diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 2533f77d39..274028e1cf 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -277,7 +277,8 @@ void EmuScreen::bootGame(const Path &filename) { if (!info || info->pending) return; - SetExtraAssertInfo((info->id + " " + info->GetTitle()).c_str()); + extraAssertInfoStr_ = info->id + " " + info->GetTitle(); + SetExtraAssertInfo(extraAssertInfoStr_.c_str()); if (!info->id.empty()) { g_Config.loadGameConfig(info->id, info->GetTitle()); @@ -468,6 +469,7 @@ void EmuScreen::dialogFinished(const Screen *dialog, DialogResult result) { if (Core_IsActive()) UI::EnableFocusMovement(false); RecreateViews(); + SetExtraAssertInfo(extraAssertInfoStr_.c_str()); } static void AfterSaveStateAction(SaveState::Status status, const std::string &message, void *) { diff --git a/UI/EmuScreen.h b/UI/EmuScreen.h index bcf3171a3e..50157a6002 100644 --- a/UI/EmuScreen.h +++ b/UI/EmuScreen.h @@ -119,5 +119,7 @@ private: UI::Button *cardboardDisableButton_ = nullptr; + std::string extraAssertInfoStr_; + ControlMapper controlMapper_; }; diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 5e123f0256..42caa72440 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -183,7 +183,7 @@ static Draw::DrawContext *g_draw; static Draw::Pipeline *colorPipeline; static Draw::Pipeline *texColorPipeline; static UIContext *uiContext; -static bool g_restartGraphics; +static int g_restartGraphics; #ifdef _WIN32 WindowsAudioBackend *winAudioBackend; @@ -1037,11 +1037,15 @@ void NativeFrame(GraphicsContext *graphicsContext) { PROFILE_END_FRAME(); // This can only be accessed from Windows currently, and causes linking errors with headless etc. - if (g_restartGraphics) { + if (g_restartGraphics == 1) { // Used for debugging only. NativeShutdownGraphics(); + g_restartGraphics++; + return; + } + else if (g_restartGraphics == 2) { NativeInitGraphics(graphicsContext); - g_restartGraphics = false; + g_restartGraphics = 0; } double startTime = time_now_d(); @@ -1183,7 +1187,8 @@ void NativeFrame(GraphicsContext *graphicsContext) { bool HandleGlobalMessage(UIMessage message, const std::string &value) { if (message == UIMessage::RESTART_GRAPHICS) { - g_restartGraphics = true; + g_restartGraphics = 1; + return true; } else if (message == UIMessage::SAVESTATE_DISPLAY_SLOT) { auto sy = GetI18NCategory(I18NCat::SYSTEM); std::string msg = StringFromFormat("%s: %d", sy->T("Savestate Slot"), SaveState::GetCurrentSlot() + 1); diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index 6ab4ae73be..1f4133d0c6 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -266,6 +266,9 @@ void GamePauseScreen::update() { GamePauseScreen::GamePauseScreen(const Path &filename) : UIDialogScreenWithGameBackground(filename) { + // So we can tell if something blew up while on the pause screen. + std::string assertStr = "PauseScreen: " + filename.GetFilename(); + SetExtraAssertInfo(assertStr.c_str()); } GamePauseScreen::~GamePauseScreen() {