functionvalue matches and cleanup

This commit is contained in:
LagoLunatic
2024-09-10 13:37:02 -04:00
parent a1bd36d0c5
commit 580a5eefe5
4 changed files with 49 additions and 27 deletions
+10 -5
View File
@@ -6,14 +6,19 @@
namespace JGadget {
template <typename T>
struct TAllocator {
static TAllocator get() { }
// TODO: this constructor declaration needs to be removed in order to match TFunctionValue_composite's constructor
// in functionvalue.cpp, and in order to get the @564 struct literal to appear in the .sbss section of that TU.
// however, removing this declaration also causes that bss literal to appear in hundreds of other TUs it shouldn't.
TAllocator();
inline TAllocator();
// TODO
void AllocateRaw(u32) {}
void DeallocateRaw(void*) {}
void allocate(u32, const void*) {}
void deallocate(T*, u32) {}
void destroy(T*) {}
/* 0x00 */ u8 _00;
/* 0x04 */ u32 _04;
/* 0x08 */ u32 _08;
/* 0x0C */ u32 _0C;
};
typedef TAllocator<void*> TVoidAllocator;
+1 -1
View File
@@ -11,7 +11,7 @@ namespace JGadget {
template <typename T>
inline const T& toValueFromIndex(int idx, const T* pValue, u32 count, const T& fallback) {
ASSERT(pValue != NULL);
return (idx >= count) ? fallback : pValue[idx];
return (idx < count) ? pValue[idx] : fallback;
}
} // namespace JGadget
@@ -76,8 +76,7 @@ public:
class TFunctionValueAttribute_refer : public JGadget::TVector_pointer<TFunctionValue*> {
public:
TFunctionValueAttribute_refer() :
JGadget::TVector_pointer<TFunctionValue*>(JGadget::TAllocator<void*>()) {}
TFunctionValueAttribute_refer() : JGadget::TVector_pointer<TFunctionValue*>(JGadget::TAllocator<void*>()) {}
~TFunctionValueAttribute_refer() {}
void refer_initialize();