Merge pull request #338 from remicalixte/unk_02015E30

Decompile unk_02015E30.s
This commit is contained in:
Akira Akashi
2021-03-19 20:18:27 +00:00
committed by GitHub
3 changed files with 59 additions and 72 deletions

View File

@@ -1,72 +0,0 @@
.include "asm/macros.inc"
.include "global.inc"
.section .bss
.global UNK_021C4898
UNK_021C4898: ; 0x021C4898
.space 0x20
.text
thumb_func_start FUN_02015E30
FUN_02015E30: ; 0x02015E30
ldr r0, _02015E38 ; =UNK_021C4898
mov r1, #0x0
str r1, [r0, #0x0]
bx lr
.balign 4
_02015E38: .word UNK_021C4898
thumb_func_start FUN_02015E3C
FUN_02015E3C: ; 0x02015E3C
push {r3, lr}
ldr r1, _02015E5C ; =UNK_021C4898
mov r2, #0x1
str r2, [r1, #0x0]
mov r2, #0x0
str r2, [r1, #0x10]
str r2, [r1, #0x14]
str r2, [r1, #0x8]
str r2, [r1, #0xc]
str r0, [r1, #0x4]
bl FUN_02020BF4
ldr r2, _02015E5C ; =UNK_021C4898
str r0, [r2, #0x18]
str r1, [r2, #0x1c]
pop {r3, pc}
.balign 4
_02015E5C: .word UNK_021C4898
thumb_func_start FUN_02015E60
FUN_02015E60: ; 0x02015E60
push {r3-r5, lr}
ldr r0, _02015E9C ; =UNK_021C4898
ldr r0, [r0, #0x0]
cmp r0, #0x0
beq _02015E9A
bl FUN_02020BF4
ldr r2, _02015E9C ; =UNK_021C4898
ldr r3, [r2, #0x18]
ldr r2, [r2, #0x1c]
sub r0, r0, r3
sbc r1, r2
bl FUN_02020C14
add r5, r1, #0x0
ldr r1, _02015E9C ; =UNK_021C4898
add r4, r0, #0x0
ldr r3, [r1, #0x8]
ldr r2, [r1, #0xc]
sub r0, r3, r4
sbc r2, r5
bhs _02015E9A
ldr r0, [r1, #0x4]
sub r1, r4, r3
bl AddIGTSeconds
ldr r0, _02015E9C ; =UNK_021C4898
str r4, [r0, #0x8]
str r5, [r0, #0xc]
_02015E9A:
pop {r3-r5, pc}
.balign 4
_02015E9C: .word UNK_021C4898

38
arm9/src/unk_02015E30.c Normal file
View File

@@ -0,0 +1,38 @@
#include "unk_02015E30.h"
extern u64 FUN_02020BF4();
extern u64 FUN_02020C14(u64 param0);
struct UnkStruct_02015E30 UNK_021C4898;
THUMB_FUNC void FUN_02015E30()
{
UNK_021C4898.unk00 = 0;
}
THUMB_FUNC void FUN_02015E3C(struct IGT *igt)
{
struct UnkStruct_02015E30 *unk1 = &UNK_021C4898;
UNK_021C4898.unk00 = 1;
UNK_021C4898.unk10 = 0;
UNK_021C4898.unk14 = 0;
UNK_021C4898.unk08 = 0;
UNK_021C4898.unk04 = igt;
UNK_021C4898.unk18 = FUN_02020BF4();
}
THUMB_FUNC void FUN_02015E60()
{
if (UNK_021C4898.unk00 != 0)
{
u64 res = FUN_02020C14(FUN_02020BF4() - UNK_021C4898.unk18);
if (UNK_021C4898.unk08 < res)
{
AddIGTSeconds(UNK_021C4898.unk04, (u32)(res - UNK_021C4898.unk08));
UNK_021C4898.unk08 = res;
}
}
}

21
include/unk_02015E30.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef POKEDIAMOND_UNK_02015E30_H
#define POKEDIAMOND_UNK_02015E30_H
#include "global.h"
#include "igt.h"
struct UnkStruct_02015E30
{
u32 unk00;
struct IGT *unk04;
u64 unk08;
u32 unk10;
u32 unk14;
u64 unk18;
};
THUMB_FUNC void FUN_02015E30();
THUMB_FUNC void FUN_02015E3C(struct IGT *igt);
THUMB_FUNC void FUN_02015E60();
#endif //POKEDIAMOND_UNK_02015E30_H