signal: show Windows popup window on crash (#410)

## Link to GitHub Issue, if one exists
#345 

## Description of change
Show a MessageBox when signal detects a crash.

## Testing
Tested full screen and windowed games.
This commit is contained in:
bicarus-dev
2025-10-31 20:54:56 -07:00
committed by GitHub
parent 13a0877d38
commit 537252440e
5 changed files with 40 additions and 1 deletions
+21
View File
@@ -72,4 +72,25 @@ namespace deferredlogs {
log_warning("troubleshooter", "{}", msg);
});
}
void show_popup_for_crash() {
static std::once_flag shown;
std::call_once(shown, []() {
const std::string title = "spice2x (" + to_string(VERSION_STRING_CFG) + ") - crash handler";
std::string text;
text += "Game has crashed.\n\n";
text += "Check log.txt and look for error messages near the end of file.\n\n";
text += "Unsure what to do next?\n";
text += " * update spice2x to the latest version\n";
text += " * check the FAQ on spice2x wiki on github\n";
text += " * do NOT screenshot this, instead, share log.txt with someone and ask for help\n\n";
text += "Press Enter, Esc, Alt+F4, or click OK to exit. Otherwise, game will close in 30 seconds.";
MessageBox(
nullptr,
text.c_str(),
title.c_str(),
MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_SETFOREGROUND | MB_TOPMOST);
});
}
}