2 Skelton for retropc emulator
3 Author : Takeda.Toshiya
4 Port to Qt : K.Ohta <whatisthis.sowhat _at_ gmail.com>
7 [ win32 main ] -> [ agar main ]
16 #include <QImageReader>
23 #include "menuclasses.h"
24 #include "mainwidget.h"
25 #include "commonclasses.h"
27 #include "emu_thread.h"
28 #include "joy_thread.h"
29 #include "draw_thread.h"
31 #include "qt_gldraw.h"
32 #include "qt_glutil_gl2_0.h"
33 #include "agar_logger.h"
35 #include "menu_disk.h"
36 #include "menu_bubble.h"
37 #include "menu_flags.h"
38 #include "dialog_movie.h"
39 #include "../avio/movie_saver.h"
43 QApplication *GuiMain = NULL;
45 // Start to define MainWindow.
46 class META_MainWindow *rMainWindow;
50 #define MAX_FONT_SIZE 32
54 std::string cpp_homedir;
55 std::string cpp_confdir;
56 std::string my_procname;
58 bool now_menuloop = false;
59 static int close_notified = 0;
63 unsigned int desktop_width;
64 unsigned int desktop_height;
66 int prev_window_mode = 0;
67 bool now_fullscreen = false;
69 int window_mode_count;
71 void Ui_MainWindow::do_set_mouse_enable(bool flag)
74 if(emu == NULL) return;
77 graphicsView->grabMouse();
80 graphicsView->releaseMouse();
87 void Ui_MainWindow::do_toggle_mouse(void)
90 if(emu == NULL) return;
92 bool flag = emu->is_mouse_enabled();
94 graphicsView->grabMouse();
97 graphicsView->releaseMouse();
105 void Object_Menu_Control::do_save_as_movie(void)
107 int fps = config.video_frame_rate;
108 emit sig_start_record_movie(fps);
111 void Object_Menu_Control::do_stop_saving_movie(void)
113 emit sig_stop_record_movie();
116 void Ui_MainWindow::rise_movie_dialog(void)
118 CSP_DialogMovie *dlg = new CSP_DialogMovie(hSaveMovieThread, using_flags);
119 dlg->setWindowTitle(QApplication::translate("CSP_DialogMovie", "Configure movie encodings", 0));
123 void Ui_MainWindow::LaunchEmuThread(void)
126 GLDrawClass *glv = this->getGraphicsView();
130 hRunEmu = new EmuThreadClass(rMainWindow, emu, using_flags, this);
131 connect(hRunEmu, SIGNAL(message_changed(QString)), this, SLOT(message_status_bar(QString)));
132 connect(hRunEmu, SIGNAL(sig_is_enable_mouse(bool)), glv, SLOT(do_set_mouse_enabled(bool)));
133 connect(glv, SIGNAL(sig_key_down(uint32_t, uint32_t, bool)), hRunEmu, SLOT(do_key_down(uint32_t, uint32_t, bool)));
134 connect(glv, SIGNAL(sig_key_up(uint32_t, uint32_t)), hRunEmu, SLOT(do_key_up(uint32_t, uint32_t)));
135 connect(this, SIGNAL(sig_quit_widgets()), glv, SLOT(do_stop_run_vm()));
138 //connect(hRunEmu, SIGNAL(sig_finished()), this, SLOT(delete_emu_thread()));
139 connect(this, SIGNAL(sig_vm_reset()), hRunEmu, SLOT(doReset()));
140 connect(this, SIGNAL(sig_vm_specialreset()), hRunEmu, SLOT(doSpecialReset()));
141 connect(this, SIGNAL(sig_vm_loadstate()), hRunEmu, SLOT(doLoadState()));
142 connect(this, SIGNAL(sig_vm_savestate()), hRunEmu, SLOT(doSaveState()));
144 connect(this, SIGNAL(sig_emu_update_config()), hRunEmu, SLOT(doUpdateConfig()));
145 connect(this, SIGNAL(sig_emu_update_volume_level(int, int)), hRunEmu, SLOT(doUpdateVolumeLevel(int, int)));
146 connect(this, SIGNAL(sig_emu_update_volume_balance(int, int)), hRunEmu, SLOT(doUpdateVolumeBalance(int, int)));
147 connect(this, SIGNAL(sig_emu_start_rec_sound()), hRunEmu, SLOT(doStartRecordSound()));
148 connect(this, SIGNAL(sig_emu_stop_rec_sound()), hRunEmu, SLOT(doStopRecordSound()));
149 connect(this, SIGNAL(sig_emu_set_display_size(int, int, int, int)), hRunEmu, SLOT(doSetDisplaySize(int, int, int, int)));
152 #if defined(USE_FD1) || defined(USE_FD2) || defined(USE_FD3) || defined(USE_FD4) || \
153 defined(USE_FD5) || defined(USE_FD6) || defined(USE_FD7) || defined(USE_FD8)
154 connect(this, SIGNAL(sig_write_protect_disk(int, bool)), hRunEmu, SLOT(do_write_protect_disk(int, bool)));
155 connect(this, SIGNAL(sig_open_disk(int, QString, int)), hRunEmu, SLOT(do_open_disk(int, QString, int)));
156 connect(this, SIGNAL(sig_close_disk(int)), hRunEmu, SLOT(do_close_disk(int)));
157 connect(hRunEmu, SIGNAL(sig_update_recent_disk(int)), this, SLOT(do_update_recent_disk(int)));
158 connect(hRunEmu, SIGNAL(sig_change_osd_fd(int, QString)), this, SLOT(do_change_osd_fd(int, QString)));
160 # if defined(USE_FD1)
163 # if defined(USE_FD2)
166 # if defined(USE_FD3)
169 # if defined(USE_FD4)
172 # if defined(USE_FD5)
175 # if defined(USE_FD6)
178 # if defined(USE_FD7)
181 # if defined(USE_FD8)
184 for(int ii = 0; ii < drvs; ii++) {
185 menu_fds[ii]->setEmu(emu);
186 connect(menu_fds[ii], SIGNAL(sig_update_inner_fd(int ,QStringList , class Action_Control **, QStringList , int, bool)),
187 this, SLOT(do_update_inner_fd(int ,QStringList , class Action_Control **, QStringList , int, bool)));
190 #if defined(USE_TAPE)
191 connect(this, SIGNAL(sig_play_tape(QString)), hRunEmu, SLOT(do_play_tape(QString)));
192 connect(this, SIGNAL(sig_rec_tape(QString)), hRunEmu, SLOT(do_rec_tape(QString)));
193 connect(this, SIGNAL(sig_close_tape(void)), hRunEmu, SLOT(do_close_tape(void)));
194 connect(hRunEmu, SIGNAL(sig_change_osd_cmt(QString)), this, SLOT(do_change_osd_cmt(QString)));
195 # if defined(USE_TAPE_BUTTON)
196 connect(this, SIGNAL(sig_cmt_push_play(void)), hRunEmu, SLOT(do_cmt_push_play(void)));
197 connect(this, SIGNAL(sig_cmt_push_stop(void)), hRunEmu, SLOT(do_cmt_push_stop(void)));
198 connect(this, SIGNAL(sig_cmt_push_fast_forward(void)), hRunEmu, SLOT(do_cmt_push_fast_forward(void)));
199 connect(this, SIGNAL(sig_cmt_push_fast_rewind(void)), hRunEmu, SLOT(do_cmt_push_fast_rewind(void)));
200 connect(this, SIGNAL(sig_cmt_push_apss_forward(void)), hRunEmu, SLOT(do_cmt_push_apss_forward(void)));
201 connect(this, SIGNAL(sig_cmt_push_apss_rewind(void)), hRunEmu, SLOT(do_cmt_push_apss_rewind(void)));
205 connect(this, SIGNAL(sig_write_protect_quickdisk(int, bool)), hRunEmu, SLOT(do_write_protect_quickdisk(int, bool)));
206 connect(this, SIGNAL(sig_open_quickdisk(int, QString)), hRunEmu, SLOT(do_open_quickdisk(int, QString)));
207 connect(this, SIGNAL(sig_close_quickdisk(int)), hRunEmu, SLOT(do_close_quickdisk(int)));
208 connect(hRunEmu, SIGNAL(sig_change_osd_qd(int, QString)), this, SLOT(do_change_osd_qd(int, QString)));
210 #if defined(USE_CART1)
211 connect(this, SIGNAL(sig_open_cart(int, QString)), hRunEmu, SLOT(do_open_cart(int, QString)));
212 connect(this, SIGNAL(sig_close_cart(int)), hRunEmu, SLOT(do_close_cart(int)));
214 #if defined(USE_COMPACT_DISC)
215 connect(this, SIGNAL(sig_open_cdrom(QString)), hRunEmu, SLOT(do_open_cdrom(QString)));
216 connect(this, SIGNAL(sig_close_cdrom()), hRunEmu, SLOT(do_eject_cdrom()));
217 connect(hRunEmu, SIGNAL(sig_change_osd_cdrom(QString)), this, SLOT(do_change_osd_cdrom(QString)));
219 #if defined(USE_LASER_DISK)
220 connect(this, SIGNAL(sig_open_laser_disk(QString)), hRunEmu, SLOT(do_open_laser_disk(QString)));
221 connect(this, SIGNAL(sig_close_laser_disk(void)), hRunEmu, SLOT(do_close_laser_disk(void)));
223 #if defined(USE_BINARY_FILE1)
224 connect(this, SIGNAL(sig_load_binary(int, QString)), hRunEmu, SLOT(do_load_binary(int, QString)));
225 connect(this, SIGNAL(sig_save_binary(int, QString)), hRunEmu, SLOT(do_save_binary(int, QString)));
227 #if defined(USE_BUBBLE1)
228 connect(this, SIGNAL(sig_write_protect_bubble(int, bool)), hRunEmu, SLOT(do_write_protect_bubble_casette(int, bool)));
229 connect(this, SIGNAL(sig_open_bubble(int, QString, int)), hRunEmu, SLOT(do_open_bubble_casette(int, QString, int)));
230 connect(this, SIGNAL(sig_close_bubble(int)), hRunEmu, SLOT(do_close_bubble_casette(int)));
231 connect(hRunEmu, SIGNAL(sig_update_recent_bubble(int)), this, SLOT(do_update_recent_bubble(int)));
232 connect(hRunEmu, SIGNAL(sig_change_osd_bubble(int, QString)), this, SLOT(do_change_osd_bubble(int, QString)));
234 # if defined(USE_BUBBLE1)
237 # if defined(USE_BUBBLE2)
240 for(int ii = 0; ii < drvs; ii++) {
241 menu_bubbles[ii]->setEmu(emu);
242 connect(menu_bubbles[ii],
243 SIGNAL(sig_update_inner_bubble(int ,QStringList , class Action_Control **, QStringList , int, bool)),
245 SLOT(do_update_inner_bubble(int ,QStringList , class Action_Control **, QStringList , int, bool)));
249 connect(this, SIGNAL(quit_emu_thread()), hRunEmu, SLOT(doExit()));
250 connect(hRunEmu, SIGNAL(sig_mouse_enable(bool)),
251 this, SLOT(do_set_mouse_enable(bool)));
252 #ifdef USE_TAPE_BUTTON
253 hRunEmu->set_tape_play(false);
255 #ifdef USE_LED_DEVICE
256 connect(hRunEmu, SIGNAL(sig_send_data_led(quint32)), this, SLOT(do_recv_data_led(quint32)));
259 connect(this, SIGNAL(sig_start_auto_key(QString)), hRunEmu, SLOT(do_start_auto_key(QString)));
260 connect(this, SIGNAL(sig_stop_auto_key()), hRunEmu, SLOT(do_stop_auto_key()));
262 //connect(actionExit_Emulator, SIGNAL(triggered()), hRunEmu, SLOT(doExit()));
263 AGAR_DebugLog(AGAR_LOG_DEBUG, "EmuThread : Start.");
264 objNameStr = QString("EmuThreadClass");
265 hRunEmu->setObjectName(objNameStr);
267 hDrawEmu = new DrawThreadClass(emu, emu->get_osd(), this);
268 emu->set_parent_handler(hRunEmu, hDrawEmu);
270 #ifdef ONE_BOARD_MICRO_COMPUTER
271 QImageReader *reader = new QImageReader(":/background.png");
272 QImage *result = new QImage(reader->read()); // this acts as a default if the size is not matched
273 glv->updateBitmap(result);
274 emu->get_osd()->upload_bitmap(result);
277 emu->get_osd()->set_buttons();
279 AGAR_DebugLog(AGAR_LOG_DEBUG, "DrawThread : Start.");
280 connect(hDrawEmu, SIGNAL(sig_draw_frames(int)), hRunEmu, SLOT(print_framerate(int)));
281 connect(hRunEmu, SIGNAL(window_title_changed(QString)), this, SLOT(do_set_window_title(QString)));
282 connect(hDrawEmu, SIGNAL(message_changed(QString)), this, SLOT(message_status_bar(QString)));
283 connect(actionCapture_Screen, SIGNAL(triggered()), glv, SLOT(do_save_frame_screen()));
285 connect(hRunEmu, SIGNAL(sig_draw_thread(bool)), hDrawEmu, SLOT(doDraw(bool)));
286 //connect(hRunEmu, SIGNAL(quit_draw_thread()), hDrawEmu, SLOT(doExit()));
287 connect(this, SIGNAL(quit_draw_thread()), hDrawEmu, SLOT(doExit()));
289 connect(glv, SIGNAL(sig_draw_timing(bool)), hRunEmu, SLOT(do_draw_timing(bool)));
290 connect(hDrawEmu, SIGNAL(sig_draw_timing(bool)), hRunEmu, SLOT(do_draw_timing(bool)));
292 connect(glv, SIGNAL(do_notify_move_mouse(int, int)),
293 hRunEmu, SLOT(moved_mouse(int, int)));
294 connect(glv, SIGNAL(do_notify_button_pressed(Qt::MouseButton)),
295 hRunEmu, SLOT(button_pressed_mouse(Qt::MouseButton)));
296 connect(glv, SIGNAL(do_notify_button_released(Qt::MouseButton)),
297 hRunEmu, SLOT(button_released_mouse(Qt::MouseButton)));
299 connect(glv, SIGNAL(sig_toggle_mouse(void)),
300 this, SLOT(do_toggle_mouse(void)));
302 connect(hRunEmu, SIGNAL(sig_resize_screen(int, int)),
303 glv, SLOT(resizeGL(int, int)));
305 connect(glv, SIGNAL(sig_resize_uibar(int, int)),
306 this, SLOT(resize_statusbar(int, int)));
307 connect(hRunEmu, SIGNAL(sig_resize_uibar(int, int)),
308 this, SLOT(resize_statusbar(int, int)));
310 connect(emu->get_osd(), SIGNAL(sig_req_encueue_video(int, int, int)),
311 hDrawEmu, SLOT(do_req_encueue_video(int, int, int)));
312 connect(hRunEmu, SIGNAL(sig_finished()), glv, SLOT(releaseKeyCode(void)));
313 connect(hRunEmu, SIGNAL(sig_finished()), this, SLOT(delete_emu_thread()));
314 objNameStr = QString("EmuDrawThread");
315 hDrawEmu->setObjectName(objNameStr);
317 AGAR_DebugLog(AGAR_LOG_DEBUG, "DrawThread : Launch done.");
319 hSaveMovieThread = new MOVIE_SAVER(640, 400, 30, emu->get_osd());
321 connect(actionStart_Record_Movie->binds, SIGNAL(sig_start_record_movie(int)), hRunEmu, SLOT(doStartRecordVideo(int)));
322 connect(this, SIGNAL(sig_start_saving_movie()),
323 actionStart_Record_Movie->binds, SLOT(do_save_as_movie()));
324 connect(actionStart_Record_Movie, SIGNAL(triggered()), this, SLOT(do_start_saving_movie()));
326 connect(actionStop_Record_Movie->binds, SIGNAL(sig_stop_record_movie()), hRunEmu, SLOT(doStopRecordVideo()));
327 connect(this, SIGNAL(sig_stop_saving_movie()), actionStop_Record_Movie->binds, SLOT(do_stop_saving_movie()));
328 connect(actionStop_Record_Movie, SIGNAL(triggered()), this, SLOT(do_stop_saving_movie()));
330 connect(emu->get_osd(), SIGNAL(sig_save_as_movie(QString, int, int)),
331 hSaveMovieThread, SLOT(do_open(QString, int, int)));
332 connect(emu->get_osd(), SIGNAL(sig_stop_saving_movie()), hSaveMovieThread, SLOT(do_close()));
334 actionStop_Record_Movie->setIcon(QIcon(":/icon_process_stop.png"));
335 actionStop_Record_Movie->setVisible(false);
337 connect(this, SIGNAL(sig_movie_set_width(int)), hSaveMovieThread, SLOT(do_set_width(int)));
338 connect(this, SIGNAL(sig_movie_set_height(int)), hSaveMovieThread, SLOT(do_set_height(int)));
340 connect(emu->get_osd(), SIGNAL(sig_movie_set_width(int)), hSaveMovieThread, SLOT(do_set_width(int)));
341 connect(emu->get_osd(), SIGNAL(sig_movie_set_height(int)), hSaveMovieThread, SLOT(do_set_height(int)));
343 connect(emu->get_osd(), SIGNAL(sig_enqueue_audio(int16_t*, int)), hSaveMovieThread, SLOT(enqueue_audio(int16_t *, int)));
344 connect(emu->get_osd(), SIGNAL(sig_enqueue_video(QImage *)), hSaveMovieThread, SLOT(enqueue_video(QImage *)));
345 connect(glv->extfunc, SIGNAL(sig_push_image_to_movie(QImage *)), hSaveMovieThread, SLOT(enqueue_video(QImage *)));
346 connect(this, SIGNAL(sig_quit_movie_thread()), hSaveMovieThread, SLOT(do_exit()));
348 objNameStr = QString("EmuMovieThread");
349 hSaveMovieThread->setObjectName(objNameStr);
350 hSaveMovieThread->start();
351 AGAR_DebugLog(AGAR_LOG_DEBUG, "MovieThread : Launch done.");
353 connect(action_SetupMovie, SIGNAL(triggered()), this, SLOT(rise_movie_dialog()));
357 AGAR_DebugLog(AGAR_LOG_DEBUG, "EmuThread : Launch done.");
358 this->set_screen_aspect(config.window_stretch_type);
359 emit sig_movie_set_width(SCREEN_WIDTH);
360 emit sig_movie_set_height(SCREEN_HEIGHT);
363 void Ui_MainWindow::LaunchJoyThread(void)
365 #if defined(USE_JOYSTICK)
366 hRunJoy = new JoyThreadClass(emu, emu->get_osd(), using_flags);
367 connect(this, SIGNAL(quit_joy_thread()), hRunJoy, SLOT(doExit()));
368 hRunJoy->setObjectName("JoyThread");
373 void Ui_MainWindow::StopJoyThread(void)
375 #if defined(USE_JOYSTICK)
376 emit quit_joy_thread();
380 void Ui_MainWindow::delete_joy_thread(void)
382 // delete hRunJoyThread;
386 void Ui_MainWindow::on_actionExit_triggered()
388 save_config(create_local_path(_T("%s.ini"), _T(CONFIG_NAME)));
389 OnMainWindowClosed();
392 void Ui_MainWindow::OnWindowRedraw(void)
395 //emu->update_screen();
399 void Ui_MainWindow::OnWindowMove(void)
408 bool Ui_MainWindow::GetPowerState(void)
410 if(close_notified == 0) return true;
415 void Ui_MainWindow::OnMainWindowClosed(void)
420 if(!close_notified) {
422 emu->notify_power_off();
429 if(statusUpdateTimer != NULL) statusUpdateTimer->stop();
430 #ifdef USE_LED_DEVICE
431 if(ledUpdateTimer != NULL) ledUpdateTimer->stop();
433 emit quit_draw_thread();
434 emit quit_joy_thread();
435 emit quit_emu_thread();
436 emit sig_quit_movie_thread();
437 emit sig_quit_widgets();
439 if(hSaveMovieThread != NULL) {
440 hSaveMovieThread->wait();
441 delete hSaveMovieThread;
444 if(hDrawEmu != NULL) {
448 if(hRunEmu != NULL) {
452 #if defined(USE_JOYSTICK)
453 if(hRunJoy != NULL) {
458 do_release_emu_resources();
462 //ChangeDisplaySettings(NULL, 0);
464 now_fullscreen = false;
470 void LostFocus(QWidget *widget)
473 emu->key_lost_focus();
479 void Ui_MainWindow::do_release_emu_resources(void)
487 extern void get_long_full_path_name(_TCHAR* src, _TCHAR* dst);
488 extern _TCHAR* get_parent_dir(_TCHAR* file);
489 extern void get_short_filename(_TCHAR *dst, _TCHAR *file, int maxlen);
492 static void setup_logs(void)
501 my_procname = my_procname + CONFIG_NAME;
502 #if defined(Q_OS_WIN)
507 #if !defined(Q_OS_WIN)
508 p = SDL_getenv("HOME");
510 p = SDL_getenv("PWD");
517 tmpstr = "Warning : Can't get HOME directory...Making conf on " + cpp_homedir + delim;
518 perror(tmpstr.c_str());
525 cpp_homedir = cpp_homedir + delim;
527 cpp_confdir = cpp_homedir + my_procname + delim;
529 cpp_confdir = cpp_homedir + ".config" + delim + my_procname + delim;
533 AGAR_OpenLog(bLogSYSLOG, bLogSTDOUT, DEVICE_NAME); // Write to syslog, console
536 #if defined(__x86_64__)
539 #if defined(__i386__)
542 AGAR_DebugLog(AGAR_LOG_INFO, "Start Common Source Project '%s'", my_procname.c_str());
543 AGAR_DebugLog(AGAR_LOG_INFO, "(C) Toshiya Takeda / Qt Version K.Ohta");
544 AGAR_DebugLog(AGAR_LOG_INFO, "Architecture: %s", archstr.c_str());
546 //AGAR_DebugLog(AGAR_LOG_INFO, " -? is print help(s).");
547 AGAR_DebugLog(AGAR_LOG_DEBUG, "Moduledir = %s home = %s", cpp_confdir.c_str(), cpp_homedir.c_str()); // Debug
548 #if !defined(Q_OS_CYGWIN)
551 dir.mkdir( QString::fromStdString(cpp_confdir));
554 //AG_MkPath(cpp_confdir.c_str());
557 #if defined(_USE_AGAR) || defined(_USE_QT)
558 sRssDir = "/usr/local/share/";
560 sRssDir = "." + delim;
562 sRssDir = sRssDir + "CommonSourceCodeProject" + delim + my_procname;
568 int MainLoop(int argc, char *argv[])
573 char homedir[PATH_MAX];
577 cpp_homedir.copy(homedir, PATH_MAX - 1, 0);
582 #if defined(USE_SDL2)
583 SDL_Init(SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER);
585 SDL_Init(SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);
586 //SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO);
588 AGAR_DebugLog(AGAR_LOG_DEBUG, "Audio and JOYSTICK subsystem was initialised.");
589 GuiMain = new QApplication(argc, argv);
591 load_config(create_local_path(_T("%s.ini"), _T(CONFIG_NAME)));
593 USING_FLAGS *using_flags = new USING_FLAGS;
594 rMainWindow = new META_MainWindow(using_flags);
595 rMainWindow->connect(rMainWindow, SIGNAL(sig_quit_all(void)), rMainWindow, SLOT(deleteLater(void)));
596 rMainWindow->setCoreApplication(GuiMain);
598 AGAR_DebugLog(AGAR_LOG_DEBUG, "InitInstance() OK.");
602 // initialize emulation core
603 rMainWindow->getWindow()->show();
604 emu = new EMU(rMainWindow, rMainWindow->getGraphicsView(), using_flags);
605 using_flags->set_emu(emu);
606 using_flags->set_osd(emu->get_osd());
608 #ifdef SUPPORT_DRAG_DROP
609 // open command line path
610 // if(szCmdLine[0]) {
611 // if(szCmdLine[0] == _T('"')) {
612 // int len = strlen(szCmdLine);
613 // szCmdLine[len - 1] = _T('\0');
616 // _TCHAR path[_MAX_PATH];
617 // get_long_full_path_name(szCmdLine, path);
618 // open_any_file(path);
625 GLDrawClass *pgl = rMainWindow->getGraphicsView();
627 pgl->setFixedSize(pgl->width(), pgl->height());
629 #if defined(USE_JOYSTICK)
630 rMainWindow->LaunchJoyThread();
632 rMainWindow->LaunchEmuThread();
633 QObject::connect(GuiMain, SIGNAL(lastWindowClosed()),
634 rMainWindow, SLOT(on_actionExit_triggered()));
639 void Ui_MainWindow::do_update_inner_fd(int drv, QStringList base, class Action_Control **action_select_media_list,
640 QStringList lst, int num, bool use_d88_menus)
644 for(int ii = 0; ii < using_flags->get_max_d88_banks(); ii++) {
645 if(ii < emu->d88_file[drv].bank_num) {
646 base << lst.value(ii);
647 action_select_media_list[ii]->setText(lst.value(ii));
648 action_select_media_list[ii]->setVisible(true);
649 if(ii == num) action_select_media_list[ii]->setChecked(true);
651 if(action_select_media_list[ii] != NULL) {
652 action_select_media_list[ii]->setText(QString::fromUtf8(""));
653 action_select_media_list[ii]->setVisible(false);
661 void Ui_MainWindow::do_update_inner_bubble(int drv, QStringList base, class Action_Control **action_select_media_list,
662 QStringList lst, int num, bool use_d88_menus)
664 #if defined(USE_BUBBLE1)
666 for(int ii = 0; ii < using_flags->get_max_b77_banks(); ii++) {
667 if(ii < emu->b77_file[drv].bank_num) {
668 base << lst.value(ii);
669 action_select_media_list[ii]->setText(lst.value(ii));
670 action_select_media_list[ii]->setVisible(true);
671 if(ii == num) action_select_media_list[ii]->setChecked(true);
673 if(action_select_media_list[ii] != NULL) {
674 action_select_media_list[ii]->setText(QString::fromUtf8(""));
675 action_select_media_list[ii]->setVisible(false);
684 #include <../debugger/qt_debugger.h>
686 void Ui_MainWindow::OnOpenDebugger(int no)
688 if((no < 0) || (no > 3)) return;
689 //emu->open_debugger(no);
690 VM *vm = emu->get_vm();
692 if(emu->now_debugging) this->OnCloseDebugger();
693 if(!(emu->now_debugging && emu->debugger_thread_param.cpu_index == no)) {
694 //emu->close_debugger();
695 if(vm->get_cpu(no) != NULL && vm->get_cpu(no)->get_debugger() != NULL) {
697 emu->hDebugger = new CSP_Debugger(this);
698 QString objNameStr = QString("EmuDebugThread");
699 emu->hDebugger->setObjectName(objNameStr);
700 emu->hDebugger->debugger_thread_param.osd = emu->get_osd();
701 emu->hDebugger->debugger_thread_param.vm = vm;
702 emu->hDebugger->debugger_thread_param.cpu_index = no;
703 emu->stop_record_sound();
704 emu->stop_record_video();
705 emu->now_debugging = true;
706 connect(this, SIGNAL(quit_debugger_thread()), emu->hDebugger, SLOT(doExit()));
707 //connect(this, SIGNAL(quit_debugger_thread()), emu->hDebugger, SLOT(close()));
708 connect(emu->hDebugger, SIGNAL(sig_finished()), this, SLOT(OnCloseDebugger()));
709 connect(emu->hDebugger, SIGNAL(sig_put_string(QString)), emu->hDebugger, SLOT(put_string(QString)));
710 emu->hDebugger->show();
711 emu->hDebugger->run();
716 void Ui_MainWindow::OnCloseDebugger(void )
719 // emu->close_debugger();
720 if(emu->now_debugging) {
721 if(emu->hDebugger->debugger_thread_param.running) {
722 emit quit_debugger_thread();
723 //emu->hDebugger->wait();
725 delete emu->hDebugger;
726 emu->hDebugger = NULL;
727 emu->now_debugging = false;