nonmatching sub_801120C

This commit is contained in:
PikalaxALT 2018-01-21 18:25:23 -05:00
parent 772f0aa3fd
commit d35cf06854
23 changed files with 413 additions and 322 deletions

View File

@ -5,247 +5,6 @@
.text .text
thumb_func_start sub_801120C
sub_801120C: @ 801120C
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
lsls r0, 24
lsrs r4, r0, 24
movs r6, 0
cmp r4, 0x32
bne _08011222
b _08011360
_08011222:
cmp r4, 0x32
bgt _08011252
cmp r4, 0x13
bgt _08011240
cmp r4, 0x12
blt _08011230
b _080113EE
_08011230:
cmp r4, 0x10
bne _08011236
b _080113EE
_08011236:
cmp r4, 0x10
bgt _0801128C
cmp r4, 0
beq _0801127E
b _080113EE
_08011240:
cmp r4, 0x30
bne _08011246
b _0801136C
_08011246:
cmp r4, 0x30
ble _0801124C
b _08011354
_0801124C:
cmp r4, 0x14
beq _08011328
b _080113EE
_08011252:
cmp r4, 0x44
bgt _08011264
cmp r4, 0x42
blt _0801125C
b _080113EE
_0801125C:
cmp r4, 0x33
bne _08011262
b _0801136C
_08011262:
b _080113EE
_08011264:
cmp r4, 0xF3
bne _0801126A
b _080113BA
_0801126A:
cmp r4, 0xF3
bgt _08011276
cmp r4, 0xF0
bge _08011274
b _080113EE
_08011274:
b _080113D4
_08011276:
cmp r4, 0xFF
bne _0801127C
b _080113D4
_0801127C:
b _080113EE
_0801127E:
ldr r1, =gUnknown_03005000
movs r0, 0x2
strh r0, [r1, 0x4]
b _080113EE
.pool
_0801128C:
ldr r0, =gUnknown_03004140
ldrh r0, [r0, 0x14]
bl sub_80115EC
movs r5, 0
movs r0, 0x1
mov r8, r0
ldr r1, =gUnknown_03005000
mov r9, r1
ldr r3, =0x00000cd5
add r3, r9
mov r10, r3
movs r7, 0x7F
_080112A6:
ldr r0, =gUnknown_03004140
ldrh r0, [r0, 0x14]
asrs r0, r5
mov r1, r8
ands r0, r1
cmp r0, 0
beq _0801130E
ldr r0, =gUnknown_03007890
lsls r1, r5, 5
adds r1, 0x14
ldr r0, [r0]
adds r0, r1
ldrb r0, [r0, 0x10]
adds r4, r7, 0
ands r4, r0
bl sub_800F7DC
ldrb r1, [r0, 0xA]
adds r0, r7, 0
ands r0, r1
cmp r4, r0
bne _08011304
ldr r0, =0x00000cd1
add r0, r9
adds r0, r5, r0
movs r1, 0
strb r1, [r0]
mov r3, r10
adds r2, r5, r3
strb r1, [r2]
movs r0, 0x20
adds r1, r5, 0
movs r3, 0x1
bl rfu_setRecvBuffer
b _0801130E
.pool
_08011304:
mov r0, r8
lsls r0, r5
orrs r6, r0
lsls r0, r6, 24
lsrs r6, r0, 24
_0801130E:
adds r0, r5, 0x1
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0x3
bls _080112A6
cmp r6, 0
beq _080113EE
adds r0, r6, 0
bl rfu_REQ_disconnect
bl rfu_waitREQComplete
b _080113EE
_08011328:
ldr r4, =gUnknown_03005000
ldr r1, =0x00000ce7
adds r0, r4, r1
ldr r1, =gUnknown_03004140
ldrb r2, [r0]
ldrb r0, [r1]
cmp r2, r0
beq _08011342
eors r0, r2
bl rfu_REQ_disconnect
bl rfu_waitREQComplete
_08011342:
movs r0, 0x11
strh r0, [r4, 0x4]
b _080113EE
.pool
_08011354:
ldr r0, =gUnknown_03005000
adds r0, 0xF0
b _080113EA
.pool
_08011360:
ldr r0, =gUnknown_03005000
adds r0, 0xF0
movs r1, 0x3
b _080113EC
.pool
_0801136C:
ldr r1, =gUnknown_03005000
adds r2, r1, 0
adds r2, 0xF0
movs r0, 0x4
strb r0, [r2]
ldr r3, =0x00000ce2
adds r1, r3
ldr r0, =gUnknown_03004140
ldrb r2, [r0, 0x14]
ldrb r0, [r1]
adds r3, r0, 0
bics r3, r2
adds r2, r3, 0
strb r2, [r1]
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r0, [r0]
cmp r0, 0x1
bne _080113B0
cmp r2, 0
bne _080113AC
adds r0, r4, 0
bl sub_8011170
b _080113B0
.pool
_080113AC:
bl sub_80111FC
_080113B0:
movs r0, 0x2
adds r1, r4, 0
bl sub_8011A64
b _080113EE
_080113BA:
movs r0, 0x1
movs r1, 0xF3
bl sub_8011A64
movs r0, 0xF3
bl sub_8011170
ldr r0, =gUnknown_03005000
adds r0, 0xEF
b _080113EA
.pool
_080113D4:
adds r0, r4, 0
bl sub_8011170
movs r0, 0x1
adds r1, r4, 0
bl sub_8011A64
ldr r0, =gUnknown_03005000
ldr r1, =0x00000cdb
adds r0, r1
ldrb r1, [r0]
_080113EA:
movs r1, 0x1
_080113EC:
strb r1, [r0]
_080113EE:
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_801120C
thumb_func_start sub_8011404 thumb_func_start sub_8011404
sub_8011404: @ 8011404 sub_8011404: @ 8011404
push {r4,r5,lr} push {r4,r5,lr}

