sub_8009D90

This commit is contained in:
PikalaxALT 2017-11-09 21:48:27 -05:00
parent d94f74d261
commit 1523d5c01e
6 changed files with 80 additions and 175 deletions

View File

@ -5,173 +5,6 @@
.text
thumb_func_start sub_8009D90
sub_8009D90: @ 8009D90
push {lr}
lsls r0, 16
lsrs r2, r0, 16
ldr r0, =0x00006666
cmp r2, r0
beq _08009E60
cmp r2, r0
bgt _08009DF0
ldr r0, =0x00004444
cmp r2, r0
beq _08009E4C
cmp r2, r0
bgt _08009DCC
ldr r0, =0x00002222
cmp r2, r0
beq _08009E38
ldr r0, =0x00002ffe
_08009DB2:
cmp r2, r0
bne _08009DB8
b _08009EE4
_08009DB8:
b _08009F06
.pool
_08009DCC:
ldr r0, =0x00005566
cmp r2, r0
bne _08009DD4
b _08009EE4
_08009DD4:
cmp r2, r0
bgt _08009DE0
subs r0, 0x11
b _08009DB2
.pool
_08009DE0:
ldr r0, =0x00005fff
cmp r2, r0
bne _08009DE8
b _08009ED0
_08009DE8:
b _08009F06
.pool
_08009DF0:
ldr r0, =0x0000aaab
cmp r2, r0
beq _08009EA8
cmp r2, r0
bgt _08009E10
ldr r0, =0x00007777
cmp r2, r0
beq _08009E6C
ldr r0, =0x0000aaaa
b _08009DB2
.pool
_08009E10:
ldr r0, =0x0000cafe
cmp r2, r0
beq _08009EF0
cmp r2, r0
bgt _08009E2C
ldr r0, =0x0000bbbb
cmp r2, r0
beq _08009E8C
b _08009F06
.pool
_08009E2C:
ldr r0, =0x0000cccc
cmp r2, r0
beq _08009EBC
b _08009F06
.pool
_08009E38:
ldr r0, =gUnknown_03003110
strh r2, [r0]
ldr r1, =gUnknown_020229C6
ldrh r1, [r1]
b _08009F04
.pool
_08009E4C:
ldr r0, =gUnknown_03003110
strh r2, [r0]
ldr r1, =gMain
ldrh r1, [r1, 0x2C]
b _08009F04
.pool
_08009E60:
ldr r0, =gUnknown_03003110
movs r1, 0
b _08009F02
.pool
_08009E6C:
ldr r0, =gUnknown_03003110
strh r2, [r0]
movs r1, 0
adds r3, r0, 0
movs r2, 0xEE
_08009E76:
adds r1, 0x1
lsls r0, r1, 1
adds r0, r3
strh r2, [r0]
lsls r1, 24
lsrs r1, 24
cmp r1, 0x4
bls _08009E76
b _08009F06
.pool
_08009E8C:
ldr r1, =gUnknown_03003110
strh r2, [r1]
ldr r2, =gUnknown_03000D10
ldrh r0, [r2, 0x2]
strh r0, [r1, 0x2]
ldrb r0, [r2, 0x9]
adds r0, 0x80
strh r0, [r1, 0x4]
b _08009F06
.pool
_08009EA8:
ldr r0, =gUnknown_03003110
strh r2, [r0]
ldr r1, =gScriptItemId
ldrh r1, [r1]
b _08009F04
.pool
_08009EBC:
ldr r0, =gUnknown_03003110
strh r2, [r0]
ldr r1, =gUnknown_03003150
ldrb r1, [r1]
b _08009F04
.pool
_08009ED0:
ldr r0, =gUnknown_03003110
strh r2, [r0]
ldr r1, =gUnknown_030030F4
ldrh r1, [r1]
b _08009F04
.pool
_08009EE4:
ldr r0, =gUnknown_03003110
strh r2, [r0]
b _08009F06
.pool
_08009EF0:
ldr r0, =gUnknown_03005DA8
ldrh r1, [r0]
cmp r1, 0
beq _08009F06
ldr r0, =gUnknown_030022B4
ldrb r0, [r0]
cmp r0, 0
bne _08009F06
ldr r0, =gUnknown_03003110
_08009F02:
strh r2, [r0]
_08009F04:
strh r1, [r0, 0x2]
_08009F06:
pop {r0}
bx r0
.pool
thumb_func_end sub_8009D90
thumb_func_start sub_8009F18
sub_8009F18: @ 8009F18
push {lr}

View File

@ -5,6 +5,8 @@
// Exported RAM declarations
extern u16 gScriptItemId;
// Exported ROM declarations
void sub_81AAC50(void);
void sub_81AAC70(void);

View File

@ -46,7 +46,7 @@ extern const u8 gGameVersion;
extern const u8 gGameLanguage;
extern u16 gKeyRepeatStartDelay;
extern u8 gUnknown_030022B4;
extern bool8 gUnknown_030022B4;
extern struct Main gMain;
extern u16 gKeyRepeatContinueDelay;
extern bool8 gSoftResetDisabled;

View File

@ -51,6 +51,7 @@ void Overworld_ChangeMusicToDefault(void);
void Overworld_ChangeMusicTo(u16);
bool32 is_c1_link_related_active(void);
extern u16 gUnknown_03005DA8;
void strange_npc_table_clear(void);
const struct MapHeader *get_mapheader_by_bank_and_number(u8, u8);

View File

@ -8,6 +8,8 @@
#include "decompress.h"
#include "string_util.h"
#include "event_data.h"
#include "item_menu.h"
#include "overworld.h"
#include "gpu_regs.h"
#include "palette.h"
#include "task.h"
@ -572,3 +574,70 @@ static void sub_8009AA0(u8 unused)
}
}
}
void sub_8009D90(u16 command)
{
switch (command)
{
case 0x2222:
gUnknown_03003110[0] = 0x2222;
gUnknown_03003110[1] = gUnknown_020229C6;
break;
case 0x2ffe:
gUnknown_03003110[0] = 0x2ffe;
break;
case 0x4444:
gUnknown_03003110[0] = 0x4444;
gUnknown_03003110[1] = gMain.heldKeys;
break;
case 0x5555:
gUnknown_03003110[0] = 0x5555;
break;
case 0x6666:
gUnknown_03003110[0] = 0x6666;
gUnknown_03003110[1] = 0;
break;
case 0x7777:
{
u8 i;
gUnknown_03003110[0] = 0x7777;
for (i = 0; i < 5; i ++)
{
gUnknown_03003110[i + 1] = 0xEE;
}
break;
}
case 0xbbbb:
gUnknown_03003110[0] = 0xbbbb;
gUnknown_03003110[1] = gUnknown_03000D10.size;
gUnknown_03003110[2] = gUnknown_03000D10.multiplayerId + 0x80;
break;
case 0xaaaa:
gUnknown_03003110[0] = 0xaaaa;
break;
case 0xaaab:
gUnknown_03003110[0] = 0xaaab;
gUnknown_03003110[1] = gScriptItemId;
break;
case 0xcccc:
gUnknown_03003110[0] = 0xcccc;
gUnknown_03003110[1] = gUnknown_03003150;
break;
case 0x5fff:
gUnknown_03003110[0] = 0x5fff;
gUnknown_03003110[1] = gUnknown_030030F4;
break;
case 0x5566:
gUnknown_03003110[0] = 0x5566;
break;
case 0xcafe:
if (gUnknown_03005DA8 == 0 || gUnknown_030022B4)
{
break;
}
gUnknown_03003110[0] = 0xcafe;
gUnknown_03003110[1] = gUnknown_03005DA8;
break;
}
}

View File

@ -80,7 +80,7 @@ const IntrFunc gIntrTableTemplate[] =
static u16 gUnknown_03000000;
u16 gKeyRepeatStartDelay;
u8 gUnknown_030022B4;
bool8 gUnknown_030022B4;
struct Main gMain;
u16 gKeyRepeatContinueDelay;
bool8 gSoftResetDisabled;
@ -129,7 +129,7 @@ void AgbMain()
if (gFlashMemoryPresent != TRUE)
SetMainCallback2(NULL);
gUnknown_030022B4 = 0;
gUnknown_030022B4 = FALSE;
gUnknown_03000000 = 0xFC0;
for (;;)
@ -147,22 +147,22 @@ void AgbMain()
if (sub_8087634() == 1)
{
gUnknown_030022B4 = 1;
gUnknown_030022B4 = TRUE;
UpdateLinkAndCallCallbacks();
gUnknown_030022B4 = 0;
gUnknown_030022B4 = FALSE;
}
else
{
gUnknown_030022B4 = 0;
gUnknown_030022B4 = FALSE;
UpdateLinkAndCallCallbacks();
if (sub_80875C8() == 1)
{
gMain.newKeys = 0;
ClearSpriteCopyRequests();
gUnknown_030022B4 = 1;
gUnknown_030022B4 = TRUE;
UpdateLinkAndCallCallbacks();
gUnknown_030022B4 = 0;
gUnknown_030022B4 = FALSE;
}
}