mirror of
https://github.com/pret/pmd-red.git
synced 2024-11-23 13:09:56 +00:00
Merge pull request #210 from ElectroDeoxys/master
Decompile code_800E9E4.s
This commit is contained in:
commit
1cdff31053
@ -1,439 +0,0 @@
|
||||
#include "asm/constants/gba_constants.inc"
|
||||
#include "asm/macros.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_800EA44
|
||||
sub_800EA44:
|
||||
push {r4-r6,lr}
|
||||
lsls r0, 16
|
||||
asrs r5, r0, 16
|
||||
lsls r1, 16
|
||||
lsrs r1, 16
|
||||
adds r0, r1, 0
|
||||
bl sub_800ECB8
|
||||
adds r4, r0, 0
|
||||
ldr r0, [r4, 0x20]
|
||||
bl sub_800ECD0
|
||||
adds r1, r0, 0
|
||||
movs r2, 0
|
||||
ldr r0, [r4, 0x1C]
|
||||
cmp r2, r0
|
||||
bge _0800EA7C
|
||||
adds r3, r0, 0
|
||||
_0800EA68:
|
||||
movs r6, 0
|
||||
ldrsh r0, [r1, r6]
|
||||
cmp r0, r5
|
||||
bne _0800EA74
|
||||
ldrb r0, [r1, 0x2]
|
||||
b _0800EA7E
|
||||
_0800EA74:
|
||||
adds r2, 0x1
|
||||
adds r1, 0xC
|
||||
cmp r2, r3
|
||||
blt _0800EA68
|
||||
_0800EA7C:
|
||||
ldrb r0, [r4, 0x10]
|
||||
_0800EA7E:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_800EA44
|
||||
|
||||
thumb_func_start sub_800EA84
|
||||
sub_800EA84:
|
||||
push {r4,lr}
|
||||
sub sp, 0x50
|
||||
adds r4, r0, 0
|
||||
ldrh r0, [r4]
|
||||
bl sub_800ECB8
|
||||
movs r1, 0
|
||||
ldrsh r0, [r0, r1]
|
||||
str r0, [sp, 0x28]
|
||||
ldr r0, [r4, 0x10]
|
||||
str r0, [sp, 0x2C]
|
||||
ldr r0, [r4, 0xC]
|
||||
str r0, [sp, 0x30]
|
||||
ldr r0, [r4, 0x4]
|
||||
str r0, [sp, 0x34]
|
||||
ldr r0, [r4, 0x8]
|
||||
str r0, [sp, 0x38]
|
||||
ldrh r0, [r4]
|
||||
bl sub_800ECB8
|
||||
movs r2, 0
|
||||
ldrsh r0, [r0, r2]
|
||||
bl sub_800EBBC
|
||||
str r0, [sp, 0x3C]
|
||||
ldr r0, _0800EADC
|
||||
str r0, [sp, 0x40]
|
||||
add r1, sp, 0x44
|
||||
ldr r0, _0800EAE0
|
||||
ldm r0!, {r2-r4}
|
||||
stm r1!, {r2-r4}
|
||||
add r1, sp, 0x28
|
||||
mov r0, sp
|
||||
movs r2, 0x28
|
||||
bl memcpy
|
||||
movs r0, 0x5
|
||||
mov r1, sp
|
||||
bl sub_800E208
|
||||
add sp, 0x50
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0800EADC: .4byte 0x0000ffff
|
||||
_0800EAE0: .4byte gUnknown_80B9C60
|
||||
thumb_func_end sub_800EA84
|
||||
|
||||
thumb_func_start sub_800EAE4
|
||||
sub_800EAE4:
|
||||
push {r4,r5,lr}
|
||||
adds r4, r1, 0
|
||||
adds r5, r2, 0
|
||||
bl sub_800E2C0
|
||||
adds r1, r0, 0
|
||||
movs r3, 0x1
|
||||
negs r3, r3
|
||||
cmp r1, r3
|
||||
beq _0800EB1E
|
||||
ldr r2, _0800EB14
|
||||
movs r0, 0xD0
|
||||
muls r1, r0
|
||||
ldr r0, [r2]
|
||||
adds r1, r0, r1
|
||||
ldr r0, [r4]
|
||||
str r0, [r1, 0x18]
|
||||
ldr r0, [r1, 0x20]
|
||||
cmp r0, r3
|
||||
beq _0800EB18
|
||||
ldr r0, [r5]
|
||||
str r0, [r1, 0x1C]
|
||||
b _0800EB1E
|
||||
.align 2, 0
|
||||
_0800EB14: .4byte gUnknown_203B0CC
|
||||
_0800EB18:
|
||||
movs r0, 0
|
||||
strh r0, [r1, 0x1C]
|
||||
strh r0, [r1, 0x1E]
|
||||
_0800EB1E:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_800EAE4
|
||||
|
||||
thumb_func_start sub_800EB24
|
||||
sub_800EB24:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x20
|
||||
adds r6, r1, 0
|
||||
mov r8, r2
|
||||
adds r5, r3, 0
|
||||
ldr r4, [sp, 0x38]
|
||||
bl sub_800E2C0
|
||||
adds r1, r0, 0
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
cmp r1, r0
|
||||
beq _0800EBB0
|
||||
ldr r2, _0800EB8C
|
||||
movs r0, 0xD0
|
||||
muls r1, r0
|
||||
ldr r0, [r2]
|
||||
adds r2, r0, r1
|
||||
adds r0, r2, 0
|
||||
adds r0, 0xCC
|
||||
ldr r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _0800EB5A
|
||||
ldr r0, [r6]
|
||||
str r0, [r2, 0x18]
|
||||
_0800EB5A:
|
||||
ldr r0, [r2]
|
||||
cmp r0, 0x6
|
||||
beq _0800EB94
|
||||
ldr r0, [r2, 0x8]
|
||||
movs r1, 0x7
|
||||
mov r12, r1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0800EB94
|
||||
mov r1, sp
|
||||
ldr r0, _0800EB90
|
||||
ldm r0!, {r3,r6,r7}
|
||||
stm r1!, {r3,r6,r7}
|
||||
ldm r0!, {r3,r6,r7}
|
||||
stm r1!, {r3,r6,r7}
|
||||
ldm r0!, {r3,r6}
|
||||
stm r1!, {r3,r6}
|
||||
mov r7, r12
|
||||
ands r4, r7
|
||||
lsls r0, r4, 2
|
||||
add r0, sp
|
||||
ldr r0, [r0]
|
||||
adds r0, r5, r0
|
||||
b _0800EB96
|
||||
.align 2, 0
|
||||
_0800EB8C: .4byte gUnknown_203B0CC
|
||||
_0800EB90: .4byte gUnknown_80B9C9C
|
||||
_0800EB94:
|
||||
adds r0, r5, 0x1
|
||||
_0800EB96:
|
||||
str r0, [r2, 0x24]
|
||||
ldr r1, [r2, 0x20]
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
cmp r1, r0
|
||||
beq _0800EBAA
|
||||
mov r1, r8
|
||||
ldr r0, [r1]
|
||||
str r0, [r2, 0x1C]
|
||||
b _0800EBB0
|
||||
_0800EBAA:
|
||||
movs r0, 0
|
||||
strh r0, [r2, 0x1C]
|
||||
strh r0, [r2, 0x1E]
|
||||
_0800EBB0:
|
||||
add sp, 0x20
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_800EB24
|
||||
|
||||
thumb_func_start sub_800EBBC
|
||||
sub_800EBBC:
|
||||
push {lr}
|
||||
bl sub_800ECA4
|
||||
ldr r0, [r0, 0x1C]
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_800EBBC
|
||||
|
||||
thumb_func_start sub_800EBC8
|
||||
sub_800EBC8:
|
||||
push {r4,lr}
|
||||
sub sp, 0x50
|
||||
adds r4, r0, 0
|
||||
ldrh r0, [r4]
|
||||
bl sub_800ECB8
|
||||
movs r1, 0x4
|
||||
ldrsh r0, [r0, r1]
|
||||
str r0, [sp, 0x28]
|
||||
ldr r0, [r4, 0x10]
|
||||
str r0, [sp, 0x2C]
|
||||
ldr r0, [r4, 0xC]
|
||||
str r0, [sp, 0x30]
|
||||
ldr r0, [r4, 0x4]
|
||||
str r0, [sp, 0x34]
|
||||
ldr r0, [r4, 0x8]
|
||||
str r0, [sp, 0x38]
|
||||
ldrh r0, [r4]
|
||||
bl sub_800ECB8
|
||||
movs r2, 0x4
|
||||
ldrsh r0, [r0, r2]
|
||||
bl sub_800EC68
|
||||
str r0, [sp, 0x3C]
|
||||
ldr r0, _0800EC20
|
||||
str r0, [sp, 0x40]
|
||||
add r1, sp, 0x44
|
||||
ldr r0, _0800EC24
|
||||
ldm r0!, {r2-r4}
|
||||
stm r1!, {r2-r4}
|
||||
add r1, sp, 0x28
|
||||
mov r0, sp
|
||||
movs r2, 0x28
|
||||
bl memcpy
|
||||
movs r0, 0x6
|
||||
mov r1, sp
|
||||
bl sub_800E208
|
||||
add sp, 0x50
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0800EC20: .4byte 0x0000ffff
|
||||
_0800EC24: .4byte gUnknown_80B9C60
|
||||
thumb_func_end sub_800EBC8
|
||||
|
||||
thumb_func_start sub_800EC28
|
||||
sub_800EC28:
|
||||
push {r4,r5,lr}
|
||||
adds r4, r1, 0
|
||||
adds r5, r2, 0
|
||||
bl sub_800E2C0
|
||||
adds r1, r0, 0
|
||||
movs r3, 0x1
|
||||
negs r3, r3
|
||||
cmp r1, r3
|
||||
beq _0800EC62
|
||||
ldr r2, _0800EC58
|
||||
movs r0, 0xD0
|
||||
muls r1, r0
|
||||
ldr r0, [r2]
|
||||
adds r1, r0, r1
|
||||
ldr r0, [r4]
|
||||
str r0, [r1, 0x18]
|
||||
ldr r0, [r1, 0x20]
|
||||
cmp r0, r3
|
||||
beq _0800EC5C
|
||||
ldr r0, [r5]
|
||||
str r0, [r1, 0x1C]
|
||||
b _0800EC62
|
||||
.align 2, 0
|
||||
_0800EC58: .4byte gUnknown_203B0CC
|
||||
_0800EC5C:
|
||||
movs r0, 0
|
||||
strh r0, [r1, 0x1C]
|
||||
strh r0, [r1, 0x1E]
|
||||
_0800EC62:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_800EC28
|
||||
|
||||
thumb_func_start sub_800EC68
|
||||
sub_800EC68:
|
||||
push {lr}
|
||||
bl sub_800ECA4
|
||||
ldr r0, [r0, 0x1C]
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_800EC68
|
||||
|
||||
thumb_func_start sub_800EC74
|
||||
sub_800EC74:
|
||||
push {lr}
|
||||
movs r0, 0x1
|
||||
bl sub_800F19C
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_800EC74
|
||||
|
||||
thumb_func_start sub_800EC84
|
||||
sub_800EC84:
|
||||
push {lr}
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
bl sub_800ECB8
|
||||
ldrb r0, [r0, 0x8]
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_800EC84
|
||||
|
||||
thumb_func_start sub_800EC94
|
||||
sub_800EC94:
|
||||
push {lr}
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
bl sub_800ECB8
|
||||
ldrb r0, [r0, 0x9]
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_800EC94
|
||||
|
||||
thumb_func_start sub_800ECA4
|
||||
sub_800ECA4:
|
||||
adds r1, r0, 0
|
||||
lsls r0, r1, 3
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
ldr r1, _0800ECB4
|
||||
adds r0, r1
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_0800ECB4: .4byte gUnknown_80B9CC4
|
||||
thumb_func_end sub_800ECA4
|
||||
|
||||
thumb_func_start sub_800ECB8
|
||||
sub_800ECB8:
|
||||
adds r1, r0, 0
|
||||
lsls r1, 16
|
||||
lsrs r1, 16
|
||||
lsls r0, r1, 3
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
ldr r1, _0800ECCC
|
||||
adds r0, r1
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_0800ECCC: .4byte gUnknown_80BDBC4
|
||||
thumb_func_end sub_800ECB8
|
||||
|
||||
thumb_func_start sub_800ECD0
|
||||
sub_800ECD0:
|
||||
adds r1, r0, 0
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
ldr r1, _0800ECE0
|
||||
adds r0, r1
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_0800ECE0: .4byte gUnknown_80C183C
|
||||
thumb_func_end sub_800ECD0
|
||||
|
||||
thumb_func_start sub_800ECE4
|
||||
sub_800ECE4:
|
||||
lsls r0, 24
|
||||
ldr r1, _0800ECF4
|
||||
lsrs r0, 23
|
||||
adds r0, r1
|
||||
movs r1, 0
|
||||
ldrsh r0, [r0, r1]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_0800ECF4: .4byte gUnknown_80CE73C
|
||||
thumb_func_end sub_800ECE4
|
||||
|
||||
thumb_func_start sub_800ECF8
|
||||
sub_800ECF8:
|
||||
lsls r0, 24
|
||||
ldr r1, _0800ED08
|
||||
lsrs r0, 22
|
||||
adds r0, r1
|
||||
movs r1, 0
|
||||
ldrsh r0, [r0, r1]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_0800ED08: .4byte gUnknown_80CE37C
|
||||
thumb_func_end sub_800ECF8
|
||||
|
||||
thumb_func_start sub_800ED0C
|
||||
sub_800ED0C:
|
||||
lsls r0, 24
|
||||
ldr r1, _0800ED1C
|
||||
lsrs r0, 22
|
||||
adds r0, r1
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r0, r1]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_0800ED1C: .4byte gUnknown_80CE37C
|
||||
thumb_func_end sub_800ED0C
|
||||
|
||||
thumb_func_start sub_800ED20
|
||||
sub_800ED20:
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
ldr r2, _0800ED34
|
||||
lsls r1, r0, 3
|
||||
adds r1, r0
|
||||
lsls r1, 2
|
||||
adds r2, 0xC
|
||||
adds r1, r2
|
||||
ldr r0, [r1]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_0800ED34: .4byte gUnknown_80BDBC4
|
||||
thumb_func_end sub_800ED20
|
||||
|
||||
.align 2,0
|
@ -1,12 +1,24 @@
|
||||
#ifndef GUARD_CODE_800E9A8_H
|
||||
#define GUARD_CODE_800E9A8_H
|
||||
|
||||
typedef struct unkStruct_800EAE4
|
||||
{
|
||||
s16 unk0;
|
||||
s16 unk2;
|
||||
} unkStruct_800EAE4;
|
||||
|
||||
struct unkStruct_203B0CC_sub
|
||||
{
|
||||
// size: 0xD0
|
||||
u32 unk0;
|
||||
s32 unk4;
|
||||
u8 fill8[0x34 - 8];
|
||||
s32 unk8;
|
||||
u8 fillc[0x18 - 0x0c];
|
||||
s32 unk18;
|
||||
unkStruct_800EAE4 unk1c;
|
||||
s32 unk20;
|
||||
s32 unk24;
|
||||
u8 fill28[0x32 - 0x28];
|
||||
u32 unk34;
|
||||
u32 unk38;
|
||||
u8 fill3C[0x4C - 0x3C];
|
||||
@ -15,7 +27,8 @@ struct unkStruct_203B0CC_sub
|
||||
u8 unk54;
|
||||
u8 fill55[0xB8 - 0x55];
|
||||
u32 unkB8;
|
||||
u8 fillBC[0xD0 - 0xBC];
|
||||
u8 fillBC[0xCC - 0xBC];
|
||||
u32 unkCC;
|
||||
};
|
||||
|
||||
struct unkStruct_203B0CC
|
||||
@ -31,7 +44,7 @@ struct unkStruct_203B0CC
|
||||
};
|
||||
|
||||
bool8 sub_800E9A8(s32 a0);
|
||||
bool8 sub_800E9E4(void);
|
||||
bool8 sub_800E9E4(u32);
|
||||
bool8 sub_800E9FC(u8 a0);
|
||||
|
||||
#endif
|
||||
|
38
include/code_800E9E4.h
Normal file
38
include/code_800E9E4.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef GUARD_CODE_800E9E4_H
|
||||
#define GUARD_CODE_800E9E4_H
|
||||
|
||||
typedef struct unkStruct_80B9CC4
|
||||
{
|
||||
// size: 0x24
|
||||
s32 unk0;
|
||||
s32 unk4;
|
||||
u8 fill8[0x1c - 0x8];
|
||||
s32 unk1c;
|
||||
u8 fill20[0x24 - 0x20];
|
||||
} unkStruct_80B9CC4;
|
||||
|
||||
typedef struct unkStruct_80BDBC4
|
||||
{
|
||||
// size: 0x24
|
||||
s16 unk0;
|
||||
s16 unk2;
|
||||
s16 unk4;
|
||||
s16 unk6;
|
||||
u8 unk8;
|
||||
u8 unk9;
|
||||
u8 fillA[0x0c - 0x0a];
|
||||
s32 unkC;
|
||||
s32 unk10;
|
||||
u8 fill14[0x1c - 0x14];
|
||||
s32 unk1C;
|
||||
s32 unk20;
|
||||
} unkStruct_80BDBC4;
|
||||
|
||||
u8 sub_800EC74(void);
|
||||
unkStruct_80B9CC4 *sub_800ECA4(s32);
|
||||
unkStruct_80BDBC4 *sub_800ECB8(u16);
|
||||
s16 sub_800ECE4(u8);
|
||||
s16 sub_800ECF8(u8);
|
||||
s16 sub_800ED0C(u8);
|
||||
|
||||
#endif
|
@ -86,7 +86,7 @@ SECTIONS {
|
||||
src/code_800DAC0.o(.text);
|
||||
asm/code_800DAC0.o(.text);
|
||||
src/code_800E9A8.o(.text);
|
||||
asm/code_800E9E4.o(.text);
|
||||
src/code_800E9E4.o(.text);
|
||||
src/code_800ED38.o(.text);
|
||||
asm/code_800ED38.o(.text);
|
||||
src/code_800F958.o(.text);
|
||||
|
@ -3,38 +3,10 @@
|
||||
#include "code_800558C.h"
|
||||
#include "code_800DAC0.h"
|
||||
#include "code_80118A4.h"
|
||||
#include "code_800E9A8.h"
|
||||
#include "file_system.h"
|
||||
#include "memory.h"
|
||||
|
||||
struct unkStruct_203B0CC_sub
|
||||
{
|
||||
// size: 0xD0
|
||||
u32 unk0;
|
||||
s32 unk4;
|
||||
u8 fill8[0x34 - 8];
|
||||
u32 unk34;
|
||||
u32 unk38;
|
||||
u8 fill3C[0x4C - 0x3C];
|
||||
u32 unk4C;
|
||||
s32 unk50;
|
||||
u8 unk54;
|
||||
u8 fill55[0xB8 - 0x55];
|
||||
u32 unkB8;
|
||||
u8 fillBC[0xD0 - 0xBC];
|
||||
};
|
||||
|
||||
struct unkStruct_203B0CC
|
||||
{
|
||||
// size: 0x1A18
|
||||
struct unkStruct_203B0CC_sub unk0[0x20];
|
||||
u32 unk1A00;
|
||||
/* 0x1A04 */ u32 fileSelection;
|
||||
u32 unk1A08;
|
||||
u32 unk1A0C;
|
||||
u32 unk1A10;
|
||||
u8 fill1A14[0x1A18 - 0x1A14];
|
||||
};
|
||||
|
||||
struct unkStruct_203B0CC *gUnknown_203B0CC;
|
||||
|
||||
struct unkStruct_800F18C
|
||||
@ -43,7 +15,7 @@ struct unkStruct_800F18C
|
||||
u32 unk4;
|
||||
};
|
||||
|
||||
extern s32 sub_800E2C0(void);
|
||||
extern s32 sub_800E2C0(u32);
|
||||
extern s32 sub_8000728(void);
|
||||
extern u32 sub_800E900(void);
|
||||
extern void sub_8009BE4(void);
|
||||
@ -59,7 +31,7 @@ extern struct FileArchive gEffectFileArchive;
|
||||
|
||||
extern void sub_800F034(void);
|
||||
extern void sub_800ED38(u32);
|
||||
extern void sub_800DC14(void);
|
||||
extern void sub_800DC14(u32);
|
||||
extern void sub_800F078();
|
||||
extern void sub_800ED64();
|
||||
extern void sub_800ED80();
|
||||
@ -111,7 +83,7 @@ void sub_800DB7C(void)
|
||||
for(index = 0, preload = &gUnknown_203B0CC->unk0[index]; index < 0x20; index++, preload++)
|
||||
{
|
||||
if(preload->unk4 != -1)
|
||||
sub_800DC14();
|
||||
sub_800DC14(preload->unk4);
|
||||
}
|
||||
|
||||
|
||||
@ -134,7 +106,7 @@ void sub_800DBBC(void)
|
||||
for(index1 = 0, preload = &gUnknown_203B0CC->unk0[index1]; index1 < 0x20; index1++, preload++)
|
||||
{
|
||||
if(preload->unk4 != -1)
|
||||
sub_800DC14();
|
||||
sub_800DC14(preload->unk4);
|
||||
}
|
||||
|
||||
|
||||
@ -151,7 +123,7 @@ bool8 sub_800DCC0(void)
|
||||
return gUnknown_203B0CC != NULL;
|
||||
}
|
||||
|
||||
void sub_800DC14(void)
|
||||
void sub_800DC14(u32 param_1)
|
||||
{
|
||||
s32 index1;
|
||||
s32 index2;
|
||||
@ -159,7 +131,7 @@ void sub_800DC14(void)
|
||||
struct unkStruct_800F18C *puVar4;
|
||||
struct unkStruct_203B0CC_sub *preload;
|
||||
|
||||
index1 = sub_800E2C0();
|
||||
index1 = sub_800E2C0(param_1);
|
||||
if (index1 != -1) {
|
||||
preload = &gUnknown_203B0CC->unk0[index1];
|
||||
if (preload->unk34 == 4) {
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "code_800E9A8.h"
|
||||
#include "code_800E9E4.h"
|
||||
|
||||
s32 sub_800E2C0(void);
|
||||
u8 sub_800EC74(void);
|
||||
s32 sub_800E2C0(u32);
|
||||
|
||||
struct unkStruct_203B0CC *gUnknown_203B0CC;
|
||||
|
||||
@ -26,9 +26,9 @@ bool8 sub_800E9A8(s32 a0)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_800E9E4(void)
|
||||
bool8 sub_800E9E4(u32 param_1)
|
||||
{
|
||||
if(sub_800E2C0() != -1)
|
||||
if(sub_800E2C0(param_1) != -1)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
357
src/code_800E9E4.c
Normal file
357
src/code_800E9E4.c
Normal file
@ -0,0 +1,357 @@
|
||||
#include "global.h"
|
||||
#include "code_800E9E4.h"
|
||||
#include "code_800E9A8.h"
|
||||
|
||||
extern s32 sub_800E2C0(u32);
|
||||
u32 sub_800F19C(s32);
|
||||
s32 sub_800EBBC(s32);
|
||||
s32 sub_800EC68(s32);
|
||||
|
||||
struct unkStruct_203B0CC *gUnknown_203B0CC;
|
||||
|
||||
typedef struct unkStruct_80B9C60
|
||||
{
|
||||
s32 unk0;
|
||||
s32 unk1;
|
||||
s32 unk2;
|
||||
} unkStruct_80B9C60;
|
||||
|
||||
extern unkStruct_80B9C60 gUnknown_80B9C60;
|
||||
|
||||
extern s32 gUnknown_80B9C9C[8];
|
||||
extern s16 gUnknown_80CE73C[20];
|
||||
|
||||
typedef struct unkStruct_80CE37C
|
||||
{
|
||||
s16 unk0;
|
||||
s16 unk2;
|
||||
} unkStruct_80CE37C;
|
||||
unkStruct_80CE37C gUnknown_80CE37C[1];
|
||||
|
||||
extern unkStruct_80BDBC4 gUnknown_80BDBC4[430];
|
||||
extern unkStruct_80B9CC4 gUnknown_80B9CC4[448];
|
||||
|
||||
typedef struct unkStruct_80C183C
|
||||
{
|
||||
// size: 0xc
|
||||
s16 unk0;
|
||||
s16 unk2;
|
||||
u8 fill4[0xc - 0x4];
|
||||
} unkStruct_80C183C;
|
||||
|
||||
extern unkStruct_80C183C gUnknown_80C183C[4336];
|
||||
unkStruct_80C183C *sub_800ECD0(s32 param_1);
|
||||
|
||||
typedef struct unkStruct_800EA44
|
||||
{
|
||||
s16 unk0;
|
||||
s16 unk2;
|
||||
} unkStruct_800EA44;
|
||||
|
||||
u8 sub_800EA44(unkStruct_800EA44 param_1, s32 param_2)
|
||||
{
|
||||
s32 a;
|
||||
unkStruct_80BDBC4 *ret;
|
||||
unkStruct_80C183C *unkStruct2;
|
||||
s32 i;
|
||||
|
||||
a = (s32) param_1.unk0;
|
||||
ret = sub_800ECB8(param_2);
|
||||
unkStruct2 = sub_800ECD0(ret->unk20);
|
||||
|
||||
for (i = 0; i < ret->unk1C; i++, unkStruct2++)
|
||||
{
|
||||
if (unkStruct2->unk0 == a)
|
||||
{
|
||||
return unkStruct2->unk2;
|
||||
}
|
||||
}
|
||||
|
||||
return ret->unk10;
|
||||
}
|
||||
|
||||
typedef struct unkStruct_800E208
|
||||
{
|
||||
s32 unk00[7];
|
||||
unkStruct_80B9C60 unk1c;
|
||||
} unkStruct_800E208;
|
||||
|
||||
s32 sub_800E208(s32, unkStruct_800E208*);
|
||||
|
||||
s32 sub_800EA84(s32 *param_1)
|
||||
{
|
||||
unkStruct_800E208 stack[2];
|
||||
unkStruct_80BDBC4 *ret1;
|
||||
u32 size;
|
||||
ret1 = sub_800ECB8(param_1[0]);
|
||||
|
||||
stack[1].unk00[0] = ret1->unk0;
|
||||
stack[1].unk00[1] = param_1[4];
|
||||
stack[1].unk00[2] = param_1[3];
|
||||
stack[1].unk00[3] = param_1[1];
|
||||
stack[1].unk00[4] = param_1[2];
|
||||
|
||||
ret1 = sub_800ECB8(param_1[0]);
|
||||
stack[1].unk00[5] = sub_800EBBC(ret1->unk0);
|
||||
stack[1].unk00[6] = 0x0000ffff;
|
||||
stack[1].unk1c = gUnknown_80B9C60;
|
||||
|
||||
size = sizeof(unkStruct_800E208);
|
||||
memcpy(&stack[0],&stack[1],size);
|
||||
return sub_800E208(5, &stack[0]);
|
||||
}
|
||||
|
||||
void sub_800EAE4(s32 param_1, s32 *param_2, unkStruct_800EAE4 *param_3)
|
||||
{
|
||||
s32 idx = sub_800E2C0(param_1);
|
||||
if (idx != -1)
|
||||
{
|
||||
struct unkStruct_203B0CC_sub *a;
|
||||
a = &gUnknown_203B0CC->unk0[idx];
|
||||
a->unk18 = param_2[0];
|
||||
if (a->unk20 != -1)
|
||||
{
|
||||
a->unk1c = *param_3;
|
||||
}
|
||||
else
|
||||
{
|
||||
a->unk1c.unk0 = 0;
|
||||
a->unk1c.unk2 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING // 99,32% match, r4/r5 regswap https://decomp.me/scratch/0cu86
|
||||
void sub_800EB24(s32 param_1, s32 *param_2, unkStruct_800EAE4 *param_3, s32 param_4, s32 param_5)
|
||||
{
|
||||
s32 idx;
|
||||
idx = sub_800E2C0(param_1);
|
||||
if (idx != -1)
|
||||
{
|
||||
struct unkStruct_203B0CC_sub *curStruct;
|
||||
curStruct = &gUnknown_203B0CC->unk0[idx];
|
||||
if (curStruct->unkCC == 0)
|
||||
{
|
||||
curStruct->unk18 = param_2[0];
|
||||
}
|
||||
|
||||
if (curStruct->unk0 != 6 && (curStruct->unk8 & 0x7) == 0)
|
||||
{
|
||||
s32 newStruct[8];
|
||||
memcpy(newStruct, gUnknown_80B9C9C, sizeof(s32) * 8);
|
||||
param_4 += newStruct[param_5 & 0x7];
|
||||
}
|
||||
else
|
||||
{
|
||||
param_4 += 1;
|
||||
}
|
||||
|
||||
curStruct->unk24 = param_4;
|
||||
|
||||
if (curStruct->unk20 != -1)
|
||||
{
|
||||
curStruct->unk1c = *param_3;
|
||||
}
|
||||
else
|
||||
{
|
||||
curStruct->unk1c.unk0 = 0;
|
||||
curStruct->unk1c.unk2 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_800EB24(s32 param_1, s32 *param_2, unkStruct_800EAE4 *param_3, s32 param_4, s32 param_5)
|
||||
{
|
||||
asm_unified( "\n"
|
||||
" push {r4-r7,lr}\n"
|
||||
" mov r7, r8\n"
|
||||
" push {r7}\n"
|
||||
" sub sp, 0x20\n"
|
||||
" adds r6, r1, 0\n"
|
||||
" mov r8, r2\n"
|
||||
" adds r5, r3, 0\n"
|
||||
" ldr r4, [sp, 0x38]\n"
|
||||
" bl sub_800E2C0\n"
|
||||
" adds r1, r0, 0\n"
|
||||
" movs r0, 0x1\n"
|
||||
" negs r0, r0\n"
|
||||
" cmp r1, r0\n"
|
||||
" beq _0800EBB0\n"
|
||||
" ldr r2, _0800EB8C\n"
|
||||
" movs r0, 0xD0\n"
|
||||
" muls r1, r0\n"
|
||||
" ldr r0, [r2]\n"
|
||||
" adds r2, r0, r1\n"
|
||||
" adds r0, r2, 0\n"
|
||||
" adds r0, 0xCC\n"
|
||||
" ldr r0, [r0]\n"
|
||||
" cmp r0, 0\n"
|
||||
" bne _0800EB5A\n"
|
||||
" ldr r0, [r6]\n"
|
||||
" str r0, [r2, 0x18]\n"
|
||||
"_0800EB5A:\n"
|
||||
" ldr r0, [r2]\n"
|
||||
" cmp r0, 0x6\n"
|
||||
" beq _0800EB94\n"
|
||||
" ldr r0, [r2, 0x8]\n"
|
||||
" movs r1, 0x7\n"
|
||||
" mov r12, r1\n"
|
||||
" ands r0, r1\n"
|
||||
" cmp r0, 0\n"
|
||||
" bne _0800EB94\n"
|
||||
" mov r1, sp\n"
|
||||
" ldr r0, _0800EB90\n"
|
||||
" ldm r0!, {r3,r6,r7}\n"
|
||||
" stm r1!, {r3,r6,r7}\n"
|
||||
" ldm r0!, {r3,r6,r7}\n"
|
||||
" stm r1!, {r3,r6,r7}\n"
|
||||
" ldm r0!, {r3,r6}\n"
|
||||
" stm r1!, {r3,r6}\n"
|
||||
" mov r7, r12\n"
|
||||
" ands r4, r7\n"
|
||||
" lsls r0, r4, 2\n"
|
||||
" add r0, sp\n"
|
||||
" ldr r0, [r0]\n"
|
||||
" adds r0, r5, r0\n"
|
||||
" b _0800EB96\n"
|
||||
" .align 2, 0\n"
|
||||
"_0800EB8C: .4byte gUnknown_203B0CC\n"
|
||||
"_0800EB90: .4byte gUnknown_80B9C9C\n"
|
||||
"_0800EB94:\n"
|
||||
" adds r0, r5, 0x1\n"
|
||||
"_0800EB96:\n"
|
||||
" str r0, [r2, 0x24]\n"
|
||||
" ldr r1, [r2, 0x20]\n"
|
||||
" movs r0, 0x1\n"
|
||||
" negs r0, r0\n"
|
||||
" cmp r1, r0\n"
|
||||
" beq _0800EBAA\n"
|
||||
" mov r1, r8\n"
|
||||
" ldr r0, [r1]\n"
|
||||
" str r0, [r2, 0x1C]\n"
|
||||
" b _0800EBB0\n"
|
||||
"_0800EBAA:\n"
|
||||
" movs r0, 0\n"
|
||||
" strh r0, [r2, 0x1C]\n"
|
||||
" strh r0, [r2, 0x1E]\n"
|
||||
"_0800EBB0:\n"
|
||||
" add sp, 0x20\n"
|
||||
" pop {r3}\n"
|
||||
" mov r8, r3\n"
|
||||
" pop {r4-r7}\n"
|
||||
" pop {r0}\n"
|
||||
" bx r0\n"
|
||||
);
|
||||
}
|
||||
#endif // NONMATCHING
|
||||
|
||||
s32 sub_800EBBC(s32 param_1)
|
||||
{
|
||||
unkStruct_80B9CC4 *ret = sub_800ECA4(param_1);
|
||||
return ret->unk1c;
|
||||
}
|
||||
|
||||
s32 sub_800EBC8(s32 *param_1)
|
||||
{
|
||||
unkStruct_800E208 stack[2];
|
||||
unkStruct_80BDBC4 *ret1;
|
||||
u32 size;
|
||||
ret1 = sub_800ECB8(param_1[0]);
|
||||
|
||||
stack[1].unk00[0] = ret1->unk4;
|
||||
stack[1].unk00[1] = param_1[4];
|
||||
stack[1].unk00[2] = param_1[3];
|
||||
stack[1].unk00[3] = param_1[1];
|
||||
stack[1].unk00[4] = param_1[2];
|
||||
|
||||
ret1 = sub_800ECB8(param_1[0]);
|
||||
stack[1].unk00[5] = sub_800EC68(ret1->unk4);
|
||||
stack[1].unk00[6] = 0x0000ffff;
|
||||
stack[1].unk1c = gUnknown_80B9C60;
|
||||
|
||||
size = sizeof(unkStruct_800E208);
|
||||
memcpy(&stack[0],&stack[1],size);
|
||||
return sub_800E208(6, &stack[0]);
|
||||
}
|
||||
|
||||
void sub_800EC28(u32 param_1, s32 *param_2, unkStruct_800EAE4 *param_3)
|
||||
{
|
||||
s32 idx;
|
||||
idx = sub_800E2C0(param_1);
|
||||
if (idx != -1)
|
||||
{
|
||||
struct unkStruct_203B0CC_sub *struct203B0CC;
|
||||
struct203B0CC = &gUnknown_203B0CC->unk0[idx];
|
||||
struct203B0CC->unk18 = param_2[0];
|
||||
if (struct203B0CC->unk20 != -1)
|
||||
{
|
||||
struct203B0CC->unk1c = *param_3;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct203B0CC->unk1c.unk0 = 0;
|
||||
struct203B0CC->unk1c.unk2 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 sub_800EC68(s32 param_1)
|
||||
{
|
||||
unkStruct_80B9CC4 *ret = sub_800ECA4(param_1);
|
||||
return ret->unk1c;
|
||||
}
|
||||
|
||||
u8 sub_800EC74(void)
|
||||
{
|
||||
return sub_800F19C(1);
|
||||
}
|
||||
|
||||
u8 sub_800EC84(s32 param_1)
|
||||
{
|
||||
unkStruct_80BDBC4 *ret;
|
||||
ret = sub_800ECB8(param_1);
|
||||
return ret->unk8;
|
||||
}
|
||||
|
||||
u8 sub_800EC94(s32 param_1)
|
||||
{
|
||||
unkStruct_80BDBC4 *ret;
|
||||
ret = sub_800ECB8(param_1);
|
||||
return ret->unk9;
|
||||
}
|
||||
|
||||
unkStruct_80B9CC4 *sub_800ECA4(s32 param_1)
|
||||
{
|
||||
return &gUnknown_80B9CC4[param_1];
|
||||
}
|
||||
|
||||
unkStruct_80BDBC4 *sub_800ECB8(u16 param_1)
|
||||
{
|
||||
return &gUnknown_80BDBC4[param_1];
|
||||
}
|
||||
|
||||
unkStruct_80C183C *sub_800ECD0(s32 param_1)
|
||||
{
|
||||
return &gUnknown_80C183C[param_1];
|
||||
}
|
||||
|
||||
s16 sub_800ECE4(u8 param_1)
|
||||
{
|
||||
return gUnknown_80CE73C[param_1];
|
||||
}
|
||||
|
||||
s16 sub_800ECF8(u8 param_1)
|
||||
{
|
||||
return gUnknown_80CE37C[param_1].unk0;
|
||||
}
|
||||
|
||||
s16 sub_800ED0C(u8 param_1)
|
||||
{
|
||||
return gUnknown_80CE37C[param_1].unk2;
|
||||
}
|
||||
|
||||
s32 sub_800ED20(u16 param_1)
|
||||
{
|
||||
return gUnknown_80BDBC4[param_1].unkC;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "file_system.h"
|
||||
#include "memory.h"
|
||||
#include "code_800E9E4.h"
|
||||
|
||||
struct unkStruct_203B0D0_sub
|
||||
{
|
||||
@ -25,16 +26,11 @@ struct unkStruct_203B0D0 {
|
||||
struct unkStruct_203B0D0 *gUnknown_203B0D0;
|
||||
|
||||
extern s32 sub_8000728();
|
||||
s32 *sub_800ECA4(s32);
|
||||
OpenedFile *sub_800F1C0(s32, s32);
|
||||
s32 sub_800F0F4(s32, s32);
|
||||
void sub_800F204(OpenedFile *file);
|
||||
void sub_800F13C(s32, OpenedFile *, s32 *);
|
||||
void sub_800F13C(s32, OpenedFile *, unkStruct_80B9CC4 *);
|
||||
void sub_800F15C(s32);
|
||||
s16 *sub_800ECB8(u16);
|
||||
s16 sub_800ECE4(u8);
|
||||
s16 sub_800ECF8(u8 r0);
|
||||
s16 sub_800ED0C(u8 r0);
|
||||
|
||||
void sub_800ED38(s32 r0)
|
||||
{
|
||||
@ -120,19 +116,19 @@ void sub_800EDF0(u32 r0, struct unkStruct_203B0D0_sub *r1) {
|
||||
|
||||
void sub_800EE5C(s32 r0)
|
||||
{
|
||||
s32 *ret;
|
||||
unkStruct_80B9CC4 *ret;
|
||||
OpenedFile *file;
|
||||
s32 ret2;
|
||||
|
||||
ret = sub_800ECA4(r0);
|
||||
if(r0 != 0)
|
||||
{
|
||||
if((u32)(ret[0] - 1) > 1)
|
||||
if((u32)(ret->unk0 - 1) > 1)
|
||||
{
|
||||
file = sub_800F1C0(ret[0], ret[1]);
|
||||
file = sub_800F1C0(ret->unk0, ret->unk4);
|
||||
if(file)
|
||||
{
|
||||
ret2 = sub_800F0F4(ret[0], ret[1]);
|
||||
ret2 = sub_800F0F4(ret->unk0, ret->unk4);
|
||||
if(ret2 == -1)
|
||||
{
|
||||
sub_800F204(file);
|
||||
@ -147,7 +143,7 @@ void sub_800EE5C(s32 r0)
|
||||
else {
|
||||
sub_800F204(file);
|
||||
}
|
||||
sub_800F15C(ret[1]);
|
||||
sub_800F15C(ret->unk4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -155,30 +151,30 @@ void sub_800EE5C(s32 r0)
|
||||
|
||||
void sub_800EEC8(u16 r0)
|
||||
{
|
||||
s16 *ret;
|
||||
unkStruct_80BDBC4 *ret;
|
||||
ret = sub_800ECB8(r0);
|
||||
sub_800EE5C(ret[0]);
|
||||
sub_800EE5C(ret->unk0);
|
||||
}
|
||||
|
||||
void sub_800EEE0(u16 r0)
|
||||
{
|
||||
s16 *ret;
|
||||
unkStruct_80BDBC4 *ret;
|
||||
ret = sub_800ECB8(r0);
|
||||
sub_800EE5C(ret[2]);
|
||||
sub_800EE5C(ret->unk4);
|
||||
}
|
||||
|
||||
void sub_800EEF8(u16 r0)
|
||||
{
|
||||
s16 *ret;
|
||||
unkStruct_80BDBC4 *ret;
|
||||
ret = sub_800ECB8(r0);
|
||||
sub_800EE5C(ret[1]);
|
||||
sub_800EE5C(ret->unk2);
|
||||
}
|
||||
|
||||
void sub_800EF10(u16 r0)
|
||||
{
|
||||
s16 *ret;
|
||||
unkStruct_80BDBC4 *ret;
|
||||
ret = sub_800ECB8(r0);
|
||||
sub_800EE5C(ret[3]);
|
||||
sub_800EE5C(ret->unk6);
|
||||
}
|
||||
|
||||
void sub_800EF28(u8 r0)
|
||||
|
Loading…
Reference in New Issue
Block a user