mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Update naked attribute and ASM_DIRECT to NAKED macro
This commit is contained in:
parent
4e2886db81
commit
23b050a99e
@ -11,10 +11,10 @@
|
||||
// to help in decompiling
|
||||
#define asm_comment(x) asm volatile("@ -- " x " -- ")
|
||||
#define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided")
|
||||
#define ASM_DIRECT __attribute__((naked))
|
||||
#define NAKED __attribute__((naked))
|
||||
|
||||
// IDE support
|
||||
#if defined (__APPLE__) || defined (__CYGWIN__)
|
||||
#if defined (__APPLE__) || defined (__CYGWIN__) || defined (_MSC_VER)
|
||||
#define _(x) x
|
||||
#define __(x) x
|
||||
#define INCBIN_U8 {0}
|
||||
@ -23,7 +23,7 @@
|
||||
#define INCBIN_S8 {0}
|
||||
#define INCBIN_S16 {0}
|
||||
#define INCBIN_S32 {0}
|
||||
#endif // __APPLE__
|
||||
#endif // IDE support
|
||||
|
||||
#define ARRAY_COUNT(array) (size_t)(sizeof(array) / sizeof((array)[0]))
|
||||
|
||||
|
@ -386,7 +386,7 @@ void sub_8159308(u8 taskId)
|
||||
DestroyAnimVisualTask(taskId);
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_8159308(u8 taskId)
|
||||
{
|
||||
asm_unified(" push {r4,r5,lr}\n\
|
||||
|
@ -648,7 +648,7 @@ static void sub_8072308(s16 arg0, u16 *arg1, u8 arg2)
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
static void sub_8072308(s16 arg0, u16 *arg1, u8 arg2)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
|
@ -3591,7 +3591,7 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void)
|
||||
gBattleMainFunc = BattleIntroRecordMonsToDex;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
static void BattleIntroOpponent1SendsOutMonAnimation(void)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
|
@ -3608,7 +3608,7 @@ static void atk24(void)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
static void atk24(void)
|
||||
{
|
||||
asm("\n\
|
||||
|
@ -812,7 +812,7 @@ void TryPutLinkBattleTvShowOnAir(void)
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void TryPutLinkBattleTvShowOnAir(void)
|
||||
{
|
||||
asm_unified(
|
||||
|
6
src/bg.c
6
src/bg.c
@ -463,7 +463,7 @@ bool8 IsDma3ManagerBusyWithBgCopy(void)
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
bool8 IsDma3ManagerBusyWithBgCopy(void)
|
||||
{
|
||||
asm("push {r4-r7,lr}\n\
|
||||
@ -1048,7 +1048,7 @@ void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8
|
||||
}
|
||||
}
|
||||
}*/
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2)
|
||||
{
|
||||
asm("push {r4-r7,lr}\n\
|
||||
@ -1495,7 +1495,7 @@ void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 pal
|
||||
*dest = test;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 palette2)
|
||||
{
|
||||
asm("push {r4-r6,lr}\n\
|
||||
|
@ -117,7 +117,7 @@ void Unused_LZDecompressWramIndirect(const void **src, void *dest)
|
||||
}
|
||||
|
||||
// This one (unused) function is really challenging, won't even try to decompile it.
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_803471C()
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
|
@ -566,7 +566,7 @@ u8 CreateMonSprite_PicBox(u16 species, s16 x, s16 y)
|
||||
return spriteId;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
u8 CreateMonSprite_PicBox(u16 species, s16 x, s16 y)
|
||||
{
|
||||
asm_unified("push {r4,r5,lr}\n\
|
||||
@ -669,7 +669,7 @@ void MultiplyPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b)
|
||||
gPlttBufferFaded[i] = RGB(curRed, curGreen, curBlue);
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void MultiplyInvertedPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b)
|
||||
{
|
||||
asm(".syntax unified\n"
|
||||
@ -744,7 +744,7 @@ void MultiplyInvertedPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b)
|
||||
".syntax divided");
|
||||
}
|
||||
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void MultiplyPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b)
|
||||
{
|
||||
asm(".syntax unified\n"
|
||||
@ -2684,7 +2684,7 @@ bool8 sub_80B8B38(struct Task *task)
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
bool8 sub_80B8B38(struct Task *task)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
@ -2997,7 +2997,7 @@ u8 sub_80B8F98(void)
|
||||
return spriteId;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
u8 sub_80B8F98(void)
|
||||
{
|
||||
asm_unified("push {r4-r7,lr}\n\
|
||||
|
@ -353,7 +353,7 @@ static u8 InitFieldObjectStateFromTemplate(struct MapObjectTemplate *template, u
|
||||
return slot;
|
||||
}
|
||||
#else
|
||||
static __attribute__((naked)) u8 InitFieldObjectStateFromTemplate(struct MapObjectTemplate *template, u8 mapId, u8 mapGroupId)
|
||||
static NAKED u8 InitFieldObjectStateFromTemplate(struct MapObjectTemplate *template, u8 mapId, u8 mapGroupId)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r9\n"
|
||||
|
@ -335,7 +335,7 @@ static void sub_81BED50(u8 taskId)
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
static void sub_81BED50(u8 taskId)
|
||||
{
|
||||
asm("\n\
|
||||
|
@ -234,7 +234,7 @@ bool8 CheckBagHasSpace(u16 itemId, u16 count)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
bool8 CheckBagHasSpace(u16 itemId, u16 count)
|
||||
{
|
||||
asm_unified("push {r4-r7,lr}\n\
|
||||
|
@ -2051,7 +2051,7 @@ u8 sub_800DD1C(u8 maxFlags)
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT u8 sub_800DD1C(u8 maxFlags)
|
||||
NAKED u8 sub_800DD1C(u8 maxFlags)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tlsls r0, 24\n"
|
||||
@ -2897,7 +2897,7 @@ void sub_800EFB0(void)
|
||||
CpuFill16(0, gRecvCmds, sizeof gRecvCmds);
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT void sub_800EFB0(void)
|
||||
NAKED void sub_800EFB0(void)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tsub sp, 0x4\n"
|
||||
@ -3233,7 +3233,7 @@ void sub_800F638(u8 unused, u32 flags)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT void sub_800F638(u8 unused, u32 flags)
|
||||
NAKED void sub_800F638(u8 unused, u32 flags)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r10\n"
|
||||
@ -3601,7 +3601,7 @@ void sub_800FD14(u16 command)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT void sub_800FD14(u16 command)
|
||||
NAKED void sub_800FD14(u16 command)
|
||||
{
|
||||
asm_unified("\tpush {r4,r5,lr}\n"
|
||||
"\tlsls r0, 16\n"
|
||||
@ -4699,7 +4699,7 @@ void sub_801120C(u8 a0)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT void sub_801120C(u8 a0)
|
||||
NAKED void sub_801120C(u8 a0)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r10\n"
|
||||
|
@ -276,7 +276,7 @@ static void sub_80D4A78(u8 bg, u8 x, u8 y, u8 deltaX, u8 deltaY, u8 unused)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
static void sub_80D4A78(u8 bg, u8 x, u8 y, u8 deltaX, u8 deltaY, u8 unused)
|
||||
{
|
||||
asm("\n\
|
||||
|
@ -980,7 +980,7 @@ static void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
|
||||
}
|
||||
}
|
||||
#else
|
||||
static ASM_DIRECT void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
|
||||
static NAKED void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r10\n"
|
||||
@ -1163,7 +1163,7 @@ const u8 *sub_81D1B40(u32 idx, u32 offset)
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT const u8 *sub_81D1B40(u32 idx, u32 offset)
|
||||
NAKED const u8 *sub_81D1B40(u32 idx, u32 offset)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r9\n"
|
||||
|
@ -2080,7 +2080,7 @@ void sub_819A080(struct UnkStruct_819A080 *a0, struct UnkStruct_819A080 *a1, u16
|
||||
}
|
||||
}
|
||||
#else
|
||||
__attribute__((naked))
|
||||
NAKED
|
||||
void sub_819A080(struct UnkStruct_819A080 *a0, struct UnkStruct_819A080 *a1, u16 a2, u16 a3, u16 a4, u16 a5, u16 a6, u16 a7)
|
||||
{
|
||||
asm("push {r4-r7,lr}\n\
|
||||
|
@ -1184,7 +1184,7 @@ static void sub_817F9F4(struct Sprite *sprite)
|
||||
}
|
||||
|
||||
#else
|
||||
__attribute__((naked))
|
||||
NAKED
|
||||
static void sub_817F9F4(struct Sprite *sprite)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
|
@ -1417,7 +1417,7 @@ void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId)
|
||||
*ppBonusesPtr = localPpBonuses;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
@ -1628,7 +1628,7 @@ void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId)
|
||||
*ppBonusesPtr = localPpBonuses;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
@ -2039,7 +2039,7 @@ void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d)
|
||||
Free(alloced);
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
@ -2341,7 +2341,7 @@ void sub_81C2194(u16 *a, u16 b, u8 c)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_81C2194(u16 *a, u16 b, u8 c)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
@ -3026,7 +3026,7 @@ void sub_81C335C()
|
||||
sub_81C25A4(r4, gText_FiveMarks, r5, 1, 0, 1);
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_81C335C()
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
@ -3369,7 +3369,7 @@ void sub_81C3B08(u8 a)
|
||||
sub_81C25A4(sp, text, offset, (a<<4), 0, r5);
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_81C3B08(u8 a)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
|
@ -475,7 +475,7 @@ u32 MoveRecordedBattleToSaveData(void)
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
u32 MoveRecordedBattleToSaveData(void)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
|
@ -925,7 +925,7 @@ static s32 RotatingGate_CanRotate(u8 gateId, s16 rotationDirection)
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
static s32 RotatingGate_CanRotate(u8 a, s16 rotationDirection)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
|
@ -375,7 +375,7 @@ void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
|
||||
*(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
|
||||
{
|
||||
asm("push {r4-r7,lr}\n\
|
||||
@ -871,7 +871,7 @@ void DecompressGlyphTile(const u16 *src, u16 *dest)
|
||||
*(dest) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] >> 8]];
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void DecompressGlyphTile(const u16 *src, u16 *dest)
|
||||
{
|
||||
asm("push {r4-r7,lr}\n\
|
||||
@ -1052,7 +1052,7 @@ u8 GetLastTextColor(u8 colorType)
|
||||
}
|
||||
}
|
||||
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void CopyGlyphToWindow(struct TextPrinter *x)
|
||||
{
|
||||
asm("push {r4-r7,lr}\n\
|
||||
@ -2341,7 +2341,7 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
__attribute__((naked))
|
||||
NAKED
|
||||
u16 RenderText(struct TextPrinter *textPrinter)
|
||||
{
|
||||
asm("push {r4-r6,lr}\n\
|
||||
|
2
src/tv.c
2
src/tv.c
@ -3931,7 +3931,7 @@ static void sub_80F0708(void) // FIXME: register allocation shenanigans
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT static void sub_80F0708(void)
|
||||
NAKED static void sub_80F0708(void)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r9\n"
|
||||
|
@ -230,7 +230,7 @@ void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output)
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output)
|
||||
NAKED void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output)
|
||||
{
|
||||
asm("\n\
|
||||
.syntax unified\n\
|
||||
|
Loading…
Reference in New Issue
Block a user