2023-01-24 19:27:46 +03:00
|
|
|
#include <Geode/DefaultInclude.hpp>
|
2023-10-02 16:50:10 +03:00
|
|
|
#include <Geode/loader/Mod.hpp>
|
2023-01-24 19:27:46 +03:00
|
|
|
|
2023-03-10 11:33:24 -08:00
|
|
|
using namespace geode::prelude;
|
2023-01-24 19:27:46 +03:00
|
|
|
|
|
|
|
$execute {
|
|
|
|
// this replaces the call to __dynamic_cast with a call to our own
|
|
|
|
// this is needed because the transitions in cocos uses dynamic cast to check
|
|
|
|
// layers, which fail on user layers due to typeinfo not matching
|
|
|
|
|
2023-10-02 16:50:10 +03:00
|
|
|
#if defined(GEODE_IS_MACOS)
|
2024-01-21 20:08:06 +03:00
|
|
|
void* dynamicCastAddr = reinterpret_cast<void*>(base::get() + 0x7a7c9f);
|
|
|
|
(void) Mod::get()->hook(dynamicCastAddr, &cast::typeinfoCastInternal, "__dynamic_cast");
|
2024-01-15 19:48:24 -07:00
|
|
|
#elif defined(GEODE_IS_ANDROID)
|
|
|
|
void* handle = dlopen("libcocos2dcpp.so", RTLD_LAZY | RTLD_NOLOAD);
|
|
|
|
void* dynamicCastAddr = dlsym(handle, "__dynamic_cast");
|
2023-10-02 16:50:10 +03:00
|
|
|
|
2024-01-15 22:19:54 -07:00
|
|
|
(void)Mod::get()->hook(dynamicCastAddr, &cast::typeinfoCastInternal, "__dynamic_cast");
|
2023-10-02 16:50:10 +03:00
|
|
|
|
2024-01-15 19:48:24 -07:00
|
|
|
dlclose(handle);
|
2023-10-02 16:50:10 +03:00
|
|
|
#endif
|
2024-01-15 00:47:02 +03:00
|
|
|
}
|