summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>2021-10-14 16:25:14 +0100
committerGitHub <noreply@github.com>2021-10-14 12:25:14 -0300
commit151e098e48fcd779a296cfbdcedd8f4528f96232 (patch)
tree290686ed902fa4107706cfdcd72f428e7ccd0696
parent3aeadb42b8a195b3d2f67ce71fcd184ddf26d856 (diff)
`z_debug` OK (#330)
* z_debug OK * Rename function * Remove duplicate struct * Update z64.h
-rw-r--r--include/functions.h2
-rw-r--r--include/z64.h17
-rw-r--r--spec1
-rw-r--r--src/code/main.c2
-rw-r--r--src/code/z_debug.c18
-rw-r--r--tools/disasm/functions.txt2
-rw-r--r--tools/sizes/code_functions.csv2
7 files changed, 31 insertions, 13 deletions
diff --git a/include/functions.h b/include/functions.h
index 8c8b76a3e..173b44d26 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -1547,7 +1547,7 @@ s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4);
s32 func_800E9138(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, f32 param_5);
s32 func_800E9250(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, Vec3f param_5);
u8 func_800E9360(void);
-void static_context_init(void);
+void GameInfo_Init(void);
// void func_800E9470(void);
void DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX, f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, s16 type, GraphicsContext* gfxCtx);
void DebugDisplay_DrawObjects(GlobalContext* globalCtx);
diff --git a/include/z64.h b/include/z64.h
index 6e179ebe2..e38d926a6 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -36,6 +36,7 @@
#include "z64scene.h"
#include "z64save.h"
#include "z64transition.h"
+#include "regs.h"
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
@@ -242,14 +243,16 @@ typedef struct {
/* 0x11D88 */ u8 unk_11D88;
} Font; // size = 0x11D8C
+// Game Info aka. Static Context
+// Data normally accessed through REG macros (see regs.h)
typedef struct {
- /* 0x0000 */ u8 unk0;
- /* 0x0001 */ u8 unk1;
- /* 0x0002 */ u8 unk2;
- /* 0x0003 */ u8 unk3;
- /* 0x0004 */ u32 unk4;
- /* 0x0008 */ UNK_TYPE1 pad8[0xC];
- /* 0x0014 */ s16 data[2784]; // Accessed through REG macros
+ /* 0x00 */ u8 unk_00; // regPage;? // 1 is first page
+ /* 0x01 */ u8 unk_01; // regGroup;? // "register" group (R, RS, RO, RP etc.)
+ /* 0x02 */ u8 unk_02; // regCur;? // selected register within page
+ /* 0x03 */ u8 unk_03; // dpadLast;?
+ /* 0x04 */ u32 unk_04; // repeat;?
+ /* 0x08 */ UNK_TYPE1 pad_08[0xC];
+ /* 0x14 */ s16 data[REG_GROUPS * REG_PER_GROUP]; // 0xAE0 entries
} GameInfo; // size = 0x15D4
typedef struct {
diff --git a/spec b/spec
index 8ca54bfc5..b121ad83c 100644
--- a/spec
+++ b/spec
@@ -471,7 +471,6 @@ beginseg
include "build/src/code/z_common_data.o"
include "build/data/code/z_common_data.bss.o"
include "build/src/code/z_debug.o"
- include "build/data/code/z_debug.bss.o"
include "build/src/code/z_debug_display.o"
include "build/data/code/z_debug_display.data.o"
include "build/data/code/z_debug_display.bss.o"
diff --git a/src/code/main.c b/src/code/main.c
index 648536aef..a2b859991 100644
--- a/src/code/main.c
+++ b/src/code/main.c
@@ -24,7 +24,7 @@ void Main(void* arg) {
startHeapSize = fb - sysHeap;
SystemArena_Init(sysHeap, startHeapSize);
- static_context_init();
+ GameInfo_Init();
R_ENABLE_ARENA_DBG = 0;
diff --git a/src/code/z_debug.c b/src/code/z_debug.c
index e6f03bb5f..5848dfa71 100644
--- a/src/code/z_debug.c
+++ b/src/code/z_debug.c
@@ -1,3 +1,19 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/static_context_init.s")
+GameInfo* gGameInfo;
+
+void GameInfo_Init(void) {
+ s32 i;
+
+ gGameInfo = (GameInfo*)SystemArena_Malloc(sizeof(GameInfo));
+ if (1) {}
+ gGameInfo->unk_00 = 0;
+ gGameInfo->unk_01 = 0;
+ gGameInfo->unk_02 = 0;
+ gGameInfo->unk_04 = 0;
+ gGameInfo->unk_03 = 0;
+
+ for (i = 0; i < ARRAY_COUNT(gGameInfo->data); i++) {
+ gGameInfo->data[i] = 0;
+ }
+}
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index e6e2507d6..8cf4a77b5 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -1519,7 +1519,7 @@
0x800E9138:("func_800E9138",),
0x800E9250:("func_800E9250",),
0x800E9360:("func_800E9360",),
- 0x800E93E0:("static_context_init",),
+ 0x800E93E0:("GameInfo_Init",),
0x800E9470:("func_800E9470",),
0x800E9488:("DebugDisplay_AddObject",),
0x800E9564:("DebugDisplay_DrawObjects",),
diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv
index 0fdfe7519..d8ca54506 100644
--- a/tools/sizes/code_functions.csv
+++ b/tools/sizes/code_functions.csv
@@ -1033,7 +1033,7 @@ asm/non_matchings/code/code_800E8EA0/func_800E8FA4.s,func_800E8FA4,0x800E8FA4,0x
asm/non_matchings/code/code_800E8EA0/func_800E9138.s,func_800E9138,0x800E9138,0x46
asm/non_matchings/code/code_800E8EA0/func_800E9250.s,func_800E9250,0x800E9250,0x44
asm/non_matchings/code/z_common_data/func_800E9360.s,func_800E9360,0x800E9360,0x20
-asm/non_matchings/code/z_debug/static_context_init.s,static_context_init,0x800E93E0,0x24
+asm/non_matchings/code/z_debug/GameInfo_Init.s,GameInfo_Init,0x800E93E0,0x24
asm/non_matchings/code/z_debug_display/func_800E9470.s,func_800E9470,0x800E9470,0x6
asm/non_matchings/code/z_debug_display/DebugDisplay_AddObject.s,DebugDisplay_AddObject,0x800E9488,0x37
asm/non_matchings/code/z_debug_display/DebugDisplay_DrawObjects.s,DebugDisplay_DrawObjects,0x800E9564,0x24