mirror of
https://github.com/geode-sdk/geode.git
synced 2025-02-18 09:10:17 -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();
|
return node->getFieldContainer();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GEODE_DLL size_t getFieldIndexForClass(size_t hash);
|
||||||
|
|
||||||
template <class Parent, class Base>
|
template <class Parent, class Base>
|
||||||
class FieldIntermediate {
|
class FieldIntermediate {
|
||||||
// Padding used for guaranteeing any member of parents
|
// Padding used for guaranteeing any member of parents
|
||||||
// will be in between sizeof(Intermediate) and sizeof(Parent)
|
// will be in between sizeof(Intermediate) and sizeof(Parent)
|
||||||
uintptr_t m_padding;
|
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:
|
public:
|
||||||
static void fieldConstructor(void* offsetField) {
|
static void fieldConstructor(void* offsetField) {
|
||||||
|
|
|
@ -64,7 +64,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// proxy forwards
|
// proxy forwards
|
||||||
// clang-format off
|
|
||||||
#include <Geode/modify/CCNode.hpp>
|
#include <Geode/modify/CCNode.hpp>
|
||||||
struct ProxyCCNode : Modify<ProxyCCNode, CCNode> {
|
struct ProxyCCNode : Modify<ProxyCCNode, CCNode> {
|
||||||
virtual CCObject* getUserObject() {
|
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
|
// not const because might modify contents
|
||||||
FieldContainer* CCNode::getFieldContainer() {
|
FieldContainer* CCNode::getFieldContainer() {
|
||||||
|
|
Loading…
Reference in a new issue