From b14019290f85cdd3c79d47de86da27f87de51f84 Mon Sep 17 00:00:00 2001 From: Yanis002 <35189056+Yanis002@users.noreply.github.com> Date: Fri, 14 Feb 2025 03:34:31 +0100 Subject: [PATCH] document some symbols and add global/types headers --- config/eur/arm9/symbols.txt | 8 ++++---- include/global.h | 29 +++++++++++++++++++++++++++++ include/types.h | 26 ++++++++++++++++++++++++++ libs/c/include/stddef.h | 8 ++++++++ 4 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 include/global.h create mode 100644 include/types.h create mode 100644 libs/c/include/stddef.h diff --git a/config/eur/arm9/symbols.txt b/config/eur/arm9/symbols.txt index 84598fa0..f846e5dc 100644 --- a/config/eur/arm9/symbols.txt +++ b/config/eur/arm9/symbols.txt @@ -615,7 +615,7 @@ func_0201233c kind:function(arm,size=0x120) addr:0x0201233c func_0201245c kind:function(thumb,size=0x10) addr:0x0201245c func_0201246c kind:function(thumb,size=0x54) addr:0x0201246c func_020124c0 kind:function(thumb,size=0x30) addr:0x020124c0 -func_020124f0 kind:function(thumb,size=0xb4) addr:0x020124f0 +DisplayAssertError kind:function(thumb,size=0xb4) addr:0x020124f0 func_020125a4 kind:function(thumb,size=0x24) addr:0x020125a4 func_020125c8 kind:function(thumb,size=0xc) addr:0x020125c8 func_020125d4 kind:function(thumb,size=0x21c) addr:0x020125d4 @@ -1028,8 +1028,8 @@ func_0201b180 kind:function(arm,size=0xf8) addr:0x0201b180 func_0201b278 kind:function(arm,size=0x6c) addr:0x0201b278 func_0201b2e4 kind:function(arm,size=0x38) addr:0x0201b2e4 func_0201b31c kind:function(arm,size=0xe8) addr:0x0201b31c -func_0201b404 kind:function(arm,size=0x14c) addr:0x0201b404 -func_0201b550 kind:function(arm,size=0x78) addr:0x0201b550 +DisplayDebugText kind:function(arm,size=0x14c) addr:0x0201b404 +DisplayDebugTextF kind:function(arm,size=0x78) addr:0x0201b550 func_0201b5c8 kind:function(arm,size=0x15c) addr:0x0201b5c8 func_0201b724 kind:function(arm,size=0x8c) addr:0x0201b724 func_0201b7b0 kind:function(arm,size=0x1b4) addr:0x0201b7b0 @@ -2806,7 +2806,7 @@ data_02050558 kind:bss addr:0x02050558 data_0205055c kind:bss addr:0x0205055c data_02050564 kind:bss addr:0x02050564 data_0205056c kind:bss addr:0x0205056c -data_02050574 kind:bss addr:0x02050574 +gArchiveList kind:bss addr:0x02050574 data_020505d0 kind:bss addr:0x020505d0 data_020505ec kind:bss addr:0x020505ec data_0205060c kind:bss addr:0x0205060c diff --git a/include/global.h b/include/global.h new file mode 100644 index 00000000..dbb0a86f --- /dev/null +++ b/include/global.h @@ -0,0 +1,29 @@ +#ifndef GLOBAL_H +#define GLOBAL_H + +#define GET_FLAG(arr, pos) (((1 << ((pos) & 0x1f)) & (arr)[((u32)(pos)) >> 5]) != 0) +#define SET_FLAG(arr, pos) ((arr)[((u32)(pos)) >> 5] |= 1 << ((pos) & 0x1f)) +#define RESET_FLAG(arr, pos) ((arr)[((u32)(pos)) >> 5] &= ~(1 << ((pos) & 0x1f))) + +#define ARRAY_LEN_U(arr) (u32)((sizeof(arr) / sizeof(*arr))) +#define ARRAY_LEN(arr) (s32)((sizeof(arr) / sizeof(*arr))) + +// Prevent the IDE from reporting errors that the compiler/linker won't report +#ifdef __INTELLISENSE__ +#endif + +#define ARM _Pragma("thumb off") +#define THUMB _Pragma("thumb on") + +// `override` was added in C++11 before the DS, so we only use the keyword to indicate overriden functions +#define override + +// Define .sbss variables by using #pragma section sbss begin|end +#pragma define_section sbss ".data" \ + ".sbss" + +// Force variables to be in .data by using #pragma section force_data begin|end +#pragma define_section force_data ".data" \ + ".data" + +#endif diff --git a/include/types.h b/include/types.h new file mode 100644 index 00000000..b71cde21 --- /dev/null +++ b/include/types.h @@ -0,0 +1,26 @@ +#ifndef TYPES_H +#define TYPES_H + +#include + +typedef unsigned long long u64; +typedef unsigned int u32; +typedef unsigned short u16; +typedef unsigned char u8; + +typedef long long s64; +typedef int s32; +typedef short s16; +typedef char s8; + +typedef s8 unk8; +typedef s16 unk16; +typedef s32 unk32; + +#ifndef __cplusplus +typedef s32 bool; +#endif + +#define CEIL_DIV(a, b) (((a) + (b) - 1) / (b)) + +#endif diff --git a/libs/c/include/stddef.h b/libs/c/include/stddef.h new file mode 100644 index 00000000..4986043a --- /dev/null +++ b/libs/c/include/stddef.h @@ -0,0 +1,8 @@ +#ifndef _C_STDDEF_H +#define _C_STDDEF_H + +#define NULL 0 + +typedef unsigned int size_t; + +#endif