Merge branch 'altalk' of https://github.com/altalk23/geode into altalk

This commit is contained in:
altalk23 2022-12-03 17:28:09 +03:00
commit c116b47a61
2 changed files with 6 additions and 7 deletions

View file

@ -42,16 +42,13 @@ namespace geode::modifier {
}
};
GEODE_DLL size_t getFieldIndexForClass(size_t hash);
template <class Parent, class Base>
class FieldIntermediate {
// Padding used for guaranteeing any member of parents
// will be in between sizeof(Intermediate) and sizeof(Parent)
uintptr_t m_padding;
static inline std::unordered_map<size_t, size_t> nextIndex;
static size_t getFieldIndexForClass(size_t hash) {
return nextIndex[hash]++;
}
public:
static void fieldConstructor(void* offsetField) {

View file

@ -64,7 +64,6 @@ public:
};
// proxy forwards
// clang-format off
#include <Geode/modify/CCNode.hpp>
struct ProxyCCNode : Modify<ProxyCCNode, CCNode> {
virtual CCObject* getUserObject() {
@ -80,7 +79,10 @@ struct ProxyCCNode : Modify<ProxyCCNode, CCNode> {
}
};
// clang-format on
static inline std::unordered_map<size_t, size_t> s_nextIndex;
size_t modifier::getFieldIndexForClass(size_t hash) {
return s_nextIndex[hash]++;
}
// not const because might modify contents
FieldContainer* CCNode::getFieldContainer() {