From b260dfea8120f2976494abef8fb54c89f06be0ec Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Tue, 8 Apr 2025 18:17:15 -0400 Subject: [PATCH] object-id OK --- configure.py | 2 +- include/JSystem/JStudio/JStudio/object-id.h | 4 ++-- src/JSystem/JStudio/JStudio/object-id.cpp | 26 ++++++++++----------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/configure.py b/configure.py index 3c33646c6..6810e957e 100755 --- a/configure.py +++ b/configure.py @@ -716,7 +716,7 @@ config.libs = [ Object(NonMatching, "JSystem/JStudio/JStudio/fvb.cpp"), Object(Matching, "JSystem/JStudio/JStudio/fvb-data.cpp"), Object(Matching, "JSystem/JStudio/JStudio/fvb-data-parse.cpp"), - Object(NonMatching, "JSystem/JStudio/JStudio/object-id.cpp"), + Object(Matching, "JSystem/JStudio/JStudio/object-id.cpp"), Object(NonMatching, "JSystem/JStudio/JStudio/stb.cpp"), Object(Matching, "JSystem/JStudio/JStudio/stb-data.cpp"), Object(Matching, "JSystem/JStudio/JStudio/stb-data-parse.cpp"), diff --git a/include/JSystem/JStudio/JStudio/object-id.h b/include/JSystem/JStudio/JStudio/object-id.h index b38901c85..0a3321097 100644 --- a/include/JSystem/JStudio/JStudio/object-id.h +++ b/include/JSystem/JStudio/JStudio/object-id.h @@ -11,8 +11,8 @@ struct TIDData { public: TIDData(const void* id, u32 id_size) : mID(id), mID_size(id_size) {} - bool isEqual(JStudio::object::TIDData const&, JStudio::object::TIDData const&); - inline const void* getID() const { return mID; } + static bool isEqual(JStudio::object::TIDData const&, JStudio::object::TIDData const&); + inline const u8* getID() const { return (const u8*)mID; } inline u32 getIDSize() const { return mID_size; } private: diff --git a/src/JSystem/JStudio/JStudio/object-id.cpp b/src/JSystem/JStudio/JStudio/object-id.cpp index a647266b9..cf2400f7e 100644 --- a/src/JSystem/JStudio/JStudio/object-id.cpp +++ b/src/JSystem/JStudio/JStudio/object-id.cpp @@ -8,30 +8,30 @@ /* 80274AF8-80274BE8 .text isEqual__Q37JStudio6object7TIDDataFRCQ37JStudio6object7TIDDataRCQ37JStudio6object7TIDData */ bool JStudio::object::TIDData::isEqual(const JStudio::object::TIDData& a, const JStudio::object::TIDData& b) { - /* Nonmatching - regalloc */ - if (a.getIDSize() != b.getIDSize()) { + u32 aSize = a.getIDSize(); + u32 bSize = b.getIDSize(); + if (aSize != bSize) { return false; } - u32 bytesRemaining = a.mID_size; - const void* aStr = a.getID(); - u32* aStr32 = (u32*)aStr; - const void* bStr = b.getID(); - u32* bStr32 = (u32*)bStr; - if (aStr == bStr) { // mismatch here + const u8* aStr32 = a.getID(); + const u8* bStr32 = b.getID(); + if (aStr32 == bStr32) { // they point to the same id return true; } - for (; bytesRemaining >= 4; bytesRemaining -= 4, aStr32++, bStr32++) { - if (*aStr32 != *bStr32) { + u32 u = aSize; + for (; u >= 4; u -= 4, aStr32 += 4, bStr32 += 4) { + if (*(u32*)aStr32 != *(u32*)bStr32) { return false; } } - u8* aStrBytes = (u8*)aStr32; - u8* bStrBytes = (u8*)bStr32; - switch (bytesRemaining) { + const u8* aStrBytes = aStr32; + const u8* bStrBytes = bStr32; + // JUT_ASSERT(46, u<4); + switch (u) { case 3: if (*aStrBytes != *bStrBytes) { return false;