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 "agar_logger.h"
34 #include "menu_disk.h"
35 #include "menu_bubble.h"
36 #include "menu_flags.h"
37 #include "../avio/movie_saver.h"
41 QApplication *GuiMain = NULL;
42 extern USING_FLAGS *using_flags;
44 // Start to define MainWindow.
45 class META_MainWindow *rMainWindow;
49 #define MAX_FONT_SIZE 32
53 std::string cpp_homedir;
54 std::string cpp_confdir;
55 std::string my_procname;
57 bool now_menuloop = false;
58 static int close_notified = 0;
62 unsigned int desktop_width;
63 unsigned int desktop_height;
65 int prev_window_mode = 0;
66 bool now_fullscreen = false;
68 int window_mode_count;
70 void Ui_MainWindow::do_set_mouse_enable(bool flag)
73 if(emu == NULL) return;
76 graphicsView->grabMouse();
79 graphicsView->releaseMouse();
86 void Ui_MainWindow::do_toggle_mouse(void)
89 if(emu == NULL) return;
91 bool flag = emu->is_mouse_enabled();
93 graphicsView->grabMouse();
96 graphicsView->releaseMouse();
103 void Object_Menu_Control::do_save_as_movie(void)
106 QDateTime nowTime = QDateTime::currentDateTime();
107 QString tmps = nowTime.toString(QString::fromUtf8("yyyy-MM-dd_hh-mm-ss.zzz."));
108 QString path = QString::fromUtf8("Saved_Movie_") + tmps + QString::fromUtf8("mp4");
109 if(emu->get_osd() == NULL) return;
110 path = QString::fromLocal8Bit(emu->get_osd()->get_app_path()) + path;
112 int num = getNumber();
113 if((num <= 0) || (num > 75)) return;
115 emit sig_start_record_movie(fps);
116 emit sig_save_as_movie(path, fps);
119 void Object_Menu_Control::do_stop_saving_movie(void)
121 emit sig_stop_record_movie();
122 emit sig_stop_saving_movie();
125 void Ui_MainWindow::LaunchEmuThread(void)
128 GLDrawClass *glv = this->getGraphicsView();
132 hRunEmu = new EmuThreadClass(rMainWindow, emu, this);
133 connect(hRunEmu, SIGNAL(message_changed(QString)), this, SLOT(message_status_bar(QString)));
134 connect(hRunEmu, SIGNAL(sig_is_enable_mouse(bool)), glv, SLOT(do_set_mouse_enabled(bool)));
135 connect(glv, SIGNAL(sig_key_down(uint32_t, uint32_t, bool)), hRunEmu, SLOT(do_key_down(uint32_t, uint32_t, bool)));
136 connect(glv, SIGNAL(sig_key_up(uint32_t, uint32_t)), hRunEmu, SLOT(do_key_up(uint32_t, uint32_t)));
137 connect(this, SIGNAL(sig_quit_widgets()), glv, SLOT(do_stop_run_vm()));
140 //connect(hRunEmu, SIGNAL(sig_finished()), this, SLOT(delete_emu_thread()));
141 connect(this, SIGNAL(sig_vm_reset()), hRunEmu, SLOT(doReset()));
142 connect(this, SIGNAL(sig_vm_specialreset()), hRunEmu, SLOT(doSpecialReset()));
143 connect(this, SIGNAL(sig_vm_loadstate()), hRunEmu, SLOT(doLoadState()));
144 connect(this, SIGNAL(sig_vm_savestate()), hRunEmu, SLOT(doSaveState()));
146 connect(this, SIGNAL(sig_emu_update_config()), hRunEmu, SLOT(doUpdateConfig()));
147 connect(this, SIGNAL(sig_emu_update_volume_level(int, int)), hRunEmu, SLOT(doUpdateVolumeLevel(int, int)));
148 connect(this, SIGNAL(sig_emu_update_volume_balance(int, int)), hRunEmu, SLOT(doUpdateVolumeBalance(int, int)));
149 connect(this, SIGNAL(sig_emu_start_rec_sound()), hRunEmu, SLOT(doStartRecordSound()));
150 connect(this, SIGNAL(sig_emu_stop_rec_sound()), hRunEmu, SLOT(doStopRecordSound()));
151 connect(this, SIGNAL(sig_emu_set_display_size(int, int, int, int)), hRunEmu, SLOT(doSetDisplaySize(int, int, int, int)));
154 #if defined(USE_FD1) || defined(USE_FD2) || defined(USE_FD3) || defined(USE_FD4) || \
155 defined(USE_FD5) || defined(USE_FD6) || defined(USE_FD7) || defined(USE_FD8)
156 connect(this, SIGNAL(sig_write_protect_disk(int, bool)), hRunEmu, SLOT(do_write_protect_disk(int, bool)));
157 connect(this, SIGNAL(sig_open_disk(int, QString, int)), hRunEmu, SLOT(do_open_disk(int, QString, int)));
158 connect(this, SIGNAL(sig_close_disk(int)), hRunEmu, SLOT(do_close_disk(int)));
159 connect(hRunEmu, SIGNAL(sig_update_recent_disk(int)), this, SLOT(do_update_recent_disk(int)));
160 connect(hRunEmu, SIGNAL(sig_change_osd_fd(int, QString)), this, SLOT(do_change_osd_fd(int, QString)));
162 # if defined(USE_FD1)
165 # if defined(USE_FD2)
168 # if defined(USE_FD3)
171 # if defined(USE_FD4)
174 # if defined(USE_FD5)
177 # if defined(USE_FD6)
180 # if defined(USE_FD7)
183 # if defined(USE_FD8)
186 for(int ii = 0; ii < drvs; ii++) {
187 menu_fds[ii]->setEmu(emu);
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);
245 connect(this, SIGNAL(quit_emu_thread()), hRunEmu, SLOT(doExit()));
246 connect(hRunEmu, SIGNAL(sig_mouse_enable(bool)),
247 this, SLOT(do_set_mouse_enable(bool)));
248 #ifdef USE_TAPE_BUTTON
249 hRunEmu->set_tape_play(false);
251 #ifdef USE_LED_DEVICE
252 connect(hRunEmu, SIGNAL(sig_send_data_led(quint32)), this, SLOT(do_recv_data_led(quint32)));
255 connect(this, SIGNAL(sig_start_auto_key(QString)), hRunEmu, SLOT(do_start_auto_key(QString)));
256 connect(this, SIGNAL(sig_stop_auto_key()), hRunEmu, SLOT(do_stop_auto_key()));
258 //connect(actionExit_Emulator, SIGNAL(triggered()), hRunEmu, SLOT(doExit()));
259 AGAR_DebugLog(AGAR_LOG_DEBUG, "EmuThread : Start.");
260 objNameStr = QString("EmuThreadClass");
261 hRunEmu->setObjectName(objNameStr);
263 hDrawEmu = new DrawThreadClass(emu, emu->get_osd(), this);
264 emu->set_parent_handler(hRunEmu, hDrawEmu);
266 #ifdef ONE_BOARD_MICRO_COMPUTER
267 QImageReader *reader = new QImageReader(":/background.png");
268 QImage *result = new QImage(reader->read()); // this acts as a default if the size is not matched
269 glv->updateBitmap(result);
273 AGAR_DebugLog(AGAR_LOG_DEBUG, "DrawThread : Start.");
274 connect(hDrawEmu, SIGNAL(sig_draw_frames(int)), hRunEmu, SLOT(print_framerate(int)));
275 connect(hRunEmu, SIGNAL(window_title_changed(QString)), this, SLOT(do_set_window_title(QString)));
276 connect(hDrawEmu, SIGNAL(message_changed(QString)), this, SLOT(message_status_bar(QString)));
277 connect(actionCapture_Screen, SIGNAL(triggered()), glv, SLOT(do_save_frame_screen()));
279 connect(hRunEmu, SIGNAL(sig_draw_thread(bool)), hDrawEmu, SLOT(doDraw(bool)));
280 //connect(hRunEmu, SIGNAL(quit_draw_thread()), hDrawEmu, SLOT(doExit()));
281 connect(this, SIGNAL(quit_draw_thread()), hDrawEmu, SLOT(doExit()));
283 connect(glv, SIGNAL(sig_draw_timing(bool)), hRunEmu, SLOT(do_draw_timing(bool)));
284 connect(hDrawEmu, SIGNAL(sig_draw_timing(bool)), hRunEmu, SLOT(do_draw_timing(bool)));
286 connect(glv, SIGNAL(do_notify_move_mouse(int, int)),
287 hRunEmu, SLOT(moved_mouse(int, int)));
288 connect(glv, SIGNAL(do_notify_button_pressed(Qt::MouseButton)),
289 hRunEmu, SLOT(button_pressed_mouse(Qt::MouseButton)));
290 connect(glv, SIGNAL(do_notify_button_released(Qt::MouseButton)),
291 hRunEmu, SLOT(button_released_mouse(Qt::MouseButton)));
293 connect(glv, SIGNAL(sig_toggle_mouse(void)),
294 this, SLOT(do_toggle_mouse(void)));
296 connect(hRunEmu, SIGNAL(sig_resize_screen(int, int)),
297 glv, SLOT(resizeGL(int, int)));
299 connect(glv, SIGNAL(sig_resize_uibar(int, int)),
300 this, SLOT(resize_statusbar(int, int)));
301 connect(hRunEmu, SIGNAL(sig_resize_uibar(int, int)),
302 this, SLOT(resize_statusbar(int, int)));
304 connect(hRunEmu, SIGNAL(sig_finished()), glv, SLOT(releaseKeyCode(void)));
305 connect(hRunEmu, SIGNAL(sig_finished()), this, SLOT(delete_emu_thread()));
306 objNameStr = QString("EmuDrawThread");
307 hDrawEmu->setObjectName(objNameStr);
309 AGAR_DebugLog(AGAR_LOG_DEBUG, "DrawThread : Launch done.");
311 hSaveMovieThread = new MOVIE_SAVER(640, 400, 30, emu->get_osd());
312 for(int i = 0; i < (CSP_MAINWIDGET_SAVE_MOVIE_END - 1); i++) {
313 connect(action_SaveAsMovie[i]->binds, SIGNAL(sig_save_as_movie(QString, int)), hSaveMovieThread, SLOT(do_open(QString, int)));
314 connect(action_SaveAsMovie[i]->binds, SIGNAL(sig_start_record_movie(int)), hRunEmu, SLOT(doStartRecordVideo(int)));
315 connect(action_SaveAsMovie[i], SIGNAL(triggered()), action_SaveAsMovie[i]->binds, SLOT(do_save_as_movie()));
316 //connect(action_SaveAsMovie[i]->binds, SIGNAL(sig_stop_record_movie()), hRunEmu, SLOT(doStopRecordVideo()));
317 //connect(action_SaveAsMovie[i]->binds, SIGNAL(sig_stop_saving_movie()), hSaveMovieThread, SLOT(do_close()));
319 //connect(action_StopSavingMovie->binds, SIGNAL(sig_start_save_as_movie(QString, int)), hSaveMovieThread, SLOT(do_open(QString, int)));
320 //connect(action_StopSavingMovie->binds, SIGNAL(sig_start_record_movie(int)), hRunEmu, SLOT(doStartRecordVideo(int)));
321 connect(action_StopSavingMovie->binds, SIGNAL(sig_stop_record_movie()), hRunEmu, SLOT(doStopRecordVideo()));
322 connect(action_StopSavingMovie->binds, SIGNAL(sig_stop_saving_movie()), hSaveMovieThread, SLOT(do_close()));
323 connect(action_StopSavingMovie, SIGNAL(triggered()), action_StopSavingMovie->binds, SLOT(do_stop_saving_movie()));
327 connect(emu->get_osd(), SIGNAL(sig_enqueue_audio(QByteArray *)), hSaveMovieThread, SLOT(enqueue_audio(QByteArray *)));
328 connect(emu->get_osd(), SIGNAL(sig_enqueue_video(QByteArray *, int, int)), hSaveMovieThread, SLOT(enqueue_video(QByteArray *, int, int)));
329 connect(this, SIGNAL(sig_quit_movie_thread()), hSaveMovieThread, SLOT(do_exit()));
331 objNameStr = QString("EmuMovieThread");
332 hSaveMovieThread->setObjectName(objNameStr);
333 hSaveMovieThread->start();
334 AGAR_DebugLog(AGAR_LOG_DEBUG, "MovieThread : Launch done.");
337 AGAR_DebugLog(AGAR_LOG_DEBUG, "EmuThread : Launch done.");
338 this->set_screen_aspect(config.window_stretch_type);
341 void Ui_MainWindow::LaunchJoyThread(void)
343 #if defined(USE_JOYSTICK)
344 hRunJoy = new JoyThreadClass(emu, emu->get_osd(), this);
345 connect(this, SIGNAL(quit_joy_thread()), hRunJoy, SLOT(doExit()));
346 hRunJoy->setObjectName("JoyThread");
351 void Ui_MainWindow::StopJoyThread(void)
353 #if defined(USE_JOYSTICK)
354 emit quit_joy_thread();
358 void Ui_MainWindow::delete_joy_thread(void)
360 // delete hRunJoyThread;
364 void Ui_MainWindow::on_actionExit_triggered()
366 save_config(create_local_path(_T("%s.ini"), _T(CONFIG_NAME)));
367 OnMainWindowClosed();
370 void Ui_MainWindow::OnWindowRedraw(void)
373 //emu->update_screen();
377 void Ui_MainWindow::OnWindowMove(void)
386 bool Ui_MainWindow::GetPowerState(void)
388 if(close_notified == 0) return true;
393 void Ui_MainWindow::OnMainWindowClosed(void)
398 if(!close_notified) {
400 emu->notify_power_off();
407 if(statusUpdateTimer != NULL) statusUpdateTimer->stop();
408 #ifdef USE_LED_DEVICE
409 if(ledUpdateTimer != NULL) ledUpdateTimer->stop();
411 emit quit_draw_thread();
412 emit quit_joy_thread();
413 emit quit_emu_thread();
414 emit sig_quit_movie_thread();
415 emit sig_quit_widgets();
417 if(hSaveMovieThread != NULL) {
418 hSaveMovieThread->wait();
419 delete hSaveMovieThread;
422 if(hDrawEmu != NULL) {
426 if(hRunEmu != NULL) {
430 #if defined(USE_JOYSTICK)
431 if(hRunJoy != NULL) {
436 do_release_emu_resources();
440 //ChangeDisplaySettings(NULL, 0);
442 now_fullscreen = false;
448 void LostFocus(QWidget *widget)
451 emu->key_lost_focus();
457 void Ui_MainWindow::do_release_emu_resources(void)
465 extern void get_long_full_path_name(_TCHAR* src, _TCHAR* dst);
466 extern _TCHAR* get_parent_dir(_TCHAR* file);
467 extern void get_short_filename(_TCHAR *dst, _TCHAR *file, int maxlen);
470 static void setup_logs(void)
479 my_procname = my_procname + CONFIG_NAME;
480 #if defined(Q_OS_WIN)
485 #if !defined(Q_OS_WIN)
486 p = SDL_getenv("HOME");
488 p = SDL_getenv("PWD");
495 tmpstr = "Warning : Can't get HOME directory...Making conf on " + cpp_homedir + delim;
496 perror(tmpstr.c_str());
503 cpp_homedir = cpp_homedir + delim;
505 cpp_confdir = cpp_homedir + my_procname + delim;
507 cpp_confdir = cpp_homedir + ".config" + delim + my_procname + delim;
511 AGAR_OpenLog(bLogSYSLOG, bLogSTDOUT, DEVICE_NAME); // Write to syslog, console
514 #if defined(__x86_64__)
517 #if defined(__i386__)
520 AGAR_DebugLog(AGAR_LOG_INFO, "Start Common Source Project '%s'", my_procname.c_str());
521 AGAR_DebugLog(AGAR_LOG_INFO, "(C) Toshiya Takeda / Qt Version K.Ohta");
522 AGAR_DebugLog(AGAR_LOG_INFO, "Architecture: %s", archstr.c_str());
524 //AGAR_DebugLog(AGAR_LOG_INFO, " -? is print help(s).");
525 AGAR_DebugLog(AGAR_LOG_DEBUG, "Moduledir = %s home = %s", cpp_confdir.c_str(), cpp_homedir.c_str()); // Debug
526 #if !defined(Q_OS_CYGWIN)
529 dir.mkdir( QString::fromStdString(cpp_confdir));
532 //AG_MkPath(cpp_confdir.c_str());
535 #if defined(_USE_AGAR) || defined(_USE_QT)
536 sRssDir = "/usr/local/share/";
538 sRssDir = "." + delim;
540 sRssDir = sRssDir + "CommonSourceCodeProject" + delim + my_procname;
546 int MainLoop(int argc, char *argv[])
551 char homedir[PATH_MAX];
555 cpp_homedir.copy(homedir, PATH_MAX - 1, 0);
560 #if defined(USE_SDL2)
561 SDL_Init(SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER);
563 SDL_Init(SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);
564 //SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO);
566 AGAR_DebugLog(AGAR_LOG_DEBUG, "Audio and JOYSTICK subsystem was initialised.");
567 GuiMain = new QApplication(argc, argv);
569 load_config(create_local_path(_T("%s.ini"), _T(CONFIG_NAME)));
571 rMainWindow = new META_MainWindow();
572 rMainWindow->connect(rMainWindow, SIGNAL(sig_quit_all(void)), rMainWindow, SLOT(deleteLater(void)));
573 rMainWindow->setCoreApplication(GuiMain);
575 AGAR_DebugLog(AGAR_LOG_DEBUG, "InitInstance() OK.");
579 // initialize emulation core
580 rMainWindow->getWindow()->show();
581 emu = new EMU(rMainWindow, rMainWindow->getGraphicsView());
582 #ifdef SUPPORT_DRAG_DROP
583 // open command line path
584 // if(szCmdLine[0]) {
585 // if(szCmdLine[0] == _T('"')) {
586 // int len = strlen(szCmdLine);
587 // szCmdLine[len - 1] = _T('\0');
590 // _TCHAR path[_MAX_PATH];
591 // get_long_full_path_name(szCmdLine, path);
592 // open_any_file(path);
599 GLDrawClass *pgl = rMainWindow->getGraphicsView();
601 pgl->setFixedSize(pgl->width(), pgl->height());
603 #if defined(USE_JOYSTICK)
604 rMainWindow->LaunchJoyThread();
606 rMainWindow->LaunchEmuThread();
607 QObject::connect(GuiMain, SIGNAL(lastWindowClosed()),
608 rMainWindow, SLOT(on_actionExit_triggered()));
614 #include <../debugger/qt_debugger.h>
616 void Ui_MainWindow::OnOpenDebugger(int no)
618 if((no < 0) || (no > 3)) return;
619 //emu->open_debugger(no);
620 VM *vm = emu->get_vm();
622 if(emu->now_debugging) this->OnCloseDebugger();
623 if(!(emu->now_debugging && emu->debugger_thread_param.cpu_index == no)) {
624 //emu->close_debugger();
625 if(vm->get_cpu(no) != NULL && vm->get_cpu(no)->get_debugger() != NULL) {
627 emu->hDebugger = new CSP_Debugger(this);
628 QString objNameStr = QString("EmuDebugThread");
629 emu->hDebugger->setObjectName(objNameStr);
630 emu->hDebugger->debugger_thread_param.osd = emu->get_osd();
631 emu->hDebugger->debugger_thread_param.vm = vm;
632 emu->hDebugger->debugger_thread_param.cpu_index = no;
633 emu->stop_record_sound();
634 emu->stop_record_video();
635 emu->now_debugging = true;
636 connect(this, SIGNAL(quit_debugger_thread()), emu->hDebugger, SLOT(doExit()));
637 //connect(this, SIGNAL(quit_debugger_thread()), emu->hDebugger, SLOT(close()));
638 connect(emu->hDebugger, SIGNAL(sig_finished()), this, SLOT(OnCloseDebugger()));
639 connect(emu->hDebugger, SIGNAL(sig_put_string(QString)), emu->hDebugger, SLOT(put_string(QString)));
640 emu->hDebugger->show();
641 emu->hDebugger->run();
646 void Ui_MainWindow::OnCloseDebugger(void )
649 // emu->close_debugger();
650 if(emu->now_debugging) {
651 if(emu->hDebugger->debugger_thread_param.running) {
652 emit quit_debugger_thread();
653 //emu->hDebugger->wait();
655 delete emu->hDebugger;
656 emu->hDebugger = NULL;
657 emu->now_debugging = false;