summaryrefslogtreecommitdiff
path: root/include/libu64
diff options
context:
space:
mode:
authormzxrules <mzxrules@gmail.com>2025-01-24 13:25:05 -0500
committerGitHub <noreply@github.com>2025-01-24 13:25:05 -0500
commitf448a48cd66d6a60fdac5ed1efec078a434a1fe7 (patch)
tree2897cb2ce3a35132af15fa269562bb4eabea5607 /include/libu64
parentab37332793161e1731176588fd901c0d90461f74 (diff)
Create headers for some libu64 files (#2440)
* Create headers for some libu64 files * apply bss patch
Diffstat (limited to 'include/libu64')
-rw-r--r--include/libu64/debug.h25
-rw-r--r--include/libu64/gfxprint.h52
-rw-r--r--include/libu64/pad.h31
-rw-r--r--include/libu64/padsetup.h8
4 files changed, 116 insertions, 0 deletions
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/libu64/gfxprint.h b/include/libu64/gfxprint.h
new file mode 100644
index 000000000..4106d9fd1
--- /dev/null
+++ b/include/libu64/gfxprint.h
@@ -0,0 +1,52 @@
+#ifndef LIBU64_GFXPRINT_H
+#define LIBU64_GFXPRINT_H
+
+#include "ultra64.h"
+#include "color.h"
+
+typedef struct GfxPrint {
+ /* 0x00 */ PrintCallback callback;
+ /* 0x04 */ Gfx* dList;
+ /* 0x08 */ u16 posX;
+ /* 0x0A */ u16 posY;
+ /* 0x0C */ u16 baseX;
+ /* 0x0E */ u8 baseY;
+ /* 0x0F */ u8 flags;
+ /* 0x10 */ Color_RGBA8_u32 color;
+ /* 0x14 */ char unk_14[0x1C]; // unused
+} GfxPrint; // size = 0x30
+
+#define GFX_CHAR_X_SPACING 8
+#define GFX_CHAR_Y_SPACING 8
+
+#define GFXP_UNUSED "\x8E"
+#define GFXP_UNUSED_CHAR 0x8E
+#define GFXP_HIRAGANA "\x8D"
+#define GFXP_HIRAGANA_CHAR 0x8D
+#define GFXP_KATAKANA "\x8C"
+#define GFXP_KATAKANA_CHAR 0x8C
+#define GFXP_RAINBOW_ON "\x8B"
+#define GFXP_RAINBOW_ON_CHAR 0x8B
+#define GFXP_RAINBOW_OFF "\x8A"
+#define GFXP_RAINBOW_OFF_CHAR 0x8A
+
+#define GFXP_FLAG_HIRAGANA (1 << 0)
+#define GFXP_FLAG_RAINBOW (1 << 1)
+#define GFXP_FLAG_SHADOW (1 << 2)
+#define GFXP_FLAG_UPDATE (1 << 3)
+#if !PLATFORM_N64
+#define GFXP_FLAG_ENLARGE (1 << 6)
+#endif
+#define GFXP_FLAG_OPEN (1 << 7)
+
+void GfxPrint_SetColor(GfxPrint* this, u32 r, u32 g, u32 b, u32 a);
+void GfxPrint_SetPosPx(GfxPrint* this, s32 x, s32 y);
+void GfxPrint_SetPos(GfxPrint* this, s32 x, s32 y);
+void GfxPrint_SetBasePosPx(GfxPrint* this, s32 x, s32 y);
+void GfxPrint_Init(GfxPrint* this);
+void GfxPrint_Destroy(GfxPrint* this);
+void GfxPrint_Open(GfxPrint* this, Gfx* dList);
+Gfx* GfxPrint_Close(GfxPrint* this);
+s32 GfxPrint_Printf(GfxPrint* this, const char* fmt, ...);
+
+#endif
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