mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-26 21:33:53 +01:00
through sub_800A0AC
This commit is contained in:
parent
c9da45b254
commit
d76901ff64
149
asm/link.s
149
asm/link.s
@ -5,155 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start GetLinkPlayerCount
|
||||
GetLinkPlayerCount: @ 8009FCC
|
||||
push {lr}
|
||||
ldr r0, =gLinkVSyncDisabled
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _08009FEC
|
||||
ldr r0, =gUnknown_030030E0
|
||||
ldr r0, [r0]
|
||||
movs r1, 0x1C
|
||||
ands r0, r1
|
||||
lsrs r0, 2
|
||||
b _08009FF4
|
||||
.pool
|
||||
_08009FEC:
|
||||
bl sub_80104F4
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
_08009FF4:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end GetLinkPlayerCount
|
||||
|
||||
thumb_func_start sub_8009FF8
|
||||
sub_8009FF8: @ 8009FF8
|
||||
push {r4-r7,lr}
|
||||
adds r6, r0, 0
|
||||
adds r5, r1, 0
|
||||
bl GetLinkPlayerCount
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
movs r2, 0
|
||||
cmp r2, r4
|
||||
bge _0800A030
|
||||
movs r7, 0xFF
|
||||
ldr r3, =gLinkPlayers
|
||||
_0800A010:
|
||||
ldrh r0, [r3]
|
||||
adds r1, r7, 0
|
||||
ands r1, r0
|
||||
cmp r1, r6
|
||||
beq _0800A01E
|
||||
cmp r1, r5
|
||||
bne _0800A028
|
||||
_0800A01E:
|
||||
movs r0, 0x1
|
||||
b _0800A034
|
||||
.pool
|
||||
_0800A028:
|
||||
adds r3, 0x1C
|
||||
adds r2, 0x1
|
||||
cmp r2, r4
|
||||
blt _0800A010
|
||||
_0800A030:
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
_0800A034:
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8009FF8
|
||||
|
||||
thumb_func_start sub_800A03C
|
||||
sub_800A03C: @ 800A03C
|
||||
movs r0, 0x2
|
||||
bx lr
|
||||
thumb_func_end sub_800A03C
|
||||
|
||||
thumb_func_start sub_800A040
|
||||
sub_800A040: @ 800A040
|
||||
push {lr}
|
||||
bl GetLinkPlayerCount
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x4
|
||||
bne _0800A05A
|
||||
movs r0, 0x2
|
||||
movs r1, 0x1
|
||||
bl sub_8009FF8
|
||||
cmp r0, 0
|
||||
bge _0800A05E
|
||||
_0800A05A:
|
||||
movs r0, 0
|
||||
b _0800A060
|
||||
_0800A05E:
|
||||
movs r0, 0x1
|
||||
_0800A060:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_800A040
|
||||
|
||||
thumb_func_start sub_800A064
|
||||
sub_800A064: @ 800A064
|
||||
push {lr}
|
||||
movs r0, 0x2
|
||||
movs r1, 0x1
|
||||
bl sub_8009FF8
|
||||
cmp r0, 0
|
||||
bge _0800A076
|
||||
movs r0, 0
|
||||
b _0800A078
|
||||
_0800A076:
|
||||
movs r0, 0x1
|
||||
_0800A078:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_800A064
|
||||
|
||||
thumb_func_start sub_800A07C
|
||||
sub_800A07C: @ 800A07C
|
||||
push {lr}
|
||||
movs r0, 0x4
|
||||
movs r1, 0x5
|
||||
bl sub_8009FF8
|
||||
adds r2, r0, 0
|
||||
cmp r2, 0
|
||||
blt _0800A0A4
|
||||
ldr r0, =gLinkPlayers
|
||||
lsls r1, r2, 3
|
||||
subs r1, r2
|
||||
lsls r1, 2
|
||||
adds r1, r0
|
||||
ldrh r0, [r1, 0x1A]
|
||||
cmp r0, 0x1
|
||||
bne _0800A0A4
|
||||
movs r0, 0x1
|
||||
b _0800A0A6
|
||||
.pool
|
||||
_0800A0A4:
|
||||
movs r0, 0
|
||||
_0800A0A6:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_800A07C
|
||||
|
||||
thumb_func_start sub_800A0AC
|
||||
sub_800A0AC: @ 800A0AC
|
||||
push {lr}
|
||||
ldr r0, =gUnknown_03000D5C
|
||||
movs r1, 0
|
||||
str r1, [r0]
|
||||
ldr r0, =gUnknown_020229C8
|
||||
strh r1, [r0]
|
||||
bl sub_8009734
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_800A0AC
|
||||
|
||||
thumb_func_start sub_800A0C8
|
||||
sub_800A0C8: @ 800A0C8
|
||||
push {r4-r7,lr}
|
||||
|
@ -51,6 +51,7 @@ enum LanguageId {
|
||||
LANGUAGE_GERMAN = 5,
|
||||
};
|
||||
|
||||
#define GAME_VERSION (VERSION_EMERALD)
|
||||
#define GAME_LANGUAGE (LANGUAGE_ENGLISH)
|
||||
|
||||
enum
|
||||
|
69
src/link.c
69
src/link.c
@ -101,6 +101,7 @@ u8 gUnknown_020223BC = 0;
|
||||
u8 gUnknown_020223BD = 0;
|
||||
bool8 gUnknown_020229C4 = FALSE;
|
||||
u16 gUnknown_020229C6 = 0;
|
||||
u16 gUnknown_020229C8 = 0;
|
||||
struct LinkPlayer gUnknown_020229CC = {};
|
||||
|
||||
// Static ROM declarations
|
||||
@ -131,6 +132,7 @@ void sub_800EDD4(void);
|
||||
bool32 sub_800F7E4(void);
|
||||
void sub_800F804(void);
|
||||
void Rfu_set_zero(void);
|
||||
u8 sub_80104F4(void);
|
||||
|
||||
// .rodata
|
||||
|
||||
@ -699,3 +701,70 @@ void sub_8009FAC(void)
|
||||
gUnknown_03003140 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
u8 GetLinkPlayerCount(void)
|
||||
{
|
||||
if (gLinkVSyncDisabled)
|
||||
{
|
||||
return sub_80104F4();
|
||||
}
|
||||
return EXTRACT_PLAYER_COUNT(gUnknown_030030E0);
|
||||
}
|
||||
|
||||
int sub_8009FF8(u32 version1, u32 version2)
|
||||
{
|
||||
int i;
|
||||
u8 nPlayers;
|
||||
|
||||
nPlayers = GetLinkPlayerCount();
|
||||
for (i = 0; i < nPlayers; i ++)
|
||||
{
|
||||
if ((gLinkPlayers[i].version & 0xFF) == version1 || (gLinkPlayers[i].version & 0xFF) == version2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
u32 sub_800A03C(void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
bool32 sub_800A040(void)
|
||||
{
|
||||
if (GetLinkPlayerCount() != 4 || sub_8009FF8(VERSION_RUBY, VERSION_SAPPHIRE) < 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 sub_800A064(void)
|
||||
{
|
||||
if (sub_8009FF8(VERSION_RUBY, VERSION_SAPPHIRE) >= 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 sub_800A07C(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = sub_8009FF8(VERSION_FIRE_RED, VERSION_LEAF_GREEN);
|
||||
if (i >= 0 && gLinkPlayers[i].language == LANGUAGE_JAPANESE)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_800A0AC(void)
|
||||
{
|
||||
gUnknown_03000D5C = 0;
|
||||
gUnknown_020229C8 = 0;
|
||||
sub_8009734();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user