dynamic cast hooks for macos

This commit is contained in:
qimiko 2024-06-04 22:23:14 -07:00
parent f08856f663
commit 712caa4c1e
No known key found for this signature in database
GPG key ID: D2D404DD810FE0E3

View file

@ -8,9 +8,12 @@ $execute {
// this is needed because the transitions in cocos uses dynamic cast to check
// layers, which fail on user layers due to typeinfo not matching
#if defined(GEODE_IS_MACOS)
void* dynamicCastAddr = reinterpret_cast<void*>(base::get() + 0x7a7c9f);
#if defined(GEODE_IS_INTEL_MAC)
void* dynamicCastAddr = reinterpret_cast<void*>(base::get() + 0x7dd5e7);
(void) Mod::get()->hook(dynamicCastAddr, &cast::typeinfoCastInternal, "__dynamic_cast");
#elif defined(GEODE_IS_ARM_MAC)
void* dynamicCastAddr = reinterpret_cast<void*>(base::get() + 0x6dfb10);
(void)Mod::get()->hook(dynamicCastAddr, &cast::typeinfoCastInternal, "__dynamic_cast");
#elif defined(GEODE_IS_ANDROID)
void* handle = dlopen("libcocos2dcpp.so", RTLD_LAZY | RTLD_NOLOAD);
void* dynamicCastAddr = dlsym(handle, "__dynamic_cast");