#include "qt_gldraw.h"
#include "qt_glutil_gl2_0.h"
#include "csp_logger.h"
-
+#include "dock_disks.h"
#include "menu_disk.h"
#include "menu_bubble.h"
-#include "menu_flags.h"
+#include "menu_flags_ext.h"
#include "dialog_movie.h"
#include "../avio/movie_saver.h"
// emulation core
// Start to define MainWindow.
class META_MainWindow *rMainWindow;
+
// buttons
#ifdef MAX_BUTTONS
#define MAX_FONT_SIZE 32
#endif
// menu
-std::string cpp_homedir;
-std::string cpp_confdir;
-std::string my_procname;
+extern std::string cpp_homedir;
+extern DLL_PREFIX_I std::string cpp_confdir;
+extern std::string my_procname;
std::string sRssDir;
bool now_menuloop = false;
static int close_notified = 0;
dlg->setWindowTitle(QApplication::translate("CSP_DialogMovie", "Configure movie encodings", 0));
dlg->show();
}
-
void Ui_MainWindow::LaunchEmuThread(void)
{
QString objNameStr;
int drvs;
- hRunEmu = new EmuThreadClass(rMainWindow, emu, using_flags, this);
+ hRunEmu = new EmuThreadClass(rMainWindow, using_flags);
connect(hRunEmu, SIGNAL(message_changed(QString)), this, SLOT(message_status_bar(QString)));
connect(hRunEmu, SIGNAL(sig_is_enable_mouse(bool)), glv, SLOT(do_set_mouse_enabled(bool)));
connect(glv, SIGNAL(sig_key_down(uint32_t, uint32_t, bool)), hRunEmu, SLOT(do_key_down(uint32_t, uint32_t, bool)));
//connect(hRunEmu, SIGNAL(sig_finished()), this, SLOT(delete_emu_thread()));
- connect(this, SIGNAL(sig_vm_reset()), hRunEmu, SLOT(doReset()));
- connect(this, SIGNAL(sig_vm_specialreset()), hRunEmu, SLOT(doSpecialReset()));
- connect(this, SIGNAL(sig_vm_loadstate()), hRunEmu, SLOT(doLoadState()));
- connect(this, SIGNAL(sig_vm_savestate()), hRunEmu, SLOT(doSaveState()));
-
- connect(this, SIGNAL(sig_emu_update_config()), hRunEmu, SLOT(doUpdateConfig()));
- connect(this, SIGNAL(sig_emu_update_volume_level(int, int)), hRunEmu, SLOT(doUpdateVolumeLevel(int, int)));
- connect(this, SIGNAL(sig_emu_update_volume_balance(int, int)), hRunEmu, SLOT(doUpdateVolumeBalance(int, int)));
- connect(this, SIGNAL(sig_emu_start_rec_sound()), hRunEmu, SLOT(doStartRecordSound()));
- connect(this, SIGNAL(sig_emu_stop_rec_sound()), hRunEmu, SLOT(doStopRecordSound()));
- connect(this, SIGNAL(sig_emu_set_display_size(int, int, int, int)), hRunEmu, SLOT(doSetDisplaySize(int, int, int, int)));
+ connect(this, SIGNAL(sig_vm_reset()), hRunEmu, SLOT(do_reset()));
+ connect(this, SIGNAL(sig_vm_specialreset()), hRunEmu, SLOT(do_special_reset()));
+
+ connect(this, SIGNAL(sig_emu_update_config()), hRunEmu, SLOT(do_update_config()));
+ connect(this, SIGNAL(sig_emu_update_volume_level(int, int)), hRunEmu, SLOT(do_update_volume_level(int, int)));
+ connect(this, SIGNAL(sig_emu_update_volume_balance(int, int)), hRunEmu, SLOT(do_update_volume_balance(int, int)));
+ connect(this, SIGNAL(sig_emu_start_rec_sound()), hRunEmu, SLOT(do_start_record_sound()));
+ connect(this, SIGNAL(sig_emu_stop_rec_sound()), hRunEmu, SLOT(do_stop_record_sound()));
+ connect(this, SIGNAL(sig_emu_set_display_size(int, int, int, int)), hRunEmu, SLOT(do_set_display_size(int, int, int, int)));
-
+ if(using_flags->is_use_state()) {
+ for(int i = 0; i < 10; i++) {
+ connect(actionLoad_State[i], SIGNAL(sig_load_state(QString)), hRunEmu, SLOT(do_load_state(QString))); // OK?
+ connect(actionSave_State[i], SIGNAL(sig_save_state(QString)), hRunEmu, SLOT(do_save_state(QString))); // OK?
+ }
+ }
#if defined(USE_FD1) || defined(USE_FD2) || defined(USE_FD3) || defined(USE_FD4) || \
defined(USE_FD5) || defined(USE_FD6) || defined(USE_FD7) || defined(USE_FD8)
connect(this, SIGNAL(sig_write_protect_disk(int, bool)), hRunEmu, SLOT(do_write_protect_disk(int, bool)));
connect(this, SIGNAL(sig_open_disk(int, QString, int)), hRunEmu, SLOT(do_open_disk(int, QString, int)));
connect(this, SIGNAL(sig_close_disk(int)), hRunEmu, SLOT(do_close_disk(int)));
connect(hRunEmu, SIGNAL(sig_update_recent_disk(int)), this, SLOT(do_update_recent_disk(int)));
- connect(hRunEmu, SIGNAL(sig_change_osd_fd(int, QString)), this, SLOT(do_change_osd_fd(int, QString)));
+ //connect(hRunEmu, SIGNAL(sig_change_osd_fd(int, QString)), this, SLOT(do_change_osd_fd(int, QString)));
drvs = 0;
# if defined(USE_FD1)
drvs = 1;
this, SLOT(do_update_inner_fd(int ,QStringList , class Action_Control **, QStringList , int, bool)));
}
#endif
-#if defined(USE_TAPE)
- connect(this, SIGNAL(sig_play_tape(QString)), hRunEmu, SLOT(do_play_tape(QString)));
- connect(this, SIGNAL(sig_rec_tape(QString)), hRunEmu, SLOT(do_rec_tape(QString)));
- connect(this, SIGNAL(sig_close_tape(void)), hRunEmu, SLOT(do_close_tape(void)));
- connect(hRunEmu, SIGNAL(sig_change_osd_cmt(QString)), this, SLOT(do_change_osd_cmt(QString)));
+#if defined(USE_TAPE1)
+ connect(this, SIGNAL(sig_play_tape(int, QString)), hRunEmu, SLOT(do_play_tape(int, QString)));
+ connect(this, SIGNAL(sig_rec_tape(int, QString)), hRunEmu, SLOT(do_rec_tape(int, QString)));
+ connect(this, SIGNAL(sig_close_tape(int)), hRunEmu, SLOT(do_close_tape(int)));
+ //connect(hRunEmu, SIGNAL(sig_change_osd_cmt(QString)), this, SLOT(do_change_osd_cmt(QString)));
# if defined(USE_TAPE_BUTTON)
- connect(this, SIGNAL(sig_cmt_push_play(void)), hRunEmu, SLOT(do_cmt_push_play(void)));
- connect(this, SIGNAL(sig_cmt_push_stop(void)), hRunEmu, SLOT(do_cmt_push_stop(void)));
- connect(this, SIGNAL(sig_cmt_push_fast_forward(void)), hRunEmu, SLOT(do_cmt_push_fast_forward(void)));
- connect(this, SIGNAL(sig_cmt_push_fast_rewind(void)), hRunEmu, SLOT(do_cmt_push_fast_rewind(void)));
- connect(this, SIGNAL(sig_cmt_push_apss_forward(void)), hRunEmu, SLOT(do_cmt_push_apss_forward(void)));
- connect(this, SIGNAL(sig_cmt_push_apss_rewind(void)), hRunEmu, SLOT(do_cmt_push_apss_rewind(void)));
+ connect(this, SIGNAL(sig_cmt_push_play(int)), hRunEmu, SLOT(do_cmt_push_play(int)));
+ connect(this, SIGNAL(sig_cmt_push_stop(int)), hRunEmu, SLOT(do_cmt_push_stop(int)));
+ connect(this, SIGNAL(sig_cmt_push_fast_forward(int)), hRunEmu, SLOT(do_cmt_push_fast_forward(int)));
+ connect(this, SIGNAL(sig_cmt_push_fast_rewind(int)), hRunEmu, SLOT(do_cmt_push_fast_rewind(int)));
+ connect(this, SIGNAL(sig_cmt_push_apss_forward(int)), hRunEmu, SLOT(do_cmt_push_apss_forward(int)));
+ connect(this, SIGNAL(sig_cmt_push_apss_rewind(int)), hRunEmu, SLOT(do_cmt_push_apss_rewind(int)));
# endif
#endif
#if defined(USE_QD1)
connect(this, SIGNAL(sig_write_protect_quickdisk(int, bool)), hRunEmu, SLOT(do_write_protect_quickdisk(int, bool)));
connect(this, SIGNAL(sig_open_quickdisk(int, QString)), hRunEmu, SLOT(do_open_quickdisk(int, QString)));
connect(this, SIGNAL(sig_close_quickdisk(int)), hRunEmu, SLOT(do_close_quickdisk(int)));
- connect(hRunEmu, SIGNAL(sig_change_osd_qd(int, QString)), this, SLOT(do_change_osd_qd(int, QString)));
+ //connect(hRunEmu, SIGNAL(sig_change_osd_qd(int, QString)), this, SLOT(do_change_osd_qd(int, QString)));
#endif
#if defined(USE_CART1)
connect(this, SIGNAL(sig_open_cart(int, QString)), hRunEmu, SLOT(do_open_cart(int, QString)));
#if defined(USE_COMPACT_DISC)
connect(this, SIGNAL(sig_open_cdrom(QString)), hRunEmu, SLOT(do_open_cdrom(QString)));
connect(this, SIGNAL(sig_close_cdrom()), hRunEmu, SLOT(do_eject_cdrom()));
- connect(hRunEmu, SIGNAL(sig_change_osd_cdrom(QString)), this, SLOT(do_change_osd_cdrom(QString)));
+ //connect(hRunEmu, SIGNAL(sig_change_osd_cdrom(QString)), this, SLOT(do_change_osd_cdrom(QString)));
#endif
#if defined(USE_LASER_DISC)
connect(this, SIGNAL(sig_open_laserdisc(QString)), hRunEmu, SLOT(do_open_laser_disc(QString)));
connect(this, SIGNAL(sig_open_bubble(int, QString, int)), hRunEmu, SLOT(do_open_bubble_casette(int, QString, int)));
connect(this, SIGNAL(sig_close_bubble(int)), hRunEmu, SLOT(do_close_bubble_casette(int)));
connect(hRunEmu, SIGNAL(sig_update_recent_bubble(int)), this, SLOT(do_update_recent_bubble(int)));
- connect(hRunEmu, SIGNAL(sig_change_osd_bubble(int, QString)), this, SLOT(do_change_osd_bubble(int, QString)));
+ //connect(hRunEmu, SIGNAL(sig_change_osd_bubble(int, QString)), this, SLOT(do_change_osd_bubble(int, QString)));
drvs = 0;
# if defined(USE_BUBBLE1)
drvs = 1;
connect(this, SIGNAL(quit_emu_thread()), hRunEmu, SLOT(doExit()));
connect(hRunEmu, SIGNAL(sig_mouse_enable(bool)),
this, SLOT(do_set_mouse_enable(bool)));
+
+
#ifdef USE_TAPE_BUTTON
hRunEmu->set_tape_play(false);
#endif
-#ifdef USE_LED_DEVICE
+#if defined(USE_KEY_LOCKED) || defined(USE_EXTRA_LEDS)
connect(hRunEmu, SIGNAL(sig_send_data_led(quint32)), this, SLOT(do_recv_data_led(quint32)));
#endif
#ifdef USE_AUTO_KEY
objNameStr = QString("EmuThreadClass");
hRunEmu->setObjectName(objNameStr);
- hDrawEmu = new DrawThreadClass(emu, emu->get_osd(), this);
+ hDrawEmu = new DrawThreadClass(emu->get_osd(), csp_logger, this);
emu->set_parent_handler(hRunEmu, hDrawEmu);
#ifdef ONE_BOARD_MICRO_COMPUTER
QImageReader *reader = new QImageReader(":/background.png");
QImage *result = new QImage(reader->read()); // this acts as a default if the size is not matched
- glv->updateBitmap(result);
- emu->get_osd()->upload_bitmap(result);
+ QImage result2 = result->convertToFormat(QImage::Format_ARGB32);
+ glv->updateBitmap(&result2);
+ emu->get_osd()->upload_bitmap(&result2);
delete result;
delete reader;
emu->get_osd()->set_buttons();
#endif
csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "DrawThread : Start.");
connect(hDrawEmu, SIGNAL(sig_draw_frames(int)), hRunEmu, SLOT(print_framerate(int)));
+ //connect(emu->get_osd(), SIGNAL(sig_draw_frames(int)), hRunEmu, SLOT(print_framerate(int)));
connect(hRunEmu, SIGNAL(window_title_changed(QString)), this, SLOT(do_set_window_title(QString)));
connect(hDrawEmu, SIGNAL(message_changed(QString)), this, SLOT(message_status_bar(QString)));
connect(actionCapture_Screen, SIGNAL(triggered()), glv, SLOT(do_save_frame_screen()));
connect(hRunEmu, SIGNAL(sig_draw_thread(bool)), hDrawEmu, SLOT(doDraw(bool)), Qt::QueuedConnection);
+ //connect(hRunEmu, SIGNAL(sig_draw_thread(bool)), emu->get_osd(), SLOT(do_draw(bool)));
//connect(hRunEmu, SIGNAL(quit_draw_thread()), hDrawEmu, SLOT(doExit()));
connect(this, SIGNAL(quit_draw_thread()), hDrawEmu, SLOT(doExit()));
-// connect(glv, SIGNAL(sig_draw_timing(bool)), hRunEmu, SLOT(do_draw_timing(bool)));
-// connect(hDrawEmu, SIGNAL(sig_draw_timing(bool)), hRunEmu, SLOT(do_draw_timing(bool)));
-
connect(glv, SIGNAL(do_notify_move_mouse(int, int)),
hRunEmu, SLOT(moved_mouse(int, int)));
connect(glv, SIGNAL(do_notify_button_pressed(Qt::MouseButton)),
#endif
connect(hRunEmu, SIGNAL(sig_resize_screen(int, int)),
glv, SLOT(resizeGL(int, int)));
+ connect(hRunEmu, SIGNAL(sig_resize_osd(int)), driveData, SLOT(setScreenWidth(int)));
connect(glv, SIGNAL(sig_resize_uibar(int, int)),
this, SLOT(resize_statusbar(int, int)));
hSaveMovieThread = new MOVIE_SAVER(640, 400, 30, emu->get_osd(), using_flags->get_config_ptr());
- connect(actionStart_Record_Movie->binds, SIGNAL(sig_start_record_movie(int)), hRunEmu, SLOT(doStartRecordVideo(int)));
+ connect(actionStart_Record_Movie->binds, SIGNAL(sig_start_record_movie(int)), hRunEmu, SLOT(do_start_record_video(int)));
connect(this, SIGNAL(sig_start_saving_movie()),
actionStart_Record_Movie->binds, SLOT(do_save_as_movie()));
connect(actionStart_Record_Movie, SIGNAL(triggered()), this, SLOT(do_start_saving_movie()));
- connect(actionStop_Record_Movie->binds, SIGNAL(sig_stop_record_movie()), hRunEmu, SLOT(doStopRecordVideo()));
+ connect(actionStop_Record_Movie->binds, SIGNAL(sig_stop_record_movie()), hRunEmu, SLOT(do_stop_record_video()));
connect(this, SIGNAL(sig_stop_saving_movie()), actionStop_Record_Movie->binds, SLOT(do_stop_saving_movie()));
connect(hSaveMovieThread, SIGNAL(sig_set_state_saving_movie(bool)), this, SLOT(do_set_state_saving_movie(bool)));
connect(actionStop_Record_Movie, SIGNAL(triggered()), this, SLOT(do_stop_saving_movie()));
csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "MovieThread : Launch done.");
connect(action_SetupMovie, SIGNAL(triggered()), this, SLOT(rise_movie_dialog()));
-
+ connect(hRunEmu, SIGNAL(sig_change_osd(int, int, QString)), driveData, SLOT(updateMessage(int, int, QString)));
+ connect(hRunEmu, SIGNAL(sig_change_access_lamp(int, int, QString)), driveData, SLOT(updateLabel(int, int, QString)));
+ connect(hRunEmu, SIGNAL(sig_set_access_lamp(int, bool)), graphicsView, SLOT(do_display_osd_leds(int, bool)));
hRunEmu->start();
csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "EmuThread : Launch done.");
void Ui_MainWindow::LaunchJoyThread(void)
{
#if defined(USE_JOYSTICK)
- hRunJoy = new JoyThreadClass(emu, emu->get_osd(), using_flags, using_flags->get_config_ptr());
+ hRunJoy = new JoyThreadClass(emu, emu->get_osd(), using_flags, using_flags->get_config_ptr(), csp_logger);
connect(this, SIGNAL(quit_joy_thread()), hRunJoy, SLOT(doExit()));
hRunJoy->setObjectName("JoyThread");
hRunJoy->start();
void Ui_MainWindow::on_actionExit_triggered()
{
- save_config(create_local_path(_T("%s.ini"), _T(CONFIG_NAME)));
OnMainWindowClosed();
}
}
#endif
if(statusUpdateTimer != NULL) statusUpdateTimer->stop();
-#ifdef USE_LED_DEVICE
+#if defined(USE_KEY_LOCKED) || defined(USE_EXTRA_LEDS)
if(ledUpdateTimer != NULL) ledUpdateTimer->stop();
#endif
emit quit_draw_thread();
if(hSaveMovieThread != NULL) {
hSaveMovieThread->wait();
delete hSaveMovieThread;
+ hSaveMovieThread = NULL;
}
if(hDrawEmu != NULL) {
hDrawEmu->wait();
delete hDrawEmu;
+ hDrawEmu = NULL;
}
if(hRunEmu != NULL) {
+ hRunEmu->quit();
hRunEmu->wait();
delete hRunEmu;
+ save_config(create_local_path(_T("%s.ini"), _T(CONFIG_NAME)));
}
#if defined(USE_JOYSTICK)
if(hRunJoy != NULL) {
hRunJoy->wait();
delete hRunJoy;
+ hRunJoy = NULL;
}
-#endif
+#endif
do_release_emu_resources();
+ hRunEmu = NULL;
// release window
if(now_fullscreen) {
}
}
-extern void get_long_full_path_name(_TCHAR* src, _TCHAR* dst);
-extern _TCHAR* get_parent_dir(_TCHAR* file);
+extern void DLL_PREFIX_I get_long_full_path_name(_TCHAR* src, _TCHAR* dst);
+extern _TCHAR* DLL_PREFIX_I get_parent_dir(_TCHAR* file);
extern void get_short_filename(_TCHAR *dst, _TCHAR *file, int maxlen);
-
static void setup_logs(void)
{
- std::string archstr;
std::string delim;
- int bLogSYSLOG;
- int bLogSTDOUT;
char *p;
my_procname = "emu";
#else
cpp_confdir = cpp_homedir + ".config" + delim + my_procname + delim;
#endif
- bLogSYSLOG = (int)0;
- bLogSTDOUT = (int)1;
- //csp_logger = new CSP_Logger((bLogSYSLOG != 0), (bLogSTDOUT != 0), DEVICE_NAME); // Write to syslog, console
-
- archstr = "Generic";
-#if defined(__x86_64__)
- archstr = "amd64";
-#endif
-#if defined(__i386__)
- archstr = "ia32";
-#endif
-
- csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "Start Common Source Project '%s'", my_procname.c_str());
- csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "(C) Toshiya Takeda / Qt Version K.Ohta");
- csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "Architecture: %s", archstr.c_str());
- //csp_logger->debug_log(AGAR_LOG_INFO, " -? is print help(s).");
- csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "Moduledir = %s home = %s", cpp_confdir.c_str(), cpp_homedir.c_str()); // Debug
#if !defined(Q_OS_CYGWIN)
{
QDir dir;
#endif
}
-int MainLoop(int argc, char *argv[], config_t *cfg)
+CSP_Logger *csp_logger;
+
+int MainLoop(int argc, char *argv[])
{
- char c;
- char strbuf[2048];
- bool flag;
char homedir[PATH_MAX];
- int thread_ret;
- int w, h;
+ std::string archstr;
+ std::string emustr("emu");
+ std::string cfgstr(CONFIG_NAME);
setup_logs();
cpp_homedir.copy(homedir, PATH_MAX - 1, 0);
- flag = FALSE;
+
+ load_config(create_local_path(_T("%s.ini"), _T(CONFIG_NAME)));
+
+ emustr = emustr + cfgstr;
+
+ csp_logger = new CSP_Logger(config.log_to_syslog, config.log_to_console, emustr.c_str()); // Write to syslog, console
+ csp_logger->set_log_stdout(CSP_LOG_DEBUG, true);
+ csp_logger->set_log_stdout(CSP_LOG_INFO, true);
+ csp_logger->set_log_stdout(CSP_LOG_WARN, true);
+
+ archstr = "Generic";
+#if defined(__x86_64__)
+ archstr = "amd64";
+#endif
+#if defined(__i386__)
+ archstr = "ia32";
+#endif
csp_logger->set_emu_vm_name(DEVICE_NAME); // Write to syslog, console
+ csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "Start Common Source Project '%s'", my_procname.c_str());
+ csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "(C) Toshiya Takeda / Qt Version K.Ohta");
+ csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "Architecture: %s", archstr.c_str());
+
+ //csp_logger->debug_log(AGAR_LOG_INFO, " -? is print help(s).");
+ csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "Moduledir = %s home = %s", cpp_confdir.c_str(), cpp_homedir.c_str()); // Debug
/*
* Into Qt's Loop.
*/
SDL_Init(SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER);
#else
SDL_Init(SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);
- //SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO);
#endif
csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "Audio and JOYSTICK subsystem was initialised.");
GuiMain = new QApplication(argc, argv);
- load_config(create_local_path(_T("%s.ini"), _T(CONFIG_NAME)));
-
- USING_FLAGS *using_flags = new USING_FLAGS(cfg);
+ GuiMain->setObjectName(QString::fromUtf8("Gui_Main"));
+ for(int ii = 0; ii < (CSP_LOG_TYPE_VM_DEVICE_END - CSP_LOG_TYPE_VM_DEVICE_0 + 1); ii++) {
+ for(int jj = 0; jj < 8; jj++) {
+ csp_logger->set_device_node_log(ii, 1, jj, config.dev_log_to_syslog[ii][jj]);
+ csp_logger->set_device_node_log(ii, 2, jj, config.dev_log_to_console[ii][jj]);
+ csp_logger->set_device_node_log(ii, 0, jj, config.dev_log_recording[ii][jj]);
+ }
+ }
+ USING_FLAGS_EXT *using_flags = new USING_FLAGS_EXT(&config);
// initialize emulation core
- rMainWindow = new META_MainWindow(using_flags);
+
+ QTranslator local_translator;
+ QLocale s_locale;
+ if(local_translator.load(s_locale, QLatin1String("csp_qt_machine"), QLatin1String("_"), QLatin1String(":/"))) {
+ GuiMain->installTranslator(&local_translator);
+ }
+ QTranslator s_translator;
+ if(s_translator.load(s_locale, QLatin1String("csp_qt_gui"), QLatin1String("_"), QLatin1String(":/"))) {
+ GuiMain->installTranslator(&s_translator);
+ }
+
+ rMainWindow = new META_MainWindow(using_flags, csp_logger);
rMainWindow->connect(rMainWindow, SIGNAL(sig_quit_all(void)), rMainWindow, SLOT(deleteLater(void)));
rMainWindow->setCoreApplication(GuiMain);
rMainWindow->getWindow()->show();
-
- emu = new EMU(rMainWindow, rMainWindow->getGraphicsView(), using_flags);
- using_flags->set_emu(emu);
- using_flags->set_osd(emu->get_osd());
- csp_logger->set_osd(emu->get_osd());
- csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "InitInstance() OK.");
-
+
+ // main loop
+ rMainWindow->LaunchEmuThread();
+#if defined(USE_JOYSTICK)
+ rMainWindow->LaunchJoyThread();
+#endif
+ GLDrawClass *pgl = rMainWindow->getGraphicsView();
+ pgl->set_emu_launched();
+ pgl->setFixedSize(pgl->width(), pgl->height());
rMainWindow->retranselateUi_Depended_OSD();
-
QObject::connect(emu->get_osd(), SIGNAL(sig_update_device_node_name(int, const _TCHAR *)),
rMainWindow, SLOT(do_update_device_node_name(int, const _TCHAR *)));
for(int i = 0; i < (CSP_LOG_TYPE_VM_DEVICE_END - CSP_LOG_TYPE_VM_DEVICE_0 + 1); i++) {
rMainWindow->do_update_device_node_name(i, using_flags->get_vm_node_name(i));
}
-
-#ifdef SUPPORT_DRAG_DROP
- // open command line path
- // if(szCmdLine[0]) {
- // if(szCmdLine[0] == _T('"')) {
- // int len = strlen(szCmdLine);
- // szCmdLine[len - 1] = _T('\0');
- // szCmdLine++;
- // }
- // _TCHAR path[_MAX_PATH];
- // get_long_full_path_name(szCmdLine, path);
- // open_any_file(path);
- //}
-#endif
-
- // set priority
-
- // main loop
- GLDrawClass *pgl = rMainWindow->getGraphicsView();
- pgl->setEmuPtr(emu);
- pgl->setFixedSize(pgl->width(), pgl->height());
+ csp_logger->set_osd(emu->get_osd());
+ csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "InitInstance() OK.");
-#if defined(USE_JOYSTICK)
- rMainWindow->LaunchJoyThread();
-#endif
- rMainWindow->LaunchEmuThread();
QObject::connect(GuiMain, SIGNAL(lastWindowClosed()),
rMainWindow, SLOT(on_actionExit_triggered()));
+
GuiMain->exec();
return 0;
}
void Ui_MainWindow::OnOpenDebugger(int no)
{
- if((no < 0) || (no > 3)) return;
+ if((no < 0) || (no > 7)) return;
//emu->open_debugger(no);
VM *vm = emu->get_vm();
emu->stop_record_video();
emu->now_debugging = true;
connect(this, SIGNAL(quit_debugger_thread()), emu->hDebugger, SLOT(doExit()));
+ connect(this, SIGNAL(destroyed()), emu->hDebugger, SLOT(do_destroy_thread()));
//connect(this, SIGNAL(quit_debugger_thread()), emu->hDebugger, SLOT(close()));
connect(emu->hDebugger, SIGNAL(sig_finished()), this, SLOT(OnCloseDebugger()));
connect(emu->hDebugger, SIGNAL(sig_put_string(QString)), emu->hDebugger, SLOT(put_string(QString)));
}
}
#endif
+extern config_t config;
+
+#include <QApplication>
+#include <qapplication.h>
+#if defined(Q_OS_WIN)
+//DLL_PREFIX_I void CSP_DebugHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
+DLL_PREFIX_I void _resource_init(void);
+DLL_PREFIX_I void _resource_free(void);
+#else
+extern void CSP_DebugHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
+extern void _resource_init(void);
+extern void _resource_free(void);
+#endif
+void CSP_DebugHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
+{
+ QString msg_type;
+ switch (type) {
+ case QtDebugMsg:
+ msg_type = QString::fromUtf8("[Qt:DEBUG]");
+ break;
+ case QtInfoMsg:
+ msg_type = QString::fromUtf8("[Qt:INFO]");
+ break;
+ case QtWarningMsg:
+ msg_type = QString::fromUtf8("[Qt:WARN]");
+ break;
+ case QtCriticalMsg:
+ msg_type = QString::fromUtf8("[Qt:CRITICAL]");
+ break;
+ case QtFatalMsg:
+ msg_type = QString::fromUtf8("[Qt:FATAL]");
+ break;
+ }
+ QString msgString = qFormatLogMessage(type, context, msg);
+ QString nmsg_l1 = msg_type;
+ QString nmsg_l2 = msg_type;
+ nmsg_l2.append(" ");
+ nmsg_l2.append(msgString);
+ nmsg_l1.append(" In line ");
+ nmsg_l1.append(context.line);
+ nmsg_l1.append(" of ");
+ nmsg_l1.append(context.line);
+ nmsg_l1.append(" (Function: ");
+ nmsg_l1.append(context.function);
+ nmsg_l1.append(" )");
+
+ if(csp_logger != NULL) {
+ csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GUI, nmsg_l1.toLocal8Bit().constData());
+ csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GUI, nmsg_l2.toLocal8Bit().constData());
+ } else {
+ fprintf(stderr,"%s\n", nmsg_l1.toLocal8Bit().constData());
+ fprintf(stderr, "%s\n", nmsg_l2.toLocal8Bit().constData());
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ int nErrorCode;
+ /*
+ * Get current DIR
+ */
+ csp_logger = NULL;
+/*
+ * アプリケーション初期化
+ */
+ _resource_init();
+ qSetMessagePattern(QString::fromUtf8("[%{type}] %{message} \n at line %{line} of %{file} : function %{function}\nBacktrace:\n %{backtrace separator=\"\n \" }"));
+ qInstallMessageHandler(CSP_DebugHandler);
+ nErrorCode = MainLoop(argc, argv);
+ _resource_free();
+ if(csp_logger != NULL) delete csp_logger;
+
+ return nErrorCode;
+}
+
+#if defined(Q_OS_WIN)
+int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
+{
+ char *arg[1] = {""};
+ main(1, arg);
+}
+#endif