mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-26 17:36:05 -05:00
Merge branch 'altalk' of https://github.com/altalk23/geode into altalk
This commit is contained in:
commit
c116b47a61
2 changed files with 6 additions and 7 deletions
|
@ -41,17 +41,14 @@ namespace geode::modifier {
|
|||
return node->getFieldContainer();
|
||||
}
|
||||
};
|
||||
|
||||
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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue