mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 15:13:42 +01:00
through sub_8009818
This commit is contained in:
parent
d5547a3744
commit
e68dbd6276
152
asm/link.s
152
asm/link.s
@ -5,130 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_80097E8
|
||||
sub_80097E8: @ 80097E8
|
||||
push {r4,lr}
|
||||
ldr r0, =gReceivedRemoteLinkPlayers
|
||||
movs r4, 0
|
||||
strb r4, [r0]
|
||||
ldr r0, =gLinkVSyncDisabled
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _080097FC
|
||||
bl sub_800EDD4
|
||||
_080097FC:
|
||||
ldr r0, =gUnknown_020229C4
|
||||
strb r4, [r0]
|
||||
bl sub_800B53C
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80097E8
|
||||
|
||||
thumb_func_start sub_8009818
|
||||
sub_8009818: @ 8009818
|
||||
push {r4-r7,lr}
|
||||
mov r7, r9
|
||||
mov r6, r8
|
||||
push {r6,r7}
|
||||
ldr r5, =gUnknown_03000D64
|
||||
ldr r4, =gUnknown_03000D10
|
||||
ldrb r0, [r5]
|
||||
ldrh r1, [r4]
|
||||
cmp r0, r1
|
||||
beq _0800983C
|
||||
ldrh r0, [r4]
|
||||
movs r1, 0x2
|
||||
movs r2, 0x3
|
||||
movs r3, 0x2
|
||||
bl sub_800A6E8
|
||||
ldrh r0, [r4]
|
||||
strb r0, [r5]
|
||||
_0800983C:
|
||||
movs r5, 0
|
||||
ldr r7, =gUnknown_03000D20
|
||||
_08009840:
|
||||
ldr r0, =gUnknown_03000D68
|
||||
adds r6, r5, r0
|
||||
lsls r0, r5, 1
|
||||
adds r0, r5
|
||||
lsls r0, 2
|
||||
adds r4, r0, r7
|
||||
ldrb r0, [r6]
|
||||
ldrh r1, [r4]
|
||||
cmp r0, r1
|
||||
beq _08009868
|
||||
ldrh r0, [r4]
|
||||
adds r2, r5, 0x4
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
movs r1, 0x2
|
||||
movs r3, 0x2
|
||||
bl sub_800A6E8
|
||||
ldrh r0, [r4]
|
||||
strb r0, [r6]
|
||||
_08009868:
|
||||
adds r0, r5, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
cmp r5, 0x3
|
||||
bls _08009840
|
||||
bl GetBlockReceivedStatus
|
||||
lsls r0, 24
|
||||
lsrs r7, r0, 24
|
||||
cmp r7, 0xF
|
||||
bne _080098CE
|
||||
movs r5, 0
|
||||
ldr r0, =gUnknown_03000D20
|
||||
mov r9, r0
|
||||
ldr r1, =0x00000342
|
||||
mov r8, r1
|
||||
_08009888:
|
||||
adds r0, r7, 0
|
||||
asrs r0, r5
|
||||
movs r1, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _080098C4
|
||||
lsls r0, r5, 8
|
||||
ldr r1, =gBlockRecvBuffer
|
||||
adds r0, r1
|
||||
lsls r4, r5, 1
|
||||
adds r1, r4, r5
|
||||
lsls r1, 2
|
||||
add r1, r9
|
||||
ldrh r1, [r1, 0x2]
|
||||
bl sub_800A648
|
||||
ldr r1, =gUnknown_03003148
|
||||
adds r4, r1
|
||||
movs r6, 0
|
||||
strh r0, [r4]
|
||||
adds r0, r5, 0
|
||||
bl ResetBlockReceivedFlag
|
||||
ldrh r0, [r4]
|
||||
cmp r0, r8
|
||||
beq _080098C4
|
||||
ldr r0, =gUnknown_020223BC
|
||||
strb r6, [r0]
|
||||
ldr r0, =gUnknown_020223BD
|
||||
strb r6, [r0]
|
||||
_080098C4:
|
||||
adds r0, r5, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
cmp r5, 0x3
|
||||
bls _08009888
|
||||
_080098CE:
|
||||
pop {r3,r4}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8009818
|
||||
|
||||
thumb_func_start sub_8009900
|
||||
sub_8009900: @ 8009900
|
||||
push {r4,r5,lr}
|
||||
@ -4258,7 +4134,7 @@ _0800BAFC:
|
||||
_0800BB00:
|
||||
adds r0, r2, 0
|
||||
strh r0, [r1]
|
||||
ldr r2, =gUnknown_03003174
|
||||
ldr r2, =gUnknown_03003170+0x4
|
||||
ldr r3, =0x04000120
|
||||
ldr r0, [r3]
|
||||
ldr r1, [r3, 0x4]
|
||||
@ -12005,12 +11881,12 @@ _0800F920:
|
||||
beq _0800F930
|
||||
b _0800FC08
|
||||
_0800F930:
|
||||
ldr r1, =gUnknown_03003092
|
||||
ldr r1, =gUnknown_03003090+0x2
|
||||
adds r0, r5, r1
|
||||
ldrh r0, [r0]
|
||||
ldr r2, =gUnknown_03005000
|
||||
strb r0, [r2, 0xD]
|
||||
ldr r3, =gUnknown_03003094
|
||||
ldr r3, =gUnknown_03003090+0x4
|
||||
adds r0, r5, r3
|
||||
bl sub_800F74C
|
||||
ldr r4, =gUnknown_03005CCE
|
||||
@ -12040,13 +11916,13 @@ _0800F982:
|
||||
adds r0, 0x80
|
||||
movs r2, 0
|
||||
strh r4, [r0]
|
||||
ldr r1, =gUnknown_03003092
|
||||
ldr r1, =gUnknown_03003090+0x2
|
||||
adds r0, r5, r1
|
||||
ldrh r0, [r0]
|
||||
adds r1, r3, 0
|
||||
adds r1, 0x82
|
||||
strh r0, [r1]
|
||||
ldr r1, =gUnknown_03003094
|
||||
ldr r1, =gUnknown_03003090+0x4
|
||||
adds r0, r5, r1
|
||||
ldrh r1, [r0]
|
||||
adds r0, r3, 0
|
||||
@ -12176,7 +12052,7 @@ _0800FA90:
|
||||
.pool
|
||||
_0800FAAC:
|
||||
ldr r2, =gUnknown_082ED6B8
|
||||
ldr r3, =gUnknown_03003092
|
||||
ldr r3, =gUnknown_03003090+0x2
|
||||
adds r0, r5, r3
|
||||
ldrh r1, [r0]
|
||||
lsls r1, 3
|
||||
@ -12200,7 +12076,7 @@ _0800FAE0:
|
||||
movs r4, 0x80
|
||||
lsls r4, 1
|
||||
adds r0, r2, r4
|
||||
ldr r3, =gUnknown_03003092
|
||||
ldr r3, =gUnknown_03003090+0x2
|
||||
adds r1, r5, r3
|
||||
ldrh r0, [r0]
|
||||
mov r6, r8
|
||||
@ -12228,7 +12104,7 @@ _0800FB10:
|
||||
adds r6, 0x1
|
||||
cmp r0, 0
|
||||
beq _0800FC08
|
||||
ldr r0, =gUnknown_03003092
|
||||
ldr r0, =gUnknown_03003090+0x2
|
||||
adds r4, r5, r0
|
||||
ldrh r1, [r4]
|
||||
ldr r0, =gUnknown_03007890
|
||||
@ -12239,7 +12115,7 @@ _0800FB10:
|
||||
beq _0800FB48
|
||||
strb r2, [r3]
|
||||
bl sub_800D630
|
||||
ldr r1, =gUnknown_03003094
|
||||
ldr r1, =gUnknown_03003090+0x4
|
||||
adds r0, r5, r1
|
||||
ldrh r1, [r0]
|
||||
ldr r2, =0x00000ce4
|
||||
@ -12260,11 +12136,11 @@ _0800FB78:
|
||||
lsls r0, 8
|
||||
bl sub_800FD14
|
||||
ldr r1, =gUnknown_03003110
|
||||
ldr r3, =gUnknown_03003092
|
||||
ldr r3, =gUnknown_03003090+0x2
|
||||
adds r0, r5, r3
|
||||
ldrh r0, [r0]
|
||||
strh r0, [r1, 0x2]
|
||||
ldr r4, =gUnknown_03003094
|
||||
ldr r4, =gUnknown_03003090+0x4
|
||||
adds r0, r5, r4
|
||||
ldrh r0, [r0]
|
||||
strh r0, [r1, 0x4]
|
||||
@ -12284,13 +12160,13 @@ _0800FBB0:
|
||||
bne _0800FC44
|
||||
ldr r0, =0x00000ce3
|
||||
adds r2, r4, r0
|
||||
ldr r1, =gUnknown_03003092
|
||||
ldr r1, =gUnknown_03003090+0x2
|
||||
adds r3, r5, r1
|
||||
ldrb r1, [r3]
|
||||
ldrb r0, [r2]
|
||||
orrs r0, r1
|
||||
strb r0, [r2]
|
||||
ldr r2, =gUnknown_03003094
|
||||
ldr r2, =gUnknown_03003090+0x4
|
||||
adds r0, r5, r2
|
||||
ldrh r1, [r0]
|
||||
ldr r2, =0x00000ce4
|
||||
@ -12305,7 +12181,7 @@ _0800FBF4:
|
||||
mov r3, r8
|
||||
lsls r1, r3, 1
|
||||
adds r1, r0
|
||||
ldr r4, =gUnknown_03003092
|
||||
ldr r4, =gUnknown_03003090+0x2
|
||||
adds r0, r5, r4
|
||||
ldrh r0, [r0]
|
||||
strh r0, [r1]
|
||||
|
@ -28090,7 +28090,7 @@ sub_81D4E60: @ 81D4E60
|
||||
strh r0, [r1]
|
||||
movs r0, 0
|
||||
strh r0, [r2]
|
||||
ldr r0, =gUnknown_03003174
|
||||
ldr r0, =gUnknown_03003170+0x4
|
||||
ldr r1, [r0, 0x4]
|
||||
ldr r0, [r0]
|
||||
str r0, [sp, 0x4]
|
||||
|
@ -197,17 +197,31 @@ void sub_800AC34(void);
|
||||
void sub_800B628(void);
|
||||
void sub_80097E8(void);
|
||||
|
||||
extern IWRAM_DATA u8 gUnknown_0300306C;
|
||||
extern IWRAM_DATA u8 gUnknown_03003078[4];
|
||||
extern IWRAM_DATA u8 gUnknown_030030E4;
|
||||
extern IWRAM_DATA u8 gUnknown_030030E8;
|
||||
extern IWRAM_DATA u8 gUnknown_030030EC[4];
|
||||
extern IWRAM_DATA u8 gUnknown_030030F0[4];
|
||||
extern IWRAM_DATA u16 gUnknown_030030F4;
|
||||
extern IWRAM_DATA u8 gUnknown_030030F8;
|
||||
extern IWRAM_DATA u16 gUnknown_03003110[8];
|
||||
extern IWRAM_DATA struct LinkTestBGInfo gUnknown_03003130; // common
|
||||
extern IWRAM_DATA void (*gUnknown_03003140)(void);
|
||||
extern IWRAM_DATA bool8 gUnknown_03003144;
|
||||
extern u16 gUnknown_03003020[6];
|
||||
extern u32 gUnknown_0300302C;
|
||||
extern struct LinkPlayerBlock gUnknown_03003030;
|
||||
extern bool8 gUnknown_0300306C;
|
||||
extern u32 gUnknown_03003070;
|
||||
extern bool8 gUnknown_03003078[4];
|
||||
extern u8 gUnknown_0300307C[4];
|
||||
extern u16 gUnknown_03003084;
|
||||
extern u16 gUnknown_03003090[4][8];
|
||||
extern u32 gUnknown_030030E0;
|
||||
extern u8 gUnknown_030030E4;
|
||||
extern u8 gUnknown_030030E8;
|
||||
extern u8 gUnknown_030030EC[4];
|
||||
extern u8 gUnknown_030030F0[4];
|
||||
extern u16 gUnknown_030030F4;
|
||||
extern u8 gUnknown_030030F8;
|
||||
extern bool8 gLinkVSyncDisabled;
|
||||
extern bool8 gUnknown_03003100;
|
||||
extern u16 gUnknown_03003110[8];
|
||||
extern u8 gUnknown_03003120;
|
||||
extern struct LinkTestBGInfo gUnknown_03003130;
|
||||
extern void (*gUnknown_03003140)(void);
|
||||
extern bool8 gUnknown_03003144;
|
||||
extern u16 gUnknown_03003148[4];
|
||||
extern u8 gUnknown_03003150;
|
||||
extern u8 gUnknown_03003160;
|
||||
|
||||
#endif // GUARD_LINK_H
|
||||
|
@ -42,17 +42,14 @@ struct Main
|
||||
/*0x439*/ u8 field_439_x4:1;
|
||||
};
|
||||
|
||||
extern u8 gUnknown_3001764;
|
||||
extern struct Main gMain;
|
||||
extern bool8 gSoftResetDisabled;
|
||||
extern bool8 gLinkVSyncDisabled;
|
||||
|
||||
extern const u8 gGameVersion;
|
||||
extern const u8 gGameLanguage;
|
||||
|
||||
extern u16 gKeyRepeatStartDelay;
|
||||
extern u8 gUnknown_030022B4;
|
||||
extern struct Main gMain;
|
||||
extern u16 gKeyRepeatContinueDelay;
|
||||
extern bool8 gSoftResetDisabled;
|
||||
extern IntrFunc gIntrTable[];
|
||||
extern u8 gUnknown_03002748;
|
||||
extern u32 IntrMain_Buffer[];
|
||||
|
84
src/link.c
84
src/link.c
@ -57,7 +57,37 @@ IWRAM_DATA void *gUnknown_03000DA8;
|
||||
IWRAM_DATA void *gUnknown_03000DAC;
|
||||
IWRAM_DATA bool32 gUnknown_03000DB0;
|
||||
|
||||
bool8 gUnknown_020229C4 = 0;
|
||||
u16 gUnknown_03003020[6];
|
||||
u32 gUnknown_0300302C;
|
||||
struct LinkPlayerBlock gUnknown_03003030;
|
||||
bool8 gUnknown_0300306C;
|
||||
u32 gUnknown_03003070;
|
||||
bool8 gUnknown_03003078[4];
|
||||
u8 gUnknown_0300307C[4];
|
||||
u16 gUnknown_03003084;
|
||||
u16 gUnknown_03003090[4][8];
|
||||
u32 gUnknown_030030E0;
|
||||
u8 gUnknown_030030E4;
|
||||
bool8 gUnknown_030030E8;
|
||||
u8 gUnknown_030030EC[4];
|
||||
u8 gUnknown_030030F0[4];
|
||||
u16 gUnknown_030030F4;
|
||||
u8 gUnknown_030030F8;
|
||||
bool8 gLinkVSyncDisabled;
|
||||
bool8 gUnknown_03003100;
|
||||
u16 gUnknown_03003110[8];
|
||||
u8 gUnknown_03003120;
|
||||
bool8 gReceivedRemoteLinkPlayers;
|
||||
struct LinkTestBGInfo gUnknown_03003130;
|
||||
void (*gUnknown_03003140)(void);
|
||||
bool8 gUnknown_03003144;
|
||||
u16 gUnknown_03003148[4];
|
||||
u8 gUnknown_03003150;
|
||||
u8 gUnknown_03003160;
|
||||
|
||||
u8 gUnknown_020223BC = 0;
|
||||
u8 gUnknown_020223BD = 0;
|
||||
bool8 gUnknown_020229C4 = FALSE;
|
||||
u16 gUnknown_020229C6 = 0;
|
||||
struct LinkPlayer gUnknown_020229CC = {};
|
||||
|
||||
@ -68,11 +98,15 @@ void sub_80096BC(void);
|
||||
void c2_08009A8C(void);
|
||||
void sub_800A2E0(void);
|
||||
void task00_link_test(u8 taskId);
|
||||
u16 sub_800A648(u16 *src, u16 size);
|
||||
void sub_800A6E8(u32 pos, u8 a0, u8 a1, u8 a2);
|
||||
void sub_800A824(void);
|
||||
void sub_800B594(void);
|
||||
void sub_800B4A4(void);
|
||||
void sub_800B53C(void);
|
||||
u32 sub_800BEC0(void);
|
||||
void sub_800E700(void);
|
||||
void sub_800EDD4(void);
|
||||
|
||||
// .rodata
|
||||
|
||||
@ -266,3 +300,51 @@ void sub_8009734(void)
|
||||
gUnknown_030030EC[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80097E8(void)
|
||||
{
|
||||
gReceivedRemoteLinkPlayers = FALSE;
|
||||
if (gLinkVSyncDisabled)
|
||||
{
|
||||
sub_800EDD4();
|
||||
}
|
||||
gUnknown_020229C4 = FALSE;
|
||||
sub_800B53C();
|
||||
}
|
||||
|
||||
void sub_8009818(void)
|
||||
{
|
||||
u8 i;
|
||||
u8 status;
|
||||
|
||||
if (gUnknown_03000D64 != gUnknown_03000D10.pos)
|
||||
{
|
||||
sub_800A6E8(gUnknown_03000D10.pos, 2, 3, 2);
|
||||
gUnknown_03000D64 = gUnknown_03000D10.pos;
|
||||
}
|
||||
for (i = 0; i < 4; i ++)
|
||||
{
|
||||
if (gUnknown_03000D68[i] != gUnknown_03000D20[i].pos)
|
||||
{
|
||||
sub_800A6E8(gUnknown_03000D20[i].pos, 2, i + 4, 2);
|
||||
gUnknown_03000D68[i] = gUnknown_03000D20[i].pos;
|
||||
}
|
||||
}
|
||||
status = GetBlockReceivedStatus();
|
||||
if (status == 0xF) // 0b1111
|
||||
{
|
||||
for (i = 0; i < 4; i ++)
|
||||
{
|
||||
if ((status >> i) & 1)
|
||||
{
|
||||
gUnknown_03003148[i] = sub_800A648(gBlockRecvBuffer[i], gUnknown_03000D20[i].size);
|
||||
ResetBlockReceivedFlag(i);
|
||||
if (gUnknown_03003148[i] != 0x0342)
|
||||
{
|
||||
gUnknown_020223BC = 0;
|
||||
gUnknown_020223BD = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "main.h"
|
||||
#include "link.h"
|
||||
#include "m4a.h"
|
||||
#include "rtc.h"
|
||||
#include "rng.h"
|
||||
|
@ -37,13 +37,7 @@ gUnknown_03003084: @ 3003084
|
||||
.space 0xC
|
||||
|
||||
gUnknown_03003090: @ 3003090
|
||||
.space 0x2
|
||||
|
||||
gUnknown_03003092: @ 3003092
|
||||
.space 0x2
|
||||
|
||||
gUnknown_03003094: @ 3003094
|
||||
.space 0x4C
|
||||
.space 0x50
|
||||
|
||||
gUnknown_030030E0: @ 30030E0
|
||||
.space 0x4
|
||||
@ -100,10 +94,7 @@ gUnknown_03003160: @ 3003160
|
||||
.space 0x10
|
||||
|
||||
gUnknown_03003170: @ 3003170
|
||||
.space 0x4
|
||||
|
||||
gUnknown_03003174: @ 3003174
|
||||
.space 0xFBC
|
||||
.space 0xFC0
|
||||
|
||||
gUnknown_03004130: @ 3004130
|
||||
.space 0x4
|
||||
|
Loading…
x
Reference in New Issue
Block a user