mirror of
https://github.com/zeldaret/st
synced 2026-06-17 15:16:49 -04:00
5e934a8c9b
* name func_01ffd3d8 and func_01ffd400 * name func_01ffd3b0 * match func_ov024_020cf9d4 + improve the Random struct * UnkStruct_027e0cf8_00_0C_024 45% * match PassengerManager::GetRandomIndex * UnkStruct_027e0cf8_00_0C_024 OK * UnkStruct_027e0cf8_00_0C_024: do other sections * UnkStruct_027e0cf8_08_024 55% * cleanup: remplace delete into null by the delete macro * UnkStruct_027e0cf8_08_024 OK * fix build issues * UnkStruct_ov024_020d86a0_024 OK * PlayerActor_A0_38_024 .text OK, CreditsEndingType OK * tools: create courselist.py to convert .CLB data to yaml * UnkDataStruct4_14 OK * UnkDataStruct4 17% * UnkDataStruct4 OK * MiscAdvManager OK * PassengerManager OK * fix build issues * ZeldaTrainBinary OK * mark PassengerManager as complete and adjust delinks * UnkStruct_027e0cf8_08_00_024 OK * document more of UnkStruct_027e0ce0 * savefile hotfixes * UnkStruct_027e0ce0_34_024 OK * code_020d46b4_024 OK * UnkStruct_027e0d00 & UnkStruct_027e0d00_20 OK * code_020d51dc_024 OK * fix weird formatting * UnkTrainSystem1 OK * fix jp broken match * UnkTrainSystem2 OK * UnkStruct_027e0d08_024 31% * fix build issues * UnkStruct_027e0d08 OK!!! * remove useless parenthesis * ActorUnk_ov000_020a8bb0_EC OK * move ActorUnk_ov000_020a8bb0_EC to MainGame/Actor/ * ActorUnkOBPC OK * add sjiswrap support * solve remaining gaps and fix build issues * reorganise files + counter docs * tools: remove format command execution from defaults
94 lines
2.7 KiB
C++
94 lines
2.7 KiB
C++
#ifndef GLOBAL_H
|
|
#define GLOBAL_H
|
|
|
|
// 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")
|
|
|
|
#define THUMB_BEGIN _Pragma("thumb on")
|
|
#define THUMB_END _Pragma("thumb off")
|
|
|
|
// `override` was added in C++11 before the DS, so we only use the keyword to indicate overriden functions
|
|
#define override
|
|
|
|
#pragma define_section dtcm ".dtcm" \
|
|
".dtcm"
|
|
// Puts variables in the DTCM module
|
|
#define DTCM_BEGIN _Pragma("section dtcm begin")
|
|
#define DTCM_END _Pragma("section dtcm end")
|
|
|
|
#pragma define_section sbss ".data" \
|
|
".sbss"
|
|
// Define .sbss variables
|
|
#define SBSS_BEGIN _Pragma("section sbss begin")
|
|
#define SBSS_END _Pragma("section sbss end")
|
|
|
|
#ifdef __MWERKS__
|
|
#define NO_INLINE __attribute__((never_inline))
|
|
#define AT_ADDRESS(xyz) : (xyz)
|
|
#define DECL_SECTION(x) __declspec(section x)
|
|
#define EXPORT __declspec(export)
|
|
#define WEAK __declspec(weak)
|
|
#define ASM asm
|
|
#else
|
|
#define AT_ADDRESS(xyz)
|
|
#define DECL_SECTION(x)
|
|
#define EXPORT
|
|
#define WEAK
|
|
#define ASM
|
|
#define NO_INLINE
|
|
#endif
|
|
|
|
#define STRUCT_PAD(from, to) unsigned char _pad_##from[(to) - (from)]
|
|
|
|
#define DF_CONCAT3_(a, b, c) a##b##c
|
|
#define DF_CONCAT3(a, b, c) DF_CONCAT3_(a, b, c)
|
|
#define DF_UNIQUE_IDENT(ident_) DF_CONCAT3(ident_, _, __LINE__)
|
|
|
|
// sometimes we need something in .bss
|
|
// to force things in .data to align properly
|
|
#define DATA_ALIGN_FIX() int DF_UNIQUE_IDENT(__data_align_fix)
|
|
|
|
#ifndef typeof
|
|
#define typeof __typeof__
|
|
#endif
|
|
#define DF_TYPEOF typeof
|
|
#define DF_FUNCTION_DECLARATOR_WITH_PROTO(ident_) \
|
|
extern void(ident_)(void); \
|
|
extern void(ident_)(void)
|
|
#define DF_FUNCTION_CALL(ident_, arg_) \
|
|
extern void(ident_)(DF_TYPEOF(arg_)); \
|
|
(ident_)(arg_)
|
|
|
|
// prevents the linker from deadstripping a symbol (can be anything)
|
|
#define DECOMP_FORCE(arg_) \
|
|
DF_FUNCTION_DECLARATOR_WITH_PROTO(DF_UNIQUE_IDENT(DECOMP_FORCE)) { \
|
|
DF_FUNCTION_CALL(DF_UNIQUE_IDENT(DECOMP_FORCE_CALL), arg_); \
|
|
}
|
|
|
|
#define SUBSCREEN_WIDTH 256
|
|
#define SUBSCREEN_HEIGHT 192
|
|
|
|
#define ALIGN_PREV(X, N) ((X) & ~((N) - 1))
|
|
#define ALIGN_NEXT(X, N) ALIGN_PREV(((X) + (N) - 1), N)
|
|
#define ALIGN(X, N) ((X + N) & ~N)
|
|
|
|
#define VTABLE_PAD(name) \
|
|
class _VTABLE_PAD_##name { \
|
|
public: \
|
|
virtual void dummy(); \
|
|
}; \
|
|
void _VTABLE_PAD_##name::dummy() {}
|
|
|
|
#define DELETE(ptr) \
|
|
{ \
|
|
delete ptr; \
|
|
ptr = NULL; \
|
|
} \
|
|
(void) 0
|
|
|
|
#endif
|