From 419c329b06867e08a310bf248262ef6715abfd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 10 Dec 2024 01:38:35 +0100 Subject: [PATCH 1/2] Show active compat flags on crash screen --- Core/Compatibility.cpp | 19 ++++++++++++++----- Core/Compatibility.h | 5 +++++ Core/Core.cpp | 5 ++++- UI/DebugOverlay.cpp | 10 ++++++++-- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/Core/Compatibility.cpp b/Core/Compatibility.cpp index e9a6f1a20159..d651ccfd4c58 100644 --- a/Core/Compatibility.cpp +++ b/Core/Compatibility.cpp @@ -74,6 +74,7 @@ void Compatibility::Load(const std::string &gameID) { void Compatibility::Clear() { memset(&flags_, 0, sizeof(flags_)); memset(&vrCompat_, 0, sizeof(vrCompat_)); + activeList_.clear(); } void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) { @@ -163,18 +164,26 @@ void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, co // Shortcut for debugging, sometimes useful to globally enable compat flags. bool all = false; iniFile.Get(option, "ALL", &all, false); - *flag |= all; + if (all) { + *flag |= all; + if (!activeList_.empty()) { + activeList_ += "\n"; + } + activeList_ += option; + } } } void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, float *flag) { std::string value; - iniFile.Get(option, gameID.c_str(), &value, "0"); - *flag = stof(value); + if (iniFile.Get(option, gameID.c_str(), &value, "0")) { + *flag = stof(value); + } } void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, int *flag) { std::string value; - iniFile.Get(option, gameID.c_str(), &value, "0"); - *flag = stof(value); + if (iniFile.Get(option, gameID.c_str(), &value, "0")) { + *flag = stof(value); + } } diff --git a/Core/Compatibility.h b/Core/Compatibility.h index bf6bca029573..8a0e33af4d34 100644 --- a/Core/Compatibility.h +++ b/Core/Compatibility.h @@ -139,6 +139,10 @@ class Compatibility { void Load(const std::string &gameID); + const std::string &GetActiveFlagsString() const { + return activeList_; + } + private: void Clear(); void CheckSettings(IniFile &iniFile, const std::string &gameID); @@ -150,4 +154,5 @@ class Compatibility { CompatFlags flags_{}; VRCompat vrCompat_{}; std::set ignored_; + std::string activeList_; }; diff --git a/Core/Core.cpp b/Core/Core.cpp index 109bb7551b2a..3658d330ea7d 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -424,7 +424,10 @@ void Core_Break(const char *reason, u32 relatedAddress) { // Free-threaded (or at least should be) void Core_Resume() { // If the current PC is on a breakpoint, the user doesn't want to do nothing. - g_breakpoints.SetSkipFirst(currentMIPS->pc); + if (currentMIPS) { + g_breakpoints.SetSkipFirst(currentMIPS->pc); + } + // Handle resuming from GE. if (coreState == CORE_STEPPING_GE) { coreState = CORE_RUNNING_GE; diff --git a/UI/DebugOverlay.cpp b/UI/DebugOverlay.cpp index 43faf9a266ed..090db6ab5994 100644 --- a/UI/DebugOverlay.cpp +++ b/UI/DebugOverlay.cpp @@ -271,6 +271,12 @@ void DrawCrashDump(UIContext *ctx, const Path &gamePath) { auto sy = GetI18NCategory(I18NCat::SYSTEM); FontID ubuntu24("UBUNTU24"); std::string discID = g_paramSFO.GetDiscID(); + + std::string activeFlags = PSP_CoreParameter().compat.GetActiveFlagsString(); + if (activeFlags.empty()) { + activeFlags = "(no compat flags active)"; + } + int x = 20 + System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_LEFT); int y = 20 + System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_TOP); @@ -419,10 +425,10 @@ Invalid / Unknown (%d) snprintf(statbuf, sizeof(statbuf), "CPU Core: %s (flags: %08x)\n" "Locked CPU freq: %d MHz\n" - "Cheats: %s, Plugins: %s\n\n%s", + "Cheats: %s, Plugins: %s\n%s\n\n%s", CPUCoreAsString(g_Config.iCpuCore), g_Config.uJitDisableFlags, GetLockedCPUSpeedMhz(), - CheatsInEffect() ? "Y" : "N", HLEPlugins::HasEnabled() ? "Y" : "N", tips.c_str()); + CheatsInEffect() ? "Y" : "N", HLEPlugins::HasEnabled() ? "Y" : "N", activeFlags.c_str(), tips.c_str()); ctx->Draw()->DrawTextShadow(ubuntu24, statbuf, x, y, 0xFFFFFFFF); ctx->Flush(); From 961dce861d7f4f151c6b8cc0b54012d9b477ff55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 10 Dec 2024 01:43:18 +0100 Subject: [PATCH 2/2] Fix interaction with the crash screen, oops --- Windows/EmuThread.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Windows/EmuThread.cpp b/Windows/EmuThread.cpp index 2e20d21b5bed..4b84983af567 100644 --- a/Windows/EmuThread.cpp +++ b/Windows/EmuThread.cpp @@ -105,9 +105,13 @@ static bool Run(GraphicsContext *ctx) { NativeFrame(ctx); return true; + case CORE_RUNTIME_ERROR: + // Need to step the loop. + NativeFrame(ctx); + break; + case CORE_POWERUP: case CORE_BOOT_ERROR: - case CORE_RUNTIME_ERROR: // Exit loop!! return true;