geode/loader/src/hooks/DynamicCastFix.cpp

19 lines
537 B
C++
Raw Normal View History

#include <Geode/DefaultInclude.hpp>
#ifdef GEODE_IS_MACOS
USE_GEODE_NAMESPACE();
2023-02-08 08:42:34 -05:00
#include <Geode/loader/Mod.hpp>
#include <Geode/modify/Modify.hpp>
$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
(void)Mod::get()->patch(
2023-02-08 08:42:34 -05:00
reinterpret_cast<void*>(base::get() + 0x603948), toByteArray(&cast::typeinfoCastInternal)
);
}
#endif