From 7fdebe0d15754d315386a5bb308d5b7a2eaf648f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 10 May 2018 17:54:30 -0400 Subject: [PATCH] through sub_80DAE0C --- asm/contest.s | 254 ----------------------- include/global.h | 2 +- include/script_pokemon_util_80F87D8.h | 7 + src/battle_anim_sound_tasks.c | 2 +- src/battle_interface.c | 2 +- src/battle_main.c | 2 +- src/battle_script_commands.c | 2 +- src/battle_tv.c | 2 +- src/bg.c | 6 +- src/contest.c | 280 +++++++++++++++++++++++++- src/decompress.c | 2 +- src/fossil_specials.c | 2 +- src/item.c | 2 +- src/link_rfu.c | 10 +- src/map_name_popup.c | 2 +- src/match_call.c | 4 +- src/pokemon_summary_screen.c | 12 +- src/recorded_battle.c | 2 +- src/rotating_gate.c | 2 +- src/text.c | 6 +- src/tv.c | 2 +- src/util.c | 2 +- 22 files changed, 315 insertions(+), 292 deletions(-) create mode 100644 include/script_pokemon_util_80F87D8.h diff --git a/asm/contest.s b/asm/contest.s index 2b19b9b662..1d2388e53e 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -5,260 +5,6 @@ .text - thumb_func_start sub_80DACBC -sub_80DACBC: @ 80DACBC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x64 - mov r8, r2 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r2, r1, 24 - movs r7, 0 - ldr r0, =gUnknown_02039F30 - ldrb r1, [r0] - mov r9, r0 - cmp r1, 0x4 - bne _080DACDE - b _080DADF6 -_080DACDE: - movs r5, 0 - ldr r3, =gContestOpponents - ldr r6, =gUnknown_085898A4 -_080DACE4: - ldrb r0, [r3, 0x1C] - lsls r0, 30 - lsrs r0, 30 - cmp r2, r0 - bne _080DAD56 - mov r0, r8 - cmp r0, 0x1 - bne _080DAD08 - ldrb r0, [r6] - cmp r0, 0x1 - beq _080DAD56 - b _080DAD0E - .pool -_080DAD08: - ldrb r0, [r6] - cmp r0, 0x2 - beq _080DAD56 -_080DAD0E: - cmp r4, 0 - bne _080DAD1A - ldrb r0, [r3, 0x1C] - lsls r0, 29 - cmp r0, 0 - blt _080DAD4A -_080DAD1A: - cmp r4, 0x1 - bne _080DAD26 - ldrb r0, [r3, 0x1C] - lsls r0, 28 - cmp r0, 0 - blt _080DAD4A -_080DAD26: - cmp r4, 0x2 - bne _080DAD32 - ldrb r0, [r3, 0x1C] - lsls r0, 27 - cmp r0, 0 - blt _080DAD4A -_080DAD32: - cmp r4, 0x3 - bne _080DAD3E - ldrb r0, [r3, 0x1C] - lsls r0, 26 - cmp r0, 0 - blt _080DAD4A -_080DAD3E: - cmp r4, 0x4 - bne _080DAD56 - ldrb r0, [r3, 0x1C] - lsls r0, 25 - cmp r0, 0 - bge _080DAD56 -_080DAD4A: - adds r0, r7, 0 - adds r1, r0, 0x1 - lsls r1, 24 - lsrs r7, r1, 24 - add r0, sp - strb r5, [r0] -_080DAD56: - adds r3, 0x40 - adds r6, 0x1 - adds r5, 0x1 - cmp r5, 0x5F - bls _080DACE4 - mov r3, sp - adds r1, r3, r7 - movs r0, 0xFF - strb r0, [r1] - movs r5, 0 - mov r0, r9 - ldrb r1, [r0] - movs r0, 0x4 - subs r0, r1 - cmp r5, r0 - bge _080DADF6 - ldr r3, =gContestMons - mov r8, r3 - mov r6, r9 - movs r0, 0x2 - add r0, r8 - mov r9, r0 -_080DAD82: - bl sub_80F903C - lsls r0, 16 - lsrs r0, 16 - adds r1, r7, 0 - bl __modsi3 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - ldrb r0, [r6] - adds r0, r5 - lsls r0, 6 - add r0, r8 - ldr r2, =gContestOpponents - mov r3, sp - adds r4, r3, r1 - ldrb r1, [r4] - lsls r1, 6 - adds r1, r2 - movs r2, 0x40 - bl memcpy - ldrb r0, [r6] - adds r0, r5 - lsls r0, 6 - mov r1, r8 - adds r1, 0xD - adds r0, r1 - bl sub_80DF9D4 - ldrb r0, [r6] - adds r0, r5 - lsls r0, 6 - add r0, r9 - movs r1, 0x2 - bl sub_80DF9E0 - ldrb r0, [r4] - adds r3, r5, 0x1 - subs r1, r7, 0x1 - cmp r0, 0xFF - beq _080DADE6 - adds r2, r4, 0 -_080DADDA: - ldrb r0, [r2, 0x1] - strb r0, [r2] - adds r2, 0x1 - ldrb r0, [r2] - cmp r0, 0xFF - bne _080DADDA -_080DADE6: - lsls r0, r1, 24 - lsrs r7, r0, 24 - adds r5, r3, 0 - ldrb r1, [r6] - movs r0, 0x4 - subs r0, r1 - cmp r5, r0 - blt _080DAD82 -_080DADF6: - add sp, 0x64 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DACBC - - thumb_func_start sub_80DAE0C -sub_80DAE0C: @ 80DAE0C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - beq _080DAE1E - movs r0, 0x3 - b _080DAE9A -_080DAE1E: - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - bne _080DAE2E - movs r0, 0x4 - b _080DAE9A -_080DAE2E: - ldr r0, =gSpecialVar_ContestCategory - ldrh r0, [r0] - cmp r0, 0x4 - bhi _080DAE82 - lsls r0, 2 - ldr r1, =_080DAE48 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080DAE48: - .4byte _080DAE5C - .4byte _080DAE62 - .4byte _080DAE68 - .4byte _080DAE6E - .4byte _080DAE74 -_080DAE5C: - adds r0, r4, 0 - movs r1, 0x32 - b _080DAE78 -_080DAE62: - adds r0, r4, 0 - movs r1, 0x33 - b _080DAE78 -_080DAE68: - adds r0, r4, 0 - movs r1, 0x34 - b _080DAE78 -_080DAE6E: - adds r0, r4, 0 - movs r1, 0x35 - b _080DAE78 -_080DAE74: - adds r0, r4, 0 - movs r1, 0x36 -_080DAE78: - bl GetMonData - lsls r0, 24 - lsrs r1, r0, 24 - b _080DAE86 -_080DAE82: - movs r0, 0 - b _080DAE9A -_080DAE86: - ldr r0, =gSpecialVar_ContestRank - adds r2, r1, 0 - ldrh r1, [r0] - movs r0, 0x2 - cmp r2, r1 - bhi _080DAE9A - movs r0, 0 - cmp r2, r1 - bcc _080DAE9A - movs r0, 0x1 -_080DAE9A: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DAE0C - thumb_func_start sub_80DAEA4 sub_80DAEA4: @ 80DAEA4 push {r4,r5,lr} diff --git a/include/global.h b/include/global.h index ec636bb074..b73baf2ce4 100644 --- a/include/global.h +++ b/include/global.h @@ -11,7 +11,7 @@ // 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__) diff --git a/include/script_pokemon_util_80F87D8.h b/include/script_pokemon_util_80F87D8.h new file mode 100644 index 0000000000..555b3428b7 --- /dev/null +++ b/include/script_pokemon_util_80F87D8.h @@ -0,0 +1,7 @@ + +#ifndef GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H +#define GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H + +u16 sub_80F903C(void); + +#endif // GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H diff --git a/src/battle_anim_sound_tasks.c b/src/battle_anim_sound_tasks.c index e956fd44f6..2316b97590 100644 --- a/src/battle_anim_sound_tasks.c +++ b/src/battle_anim_sound_tasks.c @@ -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\ diff --git a/src/battle_interface.c b/src/battle_interface.c index 0a8bf3ed7e..9ef45020df 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -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\ diff --git a/src/battle_main.c b/src/battle_main.c index 70eebed854..55845f2d11 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3591,7 +3591,7 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void) gBattleMainFunc = BattleIntroRecordMonsToDex; } #else -ASM_DIRECT +NAKED static void BattleIntroOpponent1SendsOutMonAnimation(void) { asm(".syntax unified\n\ diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d1a18e38f0..7552d48724 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3608,7 +3608,7 @@ static void atk24(void) } } #else -ASM_DIRECT +NAKED static void atk24(void) { asm("\n\ diff --git a/src/battle_tv.c b/src/battle_tv.c index 777b4846ff..e5d97be304 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -812,7 +812,7 @@ void TryPutLinkBattleTvShowOnAir(void) } #else -ASM_DIRECT +NAKED void TryPutLinkBattleTvShowOnAir(void) { asm_unified( diff --git a/src/bg.c b/src/bg.c index 975c72a942..2f4cdc8564 100644 --- a/src/bg.c +++ b/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\ diff --git a/src/contest.c b/src/contest.c index bd9fc04032..82547e4284 100644 --- a/src/contest.c +++ b/src/contest.c @@ -39,6 +39,7 @@ #include "strings.h" #include "contest_effect.h" #include "contest_link_80FC4F4.h" +#include "script_pokemon_util_80F87D8.h" #define DESTROY_POINTER(ptr) \ free(ptr); \ @@ -2087,15 +2088,15 @@ void sub_80DAB8C(u8 contestType, u8 rank) if (r3[i] == 2) continue; } - if (contestType == 0 && gContestOpponents[i].aiPool_Cool) + if (contestType == CONTEST_CATEGORY_COOL && gContestOpponents[i].aiPool_Cool) opponents[opponentsCount++] = i; - else if (contestType == 1 && gContestOpponents[i].aiPool_Beauty) + else if (contestType == CONTEST_CATEGORY_BEAUTY && gContestOpponents[i].aiPool_Beauty) opponents[opponentsCount++] = i; - else if (contestType == 2 && gContestOpponents[i].aiPool_Cute) + else if (contestType == CONTEST_CATEGORY_CUTE && gContestOpponents[i].aiPool_Cute) opponents[opponentsCount++] = i; - else if (contestType == 3 && gContestOpponents[i].aiPool_Smart) + else if (contestType == CONTEST_CATEGORY_SMART && gContestOpponents[i].aiPool_Smart) opponents[opponentsCount++] = i; - else if (contestType == 4 && gContestOpponents[i].aiPool_Tough) + else if (contestType == CONTEST_CATEGORY_TOUGH && gContestOpponents[i].aiPool_Tough) opponents[opponentsCount++] = i; } } @@ -2115,3 +2116,272 @@ void sub_80DAB8C(u8 contestType, u8 rank) sub_80DA8C8(gUnknown_02039F24); } + +#ifdef NONMATCHING +void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame) +{ + s32 i; + u8 opponentsCount = 0; + u8 opponents[100]; + const u8 * r6; + + if (gUnknown_02039F30 == 4) + return; + + r6 = gUnknown_085898A4; + for (i = 0; i < ARRAY_COUNT(gContestOpponents); i++) + { + if (rank != gContestOpponents[i].whichRank) + continue; + if (isPostgame == TRUE) + { + if (r6[i] == 1) + continue; + } + else + { + if (r6[i] == 2) + continue; + } + if (contestType == CONTEST_CATEGORY_COOL && gContestOpponents[i].aiPool_Cool) + opponents[opponentsCount++] = i; + else if (contestType == CONTEST_CATEGORY_BEAUTY && gContestOpponents[i].aiPool_Beauty) + opponents[opponentsCount++] = i; + else if (contestType == CONTEST_CATEGORY_CUTE && gContestOpponents[i].aiPool_Cute) + opponents[opponentsCount++] = i; + else if (contestType == CONTEST_CATEGORY_SMART && gContestOpponents[i].aiPool_Smart) + opponents[opponentsCount++] = i; + else if (contestType == CONTEST_CATEGORY_TOUGH && gContestOpponents[i].aiPool_Tough) + opponents[opponentsCount++] = i; + } + opponents[opponentsCount] = 0xFF; + for (i = 0; i < 4 - gUnknown_02039F30; i++) + { + u16 rnd = sub_80F903C() % opponentsCount; + s32 j; + + gContestMons[gUnknown_02039F30 + i] = gContestOpponents[opponents[rnd]]; + sub_80DF9D4(gContestMons[gUnknown_02039F30 + i].trainerName); + sub_80DF9E0(gContestMons[gUnknown_02039F30 + i].nickname, GAME_LANGUAGE); + for (j = rnd; opponents[j] != 0xFF; j++) + opponents[j] = opponents[j + 1]; + opponentsCount--; + } +} +#else +NAKED void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame) +{ + asm_unified("\tpush {r4-r7,lr}\n" + "\tmov r7, r9\n" + "\tmov r6, r8\n" + "\tpush {r6,r7}\n" + "\tsub sp, 0x64\n" + "\tmov r8, r2\n" + "\tlsls r0, 24\n" + "\tlsrs r4, r0, 24\n" + "\tlsls r1, 24\n" + "\tlsrs r2, r1, 24\n" + "\tmovs r7, 0\n" + "\tldr r0, =gUnknown_02039F30\n" + "\tldrb r1, [r0]\n" + "\tmov r9, r0\n" + "\tcmp r1, 0x4\n" + "\tbne _080DACDE\n" + "\tb _080DADF6\n" + "_080DACDE:\n" + "\tmovs r5, 0\n" + "\tldr r3, =gContestOpponents\n" + "\tldr r6, =gUnknown_085898A4\n" + "_080DACE4:\n" + "\tldrb r0, [r3, 0x1C]\n" + "\tlsls r0, 30\n" + "\tlsrs r0, 30\n" + "\tcmp r2, r0\n" + "\tbne _080DAD56\n" + "\tmov r0, r8\n" + "\tcmp r0, 0x1\n" + "\tbne _080DAD08\n" + "\tldrb r0, [r6]\n" + "\tcmp r0, 0x1\n" + "\tbeq _080DAD56\n" + "\tb _080DAD0E\n" + "\t.pool\n" + "_080DAD08:\n" + "\tldrb r0, [r6]\n" + "\tcmp r0, 0x2\n" + "\tbeq _080DAD56\n" + "_080DAD0E:\n" + "\tcmp r4, 0\n" + "\tbne _080DAD1A\n" + "\tldrb r0, [r3, 0x1C]\n" + "\tlsls r0, 29\n" + "\tcmp r0, 0\n" + "\tblt _080DAD4A\n" + "_080DAD1A:\n" + "\tcmp r4, 0x1\n" + "\tbne _080DAD26\n" + "\tldrb r0, [r3, 0x1C]\n" + "\tlsls r0, 28\n" + "\tcmp r0, 0\n" + "\tblt _080DAD4A\n" + "_080DAD26:\n" + "\tcmp r4, 0x2\n" + "\tbne _080DAD32\n" + "\tldrb r0, [r3, 0x1C]\n" + "\tlsls r0, 27\n" + "\tcmp r0, 0\n" + "\tblt _080DAD4A\n" + "_080DAD32:\n" + "\tcmp r4, 0x3\n" + "\tbne _080DAD3E\n" + "\tldrb r0, [r3, 0x1C]\n" + "\tlsls r0, 26\n" + "\tcmp r0, 0\n" + "\tblt _080DAD4A\n" + "_080DAD3E:\n" + "\tcmp r4, 0x4\n" + "\tbne _080DAD56\n" + "\tldrb r0, [r3, 0x1C]\n" + "\tlsls r0, 25\n" + "\tcmp r0, 0\n" + "\tbge _080DAD56\n" + "_080DAD4A:\n" + "\tadds r0, r7, 0\n" + "\tadds r1, r0, 0x1\n" + "\tlsls r1, 24\n" + "\tlsrs r7, r1, 24\n" + "\tadd r0, sp\n" + "\tstrb r5, [r0]\n" + "_080DAD56:\n" + "\tadds r3, 0x40\n" + "\tadds r6, 0x1\n" + "\tadds r5, 0x1\n" + "\tcmp r5, 0x5F\n" + "\tbls _080DACE4\n" + "\tmov r3, sp\n" + "\tadds r1, r3, r7\n" + "\tmovs r0, 0xFF\n" + "\tstrb r0, [r1]\n" + "\tmovs r5, 0\n" + "\tmov r0, r9\n" + "\tldrb r1, [r0]\n" + "\tmovs r0, 0x4\n" + "\tsubs r0, r1\n" + "\tcmp r5, r0\n" + "\tbge _080DADF6\n" + "\tldr r3, =gContestMons\n" + "\tmov r8, r3\n" + "\tmov r6, r9\n" + "\tmovs r0, 0x2\n" + "\tadd r0, r8\n" + "\tmov r9, r0\n" + "_080DAD82:\n" + "\tbl sub_80F903C\n" + "\tlsls r0, 16\n" + "\tlsrs r0, 16\n" + "\tadds r1, r7, 0\n" + "\tbl __modsi3\n" + "\tadds r1, r0, 0\n" + "\tlsls r1, 16\n" + "\tlsrs r1, 16\n" + "\tldrb r0, [r6]\n" + "\tadds r0, r5\n" + "\tlsls r0, 6\n" + "\tadd r0, r8\n" + "\tldr r2, =gContestOpponents\n" + "\tmov r3, sp\n" + "\tadds r4, r3, r1\n" + "\tldrb r1, [r4]\n" + "\tlsls r1, 6\n" + "\tadds r1, r2\n" + "\tmovs r2, 0x40\n" + "\tbl memcpy\n" + "\tldrb r0, [r6]\n" + "\tadds r0, r5\n" + "\tlsls r0, 6\n" + "\tmov r1, r8\n" + "\tadds r1, 0xD\n" + "\tadds r0, r1\n" + "\tbl sub_80DF9D4\n" + "\tldrb r0, [r6]\n" + "\tadds r0, r5\n" + "\tlsls r0, 6\n" + "\tadd r0, r9\n" + "\tmovs r1, 0x2\n" + "\tbl sub_80DF9E0\n" + "\tldrb r0, [r4]\n" + "\tadds r3, r5, 0x1\n" + "\tsubs r1, r7, 0x1\n" + "\tcmp r0, 0xFF\n" + "\tbeq _080DADE6\n" + "\tadds r2, r4, 0\n" + "_080DADDA:\n" + "\tldrb r0, [r2, 0x1]\n" + "\tstrb r0, [r2]\n" + "\tadds r2, 0x1\n" + "\tldrb r0, [r2]\n" + "\tcmp r0, 0xFF\n" + "\tbne _080DADDA\n" + "_080DADE6:\n" + "\tlsls r0, r1, 24\n" + "\tlsrs r7, r0, 24\n" + "\tadds r5, r3, 0\n" + "\tldrb r1, [r6]\n" + "\tmovs r0, 0x4\n" + "\tsubs r0, r1\n" + "\tcmp r5, r0\n" + "\tblt _080DAD82\n" + "_080DADF6:\n" + "\tadd sp, 0x64\n" + "\tpop {r3,r4}\n" + "\tmov r8, r3\n" + "\tmov r9, r4\n" + "\tpop {r4-r7}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.pool"); +} +#endif + +// GetContestAvailability? +u8 sub_80DAE0C(struct Pokemon *pkmn) +{ + u8 ribbon; + u8 retVal; + + if (GetMonData(pkmn, MON_DATA_IS_EGG)) + return 3; + if (GetMonData(pkmn, MON_DATA_HP) == 0) + return 4; + switch (gSpecialVar_ContestCategory) + { + case CONTEST_CATEGORY_COOL: + ribbon = GetMonData(pkmn, MON_DATA_COOL_RIBBON); + break; + case CONTEST_CATEGORY_BEAUTY: + ribbon = GetMonData(pkmn, MON_DATA_BEAUTY_RIBBON); + break; + case CONTEST_CATEGORY_CUTE: + ribbon = GetMonData(pkmn, MON_DATA_CUTE_RIBBON); + break; + case CONTEST_CATEGORY_SMART: + ribbon = GetMonData(pkmn, MON_DATA_SMART_RIBBON); + break; + case CONTEST_CATEGORY_TOUGH: + ribbon = GetMonData(pkmn, MON_DATA_TOUGH_RIBBON); + break; + default: + return 0; + } + + // Couldn't get this to match any other way. + // Returns 2, 1, or 0 respectively if ribbon's rank is above, equal, or below + // the current contest rank. + if (ribbon > gSpecialVar_ContestRank) + retVal = 2; + else if (ribbon >= gSpecialVar_ContestRank) + retVal = 1; + else + retVal = 0; + return retVal; +} diff --git a/src/decompress.c b/src/decompress.c index fb288bf4a4..1d4165d753 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -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\ diff --git a/src/fossil_specials.c b/src/fossil_specials.c index 95fafc17bf..060915fa64 100644 --- a/src/fossil_specials.c +++ b/src/fossil_specials.c @@ -335,7 +335,7 @@ static void sub_81BED50(u8 taskId) } #else -ASM_DIRECT +NAKED static void sub_81BED50(u8 taskId) { asm("\n\ diff --git a/src/item.c b/src/item.c index 975fef3aea..319d167fc7 100644 --- a/src/item.c +++ b/src/item.c @@ -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\ diff --git a/src/link_rfu.c b/src/link_rfu.c index a1917ed244..37aa20950b 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -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" diff --git a/src/map_name_popup.c b/src/map_name_popup.c index 59b1622ebf..1782e9af82 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -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\ diff --git a/src/match_call.c b/src/match_call.c index 9c1e02947d..aa6945161a 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -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" diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index f77b7c38c9..bf3e9aeee3 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -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\ diff --git a/src/recorded_battle.c b/src/recorded_battle.c index 4cb2eab497..eb48ab15a3 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -475,7 +475,7 @@ u32 MoveRecordedBattleToSaveData(void) } #else -ASM_DIRECT +NAKED u32 MoveRecordedBattleToSaveData(void) { asm(".syntax unified\n\ diff --git a/src/rotating_gate.c b/src/rotating_gate.c index db5935fc30..a16401fa23 100644 --- a/src/rotating_gate.c +++ b/src/rotating_gate.c @@ -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\ diff --git a/src/text.c b/src/text.c index eacfd2a1f9..a902844e8d 100644 --- a/src/text.c +++ b/src/text.c @@ -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\ diff --git a/src/tv.c b/src/tv.c index 4b6e682bd1..13d522f107 100644 --- a/src/tv.c +++ b/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" diff --git a/src/util.c b/src/util.c index 4f9241b212..88be4e4a13 100644 --- a/src/util.c +++ b/src/util.c @@ -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\