From 7462d988cf5bfbca7665d76d29807a7a15148a1d Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sat, 27 Jul 2013 13:26:26 +0200 Subject: [PATCH] Boot game in EmuScreen::update instead of the constructor. Avoids issues with starting games from the command line. --- UI/EmuScreen.cpp | 8 +++++--- UI/EmuScreen.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 0862803cb2..4b2f576ea6 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -54,12 +54,11 @@ EmuScreen::EmuScreen(const std::string &filename) - : gamePath_(filename), invalid_(true), pauseTrigger_(false) { - - bootGame(filename); + : booted_(false), gamePath_(filename), invalid_(true), pauseTrigger_(false) { } void EmuScreen::bootGame(const std::string &filename) { + booted_ = true; std::string fileToStart = filename; // This is probably where we should start up the emulated PSP. INFO_LOG(BOOT, "Starting up hardware."); @@ -398,6 +397,9 @@ void EmuScreen::CreateViews() { } void EmuScreen::update(InputState &input) { + if (!booted_) + bootGame(gamePath_); + UIScreen::update(input); // Simply forcibily update to the current screen size every frame. Doesn't cost much. diff --git a/UI/EmuScreen.h b/UI/EmuScreen.h index 447eb05300..072cd63f1d 100644 --- a/UI/EmuScreen.h +++ b/UI/EmuScreen.h @@ -52,6 +52,7 @@ private: void setVKeyAnalogX(int stick, int virtualKeyMin, int virtualKeyMax); void setVKeyAnalogY(int stick, int virtualKeyMin, int virtualKeyMax); + bool booted_; std::string gamePath_; // Something invalid was loaded, don't try to emulate bool invalid_;