@@ -23,6 +23,7 @@ using namespace geode::prelude;
23
23
24
24
static bool g_lastLaunchCrashed = false ;
25
25
static bool g_symbolsInitialized = false ;
26
+ static std::string g_unzippedSearchPaths;
26
27
27
28
static std::string getDateString (bool filesafe) {
28
29
auto const now = std::time (nullptr );
@@ -478,6 +479,15 @@ static void handleException(LPEXCEPTION_POINTERS info) {
478
479
if (!g_symbolsInitialized) {
479
480
log ::warn (" Failed to initialize debug symbols: Error {}" , GetLastError ());
480
481
}
482
+ else {
483
+ // set the search path to include the mods' temp directories
484
+ if (std::array<char , 4096 > searchPathBuffer;
485
+ SymGetSearchPath (static_cast <HMODULE>(GetCurrentProcess ()), searchPathBuffer.data (), searchPathBuffer.size ())) {
486
+ std::string searchPath (searchPathBuffer.data ());
487
+ searchPath += " ;" + g_unzippedSearchPaths;
488
+ SymSetSearchPath (static_cast <HMODULE>(GetCurrentProcess ()), searchPath.c_str ());
489
+ }
490
+ }
481
491
482
492
// in some cases, we can be pretty certain that the first mod found while unwinding
483
493
// is the one that caused the crash, so using `suspectedFaultyMod` is safe and correct.
@@ -521,6 +531,11 @@ static LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS info) {
521
531
bool crashlog::setupPlatformHandler () {
522
532
SetUnhandledExceptionFilter (exceptionHandler);
523
533
534
+ g_unzippedSearchPaths.clear ();
535
+ for (auto & mod : Loader::get ()->getAllMods ()) {
536
+ g_unzippedSearchPaths += mod->getTempDir ().string () + " ;" ;
537
+ }
538
+
524
539
auto lastCrashedFile = crashlog::getCrashLogDirectory () / " last-crashed" ;
525
540
if (std::filesystem::exists (lastCrashedFile)) {
526
541
g_lastLaunchCrashed = true ;
0 commit comments