View File

@ -10,6 +10,7 @@
// to help in decompiling // to help in decompiling
#define asm_comment(x) asm volatile("@ -- " x " -- ") #define asm_comment(x) asm volatile("@ -- " x " -- ")
#define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided") #define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided")
#define ASM_DIRECT __attribute__((naked))
#if defined (__APPLE__) || defined (__CYGWIN__) #if defined (__APPLE__) || defined (__CYGWIN__)
void *memset(void *, int, size_t); void *memset(void *, int, size_t);

View File

@ -67,6 +67,28 @@ union RfuPacket
struct RfuPacket8 rfuPacket8; struct RfuPacket8 rfuPacket8;
}; };
struct __attribute__((packed)) UnkLinkRfuStruct_02022B14
{
u16 unk_00_0:4;
u16 unk_00_4:1;
u16 unk_00_5:1;
u16 unk_00_6:1;
u16 unk_00_7:1;
u16 unk_01_0:1;
u16 unk_01_1:1;
u16 unk_01_2:4;
u16 unk_01_6:2;
u8 playerTrainerId[2];
u8 unk_04[4];
u16 unk_08_0:10;
u16 unk_09_2:6;
u8 unk_0a_0:7;
u8 unk_0a_7:1;
u8 playerGender:1;
u8 unk_0b_1:7;
u8 unk_0c;
};
struct RfuStruct struct RfuStruct
{ {
vs32 unk_0; vs32 unk_0;
@ -142,6 +164,15 @@ struct RfuUnk3
u32 unk_dc; u32 unk_dc;
}; };
struct RfuUnk5Sub {
u16 unk_00;
u8 unk_02;
u16 unk_04;
struct UnkLinkRfuStruct_02022B14 unk_06;
u8 fill_13[2];
u8 unk_15[8];
};
struct RfuUnk5 struct RfuUnk5
{ {
u8 unk_00; u8 unk_00;
@ -156,13 +187,7 @@ struct RfuUnk5
u8 filler_09[1]; u8 filler_09[1];
u8 unk_0a[4]; u8 unk_0a[4];
u8 filler_0e[6]; u8 filler_0e[6];
struct RfuUnk5Sub { struct RfuUnk5Sub unk_14[4];
u16 unk_00;
u8 unk_02;
u16 unk_04;
u8 unk_06[15];
u8 unk_15[11];
} unk_14[4];
}; };
extern struct RfuStruct *gRfuState; extern struct RfuStruct *gRfuState;

View File

@ -3,28 +3,6 @@
// Exported type declarations // Exported type declarations
struct __attribute__((packed)) UnkLinkRfuStruct_02022B14
{
u16 unk_00_0:4;
u16 unk_00_4:1;
u16 unk_00_5:1;
u16 unk_00_6:1;
u16 unk_00_7:1;
u16 unk_01_0:1;
u16 unk_01_1:1;
u16 unk_01_2:4;
u16 unk_01_6:2;
u8 playerTrainerId[2];
u8 unk_04[4];
u16 unk_08_0:10;
u16 unk_09_2:6;
u8 unk_0a_0:7;
u8 unk_0a_7:1;
u8 playerGender:1;
u8 unk_0b_1:7;
u8 unk_0c;
};
struct UnkLinkRfuStruct_02022B2C struct UnkLinkRfuStruct_02022B2C
{ {
u8 unk_00; u8 unk_00;

View File

@ -3362,7 +3362,7 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void)
} }
#else #else
__attribute__((naked)) ASM_DIRECT
static void BattleIntroOpponent1SendsOutMonAnimation(void) static void BattleIntroOpponent1SendsOutMonAnimation(void)
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\

View File

