mirror of
https://github.com/pret/pmd-red.git
synced 2024-11-27 06:50:30 +00:00
random assortment of decomp work and fix of nonmatchings
This commit is contained in:
parent
0c3daaaabd
commit
fc7f14ab66
@ -5,26 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start PrintFuncFileLine
|
||||
PrintFuncFileLine:
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0x8
|
||||
ldr r5, _08011AC4
|
||||
ldr r3, [r1, 0x8]
|
||||
ldr r4, [r1]
|
||||
str r4, [sp]
|
||||
ldr r1, [r1, 0x4]
|
||||
str r1, [sp, 0x4]
|
||||
adds r1, r5, 0
|
||||
bl sprintf
|
||||
add sp, 0x8
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08011AC4: .4byte gUnknown_80D41C4
|
||||
thumb_func_end PrintFuncFileLine
|
||||
|
||||
@ Unused
|
||||
thumb_func_start PrintMessageWithFuncFileLine
|
||||
PrintMessageWithFuncFileLine:
|
||||
|
@ -5,61 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_80A77A0
|
||||
sub_80A77A0:
|
||||
push {lr}
|
||||
lsls r0, 16
|
||||
asrs r1, r0, 16
|
||||
adds r2, r1, 0
|
||||
ldr r0, _080A77BC
|
||||
movs r3, 0
|
||||
ldrsh r0, [r0, r3]
|
||||
cmp r0, r1
|
||||
beq _080A77CA
|
||||
cmp r1, 0
|
||||
bge _080A77C0
|
||||
bl sub_80A7784
|
||||
b _080A77C6
|
||||
.align 2, 0
|
||||
_080A77BC: .4byte gUnknown_2039DE0
|
||||
_080A77C0:
|
||||
adds r0, r2, 0
|
||||
bl sub_80A7764
|
||||
_080A77C6:
|
||||
movs r0, 0x1
|
||||
b _080A77CC
|
||||
_080A77CA:
|
||||
movs r0, 0
|
||||
_080A77CC:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_80A77A0
|
||||
|
||||
thumb_func_start sub_80A77D0
|
||||
sub_80A77D0:
|
||||
push {lr}
|
||||
lsls r0, 16
|
||||
asrs r1, r0, 16
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
cmp r1, r0
|
||||
bne _080A77E8
|
||||
ldr r0, _080A77E4
|
||||
b _080A77F0
|
||||
.align 2, 0
|
||||
_080A77E4: .4byte gUnknown_8117EFC
|
||||
_080A77E8:
|
||||
ldr r0, _080A77F4
|
||||
lsls r1, 2
|
||||
adds r1, r0
|
||||
ldr r0, [r1]
|
||||
_080A77F0:
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_080A77F4: .4byte gUnknown_811E258
|
||||
thumb_func_end sub_80A77D0
|
||||
|
||||
thumb_func_start sub_80A77F8
|
||||
sub_80A77F8:
|
||||
push {r4,r5,lr}
|
||||
|
123
asm/save1.s
123
asm/save1.s
@ -5,129 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_8012484
|
||||
sub_8012484:
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0x8
|
||||
ldr r1, _080124A0
|
||||
ldr r0, [r1]
|
||||
ldr r0, [r0]
|
||||
adds r4, r1, 0
|
||||
cmp r0, 0x6
|
||||
bhi _0801254C
|
||||
lsls r0, 2
|
||||
ldr r1, _080124A4
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.align 2, 0
|
||||
_080124A0: .4byte gUnknown_203B188
|
||||
_080124A4: .4byte _080124A8
|
||||
.align 2, 0
|
||||
_080124A8:
|
||||
.4byte _080124C4
|
||||
.4byte _080124CC
|
||||
.4byte _080124E8
|
||||
.4byte _0801251C
|
||||
.4byte _08012534
|
||||
.4byte _0801254C
|
||||
.4byte _08012548
|
||||
_080124C4:
|
||||
ldr r1, [r4]
|
||||
movs r0, 0x1
|
||||
str r0, [r1]
|
||||
b _0801254C
|
||||
_080124CC:
|
||||
movs r0, 0
|
||||
str r0, [sp]
|
||||
mov r0, sp
|
||||
bl sub_8011DAC
|
||||
ldr r1, _080124E4
|
||||
ldr r1, [r1]
|
||||
str r0, [r1, 0x4]
|
||||
movs r0, 0x2
|
||||
str r0, [r1]
|
||||
b _0801254C
|
||||
.align 2, 0
|
||||
_080124E4: .4byte gUnknown_203B188
|
||||
_080124E8:
|
||||
adds r5, r4, 0
|
||||
ldr r1, [r5]
|
||||
ldr r0, [r1, 0x4]
|
||||
cmp r0, 0
|
||||
beq _0801253C
|
||||
bl sub_8011FF8
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08012518
|
||||
ldr r0, _08012510
|
||||
ldr r3, _08012514
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl sub_80141B4
|
||||
ldr r1, [r5]
|
||||
movs r0, 0x3
|
||||
str r0, [r1]
|
||||
b _0801254C
|
||||
.align 2, 0
|
||||
_08012510: .4byte gUnknown_80D4354
|
||||
_08012514: .4byte 0x00000301
|
||||
_08012518:
|
||||
ldr r1, [r4]
|
||||
b _0801252A
|
||||
_0801251C:
|
||||
add r0, sp, 0x4
|
||||
bl sub_80144A4
|
||||
cmp r0, 0
|
||||
bne _0801254C
|
||||
ldr r0, _08012530
|
||||
ldr r1, [r0]
|
||||
_0801252A:
|
||||
movs r0, 0x4
|
||||
str r0, [r1]
|
||||
b _0801254C
|
||||
.align 2, 0
|
||||
_08012530: .4byte gUnknown_203B188
|
||||
_08012534:
|
||||
bl sub_8012298
|
||||
ldr r0, _08012544
|
||||
ldr r1, [r0]
|
||||
_0801253C:
|
||||
movs r0, 0x6
|
||||
str r0, [r1]
|
||||
b _0801254C
|
||||
.align 2, 0
|
||||
_08012544: .4byte gUnknown_203B188
|
||||
_08012548:
|
||||
movs r0, 0
|
||||
b _0801254E
|
||||
_0801254C:
|
||||
movs r0, 0x1
|
||||
_0801254E:
|
||||
add sp, 0x8
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8012484
|
||||
|
||||
thumb_func_start sub_8012558
|
||||
sub_8012558:
|
||||
push {r4,lr}
|
||||
ldr r4, _08012570
|
||||
ldr r0, [r4]
|
||||
cmp r0, 0
|
||||
beq _0801256A
|
||||
bl MemoryFree
|
||||
movs r0, 0
|
||||
str r0, [r4]
|
||||
_0801256A:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08012570: .4byte gUnknown_203B188
|
||||
thumb_func_end sub_8012558
|
||||
|
||||
thumb_func_start sub_8012574
|
||||
sub_8012574:
|
||||
push {r4-r6,lr}
|
||||
|
@ -50,6 +50,7 @@ extern u32 gUnknown_202DE1C;
|
||||
extern u32 gUnknown_203B14C;
|
||||
extern const char gNotEntryText;
|
||||
extern const char gUnknown_80D418C;
|
||||
extern char gUnknown_80D41C4;
|
||||
|
||||
void sub_8011760(void)
|
||||
{
|
||||
@ -343,3 +344,20 @@ void PrintFuncFileLineOrNotEntry(char * r0, struct unkFileStruct *r1)
|
||||
"_08011AA0: .4byte gNotEntryText");
|
||||
#endif
|
||||
}
|
||||
|
||||
void PrintFuncFileLine(char *r0, struct unkFileStruct *r1, u32 r2)
|
||||
{
|
||||
volatile u32 temp;
|
||||
volatile u32 temp2;
|
||||
u32 r3;
|
||||
u32 r4;
|
||||
char *preload;
|
||||
|
||||
preload = &gUnknown_80D41C4;
|
||||
r3 = r1->unk8;
|
||||
r4 = r1->unk0;
|
||||
temp = r4;
|
||||
temp2 = r1->unk4;
|
||||
|
||||
sprintf(r0, preload, r2, r3);
|
||||
}
|
||||
|
@ -6,6 +6,9 @@ extern void sub_80A7310(u32 r0, u32 r1, u32 r2, u32 r3);
|
||||
extern void sub_80A7784();
|
||||
extern s16 gUnknown_2039DE0;
|
||||
|
||||
extern u32 gUnknown_8117EFC;
|
||||
extern u32 *gUnknown_811E258[];
|
||||
|
||||
void sub_80A7714(void)
|
||||
{
|
||||
sub_80A68A0();
|
||||
@ -44,3 +47,38 @@ void sub_80A7784(void)
|
||||
gUnknown_2039DE0 = -1;
|
||||
}
|
||||
}
|
||||
|
||||
u8 sub_80A77A0(s16 r0, u32 r1)
|
||||
{
|
||||
s32 temp;
|
||||
s32 temp2;
|
||||
temp = r0;
|
||||
temp2 = temp;
|
||||
if(gUnknown_2039DE0 != temp)
|
||||
{
|
||||
if(temp < 0)
|
||||
{
|
||||
sub_80A7784();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_80A7764(temp2);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO review this later
|
||||
u32 *sub_80A77D0(s16 r0)
|
||||
{
|
||||
if(r0 != -1)
|
||||
{
|
||||
return gUnknown_811E258[r0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return &gUnknown_8117EFC;
|
||||
}
|
||||
}
|
||||
|
@ -45,44 +45,19 @@ void sub_808DD48(s16 r0, struct unkEvolve *r1)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NONMATCHING
|
||||
NAKED
|
||||
#endif
|
||||
// Pretty confided args are correct yet compiler disagrees
|
||||
u8 sub_808DD68(s16 r0, u32 r1)
|
||||
{
|
||||
#ifdef NONMATCHING
|
||||
// Had to have this cast to match
|
||||
u32 temp;
|
||||
temp = r0;
|
||||
if (r1 != 0)
|
||||
{
|
||||
return 0xA;
|
||||
}
|
||||
else
|
||||
{
|
||||
return gMonsterParameters[r0].overworld_sprite;
|
||||
return gMonsterParameters[temp].overworld_sprite;
|
||||
}
|
||||
#else
|
||||
asm_unified("\tpush {lr}\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tasrs r2, r0, 16\n"
|
||||
"\tcmp r1, 0\n"
|
||||
"\tbne _0808DD88\n"
|
||||
"\tldr r0, _0808DD84\n"
|
||||
"\tldr r1, [r0]\n"
|
||||
"\tlsls r0, r2, 3\n"
|
||||
"\tadds r0, r2\n"
|
||||
"\tlsls r0, 3\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tldrb r0, [r0, 0x8]\n"
|
||||
"\tb _0808DD8A\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_0808DD84: .4byte gMonsterParameters\n"
|
||||
"_0808DD88:\n"
|
||||
"\tmovs r0, 0xA\n"
|
||||
"_0808DD8A:\n"
|
||||
"\tpop {r1}\n"
|
||||
"\tbx r1");
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NONMATCHING
|
||||
|
@ -37,6 +37,7 @@ extern u32 *gUnknown_203B48C;
|
||||
extern u32 gUnknown_203B490;
|
||||
extern u32 gUnknown_203B494;
|
||||
extern u8 *gUnknown_203B498;
|
||||
extern u32 gUnknown_80D4354;
|
||||
|
||||
extern void sub_800135C(void);
|
||||
extern u32 *sub_808CE00(void);
|
||||
@ -80,13 +81,19 @@ extern u32 *sub_809769C(void);
|
||||
u32 *sub_8011C4C(void);
|
||||
extern void sub_80958E4(u8 *a, u32 b);
|
||||
extern s32 WriteSaveSector(s32 *a, u8 *src, s32 size);
|
||||
extern u32 sub_8011DAC(u32 *a);
|
||||
extern u32 sub_80144A4(u32 *a);
|
||||
extern bool8 sub_8011FF8(void);
|
||||
extern void sub_80141B4(u32 *r0, u32 r1, u32 r2, u16 r3);
|
||||
|
||||
void sub_8012298();
|
||||
void sub_80122D0();
|
||||
void sub_80122F4();
|
||||
void sub_8012300();
|
||||
void sub_80976A8();
|
||||
void sub_80122A8();
|
||||
|
||||
|
||||
s32 sub_80121D4(s32 *a, u8 *src, s32 size)
|
||||
{
|
||||
return WriteSaveSector(a, src, size);
|
||||
@ -238,3 +245,67 @@ void sub_8012468(void)
|
||||
gUnknown_203B188->unk0 = 1;
|
||||
|
||||
}
|
||||
|
||||
u8 sub_8012484(void)
|
||||
{
|
||||
u32 temp;
|
||||
u32 temp2;
|
||||
switch(gUnknown_203B188->unk0)
|
||||
{
|
||||
case 0:
|
||||
gUnknown_203B188->unk0 = 1;
|
||||
break;
|
||||
case 1:
|
||||
temp = 0;
|
||||
gUnknown_203B188->unk4 = sub_8011DAC(&temp);
|
||||
gUnknown_203B188->unk0 = 2;
|
||||
break;
|
||||
case 2:
|
||||
if(gUnknown_203B188->unk4 != 0)
|
||||
{
|
||||
if(sub_8011FF8())
|
||||
{
|
||||
sub_80141B4(&gUnknown_80D4354, 0, 0, 0x301);
|
||||
gUnknown_203B188->unk0 = 3;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_203B188->unk0 = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_203B188->unk0 = 6;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
if(sub_80144A4(&temp2) == 0)
|
||||
{
|
||||
gUnknown_203B188->unk0 = 4;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
sub_8012298();
|
||||
gUnknown_203B188->unk0 = 6;
|
||||
case 5:
|
||||
break;
|
||||
case 6:
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void sub_8012558(void)
|
||||
{
|
||||
if(gUnknown_203B188 != NULL)
|
||||
{
|
||||
MemoryFree(gUnknown_203B188);
|
||||
gUnknown_203B188 = NULL;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user