2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #169 from archshift/autoplay

Qt: Auto-start game when selected, play game that's passed via argv[1].
This commit is contained in:
bunnei 2014-11-05 19:17:16 -05:00
commit 1aa29b2b6c

View file

@ -116,7 +116,10 @@ GMainWindow::GMainWindow()
show(); show();
System::Init(render_window); QStringList args = QApplication::arguments();
if (args.length() >= 2) {
BootGame(args[1].toStdString());
}
} }
GMainWindow::~GMainWindow() GMainWindow::~GMainWindow()
@ -129,6 +132,7 @@ GMainWindow::~GMainWindow()
void GMainWindow::BootGame(std::string filename) void GMainWindow::BootGame(std::string filename)
{ {
NOTICE_LOG(MASTER_LOG, "Citra starting...\n"); NOTICE_LOG(MASTER_LOG, "Citra starting...\n");
System::Init(render_window);
if (Core::Init()) { if (Core::Init()) {
ERROR_LOG(MASTER_LOG, "Core initialization failed, exiting..."); ERROR_LOG(MASTER_LOG, "Core initialization failed, exiting...");
@ -149,6 +153,7 @@ void GMainWindow::BootGame(std::string filename)
render_window->GetEmuThread().start(); render_window->GetEmuThread().start();
render_window->show(); render_window->show();
OnStartGame();
} }
void GMainWindow::OnMenuLoadFile() void GMainWindow::OnMenuLoadFile()
@ -185,6 +190,7 @@ void GMainWindow::OnPauseGame()
void GMainWindow::OnStopGame() void GMainWindow::OnStopGame()
{ {
render_window->GetEmuThread().SetCpuRunning(false); render_window->GetEmuThread().SetCpuRunning(false);
// TODO: Shutdown core
ui.action_Start->setEnabled(true); ui.action_Start->setEnabled(true);
ui.action_Pause->setEnabled(false); ui.action_Pause->setEnabled(false);
@ -246,7 +252,6 @@ int __cdecl main(int argc, char* argv[])
QApplication::setAttribute(Qt::AA_X11InitThreads); QApplication::setAttribute(Qt::AA_X11InitThreads);
QApplication app(argc, argv); QApplication app(argc, argv);
GMainWindow main_window; GMainWindow main_window;
main_window.show(); main_window.show();
return app.exec(); return app.exec();
} }