Show active compat flags on crash screen

This commit is contained in:
Henrik Rydgård 2024-12-10 01:38:35 +01:00
parent 594a68eed5
commit 419c329b06
4 changed files with 31 additions and 8 deletions

View file

@ -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);
}
}

View file

@ -139,6 +139,10 @@ public:
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 @@ private:
CompatFlags flags_{};
VRCompat vrCompat_{};
std::set<std::string> ignored_;
std::string activeList_;
};

View file

@ -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;

View file

@ -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();