From 73ec250ff8c01d64c08f0ebbe75cd3b741a25102 Mon Sep 17 00:00:00 2001 From: who-knows-who Date: Wed, 21 Oct 2020 14:09:43 +0100 Subject: Matched file unk_0202A8F4.s --- arm9/asm/unk_0202A8F4.s | 36 ---------------------------------- arm9/src/unk_0202A8F4.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 36 deletions(-) delete mode 100644 arm9/asm/unk_0202A8F4.s create mode 100644 arm9/src/unk_0202A8F4.c diff --git a/arm9/asm/unk_0202A8F4.s b/arm9/asm/unk_0202A8F4.s deleted file mode 100644 index ea063dd7..00000000 --- a/arm9/asm/unk_0202A8F4.s +++ /dev/null @@ -1,36 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_0202A8F4 -FUN_0202A8F4: ; 0x0202A8F4 - mov r0, #0xe - bx lr - - thumb_func_start FUN_0202A8F8 -FUN_0202A8F8: ; 0x0202A8F8 - mov r1, #0x0 - strb r1, [r0, #0x0] - strb r1, [r0, #0x1] - strb r1, [r0, #0x2] - strb r1, [r0, #0x3] - strb r1, [r0, #0x4] - strb r1, [r0, #0x5] - strb r1, [r0, #0x6] - strb r1, [r0, #0x7] - strb r1, [r0, #0x8] - strb r1, [r0, #0x9] - strb r1, [r0, #0xa] - strb r1, [r0, #0xb] - strb r1, [r0, #0xc] - strb r1, [r0, #0xd] - bx lr - - thumb_func_start FUN_0202A918 -FUN_0202A918: ; 0x0202A918 - ldr r3, _0202A920 ; =SavArray_get - mov r1, #0x18 - bx r3 - nop -_0202A920: .word SavArray_get diff --git a/arm9/src/unk_0202A8F4.c b/arm9/src/unk_0202A8F4.c new file mode 100644 index 00000000..66a0244b --- /dev/null +++ b/arm9/src/unk_0202A8F4.c @@ -0,0 +1,52 @@ +#include "global.h" +#include "save_block_2.h" + +struct Unk0202A8F4 +{ + u8 u_0; + u8 u_1; + u8 u_2; + u8 u_3; + u8 u_4; + u8 u_5; + u8 u_6; + u8 u_7; + u8 u_8; + u8 u_9; + u8 u_A; + u8 u_B; + u8 u_C; + u8 u_D; +}; + +u32 FUN_0202A8F4(); +void FUN_0202A8F8(struct Unk0202A8F4 *unk); +void *FUN_0202A918(void *arg0); + +THUMB_FUNC u32 FUN_0202A8F4() +{ + return sizeof(struct Unk0202A8F4); +} + +THUMB_FUNC void FUN_0202A8F8(struct Unk0202A8F4 *unk) +{ + unk->u_0 = 0; + unk->u_1 = 0; + unk->u_2 = 0; + unk->u_3 = 0; + unk->u_4 = 0; + unk->u_5 = 0; + unk->u_6 = 0; + unk->u_7 = 0; + unk->u_8 = 0; + unk->u_9 = 0; + unk->u_A = 0; + unk->u_B = 0; + unk->u_C = 0; + unk->u_D = 0; +} + +THUMB_FUNC void *FUN_0202A918(void *arg0) +{ + return SavArray_get(arg0, 24); +} -- cgit v1.2.3 From 63c38056c3b7bf9563207db9169d37973a068bd9 Mon Sep 17 00:00:00 2001 From: who-knows-who Date: Wed, 21 Oct 2020 14:10:56 +0100 Subject: Matched file unk_0201CBEC.s --- arm9/asm/unk_0201CBEC.s | 20 -------------------- arm9/src/unk_0201CBEC.c | 12 ++++++++++++ 2 files changed, 12 insertions(+), 20 deletions(-) delete mode 100644 arm9/asm/unk_0201CBEC.s create mode 100644 arm9/src/unk_0201CBEC.c diff --git a/arm9/asm/unk_0201CBEC.s b/arm9/asm/unk_0201CBEC.s deleted file mode 100644 index cd295439..00000000 --- a/arm9/asm/unk_0201CBEC.s +++ /dev/null @@ -1,20 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_0201CBEC -FUN_0201CBEC: ; 0x0201CBEC - push {r3, lr} - sub r0, r0, r2 - sub r2, r1, r3 - add r1, r0, #0x0 - mul r1, r0 - add r0, r2, #0x0 - mul r0, r2 - add r0, r1, r0 - lsl r0, r0, #0xc - bl FX_Sqrt - asr r0, r0, #0xc - pop {r3, pc} - .balign 4 diff --git a/arm9/src/unk_0201CBEC.c b/arm9/src/unk_0201CBEC.c new file mode 100644 index 00000000..0e75c3ff --- /dev/null +++ b/arm9/src/unk_0201CBEC.c @@ -0,0 +1,12 @@ +#include "global.h" +#include "fx.h" + +int FUN_0201CBEC(int a0, int a1, int a2, int a3); + +THUMB_FUNC int FUN_0201CBEC(int a0, int a1, int a2, int a3) { + + int r0 = a0 - a2; + int r2 = a1 - a3; + + return FX_Sqrt((r0 * r0 + r2 * r2) << 0xc) >> 0xc; +} \ No newline at end of file -- cgit v1.2.3 From df909e012e1fa795e813157072359e3e1f520550 Mon Sep 17 00:00:00 2001 From: who-knows-who Date: Thu, 22 Oct 2020 11:59:51 +0100 Subject: Matched file unk_0202ABBC.s --- arm9/asm/unk_0202ABBC.s | 81 ------------------------------------------------- arm9/src/unk_0202ABBC.c | 64 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 81 deletions(-) delete mode 100644 arm9/asm/unk_0202ABBC.s create mode 100644 arm9/src/unk_0202ABBC.c diff --git a/arm9/asm/unk_0202ABBC.s b/arm9/asm/unk_0202ABBC.s deleted file mode 100644 index e8225116..00000000 --- a/arm9/asm/unk_0202ABBC.s +++ /dev/null @@ -1,81 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_0202ABBC -FUN_0202ABBC: ; 0x0202ABBC - ldr r3, _0202ABC4 ; =SavArray_get - mov r1, #0x1a - bx r3 - nop -_0202ABC4: .word SavArray_get - - thumb_func_start FUN_0202ABC8 -FUN_0202ABC8: ; 0x0202ABC8 - mov r0, #0xf4 - bx lr - - thumb_func_start FUN_0202ABCC -FUN_0202ABCC: ; 0x0202ABCC - ldr r3, _0202ABD8 ; =MIi_CpuClearFast - add r1, r0, #0x0 - mov r0, #0x0 - mov r2, #0xf4 - bx r3 - nop -_0202ABD8: .word MIi_CpuClearFast - - thumb_func_start FUN_0202ABDC -FUN_0202ABDC: ; 0x0202ABDC - add r0, #0xec - ldrh r0, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start FUN_0202ABE4 -FUN_0202ABE4: ; 0x0202ABE4 - add r0, #0xec - strh r1, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start FUN_0202ABEC -FUN_0202ABEC: ; 0x0202ABEC - ldr r3, _0202ABF4 ; =MIi_CpuCopyFast - mov r2, #0xec - bx r3 - nop -_0202ABF4: .word MIi_CpuCopyFast - - thumb_func_start FUN_0202ABF8 -FUN_0202ABF8: ; 0x0202ABF8 - ldr r3, _0202AC04 ; =MIi_CpuCopyFast - add r2, r0, #0x0 - add r0, r1, #0x0 - add r1, r2, #0x0 - mov r2, #0xec - bx r3 - .balign 4 -_0202AC04: .word MIi_CpuCopyFast - - thumb_func_start FUN_0202AC08 -FUN_0202AC08: ; 0x0202AC08 - add r0, #0xf0 - ldr r0, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start FUN_0202AC10 -FUN_0202AC10: ; 0x0202AC10 - add r0, #0xf0 - str r1, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start FUN_0202AC18 -FUN_0202AC18: ; 0x0202AC18 - add r0, #0xee - ldrh r0, [r0, #0x0] - bx lr - .balign 4 diff --git a/arm9/src/unk_0202ABBC.c b/arm9/src/unk_0202ABBC.c new file mode 100644 index 00000000..2a15b9fd --- /dev/null +++ b/arm9/src/unk_0202ABBC.c @@ -0,0 +1,64 @@ +#include "global.h" +#include "save_block_2.h" +#include "MI_memory.h" + +void *FUN_0202ABBC(struct SaveBlock2* sav); +u32 FUN_0202ABC8(); +void FUN_0202ABCC(void *destp); +u16 FUN_0202ABDC(void *unkSavStruct); +void FUN_0202ABE4(void *unkSavStruct, u16 data); +void FUN_0202ABEC(void *srcp, void *destp); +void FUN_0202ABF8(void *destp, void *srcp); +u32 FUN_0202AC08(void *unkStruct); +void FUN_0202AC10(void *unkStruct, u32 data); +u16 FUN_0202AC18(void *unkStruct); + +THUMB_FUNC void *FUN_0202ABBC(struct SaveBlock2* sav) +{ + return SavArray_get(sav, 26); +} + +THUMB_FUNC u32 FUN_0202ABC8() +{ + return 0xf4; // 244 +} + +THUMB_FUNC void FUN_0202ABCC(void *destp) +{ + MIi_CpuClearFast(0, destp, 0xf4); +} + +THUMB_FUNC u16 FUN_0202ABDC(void *unkSavStruct) +{ + return *(u16 *)(unkSavStruct + 0xec); +} + +THUMB_FUNC void FUN_0202ABE4(void *unkSavStruct, u16 data) +{ + *(u16 *)(unkSavStruct + 0xec) = data; +} + +THUMB_FUNC void FUN_0202ABEC(void *srcp, void *destp) +{ + MIi_CpuCopyFast(srcp, destp, 0xec); +} + +THUMB_FUNC void FUN_0202ABF8(void *destp, void *srcp) +{ + MIi_CpuCopyFast(srcp, destp, 0xec); +} + +THUMB_FUNC u32 FUN_0202AC08(void *unkStruct) +{ + return *(u32 *)(unkStruct + 0xf0); +} + +THUMB_FUNC void FUN_0202AC10(void *unkStruct, u32 data) +{ + *(u32 *)(unkStruct + 0xf0) = data; +} + +THUMB_FUNC u16 FUN_0202AC18(void *unkStruct) +{ + return *(u16 *)(unkStruct + 0xee); +} \ No newline at end of file -- cgit v1.2.3 From 61dee8c8ed498f44d2cf56fef785fc04e82dd3cf Mon Sep 17 00:00:00 2001 From: who-knows-who Date: Fri, 23 Oct 2020 11:24:49 +0100 Subject: Matched file unk_0202C0E0.s --- arm9/asm/unk_0202C0E0.s | 67 ------------------------------------------------- arm9/src/unk_0202C0E0.c | 50 ++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 67 deletions(-) delete mode 100644 arm9/asm/unk_0202C0E0.s create mode 100644 arm9/src/unk_0202C0E0.c diff --git a/arm9/asm/unk_0202C0E0.s b/arm9/asm/unk_0202C0E0.s deleted file mode 100644 index 5f489515..00000000 --- a/arm9/asm/unk_0202C0E0.s +++ /dev/null @@ -1,67 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_0202C0E0 -FUN_0202C0E0: ; 0x0202C0E0 - mov r0, #0x28 - bx lr - - thumb_func_start FUN_0202C0E4 -FUN_0202C0E4: ; 0x0202C0E4 - push {r4-r5} - mov r4, #0x0 - add r1, r4, #0x0 - add r2, r4, #0x0 -_0202C0EC: - add r3, r2, #0x0 - add r5, r0, #0x0 -_0202C0F0: - add r3, r3, #0x1 - strh r1, [r5, #0x0] - add r5, r5, #0x2 - cmp r3, #0x4 - blt _0202C0F0 - add r4, r4, #0x1 - add r0, #0x8 - cmp r4, #0x5 - blt _0202C0EC - pop {r4-r5} - bx lr - .balign 4 - - thumb_func_start FUN_0202C108 -FUN_0202C108: ; 0x0202C108 - push {r3-r5, lr} - add r5, r1, #0x0 - mov r1, #0x21 - add r4, r2, #0x0 - bl SavArray_get - lsl r1, r5, #0x3 - add r3, r0, r1 - lsl r2, r4, #0x1 - ldrh r1, [r3, r2] - ldr r0, _0202C128 ; =0x0000270F - cmp r1, r0 - bhs _0202C126 - add r0, r1, #0x1 - strh r0, [r3, r2] -_0202C126: - pop {r3-r5, pc} - .balign 4 -_0202C128: .word 0x0000270F - - thumb_func_start FUN_0202C12C -FUN_0202C12C: ; 0x0202C12C - push {r3-r5, lr} - add r5, r1, #0x0 - mov r1, #0x21 - add r4, r2, #0x0 - bl SavArray_get - lsl r2, r5, #0x3 - lsl r1, r4, #0x1 - add r0, r0, r2 - ldrh r0, [r1, r0] - pop {r3-r5, pc} - .balign 4 diff --git a/arm9/src/unk_0202C0E0.c b/arm9/src/unk_0202C0E0.c new file mode 100644 index 00000000..b39570fe --- /dev/null +++ b/arm9/src/unk_0202C0E0.c @@ -0,0 +1,50 @@ +#include "global.h" +#include "save_block_2.h" + + +struct UnkSaveStruct0202C0E4 +{ + u16 data[5][4]; +}; + +u32 FUN_0202C0E0(); +void FUN_0202C0E4(struct UnkSaveStruct0202C0E4 *unkStruct); +void FUN_0202C108(struct SaveBlock2 *save, u32 a1, u32 a2); +u16 FUN_0202C12C(struct SaveBlock2 *save, u32 a1, u32 a2); + + +THUMB_FUNC u32 FUN_0202C0E0() +{ + return sizeof(struct UnkSaveStruct0202C0E4); // 40 +} + + +THUMB_FUNC void FUN_0202C0E4(struct UnkSaveStruct0202C0E4 *unkStruct) +{ + + int j, i = 0; + + do { + j = 0; + do { + unkStruct->data[i][j] = 0; + j++; + } while (j < 4); + i++; + } while (i < 5); +} + +THUMB_FUNC void FUN_0202C108(struct SaveBlock2 *save, u32 a1, u32 a2) +{ + struct UnkSaveStruct0202C0E4 *unkSavStruct = SavArray_get(save, 0x21); + if (unkSavStruct->data[a1][a2] < 9999) + { + unkSavStruct->data[a1][a2]++; + } +} + +THUMB_FUNC u16 FUN_0202C12C(struct SaveBlock2 *save, u32 a1, u32 a2) +{ + struct UnkSaveStruct0202C0E4 *unkSavStruct = SavArray_get(save, 0x21); + return unkSavStruct->data[a1][a2]; +} \ No newline at end of file -- cgit v1.2.3 From e13202e2f19c9f1673a021dbcc062d96b9f0f06c Mon Sep 17 00:00:00 2001 From: who-knows-who Date: Fri, 23 Oct 2020 14:50:33 +0100 Subject: Matched file unk_0202C144.s --- arm9/asm/unk_0202C144.s | 42 ------------------------------------------ arm9/src/unk_0202C144.c | 18 ++++++++++++++++++ include/unk_02029FBO.h | 10 ++++++++++ 3 files changed, 28 insertions(+), 42 deletions(-) delete mode 100644 arm9/asm/unk_0202C144.s create mode 100644 arm9/src/unk_0202C144.c create mode 100644 include/unk_02029FBO.h diff --git a/arm9/asm/unk_0202C144.s b/arm9/asm/unk_0202C144.s deleted file mode 100644 index fb5bc6c4..00000000 --- a/arm9/asm/unk_0202C144.s +++ /dev/null @@ -1,42 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_0202C144 -FUN_0202C144: ; 0x0202C144 - push {r3-r7, lr} - add r4, r1, #0x0 - add r5, r0, #0x0 - add r0, r4, #0x0 - mov r1, #0x4c - mov r2, #0x0 - bl GetMonData - cmp r0, #0x0 - bne _0202C194 - add r0, r5, #0x0 - bl Sav2_Pokedex_get - add r6, r0, #0x0 - add r0, r5, #0x0 - bl FUN_02029FC8 - add r7, r0, #0x0 - add r0, r4, #0x0 - mov r1, #0x5 - mov r2, #0x0 - bl GetMonData - add r2, r0, #0x0 - lsl r2, r2, #0x10 - add r0, r7, #0x0 - add r1, r6, #0x0 - lsr r2, r2, #0x10 - bl FUN_0202A1C4 - add r0, r6, #0x0 - add r1, r4, #0x0 - bl Pokedex_SetMonCaughtFlag - add r0, r5, #0x0 - bl Sav2_Poketch_get - add r1, r4, #0x0 - bl Sav2_Poketch_PokemonHistoryAddMon -_0202C194: - pop {r3-r7, pc} - .balign 4 diff --git a/arm9/src/unk_0202C144.c b/arm9/src/unk_0202C144.c new file mode 100644 index 00000000..27125eb3 --- /dev/null +++ b/arm9/src/unk_0202C144.c @@ -0,0 +1,18 @@ +#include "global.h" +#include "pokemon.h" +#include "pokedex.h" +#include "save_block_2.h" +#include "unk_02029FBO.h" +#include "poketch.h" + +THUMB_FUNC void FUN_0202C144(struct SaveBlock2 *sav2, struct Pokemon *pokemon) { + if (GetMonData(pokemon, MON_DATA_IS_EGG, NULL) == 0) + { + struct Pokedex *pokedex = Sav2_Pokedex_get(sav2); + void *unkSavStruct = FUN_02029FC8(sav2); /* SavArray_get(sav2, 20) */ + + FUN_0202A1C4(unkSavStruct, pokedex, GetMonData(pokemon, MON_DATA_SPECIES, NULL)); + Pokedex_SetMonCaughtFlag(pokedex, pokemon); + Sav2_Poketch_PokemonHistoryAddMon(Sav2_Poketch_get(sav2), &pokemon->box); + } +} \ No newline at end of file diff --git a/include/unk_02029FBO.h b/include/unk_02029FBO.h new file mode 100644 index 00000000..3d01a257 --- /dev/null +++ b/include/unk_02029FBO.h @@ -0,0 +1,10 @@ +#ifndef POKEDIAMOND_UNK_02029FBO_H +#define POKEDIAMOND_UNK_02029FBO_H + +#include "save_block_2.h" +#include "pokedex.h" + +void *FUN_02029FC8(struct SaveBlock2 *sav2); +void *FUN_0202A1C4(void *unkSavStruct, struct Pokedex *pokedex, u16 species); + +#endif //POKEDIAMOND_UNK_02029FBO_H \ No newline at end of file -- cgit v1.2.3 From f2284a721b91fc2af49bd2b5d1d43ff24de46ba6 Mon Sep 17 00:00:00 2001 From: who-knows-who Date: Sat, 27 Feb 2021 16:39:57 +0000 Subject: Remove unk_02029FBO.h (using o instead of 0) --- .vscode/settings.json | 19 +++++++++++++++++++ arm9/src/unk_0202C144.c | 3 --- include/unk_02029FB0.h | 7 ++++++- include/unk_02029FBO.h | 10 ---------- 4 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 .vscode/settings.json delete mode 100644 include/unk_02029FBO.h diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..39c2b1c7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,19 @@ +{ + "files.associations": { + "ratio": "c", + "array": "c", + "*.tcc": "c", + "bitset": "c", + "string": "c", + "vector": "c", + "string_view": "c", + "functional": "c", + "iomanip": "c", + "istream": "c", + "limits": "c", + "ostream": "c", + "sstream": "c", + "streambuf": "c", + "regex": "c" + } +} \ No newline at end of file diff --git a/arm9/src/unk_0202C144.c b/arm9/src/unk_0202C144.c index b7dd45aa..468a92e4 100644 --- a/arm9/src/unk_0202C144.c +++ b/arm9/src/unk_0202C144.c @@ -6,9 +6,6 @@ #pragma thumb on -extern struct UnkStruct_02029FB0 * FUN_02029FC8(struct SaveBlock2 * sav2); -extern void FUN_0202A1C4(struct UnkStruct_02029FB0 * unk, struct Pokedex * pokedex, u16 species); - void FUN_0202C144(struct SaveBlock2 * sav2, struct Pokemon * mon) { u32 is_egg = GetMonData(mon, MON_DATA_IS_EGG, NULL); diff --git a/include/unk_02029FB0.h b/include/unk_02029FB0.h index 545a6d3a..1cea6b45 100644 --- a/include/unk_02029FB0.h +++ b/include/unk_02029FB0.h @@ -1,9 +1,14 @@ #ifndef POKEDIAMOND_UNK_02029FB0_H #define POKEDIAMOND_UNK_02029FB0_H +#include "save_block_2.h" +#include "pokedex.h" struct UnkStruct_02029FB0 { u8 unk[0x14C]; }; -#endif +struct UnkStruct_02029FB0 * FUN_02029FC8(struct SaveBlock2 * sav2); +void FUN_0202A1C4(struct UnkStruct_02029FB0 * unk, struct Pokedex * pokedex, u16 species); + +#endif //POKEDIAMOND_UNK_02029FB0_H diff --git a/include/unk_02029FBO.h b/include/unk_02029FBO.h deleted file mode 100644 index 3d01a257..00000000 --- a/include/unk_02029FBO.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef POKEDIAMOND_UNK_02029FBO_H -#define POKEDIAMOND_UNK_02029FBO_H - -#include "save_block_2.h" -#include "pokedex.h" - -void *FUN_02029FC8(struct SaveBlock2 *sav2); -void *FUN_0202A1C4(void *unkSavStruct, struct Pokedex *pokedex, u16 species); - -#endif //POKEDIAMOND_UNK_02029FBO_H \ No newline at end of file -- cgit v1.2.3 From 50eafa9b79d992f409a688fc7c8fb1029020130a Mon Sep 17 00:00:00 2001 From: who-knows-who Date: Sat, 27 Feb 2021 17:57:20 +0000 Subject: Move struct and function definitions to header files --- .vscode/settings.json | 19 ------------------- arm9/src/unk_0201CBEC.c | 5 ++--- arm9/src/unk_0202A8F4.c | 27 +++------------------------ arm9/src/unk_0202ABBC.c | 44 +++++++++++++++++--------------------------- arm9/src/unk_0202C0E0.c | 26 +++++++------------------- include/unk_0201CBEC.h | 6 ++++++ include/unk_02029FB0.h | 2 -- include/unk_0202A8F4.h | 26 ++++++++++++++++++++++++++ include/unk_0202ABBC.h | 23 +++++++++++++++++++++++ include/unk_0202C0E0.h | 14 ++++++++++++++ 10 files changed, 98 insertions(+), 94 deletions(-) delete mode 100644 .vscode/settings.json create mode 100644 include/unk_0201CBEC.h create mode 100644 include/unk_0202A8F4.h create mode 100644 include/unk_0202ABBC.h create mode 100644 include/unk_0202C0E0.h diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 39c2b1c7..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "files.associations": { - "ratio": "c", - "array": "c", - "*.tcc": "c", - "bitset": "c", - "string": "c", - "vector": "c", - "string_view": "c", - "functional": "c", - "iomanip": "c", - "istream": "c", - "limits": "c", - "ostream": "c", - "sstream": "c", - "streambuf": "c", - "regex": "c" - } -} \ No newline at end of file diff --git a/arm9/src/unk_0201CBEC.c b/arm9/src/unk_0201CBEC.c index 0e75c3ff..7ec46f83 100644 --- a/arm9/src/unk_0201CBEC.c +++ b/arm9/src/unk_0201CBEC.c @@ -1,7 +1,6 @@ #include "global.h" #include "fx.h" - -int FUN_0201CBEC(int a0, int a1, int a2, int a3); +#include "unk_0201CBEC.h" THUMB_FUNC int FUN_0201CBEC(int a0, int a1, int a2, int a3) { @@ -9,4 +8,4 @@ THUMB_FUNC int FUN_0201CBEC(int a0, int a1, int a2, int a3) { int r2 = a1 - a3; return FX_Sqrt((r0 * r0 + r2 * r2) << 0xc) >> 0xc; -} \ No newline at end of file +} diff --git a/arm9/src/unk_0202A8F4.c b/arm9/src/unk_0202A8F4.c index 66a0244b..48931dab 100644 --- a/arm9/src/unk_0202A8F4.c +++ b/arm9/src/unk_0202A8F4.c @@ -1,27 +1,6 @@ #include "global.h" #include "save_block_2.h" - -struct Unk0202A8F4 -{ - u8 u_0; - u8 u_1; - u8 u_2; - u8 u_3; - u8 u_4; - u8 u_5; - u8 u_6; - u8 u_7; - u8 u_8; - u8 u_9; - u8 u_A; - u8 u_B; - u8 u_C; - u8 u_D; -}; - -u32 FUN_0202A8F4(); -void FUN_0202A8F8(struct Unk0202A8F4 *unk); -void *FUN_0202A918(void *arg0); +#include "unk_0202A8F4.h" THUMB_FUNC u32 FUN_0202A8F4() { @@ -46,7 +25,7 @@ THUMB_FUNC void FUN_0202A8F8(struct Unk0202A8F4 *unk) unk->u_D = 0; } -THUMB_FUNC void *FUN_0202A918(void *arg0) +THUMB_FUNC void *FUN_0202A918(struct SaveBlock2* sav2) { - return SavArray_get(arg0, 24); + return SavArray_get(sav2, 24); } diff --git a/arm9/src/unk_0202ABBC.c b/arm9/src/unk_0202ABBC.c index 2a15b9fd..7bc9d3fc 100644 --- a/arm9/src/unk_0202ABBC.c +++ b/arm9/src/unk_0202ABBC.c @@ -1,41 +1,31 @@ #include "global.h" #include "save_block_2.h" #include "MI_memory.h" +#include "unk_0202ABBC.h" -void *FUN_0202ABBC(struct SaveBlock2* sav); -u32 FUN_0202ABC8(); -void FUN_0202ABCC(void *destp); -u16 FUN_0202ABDC(void *unkSavStruct); -void FUN_0202ABE4(void *unkSavStruct, u16 data); -void FUN_0202ABEC(void *srcp, void *destp); -void FUN_0202ABF8(void *destp, void *srcp); -u32 FUN_0202AC08(void *unkStruct); -void FUN_0202AC10(void *unkStruct, u32 data); -u16 FUN_0202AC18(void *unkStruct); - -THUMB_FUNC void *FUN_0202ABBC(struct SaveBlock2* sav) +THUMB_FUNC void *FUN_0202ABBC(struct SaveBlock2* sav2) { - return SavArray_get(sav, 26); + return SavArray_get(sav2, 26); } THUMB_FUNC u32 FUN_0202ABC8() { - return 0xf4; // 244 + return sizeof(struct Unk0202ABBC); // 0xF4 } -THUMB_FUNC void FUN_0202ABCC(void *destp) +THUMB_FUNC void FUN_0202ABCC(struct Unk0202ABBC* unk) { - MIi_CpuClearFast(0, destp, 0xf4); + MIi_CpuClearFast(0, unk, 0xf4); } -THUMB_FUNC u16 FUN_0202ABDC(void *unkSavStruct) +THUMB_FUNC u16 FUN_0202ABDC(struct Unk0202ABBC* unk) { - return *(u16 *)(unkSavStruct + 0xec); + return unk->unk_EC; } -THUMB_FUNC void FUN_0202ABE4(void *unkSavStruct, u16 data) +THUMB_FUNC void FUN_0202ABE4(struct Unk0202ABBC* unk, u16 data) { - *(u16 *)(unkSavStruct + 0xec) = data; + unk->unk_EC = data; } THUMB_FUNC void FUN_0202ABEC(void *srcp, void *destp) @@ -48,17 +38,17 @@ THUMB_FUNC void FUN_0202ABF8(void *destp, void *srcp) MIi_CpuCopyFast(srcp, destp, 0xec); } -THUMB_FUNC u32 FUN_0202AC08(void *unkStruct) +THUMB_FUNC u32 FUN_0202AC08(struct Unk0202ABBC* unk) { - return *(u32 *)(unkStruct + 0xf0); + return unk->unk_F0; } -THUMB_FUNC void FUN_0202AC10(void *unkStruct, u32 data) +THUMB_FUNC void FUN_0202AC10(struct Unk0202ABBC* unk, u32 data) { - *(u32 *)(unkStruct + 0xf0) = data; + unk->unk_F0 = data; } -THUMB_FUNC u16 FUN_0202AC18(void *unkStruct) +THUMB_FUNC u16 FUN_0202AC18(struct Unk0202ABBC* unk) { - return *(u16 *)(unkStruct + 0xee); -} \ No newline at end of file + return unk->unk_EE; +} diff --git a/arm9/src/unk_0202C0E0.c b/arm9/src/unk_0202C0E0.c index b39570fe..bf24908a 100644 --- a/arm9/src/unk_0202C0E0.c +++ b/arm9/src/unk_0202C0E0.c @@ -1,24 +1,12 @@ #include "global.h" #include "save_block_2.h" - - -struct UnkSaveStruct0202C0E4 -{ - u16 data[5][4]; -}; - -u32 FUN_0202C0E0(); -void FUN_0202C0E4(struct UnkSaveStruct0202C0E4 *unkStruct); -void FUN_0202C108(struct SaveBlock2 *save, u32 a1, u32 a2); -u16 FUN_0202C12C(struct SaveBlock2 *save, u32 a1, u32 a2); - +#include "unk_0202C0E0.h" THUMB_FUNC u32 FUN_0202C0E0() { - return sizeof(struct UnkSaveStruct0202C0E4); // 40 + return sizeof(struct UnkSaveStruct0202C0E4); // 0x28 } - THUMB_FUNC void FUN_0202C0E4(struct UnkSaveStruct0202C0E4 *unkStruct) { @@ -34,17 +22,17 @@ THUMB_FUNC void FUN_0202C0E4(struct UnkSaveStruct0202C0E4 *unkStruct) } while (i < 5); } -THUMB_FUNC void FUN_0202C108(struct SaveBlock2 *save, u32 a1, u32 a2) +THUMB_FUNC void FUN_0202C108(struct SaveBlock2 *sav2, u32 a1, u32 a2) { - struct UnkSaveStruct0202C0E4 *unkSavStruct = SavArray_get(save, 0x21); + struct UnkSaveStruct0202C0E4 *unkSavStruct = SavArray_get(sav2, 33); if (unkSavStruct->data[a1][a2] < 9999) { unkSavStruct->data[a1][a2]++; } } -THUMB_FUNC u16 FUN_0202C12C(struct SaveBlock2 *save, u32 a1, u32 a2) +THUMB_FUNC u16 FUN_0202C12C(struct SaveBlock2 *sav2, u32 a1, u32 a2) { - struct UnkSaveStruct0202C0E4 *unkSavStruct = SavArray_get(save, 0x21); + struct UnkSaveStruct0202C0E4 *unkSavStruct = SavArray_get(sav2, 33); return unkSavStruct->data[a1][a2]; -} \ No newline at end of file +} diff --git a/include/unk_0201CBEC.h b/include/unk_0201CBEC.h new file mode 100644 index 00000000..a8c617d9 --- /dev/null +++ b/include/unk_0201CBEC.h @@ -0,0 +1,6 @@ +#ifndef POKEDIAMOND_UNK_0201CBEC_H +#define POKEDIAMOND_UNK_0201CBEC_H + +int FUN_0201CBEC(int a0, int a1, int a2, int a3); + +#endif //POKEDIAMOND_UNK_0201CBEC_H diff --git a/include/unk_02029FB0.h b/include/unk_02029FB0.h index 1cea6b45..0185bff4 100644 --- a/include/unk_02029FB0.h +++ b/include/unk_02029FB0.h @@ -1,8 +1,6 @@ #ifndef POKEDIAMOND_UNK_02029FB0_H #define POKEDIAMOND_UNK_02029FB0_H -#include "save_block_2.h" -#include "pokedex.h" struct UnkStruct_02029FB0 { u8 unk[0x14C]; diff --git a/include/unk_0202A8F4.h b/include/unk_0202A8F4.h new file mode 100644 index 00000000..aaca6e56 --- /dev/null +++ b/include/unk_0202A8F4.h @@ -0,0 +1,26 @@ +#ifndef POKEDIAMOND_UNK_0202A8F4_H +#define POKEDIAMOND_UNK_0202A8F4_H + +struct Unk0202A8F4 +{ + u8 u_0; + u8 u_1; + u8 u_2; + u8 u_3; + u8 u_4; + u8 u_5; + u8 u_6; + u8 u_7; + u8 u_8; + u8 u_9; + u8 u_A; + u8 u_B; + u8 u_C; + u8 u_D; +}; + +u32 FUN_0202A8F4(); +void FUN_0202A8F8(struct Unk0202A8F4 *unk); +void *FUN_0202A918(struct SaveBlock2 *sav2); + +#endif //POKEDIAMOND_UNK_0202A8F4_H diff --git a/include/unk_0202ABBC.h b/include/unk_0202ABBC.h new file mode 100644 index 00000000..bf793fbb --- /dev/null +++ b/include/unk_0202ABBC.h @@ -0,0 +1,23 @@ +#ifndef POKEDIAMOND_UNK_0202ABBC_H +#define POKEDIAMOND_UNK_0202ABBC_H + +struct Unk0202ABBC +{ + /* 0x000 */ u32 filler[59]; + /* 0x0ec */ u16 unk_EC; + /* 0x0ee */ u16 unk_EE; + /* 0x0f0 */ u32 unk_F0; +}; // size: 0xF4 + +void *FUN_0202ABBC(struct SaveBlock2* sav2); +u32 FUN_0202ABC8(); +void FUN_0202ABCC(struct Unk0202ABBC* unk); +u16 FUN_0202ABDC(struct Unk0202ABBC* unk); +void FUN_0202ABE4(struct Unk0202ABBC* unk, u16 data); +void FUN_0202ABEC(void *srcp, void *destp); +void FUN_0202ABF8(void *destp, void *srcp); +u32 FUN_0202AC08(struct Unk0202ABBC* unk); +void FUN_0202AC10(struct Unk0202ABBC* unk, u32 data); +u16 FUN_0202AC18(struct Unk0202ABBC* unk); + +#endif //POKEDIAMOND_UNK_0202ABBC_H diff --git a/include/unk_0202C0E0.h b/include/unk_0202C0E0.h new file mode 100644 index 00000000..eb972ed3 --- /dev/null +++ b/include/unk_0202C0E0.h @@ -0,0 +1,14 @@ +#ifndef POKEDIAMOND_UNK_0202C0E0_H +#define POKEDIAMOND_UNK_0202C0E0_H + +struct UnkSaveStruct0202C0E4 +{ + u16 data[5][4]; +}; + +u32 FUN_0202C0E0(); +void FUN_0202C0E4(struct UnkSaveStruct0202C0E4 *unkStruct); +void FUN_0202C108(struct SaveBlock2 *sav2, u32 a1, u32 a2); +u16 FUN_0202C12C(struct SaveBlock2 *sav2, u32 a1, u32 a2); + +#endif //POKEDIAMOND_UNK_0202C0E0_H -- cgit v1.2.3 From 6f6bf00b6635b39c5e57fab97bbf4d165be00ccc Mon Sep 17 00:00:00 2001 From: who-knows-who Date: Sun, 28 Feb 2021 13:06:25 +0000 Subject: Comment in FUN_0201CBEC.c --- arm9/src/unk_0201CBEC.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arm9/src/unk_0201CBEC.c b/arm9/src/unk_0201CBEC.c index 7ec46f83..40e68efe 100644 --- a/arm9/src/unk_0201CBEC.c +++ b/arm9/src/unk_0201CBEC.c @@ -2,10 +2,11 @@ #include "fx.h" #include "unk_0201CBEC.h" -THUMB_FUNC int FUN_0201CBEC(int a0, int a1, int a2, int a3) { +THUMB_FUNC int FUN_0201CBEC(int x1, int y1, int x2, int y2) +{ + // Calculate distance between two points with pythagoras + int x_delta = x1 - x2; + int y_delta = y1 - y2; - int r0 = a0 - a2; - int r2 = a1 - a3; - - return FX_Sqrt((r0 * r0 + r2 * r2) << 0xc) >> 0xc; + return FX_Sqrt((x_delta * x_delta + y_delta * y_delta) << 0xc) >> 0xc; } -- cgit v1.2.3 From 6b7b7395fbcfd632bf3a3bcbb9dea4480c455ed2 Mon Sep 17 00:00:00 2001 From: who-knows-who Date: Sat, 6 Mar 2021 16:19:38 +0000 Subject: Review changes --- arm9/src/unk_0201CBEC.c | 6 +++--- arm9/src/unk_0202C0E0.c | 16 +++++++--------- include/unk_0201CBEC.h | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/arm9/src/unk_0201CBEC.c b/arm9/src/unk_0201CBEC.c index 40e68efe..ea11f2aa 100644 --- a/arm9/src/unk_0201CBEC.c +++ b/arm9/src/unk_0201CBEC.c @@ -2,11 +2,11 @@ #include "fx.h" #include "unk_0201CBEC.h" -THUMB_FUNC int FUN_0201CBEC(int x1, int y1, int x2, int y2) +THUMB_FUNC s32 FUN_0201CBEC(s32 x1, s32 y1, s32 x2, s32 y2) { // Calculate distance between two points with pythagoras - int x_delta = x1 - x2; - int y_delta = y1 - y2; + s32 x_delta = x1 - x2; + s32 y_delta = y1 - y2; return FX_Sqrt((x_delta * x_delta + y_delta * y_delta) << 0xc) >> 0xc; } diff --git a/arm9/src/unk_0202C0E0.c b/arm9/src/unk_0202C0E0.c index bf24908a..0b57926b 100644 --- a/arm9/src/unk_0202C0E0.c +++ b/arm9/src/unk_0202C0E0.c @@ -9,17 +9,15 @@ THUMB_FUNC u32 FUN_0202C0E0() THUMB_FUNC void FUN_0202C0E4(struct UnkSaveStruct0202C0E4 *unkStruct) { + s32 j, i; - int j, i = 0; - - do { - j = 0; - do { + for (i = 0; i < 5; i++) + { + for (j = 0; j < 4; j++) + { unkStruct->data[i][j] = 0; - j++; - } while (j < 4); - i++; - } while (i < 5); + } + } } THUMB_FUNC void FUN_0202C108(struct SaveBlock2 *sav2, u32 a1, u32 a2) diff --git a/include/unk_0201CBEC.h b/include/unk_0201CBEC.h index a8c617d9..f3df6872 100644 --- a/include/unk_0201CBEC.h +++ b/include/unk_0201CBEC.h @@ -1,6 +1,6 @@ #ifndef POKEDIAMOND_UNK_0201CBEC_H #define POKEDIAMOND_UNK_0201CBEC_H -int FUN_0201CBEC(int a0, int a1, int a2, int a3); +s32 FUN_0201CBEC(s32 a0, s32 a1, s32 a2, s32 a3); #endif //POKEDIAMOND_UNK_0201CBEC_H -- cgit v1.2.3