Change Metal hooking to use RegisterFunctionHook

Instead of direct function pointer capture at compile time
This commit is contained in:
Jake Turner
2022-03-11 17:24:40 +00:00
committed by Baldur Karlsson
parent 91df933215
commit 6d24e2b100
+7 -1
View File
@@ -81,9 +81,15 @@ void MetalHook::RegisterGlobalNonHookedMetalFunctions()
#undef METAL_FETCH
}
extern void AppleRegisterRealSymbol(const char *functionName, void *address);
void MetalHook::RegisterGlobalHookedMetalFunctions()
{
#define METAL_FUNC(func) METAL.func = &::func;
#define METAL_FUNC(func) \
AppleRegisterRealSymbol(STRINGIZE(func), (void *)&::func); \
LibraryHooks::RegisterFunctionHook("Metal", FunctionHook(STRINGIZE(func), (void **)&METAL.func, \
(void *)&METAL_EXPORT_NAME(func)));
ForEachMetalSupported();
#undef METAL_FUNC
}