@ -657,7 +657,7 @@ static void sub_8072308(s16 arg0, u16 *arg1, u8 arg2)
} }
#else #else
__attribute__((naked)) ASM_DIRECT
static void sub_8072308(s16 arg0, u16 *arg1, u8 arg2) static void sub_8072308(s16 arg0, u16 *arg1, u8 arg2)
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\

View File

@ -3713,7 +3713,7 @@ static void atk24(void)
} }
} }
#else #else
__attribute__((naked)) ASM_DIRECT
static void atk24(void) static void atk24(void)
{ {
asm("\n\ asm("\n\
@ -4593,7 +4593,7 @@ static void atk48_playstatchangeanimation(void)
} }
} }
#else #else
__attribute__((naked)) ASM_DIRECT
static void atk48_playstatchangeanimation(void) static void atk48_playstatchangeanimation(void)
{ {
asm("\n\ asm("\n\
@ -9486,7 +9486,7 @@ static void atkC1_hiddenpowercalc(void)
} }
#else #else
__attribute__((naked)) ASM_DIRECT
static void atkC1_hiddenpowercalc(void) static void atkC1_hiddenpowercalc(void)
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\

View File

@ -265,7 +265,7 @@ static void berry_fix_gpu_set(void)
} }
#else #else
__attribute__((naked)) static void berry_fix_gpu_set(void) ASM_DIRECT static void berry_fix_gpu_set(void)
{ {
asm(".syntax unified\n" asm(".syntax unified\n"
"\tpush {r4-r6,lr}\n" "\tpush {r4-r6,lr}\n"

View File

@ -463,7 +463,7 @@ bool8 IsDma3ManagerBusyWithBgCopy(void)
return FALSE; return FALSE;
} }
#else #else
__attribute__((naked)) ASM_DIRECT
bool8 IsDma3ManagerBusyWithBgCopy(void) bool8 IsDma3ManagerBusyWithBgCopy(void)
{ {
asm("push {r4-r7,lr}\n\ asm("push {r4-r7,lr}\n\
@ -1048,7 +1048,7 @@ void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8
} }
} }
}*/ }*/
__attribute__((naked)) ASM_DIRECT
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) 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\ asm("push {r4-r7,lr}\n\
@ -1495,7 +1495,7 @@ void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 pal
*dest = test; *dest = test;
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 palette2) void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 palette2)
{ {
asm("push {r4-r6,lr}\n\ asm("push {r4-r6,lr}\n\

View File

@ -421,7 +421,7 @@ bool8 ShouldDoBrailleRegicePuzzle(void)
return FALSE; return FALSE;
} }
#else #else
__attribute__((naked)) ASM_DIRECT
bool8 ShouldDoBrailleRegicePuzzle(void) bool8 ShouldDoBrailleRegicePuzzle(void)
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\

View File

@ -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. // This one (unused) function is really challenging, won't even try to decompile it.
__attribute__((naked)) ASM_DIRECT
void sub_803471C() void sub_803471C()
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\

View File

@ -2542,7 +2542,7 @@ void sub_812A0E8(u8 taskId)
} }
} }
#else #else
__attribute__((naked)) void sub_812A0E8(u8 taskId) ASM_DIRECT void sub_812A0E8(u8 taskId)
{ {
asm_unified("\tpush {r4-r7,lr}\n" asm_unified("\tpush {r4-r7,lr}\n"
"\tlsls r0, 24\n" "\tlsls r0, 24\n"

View File

@ -641,7 +641,7 @@ static u8 sub_818E13C(void)
return retval; return retval;
} }
#else #else
__attribute__((naked)) static u8 sub_818E13C(void) ASM_DIRECT static u8 sub_818E13C(void)
{ {
asm_unified("\tpush {r4-r7,lr}\n" asm_unified("\tpush {r4-r7,lr}\n"
"\tmovs r7, 0x1\n" "\tmovs r7, 0x1\n"

View File

@ -72,6 +72,7 @@ void sub_80109E8(u16 a0);
void sub_8010A70(void *a0); void sub_8010A70(void *a0);
void sub_8010AAC(u8 taskId); void sub_8010AAC(u8 taskId);
void sub_8010D0C(u8 taskId); void sub_8010D0C(u8 taskId);
void sub_80115EC(u16 a0);
u8 sub_8011CE4(const u8 *a0, u16 a1); u8 sub_8011CE4(const u8 *a0, u16 a1);
void sub_8011D6C(u8 a0); void sub_8011D6C(u8 a0);
void sub_8011E94(u8 a0, u8 a1); void sub_8011E94(u8 a0, u8 a1);
@ -2048,7 +2049,7 @@ u8 sub_800DD1C(u8 maxFlags)
return 0; return 0;
} }
#else #else
__attribute__((naked)) u8 sub_800DD1C(u8 maxFlags) ASM_DIRECT u8 sub_800DD1C(u8 maxFlags)
{ {
asm_unified("\tpush {r4-r7,lr}\n" asm_unified("\tpush {r4-r7,lr}\n"
"\tlsls r0, 24\n" "\tlsls r0, 24\n"
@ -2143,7 +2144,7 @@ void sub_800DD94(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, int r
data->unk_01_1 = FlagGet(FLAG_SYS_GAME_CLEAR); data->unk_01_1 = FlagGet(FLAG_SYS_GAME_CLEAR);
} }
bool8 sub_800DE7C(void *buff1, void *buff2, u8 idx) bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx)
{ {
bool8 retVal; bool8 retVal;
@ -2152,13 +2153,13 @@ bool8 sub_800DE7C(void *buff1, void *buff2, u8 idx)
retVal = TRUE; retVal = TRUE;
if (sub_8010454(gUnknown_03007890->unk_14[idx].unk_04) && ((gUnknown_03007890->unk_07 >> idx) & 1)) if (sub_8010454(gUnknown_03007890->unk_14[idx].unk_04) && ((gUnknown_03007890->unk_07 >> idx) & 1))
{ {
memcpy(buff1, gUnknown_03007890->unk_14[idx].unk_06, 13); memcpy(buff1, &gUnknown_03007890->unk_14[idx].unk_06, sizeof(gUnknown_03007890->unk_14[idx].unk_06));
memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, 8); memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, sizeof(gUnknown_03007890->unk_14[idx].unk_15));
} }
else else
{ {
memset(buff1, 0, 13); memset(buff1, 0, sizeof(gUnknown_03007890->unk_14[idx].unk_06));
memset(buff2, 0, 8); memset(buff2, 0, sizeof(gUnknown_03007890->unk_14[idx].unk_15));
} }
} }
else else
@ -2166,38 +2167,38 @@ bool8 sub_800DE7C(void *buff1, void *buff2, u8 idx)
retVal = FALSE; retVal = FALSE;
if (sub_8010454(gUnknown_03007890->unk_14[idx].unk_04)) if (sub_8010454(gUnknown_03007890->unk_14[idx].unk_04))
{ {
memcpy(buff1, gUnknown_03007890->unk_14[idx].unk_06, 13); memcpy(buff1, &gUnknown_03007890->unk_14[idx].unk_06, sizeof(gUnknown_03007890->unk_14[idx].unk_06));
memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, 8); memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, sizeof(gUnknown_03007890->unk_14[idx].unk_15));
} }
else else
{ {
memset(buff1, 0, 13); memset(buff1, 0, sizeof(gUnknown_03007890->unk_14[idx].unk_06));
memset(buff2, 0, 8); memset(buff2, 0, sizeof(gUnknown_03007890->unk_14[idx].unk_15));
} }
} }
return retVal; return retVal;
} }
bool8 sub_800DF34(void *buff1, void *buff2, u8 idx) bool8 sub_800DF34(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx)
{ {
bool8 retVal = FALSE; bool8 retVal = FALSE;
if (gUnknown_03007890->unk_14[idx].unk_04 == 0x7F7D) if (gUnknown_03007890->unk_14[idx].unk_04 == 0x7F7D)
{ {
memcpy(buff1, gUnknown_03007890->unk_14[idx].unk_06, 13); *buff1 = gUnknown_03007890->unk_14[idx].unk_06;
memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, 8); memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, 8);
retVal = TRUE; retVal = TRUE;
} }
else else
{ {
memset(buff1, 0, 13); *buff1 = (struct UnkLinkRfuStruct_02022B14){};
memset(buff2, 0, 8); memset(buff2, 0, 8);
} }
return retVal; return retVal;
} }
void sub_800DF90(void *buff1, void *buff2) void sub_800DF90(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2)
{ {
memcpy(buff1, &gUnknown_02022B14, 13); *buff1 = gUnknown_02022B14;
memcpy(buff2, gUnknown_02022B22, 8); memcpy(buff2, gUnknown_02022B22, 8);
} }
@ -2894,7 +2895,7 @@ void sub_800EFB0(void)
CpuFill16(0, gRecvCmds, sizeof gRecvCmds); CpuFill16(0, gRecvCmds, sizeof gRecvCmds);
} }
#else #else
__attribute__((naked)) void sub_800EFB0(void) ASM_DIRECT void sub_800EFB0(void)
{ {
asm_unified("\tpush {r4-r7,lr}\n" asm_unified("\tpush {r4-r7,lr}\n"
"\tsub sp, 0x4\n" "\tsub sp, 0x4\n"
@ -3230,7 +3231,7 @@ void sub_800F638(u8 unused, u32 flags)
} }
} }
#else #else
__attribute__((naked)) void sub_800F638(u8 unused, u32 flags) ASM_DIRECT void sub_800F638(u8 unused, u32 flags)
{ {
asm_unified("\tpush {r4-r7,lr}\n" asm_unified("\tpush {r4-r7,lr}\n"
"\tmov r7, r10\n" "\tmov r7, r10\n"
@ -3598,7 +3599,7 @@ void sub_800FD14(u16 command)
} }
} }
#else #else
__attribute__((naked)) void sub_800FD14(u16 command) ASM_DIRECT void sub_800FD14(u16 command)
{ {
asm_unified("\tpush {r4,r5,lr}\n" asm_unified("\tpush {r4,r5,lr}\n"
"\tlsls r0, 16\n" "\tlsls r0, 16\n"
@ -4610,3 +4611,330 @@ void sub_80111FC(void)
{ {
gUnknown_03005000.unk_00 = sub_80111DC; gUnknown_03005000.unk_00 = sub_80111DC;
} }
#ifdef NONMATCHING
void sub_801120C(u8 a0)
{
u8 i;
u8 r6 = 0;
struct RfuUnk5Sub *unk5Sub;
switch (a0)
{
case 0x00:
gUnknown_03005000.unk_04 = 2;
break;
case 0x10:
break;
case 0x11:
sub_80115EC(gUnknown_03004140.unk_14);
for (i = 0; i < 4; i++)
{
if ((gUnknown_03004140.unk_14 >> i) & 1)
{
unk5Sub = &gUnknown_03007890->unk_14[i];
if (unk5Sub->unk_06.unk_0a_0 == sub_800F7DC()->unk_0a_0)
{
gUnknown_03005000.unk_cd1[i] = 0;
gUnknown_03005000.unk_cd5[i] = 0;
rfu_setRecvBuffer(0x20, i, gUnknown_03005000.unk_cd5 + i, 1);
}
else
{
r6 |= (1 << i);
}
}
}
if (r6)
{
rfu_REQ_disconnect(r6);
rfu_waitREQComplete();
}
break;
case 0x12:
break;
case 0x13:
break;
case 0x14:
if (gUnknown_03005000.unk_ce7 != gUnknown_03004140.unk_00)
{
rfu_REQ_disconnect(gUnknown_03005000.unk_ce7 ^ gUnknown_03004140.unk_00);
rfu_waitREQComplete();
}
gUnknown_03005000.unk_04 = 0x11;
break;
case 0x31:
gUnknown_03005000.unk_f0 = 1;
break;
case 0x32:
gUnknown_03005000.unk_f0 = 3;
break;
case 0x30:
case 0x33:
gUnknown_03005000.unk_f0 = 4;
gUnknown_03005000.unk_ce2 &= ~gUnknown_03004140.unk_14;
if (gReceivedRemoteLinkPlayers == 1)
{
if (gUnknown_03005000.unk_ce2 == 0)
sub_8011170(a0);
else
sub_80111FC();
}
sub_8011A64(2, a0);
break;
case 0x42 ... 0x44:
break;
case 0xf3:
sub_8011A64(1, a0);
sub_8011170(a0);
gUnknown_03005000.unk_ef = 1;
break;
case 0xf0 ... 0xf2:
case 0xff:
sub_8011170(a0);
sub_8011A64(1, a0);
gUnknown_03005000.unk_cdb = 1;
break;
}
}
#else
ASM_DIRECT void sub_801120C(u8 a0)
{
asm_unified("\tpush {r4-r7,lr}\n"
"\tmov r7, r10\n"
"\tmov r6, r9\n"
"\tmov r5, r8\n"
"\tpush {r5-r7}\n"
"\tlsls r0, 24\n"
"\tlsrs r4, r0, 24\n"
"\tmovs r6, 0\n"
"\tcmp r4, 0x32\n"
"\tbne _08011222\n"
"\tb _08011360_case_32\n"
"_08011222:\n"
"\tcmp r4, 0x32\n"
"\tbgt _08011252\n"
"\tcmp r4, 0x13\n"
"\tbgt _08011240\n"
"\tcmp r4, 0x12\n"
"\tblt _08011230\n"
"\tb _080113EE_break\n"
"_08011230:\n"
"\tcmp r4, 0x10\n"
"\tbne _08011236\n"
"\tb _080113EE_break\n"
"_08011236:\n"
"\tcmp r4, 0x10\n"
"\tbgt _0801128C_case_11\n"
"\tcmp r4, 0\n"
"\tbeq _0801127E_case_00\n"
"\tb _080113EE_break\n"
"_08011240:\n"
"\tcmp r4, 0x30\n"
"\tbne _08011246\n"
"\tb _0801136C_case_30_case_33\n"
"_08011246:\n"
"\tcmp r4, 0x30\n"
"\tble _0801124C\n"
"\tb _08011354_case_31\n"
"_0801124C:\n"
"\tcmp r4, 0x14\n"
"\tbeq _08011328_case_14\n"
"\tb _080113EE_break\n"
"_08011252:\n"
"\tcmp r4, 0x44\n"
"\tbgt _08011264\n"
"\tcmp r4, 0x42\n"
"\tblt _0801125C\n"
"\tb _080113EE_break\n"
"_0801125C:\n"
"\tcmp r4, 0x33\n"
"\tbne _08011262\n"
"\tb _0801136C_case_30_case_33\n"
"_08011262:\n"
"\tb _080113EE_break\n"
"_08011264:\n"
"\tcmp r4, 0xF3\n"
"\tbne _0801126A\n"
"\tb _080113BA_case_f3\n"
"_0801126A:\n"
"\tcmp r4, 0xF3\n"
"\tbgt _08011276\n"
"\tcmp r4, 0xF0\n"
"\tbge _08011274\n"
"\tb _080113EE_break\n"
"_08011274:\n"
"\tb _080113D4_case_f0_f1_f2_ff\n"
"_08011276:\n"
"\tcmp r4, 0xFF\n"
"\tbne _0801127C\n"
"\tb _080113D4_case_f0_f1_f2_ff\n"
"_0801127C:\n"
"\tb _080113EE_break\n"
"_0801127E_case_00:\n"
"\tldr r1, =gUnknown_03005000\n"
"\tmovs r0, 0x2\n"
"\tstrh r0, [r1, 0x4]\n"
"\tb _080113EE_break\n"
"\t.pool\n"
"_0801128C_case_11:\n"
"\tldr r0, =gUnknown_03004140\n"
"\tldrh r0, [r0, 0x14]\n"
"\tbl sub_80115EC\n"
"\tmovs r5, 0\n"
"\tmovs r0, 0x1\n"
"\tmov r8, r0\n"
"\tldr r1, =gUnknown_03005000\n"
"\tmov r9, r1\n"
"\tldr r3, =0x00000cd5\n"
"\tadd r3, r9\n"
"\tmov r10, r3\n"
"\tmovs r7, 0x7F\n"
"_080112A6:\n"
"\tldr r0, =gUnknown_03004140\n"
"\tldrh r0, [r0, 0x14]\n"
"\tasrs r0, r5\n"
"\tmov r1, r8\n"
"\tands r0, r1\n"
"\tcmp r0, 0\n"
"\tbeq _0801130E\n"
"\tldr r0, =gUnknown_03007890\n"
"\tlsls r1, r5, 5\n"
"\tadds r1, 0x14\n"
"\tldr r0, [r0]\n"
"\tadds r0, r1\n"
"\tldrb r0, [r0, 0x10]\n"
"\tadds r4, r7, 0\n"
"\tands r4, r0\n"
"\tbl sub_800F7DC\n"
"\tldrb r1, [r0, 0xA]\n"
"\tadds r0, r7, 0\n"
"\tands r0, r1\n"
"\tcmp r4, r0\n"
"\tbne _08011304\n"
"\tldr r0, =0x00000cd1\n"
"\tadd r0, r9\n"
"\tadds r0, r5, r0\n"
"\tmovs r1, 0\n"
"\tstrb r1, [r0]\n"
"\tmov r3, r10\n"
"\tadds r2, r5, r3\n"
"\tstrb r1, [r2]\n"
"\tmovs r0, 0x20\n"
"\tadds r1, r5, 0\n"
"\tmovs r3, 0x1\n"
"\tbl rfu_setRecvBuffer\n"
"\tb _0801130E\n"
"\t.pool\n"
"_08011304:\n"
"\tmov r0, r8\n"
"\tlsls r0, r5\n"
"\torrs r6, r0\n"
"\tlsls r0, r6, 24\n"
"\tlsrs r6, r0, 24\n"
"_0801130E:\n"
"\tadds r0, r5, 0x1\n"
"\tlsls r0, 24\n"
"\tlsrs r5, r0, 24\n"
"\tcmp r5, 0x3\n"
"\tbls _080112A6\n"
"\tcmp r6, 0\n"
"\tbeq _080113EE_break\n"
"\tadds r0, r6, 0\n"
"\tbl rfu_REQ_disconnect\n"
"\tbl rfu_waitREQComplete\n"
"\tb _080113EE_break\n"
"_08011328_case_14:\n"
"\tldr r4, =gUnknown_03005000\n"
"\tldr r1, =0x00000ce7\n"
"\tadds r0, r4, r1\n"
"\tldr r1, =gUnknown_03004140\n"
"\tldrb r2, [r0]\n"
"\tldrb r0, [r1]\n"
"\tcmp r2, r0\n"
"\tbeq _08011342\n"
"\teors r0, r2\n"
"\tbl rfu_REQ_disconnect\n"
"\tbl rfu_waitREQComplete\n"
"_08011342:\n"
"\tmovs r0, 0x11\n"
"\tstrh r0, [r4, 0x4]\n"
"\tb _080113EE_break\n"
"\t.pool\n"
"_08011354_case_31:\n"
"\tldr r0, =gUnknown_03005000\n"
"\tadds r0, 0xF0\n"
"\tb _080113EA\n"
"\t.pool\n"
"_08011360_case_32:\n"
"\tldr r0, =gUnknown_03005000\n"
"\tadds r0, 0xF0\n"
"\tmovs r1, 0x3\n"
"\tb _080113EC\n"
"\t.pool\n"
"_0801136C_case_30_case_33:\n"
"\tldr r1, =gUnknown_03005000\n"
"\tadds r2, r1, 0\n"
"\tadds r2, 0xF0\n"
"\tmovs r0, 0x4\n"
"\tstrb r0, [r2]\n"
"\tldr r3, =0x00000ce2\n"
"\tadds r1, r3\n"
"\tldr r0, =gUnknown_03004140\n"
"\tldrb r2, [r0, 0x14]\n"
"\tldrb r0, [r1]\n"
"\tadds r3, r0, 0\n"
"\tbics r3, r2\n"
"\tadds r2, r3, 0\n"
"\tstrb r2, [r1]\n"
"\tldr r0, =gReceivedRemoteLinkPlayers\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, 0x1\n"
"\tbne _080113B0\n"
"\tcmp r2, 0\n"
"\tbne _080113AC\n"
"\tadds r0, r4, 0\n"
"\tbl sub_8011170\n"
"\tb _080113B0\n"
"\t.pool\n"
"_080113AC:\n"
"\tbl sub_80111FC\n"
"_080113B0:\n"
"\tmovs r0, 0x2\n"
"\tadds r1, r4, 0\n"
"\tbl sub_8011A64\n"
"\tb _080113EE_break\n"
"_080113BA_case_f3:\n"
"\tmovs r0, 0x1\n"
"\tmovs r1, 0xF3\n"
"\tbl sub_8011A64\n"
"\tmovs r0, 0xF3\n"
"\tbl sub_8011170\n"
"\tldr r0, =gUnknown_03005000\n"
"\tadds r0, 0xEF\n"
"\tb _080113EA\n"
"\t.pool\n"
"_080113D4_case_f0_f1_f2_ff:\n"
"\tadds r0, r4, 0\n"
"\tbl sub_8011170\n"
"\tmovs r0, 0x1\n"
"\tadds r1, r4, 0\n"
"\tbl sub_8011A64\n"
"\tldr r0, =gUnknown_03005000\n"
"\tldr r1, =0x00000cdb\n"
"\tadds r0, r1\n"
"\tldrb r1, [r0]\n"
"_080113EA:\n"
"\tmovs r1, 0x1\n"
"_080113EC:\n"
"\tstrb r1, [r0]\n"
"_080113EE_break:\n"
"\tpop {r3-r5}\n"
"\tmov r8, r3\n"
"\tmov r9, r4\n"
"\tmov r10, r5\n"
"\tpop {r4-r7}\n"
"\tpop {r0}\n"
"\tbx r0\n"
"\t.pool");
}
#endif

View File

@ -930,7 +930,7 @@ void TintPalette_SepiaTone(u16 *palette, u16 count)
} }
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void TintPalette_SepiaTone(u16 *palette, u16 count) void TintPalette_SepiaTone(u16 *palette, u16 count)
{ {
asm("push {r4-r7,lr}\n\ asm("push {r4-r7,lr}\n\
@ -1036,7 +1036,7 @@ void TintPalette_CustomTone(u16 *palette, u16 count, u16 a3, u16 a4, u16 a5)
return; return;
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void TintPalette_CustomTone(u16 *palette, u16 count, u16 a3, u16 a4, u16 a5) void TintPalette_CustomTone(u16 *palette, u16 count, u16 a3, u16 a4, u16 a5)
{ {
asm("push {r4-r7,lr}\n\ asm("push {r4-r7,lr}\n\

View File

@ -1435,7 +1435,7 @@ void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId)
*ppBonusesPtr = localPpBonuses; *ppBonusesPtr = localPpBonuses;
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId) void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId)
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\
@ -1646,7 +1646,7 @@ void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId)
*ppBonusesPtr = localPpBonuses; *ppBonusesPtr = localPpBonuses;
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId) void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId)
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\
@ -2057,7 +2057,7 @@ void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d)
Free(alloced); Free(alloced);
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d) void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d)
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\
@ -2359,7 +2359,7 @@ void sub_81C2194(u16 *a, u16 b, u8 c)
} }
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void sub_81C2194(u16 *a, u16 b, u8 c) void sub_81C2194(u16 *a, u16 b, u8 c)
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\
@ -2808,7 +2808,7 @@ u8 sub_81C2D2C(struct WindowTemplate *template, u8 a)
return r4[a]; return r4[a];
} }
#else #else
__attribute__((naked)) ASM_DIRECT
u8 sub_81C2D2C(struct WindowTemplate *template, u8 a) u8 sub_81C2D2C(struct WindowTemplate *template, u8 a)
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\
@ -2853,7 +2853,7 @@ void sub_81C2D68(u8 a)
} }
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void sub_81C2D68(u8 a) void sub_81C2D68(u8 a)
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\
@ -3110,7 +3110,7 @@ void sub_81C335C()
sub_81C25A4(r4, gText_FiveMarks, r5, 1, 0, 1); sub_81C25A4(r4, gText_FiveMarks, r5, 1, 0, 1);
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void sub_81C335C() void sub_81C335C()
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\
@ -3453,7 +3453,7 @@ void sub_81C3B08(u8 a)
sub_81C25A4(sp, text, offset, (a<<4), 0, r5); sub_81C25A4(sp, text, offset, (a<<4), 0, r5);
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void sub_81C3B08(u8 a) void sub_81C3B08(u8 a)
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\

