Skip to content

Commit

Permalink
Slight improvement to extra assert info (set special info on pause sc…
Browse files Browse the repository at this point in the history
…reen)
  • Loading branch information
hrydgard committed Jan 18, 2024
1 parent 74f5be0 commit 902b736
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
4 changes: 3 additions & 1 deletion UI/EmuScreen.cpp
Expand Up @@ -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());
Expand Down Expand Up @@ -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 *) {
Expand Down
2 changes: 2 additions & 0 deletions UI/EmuScreen.h
Expand Up @@ -119,5 +119,7 @@ class EmuScreen : public UIScreen {

UI::Button *cardboardDisableButton_ = nullptr;

std::string extraAssertInfoStr_;

ControlMapper controlMapper_;
};
13 changes: 9 additions & 4 deletions UI/NativeApp.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions UI/PauseScreen.cpp
Expand Up @@ -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() {
Expand Down

0 comments on commit 902b736

Please sign in to comment.