From cfded01caa7d70978e4d9e6806cd348755fc465a Mon Sep 17 00:00:00 2001 From: hatal175 Date: Tue, 9 Dec 2025 23:44:27 +0200 Subject: [PATCH] Match resource.cpp with a small fake match (#2936) --- configure.py | 2 +- include/JSystem/JGadget/linklist.h | 10 ++++++---- include/JSystem/JMessage/data.h | 2 +- src/JSystem/JMessage/resource.cpp | 19 ++++++++++++------- .../JStudio/JStudio/jstudio-control.cpp | 3 ++- src/JSystem/JStudio/JStudio/stb.cpp | 4 ++-- .../MSL_C++/MSL_Common/Include/algorithm.h | 5 ++++- 7 files changed, 28 insertions(+), 17 deletions(-) diff --git a/configure.py b/configure.py index 324ae1941ee..ad0d172217a 100755 --- a/configure.py +++ b/configure.py @@ -1089,7 +1089,7 @@ config.libs = [ Object(MatchingFor(ALL_GCN), "JSystem/JMessage/control.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "JSystem/JMessage/data.cpp"), Object(MatchingFor(ALL_GCN), "JSystem/JMessage/processor.cpp"), - Object(NonMatching, "JSystem/JMessage/resource.cpp"), + Object(MatchingFor(ALL_GCN), "JSystem/JMessage/resource.cpp"), Object(MatchingFor(ALL_GCN), "JSystem/JMessage/locale.cpp"), ], ), diff --git a/include/JSystem/JGadget/linklist.h b/include/JSystem/JGadget/linklist.h index 0ecc12669bc..1d5d46a8043 100644 --- a/include/JSystem/JGadget/linklist.h +++ b/include/JSystem/JGadget/linklist.h @@ -243,6 +243,8 @@ struct TLinkList : TNodeLinkList { return iterator(TNodeLinkList::Find(Element_toNode(element))); } void Remove(T* element) { TNodeLinkList::Remove(Element_toNode(element)); } + + typedef T value_type; }; template @@ -311,10 +313,10 @@ struct TEnumerator2 { Iterator end; }; -template -struct TContainerEnumerator : public TEnumerator2::iterator, T> { - inline TContainerEnumerator(TLinkList* param_0) - : TEnumerator2::iterator, T>(param_0->begin(), param_0->end()) {} +template +struct TContainerEnumerator : public TEnumerator2 { + inline TContainerEnumerator(T& param_0) + : TEnumerator2(param_0.begin(), param_0.end()) {} }; diff --git a/include/JSystem/JMessage/data.h b/include/JSystem/JMessage/data.h index 0a83a904645..755dde8a644 100644 --- a/include/JSystem/JMessage/data.h +++ b/include/JSystem/JMessage/data.h @@ -20,7 +20,7 @@ struct data { u32* get_signature() const { return (u32*)(get() + 0x0); } u32 get_type() const { return *(u32*)(get() + 0x4); } u32 get_blockNumber() const { return *(u32*)(get() + 0xC); } - u8 get_encoding() const { return *(u8*)(get() + 0x10); } + u32 get_encoding() const { return *(u8*)(get() + 0x10); } }; // TParse_TBlock handles parsing the generic section header data diff --git a/src/JSystem/JMessage/resource.cpp b/src/JSystem/JMessage/resource.cpp index ff7500fdf23..2b1ddf70686 100644 --- a/src/JSystem/JMessage/resource.cpp +++ b/src/JSystem/JMessage/resource.cpp @@ -100,10 +100,8 @@ JMessage::TResourceContainer::TCResource::TCResource() {} JMessage::TResourceContainer::TCResource::~TCResource() { JGADGET_ASSERTWARN(173, empty()); } - -// NONMATCHING - likely due to incorrect enumerator setup compared to debug JMessage::TResource* JMessage::TResourceContainer::TCResource::Get_groupID(u16 u16GroupID) { - JGadget::TContainerEnumerator enumerator(this); + JGadget::TContainerEnumerator enumerator(*this); while (enumerator) { const TResource* res = &(*enumerator); if (res->getGroupID() == u16GroupID) @@ -117,9 +115,13 @@ JMessage::TResource* JMessage::TResourceContainer::TCResource::Do_create() { return new TResource(); } -// NONMATCHING extra null comparison void JMessage::TResourceContainer::TCResource::Do_destroy(JMessage::TResource* pResource) { + #if DEBUG delete pResource; + #else + // Fake Match - extra null comparison when not doing the conversion + delete (void*)pResource; + #endif } JMessage::TResourceContainer::TResourceContainer() : encodingType_(0), pfnParseCharacter_(NULL) {} @@ -141,14 +143,17 @@ void JMessage::TResourceContainer::setEncoding_(u8 e) { } JMessage::TParse::TParse(JMessage::TResourceContainer* pContainer) { + u8 sp8[5]; + JMessage::TResourceContainer* cont; JUT_ASSERT(324, pContainer!=NULL); - pContainer_ = pContainer; + cont = pContainer; + pContainer_ = cont; pResource_ = NULL; + sp8[0] = 0; } JMessage::TParse::~TParse() {} -// NONMATCHING regalloc, missing clrlwi bool JMessage::TParse::parseHeader_next(const void** ppData_inout, u32* puBlock_out, u32 param_2) { JUT_ASSERT(343, ppData_inout!=NULL); JUT_ASSERT(344, puBlock_out!=NULL); @@ -172,7 +177,7 @@ bool JMessage::TParse::parseHeader_next(const void** ppData_inout, u32* puBlock_ return false; } - u8 uEncoding = oHeader.get_encoding(); + const u8 uEncoding = oHeader.get_encoding(); if (uEncoding != 0) { if (!pContainer_->isEncodingSettable(uEncoding)) { JGADGET_WARNMSG(369, "encoding not acceptable"); diff --git a/src/JSystem/JStudio/JStudio/jstudio-control.cpp b/src/JSystem/JStudio/JStudio/jstudio-control.cpp index 0a9f83585b6..b58fb20f0f1 100644 --- a/src/JSystem/JStudio/JStudio/jstudio-control.cpp +++ b/src/JSystem/JStudio/JStudio/jstudio-control.cpp @@ -80,8 +80,9 @@ void JStudio::TFactory::appendCreateObject(JStudio::TCreateObject* param_0) { mList.Push_back(param_0); } + JStudio::TObject* JStudio::TFactory::create(JStudio::stb::data::TParse_TBlock_object const& param_0) { - JGadget::TContainerEnumerator aTStack_368(&mList); + JGadget::TContainerEnumerator > aTStack_368(mList); while(aTStack_368) { TCreateObject& piVar1 = *aTStack_368; JStudio::TObject* obj; diff --git a/src/JSystem/JStudio/JStudio/stb.cpp b/src/JSystem/JStudio/JStudio/stb.cpp index b3e20a63f7e..776f6c39f82 100644 --- a/src/JSystem/JStudio/JStudio/stb.cpp +++ b/src/JSystem/JStudio/JStudio/stb.cpp @@ -335,7 +335,7 @@ TObject* TControl::getObject(void const* param_0, u32 param_1) { void TControl::reset() { resetStatus_(); mObject_control.reset(NULL); - JGadget::TContainerEnumerator aTStack_18(&mObjectContainer); + JGadget::TContainerEnumerator > aTStack_18(mObjectContainer); while (aTStack_18) { (*aTStack_18).reset(NULL); } @@ -346,7 +346,7 @@ bool TControl::forward(u32 param_0) { bool rv = mObject_control.forward(param_0); int uVar7 = 0xf; int uVar6 = 0; - JGadget::TContainerEnumerator aTStack_38(&mObjectContainer); + JGadget::TContainerEnumerator > aTStack_38(mObjectContainer); while (aTStack_38) { JStudio::stb::TObject& this_00 = *aTStack_38; rv = this_00.forward(param_0) || rv; diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/algorithm.h b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/algorithm.h index bd4c0713a82..126a38f5bac 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/algorithm.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/algorithm.h @@ -31,7 +31,9 @@ inline ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, template ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, const T& val) { // For some reason, calling the other lower_bound matches for debug, but not for retail: - // return lower_bound(first, last, val, std::detail::less()); + #if DEBUG + return lower_bound(first, last, val, std::detail::less()); + #else typedef typename iterator_traits::difference_type difference_type; difference_type len = std::distance(first, last); @@ -50,6 +52,7 @@ ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, const T } return first; + #endif } template