mirror of
https://github.com/pmret/papermario.git
synced 2024-11-09 12:32:38 +01:00
029de584b7
* fix INCLUDE_IMG and INCLUDE_PAL on modern GCC * use .pushsection/.popsection * use pushsection/popsection on modern compiler only * add gcc-mips-linux-gnu to debian deps * remove rogue ) * move -DMODERN_COMPILER to cflags_modern
43 lines
1.1 KiB
C
43 lines
1.1 KiB
C
#ifndef _H_INCLUDE_ASSET
|
|
|
|
#define ASTRINGIFY_(x) #x
|
|
#define ASTRINGIFY(x) ASTRINGIFY_(x)
|
|
|
|
#ifdef MODERN_COMPILER
|
|
# define PUSHSECTION(SECTION) ".pushsection " SECTION "\n"
|
|
# define POPSECTION ".popsection\n"
|
|
#else
|
|
# define PUSHSECTION(SECTION) SECTION "\n"
|
|
# define POPSECTION
|
|
#endif
|
|
|
|
#define _INCLUDE_IMG(FILENAME, SYMBOLNAME) \
|
|
extern unsigned char SYMBOLNAME[]; \
|
|
__asm__( \
|
|
".globl " #SYMBOLNAME"\n" \
|
|
PUSHSECTION(".data") \
|
|
".align 2\n" \
|
|
".type " #SYMBOLNAME", @object\n" \
|
|
#SYMBOLNAME":\n" \
|
|
".incbin \"ver/"ASTRINGIFY(VERSION)"/build/" FILENAME ".bin\"\n" \
|
|
POPSECTION \
|
|
)
|
|
|
|
// two macros are needed for N() usage
|
|
#define INCLUDE_IMG(FILENAME, SYMBOLNAME) \
|
|
_INCLUDE_IMG(FILENAME, SYMBOLNAME)
|
|
|
|
#define INCLUDE_PAL(FILENAME, SYMBOLNAME) \
|
|
extern unsigned short SYMBOLNAME[]; \
|
|
__asm__( \
|
|
".globl " #SYMBOLNAME"\n" \
|
|
PUSHSECTION(".data") \
|
|
".align 2\n" \
|
|
".type " #SYMBOLNAME", @object\n" \
|
|
#SYMBOLNAME":\n" \
|
|
".incbin \"ver/"ASTRINGIFY(VERSION)"/build/" FILENAME ".bin\"\n" \
|
|
POPSECTION \
|
|
)
|
|
|
|
#endif // _H_INCLUDE_ASSET
|