summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorred031000 <rubenru09@aol.com>2020-06-05 18:55:49 +0100
committerred031000 <rubenru09@aol.com>2020-06-05 18:55:49 +0100
commited295dc6089bdf4825233b63e432fb194240b98a (patch)
tree081eda1af00d591ff2789ec3f5343d01870d6079
parent89fa3666e18a80632238471840de1df792409fcb (diff)
shared headers
-rw-r--r--.gitignore3
-rw-r--r--Makefile2
-rw-r--r--arm7/Makefile2
-rw-r--r--arm7/lib/include/OS_init.h2
-rw-r--r--arm7/lib/include/OS_system.h31
-rw-r--r--arm7/lib/include/consts.h6
-rw-r--r--arm9/Makefile4
-rw-r--r--arm9/lib/include/CARD_backup.h2
-rw-r--r--arm9/lib/include/CARD_pullOut.h2
-rw-r--r--arm9/lib/include/CARD_rom.h1
-rw-r--r--arm9/lib/include/CP_context.h2
-rw-r--r--arm9/lib/include/CTRDG_common.h2
-rw-r--r--arm9/lib/include/DGT_dgt.h2
-rw-r--r--arm9/lib/include/FS_command_default.h2
-rw-r--r--arm9/lib/include/FS_rom.h2
-rw-r--r--arm9/lib/include/MATH_crc.h2
-rw-r--r--arm9/lib/include/MATH_dgt.h2
-rw-r--r--arm9/lib/include/MATH_pop.h2
-rw-r--r--arm9/lib/include/MB_mb.h4
-rw-r--r--arm9/lib/include/OS_alarm.h6
-rw-r--r--arm9/lib/include/OS_alloc.h6
-rw-r--r--arm9/lib/include/OS_arena.h6
-rw-r--r--arm9/lib/include/OS_context.h6
-rw-r--r--arm9/lib/include/OS_init.h2
-rw-r--r--arm9/lib/include/OS_interrupt.h6
-rw-r--r--arm9/lib/include/OS_mutex.h6
-rw-r--r--arm9/lib/include/OS_printf.h2
-rw-r--r--arm9/lib/include/OS_protectionRegion.h6
-rw-r--r--arm9/lib/include/OS_spinLock.h6
-rw-r--r--arm9/lib/include/OS_system.h19
-rw-r--r--arm9/lib/include/OS_terminate_proc.h2
-rw-r--r--arm9/lib/include/OS_thread.h6
-rw-r--r--arm9/lib/include/OS_tick.h6
-rw-r--r--arm9/lib/include/consts.h17
-rw-r--r--arm9/lib/include/custom_allocator.h2
-rw-r--r--arm9/lib/include/dgt.h2
-rw-r--r--arm9/lib/include/gx.h1
-rw-r--r--arm9/lib/include/mmap.h2
-rw-r--r--arm9/lib/include/nitro.h2
-rw-r--r--arm9/lib/include/registers.h6
-rw-r--r--arm9/lib/include/types.h50
-rw-r--r--arm9/lib/src/FX.c1
-rw-r--r--arm9/lib/src/FX_atan.c1
-rw-r--r--arm9/lib/src/FX_cp.c1
-rw-r--r--arm9/lib/src/FX_vec.c1
-rw-r--r--arm9/lib/src/GX.c3
-rw-r--r--arm9/lib/src/GX_asm.c2
-rw-r--r--arm9/lib/src/GX_bgcnt.c3
-rw-r--r--arm9/lib/src/GX_g2.c3
-rw-r--r--arm9/lib/src/GX_g3.c3
-rw-r--r--arm9/lib/src/GX_g3_util.c3
-rw-r--r--arm9/lib/src/GX_g3b.c3
-rw-r--r--arm9/lib/src/GX_g3imm.c3
-rw-r--r--arm9/lib/src/GX_g3x.c2
-rw-r--r--arm9/lib/src/GX_load2d.c2
-rw-r--r--arm9/lib/src/GX_load3d.c2
-rw-r--r--arm9/lib/src/GX_state.c3
-rw-r--r--arm9/lib/src/GX_vramcnt.c3
-rw-r--r--arm9/lib/src/OS_terminate_proc.c5
-rw-r--r--include/filesystem.h2
-rw-r--r--include/nitro/OS_system_shared.h34
-rw-r--r--include/nitro/consts_shared.h26
-rw-r--r--include/nitro/types.h (renamed from arm7/lib/include/types.h)13
-rw-r--r--include/pokemon.h2
64 files changed, 145 insertions, 218 deletions
diff --git a/.gitignore b/.gitignore
index 1944bdd5..6e1fa301 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,3 +40,6 @@ arm9/modules/module_*.cfg
# Dism scripts
dism.sh
asmdiff.sh
+
+# Symbols CSV
+symbols.csv
diff --git a/Makefile b/Makefile
index 523a0936..63b9aaba 100644
--- a/Makefile
+++ b/Makefile
@@ -183,7 +183,7 @@ OBJCOPY := $(CROSS)objcopy
# ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o
ASFLAGS = -proc arm5te
-CFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -ir include -ir include-mw -ir arm9/lib/include -W all
+CFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -i include -ir include-mw -ir arm9/lib/include -W all
LDFLAGS = -map -nodead -w off -proc v5te -interworking -map -symtab -m _start
####################### Other Tools #########################
diff --git a/arm7/Makefile b/arm7/Makefile
index d898e7bd..063e287a 100644
--- a/arm7/Makefile
+++ b/arm7/Makefile
@@ -89,7 +89,7 @@ OBJCOPY := $(CROSS)objcopy
# ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm7_thumb.s -o arm7.o
ASFLAGS = -proc arm4t -i ..
-CFLAGS = -O4,p -proc arm7tdmi -fp soft -lang c99 -Cpp_exceptions off -ir ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all
+CFLAGS = -O4,p -proc arm7tdmi -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all
LDFLAGS = -map -nodead -w off -proc v4t -interworking -map -symtab -m _start
####################### Other Tools #########################
diff --git a/arm7/lib/include/OS_init.h b/arm7/lib/include/OS_init.h
index 1416fe8c..50d5e3c4 100644
--- a/arm7/lib/include/OS_init.h
+++ b/arm7/lib/include/OS_init.h
@@ -1,7 +1,7 @@
#ifndef POKEDIAMOND_ARM7_OS_INIT_H
#define POKEDIAMOND_ARM7_OS_INIT_H
-#include "types.h"
+#include "nitro/types.h"
#include "OS_system.h"
void OS_Init(void);
diff --git a/arm7/lib/include/OS_system.h b/arm7/lib/include/OS_system.h
index b6c81ab4..85e607ea 100644
--- a/arm7/lib/include/OS_system.h
+++ b/arm7/lib/include/OS_system.h
@@ -1,36 +1,15 @@
#ifndef POKEDIAMOND_ARM7_OS_SYSTEM_H
#define POKEDIAMOND_ARM7_OS_SYSTEM_H
-#include "types.h"
-
-//todo consts.h
-#define HW_PSR_CPU_MODE_MASK 0x1f // CPU mode
-
-#define HW_PSR_DISABLE_FIQ 0x40 // Disable FIQ
-#define HW_PSR_DISABLE_IRQ 0x80 // Disable IRQ
-#define HW_PSR_DISABLE_IRQ_FIQ 0xc0 // Disable FIQ and IRQ
-
-typedef enum {
- OS_PROCMODE_USER=16,
- OS_PROCMODE_FIQ=17,
- OS_PROCMODE_IRQ=18,
- OS_PROCMODE_SVC=19,
- OS_PROCMODE_ABORT=23,
- OS_PROCMODE_UNDEF=27,
- OS_PROCMODE_SYS=31
-} OSProcMode;
-
-typedef enum {
- OS_INTRMODE_DISABLE_IRQ = HW_PSR_DISABLE_IRQ,
- OS_INTRMODE_DISABLE_FIQ = HW_PSR_DISABLE_FIQ,
- OS_INTRMODE_ENABLE = 0
-} OSIntrMode;
+#include "nitro/types.h"
+#include "consts.h"
+#include "nitro/OS_system_shared.h"
OSIntrMode OS_EnableInterrupts(void);
OSIntrMode OS_DisableInterrupts(void);
-OSIntrMode OS_RestoreInterrupts(register OSIntrMode state);
+OSIntrMode OS_RestoreInterrupts(OSIntrMode state);
OSIntrMode OS_DisableInterrupts_IrqAndFiq(void);
-OSIntrMode OS_RestoreInterrupts_IrqAndFiq(register OSIntrMode state);
+OSIntrMode OS_RestoreInterrupts_IrqAndFiq(OSIntrMode state);
OSProcMode OS_GetProcMode(void);
void OS_SpinWait(u32 cycle);
diff --git a/arm7/lib/include/consts.h b/arm7/lib/include/consts.h
new file mode 100644
index 00000000..aaf8e429
--- /dev/null
+++ b/arm7/lib/include/consts.h
@@ -0,0 +1,6 @@
+#ifndef POKEDIAMOND_ARM7_CONSTS_H
+#define POKEDIAMOND_ARM7_CONSTS_H
+
+#include "nitro/consts_shared.h"
+
+#endif //POKEDIAMOND_ARM7_CONSTS_H
diff --git a/arm9/Makefile b/arm9/Makefile
index ebd74715..df04770c 100644
--- a/arm9/Makefile
+++ b/arm9/Makefile
@@ -184,8 +184,8 @@ OBJCOPY := $(CROSS)objcopy
# ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o
ASFLAGS = -proc arm5te -i ..
-CFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -ir ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all -D$(GAME_VERSION) -D$(GAME_LANGUAGE)
-CXXFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -ir ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all -D$(GAME_VERSION) -D$(GAME_LANGUAGE)
+CFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all -D$(GAME_VERSION) -D$(GAME_LANGUAGE)
+CXXFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all -D$(GAME_VERSION) -D$(GAME_LANGUAGE)
LDFLAGS = -map -nodead -w off -proc v5te -interworking -map -symtab -m _start
####################### Other Tools #########################
diff --git a/arm9/lib/include/CARD_backup.h b/arm9/lib/include/CARD_backup.h
index de594beb..d2cbc231 100644
--- a/arm9/lib/include/CARD_backup.h
+++ b/arm9/lib/include/CARD_backup.h
@@ -1,6 +1,8 @@
#ifndef NITRO_CARD_BACKUP_H_
#define NITRO_CARD_BACKUP_H_
+#include "nitro/types.h"
+
BOOL CARD_TryWaitBackupAsync(void);
#endif //NITRO_CARD_BACKUP_H_
diff --git a/arm9/lib/include/CARD_pullOut.h b/arm9/lib/include/CARD_pullOut.h
index 4a64f5ae..be49b95d 100644
--- a/arm9/lib/include/CARD_pullOut.h
+++ b/arm9/lib/include/CARD_pullOut.h
@@ -1,6 +1,8 @@
#ifndef NITRO_CARD_PULLOUT_H_
#define NITRO_CARD_PULLOUT_H_
+#include "nitro/types.h"
+
BOOL CARD_IsPulledOut(void);
#endif //NITRO_CARD_PULLOUT_H_
diff --git a/arm9/lib/include/CARD_rom.h b/arm9/lib/include/CARD_rom.h
index 4c2e9dd5..3d7bbb77 100644
--- a/arm9/lib/include/CARD_rom.h
+++ b/arm9/lib/include/CARD_rom.h
@@ -1,6 +1,7 @@
#ifndef NITRO_CARD_ROM_H_
#define NITRO_CARD_ROM_H_
+#include "nitro/types.h"
#include "MI_exMemory.h"
#include "MI_dma.h"
diff --git a/arm9/lib/include/CP_context.h b/arm9/lib/include/CP_context.h
index cfed9735..4a925257 100644
--- a/arm9/lib/include/CP_context.h
+++ b/arm9/lib/include/CP_context.h
@@ -5,7 +5,7 @@
#ifndef POKEDIAMOND_CP_CONTEXT_H
#define POKEDIAMOND_CP_CONTEXT_H
-#include "types.h"
+#include "nitro/types.h"
typedef struct CPContext {
u64 div_numer;
diff --git a/arm9/lib/include/CTRDG_common.h b/arm9/lib/include/CTRDG_common.h
index c83602b8..32049f3c 100644
--- a/arm9/lib/include/CTRDG_common.h
+++ b/arm9/lib/include/CTRDG_common.h
@@ -1,6 +1,8 @@
#ifndef NITRO_CTRDG_COMMON_H_
#define NITRO_CTRDG_COMMON_H_
+#include "nitro/types.h"
+
BOOL CTRDG_IsPulledOut(void);
#endif //NITRO_CTRDG_COMMON_H_
diff --git a/arm9/lib/include/DGT_dgt.h b/arm9/lib/include/DGT_dgt.h
index bc9cb47e..95c7c4e2 100644
--- a/arm9/lib/include/DGT_dgt.h
+++ b/arm9/lib/include/DGT_dgt.h
@@ -1,6 +1,8 @@
#ifndef NITRO_DGT_DGT_H_
#define NITRO_DGT_DGT_H_
+#include "nitro/types.h"
+
void DGT_Hash2CalcHmac(void* digest, void* bin_ptr, u32 bin_len, void* key_ptr, u32 keylen);
#endif //NITRO_DGT_DGT_H_
diff --git a/arm9/lib/include/FS_command_default.h b/arm9/lib/include/FS_command_default.h
index 1984aeb0..20e20f8f 100644
--- a/arm9/lib/include/FS_command_default.h
+++ b/arm9/lib/include/FS_command_default.h
@@ -1,7 +1,7 @@
#ifndef POKEDIAMOND_FS_COMMAND_DEFAULT_H
#define POKEDIAMOND_FS_COMMAND_DEFAULT_H
-#include "types.h"
+#include "nitro/types.h"
#include "FS_archive.h"
typedef struct
diff --git a/arm9/lib/include/FS_rom.h b/arm9/lib/include/FS_rom.h
index a98c8a9c..bd0cd73b 100644
--- a/arm9/lib/include/FS_rom.h
+++ b/arm9/lib/include/FS_rom.h
@@ -4,7 +4,7 @@
#include "FS_archive.h"
#include "FS_file.h"
#include "CARD_rom.h"
-#include "types.h"
+#include "nitro/types.h"
extern FSArchive fsi_arc_rom;
extern s32 fsi_card_lock_id;
diff --git a/arm9/lib/include/MATH_crc.h b/arm9/lib/include/MATH_crc.h
index 800b738b..f15a2e32 100644
--- a/arm9/lib/include/MATH_crc.h
+++ b/arm9/lib/include/MATH_crc.h
@@ -1,7 +1,7 @@
#ifndef GUARD_MATH_CRC_H
#define GUARD_MATH_CRC_H
-#include "types.h"
+#include "nitro/types.h"
typedef u8 MATHCRC8Context;
typedef u16 MATHCRC16Context;
diff --git a/arm9/lib/include/MATH_dgt.h b/arm9/lib/include/MATH_dgt.h
index 9eb3d2ef..140b4f98 100644
--- a/arm9/lib/include/MATH_dgt.h
+++ b/arm9/lib/include/MATH_dgt.h
@@ -2,7 +2,7 @@
#define GUARD_MATH_DGT_H
#include "dgt.h"
-#include "types.h"
+#include "nitro/types.h"
typedef struct DGTHash1Context MATHMD5Context;
typedef struct DGTHash2Context MATHSHA1Context;
diff --git a/arm9/lib/include/MATH_pop.h b/arm9/lib/include/MATH_pop.h
index 89dab0c0..29a42b22 100644
--- a/arm9/lib/include/MATH_pop.h
+++ b/arm9/lib/include/MATH_pop.h
@@ -1,7 +1,7 @@
#ifndef GUARD_MATH_POP_H
#define GUARD_MATH_POP_H
-#include "types.h"
+#include "nitro/types.h"
u8 MATH_CountPopulation(u32);
diff --git a/arm9/lib/include/MB_mb.h b/arm9/lib/include/MB_mb.h
index 128ea480..5bccaf8b 100644
--- a/arm9/lib/include/MB_mb.h
+++ b/arm9/lib/include/MB_mb.h
@@ -1,7 +1,3 @@
-//
-// Created by red031000 on 2020-05-06.
-//
-
#ifndef POKEDIAMOND_MB_MB_H
#define POKEDIAMOND_MB_MB_H
diff --git a/arm9/lib/include/OS_alarm.h b/arm9/lib/include/OS_alarm.h
index 6971248a..d6b0c210 100644
--- a/arm9/lib/include/OS_alarm.h
+++ b/arm9/lib/include/OS_alarm.h
@@ -1,11 +1,7 @@
-//
-// Created by red031000 on 2020-05-17.
-//
-
#ifndef POKEDIAMOND_OS_ALARM_H
#define POKEDIAMOND_OS_ALARM_H
-#include "types.h"
+#include "nitro/types.h"
#include "OS_thread.h"
typedef void (*OSAlarmHandler) (void *);
diff --git a/arm9/lib/include/OS_alloc.h b/arm9/lib/include/OS_alloc.h
index 74b7b0e5..5ee95395 100644
--- a/arm9/lib/include/OS_alloc.h
+++ b/arm9/lib/include/OS_alloc.h
@@ -1,11 +1,7 @@
-//
-// Created by mart on 4/23/20.
-//
-
#ifndef POKEDIAMOND_OS_ALLOC_H
#define POKEDIAMOND_OS_ALLOC_H
-#include "types.h"
+#include "nitro/types.h"
#include "OS_arena.h"
typedef int OSHeapHandle;
diff --git a/arm9/lib/include/OS_arena.h b/arm9/lib/include/OS_arena.h
index 8cfef81d..7608835a 100644
--- a/arm9/lib/include/OS_arena.h
+++ b/arm9/lib/include/OS_arena.h
@@ -1,11 +1,7 @@
-//
-// Created by red031000 on 2020-04-27.
-//
-
#ifndef POKEDIAMOND_OS_ARENA_H
#define POKEDIAMOND_OS_ARENA_H
-#include "types.h"
+#include "nitro/types.h"
typedef enum {
OS_ARENA_MAIN = 0,
diff --git a/arm9/lib/include/OS_context.h b/arm9/lib/include/OS_context.h
index c0ab62f1..cded1acb 100644
--- a/arm9/lib/include/OS_context.h
+++ b/arm9/lib/include/OS_context.h
@@ -1,11 +1,7 @@
-//
-// Created by red031000 on 2020-05-17.
-//
-
#ifndef POKEDIAMOND_OS_CONTEXT_H
#define POKEDIAMOND_OS_CONTEXT_H
-#include "types.h"
+#include "nitro/types.h"
#include "CP_context.h"
typedef struct OSContext
diff --git a/arm9/lib/include/OS_init.h b/arm9/lib/include/OS_init.h
index 6792c900..baa2f442 100644
--- a/arm9/lib/include/OS_init.h
+++ b/arm9/lib/include/OS_init.h
@@ -1,7 +1,7 @@
#ifndef POKEDIAMOND_ARM9_OS_INIT_H
#define POKEDIAMOND_ARM9_OS_INIT_H
-#include "types.h"
+#include "nitro/types.h"
#include "consts.h"
#include "OS_tcm.h"
#include "OS_spinLock.h"
diff --git a/arm9/lib/include/OS_interrupt.h b/arm9/lib/include/OS_interrupt.h
index cbdc225f..6ffa3a10 100644
--- a/arm9/lib/include/OS_interrupt.h
+++ b/arm9/lib/include/OS_interrupt.h
@@ -1,11 +1,7 @@
-//
-// Created by red031000 on 2020-05-07.
-//
-
#ifndef POKEDIAMOND_OS_INTERRUPT_H
#define POKEDIAMOND_OS_INTERRUPT_H
-#include "types.h"
+#include "nitro/types.h"
typedef void (*OSIrqFunction) (void);
diff --git a/arm9/lib/include/OS_mutex.h b/arm9/lib/include/OS_mutex.h
index 5db66fbe..a2cdff23 100644
--- a/arm9/lib/include/OS_mutex.h
+++ b/arm9/lib/include/OS_mutex.h
@@ -1,11 +1,7 @@
-//
-// Created by red031000 on 2020-05-17.
-//
-
#ifndef POKEDIAMOND_OS_MUTEX_H
#define POKEDIAMOND_OS_MUTEX_H
-#include "types.h"
+#include "nitro/types.h"
#include "OS_thread.h"
struct OSMutex {
diff --git a/arm9/lib/include/OS_printf.h b/arm9/lib/include/OS_printf.h
index 7c2e09b4..acb7f8c7 100644
--- a/arm9/lib/include/OS_printf.h
+++ b/arm9/lib/include/OS_printf.h
@@ -5,7 +5,7 @@
#define OS_TPanic(...) OS_Terminate()
#define OS_TWarning(...) ((void)0)
-#include "types.h"
+#include "nitro/types.h"
s32 OS_SPrintf(s8 *buffer, const s8 *format, ...);
s32 OS_VSPrintf(s8 *buffer, const s8 *format, void *args);
diff --git a/arm9/lib/include/OS_protectionRegion.h b/arm9/lib/include/OS_protectionRegion.h
index 8e25420a..9b65258d 100644
--- a/arm9/lib/include/OS_protectionRegion.h
+++ b/arm9/lib/include/OS_protectionRegion.h
@@ -1,11 +1,7 @@
-//
-// Created by red031000 on 2020-04-24.
-//
-
#ifndef POKEDIAMOND_OS_PROTECTIONREGION_H
#define POKEDIAMOND_OS_PROTECTIONREGION_H
-#include "types.h"
+#include "nitro/types.h"
#include "consts.h"
void OS_SetDPermissionsForProtectionRegion(register u32 setMask, register u32 flags);
diff --git a/arm9/lib/include/OS_spinLock.h b/arm9/lib/include/OS_spinLock.h
index eccc502b..5dc47522 100644
--- a/arm9/lib/include/OS_spinLock.h
+++ b/arm9/lib/include/OS_spinLock.h
@@ -1,11 +1,7 @@
-//
-// Created by red031000 on 2020-05-03.
-//
-
#ifndef POKEDIAMOND_OS_SPINLOCK_H
#define POKEDIAMOND_OS_SPINLOCK_H
-#include "types.h"
+#include "nitro/types.h"
#include "syscall.h"
typedef volatile struct OSLockWord {
diff --git a/arm9/lib/include/OS_system.h b/arm9/lib/include/OS_system.h
index a5426c17..37dbbd76 100644
--- a/arm9/lib/include/OS_system.h
+++ b/arm9/lib/include/OS_system.h
@@ -3,24 +3,7 @@
#include "function_target.h"
#include "consts.h"
-
-typedef enum {
- OS_PROCMODE_USER=16,
- OS_PROCMODE_FIQ=17,
- OS_PROCMODE_IRQ=18,
- OS_PROCMODE_SVC=19,
- OS_PROCMODE_ABORT=23,
- OS_PROCMODE_UNDEF=27,
- OS_PROCMODE_SYS=31
-} OSProcMode;
-
-ENUMS_ALWAYS_INT_ON
-typedef enum {
- OS_INTRMODE_DISABLE_IRQ = HW_PSR_DISABLE_IRQ,
- OS_INTRMODE_DISABLE_FIQ = HW_PSR_DISABLE_FIQ,
- OS_INTRMODE_ENABLE = 0
-} OSIntrMode;
-ENUMS_ALWAYS_INT_RESET
+#include "nitro/OS_system_shared.h"
OSIntrMode OS_EnableInterrupts(void);
OSIntrMode OS_DisableInterrupts(void);
diff --git a/arm9/lib/include/OS_terminate_proc.h b/arm9/lib/include/OS_terminate_proc.h
index d1abe3ad..1d3ac27e 100644
--- a/arm9/lib/include/OS_terminate_proc.h
+++ b/arm9/lib/include/OS_terminate_proc.h
@@ -5,6 +5,8 @@
#ifndef POKEDIAMOND_OS_TERMINATE_PROC_H
#define POKEDIAMOND_OS_TERMINATE_PROC_H
+#include "nitro/types.h"
+
void OS_Terminate(void);
void OS_Halt(void);
diff --git a/arm9/lib/include/OS_thread.h b/arm9/lib/include/OS_thread.h
index bbdb33c9..bf62e66b 100644
--- a/arm9/lib/include/OS_thread.h
+++ b/arm9/lib/include/OS_thread.h
@@ -1,11 +1,7 @@
-//
-// Created by red031000 on 2020-05-03.
-//
-
#ifndef POKEDIAMOND_OS_THREAD_H
#define POKEDIAMOND_OS_THREAD_H
-#include "types.h"
+#include "nitro/types.h"
#include "OS_context.h"
typedef struct OSiAlarm OSAlarm;
diff --git a/arm9/lib/include/OS_tick.h b/arm9/lib/include/OS_tick.h
index fbb8ce9e..fb4ce7e6 100644
--- a/arm9/lib/include/OS_tick.h
+++ b/arm9/lib/include/OS_tick.h
@@ -1,11 +1,7 @@
-//
-// Created by red031000 on 2020-05-17.
-//
-
#ifndef POKEDIAMOND_OS_TICK_H
#define POKEDIAMOND_OS_TICK_H
-#include "types.h"
+#include "nitro/types.h"
typedef u64 OSTick;
diff --git a/arm9/lib/include/consts.h b/arm9/lib/include/consts.h
index b99b4148..6c83bce8 100644
--- a/arm9/lib/include/consts.h
+++ b/arm9/lib/include/consts.h
@@ -1,19 +1,10 @@
-//
-// Created by mart on 4/15/20.
-//
-
-#ifndef POKEDIAMOND_CONSTS_H
-#define POKEDIAMOND_CONSTS_H
+#ifndef POKEDIAMOND_ARM9_CONSTS_H
+#define POKEDIAMOND_ARM9_CONSTS_H
+#include "nitro/consts_shared.h"
#include "mmap.h"
#include "registers.h"
-#define HW_PSR_CPU_MODE_MASK 0x1f // CPU mode
-
-#define HW_PSR_DISABLE_FIQ 0x40 // Disable FIQ
-#define HW_PSR_DISABLE_IRQ 0x80 // Disable IRQ
-#define HW_PSR_DISABLE_IRQ_FIQ 0xc0 // Disable FIQ and IRQ
-
#define HW_C6_PR_4KB 0x16
#define HW_C6_PR_8KB 0x18
#define HW_C6_PR_16KB 0x1a
@@ -53,4 +44,4 @@
#define OS_IE_V_BLANK (1UL << 0)
-#endif //POKEDIAMOND_CONSTS_H
+#endif //POKEDIAMOND_ARM9_CONSTS_H
diff --git a/arm9/lib/include/custom_allocator.h b/arm9/lib/include/custom_allocator.h
index 828566f7..0a42ae13 100644
--- a/arm9/lib/include/custom_allocator.h
+++ b/arm9/lib/include/custom_allocator.h
@@ -1,7 +1,7 @@
#ifndef POKEDIAMOND_CUSTOM_ALLOCATOR_H
#define POKEDIAMOND_CUSTOM_ALLOCATOR_H
-#include "types.h"
+#include "nitro/types.h"
typedef void * (* AllocFunc)(u32 size);
typedef void (* FreeFunc)(void * ptr);
diff --git a/arm9/lib/include/dgt.h b/arm9/lib/include/dgt.h
index a764e85a..97916f1b 100644
--- a/arm9/lib/include/dgt.h
+++ b/arm9/lib/include/dgt.h
@@ -1,7 +1,7 @@
#ifndef GUARD_DGT_H
#define GUARD_DGT_H
-#include "types.h"
+#include "nitro/types.h"
struct DGTHash1Context {
union {
diff --git a/arm9/lib/include/gx.h b/arm9/lib/include/gx.h
index 79b707fc..f1c9fa50 100644
--- a/arm9/lib/include/gx.h
+++ b/arm9/lib/include/gx.h
@@ -3,6 +3,7 @@
#include "fx.h"
#include "MI_memory.h"
+#include "MI_dma.h"
//temporary while other files aren't decompiled
diff --git a/arm9/lib/include/mmap.h b/arm9/lib/include/mmap.h
index c43e65b6..8f9d8dcd 100644
--- a/arm9/lib/include/mmap.h
+++ b/arm9/lib/include/mmap.h
@@ -1,7 +1,7 @@
#ifndef NITRO_MMAP_H
#define NITRO_MMAP_H
-#include "types.h"
+#include "nitro/types.h"
extern u32 SDK_AUTOLOAD_DTCM_START[];
diff --git a/arm9/lib/include/nitro.h b/arm9/lib/include/nitro.h
index 9eeab198..ea7503cc 100644
--- a/arm9/lib/include/nitro.h
+++ b/arm9/lib/include/nitro.h
@@ -8,7 +8,7 @@ extern "C" {
// Include all nitro files
#include "sections.h"
#include "misc.h"
-#include "types.h"
+#include "nitro/types.h"
#include "consts.h"
#include "OS_init.h"
#include "mmap.h"
diff --git a/arm9/lib/include/registers.h b/arm9/lib/include/registers.h
index a1536eb8..4781ba1b 100644
--- a/arm9/lib/include/registers.h
+++ b/arm9/lib/include/registers.h
@@ -1,11 +1,7 @@
-//
-// Created by red031000 on 2020-05-06.
-//
-
#ifndef POKEDIAMOND_REGISTERS_H
#define POKEDIAMOND_REGISTERS_H
-#include "types.h"
+#include "nitro/types.h"
#define reg_GX_DISPCNT (*(REGType32v *)0x4000000)
#define reg_GX_DISPSTAT (*(REGType16v *)0x4000004)
diff --git a/arm9/lib/include/types.h b/arm9/lib/include/types.h
deleted file mode 100644
index ca11e244..00000000
--- a/arm9/lib/include/types.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef POKEDIAMOND_ARM9_TYPES_H
-#define POKEDIAMOND_ARM9_TYPES_H
-
-typedef unsigned char u8;
-typedef unsigned short int u16;
-typedef unsigned long u32;
-
-typedef signed char s8;
-typedef signed short int s16;
-typedef signed long s32;
-
-typedef unsigned long long int u64;
-typedef signed long long int s64;
-
-typedef volatile u8 vu8;
-typedef volatile u16 vu16;
-typedef volatile u32 vu32;
-typedef volatile u64 vu64;
-
-typedef volatile s8 vs8;
-typedef volatile s16 vs16;
-typedef volatile s32 vs32;
-typedef volatile s64 vs64;
-
-typedef float f32;
-typedef volatile f32 vf32;
-
-typedef u8 REGType8;
-typedef u16 REGType16;
-typedef u32 REGType32;
-typedef u64 REGType64;
-
-typedef vu8 REGType8v;
-typedef vu16 REGType16v;
-typedef vu32 REGType32v;
-typedef vu64 REGType64v;
-
-typedef int BOOL;
-#define TRUE 1
-#define FALSE 0
-
-#ifndef NULL
-#ifdef __cplusplus
-#define NULL 0
-#else // __cplusplus
-#define NULL ((void *)0)
-#endif // __cplusplus
-#endif
-
-#endif //POKEDIAMOND_ARM9_TYPES_H
diff --git a/arm9/lib/src/FX.c b/arm9/lib/src/FX.c
index 4b9c213f..ea730538 100644
--- a/arm9/lib/src/FX.c
+++ b/arm9/lib/src/FX.c
@@ -1,5 +1,4 @@
#include "global.h"
-#include "main.h"
#include "fx.h"
ARM_FUNC void FX_Init(){
diff --git a/arm9/lib/src/FX_atan.c b/arm9/lib/src/FX_atan.c
index fa2d0dbe..ef2a662d 100644
--- a/arm9/lib/src/FX_atan.c
+++ b/arm9/lib/src/FX_atan.c
@@ -1,5 +1,4 @@
#include "global.h"
-#include "main.h"
#include "fx.h"
const fx16 FX_AtanTable_[] = {
diff --git a/arm9/lib/src/FX_cp.c b/arm9/lib/src/FX_cp.c
index 83967ff3..c8069146 100644
--- a/arm9/lib/src/FX_cp.c
+++ b/arm9/lib/src/FX_cp.c
@@ -1,5 +1,4 @@
#include "global.h"
-#include "main.h"
#include "fx.h"
diff --git a/arm9/lib/src/FX_vec.c b/arm9/lib/src/FX_vec.c
index 891b980a..39dd3076 100644
--- a/arm9/lib/src/FX_vec.c
+++ b/arm9/lib/src/FX_vec.c
@@ -1,5 +1,4 @@
#include "global.h"
-#include "main.h"
#include "fx.h"
ARM_FUNC void VEC_Add(struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *dst){
diff --git a/arm9/lib/src/GX.c b/arm9/lib/src/GX.c
index 6b2f7790..d103bed5 100644
--- a/arm9/lib/src/GX.c
+++ b/arm9/lib/src/GX.c
@@ -1,6 +1,5 @@
#include "global.h"
-#include "main.h"
-#include "GX.h"
+#include "gx.h"
u32 GXi_DmaId = 3;
vu16 GXi_VRamLockId = 0;
diff --git a/arm9/lib/src/GX_asm.c b/arm9/lib/src/GX_asm.c
index f40793d8..1eb0a011 100644
--- a/arm9/lib/src/GX_asm.c
+++ b/arm9/lib/src/GX_asm.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "main.h"
-#include "GX.h"
+#include "gx.h"
//looks like asm and says asm on the tin...
ARM_FUNC asm void GX_SendFifo48B(void *src, void *dst){
diff --git a/arm9/lib/src/GX_bgcnt.c b/arm9/lib/src/GX_bgcnt.c
index 92f2c4b8..91a67655 100644
--- a/arm9/lib/src/GX_bgcnt.c
+++ b/arm9/lib/src/GX_bgcnt.c
@@ -1,6 +1,5 @@
#include "global.h"
-#include "main.h"
-#include "GX.h"
+#include "gx.h"
ARM_FUNC void *G2_GetBG0ScrPtr(){
u32 temp = (u32)(((reg_G2_BG0CNT & 0x1F00) >> 0x8) << 0xB);
diff --git a/arm9/lib/src/GX_g2.c b/arm9/lib/src/GX_g2.c
index d17d4263..bde1d1a5 100644
--- a/arm9/lib/src/GX_g2.c
+++ b/arm9/lib/src/GX_g2.c
@@ -1,6 +1,5 @@
#include "global.h"
-#include "main.h"
-#include "GX.h"
+#include "gx.h"
ARM_FUNC void G2x_SetBGyAffine_(u32 *ptr, struct Mtx22 *mtx, fx32 a, fx32 b, fx32 c, fx32 d){
fx32 temp0, temp1, temp2, temp3;
diff --git a/arm9/lib/src/GX_g3.c b/arm9/lib/src/GX_g3.c
index 2b5f2941..45b6b11b 100644
--- a/arm9/lib/src/GX_g3.c
+++ b/arm9/lib/src/GX_g3.c
@@ -1,6 +1,5 @@
#include "global.h"
-#include "main.h"
-#include "GX.h"
+#include "gx.h"
ARM_FUNC void G3_BeginMakeDL(struct GXDLInfo *displaylist, void *r1, u32 r2){
diff --git a/arm9/lib/src/GX_g3_util.c b/arm9/lib/src/GX_g3_util.c
index 6e472471..e647f1c7 100644
--- a/arm9/lib/src/GX_g3_util.c
+++ b/arm9/lib/src/GX_g3_util.c
@@ -1,6 +1,5 @@
#include "global.h"
-#include "main.h"
-#include "GX.h"
+#include "gx.h"
ARM_FUNC void G3i_PerspectiveW_(fx32 fovsin, fx32 fovcos, fx32 ratio, fx32 near, fx32 far, fx32 scale, u32 load, struct Mtx44 *mtx){
diff --git a/arm9/lib/src/GX_g3b.c b/arm9/lib/src/GX_g3b.c
index c71ff9d5..a3b96a0b 100644
--- a/arm9/lib/src/GX_g3b.c
+++ b/arm9/lib/src/GX_g3b.c
@@ -1,6 +1,5 @@
#include "global.h"
-#include "main.h"
-#include "GX.h"
+#include "gx.h"
ARM_FUNC void G3BS_LoadMtx44(struct GXDLInfo *displaylist, struct Mtx44 *mtx){
diff --git a/arm9/lib/src/GX_g3imm.c b/arm9/lib/src/GX_g3imm.c
index bacd395a..f2129c48 100644
--- a/arm9/lib/src/GX_g3imm.c
+++ b/arm9/lib/src/GX_g3imm.c
@@ -1,6 +1,5 @@
#include "global.h"
-#include "main.h"
-#include "GX.h"
+#include "gx.h"
void MI_Copy36B(void *src, void *dst);
diff --git a/arm9/lib/src/GX_g3x.c b/arm9/lib/src/GX_g3x.c
index ed84f58b..c8266bee 100644
--- a/arm9/lib/src/GX_g3x.c
+++ b/arm9/lib/src/GX_g3x.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "main.h"
-#include "GX.h"
+#include "gx.h"
extern u32 GXi_DmaId;
diff --git a/arm9/lib/src/GX_load2d.c b/arm9/lib/src/GX_load2d.c
index 92669bce..132de9ee 100644
--- a/arm9/lib/src/GX_load2d.c
+++ b/arm9/lib/src/GX_load2d.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "main.h"
-#include "GX.h"
+#include "gx.h"
extern u32 GXi_DmaId;
diff --git a/arm9/lib/src/GX_load3d.c b/arm9/lib/src/GX_load3d.c
index df057a44..ae15f32e 100644
--- a/arm9/lib/src/GX_load3d.c
+++ b/arm9/lib/src/GX_load3d.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "main.h"
-#include "GX.h"
+#include "gx.h"
extern u32 GXi_DmaId;
diff --git a/arm9/lib/src/GX_state.c b/arm9/lib/src/GX_state.c
index 6b216f39..003e42b5 100644
--- a/arm9/lib/src/GX_state.c
+++ b/arm9/lib/src/GX_state.c
@@ -1,6 +1,5 @@
#include "global.h"
-#include "main.h"
-#include "GX.h"
+#include "gx.h"
struct GX_State gGXState;
diff --git a/arm9/lib/src/GX_vramcnt.c b/arm9/lib/src/GX_vramcnt.c
index 6dcf34c1..c9d5a1bd 100644
--- a/arm9/lib/src/GX_vramcnt.c
+++ b/arm9/lib/src/GX_vramcnt.c
@@ -1,6 +1,5 @@
#include "global.h"
-#include "main.h"
-#include "GX.h"
+#include "gx.h"
extern u16 GXi_VRamLockId;
extern struct GX_State gGXState;
diff --git a/arm9/lib/src/OS_terminate_proc.c b/arm9/lib/src/OS_terminate_proc.c
index 40b015d9..c86b85ab 100644
--- a/arm9/lib/src/OS_terminate_proc.c
+++ b/arm9/lib/src/OS_terminate_proc.c
@@ -1,8 +1,3 @@
-//
-// Created by red031000 on 2020-05-07.
-//
-
-#include "types.h"
#include "OS_terminate_proc.h"
#include "function_target.h"
#include "OS_system.h"
diff --git a/include/filesystem.h b/include/filesystem.h
index 64335228..37f73bb0 100644
--- a/include/filesystem.h
+++ b/include/filesystem.h
@@ -1,6 +1,8 @@
#ifndef POKEDIAMOND_FILESYSTEM_H
#define POKEDIAMOND_FILESYSTEM_H
+#include "nitro/types.h"
+
typedef struct NARC
{
FSFile file;
diff --git a/include/nitro/OS_system_shared.h b/include/nitro/OS_system_shared.h
new file mode 100644
index 00000000..f36e7638
--- /dev/null
+++ b/include/nitro/OS_system_shared.h
@@ -0,0 +1,34 @@
+/*
+ * NOTE:
+ * This file is shared between ARM9 and ARM7
+ * DO NOT PUT PROC SPECIFIC CODE IN HERE
+ * Thank You!
+ */
+
+/*
+ * DO NOT INCLUDE THIS FILE DIRECTLY
+ * Include OS_system.h from the specific proc's lib
+ */
+
+#ifndef POKEDIAMOND_OS_SYSTEM_SHARED_H
+#define POKEDIAMOND_OS_SYSTEM_SHARED_H
+
+#include "nitro/consts_shared.h"
+
+typedef enum {
+ OS_PROCMODE_USER=16,
+ OS_PROCMODE_FIQ=17,
+ OS_PROCMODE_IRQ=18,
+ OS_PROCMODE_SVC=19,
+ OS_PROCMODE_ABORT=23,
+ OS_PROCMODE_UNDEF=27,
+ OS_PROCMODE_SYS=31
+} OSProcMode;
+
+typedef enum {
+ OS_INTRMODE_DISABLE_IRQ = HW_PSR_DISABLE_IRQ,
+ OS_INTRMODE_DISABLE_FIQ = HW_PSR_DISABLE_FIQ,
+ OS_INTRMODE_ENABLE = 0
+} OSIntrMode;
+
+#endif //POKEDIAMOND_OS_SYSTEM_SHARED_H
diff --git a/include/nitro/consts_shared.h b/include/nitro/consts_shared.h
new file mode 100644
index 00000000..e515831e
--- /dev/null
+++ b/include/nitro/consts_shared.h
@@ -0,0 +1,26 @@
+/*
+ * NOTE:
+ * This file is shared between ARM9 and ARM7
+ * DO NOT PUT PROC SPECIFIC CODE IN HERE
+ * Thank You!
+ */
+
+/*
+ * DO NOT INCLUDE THIS FILE DIRECTLY
+ * Include consts.h from the specific proc's lib
+ */
+
+#ifndef POKEDIAMOND_CONSTS_SHARED_H
+#define POKEDIAMOND_CONSTS_SHARED_H
+
+#include "nitro/types.h"
+
+//Shared Consts
+
+#define HW_PSR_CPU_MODE_MASK 0x1f // CPU mode
+
+#define HW_PSR_DISABLE_FIQ 0x40 // Disable FIQ
+#define HW_PSR_DISABLE_IRQ 0x80 // Disable IRQ
+#define HW_PSR_DISABLE_IRQ_FIQ 0xc0 // Disable FIQ and IRQ
+
+#endif //POKEDIAMOND_CONSTS_SHARED_H
diff --git a/arm7/lib/include/types.h b/include/nitro/types.h
index 3a497c56..190d9eae 100644
--- a/arm7/lib/include/types.h
+++ b/include/nitro/types.h
@@ -1,5 +1,12 @@
-#ifndef POKEDIAMOND_ARM7_TYPES_H
-#define POKEDIAMOND_ARM7_TYPES_H
+/*
+ * NOTE:
+ * This file is shared between ARM9 and ARM7
+ * DO NOT PUT PROC SPECIFIC CODE IN HERE
+ * Thank You!
+ */
+
+#ifndef POKEDIAMOND_TYPES_H
+#define POKEDIAMOND_TYPES_H
typedef unsigned char u8;
typedef unsigned short int u16;
@@ -47,4 +54,4 @@ typedef int BOOL;
#endif // __cplusplus
#endif
-#endif //POKEDIAMOND_NITRO_TYPES_H
+#endif //POKEDIAMOND_TYPES_H
diff --git a/include/pokemon.h b/include/pokemon.h
index 494f29d8..a8584b27 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -1,7 +1,7 @@
#ifndef POKEDIAMOND_POKEMON_H
#define POKEDIAMOND_POKEMON_H
-#include "types.h"
+#include "nitro/types.h"
// Enums