xgameruntime: export XErrorReport, which XGameRuntimeInitialize requires

xgameruntime.lib's XGameRuntimeInitialize looks up "XErrorReport" with
GetProcAddress next to QueryApiImpl, the InitializeApiImpl* entries and
UninitializeApiImpl, and refuses to initialise when it is missing. In the
retail executable that is the lookup at +0x55e2b7e and the null check at
+0x55e2c08, after which boot stops at an int3 (+0x5a91c21).

The shim now exports XErrorReport(HRESULT, const char*) as a DLL export,
forwarding to the IXErrorImpl report it already served (callback, S_OK).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ItsNotRexed
2026-11-23 15:34:37 -05:00
parent b7a3fed28d
commit 6312c057f8

View File

@ -248,6 +248,11 @@ HRESULT STDMETHODCALLTYPE error_report(void*, HRESULT hr, const char* message) {
if (XErrorCallback cb = g_error_callback.load()) cb(hr, message, g_error_context.load());
return S_OK;
}
// The same function as a DLL export: xgameruntime.lib's XGameRuntimeInitialize looks up "XErrorReport" with
// GetProcAddress next to QueryApiImpl, the InitializeApiImpl* and UninitializeApiImpl, and refuses to initialise when it
// is missing (retail executable: the lookup at +0x55e2b7e, the null check at +0x55e2c08, then an int3 at +0x5a91c21).
HRESULT WINAPI XErrorReport(HRESULT hr, const char* message) { return error_report(nullptr, hr, message); }
void STDMETHODCALLTYPE error_set_callback(void*, XErrorCallback callback, void* context) {
std::lock_guard<std::mutex> lock(g_error_mutex);
g_error_context = context;
@ -1324,6 +1329,7 @@ SHIM_TABLE(xgameruntime,
XGR(InitializeApiImplEx2),
XGR(UninitializeApiImpl),
XGR(QueryApiImpl),
XGR(XErrorReport),
// the same runtime through gameplatformservices.dll, which XCurl.dll loads from System32 (GetApiVersionImpl above)
{"gameplatformservices.dll", "QueryApiImpl", reinterpret_cast<void*>(&QueryApiImpl)},
{"gameplatformservices.dll", "GetApiVersionImpl", reinterpret_cast<void*>(&GetApiVersionImpl)},