Skip to content

Commit

Permalink
Merge pull request hrydgard#19712 from hrydgard/show-active-compat-flags
Browse files Browse the repository at this point in the history
Show active compat flags on crash screen
  • Loading branch information
hrydgard authored Dec 10, 2024
2 parents 594a68e + 961dce8 commit 5f68f81
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
19 changes: 14 additions & 5 deletions Core/Compatibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
}
5 changes: 5 additions & 0 deletions Core/Compatibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -150,4 +154,5 @@ class Compatibility {
CompatFlags flags_{};
VRCompat vrCompat_{};
std::set<std::string> ignored_;
std::string activeList_;
};
5 changes: 4 additions & 1 deletion Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 8 additions & 2 deletions UI/DebugOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand Down
6 changes: 5 additions & 1 deletion Windows/EmuThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 5f68f81

Please sign in to comment.