Use variable names from ghidra project. Reorganize some data tables and header files to work easier with it.

This commit is contained in:
rozlette
2019-11-28 00:26:09 -06:00
parent e64adeff3e
commit 86ab9c2067
26 changed files with 30310 additions and 15089 deletions
+14 -14
View File
@@ -39,7 +39,7 @@ UNK_RET func_80080250(void) {
v1 = &code_vrom_start;
t7 = &code_vrom_end;
v0 = &D_80096B50;
v0 = &dmamgrChunkSize;
sp28 = *v0;
*v0 = 0;
@@ -48,14 +48,14 @@ UNK_RET func_80080250(void) {
func_800801EC();
osRecvMesg(&sp30, 0, 1);
D_80096B50 = sp28;
dmamgrChunkSize = sp28;
func_80080150(&D_801E3FA0, &D_80208EA0);
}
UNK_RET func_80080300(UNK_TYPE a0) {
func_80085320(&D_8009A670, &D_8009A170, &D_8009A670_, 0, 256, &D_800981A0);
func_80081754(&D_80099EF0, &D_8009A670, 18, 1);
func_80085320(&irqmgrThreadInfo, &irqmgrStack, &irqmgrStack[1280], 0, 256, &irqmgrThreadName);
func_80081754(&irqmgrContext, &irqmgrThreadInfo, 18, 1);
func_80080D0C();
func_80080250();
func_80174BF0(a0);
@@ -66,9 +66,9 @@ void func_8008038C(void) {
u32 i;
osCreateViManager(254);
D_80096B2C = 66;
D_80096B30 = 1.0;
D_80096B34 = 1.0;
viEnabledSpecialFeatures = 66;
screenXScale = 1.0;
screenYScale = 1.0;
switch (osTvType) {
case 1:
@@ -76,19 +76,19 @@ void func_8008038C(void) {
for (i = 0; i < 20; i++) {
D_800980E0[i] = D_8009B240[i];
}
D_80096B34 = D_800981B0;
screenYScale = D_800981B0;
break;
case 2:
D_8009B290 = 30;
for (i = 0; i < 20; i++) {
D_80098010[i] = D_8009B240[i];
osViModeMpalLan1[i] = D_8009B240[i];
}
D_80096B34 = D_800981B0;
screenYScale = D_800981B0;
break;
case 0:
D_8009B290 = 44;
for (i = 0; i < 20; i++) {
D_80097FC0[i] = D_8009B240[i];
osViModeNtscLan1[i] = D_8009B240[i];
}
break;
}
@@ -99,9 +99,9 @@ void func_8008038C(void) {
void func_80080514(UNK_TYPE a0) {
func_8008038C();
osCreatePiManager(150, (OSMesgQueue*)&D_8009B228, (OSMesg*)&D_8009B160, 50);
func_80085320(&D_8009B140, &D_8009A840, &D_8009B140_, 0, 1024, &D_800981A8);
osCreateThread((OSThread*)&D_8009A690, 3, (void (*)(void*))func_80080300, (void*)a0, (void*)&D_8009B140, 12);
osStartThread((OSThread*)&D_8009A690);
func_80085320(&mainThreadInfo, &mainStack, &mainStack[2304], 0, 1024, &mainThreadName);
osCreateThread((OSThread*)&mainOSThread, 3, (void (*)(void*))func_80080300, (void*)a0, (void*)&mainThreadInfo, 12);
osStartThread((OSThread*)&mainOSThread);
osSetThreadPri(NULL, 0);
while(1);
+13 -13
View File
@@ -6,7 +6,7 @@ void func_80085320(ThreadInfo* a0, UNK_PTR a1, UNK_PTR a2, UNK_TYPE a3, UNK_TYPE
ThreadInfo* v0;
if (a0 == NULL) {
g_s80085320_ListHead = NULL;
ThreadInfoListHead = NULL;
return;
}
@@ -16,23 +16,23 @@ void func_80085320(ThreadInfo* a0, UNK_PTR a1, UNK_PTR a2, UNK_TYPE a3, UNK_TYPE
a0->unk14 = sp10;
a0->unk18 = sp14;
v0 = g_s80085320_ListHead;
v0 = ThreadInfoListHead;
while (v0 != NULL) {
if (v0 == a0) return;
v0 = v0->next;
}
a0->prev = g_s80085320_ListTail;
a0->prev = ThreadInfoListTail;
a0->next = NULL;
if (g_s80085320_ListTail != NULL) {
g_s80085320_ListTail->next = a0;
if (ThreadInfoListTail != NULL) {
ThreadInfoListTail->next = a0;
}
g_s80085320_ListTail = a0;
ThreadInfoListTail = a0;
if (g_s80085320_ListHead == NULL) {
g_s80085320_ListHead = a0;
if (ThreadInfoListHead == NULL) {
ThreadInfoListHead = a0;
}
if (a0->unk14 != -1) {
@@ -44,16 +44,16 @@ void func_80085320(ThreadInfo* a0, UNK_PTR a1, UNK_PTR a2, UNK_TYPE a3, UNK_TYPE
UNK_RET func_800853F8(ThreadInfo* a0) {
if (a0->prev == NULL) {
if (g_s80085320_ListHead == a0) {
g_s80085320_ListHead = a0->next;
if (ThreadInfoListHead == a0) {
ThreadInfoListHead = a0->next;
}
} else {
a0->prev->next = a0->next;
}
if (a0->next == NULL) {
if (g_s80085320_ListTail == a0) {
g_s80085320_ListTail = a0->prev;
if (ThreadInfoListTail == a0) {
ThreadInfoListTail = a0->prev;
}
}
}
@@ -83,7 +83,7 @@ UNK_TYPE func_80085468(ThreadInfo* a0) {
}
UNK_TYPE func_800854E0(UNK_ARGS) {
ThreadInfo* s0 = g_s80085320_ListHead;
ThreadInfo* s0 = ThreadInfoListHead;
UNK_TYPE ret = 0;
while (s0 != NULL) {
if (func_80085468(s0) != 0) {
+18 -18
View File
@@ -8,54 +8,54 @@ OSPiHandle* func_80092920(void) {
u32 temp3;
u32 temp4;
UNK_TYPE func_ret;
func_8008C1E0();
if (D_800980D0 == 0) {
func_8008C224();
return &D_8009E610;
}
D_800980D0_ = 0;
D_800980D0 = 0; // TODO volatile?
D_8009E610.type = 0;
D_8009E610.baseAddress = 0xB0000000;
D_8009E610.domain = 0;
D_8009E610.speed = 0;
func_80089630(&D_8009E624, 96);
while ((*(vu32*)0xA4600010) & 0x3);
temp = *(vu32*)0xA4600014;
temp2 = *(vu32*)0xA460001C;
temp3 = *(vu32*)0xA4600020;
temp4 = *(vu32*)0xA4600018;
*(vu32*)0xA4600014 = 255;
*(vu32*)0xA460001C = 0;
*(vu32*)0xA4600020 = 3;
*(vu32*)0xA4600018 = 255;
v0 = *(u32*)(D_8009E610.baseAddress | 0xA0000000);
D_8009E610.pageSize = (v0 >> 16) & 0xF;
D_8009E610.relDuration = (v0 >> 20) & 0xF;
D_8009E610.pulse = v0 >> 8;
D_8009E610.latency = v0;
*(vu32*)0xA4600014 = temp;
*(vu32*)0xA460001C = temp2;
*(vu32*)0xA4600020 = temp3;
*(vu32*)0xA4600018 = temp4;
func_ret = func_80091A60();
D_8009E610.next = D_80097E8C;
D_80097E8C = &D_8009E610;
D_8009E610.next = osPiHandleListHead;
osPiHandleListHead = &D_8009E610;
func_80091AD0(func_ret);
func_8008C224();
return &D_8009E610;
}
+4 -4
View File
@@ -2,13 +2,13 @@
#include <global.h>
UNK_RET start(void) {
thread_info_init(&D_80099500, &D_80099AF0, &D_80099EF0, 0, -1, &D_80098190);
thread_info_init(&bootThreadInfo, &bootStack, &irqmgrContext, 0, -1, &bootThreadName);
osMemSize = func_8008D350();
func_800818F4();
osInitialize();
osUnmapTLBAll();
D_80096B40 = func_80092920();
thread_info_init(&D_80099AD0, &D_800996D0, &D_80099AD0_, 0, 256, &D_80098198);
osCreateThread(&D_80099520, 1, (void(*)(void*))Idle_ThreadEntry, 0, &D_80099AD0, 12);
osStartThread(&D_80099520);
thread_info_init(&idleTreadInfo, &idleStack, &idleStack[1024], 0, 256, &idleThreadName);
osCreateThread(&idleOSThread, 1, (void(*)(void*))Idle_ThreadEntry, 0, &idleTreadInfo, 12);
osStartThread(&idleOSThread);
}
+11 -11
View File
@@ -7,23 +7,23 @@ UNK_RET func_800805E0(UNK_TYPE a0) {
if (a0 != 0) {
switch (osTvType) {
case 2:
osViSetMode(&D_80098010);
osViSetMode(&osViModeMpalLan1);
break;
case 0:
osViSetMode(&D_80097590);
break;
case 1:
default:
osViSetMode(&D_80097FC0);
osViSetMode(&osViModeNtscLan1);
break;
}
// TODO v0 is used here instead of a0. Is this a 7.1 optimization?
if (D_80096B2C != 0) {
osViSetSpecialFeatures(D_80096B2C);
if (viEnabledSpecialFeatures != 0) {
osViSetSpecialFeatures(viEnabledSpecialFeatures);
}
if (D_80096B34 != 1) {
if (screenYScale != 1) {
osViSetYScale(1);
}
} else {
@@ -34,16 +34,16 @@ UNK_RET func_800805E0(UNK_TYPE a0) {
}
// TODO v0 is used here instead of a0. Is this a 7.1 optimization?
if (D_80096B2C != 0) {
osViSetSpecialFeatures(D_80096B2C);
if (viEnabledSpecialFeatures != 0) {
osViSetSpecialFeatures(viEnabledSpecialFeatures);
}
if (D_80096B30 != 1) {
osViSetXScale(D_80096B30);
if (screenXScale != 1) {
osViSetXScale(screenXScale);
}
if (D_80096B34 != 1) {
osViSetYScale(D_80096B34);
if (screenYScale != 1) {
osViSetYScale(screenYScale);
}
}
+21 -20
View File
@@ -7,7 +7,7 @@ s32 Dmamgr_DoDmaTransfer(void* a0, void* a1, s32 a2) {
OSMesgQueue sp48;
OSMesg sp44;
s32 ret;
u32 s0 = D_80096B50;
u32 s0 = dmamgrChunkSize;
osInvalDCache(a1, a2);
osCreateMesgQueue(&sp48, &sp44, 1);
@@ -89,8 +89,9 @@ s32 Dmamgr_FindDmaIndex(u32 a0) {
return -1;
}
UNK_TYPE* func_800809F4(u32 a0) {
return &D_800981C0;
// TODO this should be a string
char* func_800809F4(u32 a0) {
return &D_800981C0[0];
}
#ifdef NONMATCHING
@@ -111,10 +112,10 @@ void Dmamgr_HandleRequest(DmaRequest* a0) {
sp1C = Dmamgr_FindDmaIndex(sp34);
if ((sp1C >= 0) && (sp1C < D_8009B2BC)) {
if ((sp1C >= 0) && (sp1C < numDmaEntries)) {
if (dmadata[sp1C].romEnd == 0) {
if (dmadata[sp1C].vromEnd < (sp2C + sp34)) {
func_80083E4C(&D_800981C4, 499);
func_80083E4C(&dmamgrString800981C4, 499);
}
Dmamgr_DoDmaTransfer((u8*)((dmadata[sp1C].romStart + sp34) - dmadata[sp1C].vromStart), (u8*)sp30, sp2C);
return;
@@ -125,18 +126,18 @@ void Dmamgr_HandleRequest(DmaRequest* a0) {
sp28 = dmadata[sp1C].romStart;
if (sp34 != dmadata[sp1C].vromStart) {
func_80083E4C(&D_800981D4, 518);
func_80083E4C(&dmamgrString800981D4, 518);
}
if (sp2C != (dmadata[sp1C].vromEnd - dmadata[sp1C].vromStart)) {
func_80083E4C(&D_800981E4, 525);
func_80083E4C(&dmamgrString800981E4, 525);
}
osSetThreadPri(NULL, 10);
Yaz0_LoadAndDecompressFile(sp28, sp30, sp24);
osSetThreadPri(NULL, 17);
} else {
func_80083E4C(&D_800981F4, 558);
func_80083E4C(&dmamgrString800981F4, 558);
}
}
@@ -154,13 +155,13 @@ void Dmamgr_ThreadEntry(void* a0) {
DmaRequest* s0;
for (;;) {
osRecvMesg(&D_8009B2C0, (OSMesg)&sp34, 1);
osRecvMesg(&dmamgrMsq, (OSMesg)&sp34, 1);
if (sp34 == NULL) return;
s0 = sp34;
Dmamgr_HandleRequest(s0);
// TODO a0 isn't being used for this comparison
if (s0->unk18 == NULL) continue;
osSendMesg(&D_8009B2C0, (OSMesg)s0->unk1C, 0);
osSendMesg(&dmamgrMsq, (OSMesg)s0->unk1C, 0);
}
}
@@ -173,10 +174,10 @@ GLOBAL_ASM("./asm/nonmatching/z_std_dma/Dmamgr_ThreadEntry.asm")
#ifdef NONMATCHING
s32 Dmamgr_SendRequest(DmaRequest* a0, UNK_FUN_PTR(a1), UNK_PTR a2, UNK_TYPE a3, UNK_TYPE sp30, OSMesgQueue* sp34, UNK_TYPE sp38) {
// TODO this isn't correct, it uses a lui, addiu to get the address of D_80096B60, then loads it,
// meaning that this is likely just "if (*D_80096B60 >= 2)". However, I can not get it to not
// TODO this isn't correct, it uses a lui, addiu to get the address of prenmiStage, then loads it,
// meaning that this is likely just "if (*prenmiStage >= 2)". However, I can not get it to not
// produce the usual lui, lw combo to load from an address :/
if (*D_80096B60 >= 2) {
if (*prenmiStage >= 2) {
return -2;
}
@@ -187,7 +188,7 @@ s32 Dmamgr_SendRequest(DmaRequest* a0, UNK_FUN_PTR(a1), UNK_PTR a2, UNK_TYPE a3,
a0->unk18 = sp34;
a0->unk1C = sp38;
osSendMesg(&D_8009B2C0, (OSMesg)a0, 1);
osSendMesg(&dmamgrMsq, (OSMesg)a0, 1);
return 0;
}
@@ -227,15 +228,15 @@ void Dmamgr_Start() {
for (v0 = dmadata, v1 = 0; v0->vromEnd != 0; v0++, v1++);
D_8009B2BC = (u16)v1;
numDmaEntries = (u16)v1;
osCreateMesgQueue(&D_8009B2C0, (OSMesg)&D_8009B2D8, 32);
osCreateMesgQueue(&dmamgrMsq, (OSMesg)&dmamgrMsqMessages, 32);
thread_info_init(&D_8009B2A0, &D_8009B508, &D_8009BA08, 0, 256, &D_80098204);
thread_info_init(&dmamgrThreadInfo, &dmamgrStack, &D_8009BA08, 0, 256, &dmamgrThreadName);
osCreateThread(&D_8009B358, 18, Dmamgr_ThreadEntry, NULL, &D_8009BA08, 17);
osCreateThread(&dmamgrOSThread, 18, Dmamgr_ThreadEntry, NULL, &D_8009BA08, 17);
osStartThread(&D_8009B358);
osStartThread(&dmamgrOSThread);
}
#else
@@ -245,5 +246,5 @@ GLOBAL_ASM("./asm/nonmatching/z_std_dma/Dmamgr_Start.asm")
#endif
void Dmamgr_Stop() {
osSendMesg(&D_8009B2C0, NULL, 1);
osSendMesg(&dmamgrMsq, NULL, 1);
}
+2 -2
View File
@@ -9,9 +9,9 @@ UNK_RET EnAObj_Init(void* a0, UNK_TYPE a1) {
ActorEnAObj* s0 = (ActorEnAObj*)a0;
s0->base.textId = ((s0->base.variable >> 8) & 0xFF) | 0x300;
s0->base.variable = (s0->base.variable & 0xFF) - 9;
Lib_ApplyActorInitVars((Actor*)s0, (ActorInitVar*)&D_801ADEAC);
Lib_ApplyActorInitVars((Actor*)s0, (ActorInitVar*)&enAObjInitVar);
func_800B3BA4(&s0->base.unkBC, 0, (UNK_PTR)&func_800B3FC0, 12);
Collision_InitCylinder(a1, &s0->collision, (Actor*)s0, &D_801ADE80);
Collision_InitCylinder(a1, &s0->collision, (Actor*)s0, &enAObjCylinderInit);
Collision_CylinderMoveToActor((Actor*)s0, &s0->collision);
s0->base.unkA0.unk16 = 255;
s0->update = (actor_func)EnAObj_Update1;
+2 -2
View File
@@ -10,7 +10,7 @@ UNK_RET func_800BF9A0(UNK_TYPE a0, UNK_TYPE a1) {
func_800847CC(&D_801DCBB0, D_801B4610);
func_800847CC(&D_801DCBC4);
for (i = 0, s0 = &D_801AEFD0; i < D_801B4610; i++, s0++) {
for (i = 0, s0 = &actorOverlayTable[0]; i < D_801B4610; i++, s0++) {
v1 = s0->vramEnd - s0->vramStart;
if (s0->ramAddr == 0) continue;
func_800847CC(&D_801DCBE4, i, s0->ramAddr, s0->ramAddr + v1, s0->clients, &D_801DCBFC);
@@ -19,7 +19,7 @@ UNK_RET func_800BF9A0(UNK_TYPE a0, UNK_TYPE a1) {
UNK_TYPE func_800BFA78(UNK_TYPE a0, UNK_TYPE a1) {
s32 i;
ActorOverlayTableEntry* v0 = &D_801AEFD0;
ActorOverlayTableEntry* v0 = &actorOverlayTable[0];
UNK_TYPE t1;
UNK_TYPE a2;
UNK_TYPE a0_2 = a0;
+2 -2
View File
@@ -3,14 +3,14 @@
s800E03A0* func_800E03A0(s32 a0) {
if ((a0 < 0) || (a0 > 22)) return 0;
return &((&D_801B9F20)[a0]);
return &(D_801B9F20[a0]);
}
// Probably zeroes out a s800E03A0?
void func_800E03CC(u8* a0) {
s32 i;
u8* v1;
for (i = 0, v1 = a0; i < 32; i++) {
*v1++ = 0;
}
+3 -3
View File
@@ -421,7 +421,7 @@ UNK_TYPE Lib_PitchVec3f(Vector3f* a0, Vector3f* a1) {
void Lib_ApplyActorInitVars(Actor* a0, ActorInitVar* a1) {
do {
D_801BE960[a1->type]((u8*)a0, a1);
actorInitVarFuncs[a1->type]((u8*)a0, a1);
} while ((a1++)->cont);
}
@@ -650,7 +650,7 @@ f32 Lib_PushAwayVec3f(Vector3f* a0, Vector3f* a1, f32 a2) {
void Lib_Nop801004FC(void) {}
UNK_TYPE Lib_PtrSegToPhys(u32 a0) {
return(D_801F8180[(a0 << 4) >> 28] + (a0 & 0xFFFFFF)) + 0x80000000;
return(rspSegmentPhysAddrs[(a0 << 4) >> 28] + (a0 & 0xFFFFFF)) + 0x80000000;
}
UNK_TYPE Lib_PtrSegToPhysNull(u32 a0) {
@@ -658,7 +658,7 @@ UNK_TYPE Lib_PtrSegToPhysNull(u32 a0) {
return a0;
}
return(D_801F8180[(a0 << 4) >> 28] + (a0 & 0xFFFFFF)) + 0x80000000;
return(rspSegmentPhysAddrs[(a0 << 4) >> 28] + (a0 & 0xFFFFFF)) + 0x80000000;
}
UNK_TYPE Lib_PtrSegToK0(UNK_TYPE a0) {