diff options
| author | Random <28494085+Random0666@users.noreply.github.com> | 2020-03-20 12:43:51 +0100 |
|---|---|---|
| committer | Random <28494085+Random0666@users.noreply.github.com> | 2020-03-20 15:26:43 +0100 |
| commit | 8779aaa75875d17dded8605a4e1731de475f0760 (patch) | |
| tree | 2d2b51674752d09ecb6fda4fcf01148788efcdcf /src/code | |
| parent | 9c9ad6160b15e1ce0294fe00da29bf20cca6a591 (diff) | |
Decompiled various small files
- Decompiled `code_8006C360.c`
- Decompiled `prenmi_buf.c` (previously `code_8007BE60.c`)
- Decompiled `code_8007BF10.c`
- Documented `sys_ucode.c`
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/code_8006C360.c | 77 | ||||
| -rw-r--r-- | src/code/code_8007BE60.c | 50 | ||||
| -rw-r--r-- | src/code/code_8007BF10.c | 20 | ||||
| -rw-r--r-- | src/code/main.c | 8 | ||||
| -rw-r--r-- | src/code/prenmi_buff.c | 35 | ||||
| -rw-r--r-- | src/code/sys_ucode.c | 8 | ||||
| -rw-r--r-- | src/code/z_room.c | 8 |
7 files changed, 142 insertions, 64 deletions
diff --git a/src/code/code_8006C360.c b/src/code/code_8006C360.c index 3180bab89..3551ed172 100644 --- a/src/code/code_8006C360.c +++ b/src/code/code_8006C360.c @@ -1,5 +1,80 @@ #include <ultra64.h> #include <global.h> -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C360/func_8006C360.s") +//#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C360/func_8006C360.s") + +typedef struct +{ + u16 data[9]; +} struct_8011F3F0; // size = 0x12 + +struct_8011F3F0 D_8011F3F0[60] = +{ + { { 0x0000, 0x7124, 0x7127, 0x7126, 0x7125, 0x7127, 0x7124, 0x7125, 0x7127 } }, + { { 0x0000, 0x7128, 0x7129, 0x7128, 0x7128, 0x7128, 0x7128, 0x712A, 0x712B } }, + { { 0x0000, 0x7128, 0x712B, 0x7128, 0x7128, 0x7129, 0x7128, 0x712B, 0x7128 } }, + { { 0x0000, 0x7128, 0x7129, 0x7128, 0x7128, 0x7128, 0x7128, 0x712A, 0x712B } }, + { { 0x0000, 0x7128, 0x7129, 0x712B, 0x7128, 0x7128, 0x7128, 0x7129, 0x7128 } }, + { { 0x0000, 0x712D, 0x712D, 0x712D, 0x712D, 0x712D, 0x712D, 0x712D, 0x712F } }, + { { 0x0000, 0x712C, 0x712C, 0x712C, 0x712E, 0x712C, 0x712C, 0x712F, 0x712F } }, + { { 0x0000, 0x712C, 0x712C, 0x712C, 0x712F, 0x712C, 0x712C, 0x712F, 0x712F } }, + { { 0x0000, 0x7130, 0x7132, 0x7133, 0x7130, 0x7130, 0x7131, 0x7132, 0x7131 } }, + { { 0x0000, 0x7134, 0x7137, 0x7135, 0x7134, 0x7136, 0x7135, 0x7134, 0x7135 } }, + { { 0x0000, 0x7138, 0x713A, 0x7138, 0x7139, 0x713A, 0x7138, 0x7139, 0x713B } }, + { { 0x0000, 0x7144, 0x7146, 0x7144, 0x7146, 0x7147, 0x7145, 0x7145, 0x7147 } }, + { { 0x0000, 0x7148, 0x7149, 0x7149, 0x714A, 0x714A, 0x714B, 0x7149, 0x714B } }, + { { 0x0000, 0x714C, 0x714D, 0x714C, 0x714C, 0x714E, 0x714C, 0x714E, 0x714F } }, + { { 0x0000, 0x7150, 0x7153, 0x7152, 0x7150, 0x7151, 0x7153, 0x7153, 0x7151 } }, + { { 0x0000, 0x7155, 0x7156, 0x7157, 0x7154, 0x7156, 0x7156, 0x7156, 0x7156 } }, + { { 0x0000, 0x715A, 0x7159, 0x715B, 0x715A, 0x715A, 0x7158, 0x7158, 0x715B } }, + { { 0x0000, 0x715E, 0x715D, 0x715D, 0x715F, 0x715E, 0x715C, 0x715C, 0x715D } }, + { { 0x0000, 0x7163, 0x7162, 0x7160, 0x7163, 0x7160, 0x7161, 0x7161, 0x7160 } }, + { { 0x0000, 0x7164, 0x7166, 0x7164, 0x7167, 0x7164, 0x7164, 0x7164, 0x7167 } }, + { { 0x0000, 0x716B, 0x7169, 0x7168, 0x716B, 0x716A, 0x716B, 0x716B, 0x716A } }, + { { 0x0000, 0x716C, 0x716D, 0x716F, 0x716C, 0x716E, 0x716E, 0x716E, 0x716F } }, + { { 0x0000, 0x7171, 0x7173, 0x7170, 0x7172, 0x0000, 0x0000, 0x0000, 0x0000 } }, + { { 0x0000, 0x7176, 0x7177, 0x7174, 0x7174, 0x7175, 0x7174, 0x7174, 0x7177 } }, + { { 0x0000, 0x7178, 0x7179, 0x7179, 0x717B, 0x717A, 0x717B, 0x717A, 0x717B } }, + { { 0x0000, 0x717D, 0x717C, 0x717C, 0x717D, 0x717F, 0x717C, 0x717E, 0x717D } }, + { { 0x0000, 0x7183, 0x7181, 0x7180, 0x7183, 0x7182, 0x7183, 0x7181, 0x7183 } }, + { { 0x0000, 0x7184, 0x7186, 0x7185, 0x7186, 0x7184, 0x7187, 0x7186, 0x7184 } }, + { { 0x0000, 0x71A4, 0x71A6, 0x71A5, 0x0000, 0x71A6, 0x71A6, 0x71A6, 0x71A7 } }, + { { 0x0000, 0x7188, 0x7188, 0x7189, 0x7188, 0x7189, 0x718B, 0x718A, 0x7189 } }, + { { 0x0000, 0x718C, 0x718C, 0x718D, 0x718C, 0x718E, 0x718F, 0x718D, 0x718C } }, + { { 0x0000, 0x7190, 0x7190, 0x7191, 0x7192, 0x7191, 0x7193, 0x7190, 0x7191 } }, + { { 0x0000, 0x7196, 0x7194, 0x7195, 0x7196, 0x7197, 0x7194, 0x7196, 0x7195 } }, + { { 0x0000, 0x7199, 0x719A, 0x7198, 0x7198, 0x719A, 0x719A, 0x719B, 0x7198 } }, + { { 0x0000, 0x719D, 0x719C, 0x719E, 0x719D, 0x719D, 0x719C, 0x719F, 0x719E } }, + { { 0x0000, 0x71A1, 0x71A0, 0x71A1, 0x71A2, 0x71A1, 0x71A2, 0x71A3, 0x71A2 } }, + { { 0x0000, 0x711C, 0x711E, 0x711C, 0x711F, 0x711E, 0x711C, 0x711D, 0x711F } }, + { { 0x0000, 0x7104, 0x7105, 0x7107, 0x7107, 0x7105, 0x7106, 0x7107, 0x7107 } }, + { { 0x0000, 0x7107, 0x7105, 0x7107, 0x7107, 0x7106, 0x7107, 0x7107, 0x7105 } }, + { { 0x0000, 0x7113, 0x7117, 0x7113, 0x7110, 0x7112, 0x7112, 0x7116, 0x7112 } }, + { { 0x0000, 0x7113, 0x7113, 0x7113, 0x7113, 0x7113, 0x7113, 0x7111, 0x7113 } }, + { { 0x0000, 0x7113, 0x7117, 0x7113, 0x7110, 0x7112, 0x7112, 0x7116, 0x7112 } }, + { { 0x0000, 0x7117, 0x7117, 0x7117, 0x7117, 0x7117, 0x7117, 0x7117, 0x7113 } }, + { { 0x0000, 0x7101, 0x7100, 0x7102, 0x7103, 0x7101, 0x7100, 0x7102, 0x7103 } }, + { { 0x0000, 0x7100, 0x7102, 0x7100, 0x7100, 0x7100, 0x7100, 0x7100, 0x7102 } }, + { { 0x0000, 0x710A, 0x7109, 0x7109, 0x710A, 0x710B, 0x7108, 0x7109, 0x710B } }, + { { 0x0000, 0x7117, 0x7112, 0x7113, 0x7110, 0x710C, 0x7117, 0x710E, 0x7112 } }, + { { 0x0000, 0x710D, 0x710F, 0x710C, 0x7112, 0x710D, 0x710C, 0x710C, 0x710F } }, + { { 0x0000, 0x710A, 0x7109, 0x711A, 0x710A, 0x7109, 0x7108, 0x710B, 0x7109 } }, + { { 0x0000, 0x710C, 0x710F, 0x7113, 0x7110, 0x710D, 0x7112, 0x7116, 0x710D } }, + { { 0x0000, 0x7115, 0x7114, 0x7114, 0x7115, 0x7114, 0x7114, 0x7116, 0x7117 } }, + { { 0x0000, 0x7113, 0x710F, 0x7113, 0x7110, 0x710C, 0x711A, 0x710D, 0x7112 } }, + { { 0x0000, 0x7101, 0x7102, 0x7103, 0x7101, 0x7100, 0x7100, 0x7102, 0x7100 } }, + { { 0x0000, 0x7112, 0x710E, 0x7112, 0x710E, 0x710D, 0x7112, 0x710E, 0x710F } }, + { { 0x0000, 0x7142, 0x7141, 0x7142, 0x7143, 0x7140, 0x7140, 0x7141, 0x7143 } }, + { { 0x0000, 0x713C, 0x713D, 0x713D, 0x713E, 0x713E, 0x713F, 0x713D, 0x713F } }, + { { 0x0000, 0x7101, 0x7102, 0x7103, 0x7101, 0x7100, 0x7100, 0x7102, 0x7100 } }, + { { 0x0000, 0x7113, 0x7117, 0x7113, 0x7110, 0x7112, 0x7112, 0x7116, 0x7112 } }, + { { 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x7105, 0x7105, 0x7107, 0x7107 } }, + { { 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x710C, 0x7105, 0x7107, 0x7107 } }, +}; + +u16 func_8006C360(GlobalContext* globalCtx, u32 idx) +{ + u8 mask = func_8008F080(globalCtx); + return D_8011F3F0[idx].data[mask]; +} diff --git a/src/code/code_8007BE60.c b/src/code/code_8007BE60.c deleted file mode 100644 index 59ef949c5..000000000 --- a/src/code/code_8007BE60.c +++ /dev/null @@ -1,50 +0,0 @@ -#include <ultra64.h> -#include <global.h> - -extern u32 osResetType; - -/* -void func_8007BE60(u32* a0) -{ - u32 var1; - - //*a0 = 0; - - if (osResetType == 0) - { - a0[1] = 0; - a0[2] = 0; - a0[3] = 0; - } - else - { - var1 = a0[3] + a0[5]; - a0[1]++; - a0[2] = (var1 < a0[5]) + a0[2] + a0[4]; - a0[3] = var1; - } - - a0[5] = 0; - a0[4] = 0; -} -*/ - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BE60/func_8007BE60.s") - -typedef struct -{ - /* 0x00 */ u32 unk_00; - /* 0x04 */ char unk_04[0x0C]; - /* 0x10 */ OSTime unk_10; -} struct_8007BED4; - -void func_8007BED4(struct_8007BED4* arg0) -{ - arg0->unk_00 = 1; - arg0->unk_10 = osGetTime(); -} - -u32 func_8007BF08(struct_8007BED4* arg0) -{ - return arg0->unk_00; -} diff --git a/src/code/code_8007BF10.c b/src/code/code_8007BF10.c index 46771a303..f318d23bf 100644 --- a/src/code/code_8007BF10.c +++ b/src/code/code_8007BF10.c @@ -1,5 +1,23 @@ #include <ultra64.h> #include <global.h> +#include <sched.h> -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF10/func_8007BF10.s") +void func_8007BF10() +{ + u32 pad[4]; + OSScTask task; + OSMesgQueue queue; + OSMesg msg; + u32 pad2[1]; + task.next = NULL; + task.flags = 3; + task.msgQ = &queue; + task.msg = NULL; + task.framebuffer = NULL; + task.list.t.type = 0; + osCreateMesgQueue(task.msgQ, &msg, 1); + osSendMesg(&gSchedContext.cmdQ, &task, OS_MESG_BLOCK); + func_800C95F8(&gSchedContext); // osScKickEntryMsg + osRecvMesg(&queue, NULL, OS_MESG_BLOCK); +} diff --git a/src/code/main.c b/src/code/main.c index f69f62317..987654a41 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -7,7 +7,7 @@ u32 gScreenWidth = SCREEN_WIDTH; u32 gScreenHeight = SCREEN_HEIGHT; u32 gSystemHeapSize = 0; -u8* gAppNmiBufferPtr; +PreNmiBuff* gAppNmiBufferPtr; SchedContext gSchedContext; PadMgr gPadMgr; IrqMgr gIrqMgr; @@ -50,8 +50,8 @@ void Main(void* arg0) osSyncPrintf("mainproc 実行開始\n"); //Start running gScreenWidth = SCREEN_WIDTH; gScreenHeight = SCREEN_HEIGHT; - gAppNmiBufferPtr = osAppNmiBuffer; - func_8007BE60(gAppNmiBufferPtr); + gAppNmiBufferPtr = (PreNmiBuff*)osAppNmiBuffer; + PreNmiBuff_Init(gAppNmiBufferPtr); Fault_Start(); SysCfb_Init(0); sysHeap = (u32)gSystemHeap; @@ -112,7 +112,7 @@ void Main(void* arg0) if (*msg == OS_SC_PRE_NMI_MSG) { osSyncPrintf("main.c: リセットされたみたいだよ\n"); //Looks like it's been reset - func_8007BED4(gAppNmiBufferPtr); + PreNmiBuff_SetReset(gAppNmiBufferPtr); } } diff --git a/src/code/prenmi_buff.c b/src/code/prenmi_buff.c new file mode 100644 index 000000000..5616e3b79 --- /dev/null +++ b/src/code/prenmi_buff.c @@ -0,0 +1,35 @@ +#include <ultra64.h> +#include <global.h> + +#define COLD_RESET 0 +#define NMI 1 + + +void PreNmiBuff_Init(PreNmiBuff* this) +{ + this->resetting = false; + if (osResetType == COLD_RESET) + { + this->resetCount = 0; + this->duration = 0; + } + else + { + this->resetCount++; + this->duration += this->resetTime; + } + + this->resetTime = 0; +} + + +void PreNmiBuff_SetReset(PreNmiBuff* this) +{ + this->resetting = true; + this->resetTime = osGetTime(); +} + +u32 PreNmiBuff_IsResetting(PreNmiBuff* this) +{ + return this->resetting; +} diff --git a/src/code/sys_ucode.c b/src/code/sys_ucode.c index f92a0d61e..0bd169090 100644 --- a/src/code/sys_ucode.c +++ b/src/code/sys_ucode.c @@ -1,21 +1,21 @@ #include <global.h> -u32 func_800D2DF0() +u32 SysUcode_GetUCodeBoot() { return &D_80009320; } -u32 func_800D2DFC() +u32 SysUcode_GetUcodeBootSize() { return (u32)&D_800093F0 - (u32)&D_80009320; } -u32 func_800D2E14() +u32 SysUcode_GetUcode() { return D_8012DBA0; } -u32 func_800D2E20() +u32 SysUcode_GetUcodeData() { return D_8012DBA4; } diff --git a/src/code/z_room.c b/src/code/z_room.c index bbcb3d6f4..79c0d2bf6 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -426,8 +426,8 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) gfxCtx->polyOpa.p = spA8; } - // gSPLoadUcode(gfxCtx->polyOpa.p++, func_800D2E14(), func_800D2E20())? - gSPLoadUcodeEx(gfxCtx->polyOpa.p++, func_800D2E14(), func_800D2E20(), 0x800); + // gSPLoadUcode(gfxCtx->polyOpa.p++, SysUcode_GetUcode(), SysUcode_GetUcodeData())? + gSPLoadUcodeEx(gfxCtx->polyOpa.p++, SysUcode_GetUcode(), SysUcode_GetUcodeData(), 0x800); } } @@ -542,8 +542,8 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) gfxCtx->polyOpa.p = spA8; } - // gSPLoadUcode(gfxCtx->polyOpa.p++, func_800D2E14(), func_800D2E20())? - gSPLoadUcodeEx(gfxCtx->polyOpa.p++, func_800D2E14(), func_800D2E20(), 0x800); + // gSPLoadUcode(gfxCtx->polyOpa.p++, SysUcode_GetUcode(), SysUcode_GetUcodeData())? + gSPLoadUcodeEx(gfxCtx->polyOpa.p++, SysUcode_GetUcode(), SysUcode_GetUcodeData(), 0x800); } } |
