diff options
author | Rémi Calixte <remicalixte.rmc@gmail.com> | 2021-03-19 20:56:32 +0100 |
---|---|---|
committer | Rémi Calixte <remicalixte.rmc@gmail.com> | 2021-03-19 21:03:42 +0100 |
commit | 7dd1e6b1a3ce58430bca1d2ad95d68f7c7c7a0ea (patch) | |
tree | c2aa291fe5064fe17f993cdd4539446126b8d584 | |
parent | 885d7c10805d581e4758e57ada3908b5dc9eded7 (diff) |
decomp 02015E30
-rw-r--r-- | arm9/asm/unk_02015E30.s | 72 | ||||
-rw-r--r-- | arm9/src/unk_02015E30.c | 38 | ||||
-rw-r--r-- | include/unk_02015E30.h | 21 |
3 files changed, 59 insertions, 72 deletions
diff --git a/arm9/asm/unk_02015E30.s b/arm9/asm/unk_02015E30.s deleted file mode 100644 index 9ca09399..00000000 --- a/arm9/asm/unk_02015E30.s +++ /dev/null @@ -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 diff --git a/arm9/src/unk_02015E30.c b/arm9/src/unk_02015E30.c new file mode 100644 index 00000000..848bc3ad --- /dev/null +++ b/arm9/src/unk_02015E30.c @@ -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; + } + } +}
\ No newline at end of file diff --git a/include/unk_02015E30.h b/include/unk_02015E30.h new file mode 100644 index 00000000..7d565beb --- /dev/null +++ b/include/unk_02015E30.h @@ -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
\ No newline at end of file |