From 43eb982a80c45fe26f1cbbc23285c4d8a2cc64b4 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 20 Apr 2020 20:57:00 -0400 Subject: [PATCH] Create include/ directory and move main.h structs there --- CMakeLists.txt | 2 +- Makefile | 2 +- include/global.h | 6 +++++ include/main.h | 40 +++++++++++++++++++++++++++ {nitro => include/nitro}/nitro.h | 4 +-- {nitro => include/nitro}/os.c | 0 {nitro => include/nitro}/os.h | 2 +- {nitro => include/nitro}/os_asm.h | 2 +- {nitro => include/nitro}/os_asm.s | 0 {nitro => include/nitro}/types.h | 0 src/FUN_02000DF4.c | 11 ++------ src/main.c | 45 ++----------------------------- src/string_util.c | 2 +- 13 files changed, 57 insertions(+), 59 deletions(-) create mode 100644 include/global.h create mode 100644 include/main.h rename {nitro => include/nitro}/nitro.h (79%) rename {nitro => include/nitro}/os.c (100%) rename {nitro => include/nitro}/os.h (81%) rename {nitro => include/nitro}/os_asm.h (86%) rename {nitro => include/nitro}/os_asm.s (100%) rename {nitro => include/nitro}/types.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27dd07f97..ef9276a4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,4 +8,4 @@ enable_language(ASM) file(GLOB_RECURSE SOURCES RELATIVE ${CMAKE_SOURCE_DIR} "*.c") add_executable(PokeDiamond ${SOURCES}) -target_include_directories(PokeDiamond PRIVATE nitro) +target_include_directories(PokeDiamond PRIVATE include) diff --git a/Makefile b/Makefile index f70d51b83..91f6d8e34 100644 --- a/Makefile +++ b/Makefile @@ -79,7 +79,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 v5te -thumb -fp soft -lang c99 -Cpp_exceptions off -i nitro +CFLAGS = -O4,p -proc v5te -thumb -fp soft -lang c99 -Cpp_exceptions off -i include LDFLAGS = -map -nodead -w off -proc v5te -interworking -map -symtab -m Entry ####################### Other Tools ######################### diff --git a/include/global.h b/include/global.h new file mode 100644 index 000000000..33880ca1d --- /dev/null +++ b/include/global.h @@ -0,0 +1,6 @@ +#ifndef GUARD_GLOBAL_H +#define GUARD_GLOBAL_H + +#include "nitro/nitro.h" + +#endif //GUARD_GLOBAL_H diff --git a/include/main.h b/include/main.h new file mode 100644 index 000000000..0df94795d --- /dev/null +++ b/include/main.h @@ -0,0 +1,40 @@ +#ifndef GUARD_MAIN_H +#define GUARD_MAIN_H + +struct Unk2106FA0 +{ + s32 unk0; + s32 unk4; + s32 unk8; + s32 unkC; + s32 unk10; + s32 unk14; + s32 unk18; + s32 unk1C; + s32 unk20; +}; + +struct Unk21C48B8 +{ + void (*unk0)(s32); + s32 unk4; + s32 unk8; + s32 unkC; + s32 unk10; + s32 unk14; + s32 unk18; + s32 unk1C; + s32 unk20; + s32 unk24; + s32 unk28; + s32 unk2C; + s32 unk30; + s32 unk34; + s32 unk38; + u8 filler3C[0xC]; + s32 unk48; + u8 filler4C[0x20]; + s32 unk6C; +}; + +#endif //GUARD_MAIN_H diff --git a/nitro/nitro.h b/include/nitro/nitro.h similarity index 79% rename from nitro/nitro.h rename to include/nitro/nitro.h index 70ad9a189..017f37087 100644 --- a/nitro/nitro.h +++ b/include/nitro/nitro.h @@ -6,8 +6,8 @@ extern "C" { #endif // Include all nitro files -#include "types.h" -#include "os.h" +#include "nitro/types.h" +#include "nitro/os.h" #ifdef __cplusplus }; diff --git a/nitro/os.c b/include/nitro/os.c similarity index 100% rename from nitro/os.c rename to include/nitro/os.c diff --git a/nitro/os.h b/include/nitro/os.h similarity index 81% rename from nitro/os.h rename to include/nitro/os.h index 8e4d4ed3f..c14b2891b 100644 --- a/nitro/os.h +++ b/include/nitro/os.h @@ -5,6 +5,6 @@ #ifndef POKEDIAMOND_OS_H #define POKEDIAMOND_OS_H -#include "os_asm.h" +#include "nitro/os_asm.h" #endif //POKEDIAMOND_OS_H diff --git a/nitro/os_asm.h b/include/nitro/os_asm.h similarity index 86% rename from nitro/os_asm.h rename to include/nitro/os_asm.h index 43c933857..775955f18 100644 --- a/nitro/os_asm.h +++ b/include/nitro/os_asm.h @@ -5,7 +5,7 @@ #ifndef POKEDIAMOND_OS_ASM_H #define POKEDIAMOND_OS_ASM_H -#include "types.h" +#include "nitro/types.h" OSProcMode OS_GetProcMode(); diff --git a/nitro/os_asm.s b/include/nitro/os_asm.s similarity index 100% rename from nitro/os_asm.s rename to include/nitro/os_asm.s diff --git a/nitro/types.h b/include/nitro/types.h similarity index 100% rename from nitro/types.h rename to include/nitro/types.h diff --git a/src/FUN_02000DF4.c b/src/FUN_02000DF4.c index 0cc1c2dd9..0099480c5 100644 --- a/src/FUN_02000DF4.c +++ b/src/FUN_02000DF4.c @@ -1,12 +1,5 @@ -#include "nitro.h" - -struct Unk2106FA0 { - u8 filler0[0x8]; - s32 unk8; - s32 unkC; - s32 unk10; - s32 unk14; -}; +#include "global.h" +#include "main.h" extern struct Unk2106FA0 gBacklightTop; diff --git a/src/main.c b/src/main.c index d703331dd..bfd6c82e6 100644 --- a/src/main.c +++ b/src/main.c @@ -1,46 +1,5 @@ - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned long u32; -typedef signed char s8; -typedef signed short s16; -typedef signed long s32; - -struct Unk2106FA0 -{ - s32 unk0; - s32 unk4; - s32 unk8; - s32 unkC; - s32 unk10; - s32 unk14; - s32 unk18; - s32 unk1C; - s32 unk20; -}; - -struct Unk21C48B8 -{ - void (*unk0)(s32); - s32 unk4; - s32 unk8; - s32 unkC; - s32 unk10; - s32 unk14; - s32 unk18; - s32 unk1C; - s32 unk20; - s32 unk24; - s32 unk28; - s32 unk2C; - s32 unk30; - s32 unk34; - s32 unk38; - u8 filler3C[0xC]; - s32 unk48; - u8 filler4C[0x20]; - s32 unk6C; -}; +#include "global.h" +#include "main.h" extern struct Unk2106FA0 gBacklightTop; extern struct Unk2106FA0 gBacklightTop_2; // same as the first one, it's referenced twice in the constant pool... diff --git a/src/string_util.c b/src/string_util.c index 7d755cb92..8f9c96ff7 100644 --- a/src/string_util.c +++ b/src/string_util.c @@ -1,4 +1,4 @@ -#include "nitro.h" +#include "global.h" u16 gDigitTable[] = { 0xA2,