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.
This commit is contained in:
Ryan Houdek committed 2022-08-09 01:55:25 -07:00
1 parent 62d9961bd1
commit ff1a5dd4c2
1 file changed
+12 -8
+12 -8
View File
@@ -43,26 +43,30 @@ const std::unordered_map<std::string_view, uintptr_t /* guest function address *
});
extern "C" {
voidFunc *glXGetProcAddress(const GLubyte *procname) {
voidFunc *glXGetProcAddress(const GLubyte *procname) {
auto Ret = fexfn_pack_glXGetProcAddress(procname);
if (!Ret) {
return nullptr;
return nullptr;
}
auto TargetFuncIt = HostPtrInvokers.find(reinterpret_cast<const char*>(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