|
|
@ -32,9 +32,7 @@ GMainWindow::GMainWindow()
|
|
|
|
statusBar()->hide();
|
|
|
|
statusBar()->hide();
|
|
|
|
|
|
|
|
|
|
|
|
render_window = new GRenderWindow;
|
|
|
|
render_window = new GRenderWindow;
|
|
|
|
//render_window->setStyleSheet("background-color:black;");
|
|
|
|
render_window->hide();
|
|
|
|
ui.horizontalLayout->addWidget(render_window);
|
|
|
|
|
|
|
|
//render_window->hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
disasmWidget = new DisassemblerWidget(this, render_window->GetEmuThread());
|
|
|
|
disasmWidget = new DisassemblerWidget(this, render_window->GetEmuThread());
|
|
|
|
addDockWidget(Qt::BottomDockWidgetArea, disasmWidget);
|
|
|
|
addDockWidget(Qt::BottomDockWidgetArea, disasmWidget);
|
|
|
@ -71,15 +69,15 @@ GMainWindow::GMainWindow()
|
|
|
|
restoreState(settings.value("state").toByteArray());
|
|
|
|
restoreState(settings.value("state").toByteArray());
|
|
|
|
render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray());
|
|
|
|
render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray());
|
|
|
|
|
|
|
|
|
|
|
|
//ui.action_Popout_Window_Mode->setChecked(settings.value("popupWindowMode", false).toBool());
|
|
|
|
ui.action_Popout_Window_Mode->setChecked(settings.value("popoutWindowMode", true).toBool());
|
|
|
|
//ToggleWindowMode();
|
|
|
|
ToggleWindowMode();
|
|
|
|
|
|
|
|
|
|
|
|
// Setup connections
|
|
|
|
// Setup connections
|
|
|
|
connect(ui.action_load_elf, SIGNAL(triggered()), this, SLOT(OnMenuLoadELF()));
|
|
|
|
connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()));
|
|
|
|
connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame()));
|
|
|
|
connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame()));
|
|
|
|
connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame()));
|
|
|
|
connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame()));
|
|
|
|
connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame()));
|
|
|
|
connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame()));
|
|
|
|
//connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(SetupEmuWindowMode()));
|
|
|
|
connect(ui.action_Popout_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode()));
|
|
|
|
connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog()));
|
|
|
|
connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog()));
|
|
|
|
|
|
|
|
|
|
|
|
// BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues
|
|
|
|
// BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues
|
|
|
@ -88,15 +86,13 @@ GMainWindow::GMainWindow()
|
|
|
|
connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), callstackWidget, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection);
|
|
|
|
connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), callstackWidget, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection);
|
|
|
|
|
|
|
|
|
|
|
|
// Setup hotkeys
|
|
|
|
// Setup hotkeys
|
|
|
|
RegisterHotkey("Main Window", "Load Image", QKeySequence::Open);
|
|
|
|
RegisterHotkey("Main Window", "Load File", QKeySequence::Open);
|
|
|
|
RegisterHotkey("Main Window", "Start Emulation");
|
|
|
|
RegisterHotkey("Main Window", "Start Emulation");
|
|
|
|
LoadHotkeys(settings);
|
|
|
|
LoadHotkeys(settings);
|
|
|
|
|
|
|
|
|
|
|
|
connect(GetHotkey("Main Window", "Load Image", this), SIGNAL(activated()), this, SLOT(OnMenuLoadImage()));
|
|
|
|
connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, SLOT(OnMenuLoadFile()));
|
|
|
|
connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, SLOT(OnStartGame()));
|
|
|
|
connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, SLOT(OnStartGame()));
|
|
|
|
|
|
|
|
|
|
|
|
show();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LogManager::Init();
|
|
|
|
LogManager::Init();
|
|
|
|
System::Init(render_window);
|
|
|
|
System::Init(render_window);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -110,12 +106,9 @@ GMainWindow::~GMainWindow()
|
|
|
|
|
|
|
|
|
|
|
|
void GMainWindow::BootGame(const char* filename)
|
|
|
|
void GMainWindow::BootGame(const char* filename)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
render_window->DoneCurrent(); // make sure EmuThread can access GL context
|
|
|
|
|
|
|
|
render_window->GetEmuThread().SetFilename(filename);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NOTICE_LOG(MASTER_LOG, "citra starting...\n");
|
|
|
|
NOTICE_LOG(MASTER_LOG, "citra starting...\n");
|
|
|
|
|
|
|
|
|
|
|
|
if (Core::Init(/*render_window*/)) {
|
|
|
|
if (Core::Init()) {
|
|
|
|
ERROR_LOG(MASTER_LOG, "core initialization failed, exiting...");
|
|
|
|
ERROR_LOG(MASTER_LOG, "core initialization failed, exiting...");
|
|
|
|
Core::Stop();
|
|
|
|
Core::Stop();
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
@ -134,19 +127,22 @@ void GMainWindow::BootGame(const char* filename)
|
|
|
|
registersWidget->OnCPUStepped();
|
|
|
|
registersWidget->OnCPUStepped();
|
|
|
|
callstackWidget->OnCPUStepped();
|
|
|
|
callstackWidget->OnCPUStepped();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render_window->DoneCurrent(); // make sure EmuThread can access GL context
|
|
|
|
|
|
|
|
render_window->GetEmuThread().SetFilename(filename);
|
|
|
|
render_window->GetEmuThread().start();
|
|
|
|
render_window->GetEmuThread().start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render_window->show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnMenuLoadELF()
|
|
|
|
void GMainWindow::OnMenuLoadFile()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QString filename = QFileDialog::getOpenFileName(this, tr("Load ELF"), QString(), QString());
|
|
|
|
QString filename = QFileDialog::getOpenFileName(this, tr("Load file"), QString(), tr("3DS homebrew (*.elf *.dat)"));
|
|
|
|
if (filename.size())
|
|
|
|
if (filename.size())
|
|
|
|
BootGame(filename.toLatin1().data());
|
|
|
|
BootGame(filename.toLatin1().data());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnStartGame()
|
|
|
|
void GMainWindow::OnStartGame()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
render_window->show();
|
|
|
|
|
|
|
|
render_window->GetEmuThread().SetCpuRunning(true);
|
|
|
|
render_window->GetEmuThread().SetCpuRunning(true);
|
|
|
|
|
|
|
|
|
|
|
|
ui.action_Start->setEnabled(false);
|
|
|
|
ui.action_Start->setEnabled(false);
|
|
|
@ -181,18 +177,8 @@ void GMainWindow::OnOpenHotkeysDialog()
|
|
|
|
|
|
|
|
|
|
|
|
void GMainWindow::ToggleWindowMode()
|
|
|
|
void GMainWindow::ToggleWindowMode()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//if (!render_window->GetEmuThread().isRunning())
|
|
|
|
bool enable = ui.action_Popout_Window_Mode->isChecked();
|
|
|
|
// return;
|
|
|
|
if (enable && render_window->parent() != NULL)
|
|
|
|
/*
|
|
|
|
|
|
|
|
bool enable = ui.action_Single_Window_Mode->isChecked();
|
|
|
|
|
|
|
|
if (enable && render_window->parent() == NULL) // switch to single window mode
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
render_window->BackupGeometry();
|
|
|
|
|
|
|
|
ui.horizontalLayout->addWidget(render_window);
|
|
|
|
|
|
|
|
render_window->setVisible(true);
|
|
|
|
|
|
|
|
render_window->DoneCurrent();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (!enable && render_window->parent() != NULL) // switch to multiple windows mode
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ui.horizontalLayout->removeWidget(render_window);
|
|
|
|
ui.horizontalLayout->removeWidget(render_window);
|
|
|
|
render_window->setParent(NULL);
|
|
|
|
render_window->setParent(NULL);
|
|
|
@ -200,7 +186,13 @@ void GMainWindow::ToggleWindowMode()
|
|
|
|
render_window->DoneCurrent();
|
|
|
|
render_window->DoneCurrent();
|
|
|
|
render_window->RestoreGeometry();
|
|
|
|
render_window->RestoreGeometry();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
else if (!enable && render_window->parent() == NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
render_window->BackupGeometry();
|
|
|
|
|
|
|
|
ui.horizontalLayout->addWidget(render_window);
|
|
|
|
|
|
|
|
render_window->setVisible(true);
|
|
|
|
|
|
|
|
render_window->DoneCurrent();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnConfigure()
|
|
|
|
void GMainWindow::OnConfigure()
|
|
|
@ -215,7 +207,7 @@ void GMainWindow::closeEvent(QCloseEvent* event)
|
|
|
|
settings.setValue("geometry", saveGeometry());
|
|
|
|
settings.setValue("geometry", saveGeometry());
|
|
|
|
settings.setValue("state", saveState());
|
|
|
|
settings.setValue("state", saveState());
|
|
|
|
settings.setValue("geometryRenderWindow", render_window->saveGeometry());
|
|
|
|
settings.setValue("geometryRenderWindow", render_window->saveGeometry());
|
|
|
|
//settings.setValue("singleWindowMode", ui.action_Single_Window_Mode->isChecked());
|
|
|
|
settings.setValue("popoutWindowMode", ui.action_Popout_Window_Mode->isChecked());
|
|
|
|
settings.setValue("firstStart", false);
|
|
|
|
settings.setValue("firstStart", false);
|
|
|
|
SaveHotkeys(settings);
|
|
|
|
SaveHotkeys(settings);
|
|
|
|
|
|
|
|
|
|
|
|