summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2024-08-25 16:00:10 +0200
committerGitHub <noreply@github.com>2024-08-25 16:00:10 +0200
commit7056423e5b47775da6955b2a8a3e6e10fd5c7be8 (patch)
tree2cd83447908d94a0cc232d3b929ef00a059f84e1 /src/code
parent22a00b46fb645f7ad1b47ea81f42f4036e9a5f9c (diff)
[ntsc-1.2] Decompile cic6105.c, main.c (#2068)
* decompile-OK Main, cic6105.c * names cleanup / minimal doc * match versions * fix bad disasm metadata format * bss * bss * review 1 * review 2 * review 3 * review 4 * cleanup * bss * add some sizes to disasm metadata symbols
Diffstat (limited to 'src/code')
-rw-r--r--src/code/game.c2
-rw-r--r--src/code/graph.c2
-rw-r--r--src/code/main.c33
-rw-r--r--src/code/sched.c2
-rw-r--r--src/code/speed_meter.c2
-rw-r--r--src/code/sys_cfb.c2
-rw-r--r--src/code/sys_matrix.c2
-rw-r--r--src/code/z_debug.c2
-rw-r--r--src/code/z_player_call.c2
-rw-r--r--src/code/z_skin.c2
10 files changed, 48 insertions, 3 deletions
diff --git a/src/code/game.c b/src/code/game.c
index e10d650fb..7a53acdda 100644
--- a/src/code/game.c
+++ b/src/code/game.c
@@ -1,6 +1,8 @@
#include "global.h"
#include "terminal.h"
+#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
+
SpeedMeter D_801664D0;
VisCvg sVisCvg;
VisZBuf sVisZBuf;
diff --git a/src/code/graph.c b/src/code/graph.c
index 1fffacac5..747416399 100644
--- a/src/code/graph.c
+++ b/src/code/graph.c
@@ -4,6 +4,8 @@
#define GFXPOOL_HEAD_MAGIC 0x1234
#define GFXPOOL_TAIL_MAGIC 0x5678
+#pragma increment_block_number "gc-eu:128 gc-eu-mq:128"
+
/**
* The time at which the previous `Graph_Update` ended.
*/
diff --git a/src/code/main.c b/src/code/main.c
index 1b67009cb..2e46ae825 100644
--- a/src/code/main.c
+++ b/src/code/main.c
@@ -1,5 +1,10 @@
#include "global.h"
#include "terminal.h"
+#include "versions.h"
+#if PLATFORM_N64
+#include "cic6105.h"
+#include "n64dd.h"
+#endif
extern u8 _buffersSegmentEnd[];
@@ -52,8 +57,20 @@ void Main(void* arg) {
gAppNmiBufferPtr = (PreNmiBuff*)osAppNMIBuffer;
PreNmiBuff_Init(gAppNmiBufferPtr);
Fault_Init();
+#if PLATFORM_N64
+ func_800ADA80();
+ if ((u8)B_80121AE1 != 0) {
+ systemHeapStart = (uintptr_t)&D_801E8090;
+ SysCfb_Init(1);
+ } else {
+ func_800ADAF8();
+ systemHeapStart = (uintptr_t)_buffersSegmentEnd;
+ SysCfb_Init(0);
+ }
+#else
SysCfb_Init(0);
systemHeapStart = (uintptr_t)_buffersSegmentEnd;
+#endif
fb = (uintptr_t)SysCfb_GetFbPtr(0);
gSystemHeapSize = fb - systemHeapStart;
PRINTF(T("システムヒープ初期化 %08x-%08x %08x\n", "System heap initalization %08x-%08x %08x\n"), systemHeapStart,
@@ -97,6 +114,11 @@ void Main(void* arg) {
StackCheck_Init(&sSchedStackInfo, sSchedStack, STACK_TOP(sSchedStack), 0, 0x100, "sched");
Sched_Init(&gScheduler, STACK_TOP(sSchedStack), THREAD_PRI_SCHED, gViConfigModeType, 1, &gIrqMgr);
+#if PLATFORM_N64
+ CIC6105_AddFaultClient();
+ func_80001640();
+#endif
+
IrqMgr_AddClient(&gIrqMgr, &irqClient, &irqMgrMsgQueue);
StackCheck_Init(&sAudioStackInfo, sAudioStack, STACK_TOP(sAudioStack), 0, 0x100, "audio");
@@ -119,14 +141,19 @@ void Main(void* arg) {
if (msg == NULL) {
break;
}
- if (*msg == OS_SC_PRE_NMI_MSG) {
- PRINTF(T("main.c: リセットされたみたいだよ\n", "main.c: Looks like it's been reset\n"));
- PreNmiBuff_SetReset(gAppNmiBufferPtr);
+ switch (*msg) {
+ case OS_SC_PRE_NMI_MSG:
+ PRINTF(T("main.c: リセットされたみたいだよ\n", "main.c: Looks like it's been reset\n"));
+ PreNmiBuff_SetReset(gAppNmiBufferPtr);
+ break;
}
}
PRINTF(T("mainproc 後始末\n", "mainproc Cleanup\n"));
osDestroyThread(&sGraphThread);
RcpUtils_Reset();
+#if PLATFORM_N64
+ CIC6105_RemoveFaultClient();
+#endif
PRINTF(T("mainproc 実行終了\n", "mainproc End of execution\n"));
}
diff --git a/src/code/sched.c b/src/code/sched.c
index fbfc42dc0..ef34a4f6a 100644
--- a/src/code/sched.c
+++ b/src/code/sched.c
@@ -45,6 +45,8 @@
#define RDP_DONE_MSG 668
#define NOTIFY_MSG 670 // original name: ENTRY_MSG
+#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
+
OSTime sRSPGfxTimeStart;
OSTime sRSPAudioTimeStart;
OSTime sRSPOtherTimeStart;
diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c
index a9ddee071..13e2622c6 100644
--- a/src/code/speed_meter.c
+++ b/src/code/speed_meter.c
@@ -1,3 +1,5 @@
+#pragma increment_block_number "gc-eu:128 gc-eu-mq:128"
+
#include "global.h"
#include "terminal.h"
diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c
index 28019c3e7..3d5457913 100644
--- a/src/code/sys_cfb.c
+++ b/src/code/sys_cfb.c
@@ -1,5 +1,7 @@
#include "global.h"
+#pragma increment_block_number "gc-eu:128 gc-eu-mq:128"
+
uintptr_t sSysCfbFbPtr[2];
uintptr_t sSysCfbEnd;
diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c
index 2ca6e4cf4..550b39e4e 100644
--- a/src/code/sys_matrix.c
+++ b/src/code/sys_matrix.c
@@ -16,6 +16,8 @@ MtxF gMtxFClear = {
};
// clang-format on
+#pragma increment_block_number "gc-eu:128 gc-eu-mq:128"
+
MtxF* sMatrixStack; // "Matrix_stack"
MtxF* sCurrentMatrix; // "Matrix_now"
diff --git a/src/code/z_debug.c b/src/code/z_debug.c
index 3e6e18494..d668f490a 100644
--- a/src/code/z_debug.c
+++ b/src/code/z_debug.c
@@ -12,6 +12,8 @@ typedef struct InputCombo {
/* 0x2 */ u16 press;
} InputCombo; // size = 0x4
+#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
+
RegEditor* gRegEditor;
DebugCamTextBufferEntry sDebugCamTextBuffer[22];
diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c
index 38812cb0f..2235c8b3d 100644
--- a/src/code/z_player_call.c
+++ b/src/code/z_player_call.c
@@ -2,6 +2,8 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_26)
+#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
+
void (*sPlayerCallInitFunc)(Actor* thisx, PlayState* play);
void (*sPlayerCallDestroyFunc)(Actor* thisx, PlayState* play);
void (*sPlayerCallUpdateFunc)(Actor* thisx, PlayState* play);
diff --git a/src/code/z_skin.c b/src/code/z_skin.c
index 69a14f065..ab3b8624a 100644
--- a/src/code/z_skin.c
+++ b/src/code/z_skin.c
@@ -1,5 +1,7 @@
#include "global.h"
+#pragma increment_block_number "gc-eu:128 gc-eu-mq:128"
+
MtxF gSkinLimbMatrices[60]; // holds matrices for each limb of the skeleton currently being drawn
static s32 sUnused;