mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 06:29:58 -04:00
Keep the crash report's exception filter in place, and write the game's exit code into its log from the launcher.
The last-chance exception filter is set at the start, before the GPU driver and the other DLLs load. A DLL that sets its own filter later takes its place, and a fault in that DLL then ends the game with no FATAL line in the log. Two 0.6.0 logs from an RX 7800 XT end that way on the title screen. Once a second the filter is now put back and the module that replaced it is logged (NX2NAVI_CRASH_FILTER_GUARD, default 1). When the game ends with a nonzero code, the launcher adds that code, in hex with its meaning, to the end of logs\nx2navi.log, so a fail-fast exit that no handler in the process can see still shows in the log a player sends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1007,6 +1007,21 @@ void plat_crash_hook(void (*fn)(const PlatCrash *c)) {
|
||||
_set_invalid_parameter_handler(invalid_parameter);
|
||||
}
|
||||
|
||||
// The last-chance filter is set once, at the start, before the GPU driver, the window and audio libraries and the
|
||||
// movie decoder load. A DLL that sets its own filter later takes the place of crash_filter, and a fault outside this
|
||||
// executable then ends the process with no line in the log. This puts crash_filter back; when another filter had
|
||||
// taken its place, `who` gets the module and offset of that filter and the call returns 1.
|
||||
int plat_crash_filter_reassert(char *who, size_t n) {
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER prev = SetUnhandledExceptionFilter(crash_filter);
|
||||
if (prev == crash_filter) return 0;
|
||||
void *base = NULL;
|
||||
if (prev) RtlPcToFileHeader((void *)prev, &base);
|
||||
if (!prev) snprintf(who, n, "no filter (removed)");
|
||||
else if (!base) snprintf(who, n, "%p, outside every module", (void *)prev);
|
||||
else snprintf(who, n, "%s+%#llx", image_name(base), (unsigned long long)((uintptr_t)prev - (uintptr_t)base));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// A fresh process gets a fresh layout: Windows places DLLs, heaps and thread stacks at random addresses. The parent
|
||||
// waits and exits with the child's code.
|
||||
void plat_reexec(void) {
|
||||
|
||||
Reference in New Issue
Block a user