summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorrozlette <uberpanzermensch@gmail.com>2020-01-11 08:54:07 -0600
committerrozlette <uberpanzermensch@gmail.com>2020-01-11 08:54:07 -0600
commitbb9de27a16fcfa731c96ae552eecdb7a60ee8e91 (patch)
treeac9a3118c8f3319dfeaa6628d37233c55aa8e456 /include
parent727a546fcf1894061f3ec4295fa7c80083768aba (diff)
Decomp controller.c
Diffstat (limited to 'include')
-rw-r--r--include/all_types.h10
-rw-r--r--include/functions.h21
-rw-r--r--include/io/controller.h62
-rw-r--r--include/osint.h5
-rw-r--r--include/segment.h2
-rw-r--r--include/structs.h6
-rw-r--r--include/variables.h15
7 files changed, 87 insertions, 34 deletions
diff --git a/include/all_types.h b/include/all_types.h
new file mode 100644
index 000000000..e7cb990c0
--- /dev/null
+++ b/include/all_types.h
@@ -0,0 +1,10 @@
+#include <PR/ultratypes.h>
+#include <PR/gbi.h>
+#include <io/controller.h>
+#include <osint.h>
+#include <viint.h>
+#include <guint.h>
+#include <os.h>
+#include <stdlib.h>
+#include <xstdio.h>
+#include <unk.h>
diff --git a/include/functions.h b/include/functions.h
index 34abbe946..ba66fafea 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -1,14 +1,7 @@
#ifndef _FUNCTIONS_H_
#define _FUNCTIONS_H_
-#include <PR/ultratypes.h>
-#include <osint.h>
-#include <viint.h>
-#include <guint.h>
-#include <unk.h>
#include <structs.h>
-#include <stdlib.h>
-#include <xstdio.h>
void start(void); // func_80080060
void Idle_ClearMemory(void* begin, void* end); // func_80080150
@@ -245,7 +238,7 @@ void func_80087854(void); // func_80087854
int sprintf(char* s, char* fmt, ...); // func_800878A4
void func_80087900(void); // func_80087900
void func_80087934(void); // func_80087934
-void wait_cycles(void); // func_80087960
+void wait_cycles(OSTime uParm1); // func_80087960
void func_800879CC(void); // func_800879CC
void func_80087A1C(void); // func_80087A1C
void func_80087A6C(u32 param_1); // func_80087A6C
@@ -267,11 +260,11 @@ void osSpTaskLoad(OSTask* intp); // func_8008868C
void osSpTaskStartGo(OSTask* tp); // func_800887F4
void __ull_rshift(void); // func_80088840
void __ull_rem(void); // func_8008886C
-u64 __ull_div(void); // func_800888A8
+u64 __ull_div(u64 param_1, u64 param_2); // func_800888A8
void __ll_lshift(void); // func_800888E4
void __ll_rem(void); // func_80088910
void __ll_div(void); // func_8008894C
-u64 __ll_mul(void); // func_800889A8
+u64 __ll_mul(u64 param_1, u64 param_2); // func_800889A8
void __ull_divremi(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5); // func_800889D8
void __ll_mod(void); // func_80088A38
void __ll_rshift(void); // func_80088AD4
@@ -295,7 +288,7 @@ void func_80089944(void); // func_80089944
void __osSiCreateAccessQueue(void); // func_80089AA0
void __osSiGetAccess(void); // func_80089AF0
void __osSiRelAccess(void); // func_80089B34
-void osContInit(void); // func_80089B60
+s32 osContInit(OSMesgQueue* mq, u8* bitpattern, OSContStatus* data); // func_80089B60
void __osContGetInitData(u8* pattern, OSContStatus* data); // func_80089CBC
void __osPackRequestData(u8 cmd); // func_80089D68
void osCreateThread(OSThread* t, OSId id, osCreateThread_func* entry, void* arg, void* sp, OSPri p); // func_80089E40
@@ -374,7 +367,7 @@ void osInvalICache(void* vaddr, s32 nbytes); // func_8008F270
void osInvalDCache(void* vaddr, s32 nbytes); // func_8008F2F0
void __osTimerServicesInit(void); // func_8008F3A0
void __osTimerInterrupt(void); // func_8008F42C
-void __osSetTimerIntr(void); // func_8008F5A4
+void __osSetTimerIntr(OSTime tim); // func_8008F5A4
void __osInsertTimer(OSTimer* t); // func_8008F644
void func_8008F7D0(void); // func_8008F7D0
int __osSpDeviceBusy(void); // func_8008FA00
@@ -450,12 +443,12 @@ void func_80093CC0(void); // func_80093CC0
u32 __osGetCause(void); // func_80093D90
void func_80093DA0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // func_80093DA0
void func_80093FF0(void); // func_80093FF0
-s32 osSetTimer(OSTimer* t, OSTime interval, OSMesgQueue* mq, OSMesg msg); // func_80094150
+s32 osSetTimer(OSTimer* t, OSTime value, OSTime interval, OSMesgQueue* mq, OSMesg msg); // func_80094150
void _Ldtob(void); // func_800942E0
void func_80094770(void); // func_80094770
void func_80094828(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5); // func_80094828
ldiv_t ldiv(s32 __numer, s32 __denom); // func_80094DF0
-lldiv_t* lldiv(lldiv_t* __return_storage_ptr__, s64 __numer, s64 __denom); // func_80094E74
+lldiv_t* lldiv(s64 __numer, s64 __denom); // func_80094E74
void _Litob(void); // func_80094F80
s32 __osSiRawWriteIo(u32 devAddr, u32 data); // func_80095220
u32 __osSpGetStatus(void); // func_80095270
diff --git a/include/io/controller.h b/include/io/controller.h
new file mode 100644
index 000000000..9310f3b1d
--- /dev/null
+++ b/include/io/controller.h
@@ -0,0 +1,62 @@
+#ifndef _CONTROLLER_H_
+#define _CONTROLLER_H_
+
+#include <PR/ultratypes.h>
+
+typedef struct {
+ /* 0x00 */ u32 ramarray[15];
+ /* 0x3C */ u32 pifstatus;
+} OSPifRam;
+
+
+typedef struct {
+ /* 0x0 */ u8 dummy;
+ /* 0x1 */ u8 txsize;
+ /* 0x2 */ u8 rxsize;
+ /* 0x3 */ u8 cmd;
+ /* 0x4 */ u16 button;
+ /* 0x6 */ s8 stick_x;
+ /* 0x7 */ s8 stick_y;
+} __OSContReadFormat;
+
+
+typedef struct {
+ /* 0x0 */ u8 dummy;
+ /* 0x1 */ u8 txsize;
+ /* 0x2 */ u8 rxsize;
+ /* 0x3 */ u8 cmd;
+ /* 0x4 */ u8 typeh;
+ /* 0x5 */ u8 typel;
+ /* 0x6 */ u8 status;
+ /* 0x7 */ u8 dummy1;
+} __OSContRequesFormat;
+
+
+typedef struct {
+ /* 0x00 */ u8 dummy;
+ /* 0x01 */ u8 txsize;
+ /* 0x02 */ u8 rxsize;
+ /* 0x03 */ u8 cmd;
+ /* 0x04 */ u16 address;
+ /* 0x06 */ u8 data[32];
+ /* 0x26 */ u8 datacrc;
+} __OSContRamReadFormat;
+
+
+typedef struct {
+ /* 0x00 */ u16 company_code;
+ /* 0x02 */ u16 game_code;
+ /* 0x04 */ u8 start_page;
+ /* 0x05 */ u8 status;
+ /* 0x06 */ u16 data_sum;
+ /* 0x08 */ unsigned char ext_name[4];
+ /* 0x0C */ unsigned char game_name[16];
+ /* 0x1C */ s32 reserved;
+} __OSDir;
+
+
+typedef struct {
+ /* 0x0 */ u8 inode_page[256];
+} __OSInode;
+
+#endif
diff --git a/include/osint.h b/include/osint.h
index 423884d3c..1b38c5f8e 100644
--- a/include/osint.h
+++ b/include/osint.h
@@ -21,8 +21,7 @@ typedef struct {
/* 0x4 */ OSPri priority;
} __OSThreadTail;
-#include <variables.h> // TODO all variables should be moved to the file that logically defines them
- // maybe put externs here?
-#include <functions.h>
+#include <global.h> // TODO this is just so libultra files can see function and variable declarations.
+ // Once all data sections have been split up, it should be removed.
#endif
diff --git a/include/segment.h b/include/segment.h
index 143aed3b5..272777a30 100644
--- a/include/segment.h
+++ b/include/segment.h
@@ -1,7 +1,7 @@
#ifndef _SEGMENT_H_
#define _SEGMENT_H_
-#include <PR/ultratypes.h>
+#include <structs.h>
extern UNK_TYPE D_04029CB0; // D_04029CB0
extern UNK_TYPE D_04029CF0; // D_04029CF0
diff --git a/include/structs.h b/include/structs.h
index 7859f142b..08bbc3d46 100644
--- a/include/structs.h
+++ b/include/structs.h
@@ -1,11 +1,7 @@
#ifndef _STRUCTS_H_
#define _STRUCTS_H_
-#include <PR/ultratypes.h>
-#include <PR/gbi.h>
-#include <unk.h>
-#include <os.h>
-#include <stdlib.h>
+#include <all_types.h>
typedef struct {
/* 0x0 */ s16 priority; // Lower means higher priority. -1 means it ignores priority
diff --git a/include/variables.h b/include/variables.h
index ee74a23b2..5a610760a 100644
--- a/include/variables.h
+++ b/include/variables.h
@@ -1,14 +1,7 @@
#ifndef _VARIABLES_H_
#define _VARIABLES_H_
-#include <PR/ultratypes.h>
-#include <osint.h>
-#include <viint.h>
-#include <guint.h>
-#include <unk.h>
#include <structs.h>
-#include <stdlib.h>
-#include <xstdio.h>
#include <dmadata.h>
#include <segment.h>
#include <pre_boot_variables.h>
@@ -308,12 +301,12 @@ extern OSTask tmp_task; // D_8009CD70
extern UNK_TYPE1 D_8009CDB0; // D_8009CDB0
extern UNK_TYPE1 D_8009CEB0; // D_8009CEB0
extern UNK_TYPE1 __osSiAccessQueue; // D_8009CEB8
-extern UNK_TYPE4 __osContPifRam; // D_8009CED0
-extern UNK_TYPE4 D_8009CF0C; // D_8009CF0C
+extern OSPifRam __osContPifRam; // D_8009CED0
+extern UNK_TYPE1 D_8009CF0C; // D_8009CF0C
extern u8 __osContLastCmd; // D_8009CF10
extern u8 __osMaxControllers; // D_8009CF11
-extern UNK_TYPE1 D_8009CF38; // D_8009CF38
-extern UNK_TYPE1 D_8009CF50; // D_8009CF50
+extern OSMesgQueue D_8009CF38; // D_8009CF38
+extern OSMesg D_8009CF50[1]; // D_8009CF50
extern UNK_TYPE1 D_8009CF60; // D_8009CF60
extern UNK_TYPE4 D_8009CF70; // D_8009CF70
extern UNK_TYPE1 __osThreadSave; // D_8009CF80