Merge branch 'main' into flag-mgr-experimenting

This commit is contained in:
CovenEsme
2024-04-27 15:23:21 +00:00
committed by GitHub
6 changed files with 226 additions and 26 deletions
+6
View File
@@ -127,6 +127,9 @@ toBeSorted/skipflag_manager.cpp:
.sbss start:0x80575408 end:0x80575410
.bss start:0x805A9C68 end:0x805A9C88
c/c_list.cpp:
.text start:0x802E08C0 end:0x802E0A10
f/f_base.cpp:
.text start:0x802E12F0 end:0x802E2680
.ctors start:0x804DB8C0 end:0x804DB8C4
@@ -161,6 +164,9 @@ m/m_mtx.cpp:
rvl/CX/cx.c:
.text start:0x803CEE90 end:0x803D0B20
nw4r/ut/ut_list.cpp:
.text start:0x8042A530 end:0x8042A850
nw4r/db/db_directPrint.cpp:
.text start:0x804342A0 end:0x80434EA0
.rodata start:0x804F5D28 end:0x804F5FE0
+17 -17
View File
@@ -17278,7 +17278,7 @@ fn_802E0710 = .text:0x802E0710; // type:function size:0xD8
fn_802E07F0 = .text:0x802E07F0; // type:function size:0x24
fn_802E0820 = .text:0x802E0820; // type:function size:0x34
fn_802E0860 = .text:0x802E0860; // type:function size:0x60
fn_802E08C0 = .text:0x802E08C0; // type:function size:0x40
insertAfter__9cListMg_cFP9cListNd_cP9cListNd_c = .text:0x802E08C0; // type:function size:0x40
remove__9cListMg_cFP9cListNd_c = .text:0x802E0900; // type:function size:0xAC
append__9cListMg_cFP9cListNd_c = .text:0x802E09B0; // type:function size:0x30
prepend__9cListMg_cFP9cListNd_c = .text:0x802E09E0; // type:function size:0x30
@@ -22151,11 +22151,11 @@ VIWaitForRetrace = .text:0x803B4760; // type:function size:0x54
fn_803B47C0 = .text:0x803B47C0; // type:function size:0x2A8
fn_803B4A70 = .text:0x803B4A70; // type:function size:0xE0
fn_803B4B50 = .text:0x803B4B50; // type:function size:0x194
fn_803B4CF0 = .text:0x803B4CF0; // type:function size:0x6CC
VIConfigure = .text:0x803B4CF0; // type:function size:0x6CC
fn_803B53C0 = .text:0x803B53C0; // type:function size:0x354
fn_803B5720 = .text:0x803B5720; // type:function size:0x114
fn_803B5840 = .text:0x803B5840; // type:function size:0x6C
fn_803B58B0 = .text:0x803B58B0; // type:function size:0x8
VIFlush = .text:0x803B5720; // type:function size:0x114
VISetNextFrameBuffer = .text:0x803B5840; // type:function size:0x6C
VIGetCurrentFrameBuffer = .text:0x803B58B0; // type:function size:0x8
VISetBlack = .text:0x803B58C0; // type:function size:0x78
VIGetRetraceCount = .text:0x803B5940; // type:function size:0x8
fn_803B5950 = .text:0x803B5950; // type:function size:0x9C
@@ -23926,14 +23926,14 @@ fn_8042A148 = .text:0x8042A148; // type:function size:0x124
fn_8042A26C = .text:0x8042A26C; // type:function size:0x104
fn_8042A370 = .text:0x8042A370; // type:function size:0xE0
fn_8042A450 = .text:0x8042A450; // type:function size:0xE0
fn_8042A530 = .text:0x8042A530; // type:function size:0x18
fn_8042A550 = .text:0x8042A550; // type:function size:0x70
fn_8042A5C0 = .text:0x8042A5C0; // type:function size:0x6C
fn_8042A630 = .text:0x8042A630; // type:function size:0x120
fn_8042A750 = .text:0x8042A750; // type:function size:0x6C
fn_8042A7C0 = .text:0x8042A7C0; // type:function size:0x20
fn_8042A7E0 = .text:0x8042A7E0; // type:function size:0x1C
fn_8042A800 = .text:0x8042A800; // type:function size:0x50
List_Init__Q24nw4r2utFPQ34nw4r2ut4ListUs = .text:0x8042A530; // type:function size:0x18
List_Append__Q24nw4r2utFPQ34nw4r2ut4ListPv = .text:0x8042A550; // type:function size:0x70
List_Prepend__Q24nw4r2utFPQ34nw4r2ut4ListPv = .text:0x8042A5C0; // type:function size:0x6C
List_Insert__Q24nw4r2utFPQ34nw4r2ut4ListPvPv = .text:0x8042A630; // type:function size:0x120
List_Remove__Q24nw4r2utFPQ34nw4r2ut4ListPv = .text:0x8042A750; // type:function size:0x6C
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
@@ -36497,11 +36497,11 @@ jumptable_8055FB08 = .data:0x8055FB08; // type:object size:0x44 scope:local
lbl_8055FB4C = .data:0x8055FB4C; // type:object size:0x44
jumptable_8055FB90 = .data:0x8055FB90; // type:object size:0x44 scope:local
jumptable_8055FBD4 = .data:0x8055FBD4; // type:object size:0x54 scope:local
lbl_8055FC28 = .data:0x8055FC28; // type:object size:0x3C
GXNtsc480IntDf = .data:0x8055FC28; // type:object size:0x3C
lbl_8055FC64 = .data:0x8055FC64; // type:object size:0x3C
lbl_8055FCA0 = .data:0x8055FCA0; // type:object size:0x3C
lbl_8055FCDC = .data:0x8055FCDC; // type:object size:0x3C
lbl_8055FD18 = .data:0x8055FD18; // type:object size:0x40
GXMpal480IntDf = .data:0x8055FCA0; // type:object size:0x3C
GXPal528IntDf = .data:0x8055FCDC; // type:object size:0x3C
GXEurgb60Hz480IntDf = .data:0x8055FD18; // type:object size:0x40
jumptable_8055FD58 = .data:0x8055FD58; // type:object size:0xF4 scope:local
jumptable_8055FE4C = .data:0x8055FE4C; // type:object size:0xF4 scope:local
jumptable_8055FF40 = .data:0x8055FF40; // type:object size:0x3C scope:local
+7
View File
@@ -275,6 +275,7 @@ config.libs = [
Object(NonMatching, "toBeSorted/flag_space.cpp"),
Object(NonMatching, "toBeSorted/misc_flag_managers.cpp"),
Object(NonMatching, "toBeSorted/skipflag_manager.cpp"),
Object(Matching, "c/c_list.cpp"),
Object(Matching, "d/d_base.cpp"),
Object(NonMatching, "d/d_heap.cpp"),
Object(NonMatching, "d/d_stage.cpp"),
@@ -311,6 +312,12 @@ config.libs = [
Object(NonMatching, "nw4r/db/db_directPrint.cpp"),
],
),
nw4rLib(
"ut",
[
Object(Matching, "nw4r/ut/ut_list.cpp"),
],
),
# EGG
EGGLib(
"core",
+73
View File
@@ -0,0 +1,73 @@
#include <c/c_list.h>
bool cListMg_c::insertAfter(cListNd_c *node, cListNd_c *prevNode) {
if (prevNode == nullptr) {
return this->prepend(node);
}
if (node == nullptr) {
return;
}
node->mpNext = prevNode->mpNext;
node->mpPrev = prevNode;
prevNode->mpNext = node;
if (node->mpNext != nullptr) {
node->mpNext->mpPrev = node;
} else {
this->mpLast = node;
}
}
bool cListMg_c::remove(cListNd_c *node) {
if (node == nullptr) {
return;
}
if (node->mpPrev == nullptr && node->mpNext == nullptr) {
if (this->mpFirst == node && this->mpLast == node) {
this->mpFirst = nullptr;
this->mpLast = nullptr;
}
} else {
if (node->mpPrev != nullptr) {
node->mpPrev->mpNext = node->mpNext;
} else if (node == this->mpFirst) {
this->mpFirst = node->mpNext;
}
if (node->mpNext != nullptr) {
node->mpNext->mpPrev = node->mpPrev;
} else if (node == this->mpLast) {
this->mpLast = node->mpPrev;
}
node->mpPrev = nullptr;
node->mpNext = nullptr;
}
}
bool cListMg_c::append(cListNd_c *node) {
if (node == nullptr) {
return;
}
if (this->mpLast != nullptr) {
this->mpLast->mpNext = node;
node->mpPrev = this->mpLast;
} else {
this->mpFirst = node;
}
this->mpLast = node;
}
bool cListMg_c::prepend(cListNd_c *node) {
if (node == nullptr) {
return;
}
if (this->mpFirst != nullptr) {
this->mpFirst->mpPrev = node;
node->mpNext = this->mpFirst;
} else {
this->mpLast = node;
}
this->mpFirst = node;
}
+5 -9
View File
@@ -9,9 +9,6 @@
NOTE: This file does not match fully yet, Inlining + function ordering needs to still be addressed
Nonmatching functions:
DrawStringLineToXfb_ https://decomp.me/scratch/uqeZ6
This worked for SS: as seen in egg stuff ive worked on, not sure if it works for others ¯\_(ツ)_/¯
- Especially with inlines. DWARF provides info of local vars and maps provide calls to functions,
but outside of that I made some guesses.
@@ -256,9 +253,7 @@ const char *DrawStringLineToXfb_(int posh, int posv, const char *str, int width)
char c;
int code, cnt, tab_size;
cnt = 0;
while (*str != '\0') {
c = *str;
for (cnt = 0; (c = *str) != '\0'; str++) {
if (c == '\n' || c == '\0') {
return str;
}
@@ -274,11 +269,12 @@ const char *DrawStringLineToXfb_(int posh, int posv, const char *str, int width)
posh += 6;
cnt++;
}
if (cnt >= width && str[1] == '\n') {
str++;
if (cnt >= width) {
if (str[1] == '\n') {
str++;
}
return str;
}
str++;
}
return str;
}
+118
View File
@@ -0,0 +1,118 @@
#include <nw4r/ut/ut_list.h>
namespace nw4r {
namespace ut {
#define NODE_PTR(list, object) ((Node*)(((char*)object) + list->offset))
void* List_GetNth(const List* list, u16 n) {
void *object;
int c;
for (c = 0, object = nullptr; object = List_GetNext(list, object); c++) {
if (n == c) {
return object;
}
}
return nullptr;
}
void* List_GetPrev(const List* list, const void* object) {
if (object == nullptr) {
return list->last;
} else {
return NODE_PTR(list, object)->prev;
}
}
void* List_GetNext(const List* list, const void* object) {
if (object == nullptr) {
return list->first;
} else {
return NODE_PTR(list, object)->next;
}
}
void List_Remove(List* list, void* object) {
Node *node = NODE_PTR(list, object);
if (node->prev == nullptr) {
list->first = node->next;
} else {
NODE_PTR(list, node->prev)->next = node->next;
}
if (node->next == nullptr) {
list->last = node->prev;
} else {
NODE_PTR(list, node->next)->prev = node->prev;
}
node->prev = nullptr;
node->next = nullptr;
list->size--;
}
void List_Insert(List* list, void* next, void* object) {
if (next == nullptr) {
List_Append(list, object);
} else if (next == list->first) {
List_Prepend(list, object);
} else {
Node *newNode = NODE_PTR(list, object);
void *prevObj = NODE_PTR(list, next)->prev;
Node *prevNode = NODE_PTR(list, prevObj);
newNode->prev = prevObj;
newNode->next = next;
prevNode->next = object;
NODE_PTR(list, next)->prev = object;
list->size++;
}
}
void List_Prepend(List* list, void* object) {
if (list->first == nullptr) {
Node *node = NODE_PTR(list, object);
node->next = nullptr;
node->prev = nullptr;
list->first = object;
list->last = object;
list->size++;
} else {
Node *node = NODE_PTR(list, object);
node->prev = nullptr;
node->next = list->first;
NODE_PTR(list, list->first)->prev = object;
list->first = object;
list->size++;
}
}
void List_Append(List* list, void* object) {
if (list->first == nullptr) {
Node *node = NODE_PTR(list, object);
node->next = nullptr;
node->prev = nullptr;
list->first = object;
list->last = object;
list->size++;
} else {
Node *node = NODE_PTR(list, object);
node->prev = list->last;
node->next = nullptr;
NODE_PTR(list, list->last)->next = object;
list->last = object;
list->size++;
}
}
void List_Init(List* list, u16 offset) {
list->first = nullptr;
list->last = nullptr;
list->size = 0;
list->offset = offset;
}
} // namespace ut
} // namespace nw4r