sub_80E78C4

This commit is contained in:
PikalaxALT 2017-11-04 12:20:40 -04:00
parent fb9e5cb3a4
commit 158e9ff762
6 changed files with 37 additions and 75 deletions

View File

@ -795,7 +795,7 @@ sub_80B2A08: @ 80B2A08
ldrh r0, [r0] ldrh r0, [r0]
cmp r0, 0x4 cmp r0, 0x4
bne _080B2A38 bne _080B2A38
bl Link_AnyPartnersPlayingRubyOrSapphrie bl Link_AnyPartnersPlayingRubyOrSapphire
cmp r0, 0 cmp r0, 0
bne _080B2A4A bne _080B2A4A
bl sub_800AC34 bl sub_800AC34

View File

@ -1464,8 +1464,8 @@ _0800A060:
bx r1 bx r1
thumb_func_end Link_HaveFourPlayersWithAtLeastOneRubyOrSapphire thumb_func_end Link_HaveFourPlayersWithAtLeastOneRubyOrSapphire
thumb_func_start Link_AnyPartnersPlayingRubyOrSapphrie thumb_func_start Link_AnyPartnersPlayingRubyOrSapphire
Link_AnyPartnersPlayingRubyOrSapphrie: @ 800A064 Link_AnyPartnersPlayingRubyOrSapphire: @ 800A064
push {lr} push {lr}
movs r0, 0x2 movs r0, 0x2
movs r1, 0x1 movs r1, 0x1
@ -1479,7 +1479,7 @@ _0800A076:
_0800A078: _0800A078:
pop {r1} pop {r1}
bx r1 bx r1
thumb_func_end Link_AnyPartnersPlayingRubyOrSapphrie thumb_func_end Link_AnyPartnersPlayingRubyOrSapphire
thumb_func_start sub_800A07C thumb_func_start sub_800A07C
sub_800A07C: @ 800A07C sub_800A07C: @ 800A07C

View File

@ -5,70 +5,6 @@
.text .text
thumb_func_start sub_80E78C4
sub_80E78C4: @ 80E78C4
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
sub sp, 0x10
mov r9, r0
mov r8, r1
lsls r2, 24
lsrs r7, r2, 24
mov r0, sp
bl sub_80E7830
lsls r0, r7, 2
add r0, sp
ldr r1, [r0]
mov r0, r8
muls r0, r1
mov r2, r9
adds r6, r2, r0
ldr r2, =gLinkPlayers
lsls r0, r1, 3
subs r0, r1
lsls r0, 2
adds r0, r2
ldrb r4, [r0]
ldrh r5, [r0, 0x1A]
bl Link_AnyPartnersPlayingRubyOrSapphrie
cmp r0, 0
beq _080E7910
adds r0, r6, 0
adds r1, r4, 0
adds r2, r5, 0
bl sub_8120D34
b _080E791A
.pool
_080E7910:
adds r0, r6, 0
adds r1, r4, 0
adds r2, r5, 0
bl sub_8120CD0
_080E791A:
ldr r0, =gUnknown_03001140
ldr r0, [r0]
lsls r1, r7, 2
add r1, sp
ldr r1, [r1]
mov r2, r8
muls r2, r1
adds r1, r2, 0
add r1, r9
movs r2, 0x40
bl memcpy
bl sub_8120670
add sp, 0x10
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80E78C4
thumb_func_start sub_80E7948 thumb_func_start sub_80E7948
sub_80E7948: @ 80E7948 sub_80E7948: @ 80E7948
push {r4-r7,lr} push {r4-r7,lr}
@ -82,7 +18,7 @@ sub_80E7948: @ 80E7948
lsrs r6, r2, 24 lsrs r6, r2, 24
mov r0, sp mov r0, sp
bl sub_80E7830 bl sub_80E7830
bl Link_AnyPartnersPlayingRubyOrSapphrie bl Link_AnyPartnersPlayingRubyOrSapphire
cmp r0, 0 cmp r0, 0
beq _080E79AC beq _080E79AC
lsls r0, r6, 2 lsls r0, r6, 2
@ -399,7 +335,7 @@ _080E7BB0:
mov r8, r0 mov r8, r0
cmp r0, 0x3 cmp r0, 0x3
bls _080E7BB0 bls _080E7BB0
bl Link_AnyPartnersPlayingRubyOrSapphrie bl Link_AnyPartnersPlayingRubyOrSapphire
str r0, [sp, 0x3C] str r0, [sp, 0x3C]
movs r2, 0 movs r2, 0
mov r8, r2 mov r8, r2
@ -956,7 +892,7 @@ _080E8024:
.4byte _080E80EE .4byte _080E80EE
.4byte _080E80FA .4byte _080E80FA
_080E804C: _080E804C:
bl Link_AnyPartnersPlayingRubyOrSapphrie bl Link_AnyPartnersPlayingRubyOrSapphire
cmp r0, 0 cmp r0, 0
bne _080E80F2 bne _080E80F2
movs r0, 0x6 movs r0, 0x6

