mirror of
https://github.com/pret/pmd-red.git
synced 2024-11-23 13:09:56 +00:00
some more work on decomping funcs
This commit is contained in:
parent
2832112389
commit
db6ed3e526
@ -5,241 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_8098E18
|
||||
sub_8098E18:
|
||||
push {r4-r6,lr}
|
||||
adds r6, r1, 0
|
||||
lsls r0, 16
|
||||
asrs r2, r0, 16
|
||||
adds r5, r2, 0
|
||||
ldr r4, _08098E40
|
||||
ldr r0, [r4]
|
||||
cmp r0, 0
|
||||
bne _08098EA8
|
||||
ldr r1, _08098E44
|
||||
movs r0, 0
|
||||
adds r3, r6, 0
|
||||
bl Log
|
||||
ldr r0, _08098E48
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08098E4C
|
||||
movs r0, 0x7
|
||||
b _08098E8A
|
||||
.align 2, 0
|
||||
_08098E40: .4byte gUnknown_20398A8
|
||||
_08098E44: .4byte gUnknown_8115F80
|
||||
_08098E48: .4byte gUnknown_203B49D
|
||||
_08098E4C:
|
||||
ldr r0, _08098E74
|
||||
ldrb r0, [r0]
|
||||
ldr r1, _08098E78
|
||||
cmp r0, 0
|
||||
bne _08098E58
|
||||
strh r5, [r1]
|
||||
_08098E58:
|
||||
movs r2, 0
|
||||
ldrsh r0, [r1, r2]
|
||||
bl sub_80A2750
|
||||
lsls r0, 16
|
||||
asrs r0, 16
|
||||
cmp r0, 0x2
|
||||
beq _08098E88
|
||||
cmp r0, 0x2
|
||||
bgt _08098E7C
|
||||
cmp r0, 0x1
|
||||
beq _08098E84
|
||||
b _08098E8C
|
||||
.align 2, 0
|
||||
_08098E74: .4byte gUnknown_203B49C
|
||||
_08098E78: .4byte gUnknown_20398C4
|
||||
_08098E7C:
|
||||
cmp r0, 0x4
|
||||
bne _08098E8C
|
||||
movs r0, 0x8
|
||||
b _08098E8A
|
||||
_08098E84:
|
||||
movs r0, 0x5
|
||||
b _08098E8A
|
||||
_08098E88:
|
||||
movs r0, 0x6
|
||||
_08098E8A:
|
||||
str r0, [r4]
|
||||
_08098E8C:
|
||||
ldr r0, _08098EA0
|
||||
movs r1, 0x1
|
||||
str r1, [r0]
|
||||
ldr r0, _08098EA4
|
||||
str r6, [r0]
|
||||
bl sub_809C730
|
||||
movs r0, 0x1
|
||||
b _08098EAA
|
||||
.align 2, 0
|
||||
_08098EA0: .4byte gUnknown_20398AC
|
||||
_08098EA4: .4byte gUnknown_20398B0
|
||||
_08098EA8:
|
||||
movs r0, 0
|
||||
_08098EAA:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8098E18
|
||||
|
||||
thumb_func_start sub_8098EB0
|
||||
sub_8098EB0:
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r5, _08098EE4
|
||||
ldr r0, [r5]
|
||||
cmp r0, 0
|
||||
bne _08098EF8
|
||||
ldr r0, _08098EE8
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08098EF8
|
||||
ldr r1, _08098EEC
|
||||
movs r0, 0
|
||||
adds r2, r4, 0
|
||||
bl Log
|
||||
movs r0, 0x7
|
||||
str r0, [r5]
|
||||
ldr r1, _08098EF0
|
||||
movs r0, 0x1
|
||||
str r0, [r1]
|
||||
ldr r0, _08098EF4
|
||||
str r4, [r0]
|
||||
bl sub_809C730
|
||||
movs r0, 0x1
|
||||
b _08098EFA
|
||||
.align 2, 0
|
||||
_08098EE4: .4byte gUnknown_20398A8
|
||||
_08098EE8: .4byte gUnknown_203B49D
|
||||
_08098EEC: .4byte gUnknown_8115FA4
|
||||
_08098EF0: .4byte gUnknown_20398AC
|
||||
_08098EF4: .4byte gUnknown_20398B0
|
||||
_08098EF8:
|
||||
movs r0, 0
|
||||
_08098EFA:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8098EB0
|
||||
|
||||
thumb_func_start sub_8098F00
|
||||
sub_8098F00:
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r5, _08098F10
|
||||
ldr r0, [r5]
|
||||
cmp r0, 0
|
||||
beq _08098F14
|
||||
movs r0, 0
|
||||
b _08098F32
|
||||
.align 2, 0
|
||||
_08098F10: .4byte gUnknown_20398A8
|
||||
_08098F14:
|
||||
ldr r1, _08098F38
|
||||
movs r0, 0
|
||||
adds r2, r4, 0
|
||||
bl Log
|
||||
movs r0, 0x9
|
||||
str r0, [r5]
|
||||
ldr r1, _08098F3C
|
||||
movs r0, 0x1
|
||||
str r0, [r1]
|
||||
ldr r0, _08098F40
|
||||
str r4, [r0]
|
||||
bl sub_809C730
|
||||
movs r0, 0x1
|
||||
_08098F32:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_08098F38: .4byte gUnknown_8115FC8
|
||||
_08098F3C: .4byte gUnknown_20398AC
|
||||
_08098F40: .4byte gUnknown_20398B0
|
||||
thumb_func_end sub_8098F00
|
||||
|
||||
thumb_func_start sub_8098F44
|
||||
sub_8098F44:
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r5, _08098F54
|
||||
ldr r0, [r5]
|
||||
cmp r0, 0
|
||||
beq _08098F58
|
||||
movs r0, 0
|
||||
b _08098F76
|
||||
.align 2, 0
|
||||
_08098F54: .4byte gUnknown_20398A8
|
||||
_08098F58:
|
||||
ldr r1, _08098F7C
|
||||
movs r0, 0
|
||||
adds r2, r4, 0
|
||||
bl Log
|
||||
movs r0, 0xA
|
||||
str r0, [r5]
|
||||
ldr r1, _08098F80
|
||||
movs r0, 0x1
|
||||
str r0, [r1]
|
||||
ldr r0, _08098F84
|
||||
str r4, [r0]
|
||||
bl sub_809C730
|
||||
movs r0, 0x1
|
||||
_08098F76:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_08098F7C: .4byte gUnknown_8115FE8
|
||||
_08098F80: .4byte gUnknown_20398AC
|
||||
_08098F84: .4byte gUnknown_20398B0
|
||||
thumb_func_end sub_8098F44
|
||||
|
||||
thumb_func_start sub_8098F88
|
||||
sub_8098F88:
|
||||
ldr r0, _08098F90
|
||||
ldrb r0, [r0]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_08098F90: .4byte gUnknown_20398B9
|
||||
thumb_func_end sub_8098F88
|
||||
|
||||
thumb_func_start sub_8098F94
|
||||
sub_8098F94:
|
||||
ldr r0, _08098F9C
|
||||
ldrb r0, [r0]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_08098F9C: .4byte gUnknown_20398BA
|
||||
thumb_func_end sub_8098F94
|
||||
|
||||
thumb_func_start sub_8098FA0
|
||||
sub_8098FA0:
|
||||
push {lr}
|
||||
movs r0, 0
|
||||
movs r1, 0x11
|
||||
bl sub_8001658
|
||||
lsls r0, 16
|
||||
asrs r0, 16
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8098FA0
|
||||
|
||||
thumb_func_start sub_8098FB4
|
||||
sub_8098FB4:
|
||||
push {lr}
|
||||
movs r0, 0
|
||||
movs r1, 0x11
|
||||
bl sub_8001658
|
||||
lsls r0, 16
|
||||
asrs r0, 16
|
||||
bl sub_80A2B18
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8098FB4
|
||||
|
||||
thumb_func_start sub_8098FCC
|
||||
sub_8098FCC:
|
||||
push {r4,lr}
|
||||
|
@ -10035,17 +10035,4 @@ _080A26B4:
|
||||
bx r1
|
||||
thumb_func_end sub_80A2688
|
||||
|
||||
thumb_func_start sub_80A26B8
|
||||
sub_80A26B8:
|
||||
lsls r0, 16
|
||||
ldr r1, _080A26C8
|
||||
asrs r0, 15
|
||||
adds r0, r1
|
||||
movs r1, 0
|
||||
ldrsh r0, [r0, r1]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_080A26C8: .4byte gUnknown_8116F9A
|
||||
thumb_func_end sub_80A26B8
|
||||
|
||||
.align 2,0
|
||||
|
@ -3,12 +3,22 @@
|
||||
|
||||
extern struct PlayTimeStruct *gUnknown_203B47C;
|
||||
extern u32 gUnknown_20398A8;
|
||||
extern u32 gUnknown_8115F5C;
|
||||
extern u32 gUnknown_20398AC;
|
||||
extern u32 gUnknown_20398B0;
|
||||
extern u32 gUnknown_20398B4;
|
||||
extern u8 gUnknown_20398B9;
|
||||
extern u8 gUnknown_20398BA;
|
||||
extern u32 gUnknown_20398C0;
|
||||
extern s16 gUnknown_20398C4;
|
||||
extern u16 gUnknown_20398BE;
|
||||
extern u8 gUnknown_203B49D;
|
||||
extern u8 gUnknown_203B49C;
|
||||
|
||||
extern u32 gUnknown_8115F5C;
|
||||
extern u32 gUnknown_8115F80;
|
||||
extern u32 gUnknown_8115FA4;
|
||||
extern u32 gUnknown_8115FC8;
|
||||
extern u32 gUnknown_8115FE8;
|
||||
|
||||
extern void Log(u32, u32*, s32, u32);
|
||||
|
||||
@ -22,7 +32,6 @@ extern void sub_80A6E80();
|
||||
extern void sub_8099BE4();
|
||||
extern void sub_8099744();
|
||||
extern void sub_8011860();
|
||||
extern void IncrementPlayTime(struct PlayTimeStruct *Time);
|
||||
extern void sub_800CB20();
|
||||
extern void sub_800485C();
|
||||
extern void nullsub_120();
|
||||
@ -51,12 +60,13 @@ extern void sub_8098CC8();
|
||||
extern void sub_809674C();
|
||||
extern void sub_80961B4();
|
||||
extern void sub_8091FB4();
|
||||
extern s32 sub_80A2B18(s16);
|
||||
extern u8 sub_8001CC4(u8, u8, u8);
|
||||
extern void sub_8091980(u32);
|
||||
|
||||
extern u8 sub_80023E4(u32);
|
||||
extern void sub_80118C4(u16);
|
||||
extern void sub_809C730();
|
||||
extern u8 sub_809C730();
|
||||
|
||||
void sub_8098BDC(void)
|
||||
{
|
||||
@ -214,3 +224,212 @@ bool8 sub_8098DCC(u32 r0)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef NONMATCHING
|
||||
NAKED
|
||||
#endif
|
||||
bool8 sub_8098E18(s16 r0, u32 r1, u32 r2)
|
||||
{
|
||||
#ifdef NONMATCHING
|
||||
// Had to nonmatch because the prologue statements of add/lsls/lsrs didn't match
|
||||
s32 temp;
|
||||
s16 return_var;
|
||||
temp = r0;
|
||||
if(gUnknown_20398A8 == 0)
|
||||
{
|
||||
Log(0, &gUnknown_8115F80, temp, r2);
|
||||
if(gUnknown_203B49D != 0)
|
||||
{
|
||||
gUnknown_20398A8 = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(gUnknown_203B49C == 0)
|
||||
{
|
||||
gUnknown_20398C4 = r2;
|
||||
}
|
||||
return_var = sub_80A2750(gUnknown_20398C4);
|
||||
// TODO so ugly but it works.. nested if statements aren't my thing in decomping
|
||||
if(return_var == 2)
|
||||
{
|
||||
goto _08098E88;
|
||||
}
|
||||
if(return_var > 2)
|
||||
{
|
||||
goto _08098E7C;
|
||||
}
|
||||
if(return_var == 1)
|
||||
{
|
||||
goto _08098E84;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto _08098E8C;
|
||||
}
|
||||
_08098E7C:
|
||||
if(return_var == 4)
|
||||
{
|
||||
gUnknown_20398A8 = 8;
|
||||
goto _08098E8C;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto _08098E8C;
|
||||
}
|
||||
_08098E84:
|
||||
gUnknown_20398A8 = 5;
|
||||
goto _08098E8C;
|
||||
_08098E88:
|
||||
gUnknown_20398A8 = 6;
|
||||
}
|
||||
_08098E8C:
|
||||
gUnknown_20398AC = 1;
|
||||
gUnknown_20398B0 = r1;
|
||||
sub_809C730();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
#else
|
||||
asm_unified("\tpush {r4-r6,lr}\n"
|
||||
"\tadds r6, r1, 0\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tasrs r2, r0, 16\n"
|
||||
"\tadds r5, r2, 0\n"
|
||||
"\tldr r4, _08098E40\n"
|
||||
"\tldr r0, [r4]\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbne _08098EA8\n"
|
||||
"\tldr r1, _08098E44\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tadds r3, r6, 0\n"
|
||||
"\tbl Log\n"
|
||||
"\tldr r0, _08098E48\n"
|
||||
"\tldrb r0, [r0]\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbeq _08098E4C\n"
|
||||
"\tmovs r0, 0x7\n"
|
||||
"\tb _08098E8A\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_08098E40: .4byte gUnknown_20398A8\n"
|
||||
"_08098E44: .4byte gUnknown_8115F80\n"
|
||||
"_08098E48: .4byte gUnknown_203B49D\n"
|
||||
"_08098E4C:\n"
|
||||
"\tldr r0, _08098E74\n"
|
||||
"\tldrb r0, [r0]\n"
|
||||
"\tldr r1, _08098E78\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbne _08098E58\n"
|
||||
"\tstrh r5, [r1]\n"
|
||||
"_08098E58:\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tldrsh r0, [r1, r2]\n"
|
||||
"\tbl sub_80A2750\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tasrs r0, 16\n"
|
||||
"\tcmp r0, 0x2\n"
|
||||
"\tbeq _08098E88\n"
|
||||
"\tcmp r0, 0x2\n"
|
||||
"\tbgt _08098E7C\n"
|
||||
"\tcmp r0, 0x1\n"
|
||||
"\tbeq _08098E84\n"
|
||||
"\tb _08098E8C\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_08098E74: .4byte gUnknown_203B49C\n"
|
||||
"_08098E78: .4byte gUnknown_20398C4\n"
|
||||
"_08098E7C:\n"
|
||||
"\tcmp r0, 0x4\n"
|
||||
"\tbne _08098E8C\n"
|
||||
"\tmovs r0, 0x8\n"
|
||||
"\tb _08098E8A\n"
|
||||
"_08098E84:\n"
|
||||
"\tmovs r0, 0x5\n"
|
||||
"\tb _08098E8A\n"
|
||||
"_08098E88:\n"
|
||||
"\tmovs r0, 0x6\n"
|
||||
"_08098E8A:\n"
|
||||
"\tstr r0, [r4]\n"
|
||||
"_08098E8C:\n"
|
||||
"\tldr r0, _08098EA0\n"
|
||||
"\tmovs r1, 0x1\n"
|
||||
"\tstr r1, [r0]\n"
|
||||
"\tldr r0, _08098EA4\n"
|
||||
"\tstr r6, [r0]\n"
|
||||
"\tbl sub_809C730\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"\tb _08098EAA\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_08098EA0: .4byte gUnknown_20398AC\n"
|
||||
"_08098EA4: .4byte gUnknown_20398B0\n"
|
||||
"_08098EA8:\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"_08098EAA:\n"
|
||||
"\tpop {r4-r6}\n"
|
||||
"\tpop {r1}\n"
|
||||
"\tbx r1");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Unused
|
||||
u32 sub_8098EB0(u32 r0, u32 r1, u32 r2, u32 r3)
|
||||
{
|
||||
if(gUnknown_20398A8 == 0)
|
||||
{
|
||||
if(gUnknown_203B49D != 0)
|
||||
{
|
||||
Log(0, &gUnknown_8115FA4, r0, r3);
|
||||
gUnknown_20398A8 = 7;
|
||||
gUnknown_20398AC = 1;
|
||||
gUnknown_20398B0 = r0;
|
||||
sub_809C730();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_8098F00(u32 r0, u32 r1, u32 r2, u32 r3)
|
||||
{
|
||||
if(gUnknown_20398A8 == 0)
|
||||
{
|
||||
Log(0, &gUnknown_8115FC8, r0, r3);
|
||||
gUnknown_20398A8 = 9;
|
||||
gUnknown_20398AC = 1;
|
||||
gUnknown_20398B0 = r0;
|
||||
sub_809C730();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_8098F44(u32 r0, u32 r1, u32 r2, u32 r3)
|
||||
{
|
||||
if(gUnknown_20398A8 == 0)
|
||||
{
|
||||
Log(0, &gUnknown_8115FE8, r0, r3);
|
||||
gUnknown_20398A8 = 0xA;
|
||||
gUnknown_20398AC = 1;
|
||||
gUnknown_20398B0 = r0;
|
||||
sub_809C730();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_8098F88(void)
|
||||
{
|
||||
return gUnknown_20398B9;
|
||||
}
|
||||
|
||||
u32 sub_8098F94(void)
|
||||
{
|
||||
return gUnknown_20398BA;
|
||||
}
|
||||
|
||||
s16 sub_8098FA0(void)
|
||||
{
|
||||
return sub_8001658(0, 0x11);
|
||||
}
|
||||
|
||||
s32 sub_8098FB4(void)
|
||||
{
|
||||
return sub_80A2B18(sub_8001658(0, 0x11));
|
||||
}
|
||||
|
@ -20,6 +20,15 @@ extern struct unkStruct_80A2608 *sub_80A2620(u32);
|
||||
extern u8 sub_8097384(u32);
|
||||
extern s16 gUnknown_8116F9A[];
|
||||
|
||||
s16 sub_80A26B8(s16 r0)
|
||||
{
|
||||
// Useless cast that forces correct ordering
|
||||
s32 temp;
|
||||
temp = r0;
|
||||
|
||||
return gUnknown_8116F9A[r0];
|
||||
}
|
||||
|
||||
s16 sub_80A26CC(s16 r0)
|
||||
{
|
||||
return (0xDC >> 2) + r0;
|
||||
|
Loading…
Reference in New Issue
Block a user