Conversation
The shipped build has no crash reporting - the __try/__except around the game is behind ENABLE_EXCEPTION_HANDLING, which is never defined, so an unhandled exception just terminates the process with no diagnostics, making player crash reports unactionable. Install a top-level crash handler as the first thing in WinMain (SetUnhandledExceptionFilter, plus CRT pure-virtual / invalid-parameter / abort handlers). On any crash it writes two files to the game folder: - CrashLog_<pid>.txt: readable summary - build version, time, exception type, faulting module+offset, access-violation address, and a symbolic call stack (function + file:line when a .pdb is present, module+offset otherwise). - CrashDump_<pid>.dmp: a minidump; open it with the matching ja2.pdb in Visual Studio / WinDbg for a full symbolic stack, locals and all threads. A message box tells the user which two files to attach. Uses Dbghelp.lib (already linked). Hardened: writes the minidump before touching DbgHelp symbols, reentrancy-guarded and __try-wrapped so it can't re-crash the report, reserves stack (SetThreadStackGuarantee, dynamically loaded for XP headers) so it runs on a stack-overflow crash. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The shipped build has no crash reporting. The
__try/__exceptaround the game (sgp.cpp) is behindENABLE_EXCEPTION_HANDLING, which is never defined, so an unhandled exception just terminates the process with nothing written — player crash reports are unactionable.What this adds
A top-level crash handler, installed as the very first thing in
WinMain. On any crash it writes two files to the game folder:CrashLog_<pid>.txt— readable summary: build version, timestamp, exception type, faulting module + offset, read/write access-violation address, and a symbolic call stack (function +file:linewhen a.pdbis beside the exe, module+offset otherwise). Actionable without a debugger.CrashDump_<pid>.dmp— a minidump. Opened with the matchingja2.pdbin Visual Studio / WinDbg it gives the full symbolic stack, locals and all threads.A message box tells the player which two files to attach when reporting.
Coverage
SetUnhandledExceptionFilter.abort()/SIGABRT(where an unhandledstd::terminatealso lands) — routed through the same writer viaRtlCaptureContext.Notes
Dbghelp.lib(already linked); single file, no CMake change.__try-wrapped so the handler can't re-crash the report; reserves stack viaSetThreadStackGuarantee(loaded dynamically for XP-era headers) so it still runs on a stack-overflow crash.%TEMP%fallback could be added later.🤖 Generated with Claude Code