#pragma once #include "../meta/meta.hpp" #include "Addresses.hpp" #include "Field.hpp" #include "Types.hpp" #include "Wrapper.hpp" #include #include #include #include "IDManager.hpp" #define GEODE_APPLY_MODIFY_FOR_FUNCTION( \ addr_index, pure_index, convention, className, functionName \ ) \ if constexpr (wrap::functionName::uuid != nullptr && (void*)wrap::functionName::uuid != (void*)wrap::functionName::uuid) { \ (void)Mod::get() \ ->addHook::value, convention>( \ #className "::" #functionName, (void*)addresses::address##addr_index() \ ); \ } namespace geode::modifier { template class ModifyDerive; template class ModifyBase { public: // unordered_map idea ModifyBase() { Derived::apply(); } template friend class ModifyDerive; // explicit Modify(Property property) idea }; template class ModifyDerive { public: ModifyDerive() { static_assert(core::meta::always_false, "Custom Modify not implemented."); } }; } namespace geode { template class Modify : public Base { private: static inline modifier::ModifyDerive s_apply; // because for some reason we need it static inline auto s_applyRef = &Modify::s_apply; public: // abusing the internal stuff // basically we dont want modify to invoke base ctors and dtors // we already have utilities for these, which are ccdestructor // and the monostate constructor Modify() : Base(std::monostate(), sizeof(Base)) {} ~Modify() { cocos2d::CCDestructor::lock(this) = true; } Modify(Modify const&) = delete; Modify(Modify&&) = delete; modifier::FieldIntermediate m_fields; }; }