Matching. Pulled from ogws

This commit is contained in:
elijah-thomas774
2024-05-04 20:21:58 -04:00
parent 1ecdfe9a4d
commit 3b8a4efbfd
4 changed files with 85 additions and 5 deletions
+3
View File
@@ -170,6 +170,9 @@ rvl/CX/cx.c:
nw4r/ut/ut_list.cpp:
.text start:0x8042A530 end:0x8042A850
nw4r/ut/ut_LinkList.cpp:
.text start:0x8042A850 end:0x8042A9E0
nw4r/db/db_directPrint.cpp:
.text start:0x804342A0 end:0x80434E9C
.rodata start:0x804F5D28 end:0x804F5FDC
+5 -5
View File
@@ -23934,11 +23934,11 @@ List_Remove__Q24nw4r2utFPQ34nw4r2ut4ListPv = .text:0x8042A750; // type:function
List_GetNext__Q24nw4r2utFPCQ34nw4r2ut4ListPCv = .text:0x8042A7C0; // type:function size:0x20
List_GetPrev__Q24nw4r2utFPCQ34nw4r2ut4ListPCv = .text:0x8042A7E0; // type:function size:0x1C
List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs = .text:0x8042A800; // type:function size:0x50
fn_8042A850 = .text:0x8042A850; // type:function size:0x84
fn_8042A8E0 = .text:0x8042A8E0; // type:function size:0x48
fn_8042A930 = .text:0x8042A930; // type:function size:0x44
fn_8042A980 = .text:0x8042A980; // type:function size:0x2C
fn_8042A9B0 = .text:0x8042A9B0; // type:function size:0x30
__dt__Q44nw4r2ut6detail12LinkListImplFv = .text:0x8042A850; // type:function size:0x84
Erase__Q44nw4r2ut6detail12LinkListImplFQ54nw4r2ut6detail12LinkListImpl8Iterator = .text:0x8042A8E0; // type:function size:0x48
Clear__Q44nw4r2ut6detail12LinkListImplFv = .text:0x8042A930; // type:function size:0x44
Insert__Q44nw4r2ut6detail12LinkListImplFQ54nw4r2ut6detail12LinkListImpl8IteratorPQ34nw4r2ut12LinkListNode = .text:0x8042A980; // type:function size:0x2C
Erase__Q44nw4r2ut6detail12LinkListImplFPQ34nw4r2ut12LinkListNode = .text:0x8042A9B0; // type:function size:0x30
fn_8042A9E0 = .text:0x8042A9E0; // type:function size:0x74
fn_8042AA60 = .text:0x8042AA60; // type:function size:0x78
fn_8042AAE0 = .text:0x8042AAE0; // type:function size:0x1C
+1
View File
@@ -318,6 +318,7 @@ config.libs = [
"ut",
[
Object(Matching, "nw4r/ut/ut_list.cpp"),
Object(Matching, "nw4r/ut/ut_LinkList.cpp"),
],
),
# EGG
+76
View File
@@ -0,0 +1,76 @@
#include <nw4r/ut/ut_LinkList.h>
namespace nw4r {
namespace ut {
namespace detail {
/* 8042a850 */
LinkListImpl::~LinkListImpl() {
Clear();
}
/* 8042a8e0 */
LinkListImpl::Iterator LinkListImpl::Erase(LinkListImpl::Iterator it) {
Iterator copy(it);
return Erase(it, ++copy);
}
/* 8042a930 */
void LinkListImpl::Clear() {
Erase(GetBeginIter(), GetEndIter());
}
/* 8042a980 */
LinkListImpl::Iterator LinkListImpl::Insert(Iterator it, LinkListNode *p) {
LinkListNode *next = it.mNode;
LinkListNode *prev = next->mPrev;
// prev <- p -> next
p->mNext = next;
p->mPrev = prev;
// prev <-> p <-> next
next->mPrev = p;
prev->mNext = p;
mSize++;
return Iterator(p);
}
/* 8042a9b0 */
LinkListImpl::Iterator LinkListImpl::Erase(LinkListNode *p) {
LinkListNode *next = p->mNext;
LinkListNode *prev = p->mPrev;
// Remove connections to node
next->mPrev = prev;
prev->mNext = next;
mSize--;
// Isolate node
p->mNext = NULL;
p->mPrev = NULL;
return Iterator(next);
}
/* Not in SS */
LinkListImpl::Iterator LinkListImpl::Erase(Iterator begin, Iterator end) {
LinkListNode *pCur = begin.mNode;
LinkListNode *pEnd = end.mNode;
while (pCur != pEnd) {
// Preserve next node before erasing pointers
LinkListNode *pNext = pCur->mNext;
// Erase current node
Erase(pCur);
pCur = pNext;
}
return Iterator(pEnd);
}
} // namespace detail
} // namespace ut
} // namespace nw4r