From dcf44596d2c335c1ad82ea50f7e7d934e6bc1e52 Mon Sep 17 00:00:00 2001 From: Lucas Shaw <49287729+shawlucas@users.noreply.github.com> Date: Sun, 24 Oct 2021 10:59:14 -0400 Subject: Animation system updated, some more boot files decompiled (+6%), z_fcurve_data_skelanime decompiled (1 non-matching), some asm files split, etc (#89) * Progress on various files * gfxprint stuff * split some rodata, add iconv for rodata string parsing * z_std_dma rodata * 2 nonmatchings in gfxprint * mtxuty-cvt ok * more * match a function in idle.c * progress * Cleanup * Rename BgPolygon to CollisionPoly * progress * some effect stuff * more effect progress * updates * made suggested changes * z_effect_soft_sprite_old_init mostly ok * remove old effects enum * gamealloc.c OK * added more files * motor.c almost done * motor.c OK * updates * migration of two files * listalloc.c oK * z_fcurve_data_skelanime split * z_fcurve_data_skelanime.c decompiled * more files split * z_malloc.c OK * contpfs.c OK * fault.c rodata migrated * migrated fault_drawer rodata * update * update preprocess.py * renamed functions in z_skelanime * started z_skelanime cleanup * like halfway through fixing z_skelanime * animation system updated to meet oot standards * remove unused animation structs * rename matrix structs to fit oot * Add -woff 712 * fix diff_settings.py because i accidentally broke it before * fixed merge conflict, doesn't match though * It matches now * Updates * Fixed warnings...added gcc code syntax checking * Remove gcc check, added in Tharo's PR * warnings fixed (i think) * fixed all warnings i think * ok * not sure what to do * Fix all warnings i think (z_en_a_keep needs some file cleanup thouguh) * it matches if i do this * remove comment * accidentally put osPfsFreeBlocks in epilinkhandle.c * memcmp -> bcmp * change u32 size to size_t size, delete string.h because it caused unnecessary confusion with defining size_t twice * format.sh * MTXMODE_NEW and MTXMODE_APPLY to matrix functions * Made suggested changes * pragma sFaultDrawerFont instead of including in repo * add some functions to functions.h * Bss reordering fixed in z_collision_check...added hack to disasm.py * Updated z_en_a_keep.c * Missed suggestion in EnAObj_Destroy * . * update z_fcurve_Data_skelanime and z_skelanime with suggestions * devmgr.c ok * minor changes * Addressed comments * remove redundant file * gfxp -> dlist in game.c * updated actorfixer.py * fixed warnings in z_malloc * Change void* back to Actor* * format * Add the soft_sprit comments back * Rename SV->Flex * remove .common * run format * Update src/code/z_skelanime.c * u32 channel Co-authored-by: Lucas Shaw Co-authored-by: angie Co-authored-by: Kenix3 --- src/boot_O2_g3/fault.c | 49 ++++++++++++++++++++++++++++++++----------- src/boot_O2_g3/fault_drawer.c | 6 ++++-- src/boot_O2_g3/yaz0.c | 2 +- src/boot_O2_g3/z_std_dma.c | 8 +++---- 4 files changed, 46 insertions(+), 19 deletions(-) (limited to 'src/boot_O2_g3') diff --git a/src/boot_O2_g3/fault.c b/src/boot_O2_g3/fault.c index 3cc3deb35..1851d21cb 100644 --- a/src/boot_O2_g3/fault.c +++ b/src/boot_O2_g3/fault.c @@ -1,7 +1,32 @@ +#include "ultra64.h" #include "global.h" #include "vt.h" -#pragma GLOBAL_ASM("asm/non_matchings/boot/fault/D_800982B0.s") +// data +const char* sCpuExceptions[] = { + "Interrupt", + "TLB modification", + "TLB exception on load", + "TLB exception on store", + "Address error on load", + "Address error on store", + "Bus error on inst.", + "Bus error on data", + "System call exception", + "Breakpoint exception", + "Reserved instruction", + "Coprocessor unusable", + "Arithmetic overflow", + "Trap exception", + "Virtual coherency on inst.", + "Floating point exception", + "Watchpoint exception", + "Virtual coherency on data", +}; + +const char* sFpuExceptions[] = { + "Unimplemented operation", "Invalid operation", "Division by zero", "Overflow", "Underflow", "Inexact operation", +}; void Fault_SleepImpl(u32 duration) { u64 value = (duration * OS_CPU_COUNTER) / 1000ull; @@ -79,7 +104,7 @@ void Fault_RemoveClient(FaultClient* client) { } } -void Fault_AddAddrConvClient(FaultAddrConvClient* client, fault_address_converter_func callback, void* param) { +void Fault_AddAddrConvClient(FaultAddrConvClient* client, FaultAddrConvFunc callback, void* param) { OSIntMask mask; u32 alreadyExists = 0; @@ -269,9 +294,9 @@ void Fault_PrintFPCR(u32 value) { u32 flag = 0x20000; FaultDrawer_Printf("FPCSR:%08xH ", value); - for (i = 0; i < ARRAY_COUNT(sExceptionNames); i++) { + for (i = 0; i < ARRAY_COUNT(sFpuExceptions); i++) { if (value & flag) { - FaultDrawer_Printf("(%s)", sExceptionNames[i]); + FaultDrawer_Printf("(%s)", sFpuExceptions[i]); break; } flag >>= 1; @@ -284,9 +309,9 @@ void osSyncPrintfFPCR(u32 value) { u32 flag = 0x20000; osSyncPrintf("FPCSR:%08xH ", value); - for (i = 0; i < ARRAY_COUNT(sExceptionNames); i++) { + for (i = 0; i < ARRAY_COUNT(sFpuExceptions); i++) { if (value & flag) { - osSyncPrintf("(%s)\n", sExceptionNames[i]); + osSyncPrintf("(%s)\n", sFpuExceptions[i]); break; } flag >>= 1; @@ -308,7 +333,7 @@ void Fault_PrintThreadContext(OSThread* t) { FaultDrawer_SetCursor(0x16, 0x14); ctx = &t->context; - FaultDrawer_Printf("THREAD:%d (%d:%s)\n", t->id, causeStrIdx, D_80096B80[causeStrIdx]); + FaultDrawer_Printf("THREAD:%d (%d:%s)\n", t->id, causeStrIdx, sCpuExceptions[causeStrIdx]); FaultDrawer_SetCharPad(-1, 0); FaultDrawer_Printf("PC:%08xH SR:%08xH VA:%08xH\n", (u32)ctx->pc, (u32)ctx->sr, (u32)ctx->badvaddr); @@ -368,7 +393,7 @@ void osSyncPrintfThreadContext(OSThread* t) { ctx = &t->context; osSyncPrintf("\n"); - osSyncPrintf("THREAD ID:%d (%d:%s)\n", t->id, causeStrIdx, D_80096B80[causeStrIdx]); + osSyncPrintf("THREAD ID:%d (%d:%s)\n", t->id, causeStrIdx, sCpuExceptions[causeStrIdx]); osSyncPrintf("PC:%08xH SR:%08xH VA:%08xH\n", (u32)ctx->pc, (u32)ctx->sr, (u32)ctx->badvaddr); osSyncPrintf("AT:%08xH V0:%08xH V1:%08xH\n", (u32)ctx->at, (u32)ctx->v0, (u32)ctx->v1); @@ -444,7 +469,7 @@ void Fault_WaitForButtonCombo(void) { } while (!CHECK_BTN_ALL(input->cur.button, BTN_DLEFT | BTN_L | BTN_R | BTN_CRIGHT)); } -void Fault_DrawMemDumpPage(char* title, u32* addr, u32 param_3) { +void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) { u32* alignedAddr; u32* writeAddr; s32 y; @@ -741,9 +766,9 @@ void Fault_SetOptionsFromController3(void) { } if (faultCustomOptions) { - graphPC = graphOSThread.context.pc; - graphRA = graphOSThread.context.ra; - graphSP = graphOSThread.context.sp; + graphPC = sGraphThread.context.pc; + graphRA = sGraphThread.context.ra; + graphSP = sGraphThread.context.sp; if (CHECK_BTN_ALL(input3->press.button, BTN_R)) { faultCopyToLog = !faultCopyToLog; FaultDrawer_SetOsSyncPrintfEnabled(faultCopyToLog); diff --git a/src/boot_O2_g3/fault_drawer.c b/src/boot_O2_g3/fault_drawer.c index 4e6518d14..949faadf1 100644 --- a/src/boot_O2_g3/fault_drawer.c +++ b/src/boot_O2_g3/fault_drawer.c @@ -1,6 +1,8 @@ #include "global.h" #include "vt.h" +extern const u32 sFaultDrawerFont[]; + FaultDrawer* sFaultDrawContext = &sFaultDrawerStruct; FaultDrawer sFaultDrawerDefault = { (u16*)0x803DA800, // fb - TODO map out buffers in this region and avoid hard-coded pointer @@ -14,7 +16,7 @@ FaultDrawer sFaultDrawerDefault = { GPACK_RGBA5551(0, 0, 0, 0), // backColor 22, // cursorX 16, // cursorY - (u32*)&sFaultDrawerFont, // font + (u32*)sFaultDrawerFont, // font 8, // charW 8, // charH 0, // charWPad @@ -142,7 +144,7 @@ void FaultDrawer_FillScreen() { #pragma GLOBAL_ASM("asm/non_matchings/boot/fault_drawer/FaultDrawer_FormatStringFunc.s") -#pragma GLOBAL_ASM("asm/non_matchings/boot/fault_drawer/D_80099080.s") +const char D_80099080[] = "(null)"; void FaultDrawer_VPrintf(const char* str, char* args) { // va_list _Printf((PrintCallback)FaultDrawer_FormatStringFunc, sFaultDrawContext, str, args); diff --git a/src/boot_O2_g3/yaz0.c b/src/boot_O2_g3/yaz0.c index bf42adf3f..094c0bb38 100644 --- a/src/boot_O2_g3/yaz0.c +++ b/src/boot_O2_g3/yaz0.c @@ -122,7 +122,7 @@ s32 Yaz0_DecompressImpl(u8* src, u8* dst) { return 0; } -void Yaz0_Decompress(u32 romStart, void* dst, u32 size) { +void Yaz0_Decompress(u32 romStart, void* dst, size_t size) { s32 status; u32 pad; char sp80[0x50]; diff --git a/src/boot_O2_g3/z_std_dma.c b/src/boot_O2_g3/z_std_dma.c index 3a447b0e8..2903b488f 100644 --- a/src/boot_O2_g3/z_std_dma.c +++ b/src/boot_O2_g3/z_std_dma.c @@ -9,7 +9,7 @@ OSMesg sDmaMgrMsgs[32]; OSThread sDmaMgrThread; u8 sDmaMgrStack[0x500]; -s32 DmaMgr_DMARomToRam(u32 rom, void* ram, u32 size) { +s32 DmaMgr_DMARomToRam(u32 rom, void* ram, size_t size) { OSIoMesg ioMsg; OSMesgQueue queue; OSMesg msg[1]; @@ -111,7 +111,7 @@ const char* func_800809F4(u32 a0) { void DmaMgr_ProcessMsg(DmaRequest* req) { u32 vrom; void* ram; - u32 size; + size_t size; u32 romStart; u32 romSize; DmaEntry* dmaEntry; @@ -172,7 +172,7 @@ void DmaMgr_ThreadEntry(void* a0) { } } -s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart, u32 size, UNK_TYPE4 unused, +s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart, size_t size, UNK_TYPE4 unused, OSMesgQueue* queue, OSMesg msg) { if (gIrqMgrResetStatus >= 2) { return -2; @@ -190,7 +190,7 @@ s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart, return 0; } -s32 DmaMgr_SendRequest0(void* vramStart, u32 vromStart, u32 size) { +s32 DmaMgr_SendRequest0(void* vramStart, u32 vromStart, size_t size) { DmaRequest req; OSMesgQueue queue; OSMesg msg[1]; -- cgit v1.2.3