diff --git a/loader/src/hooks/DynamicCastFix.cpp b/loader/src/hooks/DynamicCastFix.cpp index 9119b796..332a021f 100644 --- a/loader/src/hooks/DynamicCastFix.cpp +++ b/loader/src/hooks/DynamicCastFix.cpp @@ -12,10 +12,13 @@ $execute { (void)Mod::get()->patch( reinterpret_cast(base::get() + 0x603948), toByteArray(&cast::typeinfoCastInternal) ); - #elif defined(GEODE_IS_ANDROID32) - (void)Mod::get()->addHook(reinterpret_cast(base::get() + (0x720348 - 0x10000) + 1), &cast::typeinfoCastInternal, "__dynamic_cast"); - #elif defined(GEODE_IS_ANDROID64) - (void)Mod::get()->addHook(reinterpret_cast(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