diff --git a/src/core/overwrite_dlopen.cpp b/src/core/overwrite_dlopen.cpp index 61d9251e..9a6d3244 100644 --- a/src/core/overwrite_dlopen.cpp +++ b/src/core/overwrite_dlopen.cpp @@ -2,21 +2,25 @@ // This is specifically for preload, and removes the source lock from the launcher. The only other way is bytepatching hl2_linux directly... typedef void *(*dlopen_t)(const char *__file, int __mode); -void *dlopen(const char *__file, int __mode) noexcept(true) +void *dlopen(const char *__file, int __mode) __THROWNL { dlopen_t dlopen_fn = (dlopen_t) dlsym(RTLD_NEXT, "dlopen"); - auto ret = dlopen_fn(__file, __mode); + + auto ret = dlopen_fn(__file, __mode); + if (!__file) + return ret; + if (!strcmp(__file, "bin/launcher.so")) { logging::Info("Intercepted launcher.so"); logging::Info("Waiting for cathook to load Launcher symbols..."); while (sharedobj::launcher().lmap == nullptr) - usleep(10); + usleep(1); logging::Info("Loaded Launcher symbols"); static uintptr_t launcher_sig = gSignatures.GetLauncherSignature("55 89 E5 56 53 8D 9D ? ? ? ? 81 EC A0 00 00 00"); static BytePatch LauncherBytePatch = BytePatch(launcher_sig, { 0xB8, 0x01, 0x00, 0x00, 0x00, 0xC3 }); LauncherBytePatch.Patch(); - logging::Info("Removed source lock"); + logging::Info("Removed source lock %d", errno); } return ret; } diff --git a/src/hack.cpp b/src/hack.cpp index 36d83b37..5c455918 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -319,6 +319,10 @@ free(logname);*/ #if ENABLE_TEXTMODE static BytePatch patch(gSignatures.GetEngineSignature, "74 ? 89 5C 24 ? 8D 9D ? ? ? ? 89 74 24", 0, { 0x71 }); patch.Patch(); + + // Remove intro video which also causes some crashes + static BytePatch patch_intro_video(gSignatures.GetEngineSignature, "55 89 E5 57 56 53 83 EC 5C 8B 5D ? 8B 55", 0x9, { 0x83, 0xc4, 0x5c, 0x5b, 0x5e, 0x5f, 0x5d, 0xc3 }); + patch_intro_video.Patch(); #endif CreateEarlyInterfaces();