1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-13 19:35:28 +00:00

Various fixes/matches

- Matched all remaining functions in `__osMalloc.c`, 2 functions in `code_8007BF90.c`, 1 in `code_800A9F30.c`, 2 in `fault.c`, 1 in `fault_drawer.c`, 1 in `gfxprint.c`, 2 in `z_camera.c`
-  Improved most other remaining non matchings to ensure they are actually equivalent and to get them closer to matching
- Added a `alloc.h` header file in the process of working on `fault.c` non matchings
- Decompiled `padmgr.c` data/bss in order to improve padmgr non matchings
- Removed unused `z_en_wallmas.c` data files
- Moved functions confirmed to be in `z_cheap_proc.c` to their own file with that name
This commit is contained in:
Roman971 2020-03-18 01:09:21 +01:00
parent 2c7a339a81
commit 76eb52ab52
37 changed files with 549 additions and 2829 deletions

View file

@ -1,10 +1,13 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
#include <PR/os_cont.h>
#include <ultra64/controller.h>
#include <padmgr.h>
s32 D_8012D280 = 1;
OSMesgQueue* PadMgr_LockGetControllerQueue(PadMgr* padmgr)
{
OSMesgQueue* ctrlrqueue = NULL;
@ -37,23 +40,28 @@ void PadMgr_UnlockReleaseControllerQueue(PadMgr* padmgr, OSMesgQueue* ctrlrqueue
void PadMgr_Lock2(PadMgr* padmgr)
{
osRecvMesg(&padmgr->queue2, 0, OS_MESG_BLOCK);
osRecvMesg(&padmgr->queue2, NULL, OS_MESG_BLOCK);
}
void PadMgr_Unlock2(PadMgr* padmgr)
{
osSendMesg(&padmgr->queue2, 0, OS_MESG_BLOCK);
osSendMesg(&padmgr->queue2, NULL, OS_MESG_BLOCK);
}
#ifdef NON_MATCHING
// regalloc and minor ordering differences
void func_800C740C(PadMgr* padmgr)
{
static u32 D_8012D284 = 0;
static u32 D_8016A4F0;
s32 temp;
s32 var1;
OSMesgQueue* ctrlrqueue;
s32 var3;
s32 var4;
s32 i;
temp = 1;
ctrlrqueue = PadMgr_LockGetControllerQueue(padmgr);
var1 = 0;
@ -63,26 +71,28 @@ void func_800C740C(PadMgr* padmgr)
{
if (padmgr->pad_status[i].status & 1)
{
if (padmgr->unk_2AE[i] == 1)
if (padmgr->unk_2AE[i] == temp)
{
if (padmgr->unk_2B2[i] != 0)
{
if (padmgr->unk_2B6[i] < 3)
{
osSyncPrintf(D_80145894); //"\x1b[33m" (probably formatting/debugger interface)
osSyncPrintf(D_8014589C, i + 1, D_801458B0); //"padmgr: %d[JPN]Con: ", "[JPN]Vibration pack jumble jumble"
osSyncPrintf(D_801458CC); //"\x1b[m" (probably formatting/debugger interface)
if (osSetVibration(&padmgr->unk_controller[i], 1) != 0)
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パック ぶるぶるぶるぶる");
osSyncPrintf(VT_RST);
if (osSetVibration(&padmgr->unk_controller[i], temp) != 0)
{
padmgr->unk_2AE[i] = 0;
osSyncPrintf(D_801458D0);
osSyncPrintf(D_801458D8, i + 1, D_801458EC); //"A communication error has occurred with the vibraton pack"
osSyncPrintf(D_80145914);
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パックで通信エラーが発生しました");
osSyncPrintf(VT_RST);
}
else
{
padmgr->unk_2B6[i] = 3;
}
var1 = 1;
}
}
@ -90,20 +100,22 @@ void func_800C740C(PadMgr* padmgr)
{
if (padmgr->unk_2B6[i] != 0)
{
osSyncPrintf(D_80145918);
osSyncPrintf(D_80145920, i + 1, D_80145934); //"Stop vibration pack"
osSyncPrintf(D_80145944);
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パック 停止");
osSyncPrintf(VT_RST);
if (osSetVibration(&padmgr->unk_controller[i], 0) != 0)
{
padmgr->unk_2AE[i] = 0;
osSyncPrintf(D_80145948);
osSyncPrintf(D_80145950, i + 1, D_80145964); //"A communication error has occurred with the vibration pack"
osSyncPrintf(D_8014598C);
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パックで通信エラーが発生しました");
osSyncPrintf(VT_RST);
}
else
{
padmgr->unk_2B6[i]--;
}
var1 = 1;
}
}
@ -115,16 +127,16 @@ void func_800C740C(PadMgr* padmgr)
{
if (padmgr->unk_2AE[i] == 1)
{
osSyncPrintf(D_80145990);
osSyncPrintf(D_80145998, i + 1, D_801459AC); //"Vibration pack seems to be pulled out"
osSyncPrintf(D_801459CC);
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パックが抜かれたようです");
osSyncPrintf(VT_RST);
padmgr->unk_2AE[i] = 0;
}
else
{
osSyncPrintf(D_801459D0);
osSyncPrintf(D_80145A24);
osSyncPrintf(D_801459D8, i + 1, D_801459EC); //"It seems that a controller pack that is not a vibration pack was pulled out"
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パックではないコントローラパックが抜かれたようです");
osSyncPrintf(VT_RST);
padmgr->unk_2AE[i] = 0;
}
}
@ -145,9 +157,9 @@ void func_800C740C(PadMgr* padmgr)
padmgr->unk_2AE[var3] = 1;
osSetVibration(&padmgr->unk_controller[var3], 1);
osSetVibration(&padmgr->unk_controller[var3], 0);
osSyncPrintf(D_80145A28);
osSyncPrintf(D_80145A30, var3 + 1, D_80145A44); //"Recognized vibration pack"
osSyncPrintf(D_80145A60);
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", var3 + 1, "振動パックを認識しました");
osSyncPrintf(VT_RST);
}
else if (var4 == 11)
{
@ -155,12 +167,11 @@ void func_800C740C(PadMgr* padmgr)
}
else if (var4 == 4)
{
LogUtils_LogThreadId(D_80145A64, 282);
++D_8012D284;
osSyncPrintf(D_80145A70, D_8012D284); //"++errcnt = %d"
osSyncPrintf(D_80145A80);
osSyncPrintf(D_80145A88, var3 + 1, D_80145A9C); //"Controller pack communication error"
osSyncPrintf(D_80145ABC);
LogUtils_LogThreadId("../padmgr.c", 282);
osSyncPrintf("++errcnt = %d\n", ++D_8012D284);
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", var3 + 1, "コントローラパックの通信エラー");
osSyncPrintf(VT_RST);
}
}
}
@ -169,6 +180,8 @@ void func_800C740C(PadMgr* padmgr)
PadMgr_UnlockReleaseControllerQueue(padmgr, ctrlrqueue);
}
#else
u32 D_8012D284 = 0;
u32 D_8016A4F0;
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/func_800C740C.s")
#endif
@ -186,10 +199,10 @@ void func_800C7818(PadMgr* padmgr)
{
if ((gFaultStruct.msgId == 0) && (padmgr->unk_45D != 0))
{
osSyncPrintf("\x1b[33m");
osSyncPrintf(VT_FGCOL(YELLOW));
//EUC-JP: コン | 'Con'? , EUC-JP: 振動パック 停止 | Stop vibration pack
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パック 停止");
osSyncPrintf("\x1b[m");
osSyncPrintf(VT_RST);
}
osSetVibration(&padmgr->unk_controller[i], 0);
@ -211,7 +224,8 @@ void func_800C7934(PadMgr* padmgr, u32 a1, u32 a2)
}
#ifdef NON_MATCHING
//func_800A23CC in 1.0
// minor ordering difference
// 800A23CC in 1.0
void func_800C7948(PadMgr* padmgr, u8* a1)
{
padmgr->unk_2B2[0] = a1[0];