Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
include_asset.h
Go to the documentation of this file.
1#ifndef _H_INCLUDE_ASSET
2
3#define ASTRINGIFY_(x) #x
4#define ASTRINGIFY(x) ASTRINGIFY_(x)
5
6#ifdef MODERN_COMPILER
7# define PUSHSECTION(SECTION) ".pushsection " SECTION "\n"
8# define POPSECTION ".popsection\n"
9#else
10# define PUSHSECTION(SECTION) SECTION "\n"
11# define POPSECTION
12#endif
13
14#define _INCLUDE_IMG(FILENAME, SYMBOLNAME) \
15 extern unsigned char SYMBOLNAME[]; \
16 __asm__( \
17 ".globl " #SYMBOLNAME"\n" \
18 PUSHSECTION(".data") \
19 ".align 3\n" \
20 ".type " #SYMBOLNAME", @object\n" \
21 #SYMBOLNAME":\n" \
22 ".incbin \"ver/"ASTRINGIFY(VERSION)"/build/" FILENAME ".bin\"\n" \
23 POPSECTION \
24 )
25
26// two macros are needed for N() usage
27#define INCLUDE_IMG(FILENAME, SYMBOLNAME) \
28 _INCLUDE_IMG(FILENAME, SYMBOLNAME)
29
30#define INCLUDE_PAL(FILENAME, SYMBOLNAME) \
31 extern unsigned short SYMBOLNAME[]; \
32 __asm__( \
33 ".globl " #SYMBOLNAME"\n" \
34 PUSHSECTION(".data") \
35 ".align 3\n" \
36 ".type " #SYMBOLNAME", @object\n" \
37 #SYMBOLNAME":\n" \
38 ".incbin \"ver/"ASTRINGIFY(VERSION)"/build/" FILENAME ".bin\"\n" \
39 POPSECTION \
40 )
41
42#define INCLUDE_RAW(FILENAME, SYMBOLNAME) \
43 extern unsigned char SYMBOLNAME[]; \
44 __asm__( \
45 ".globl " #SYMBOLNAME"\n" \
46 PUSHSECTION(".data") \
47 ".align 3\n" \
48 ".type " #SYMBOLNAME", @object\n" \
49 #SYMBOLNAME":\n" \
50 ".incbin \"ver/"ASTRINGIFY(VERSION)"/build/assets/"ASTRINGIFY(VERSION)"/" FILENAME "\"\n" \
51 POPSECTION \
52 )
53
54
55#endif // _H_INCLUDE_ASSET