diff --git a/VERSION b/VERSION index 528fe9fc..8bf83ecb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.0-beta.23 \ No newline at end of file +2.0.0-beta.24 \ No newline at end of file diff --git a/loader/include/Geode/cocos/base_nodes/CCNode.h b/loader/include/Geode/cocos/base_nodes/CCNode.h index 799ee032..f23d9063 100644 --- a/loader/include/Geode/cocos/base_nodes/CCNode.h +++ b/loader/include/Geode/cocos/base_nodes/CCNode.h @@ -862,7 +862,9 @@ public: private: friend class geode::modifier::FieldContainer; + [[deprecated("Will be removed, it's an ABI break")]] GEODE_DLL geode::modifier::FieldContainer* getFieldContainer(); + GEODE_DLL geode::modifier::FieldContainer* getFieldContainer(char const* forClass); GEODE_DLL void addEventListenerInternal( std::string const& id, geode::EventListenerProtocol* protocol diff --git a/loader/include/Geode/modify/Field.hpp b/loader/include/Geode/modify/Field.hpp index cfe47042..d67d5d52 100644 --- a/loader/include/Geode/modify/Field.hpp +++ b/loader/include/Geode/modify/Field.hpp @@ -44,8 +44,8 @@ namespace geode::modifier { return m_containedFields.at(index); } - static FieldContainer* from(cocos2d::CCNode* node) { - return node->getFieldContainer(); + static FieldContainer* from(cocos2d::CCNode* node, char const* forClass) { + return node->getFieldContainer(forClass); } }; @@ -97,7 +97,7 @@ namespace geode::modifier { static_assert(sizeof(Base) == offsetof(Parent, m_fields), "offsetof not correct"); // generating the container if it doesn't exist - auto container = FieldContainer::from(node); + auto container = FieldContainer::from(node, typeid(Base).name()); // the index is global across all mods, so the // function is defined in the loader source diff --git a/loader/src/hooks/GeodeNodeMetadata.cpp b/loader/src/hooks/GeodeNodeMetadata.cpp index 5615c2d9..f2e19cbc 100644 --- a/loader/src/hooks/GeodeNodeMetadata.cpp +++ b/loader/src/hooks/GeodeNodeMetadata.cpp @@ -17,6 +17,7 @@ struct ProxyCCNode; class GeodeNodeMetadata final : public cocos2d::CCObject { private: FieldContainer* m_fieldContainer; + std::unordered_map<std::string, FieldContainer*> m_classFieldContainers; std::string m_id = ""; Ref<Layout> m_layout = nullptr; Ref<LayoutOptions> m_layoutOptions = nullptr; @@ -62,6 +63,13 @@ public: FieldContainer* getFieldContainer() { return m_fieldContainer; } + + FieldContainer* getFieldContainer(char const* forClass) { + if (!m_classFieldContainers.count(forClass)) { + m_classFieldContainers[forClass] = new FieldContainer(); + } + return m_classFieldContainers[forClass]; + } }; // proxy forwards @@ -99,6 +107,10 @@ FieldContainer* CCNode::getFieldContainer() { return GeodeNodeMetadata::set(this)->getFieldContainer(); } +FieldContainer* CCNode::getFieldContainer(char const* forClass) { + return GeodeNodeMetadata::set(this)->getFieldContainer(forClass); +} + std::string CCNode::getID() { return GeodeNodeMetadata::set(this)->m_id; } diff --git a/loader/src/ui/nodes/MDTextArea.cpp b/loader/src/ui/nodes/MDTextArea.cpp index e2470daf..363b7fac 100644 --- a/loader/src/ui/nodes/MDTextArea.cpp +++ b/loader/src/ui/nodes/MDTextArea.cpp @@ -2,6 +2,8 @@ #include <Geode/binding/LevelTools.hpp> #include <Geode/binding/LevelInfoLayer.hpp> #include <Geode/binding/CCContentLayer.hpp> +#include <Geode/binding/GJSearchObject.hpp> +#include <Geode/binding/LevelBrowserLayer.hpp> #include <Geode/loader/Mod.hpp> #include <Geode/loader/Loader.hpp> #include <Geode/loader/Index.hpp>