View File

@ -484,7 +484,7 @@ u32 MoveRecordedBattleToSaveData(void)
} }
#else #else
__attribute__((naked)) ASM_DIRECT
u32 MoveRecordedBattleToSaveData(void) u32 MoveRecordedBattleToSaveData(void)
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\

View File

@ -1537,7 +1537,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx)
CopyWindowToVram(gUnknown_03000F30, 3); CopyWindowToVram(gUnknown_03000F30, 3);
return FALSE; return FALSE;
}*/ }*/
__attribute__((naked)) ASM_DIRECT
bool8 ScrCmd_braillemessage(struct ScriptContext *ctx) bool8 ScrCmd_braillemessage(struct ScriptContext *ctx)
{ {
asm("push {r4-r7,lr}\n\ asm("push {r4-r7,lr}\n\

View File

@ -765,7 +765,7 @@ void sub_80E9914(void)
} }
} }
#else #else
__attribute__((naked)) void sub_80E9914(void) ASM_DIRECT void sub_80E9914(void)
{ {
asm_unified("\tpush {r4-r7,lr}\n" asm_unified("\tpush {r4-r7,lr}\n"
"\tmov r7, r10\n" "\tmov r7, r10\n"

View File

@ -1228,7 +1228,7 @@ void obj_update_pos2(struct Sprite* sprite, s32 a1, s32 a2)
} }
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void obj_update_pos2(struct Sprite* sprite, s32 a1, s32 a2) void obj_update_pos2(struct Sprite* sprite, s32 a1, s32 a2)
{ {
asm(".syntax unified\n\ asm(".syntax unified\n\

View File

@ -374,7 +374,7 @@ void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
*(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor; *(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor;
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
{ {
asm("push {r4-r7,lr}\n\ asm("push {r4-r7,lr}\n\
@ -870,7 +870,7 @@ void DecompressGlyphTile(const u16 *src, u16 *dest)
*(dest) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] >> 8]]; *(dest) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] >> 8]];
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void DecompressGlyphTile(const u16 *src, u16 *dest) void DecompressGlyphTile(const u16 *src, u16 *dest)
{ {
asm("push {r4-r7,lr}\n\ asm("push {r4-r7,lr}\n\
@ -1051,7 +1051,7 @@ u8 GetLastTextColor(u8 colorType)
} }
} }
__attribute__((naked)) ASM_DIRECT
void CopyGlyphToWindow(struct TextPrinter *x) void CopyGlyphToWindow(struct TextPrinter *x)
{ {
asm("push {r4-r7,lr}\n\ asm("push {r4-r7,lr}\n\
@ -2047,7 +2047,7 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c
} }
} }
__attribute__((naked)) ASM_DIRECT
u16 RenderText(struct TextPrinter *textPrinter) // 80057B4 u16 RenderText(struct TextPrinter *textPrinter) // 80057B4
{ {
asm("push {r4-r6,lr}\n\ asm("push {r4-r6,lr}\n\

View File

@ -2154,7 +2154,7 @@ void sub_80EDE98(TVShow *show)
} }
} }
#else #else
__attribute__((naked)) ASM_DIRECT
void sub_80EDE98(TVShow *show) void sub_80EDE98(TVShow *show)
{ {
asm_unified("\tpush {r4-r7,lr}\n" asm_unified("\tpush {r4-r7,lr}\n"
@ -4110,7 +4110,7 @@ void sub_80F0708(void) // FIXME: register allocation shenanigans
} }
} }
#else #else
__attribute__((naked)) void sub_80F0708(void) ASM_DIRECT void sub_80F0708(void)
{ {
asm_unified("\tpush {r4-r7,lr}\n" asm_unified("\tpush {r4-r7,lr}\n"
"\tmov r7, r9\n" "\tmov r7, r9\n"

View File

@ -230,7 +230,7 @@ void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output)
} }
#else #else
__attribute__((naked)) void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output) ASM_DIRECT void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output)
{ {
asm("\n\ asm("\n\
.syntax unified\n\ .syntax unified\n\