View File

@ -194,7 +194,7 @@ void sub_8011BD0(void);
u8 sub_800ABAC(void); u8 sub_800ABAC(void);
u8 sub_800ABBC(void); u8 sub_800ABBC(void);
void sub_800AC34(void); void sub_800AC34(void);
bool32 Link_AnyPartnersPlayingRubyOrSapphrie(void); bool32 Link_AnyPartnersPlayingRubyOrSapphire(void);
bool32 sub_800A03C(void); bool32 sub_800A03C(void);
void sub_8009628(u8); void sub_8009628(u8);
u8 sub_800AA48(void); u8 sub_800AA48(void);

View File

@ -5,5 +5,8 @@
void SetMauvilleOldMan(void); void SetMauvilleOldMan(void);
u8 sub_81201C8(void); u8 sub_81201C8(void);
void sub_8120B70(OldMan *dest); void sub_8120B70(OldMan *dest);
void sub_8120D34(OldMan *dest, u8 version, u16 language);
void sub_8120CD0(OldMan *dest, u8 version, u16 language);
void sub_8120670(void);
#endif // GUARD_MAUVILLE_OLD_MAN_H #endif // GUARD_MAUVILLE_OLD_MAN_H

View File

@ -160,7 +160,7 @@ void sub_80E6E24(void)
sub_80E9914(); sub_80E9914();
sub_80F0BB8(); sub_80F0BB8();
sub_80E6BF8(); sub_80E6BF8();
if (Link_AnyPartnersPlayingRubyOrSapphrie()) if (Link_AnyPartnersPlayingRubyOrSapphire())
{ {
if (sub_800A03C() == FALSE) if (sub_800A03C() == FALSE)
{ {
@ -193,7 +193,7 @@ void sub_80E6E24(void)
void sub_80E6F60(u32 a0) void sub_80E6F60(u32 a0)
{ {
if (Link_AnyPartnersPlayingRubyOrSapphrie()) if (Link_AnyPartnersPlayingRubyOrSapphire())
{ {
// Ruby/Sapphire // Ruby/Sapphire
sub_80E7B2C(gUnknown_0203A014[0].tvShows); sub_80E7B2C(gUnknown_0203A014[0].tvShows);
@ -380,7 +380,7 @@ static void sub_80E7324(u8 taskId)
task->data[0] = 0; task->data[0] = 0;
task->data[5] = sub_80E7810(); task->data[5] = sub_80E7810();
task->func = sub_80E756C; task->func = sub_80E756C;
if (Link_AnyPartnersPlayingRubyOrSapphrie()) if (Link_AnyPartnersPlayingRubyOrSapphire())
{ {
sub_80E7808(gUnknown_0203A018, (u16 *)&task->data[2]); sub_80E7808(gUnknown_0203A018, (u16 *)&task->data[2]);
taskId2 = CreateTask(sub_80E7630, 80); taskId2 = CreateTask(sub_80E7630, 80);
@ -575,3 +575,26 @@ void sub_80E7830(u32 *data)
break; break;
} }
} }
void sub_80E78C4(OldMan *oldMan, size_t recordSize, u8 which)
{
u8 version;
u16 language;
OldMan *dest;
u32 data[4];
sub_80E7830(data);
dest = (OldMan *)((void *)oldMan + recordSize * data[which]);
version = gLinkPlayers[data[which]].version;
language = gLinkPlayers[data[which]].language;
if (Link_AnyPartnersPlayingRubyOrSapphire())
{
sub_8120D34(dest, version, language);
}
else
{
sub_8120CD0(dest, version, language);
}
memcpy(gUnknown_03001140, (OldMan *)((void *)oldMan + recordSize * data[which]), sizeof(OldMan));
sub_8120670();
}