Display CRC on crash screen. Thanks sum2012 for the idea.

Fixes #16840
This commit is contained in:
Henrik Rydgård committed 2023-01-25 00:43:17 +01:00
1 parent 91cca1c980
commit e03db2ee23
2 files changed
+21 -8

No files matched your search

+1 -2
View File
@@ -142,8 +142,7 @@ namespace Reporting
}
if (crcPending) {
// Already in process.
INFO_LOG(SYSTEM, "CRC already pending");
// Already in process. This is OK - on the crash screen we call this in a polling fashion.
return;
}
+20 -6
View File
@@ -90,6 +90,8 @@ using namespace std::placeholders;
#include "UI/DiscordIntegration.h"
#include "UI/ChatScreen.h"
#include "Core/Reporting.h"
#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP)
#include "Windows/MainWindow.h"
#endif
@@ -1158,7 +1160,7 @@ static const char *CPUCoreAsString(int core) {
}
}
static void DrawCrashDump(UIContext *ctx) {
static void DrawCrashDump(UIContext *ctx, const Path &gamePath) {
const ExceptionInfo &info = Core_GetExceptionInfo();
auto sy = GetI18NCategory("System");
@@ -1170,13 +1172,23 @@ static void DrawCrashDump(UIContext *ctx) {
ctx->Flush();
if (ctx->Draw()->GetFontAtlas()->getFont(ubuntu24))
ctx->BindFontTexture();
ctx->Draw()->SetFontScale(1.2f, 1.2f);
ctx->Draw()->SetFontScale(1.1f, 1.1f);
ctx->Draw()->DrawTextShadow(ubuntu24, sy->T("Game crashed"), x, y, 0xFFFFFFFF);
char statbuf[4096];
char versionString[256];
snprintf(versionString, sizeof(versionString), "%s", PPSSPP_GIT_VERSION);
char crcStr[16]{};
if (Reporting::HasCRC(gamePath)) {
u32 crc = Reporting::RetrieveCRC(gamePath);
snprintf(crcStr, sizeof(crcStr), "CRC: %08x\n", crc);
} else {
// Queue it for calculation, we want it!
// It's OK to call this repeatedly until we have it, which is natural here.
Reporting::QueueCRC(gamePath);
}
// TODO: Draw a lot more information. Full register set, and so on.
#ifdef _DEBUG
@@ -1196,23 +1208,24 @@ static void DrawCrashDump(UIContext *ctx) {
ctx->PushScissor(Bounds(x, y, columnWidth, height));
INFO_LOG(SYSTEM, "DrawCrashDump (%d %d %d %d)", x, y, columnWidth, height);
snprintf(statbuf, sizeof(statbuf), R"(%s
%s (%s)
%s (%s)
%s v%d (%s)
%s
)",
ExceptionTypeAsString(info.type),
g_paramSFO.GetDiscID().c_str(), g_paramSFO.GetValueString("TITLE").c_str(),
versionString, build,
sysName.c_str(), sysVersion, GetCompilerABI()
sysName.c_str(), sysVersion, GetCompilerABI(),
crcStr
);
ctx->Draw()->SetFontScale(.7f, .7f);
ctx->Draw()->DrawTextShadow(ubuntu24, statbuf, x, y, 0xFFFFFFFF);
y += 140;
y += 160;
if (info.type == ExceptionType::MEMORY) {
snprintf(statbuf, sizeof(statbuf), R"(
@@ -1272,6 +1285,7 @@ Invalid / Unknown (%d)
ctx->Draw()->DrawTextShadow(ubuntu24, statbuf, x, y, 0xFFFFFFFF);
ctx->Flush();
ctx->Draw()->SetFontScale(1.0f, 1.0f);
ctx->RebindTexture();
}
@@ -1565,7 +1579,7 @@ void EmuScreen::renderUI() {
if (coreState == CORE_RUNTIME_ERROR || coreState == CORE_STEPPING) {
const ExceptionInfo &info = Core_GetExceptionInfo();
if (info.type != ExceptionType::NONE) {
DrawCrashDump(ctx);
DrawCrashDump(ctx, gamePath_);
} else {
// We're somehow in ERROR or STEPPING without a crash dump. This case is what lead
// to the bare "Resume" and "Reset" buttons without a crash dump before, in cases