document some symbols and add global/types headers

This commit is contained in:
Yanis002
2025-02-14 03:34:31 +01:00
parent 9e05943d10
commit b14019290f
4 changed files with 67 additions and 4 deletions
+29
View File
@@ -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
+26
View File
@@ -0,0 +1,26 @@
#ifndef TYPES_H
#define TYPES_H
#include <stddef.h>
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