Skip to content

Commit

Permalink
Draw a minimal crash dump on the emu screen after a crash (if bIgnore…
Browse files Browse the repository at this point in the history
…BadMemAccess is false).

Add setting for ignore bad memory accesses
  • Loading branch information
hrydgard committed Feb 12, 2019
1 parent 1a30b37 commit 6bd2a06
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
34 changes: 34 additions & 0 deletions UI/EmuScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,30 @@ static void DrawDebugStats(DrawBuffer *draw2d) {
draw2d->SetFontScale(1.0f, 1.0f);
}

static void DrawCrashDump(DrawBuffer *draw2d) {
char statbuf[4096];
char versionString[256];
sprintf(versionString, "%s", PPSSPP_GIT_VERSION);
// TODO: Draw a lot more information. Full register set, and so on.
snprintf(statbuf, sizeof(statbuf), R"(Bad Memory Access
Game ID: %s
Game Title: %s
PPSSPP Version: %s
PC: %08x
)",
g_paramSFO.GetDiscID().c_str(),
g_paramSFO.GetValueString("TITLE").c_str(),
versionString,
currentMIPS->pc);

draw2d->SetFontScale(.7f, .7f);
int x = 20;
int y = 40;
draw2d->DrawText(UBUNTU24, statbuf, x + 1, y + 1, 0xc0000000, FLAG_DYNAMIC_ASCII);
draw2d->DrawText(UBUNTU24, statbuf, x, y, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII);
}

static void DrawAudioDebugStats(DrawBuffer *draw2d) {
char statbuf[1024] = { 0 };
const AudioDebugStats *stats = __AudioGetDebugStats();
Expand Down Expand Up @@ -1251,6 +1275,9 @@ void EmuScreen::render() {
if (PSP_IsInited()) {
gpu->CopyDisplayToOutput();
}
} else if (coreState == CORE_ERROR) {
// We'll render some text in the UI.
thin3d->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR });
} else {
// Didn't actually reach the end of the frame, ran out of the blockTicks cycles.
// In this case we need to bind and wipe the backbuffer, at least.
Expand Down Expand Up @@ -1297,6 +1324,8 @@ bool EmuScreen::hasVisibleUI() {
if (g_Config.bShowDebugStats || g_Config.bShowDeveloperMenu || g_Config.bShowAudioDebug || g_Config.bShowFrameProfiler)
return true;

if (coreState == CORE_ERROR)
return true;
return false;
}

Expand Down Expand Up @@ -1347,6 +1376,11 @@ void EmuScreen::renderUI() {
DrawProfile(*ctx);
}
#endif

if (coreState == CORE_ERROR) {
DrawCrashDump(draw2d);
}

ctx->Flush();
}

Expand Down
1 change: 1 addition & 0 deletions UI/GameSettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@ void GameSettingsScreen::CreateViews() {
systemSettings->Add(new ItemHeader(sy->T("Emulation")));

systemSettings->Add(new CheckBox(&g_Config.bFastMemory, sy->T("Fast Memory", "Fast Memory (Unstable)")))->OnClick.Handle(this, &GameSettingsScreen::OnJitAffectingSetting);
systemSettings->Add(new CheckBox(&g_Config.bIgnoreBadMemAccess, sy->T("Ignore bad memory accesses")));

systemSettings->Add(new CheckBox(&g_Config.bSeparateIOThread, sy->T("I/O on thread (experimental)")))->SetEnabled(!PSP_IsInited());
static const char *ioTimingMethods[] = { "Fast (lag on slow storage)", "Host (bugs, less lag)", "Simulate UMD delays" };
Expand Down

0 comments on commit 6bd2a06

Please sign in to comment.