forked from suyu/suyu
Qt: Fix loading a new game without stopping emulation.
This commit is contained in:
parent
5a855bdb2f
commit
3dd2688785
2 changed files with 25 additions and 15 deletions
|
@ -199,6 +199,10 @@ void GMainWindow::OnDisplayTitleBars(bool show)
|
||||||
void GMainWindow::BootGame(std::string filename) {
|
void GMainWindow::BootGame(std::string filename) {
|
||||||
LOG_INFO(Frontend, "Citra starting...\n");
|
LOG_INFO(Frontend, "Citra starting...\n");
|
||||||
|
|
||||||
|
// Shutdown previous session if the emu thread is still active...
|
||||||
|
if (emu_thread != nullptr)
|
||||||
|
ShutdownGame();
|
||||||
|
|
||||||
System::Init(render_window);
|
System::Init(render_window);
|
||||||
|
|
||||||
// Load a game or die...
|
// Load a game or die...
|
||||||
|
@ -217,6 +221,25 @@ void GMainWindow::BootGame(std::string filename) {
|
||||||
OnStartGame();
|
OnStartGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::ShutdownGame() {
|
||||||
|
emu_thread->SetCpuRunning(false);
|
||||||
|
|
||||||
|
emu_thread->ShutdownCpu();
|
||||||
|
emu_thread->WaitForCpuShutdown();
|
||||||
|
emu_thread->Stop();
|
||||||
|
|
||||||
|
delete emu_thread;
|
||||||
|
emu_thread = nullptr;
|
||||||
|
|
||||||
|
System::Shutdown();
|
||||||
|
|
||||||
|
ui.action_Start->setEnabled(true);
|
||||||
|
ui.action_Pause->setEnabled(false);
|
||||||
|
ui.action_Stop->setEnabled(false);
|
||||||
|
|
||||||
|
render_window->hide();
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::OnMenuLoadFile()
|
void GMainWindow::OnMenuLoadFile()
|
||||||
{
|
{
|
||||||
QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), QString(), tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.bin *.cci *.cxi)"));
|
QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), QString(), tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.bin *.cci *.cxi)"));
|
||||||
|
@ -249,21 +272,7 @@ void GMainWindow::OnPauseGame()
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnStopGame() {
|
void GMainWindow::OnStopGame() {
|
||||||
emu_thread->SetCpuRunning(false);
|
ShutdownGame();
|
||||||
|
|
||||||
emu_thread->ShutdownCpu();
|
|
||||||
emu_thread->WaitForCpuShutdown();
|
|
||||||
emu_thread->Stop();
|
|
||||||
|
|
||||||
delete emu_thread;
|
|
||||||
|
|
||||||
System::Shutdown();
|
|
||||||
|
|
||||||
ui.action_Start->setEnabled(true);
|
|
||||||
ui.action_Pause->setEnabled(false);
|
|
||||||
ui.action_Stop->setEnabled(false);
|
|
||||||
|
|
||||||
render_window->hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnOpenHotkeysDialog()
|
void GMainWindow::OnOpenHotkeysDialog()
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void BootGame(std::string filename);
|
void BootGame(std::string filename);
|
||||||
|
void ShutdownGame();
|
||||||
|
|
||||||
void closeEvent(QCloseEvent* event) override;
|
void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue