papermario/include/include_asset.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

56 lines
1.5 KiB
C
Raw Normal View History

#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") \
2024-09-12 19:00:57 +02:00
".align 3\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") \
2024-09-12 19:00:57 +02:00
".align 3\n" \
".type " #SYMBOLNAME", @object\n" \
#SYMBOLNAME":\n" \
".incbin \"ver/"ASTRINGIFY(VERSION)"/build/" FILENAME ".bin\"\n" \
POPSECTION \
)
2024-09-12 19:00:57 +02:00
#define INCLUDE_RAW(FILENAME, SYMBOLNAME) \
extern unsigned char SYMBOLNAME[]; \
__asm__( \
".globl " #SYMBOLNAME"\n" \
PUSHSECTION(".data") \
".align 3\n" \
".type " #SYMBOLNAME", @object\n" \
#SYMBOLNAME":\n" \
".incbin \"ver/"ASTRINGIFY(VERSION)"/build/assets/"ASTRINGIFY(VERSION)"/" FILENAME "\"\n" \
POPSECTION \
)
#endif // _H_INCLUDE_ASSET