dynamically resolve dynamic_cast address

This commit is contained in:
qimiko 2024-01-15 19:48:24 -07:00
parent e6cd66aee7
commit b871c2a088
No known key found for this signature in database
GPG key ID: D2D404DD810FE0E3

View file

@ -12,10 +12,13 @@ $execute {
(void)Mod::get()->patch(
reinterpret_cast<void*>(base::get() + 0x603948), toByteArray(&cast::typeinfoCastInternal)
);
#elif defined(GEODE_IS_ANDROID32)
(void)Mod::get()->addHook(reinterpret_cast<void*>(base::get() + (0x720348 - 0x10000) + 1), &cast::typeinfoCastInternal, "__dynamic_cast");
#elif defined(GEODE_IS_ANDROID64)
(void)Mod::get()->addHook(reinterpret_cast<void*>(base::get() + (0xd6cb8c - 0x100000)), &cast::typeinfoCastInternal, "__dynamic_cast");
#elif defined(GEODE_IS_ANDROID)
void* handle = dlopen("libcocos2dcpp.so", RTLD_LAZY | RTLD_NOLOAD);
void* dynamicCastAddr = dlsym(handle, "__dynamic_cast");
(void)Mod::get()->addHook(dynamicCastAddr, &cast::typeinfoCastInternal, "__dynamic_cast");
dlclose(handle);
#endif