diff options
author | Rémi Calixte <remicalixte.rmc@gmail.com> | 2021-04-16 11:57:16 +0200 |
---|---|---|
committer | Rémi Calixte <remicalixte.rmc@gmail.com> | 2021-04-16 13:46:42 +0200 |
commit | 2023f223aa3cfce3d8e17cddf3833dc8510c443e (patch) | |
tree | e191947826407a84718ab34d7dd96a600217fb62 | |
parent | 85a8a2bd43633e11af094d66a35f3c32dc7c8bfe (diff) |
decomp unk_0202D858.s
-rw-r--r-- | arm9/asm/unk_0202D858.s | 90 | ||||
-rw-r--r-- | arm9/src/unk_0202D858.c | 96 | ||||
-rw-r--r-- | arm9/src/unk_0202F150.c | 18 | ||||
-rw-r--r-- | include/unk_0202D858.h | 10 | ||||
-rw-r--r-- | include/unk_0202F150.h | 5 |
5 files changed, 117 insertions, 102 deletions
diff --git a/arm9/asm/unk_0202D858.s b/arm9/asm/unk_0202D858.s deleted file mode 100644 index e678326d..00000000 --- a/arm9/asm/unk_0202D858.s +++ /dev/null @@ -1,90 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .section .rodata - - .global UNK_020EEB04 -UNK_020EEB04: ; 0x020EEB04 - .byte 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x04, 0x03, 0x04, 0x07, 0x03, 0x07, 0x04, 0x01, 0x04 - .byte 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00 - - .global UNK_020EEB1E -UNK_020EEB1E: ; 0x020EEB1E - .byte 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 - .byte 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00 - - .text - - thumb_func_start FUN_0202D858 -FUN_0202D858: ; 0x0202D858 - push {r3-r4, lr} - sub sp, #0x1c - ldr r3, _0202D880 ; =UNK_020EEB04 - add r4, r0, #0x0 - add r2, sp, #0x0 - mov r1, #0x1a -_0202D864: - ldrb r0, [r3, #0x0] - add r3, r3, #0x1 - strb r0, [r2, #0x0] - add r2, r2, #0x1 - sub r1, r1, #0x1 - bne _0202D864 - cmp r4, #0x1a - blo _0202D878 - bl ErrorHandling -_0202D878: - add r0, sp, #0x0 - ldrb r0, [r0, r4] - add sp, #0x1c - pop {r3-r4, pc} - .balign 4 -_0202D880: .word UNK_020EEB04 - - thumb_func_start FUN_0202D884 -FUN_0202D884: ; 0x0202D884 - push {r3-r4, lr} - sub sp, #0x1c - ldr r3, _0202D8AC ; =UNK_020EEB1E - add r4, r0, #0x0 - add r2, sp, #0x0 - mov r1, #0x1a -_0202D890: - ldrb r0, [r3, #0x0] - add r3, r3, #0x1 - strb r0, [r2, #0x0] - add r2, r2, #0x1 - sub r1, r1, #0x1 - bne _0202D890 - cmp r4, #0x1a - blo _0202D8A4 - bl ErrorHandling -_0202D8A4: - add r0, sp, #0x0 - ldrb r0, [r0, r4] - add sp, #0x1c - pop {r3-r4, pc} - .balign 4 -_0202D8AC: .word UNK_020EEB1E - - thumb_func_start FUN_0202D8B0 -FUN_0202D8B0: ; 0x0202D8B0 - cmp r0, #0xd - bgt _0202D8C4 - cmp r0, #0x7 - blt _0202D8CC - beq _0202D8C8 - cmp r0, #0x9 - beq _0202D8C8 - cmp r0, #0xd - beq _0202D8C8 - b _0202D8CC -_0202D8C4: - cmp r0, #0x12 - bne _0202D8CC -_0202D8C8: - mov r0, #0x1 - bx lr -_0202D8CC: - mov r0, #0x0 - bx lr diff --git a/arm9/src/unk_0202D858.c b/arm9/src/unk_0202D858.c new file mode 100644 index 00000000..45c7c776 --- /dev/null +++ b/arm9/src/unk_0202D858.c @@ -0,0 +1,96 @@ +#include "unk_0202D858.h" + +struct UnkStruct_0202D858 +{ + u8 unk00[0x1a]; +}; + +static const struct UnkStruct_0202D858 UNK_020EEB04 = { { + 0x01, + 0x01, + 0x01, + 0x01, + 0x03, + 0x03, + 0x03, + 0x04, + 0x03, + 0x04, + 0x07, + 0x03, + 0x07, + 0x04, + 0x01, + 0x04, + 0x01, + 0x01, + 0x04, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x00, + 0x00, +} }; + +static const struct UnkStruct_0202D858 UNK_020EEB1E = { { + 0x01, + 0x01, + 0x01, + 0x01, + 0x03, + 0x03, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x00, + 0x00, +} }; + +THUMB_FUNC u8 FUN_0202D858(u16 param0) +{ + struct UnkStruct_0202D858 st0 = UNK_020EEB04; + + GF_ASSERT(param0 < 0x1a); + + return st0.unk00[param0]; +} + +THUMB_FUNC u8 FUN_0202D884(u16 param0) +{ + struct UnkStruct_0202D858 st0 = UNK_020EEB1E; + + GF_ASSERT(param0 < 0x1a); + + return st0.unk00[param0]; +} + +THUMB_FUNC u32 FUN_0202D8B0(int param0) +{ + switch (param0) + { + case 0x7: + case 0x9: + case 0xd: + case 0x12: + return 1; + } + + return 0; +} diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c index 23a7de85..d36c5794 100644 --- a/arm9/src/unk_0202F150.c +++ b/arm9/src/unk_0202F150.c @@ -9,7 +9,6 @@ vu8 UNK_02105D58 = 4; vu8 UNK_02105D59 = 4; extern int FUN_02033534(); -extern u32 FUN_0202D858(u16 param0); extern void FUN_02031480(u32 param0); extern void FUN_0202D7D8(u8 *param0, u32 param1, struct UnkStruct0202F150_sub1 *param2); extern u32 FUN_0200CA60(void (*param0)(), u32 param1, u32 param2); @@ -57,7 +56,6 @@ extern u32 FUN_0202EDF8(); extern u16 FUN_0202D19C(); extern void FUN_020334E8(u32 param0, u32 param1); extern u32 FUN_0202EE60(); -extern u32 FUN_0202D884(u16 param0); extern void FUN_0202F05C(); extern void GF_RTC_CopyDateTime(RTCDate *, RTCTime *); extern void FUN_0202D830(u8 *param0, u32 param1); @@ -69,7 +67,7 @@ THUMB_FUNC u32 FUN_0202F150(u32 param0, u32 param1) UNK_021C59F4.unk00 = 0; if (param0 != 0) { - u32 res = FUN_0202D858((u16)FUN_02033534()) + 1; + int res = FUN_0202D858((u16)FUN_02033534()) + 1; if (UNK_021C59F4.unk04 != 0) { @@ -148,7 +146,7 @@ THUMB_FUNC void FUN_0202F2F0() UNK_021C59F4.unk04->unk67F = 0; UNK_021C59F4.unk04->unk680 = 0; - int res = (int)FUN_0202D858((u16)FUN_02033534()) + 1; + int res = FUN_0202D858((u16)FUN_02033534()) + 1; MI_CpuFill8(UNK_021C59F4.unk04->unk458, 0, UNK_021C59F4.unk04->unk658 * res); @@ -236,7 +234,7 @@ THUMB_FUNC void FUN_0202F5A4() UNK_021C59F4.unk04->unk62C = 0; UNK_021C59F4.unk04->unk62D = 0; - int res = (int)FUN_0202D858((u16)FUN_02033534()) + 1; + int res = FUN_0202D858((u16)FUN_02033534()) + 1; MI_CpuFill8(UNK_021C59F4.unk04->unk458, 0, UNK_021C59F4.unk04->unk658 * res); @@ -883,7 +881,7 @@ THUMB_FUNC void FUN_0202FEEC() } int st0 = FUN_02031228((u16)FUN_02033534()); - int r6 = (int)FUN_0202D858((u16)FUN_02033534()) + 1; + int r6 = FUN_0202D858((u16)FUN_02033534()) + 1; if (UNK_02105D59 == 2 || UNK_02105D59 == 0) { @@ -1100,7 +1098,7 @@ THUMB_FUNC void FUN_0203026C(u32 param0, u8 *param1, u32 param2) if (FUN_0202FA28() == 1) { int r6 = FUN_02031228((u16)FUN_02033534()); - int st4 = (int)FUN_0202D858((u16)FUN_02033534()) + 1; + int st4 = FUN_0202D858((u16)FUN_02033534()) + 1; int r4 = 0; while (r4 < st4) @@ -1946,7 +1944,7 @@ THUMB_FUNC void FUN_02030DFC() { if (UNK_021C59F4.unk04->unk68B == 0) { - int r7 = (int)FUN_0202D858((u16)FUN_02033534()) + 1; + int r7 = FUN_0202D858((u16)FUN_02033534()) + 1; int r4; for (r4 = 0; r4 < r7; r4++) { @@ -2258,12 +2256,12 @@ THUMB_FUNC int FUN_02031228(u16 param0) return 0x26; } -THUMB_FUNC u32 FUN_02031248(u32 param0) +THUMB_FUNC int FUN_02031248(u32 param0) { return FUN_0202D858((u16)param0) + 1; } -THUMB_FUNC u32 FUN_02031258(u32 param0) +THUMB_FUNC int FUN_02031258(u32 param0) { return FUN_0202D884((u16)param0) + 1; } diff --git a/include/unk_0202D858.h b/include/unk_0202D858.h new file mode 100644 index 00000000..210821d0 --- /dev/null +++ b/include/unk_0202D858.h @@ -0,0 +1,10 @@ +#ifndef POKEDIAMOND_UNK_0202D858_H +#define POKEDIAMOND_UNK_0202D858_H + +#include "global.h" + +THUMB_FUNC u8 FUN_0202D858(u16 param0); +THUMB_FUNC u8 FUN_0202D884(u16 param0); +THUMB_FUNC u32 FUN_0202D8B0(int param0); + +#endif // POKEDIAMOND_UNK_0202D858_H diff --git a/include/unk_0202F150.h b/include/unk_0202F150.h index 3996c1c8..77fb4f7d 100644 --- a/include/unk_0202F150.h +++ b/include/unk_0202F150.h @@ -6,6 +6,7 @@ #include "RTC_api.h" #include "heap.h" #include "main.h" +#include "unk_0202D858.h" struct UnkStruct0202F150_sub1 { @@ -163,8 +164,8 @@ THUMB_FUNC u32 FUN_020311DC(u32 param0); THUMB_FUNC u32 FUN_020311E8(); THUMB_FUNC u32 FUN_020311F0(); THUMB_FUNC int FUN_02031228(u16 param0); -THUMB_FUNC u32 FUN_02031248(u32 param0); -THUMB_FUNC u32 FUN_02031258(u32 param0); +THUMB_FUNC int FUN_02031248(u32 param0); +THUMB_FUNC int FUN_02031258(u32 param0); THUMB_FUNC void FUN_02031268(u8 param0); THUMB_FUNC u8 FUN_02031280(); THUMB_FUNC void FUN_0203129C(); |