From ff1a5dd4c2bd9c0a62ecbc12278e7510a5975488 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 9 Aug 2022 01:55:25 -0700 Subject: [PATCH] Thunks: Make unknown glXGetProcAddress non-fatal Multiple games will query symbols that are leaked but we don't support. It is safe to return nullptr in these cases. Print a warning message still just in-case someone fails hard at GL. --- ThunkLibs/libGL/libGL_Guest.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ThunkLibs/libGL/libGL_Guest.cpp b/ThunkLibs/libGL/libGL_Guest.cpp index 65635cb8c..552bcc404 100644 --- a/ThunkLibs/libGL/libGL_Guest.cpp +++ b/ThunkLibs/libGL/libGL_Guest.cpp @@ -43,26 +43,30 @@ const std::unordered_map(procname)); if (TargetFuncIt == HostPtrInvokers.end()) { - // Extension found in host but not in our interface definition => treat as fatal error + // Extension found in host but not in our interface definition => Not fatal but warn about it + // Some games query leaked GLES symbols but don't use them + // glFrustrumf : ES 1.x function + // - Papers, Please + // - Dicey Dungeons fprintf(stderr, "glXGetProcAddress: not found %s\n", procname); - __builtin_trap(); + return nullptr; } LinkAddressToFunction((uintptr_t)Ret, TargetFuncIt->second); return Ret; - } + } - voidFunc *glXGetProcAddressARB(const GLubyte *procname) { - return glXGetProcAddress(procname); - } + voidFunc *glXGetProcAddressARB(const GLubyte *procname) { + return glXGetProcAddress(procname); + } } // libGL.so must pull in libX11.so as a dependency. Referencing some libX11