summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/functions.h26
-rw-r--r--include/libu64/debug.h25
-rw-r--r--include/libu64/gfxprint.h (renamed from include/gfxprint.h)4
-rw-r--r--include/libu64/pad.h31
-rw-r--r--include/libu64/padsetup.h8
-rw-r--r--include/padmgr.h8
-rw-r--r--include/z64.h3
-rw-r--r--src/boot/z_std_dma.c2
-rw-r--r--src/code/main.c2
-rw-r--r--src/code/padmgr.c4
-rw-r--r--src/code/sys_math3d.c2
-rw-r--r--src/code/z_camera.c2
-rw-r--r--src/libu64/pad.c3
-rw-r--r--src/libu64/padsetup.c2
-rw-r--r--src/overlays/actors/ovl_Fishing/z_fishing.c2
-rw-r--r--src/overlays/actors/ovl_player_actor/z_player.c2
16 files changed, 81 insertions, 45 deletions
diff --git a/include/functions.h b/include/functions.h
index 6984ea163..758f94648 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -26,14 +26,6 @@ NORETURN void func_80002384(const char* exp, const char* file, int line);
#endif
OSPiHandle* osDriveRomInit(void);
void Mio0_Decompress(u8* src, u8* dst);
-#if DEBUG_FEATURES
-void LogUtils_LogHexDump(void* ptr, s32 size0);
-void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, int line);
-void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, int line);
-void LogUtils_LogThreadId(const char* name, int line);
-#endif
-void LogUtils_HungupThread(const char* name, int line);
-void LogUtils_ResetHungup(void);
EnItem00* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, s16 params);
EnItem00* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s16 params);
@@ -290,24 +282,6 @@ size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, voi
// ? func_800FC83C(?);
// ? func_800FCAB4(?);
void SystemHeap_Init(void* start, u32 size);
-void PadUtils_Init(Input* input);
-void func_800FCB70(void);
-void PadUtils_ResetPressRel(Input* input);
-u32 PadUtils_CheckCurExact(Input* input, u16 value);
-u32 PadUtils_CheckCur(Input* input, u16 key);
-u32 PadUtils_CheckPressed(Input* input, u16 key);
-u32 PadUtils_CheckReleased(Input* input, u16 key);
-u16 PadUtils_GetCurButton(Input* input);
-u16 PadUtils_GetPressButton(Input* input);
-s8 PadUtils_GetCurX(Input* input);
-s8 PadUtils_GetCurY(Input* input);
-void PadUtils_SetRelXY(Input* input, s32 x, s32 y);
-s8 PadUtils_GetRelXImpl(Input* input);
-s8 PadUtils_GetRelYImpl(Input* input);
-s8 PadUtils_GetRelX(Input* input);
-s8 PadUtils_GetRelY(Input* input);
-void PadUtils_UpdateRelXY(Input* input);
-s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status);
f32 absf(f32);
diff --git a/include/libu64/debug.h b/include/libu64/debug.h
new file mode 100644
index 000000000..598c90195
--- /dev/null
+++ b/include/libu64/debug.h
@@ -0,0 +1,25 @@
+#ifndef LIBU64_DEBUG_H
+#define LIBU64_DEBUG_H
+
+#include "ultra64.h"
+
+#if PLATFORM_N64 || DEBUG_FEATURES
+f32 LogUtils_CheckFloatRange(const char* exp, int line, const char* valueName, f32 value, const char* minName, f32 min,
+ const char* maxName, f32 max);
+#endif
+
+#if DEBUG_FEATURES
+s32 LogUtils_CheckIntRange(const char* exp, int line, const char* valueName, s32 value, const char* minName, s32 min,
+ const char* maxName, s32 max);
+void LogUtils_LogHexDump(void* ptr, s32 size0);
+void LogUtils_LogPointer(s32 value, u32 max, void* ptr, const char* name, const char* file, int line);
+void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* file, int line);
+void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, int line);
+void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, int line);
+void LogUtils_LogThreadId(const char* name, int line);
+#endif
+
+void LogUtils_HungupThread(const char* name, int line);
+void LogUtils_ResetHungup(void);
+
+#endif
diff --git a/include/gfxprint.h b/include/libu64/gfxprint.h
index 039b564b4..4106d9fd1 100644
--- a/include/gfxprint.h
+++ b/include/libu64/gfxprint.h
@@ -1,5 +1,5 @@
-#ifndef GFXPRINT_H
-#define GFXPRINT_H
+#ifndef LIBU64_GFXPRINT_H
+#define LIBU64_GFXPRINT_H
#include "ultra64.h"
#include "color.h"
diff --git a/include/libu64/pad.h b/include/libu64/pad.h
new file mode 100644
index 000000000..f5ab44d8c
--- /dev/null
+++ b/include/libu64/pad.h
@@ -0,0 +1,31 @@
+#ifndef LIBU64_PAD_H
+#define LIBU64_PAD_H
+
+#include "ultra64.h"
+
+typedef struct Input {
+ /* 0x00 */ OSContPad cur;
+ /* 0x06 */ OSContPad prev;
+ /* 0x0C */ OSContPad press; // X/Y store delta from last frame
+ /* 0x12 */ OSContPad rel; // X/Y store adjusted
+} Input; // size = 0x18
+
+void PadUtils_Init(Input* input);
+void func_800FCB70(void);
+void PadUtils_ResetPressRel(Input* input);
+u32 PadUtils_CheckCurExact(Input* input, u16 value);
+u32 PadUtils_CheckCur(Input* input, u16 key);
+u32 PadUtils_CheckPressed(Input* input, u16 key);
+u32 PadUtils_CheckReleased(Input* input, u16 key);
+u16 PadUtils_GetCurButton(Input* input);
+u16 PadUtils_GetPressButton(Input* input);
+s8 PadUtils_GetCurX(Input* input);
+s8 PadUtils_GetCurY(Input* input);
+void PadUtils_SetRelXY(Input* input, s32 x, s32 y);
+s8 PadUtils_GetRelXImpl(Input* input);
+s8 PadUtils_GetRelYImpl(Input* input);
+s8 PadUtils_GetRelX(Input* input);
+s8 PadUtils_GetRelY(Input* input);
+void PadUtils_UpdateRelXY(Input* input);
+
+#endif
diff --git a/include/libu64/padsetup.h b/include/libu64/padsetup.h
new file mode 100644
index 000000000..0aab4a729
--- /dev/null
+++ b/include/libu64/padsetup.h
@@ -0,0 +1,8 @@
+#ifndef LIBU64_PADSETUP_H
+#define LIBU64_PADSETUP_H
+
+#include "ultra64.h"
+
+s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status);
+
+#endif
diff --git a/include/padmgr.h b/include/padmgr.h
index 5bfa98308..4b9e6890c 100644
--- a/include/padmgr.h
+++ b/include/padmgr.h
@@ -2,6 +2,7 @@
#define PADMGR_H
#include "ultra64.h"
+#include "libu64/pad.h"
#include "irqmgr.h"
#include "versions.h"
@@ -11,13 +12,6 @@ typedef enum ControllerPakType {
CONT_PAK_OTHER
} ControllerPakType;
-typedef struct Input {
- /* 0x00 */ OSContPad cur;
- /* 0x06 */ OSContPad prev;
- /* 0x0C */ OSContPad press; // X/Y store delta from last frame
- /* 0x12 */ OSContPad rel; // X/Y store adjusted
-} Input; // size = 0x18
-
typedef struct PadMgr {
/* 0x0000 */ OSContStatus padStatus[MAXCONTROLLERS];
/* 0x0010 */ OSMesg serialMsg;
diff --git a/include/z64.h b/include/z64.h
index ecaa19715..e7677a8ee 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -54,7 +54,7 @@
#include "sequence.h"
#include "sfx.h"
#include "color.h"
-#include "gfxprint.h"
+#include "libu64/gfxprint.h"
#include "z_lib.h"
#include "ichain.h"
#include "regs.h"
@@ -86,6 +86,7 @@
#include "libc64/malloc.h"
#include "libc64/sleep.h"
#include "libc64/sprintf.h"
+#include "libu64/debug.h"
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c
index b708a54dd..c8183fc7c 100644
--- a/src/boot/z_std_dma.c
+++ b/src/boot/z_std_dma.c
@@ -28,7 +28,7 @@
#endif
#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" \
- "ntsc-1.2:66 pal-1.0:64 pal-1.1:64"
+ "ntsc-1.2:64 pal-1.0:62 pal-1.1:62"
StackEntry sDmaMgrStackInfo;
OSMesgQueue sDmaMgrMsgQueue;
diff --git a/src/code/main.c b/src/code/main.c
index 6e6e3026c..d4c54b687 100644
--- a/src/code/main.c
+++ b/src/code/main.c
@@ -24,7 +24,7 @@ extern struct IrqMgr gIrqMgr;
#endif
#pragma increment_block_number "gc-eu:144 gc-eu-mq:144 gc-jp:144 gc-jp-ce:144 gc-jp-mq:144 gc-us:144 gc-us-mq:144" \
- "ntsc-1.0:127 ntsc-1.1:127 ntsc-1.2:127 pal-1.0:125 pal-1.1:125"
+ "ntsc-1.0:125 ntsc-1.1:125 ntsc-1.2:125 pal-1.0:123 pal-1.1:123"
extern u8 _buffersSegmentEnd[];
diff --git a/src/code/padmgr.c b/src/code/padmgr.c
index b5f76b721..740f15b29 100644
--- a/src/code/padmgr.c
+++ b/src/code/padmgr.c
@@ -28,7 +28,9 @@
* `osContStartReadData` to receiving the data. By running this on a separate thread to the game state, work can be
* done while waiting for this operation to complete.
*/
-#include "global.h"
+#include "libu64/debug.h"
+#include "libu64/padsetup.h"
+#include "macros.h"
#include "fault.h"
#include "terminal.h"
#include "line_numbers.h"
diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c
index 0a773bfb6..fc37a98c6 100644
--- a/src/code/sys_math3d.c
+++ b/src/code/sys_math3d.c
@@ -5,7 +5,7 @@
#include "macros.h"
#include "sys_math3d.h"
-#pragma increment_block_number "gc-eu:98 gc-eu-mq:98 gc-jp:98 gc-jp-ce:98 gc-jp-mq:98 gc-us:98 gc-us-mq:98" \
+#pragma increment_block_number "gc-eu:97 gc-eu-mq:97 gc-jp:97 gc-jp-ce:97 gc-jp-mq:97 gc-us:97 gc-us-mq:97" \
"ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:79 pal-1.0:80 pal-1.1:80"
s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB,
diff --git a/src/code/z_camera.c b/src/code/z_camera.c
index f36aba0d7..e528431a2 100644
--- a/src/code/z_camera.c
+++ b/src/code/z_camera.c
@@ -3639,7 +3639,7 @@ s32 Camera_KeepOn3(Camera* camera) {
}
#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" \
- "ntsc-1.0:129 ntsc-1.1:129 ntsc-1.2:129 pal-1.0:127 pal-1.1:127"
+ "ntsc-1.0:127 ntsc-1.1:127 ntsc-1.2:127 pal-1.0:125 pal-1.1:125"
s32 Camera_KeepOn4(Camera* camera) {
static Vec3f D_8015BD50;
diff --git a/src/libu64/pad.c b/src/libu64/pad.c
index 7a0407ef9..551cd495b 100644
--- a/src/libu64/pad.c
+++ b/src/libu64/pad.c
@@ -1,4 +1,5 @@
-#include "global.h"
+#include "ultra64.h"
+#include "libu64/pad.h"
void PadUtils_Init(Input* input) {
bzero(input, sizeof(Input));
diff --git a/src/libu64/padsetup.c b/src/libu64/padsetup.c
index 20a546ae3..86f38c0ad 100644
--- a/src/libu64/padsetup.c
+++ b/src/libu64/padsetup.c
@@ -1,4 +1,4 @@
-#include "global.h"
+#include "ultra64.h"
s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status) {
s32 ret;
diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c
index 5f995aa72..2a3a592fc 100644
--- a/src/overlays/actors/ovl_Fishing/z_fishing.c
+++ b/src/overlays/actors/ovl_Fishing/z_fishing.c
@@ -35,7 +35,7 @@
#include "cic6105.h"
#endif
-#pragma increment_block_number "gc-eu:163 gc-eu-mq:163 gc-jp:163 gc-jp-ce:163 gc-jp-mq:163 gc-us:163 gc-us-mq:163" \
+#pragma increment_block_number "gc-eu:162 gc-eu-mq:162 gc-jp:162 gc-jp-ce:162 gc-jp-mq:162 gc-us:162 gc-us-mq:162" \
"ntsc-1.0:121 ntsc-1.1:121 ntsc-1.2:121 pal-1.0:121 pal-1.1:121"
#define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED
diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c
index c1f3fe2c5..9b2c99848 100644
--- a/src/overlays/actors/ovl_player_actor/z_player.c
+++ b/src/overlays/actors/ovl_player_actor/z_player.c
@@ -332,7 +332,7 @@ void Player_Action_CsAction(Player* this, PlayState* play);
// .bss part 1
#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" \
- "ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:128 pal-1.1:128"
+ "ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:64 pal-1.1:64"
static s32 D_80858AA0;