From 07cb6048a0510c1c075ad4d24bb1cc4a49bd1e0d Mon Sep 17 00:00:00 2001 From: bicarus-dev <202771338+bicarus-dev@users.noreply.github.com> Date: Sun, 28 Sep 2025 23:49:08 -0700 Subject: [PATCH] Add explanation for common exception codes (#386) ## Link to GitHub Issue, if one exists #345 ## Description of change Add a little warning message that shows when well-known exception codes are encountered & caught by signal hooks. ## Testing Tested by injecting bad instructions into the DLL. --- src/spice2x/launcher/signal.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/spice2x/launcher/signal.cpp b/src/spice2x/launcher/signal.cpp index c5aaa33..51ec7d7 100644 --- a/src/spice2x/launcher/signal.cpp +++ b/src/spice2x/launcher/signal.cpp @@ -6,6 +6,7 @@ #include #include "avs/core.h" +#include "avs/game.h" #include "acio/acio.h" #include "external/stackwalker/stackwalker.h" #include "hooks/libraryhook.h" @@ -103,6 +104,22 @@ static LONG WINAPI TopLevelExceptionFilter(struct _EXCEPTION_POINTERS *Exception // print signal log_warning("signal", "exception raised: {}", exception_code(ExceptionRecord)); + std::string err; + switch (ExceptionRecord->ExceptionCode) { + case EXCEPTION_ILLEGAL_INSTRUCTION: + err = "Illegal instruction: either your CPU is too old (e.g., does not support " + "SSE4.2 or AVX2 but perhaps the game requires it); or, a bad patch was applied."; + break; + default: + break; + } + if (!err.empty()) { + log_warning( + "signal", + "likely cause for your error based on the exception code:\n {}", + err.c_str()); + } + // check ACIO init failures if (acio::IO_INIT_IN_PROGRESS) { log_warning(