summaryrefslogtreecommitdiff
path: root/include/dolphin/gba.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-02-01 18:45:02 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-02-01 18:50:25 -0400
commit9fa0a7f1da1b70bee995f53c6c96c43189018772 (patch)
tree114548896790eaff23cdca84a025281de86bbb51 /include/dolphin/gba.h
parent2ba3289286bbfcf9fcc13fd135d976058d8b6c2e (diff)
global: Import Dolphin SDK
This version comes from the Metroid Prime decompilation project. https://github.com/PrimeDecomp/prime
Diffstat (limited to 'include/dolphin/gba.h')
-rw-r--r--include/dolphin/gba.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/include/dolphin/gba.h b/include/dolphin/gba.h
new file mode 100644
index 0000000..692f568
--- /dev/null
+++ b/include/dolphin/gba.h
@@ -0,0 +1,65 @@
+#ifndef _DOLPHIN_GBA
+#define _DOLPHIN_GBA
+
+#include <types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GBA_CHAN0 0
+#define GBA_CHAN1 1
+#define GBA_CHAN2 2
+#define GBA_CHAN3 3
+#define GBA_MAX_CHAN 4
+
+#define GBA_ALL_KEY_MASK 0x03ff
+#define GBA_A_BUTTON 0x0001
+#define GBA_B_BUTTON 0x0002
+#define GBA_SELECT_BUTTON 0x0004
+#define GBA_START_BUTTON 0x0008
+#define GBA_R_KEY 0x0010
+#define GBA_L_KEY 0x0020
+#define GBA_U_KEY 0x0040
+#define GBA_D_KEY 0x0080
+#define GBA_R_BUTTON 0x0100
+#define GBA_L_BUTTON 0x0200
+
+#define GBA_JSTAT_MASK 0x3a
+#define GBA_JSTAT_FLAGS_SHIFT 4
+#define GBA_JSTAT_FLAGS_MASK 0x30
+#define GBA_JSTAT_PSF1 0x20
+#define GBA_JSTAT_PSF0 0x10
+#define GBA_JSTAT_SEND 0x08
+#define GBA_JSTAT_RECV 0x02
+
+#define GBA_READY 0
+#define GBA_NOT_READY 1
+#define GBA_BUSY 2
+#define GBA_JOYBOOT_UNKNOWN_STATE 3
+#define GBA_JOYBOOT_ERR_INVALID 4
+
+#define GBA_JOYBOOT_PROGRAM_SIZE_MAX 0x40000
+
+#define GBA_JOYBOOT_BOOTPARAM_OFFSET 0xc8
+#define GBA_JOYBOOT_BOOTPARAM_SIZE 0x18
+typedef void (*GBACallback)(s32 chan, s32 ret);
+void GBAInit(void);
+s32 GBAGetStatus(s32 chan, u8* status);
+s32 GBAGetStatusAsync(s32 chan, u8* status, GBACallback callback);
+s32 GBAReset(s32 chan, u8* status);
+s32 GBAResetAsync(s32 chan, u8* status, GBACallback callback);
+s32 GBAGetProcessStatus(s32 chan, u8* percentp);
+s32 GBARead(s32 chan, u8* dst, u8* status);
+s32 GBAReadAsync(s32 chan, u8* dst, u8* status, GBACallback callback);
+s32 GBAWrite(s32 chan, u8* src, u8* status);
+s32 GBAWriteAsync(s32 chan, u8* src, u8* status, GBACallback callback);
+s32 GBAJoyBoot(s32 chan, s32 palette_color, s32 palette_speed, u8* programp, s32 length,
+ u8* status);
+s32 GBAJoyBootAsync(s32 chan, s32 palette_color, s32 palette_speed, u8* programp, s32 length,
+ u8* status, GBACallback callback);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _DOLPHIN_GBA