Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
dol2asm.h
Go to the documentation of this file.
1#ifndef DOL2ASM
2#define DOL2ASM
3
4// this helps remove useless error from the linter when using vscode.
5#ifdef __MWERKS__
6
7#ifdef __cplusplus
8#define SECTION_INIT extern "C" __declspec(section ".init")
9#define SECTION_RODATA __declspec(section ".rodata")
10#define SECTION_DATA __declspec(section ".data")
11#define SECTION_SDATA __declspec(section ".sdata")
12#define SECTION_SDATA2 __declspec(section ".sdata2")
13#define SECTION_BSS __declspec(section ".data")
14#define SECTION_SBSS __declspec(section ".sdata")
15#define SECTION_SBSS2 __declspec(section ".sdata2")
16#define SECTION_CTORS extern "C" __declspec(section ".ctors")
17#define SECTION_DTORS extern "C" __declspec(section ".dtors")
18#define SECTION_EXTAB extern "C" __declspec(section "extab_")
19#define SECTION_EXTABINDEX extern "C" __declspec(section "extabindex_")
20#define SECTION_DEAD extern "C" __declspec(section ".dead")
21#define SECTION_CTORS10 __declspec(section ".ctors$10")
22#define SECTION_CTORS15 __declspec(section ".ctors$15")
23#define SECTION_DTORS10 __declspec(section ".dtors$10")
24#define SECTION_DTORS15 __declspec(section ".dtors$15")
25#define COMPILER_STRIP_GATE(NAME, VALUE) SECTION_DEAD void* const cg_##NAME = (void*)(VALUE)
26#define REGISTER_CTORS(ADDR, FUNCTION) SECTION_CTORS void* const _ctors_##ADDR = (void*)(FUNCTION);
27#else
28#define SECTION_INIT __declspec(section ".init")
29#define SECTION_RODATA __declspec(section ".rodata")
30#define SECTION_DATA __declspec(section ".data")
31#define SECTION_SDATA __declspec(section ".sdata")
32#define SECTION_SDATA2 __declspec(section ".sdata2")
33#define SECTION_BSS __declspec(section ".data")
34#define SECTION_SBSS __declspec(section ".sdata")
35#define SECTION_SBSS2 __declspec(section ".sdata2")
36#define SECTION_CTORS __declspec(section ".ctors")
37#define SECTION_DTORS __declspec(section ".dtors")
38#define SECTION_EXTAB __declspec(section "extab_")
39#define SECTION_EXTABINDEX __declspec(section "extabindex_")
40#define SECTION_DEAD __declspec(section ".dead")
41#define SECTION_CTORS10 __declspec(section ".ctors$10")
42#define SECTION_CTORS15 __declspec(section ".ctors$15")
43#define SECTION_DTORS10 __declspec(section ".dtors$10")
44#define SECTION_DTORS15 __declspec(section ".dtors$15")
45#define COMPILER_STRIP_GATE(NAME, VALUE) SECTION_DEAD void* const cg_##NAME = (void*)(VALUE)
46#define REGISTER_CTORS(ADDR, FUNCTION) SECTION_CTORS void* const _ctors_##ADDR = (void*)(FUNCTION);
47#endif
48
49#else
50#define SECTION_INIT
51#define SECTION_RODATA
52#define SECTION_DATA
53#define SECTION_SDATA
54#define SECTION_SDATA2
55#define SECTION_BSS
56#define SECTION_SBSS
57#define SECTION_SBSS2
58#define SECTION_CTORS
59#define SECTION_DTORS
60#define SECTION_EXTAB
61#define SECTION_EXTABINDEX
62#define SECTION_DEAD
63#define SECTION_CTORS10
64#define SECTION_CTORS15
65#define SECTION_DTORS10
66#define SECTION_DTORS15
67#define COMPILER_STRIP_GATE(...)
68#define REGISTER_CTORS(...)
69
70// vscode doesn't like asm and nofralloc very much
71#define asm
72#define nofralloc
73#endif
74
75// floating-point constants
76// TODO: move to different header
77#define _HUGE_ENUF 1e+300
78#define INFINITY ((float)(_HUGE_ENUF * _HUGE_ENUF))
79#define HUGE_VAL ((double)INFINITY)
80#define HUGE_VALL ((long double)INFINITY)
81
82#define DOUBLE_INF HUGE_VAL
83
84#pragma section ".dead"
85#pragma section ".ctors$10"
86#pragma section ".ctors$15"
87#pragma section ".dtors$10"
88#pragma section ".dtors$15"
89
90#endif /* DOL2ASM */