diff options
-rw-r--r-- | arm9/asm/unk_0200AA80.s | 6 | ||||
-rw-r--r-- | arm9/asm/unk_02015CC0.s | 60 | ||||
-rw-r--r-- | arm9/src/unk_02015CC0.c | 31 | ||||
-rw-r--r-- | include/unk_02015CC0.h | 8 |
4 files changed, 42 insertions, 63 deletions
diff --git a/arm9/asm/unk_0200AA80.s b/arm9/asm/unk_0200AA80.s index ccf022f4..165a789e 100644 --- a/arm9/asm/unk_0200AA80.s +++ b/arm9/asm/unk_0200AA80.s @@ -5,9 +5,9 @@ .global UNK_020ECE64 UNK_020ECE64: ; 0x020ECE64 - .short 0x017E - .short 0x0180 - .short 0x017F + .short 0x017E ; Locations + .short 0x0180 ; Gifts/trades + .short 0x017F ; Events .balign 4 .global UNK_020ECE6C diff --git a/arm9/asm/unk_02015CC0.s b/arm9/asm/unk_02015CC0.s deleted file mode 100644 index 32de27da..00000000 --- a/arm9/asm/unk_02015CC0.s +++ /dev/null @@ -1,60 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .section .rodata - - .global UNK_020ED72C -UNK_020ED72C: ; 0x020ED72C - .byte 0x00, 0x00, 0xD0, 0x07, 0xB8, 0x0B, 0x00, 0x00 - - .text - - thumb_func_start FUN_02015CC0 -FUN_02015CC0: ; 0x02015CC0 - ldr r3, _02015CDC ; =UNK_020ED72C - mov r2, #0x0 -_02015CC4: - ldrh r1, [r3, #0x2] - cmp r0, r1 - bhs _02015CCE - add r0, r2, #0x0 - bx lr -_02015CCE: - add r2, r2, #0x1 - add r3, r3, #0x2 - cmp r2, #0x2 - blt _02015CC4 - add r0, r2, #0x0 - bx lr - nop -_02015CDC: .word UNK_020ED72C - - thumb_func_start FUN_02015CE0 -FUN_02015CE0: ; 0x02015CE0 - push {r4, lr} - add r4, r0, #0x0 - bl FUN_02015CC0 - lsl r1, r0, #0x1 - ldr r0, _02015CF4 ; =UNK_020ED72C - ldrh r0, [r0, r1] - sub r0, r4, r0 - pop {r4, pc} - nop -_02015CF4: .word UNK_020ED72C - - thumb_func_start FUN_02015CF8 -FUN_02015CF8: ; 0x02015CF8 - push {r3-r5, lr} - add r5, r0, #0x0 - add r4, r1, #0x0 - cmp r5, #0x3 - blt _02015D06 - bl ErrorHandling -_02015D06: - ldr r0, _02015D10 ; =UNK_020ED72C - lsl r1, r5, #0x1 - ldrh r0, [r0, r1] - add r0, r4, r0 - pop {r3-r5, pc} - .balign 4 -_02015D10: .word UNK_020ED72C diff --git a/arm9/src/unk_02015CC0.c b/arm9/src/unk_02015CC0.c new file mode 100644 index 00000000..5da221d0 --- /dev/null +++ b/arm9/src/unk_02015CC0.c @@ -0,0 +1,31 @@ +#include "global.h" +#include "unk_02015CC0.h" + +#pragma thumb on + +const u16 UNK_020ED72C[] = { + 0, + 2000, + 3000 +}; + +int FUN_02015CC0(u16 a0) +{ + int i; + for (i = 0; i < (int)NELEMS(UNK_020ED72C) - 1; i++) { + if (a0 < UNK_020ED72C[i + 1]) + return i; + } + return i; +} + +int FUN_02015CE0(u16 a0) +{ + return a0 - UNK_020ED72C[FUN_02015CC0(a0)]; +} + +int FUN_02015CF8(int a0, int a1) +{ + GF_ASSERT(a0 < (int)NELEMS(UNK_020ED72C)); + return a1 + UNK_020ED72C[a0]; +} diff --git a/include/unk_02015CC0.h b/include/unk_02015CC0.h new file mode 100644 index 00000000..206afe6f --- /dev/null +++ b/include/unk_02015CC0.h @@ -0,0 +1,8 @@ +#ifndef POKEDIAMOND_UNK_02015CC0_H +#define POKEDIAMOND_UNK_02015CC0_H + +int FUN_02015CC0(u16 a0); +int FUN_02015CE0(u16 a0); +int FUN_02015CF8(int a0, int a1); + +#endif //POKEDIAMOND_UNK_02015CC0_H |