From 435054bfb3d55802403bc987225ef545c843343e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Mon, 15 Mar 2021 19:56:37 +0100 Subject: module_52.c --- arm9/modules/52/src/module_52_c.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 arm9/modules/52/src/module_52_c.c diff --git a/arm9/modules/52/src/module_52_c.c b/arm9/modules/52/src/module_52_c.c new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3 From 2583e3148007cedecfdd2c7f02e27a98bdadbd84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Mon, 15 Mar 2021 20:49:20 +0100 Subject: decomp MOD52_021D74E0 --- arm9/arm9.lsf | 1 + arm9/global.inc | 1 + arm9/modules/52/asm/module_52.s | 14 -------------- arm9/modules/52/src/module_52_c.c | 13 +++++++++++++ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index b8accee4..615430f9 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -899,6 +899,7 @@ Overlay MODULE_52 { ##Some kind of transition overlay for intro## After arm9 + Object module_52_c.o Object module_52.o } diff --git a/arm9/global.inc b/arm9/global.inc index d816d92a..999a0e6d 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8519,3 +8519,4 @@ .extern CARDi_InitCommon .extern MonNotFaintedOrEgg .extern CountAlivePokemon +.extern MOD52_021D74E0 diff --git a/arm9/modules/52/asm/module_52.s b/arm9/modules/52/asm/module_52.s index 22824930..4d85bb58 100644 --- a/arm9/modules/52/asm/module_52.s +++ b/arm9/modules/52/asm/module_52.s @@ -3,20 +3,6 @@ .section .text .balign 4, 0 - thumb_func_start MOD52_021D74E0 -MOD52_021D74E0: ; 0x021D74E0 - push {r3, lr} - mov r2, #2 - mov r0, #3 - mov r1, #0x4d - lsl r2, r2, #0x10 - bl FUN_0201681C - bl InitializeMainRNG - mov r0, #1 - pop {r3, pc} - .align 2, 0 - thumb_func_end MOD52_021D74E0 - thumb_func_start MOD52_021D74F8 MOD52_021D74F8: ; 0x021D74F8 push {r3, lr} diff --git a/arm9/modules/52/src/module_52_c.c b/arm9/modules/52/src/module_52_c.c index e69de29b..5835255f 100644 --- a/arm9/modules/52/src/module_52_c.c +++ b/arm9/modules/52/src/module_52_c.c @@ -0,0 +1,13 @@ +#include "global.h" +#include "main.h" + + +extern void FUN_0201681C(u32 param0, u32 heap_id, u32 param2); +extern void MOD52_021D769C(u32 heap_id, u32 param1); + +THUMB_FUNC int MOD52_021D74E0() { + FUN_0201681C(3, 0x4d, 2 << 16); + InitializeMainRNG(); + + return 1; +} \ No newline at end of file -- cgit v1.2.3 From 66f2e4ed4df708280904a21e4a92558e7fcc5866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Mon, 15 Mar 2021 21:17:31 +0100 Subject: decomp MOD52_021D74F8 --- arm9/global.inc | 1 + arm9/modules/52/asm/module_52.s | 11 ----------- arm9/modules/52/src/module_52_c.c | 13 +++++++++++-- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/arm9/global.inc b/arm9/global.inc index 999a0e6d..15f291a0 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8520,3 +8520,4 @@ .extern MonNotFaintedOrEgg .extern CountAlivePokemon .extern MOD52_021D74E0 +.extern MOD52_021D74F8 diff --git a/arm9/modules/52/asm/module_52.s b/arm9/modules/52/asm/module_52.s index 4d85bb58..457373a1 100644 --- a/arm9/modules/52/asm/module_52.s +++ b/arm9/modules/52/asm/module_52.s @@ -3,17 +3,6 @@ .section .text .balign 4, 0 - thumb_func_start MOD52_021D74F8 -MOD52_021D74F8: ; 0x021D74F8 - push {r3, lr} - bl OverlayManager_GetField18 - ldr r1, [r0, #8] - mov r0, #0x4d - bl MOD52_021D769C - mov r0, #1 - pop {r3, pc} - .align 2, 0 - thumb_func_end MOD52_021D74F8 thumb_func_start MOD52_021D750C MOD52_021D750C: ; 0x021D750C diff --git a/arm9/modules/52/src/module_52_c.c b/arm9/modules/52/src/module_52_c.c index 5835255f..61877176 100644 --- a/arm9/modules/52/src/module_52_c.c +++ b/arm9/modules/52/src/module_52_c.c @@ -1,13 +1,22 @@ #include "global.h" #include "main.h" +#include "overlay_manager.h" extern void FUN_0201681C(u32 param0, u32 heap_id, u32 param2); -extern void MOD52_021D769C(u32 heap_id, u32 param1); +extern void MOD52_021D769C(u32 heap_id, int param1); THUMB_FUNC int MOD52_021D74E0() { FUN_0201681C(3, 0x4d, 2 << 16); InitializeMainRNG(); return 1; -} \ No newline at end of file +} + +THUMB_FUNC int MOD52_021D74F8(struct UnkStruct_02006234 *param0) { + int res = OverlayManager_GetField18(param0)[2]; + + MOD52_021D769C(0x4d, res); + + return 1; +} -- cgit v1.2.3 From f3adb8eda9602941397cac94e76caf8b51781d0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Mon, 15 Mar 2021 21:51:27 +0100 Subject: decomp MOD52_021D750C --- arm9/global.inc | 1 + arm9/modules/52/asm/module_52.s | 14 -------------- arm9/modules/52/src/module_52_c.c | 9 +++++++++ 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/arm9/global.inc b/arm9/global.inc index 15f291a0..83a492ba 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8521,3 +8521,4 @@ .extern CountAlivePokemon .extern MOD52_021D74E0 .extern MOD52_021D74F8 +.extern MOD52_021D750C \ No newline at end of file diff --git a/arm9/modules/52/asm/module_52.s b/arm9/modules/52/asm/module_52.s index 457373a1..5c456f0c 100644 --- a/arm9/modules/52/asm/module_52.s +++ b/arm9/modules/52/asm/module_52.s @@ -4,20 +4,6 @@ .balign 4, 0 - thumb_func_start MOD52_021D750C -MOD52_021D750C: ; 0x021D750C - push {r3, lr} - mov r0, #0x4d - bl FUN_020168D0 - mov r0, #0 - ldr r1, _021D7524 ; =UNK_020FD144 - mvn r0, r0 - bl RegisterMainOverlay - mov r0, #1 - pop {r3, pc} - nop -_021D7524: .word UNK_020FD144 - thumb_func_end MOD52_021D750C thumb_func_start MOD52_021D7528 MOD52_021D7528: ; 0x021D7528 diff --git a/arm9/modules/52/src/module_52_c.c b/arm9/modules/52/src/module_52_c.c index 61877176..bc059dff 100644 --- a/arm9/modules/52/src/module_52_c.c +++ b/arm9/modules/52/src/module_52_c.c @@ -4,7 +4,9 @@ extern void FUN_0201681C(u32 param0, u32 heap_id, u32 param2); +extern int FUN_020168D0(u32 heap_id); extern void MOD52_021D769C(u32 heap_id, int param1); +extern struct Unk21DBE18 UNK_020FD144; THUMB_FUNC int MOD52_021D74E0() { FUN_0201681C(3, 0x4d, 2 << 16); @@ -20,3 +22,10 @@ THUMB_FUNC int MOD52_021D74F8(struct UnkStruct_02006234 *param0) { return 1; } + +THUMB_FUNC int MOD52_021D750C() { + FUN_020168D0(0x4d); + RegisterMainOverlay(-1, &UNK_020FD144); + + return 1; +} \ No newline at end of file -- cgit v1.2.3 From 31439d0c354fb6db2adea8cf695e4f9fde4368fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Mon, 15 Mar 2021 21:54:01 +0100 Subject: decomp MOD52_021D7528 --- arm9/global.inc | 3 ++- arm9/modules/52/asm/module_52.s | 16 ---------------- arm9/modules/52/src/module_52_c.c | 7 +++++++ 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/arm9/global.inc b/arm9/global.inc index 83a492ba..aee60c7b 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8521,4 +8521,5 @@ .extern CountAlivePokemon .extern MOD52_021D74E0 .extern MOD52_021D74F8 -.extern MOD52_021D750C \ No newline at end of file +.extern MOD52_021D750C +.extern MOD52_021D7528 \ No newline at end of file diff --git a/arm9/modules/52/asm/module_52.s b/arm9/modules/52/asm/module_52.s index 5c456f0c..82abcf6e 100644 --- a/arm9/modules/52/asm/module_52.s +++ b/arm9/modules/52/asm/module_52.s @@ -3,22 +3,6 @@ .section .text .balign 4, 0 - - - thumb_func_start MOD52_021D7528 -MOD52_021D7528: ; 0x021D7528 - push {r3, lr} - mov r2, #2 - mov r0, #3 - mov r1, #0x4d - lsl r2, r2, #0x10 - bl FUN_0201681C - bl InitializeMainRNG - mov r0, #1 - pop {r3, pc} - .align 2, 0 - thumb_func_end MOD52_021D7528 - thumb_func_start MOD52_021D7540 MOD52_021D7540: ; 0x021D7540 push {r4, lr} diff --git a/arm9/modules/52/src/module_52_c.c b/arm9/modules/52/src/module_52_c.c index bc059dff..4e73a078 100644 --- a/arm9/modules/52/src/module_52_c.c +++ b/arm9/modules/52/src/module_52_c.c @@ -28,4 +28,11 @@ THUMB_FUNC int MOD52_021D750C() { RegisterMainOverlay(-1, &UNK_020FD144); return 1; +} + +THUMB_FUNC int MOD52_021D7528() { + FUN_0201681C(3, 0x4d, 2 << 16); + InitializeMainRNG(); + + return 1; } \ No newline at end of file -- cgit v1.2.3 From 543b9f0b5cc4351f1663fa48219438fb7e1a9672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Mon, 15 Mar 2021 22:05:14 +0100 Subject: decomp MOD52_021D7540 --- arm9/global.inc | 3 ++- arm9/modules/52/asm/module_52.s | 15 --------------- arm9/modules/52/src/module_52_c.c | 19 ++++++++++++++++--- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/arm9/global.inc b/arm9/global.inc index aee60c7b..f6c46ada 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8522,4 +8522,5 @@ .extern MOD52_021D74E0 .extern MOD52_021D74F8 .extern MOD52_021D750C -.extern MOD52_021D7528 \ No newline at end of file +.extern MOD52_021D7528 +.extern MOD52_021D7540 \ No newline at end of file diff --git a/arm9/modules/52/asm/module_52.s b/arm9/modules/52/asm/module_52.s index 82abcf6e..1fb81f69 100644 --- a/arm9/modules/52/asm/module_52.s +++ b/arm9/modules/52/asm/module_52.s @@ -3,21 +3,6 @@ .section .text .balign 4, 0 - thumb_func_start MOD52_021D7540 -MOD52_021D7540: ; 0x021D7540 - push {r4, lr} - bl OverlayManager_GetField18 - ldr r4, [r0, #8] - mov r0, #0x4d - add r1, r4, #0 - mov r2, #1 - bl MOD52_021D7604 - add r0, r4, #0 - bl Sav2_PlayerData_GetIGTAddr - bl FUN_02015E3C - mov r0, #1 - pop {r4, pc} - thumb_func_end MOD52_021D7540 thumb_func_start MOD52_021D7560 MOD52_021D7560: ; 0x021D7560 diff --git a/arm9/modules/52/src/module_52_c.c b/arm9/modules/52/src/module_52_c.c index 4e73a078..f4803a8d 100644 --- a/arm9/modules/52/src/module_52_c.c +++ b/arm9/modules/52/src/module_52_c.c @@ -1,12 +1,15 @@ #include "global.h" #include "main.h" #include "overlay_manager.h" +#include "player_data.h" extern void FUN_0201681C(u32 param0, u32 heap_id, u32 param2); extern int FUN_020168D0(u32 heap_id); -extern void MOD52_021D769C(u32 heap_id, int param1); +extern void MOD52_021D769C(u32 heap_id, struct SaveBlock2 *save); extern struct Unk21DBE18 UNK_020FD144; +extern void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *save, u32 param2); +extern void FUN_02015E3C(struct IGT* igt); THUMB_FUNC int MOD52_021D74E0() { FUN_0201681C(3, 0x4d, 2 << 16); @@ -16,9 +19,9 @@ THUMB_FUNC int MOD52_021D74E0() { } THUMB_FUNC int MOD52_021D74F8(struct UnkStruct_02006234 *param0) { - int res = OverlayManager_GetField18(param0)[2]; + struct SaveBlock2 *save = OverlayManager_GetField18(param0)[2]; - MOD52_021D769C(0x4d, res); + MOD52_021D769C(0x4d, save); return 1; } @@ -35,4 +38,14 @@ THUMB_FUNC int MOD52_021D7528() { InitializeMainRNG(); return 1; +} + + +THUMB_FUNC int MOD52_021D7540(struct UnkStruct_02006234 *param0) { + struct SaveBlock2 *save = OverlayManager_GetField18(param0)[2]; + MOD52_021D7604(0x4d, save, 1); + struct IGT* igt = Sav2_PlayerData_GetIGTAddr(save); + FUN_02015E3C(igt); + + return 1; } \ No newline at end of file -- cgit v1.2.3 From 223add63f94543b37d9d648840a324432576dd45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Mon, 15 Mar 2021 22:08:57 +0100 Subject: decomp MOD52_021D7560 --- arm9/global.inc | 3 ++- arm9/modules/52/asm/module_52.s | 15 +-------------- arm9/modules/52/src/module_52_c.c | 37 +++++++++++++++++++++++++------------ 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/arm9/global.inc b/arm9/global.inc index f6c46ada..7e2fc2e9 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8523,4 +8523,5 @@ .extern MOD52_021D74F8 .extern MOD52_021D750C .extern MOD52_021D7528 -.extern MOD52_021D7540 \ No newline at end of file +.extern MOD52_021D7540 +.extern MOD52_021D7560 diff --git a/arm9/modules/52/asm/module_52.s b/arm9/modules/52/asm/module_52.s index 1fb81f69..385167f4 100644 --- a/arm9/modules/52/asm/module_52.s +++ b/arm9/modules/52/asm/module_52.s @@ -4,20 +4,7 @@ .balign 4, 0 - thumb_func_start MOD52_021D7560 -MOD52_021D7560: ; 0x021D7560 - push {r3, lr} - mov r0, #0x4d - bl FUN_020168D0 - mov r0, #0 - ldr r1, _021D7578 ; =UNK_020F2B7C - mvn r0, r0 - bl RegisterMainOverlay - mov r0, #1 - pop {r3, pc} - nop -_021D7578: .word UNK_020F2B7C - thumb_func_end MOD52_021D7560 + thumb_func_start MOD52_021D757C MOD52_021D757C: ; 0x021D757C diff --git a/arm9/modules/52/src/module_52_c.c b/arm9/modules/52/src/module_52_c.c index f4803a8d..38aa29c0 100644 --- a/arm9/modules/52/src/module_52_c.c +++ b/arm9/modules/52/src/module_52_c.c @@ -3,22 +3,25 @@ #include "overlay_manager.h" #include "player_data.h" - extern void FUN_0201681C(u32 param0, u32 heap_id, u32 param2); extern int FUN_020168D0(u32 heap_id); extern void MOD52_021D769C(u32 heap_id, struct SaveBlock2 *save); extern struct Unk21DBE18 UNK_020FD144; +extern struct Unk21DBE18 UNK_020F2B7C; + extern void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *save, u32 param2); -extern void FUN_02015E3C(struct IGT* igt); +extern void FUN_02015E3C(struct IGT *igt); -THUMB_FUNC int MOD52_021D74E0() { +THUMB_FUNC int MOD52_021D74E0() +{ FUN_0201681C(3, 0x4d, 2 << 16); - InitializeMainRNG(); + InitializeMainRNG(); return 1; } -THUMB_FUNC int MOD52_021D74F8(struct UnkStruct_02006234 *param0) { +THUMB_FUNC int MOD52_021D74F8(struct UnkStruct_02006234 *param0) +{ struct SaveBlock2 *save = OverlayManager_GetField18(param0)[2]; MOD52_021D769C(0x4d, save); @@ -26,26 +29,36 @@ THUMB_FUNC int MOD52_021D74F8(struct UnkStruct_02006234 *param0) { return 1; } -THUMB_FUNC int MOD52_021D750C() { +THUMB_FUNC int MOD52_021D750C() +{ FUN_020168D0(0x4d); RegisterMainOverlay(-1, &UNK_020FD144); return 1; } -THUMB_FUNC int MOD52_021D7528() { +THUMB_FUNC int MOD52_021D7528() +{ FUN_0201681C(3, 0x4d, 2 << 16); - InitializeMainRNG(); + InitializeMainRNG(); - return 1; + return 1; } - -THUMB_FUNC int MOD52_021D7540(struct UnkStruct_02006234 *param0) { +THUMB_FUNC int MOD52_021D7540(struct UnkStruct_02006234 *param0) +{ struct SaveBlock2 *save = OverlayManager_GetField18(param0)[2]; MOD52_021D7604(0x4d, save, 1); - struct IGT* igt = Sav2_PlayerData_GetIGTAddr(save); + struct IGT *igt = Sav2_PlayerData_GetIGTAddr(save); FUN_02015E3C(igt); + return 1; +} + +THUMB_FUNC int MOD52_021D7560() +{ + FUN_020168D0(0x4d); + RegisterMainOverlay(-1, &UNK_020F2B7C); + return 1; } \ No newline at end of file -- cgit v1.2.3 From 96d819dc80d6d62f802850ff69ec62cf27dd9c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Mon, 15 Mar 2021 22:10:52 +0100 Subject: decomp MOD52_021D757C --- arm9/global.inc | 1 + arm9/modules/52/asm/module_52.s | 14 -------------- arm9/modules/52/src/module_52_c.c | 10 +++++++++- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/arm9/global.inc b/arm9/global.inc index 7e2fc2e9..930bd44d 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8525,3 +8525,4 @@ .extern MOD52_021D7528 .extern MOD52_021D7540 .extern MOD52_021D7560 +.extern MOD52_021D757C \ No newline at end of file diff --git a/arm9/modules/52/asm/module_52.s b/arm9/modules/52/asm/module_52.s index 385167f4..821f2bfc 100644 --- a/arm9/modules/52/asm/module_52.s +++ b/arm9/modules/52/asm/module_52.s @@ -6,20 +6,6 @@ - thumb_func_start MOD52_021D757C -MOD52_021D757C: ; 0x021D757C - push {r3, lr} - mov r2, #2 - mov r0, #3 - mov r1, #0x4d - lsl r2, r2, #0x10 - bl FUN_0201681C - bl InitializeMainRNG - mov r0, #1 - pop {r3, pc} - .align 2, 0 - thumb_func_end MOD52_021D757C - thumb_func_start MOD52_021D7594 MOD52_021D7594: ; 0x021D7594 push {r3, r4, r5, lr} diff --git a/arm9/modules/52/src/module_52_c.c b/arm9/modules/52/src/module_52_c.c index 38aa29c0..b68bdd36 100644 --- a/arm9/modules/52/src/module_52_c.c +++ b/arm9/modules/52/src/module_52_c.c @@ -61,4 +61,12 @@ THUMB_FUNC int MOD52_021D7560() RegisterMainOverlay(-1, &UNK_020F2B7C); return 1; -} \ No newline at end of file +} + +THUMB_FUNC int MOD52_021D757C() +{ + FUN_0201681C(3, 0x4d, 2 << 16); + InitializeMainRNG(); + + return 1; +} -- cgit v1.2.3 From 32852c6104604d7df8450dc9a58a3beeb13e6913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Mon, 15 Mar 2021 23:28:06 +0100 Subject: decomp MOD52_021D7594 --- arm9/global.inc | 3 ++- arm9/modules/52/asm/module_52.s | 38 -------------------------------------- arm9/modules/52/src/module_52_c.c | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 39 deletions(-) diff --git a/arm9/global.inc b/arm9/global.inc index 930bd44d..1bcdcc4b 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8525,4 +8525,5 @@ .extern MOD52_021D7528 .extern MOD52_021D7540 .extern MOD52_021D7560 -.extern MOD52_021D757C \ No newline at end of file +.extern MOD52_021D757C +.extern MOD52_021D7594 diff --git a/arm9/modules/52/asm/module_52.s b/arm9/modules/52/asm/module_52.s index 821f2bfc..dfc5f598 100644 --- a/arm9/modules/52/asm/module_52.s +++ b/arm9/modules/52/asm/module_52.s @@ -5,44 +5,6 @@ - - thumb_func_start MOD52_021D7594 -MOD52_021D7594: ; 0x021D7594 - push {r3, r4, r5, lr} - bl OverlayManager_GetField18 - ldr r4, [r0, #8] - add r0, r4, #0 - bl Sav2_SysInfo_get - add r5, r0, #0 - mov r0, #0x4d - add r1, r4, #0 - bl MOD52_021D7688 - add r0, r4, #0 - mov r1, #0 - bl Options_SetButtonModeOnMain - add r0, r5, #0 - bl Sav2_SysInfo_MacAddressIsMine - cmp r0, #0 - beq _021D75C8 - add r0, r5, #0 - bl Sav2_SysInfo_RTCOffsetIsMine - cmp r0, #0 - bne _021D75D8 -_021D75C8: - add r0, r4, #0 - bl Sav2_SysInfo_RTC_get - bl FUN_020238A4 - add r0, r5, #0 - bl Sav2_SysInfo_InitFromSystem -_021D75D8: - add r0, r4, #0 - bl Sav2_PlayerData_GetIGTAddr - bl FUN_02015E3C - mov r0, #1 - pop {r3, r4, r5, pc} - .align 2, 0 - thumb_func_end MOD52_021D7594 - thumb_func_start MOD52_021D75E8 MOD52_021D75E8: ; 0x021D75E8 push {r3, lr} diff --git a/arm9/modules/52/src/module_52_c.c b/arm9/modules/52/src/module_52_c.c index b68bdd36..5c242b26 100644 --- a/arm9/modules/52/src/module_52_c.c +++ b/arm9/modules/52/src/module_52_c.c @@ -1,7 +1,9 @@ #include "global.h" #include "main.h" +#include "options.h" #include "overlay_manager.h" #include "player_data.h" +#include "sav_system_info.h" extern void FUN_0201681C(u32 param0, u32 heap_id, u32 param2); extern int FUN_020168D0(u32 heap_id); @@ -12,6 +14,8 @@ extern struct Unk21DBE18 UNK_020F2B7C; extern void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *save, u32 param2); extern void FUN_02015E3C(struct IGT *igt); +extern void MOD52_021D7688(u32 heap_id, struct SaveBlock2 *save); + THUMB_FUNC int MOD52_021D74E0() { FUN_0201681C(3, 0x4d, 2 << 16); @@ -70,3 +74,22 @@ THUMB_FUNC int MOD52_021D757C() return 1; } + +THUMB_FUNC int MOD52_021D7594(struct UnkStruct_02006234 *param0) +{ + struct SaveBlock2 *save = OverlayManager_GetField18(param0)[2]; + struct SavSysInfo *save_info = Sav2_SysInfo_get(save); + + MOD52_021D7688(0x4d, save); + Options_SetButtonModeOnMain(save, 0); + + if (!Sav2_SysInfo_MacAddressIsMine(save_info) || !Sav2_SysInfo_RTCOffsetIsMine(save_info)) + { + FUN_020238A4(Sav2_SysInfo_RTC_get(save)); + Sav2_SysInfo_InitFromSystem(save_info); + } + + FUN_02015E3C(Sav2_PlayerData_GetIGTAddr(save)); + + return 1; +} -- cgit v1.2.3 From 0772a60fbb18493ffdefeff7406015f64c09c3ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Mon, 15 Mar 2021 23:31:18 +0100 Subject: decomp MOD52_021D75E8 --- arm9/global.inc | 1 + arm9/modules/52/asm/module_52.s | 15 --------------- arm9/modules/52/src/module_52_c.c | 9 +++++++++ 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/arm9/global.inc b/arm9/global.inc index 1bcdcc4b..40466824 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8527,3 +8527,4 @@ .extern MOD52_021D7560 .extern MOD52_021D757C .extern MOD52_021D7594 +.extern MOD52_021D75E8 \ No newline at end of file diff --git a/arm9/modules/52/asm/module_52.s b/arm9/modules/52/asm/module_52.s index dfc5f598..f9363ba0 100644 --- a/arm9/modules/52/asm/module_52.s +++ b/arm9/modules/52/asm/module_52.s @@ -5,21 +5,6 @@ - thumb_func_start MOD52_021D75E8 -MOD52_021D75E8: ; 0x021D75E8 - push {r3, lr} - mov r0, #0x4d - bl FUN_020168D0 - mov r0, #0 - ldr r1, _021D7600 ; =UNK_020F2B8C - mvn r0, r0 - bl RegisterMainOverlay - mov r0, #1 - pop {r3, pc} - nop -_021D7600: .word UNK_020F2B8C - thumb_func_end MOD52_021D75E8 - thumb_func_start MOD52_021D7604 MOD52_021D7604: ; 0x021D7604 push {r3, r4, r5, r6, r7, lr} diff --git a/arm9/modules/52/src/module_52_c.c b/arm9/modules/52/src/module_52_c.c index 5c242b26..d87eb0e6 100644 --- a/arm9/modules/52/src/module_52_c.c +++ b/arm9/modules/52/src/module_52_c.c @@ -10,6 +10,7 @@ extern int FUN_020168D0(u32 heap_id); extern void MOD52_021D769C(u32 heap_id, struct SaveBlock2 *save); extern struct Unk21DBE18 UNK_020FD144; extern struct Unk21DBE18 UNK_020F2B7C; +extern struct Unk21DBE18 UNK_020F2B8C; extern void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *save, u32 param2); extern void FUN_02015E3C(struct IGT *igt); @@ -93,3 +94,11 @@ THUMB_FUNC int MOD52_021D7594(struct UnkStruct_02006234 *param0) return 1; } + +THUMB_FUNC int MOD52_021D75E8() +{ + FUN_020168D0(0x4d); + RegisterMainOverlay(-1, &UNK_020F2B8C); + + return 1; +} \ No newline at end of file -- cgit v1.2.3 From 9535d47d68cf3fb999bac445c3aeaaf28bf8f37b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Tue, 16 Mar 2021 09:31:16 +0100 Subject: wip: decomp MOD52_021D7604 --- arm9/global.inc | 3 +- arm9/modules/52/asm/module_52.s | 56 ---------------------- arm9/modules/52/src/module_52_c.c | 97 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 97 insertions(+), 59 deletions(-) diff --git a/arm9/global.inc b/arm9/global.inc index 40466824..f682a937 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8527,4 +8527,5 @@ .extern MOD52_021D7560 .extern MOD52_021D757C .extern MOD52_021D7594 -.extern MOD52_021D75E8 \ No newline at end of file +.extern MOD52_021D75E8 +.extern MOD52_021D7604 \ No newline at end of file diff --git a/arm9/modules/52/asm/module_52.s b/arm9/modules/52/asm/module_52.s index f9363ba0..acb4b895 100644 --- a/arm9/modules/52/asm/module_52.s +++ b/arm9/modules/52/asm/module_52.s @@ -4,62 +4,6 @@ .balign 4, 0 - - thumb_func_start MOD52_021D7604 -MOD52_021D7604: ; 0x021D7604 - push {r3, r4, r5, r6, r7, lr} - add r5, r1, #0 - str r0, [sp] - add r0, r5, #0 - add r6, r2, #0 - bl Sav2_SysInfo_get - bl Sav2_SysInfo_InitFromSystem - add r0, r5, #0 - bl Sav2_SysInfo_RTC_get - bl Sav2_SysInfo_RTC_init - add r0, r5, #0 - bl FUN_0202881C - add r4, r0, #0 - bl MTRandom - add r2, r0, #0 - add r0, r4, #0 - mov r1, #1 - bl FUN_02028788 - add r0, r5, #0 - bl FUN_0206007C - add r0, r5, #0 - bl Sav2_PlayerData_GetProfileAddr - add r4, r0, #0 - bl MTRandom - add r7, r0, #0 - cmp r6, #0 - beq _021D7656 - add r0, r4, #0 - add r1, r7, #0 - bl PlayerProfile_SetTrainerID -_021D7656: - add r0, r4, #0 - bl PlayerProfile_GetTrainerGender - add r1, r0, #0 - add r0, r7, #0 - mov r2, #0 - bl FUN_02053678 - add r1, r0, #0 - lsl r1, r1, #0x18 - add r0, r4, #0 - lsr r1, r1, #0x18 - bl PlayerProfile_SetAvatar - add r0, r5, #0 - bl FUN_02024ECC - ldr r1, [sp] - ldr r2, _021D7684 ; =0x021D76F8 - mov r3, #0x76 - bl FUN_020250C4 - pop {r3, r4, r5, r6, r7, pc} - .align 2, 0 -_021D7684: .word MOD52_021D76F8 - thumb_func_end MOD52_021D7604 - thumb_func_start MOD52_021D7688 MOD52_021D7688: ; 0x021D7688 push {r3, lr} diff --git a/arm9/modules/52/src/module_52_c.c b/arm9/modules/52/src/module_52_c.c index d87eb0e6..cfd74a74 100644 --- a/arm9/modules/52/src/module_52_c.c +++ b/arm9/modules/52/src/module_52_c.c @@ -4,6 +4,9 @@ #include "overlay_manager.h" #include "player_data.h" #include "sav_system_info.h" +#include "unk_020286F8.h" +#include "math_util.h" + extern void FUN_0201681C(u32 param0, u32 heap_id, u32 param2); extern int FUN_020168D0(u32 heap_id); @@ -12,11 +15,18 @@ extern struct Unk21DBE18 UNK_020FD144; extern struct Unk21DBE18 UNK_020F2B7C; extern struct Unk21DBE18 UNK_020F2B8C; -extern void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *save, u32 param2); +void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *save, u32 param2); extern void FUN_02015E3C(struct IGT *igt); extern void MOD52_021D7688(u32 heap_id, struct SaveBlock2 *save); +extern void FUN_0206007C(struct SaveBlock2 *save); +extern int FUN_02053678(u32 random, u32 gender, u32 param2); +extern void FUN_02024ECC(struct SaveBlock2 *save); +extern void FUN_020250C4(struct SaveBlock2 *save, u32 heap_id, u32 **param2, u32 param3); + +extern u32 *MOD52_021D76F8; + THUMB_FUNC int MOD52_021D74E0() { FUN_0201681C(3, 0x4d, 2 << 16); @@ -101,4 +111,87 @@ THUMB_FUNC int MOD52_021D75E8() RegisterMainOverlay(-1, &UNK_020F2B8C); return 1; -} \ No newline at end of file +} + + +// thumb_func_start MOD52_021D7604 +// MOD52_021D7604: ; 0x021D7604 +// push {r3, r4, r5, r6, r7, lr} +// add r5, r1, #0 +// str r0, [sp] +// add r0, r5, #0 +// add r6, r2, #0 +// bl Sav2_SysInfo_get +// bl Sav2_SysInfo_InitFromSystem +// add r0, r5, #0 +// bl Sav2_SysInfo_RTC_get +// bl Sav2_SysInfo_RTC_init +// add r0, r5, #0 +// bl FUN_0202881C +// add r4, r0, #0 +// bl MTRandom +// add r2, r0, #0 +// add r0, r4, #0 +// mov r1, #1 +// bl FUN_02028788 +// add r0, r5, #0 +// bl FUN_0206007C +// add r0, r5, #0 +// bl Sav2_PlayerData_GetProfileAddr +// add r4, r0, #0 +// bl MTRandom +// add r7, r0, #0 +// cmp r6, #0 +// beq _021D7656 +// add r0, r4, #0 +// add r1, r7, #0 +// bl PlayerProfile_SetTrainerID +// _021D7656: +// add r0, r4, #0 +// bl PlayerProfile_GetTrainerGender +// add r1, r0, #0 +// add r0, r7, #0 +// mov r2, #0 +// bl FUN_02053678 +// add r1, r0, #0 +// lsl r1, r1, #0x18 +// add r0, r4, #0 +// lsr r1, r1, #0x18 +// bl PlayerProfile_SetAvatar +// add r0, r5, #0 +// bl FUN_02024ECC +// ldr r1, [sp] +// ldr r2, _021D7684 ; =0x021D76F8 +// mov r3, #0x76 +// bl FUN_020250C4 +// pop {r3, r4, r5, r6, r7, pc} +// .align 2, 0 +// _021D7684: .word MOD52_021D76F8 +// thumb_func_end MOD52_021D7604 +THUMB_FUNC void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *save, u32 param2) { + Sav2_SysInfo_InitFromSystem(Sav2_SysInfo_get(save)); + Sav2_SysInfo_RTC_init(Sav2_SysInfo_RTC_get(save)); + + struct UnkSaveStruct_020286F8 *unk_save = FUN_0202881C(save); + u32 rand = MTRandom(); + + FUN_02028788(unk_save, 1, rand); + FUN_0206007C(save); + + struct PlayerData *player_data = Sav2_PlayerData_GetProfileAddr(save); + u32 rand2 = MTRandom(); + + if (param2 != 0) { + PlayerProfile_SetTrainerID(player_data, rand2); + } + + u32 gender = PlayerProfile_GetTrainerGender(player_data); + u32 avatar = FUN_02053678(rand2, gender, 0); + avatar = avatar << 0x18; + avatar = avatar >> 0x18; + + PlayerProfile_SetAvatar(player_data, avatar); + + FUN_02024ECC(save); + FUN_020250C4(save, heap_id, &MOD52_021D76F8, 0x76); +} -- cgit v1.2.3 From 7d09fdd1c9e3e37f274ea7b35fe0b0e70f8b68dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Tue, 16 Mar 2021 17:34:38 +0100 Subject: match remaining symbols --- arm9/global.inc | 4 +- arm9/modules/52/asm/module_52.s | 87 ----- arm9/modules/52/src/module_52_c.c | 660 ++++++++++++++++++++++++++++++++------ 3 files changed, 567 insertions(+), 184 deletions(-) diff --git a/arm9/global.inc b/arm9/global.inc index f682a937..70a13375 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8528,4 +8528,6 @@ .extern MOD52_021D757C .extern MOD52_021D7594 .extern MOD52_021D75E8 -.extern MOD52_021D7604 \ No newline at end of file +.extern MOD52_021D7604 +.extern MOD52_021D7688 +.extern MOD52_021D769C diff --git a/arm9/modules/52/asm/module_52.s b/arm9/modules/52/asm/module_52.s index acb4b895..e69de29b 100644 --- a/arm9/modules/52/asm/module_52.s +++ b/arm9/modules/52/asm/module_52.s @@ -1,87 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - .section .text - .balign 4, 0 - - - thumb_func_start MOD52_021D7688 -MOD52_021D7688: ; 0x021D7688 - push {r3, lr} - add r0, r1, #0 - bl FUN_020226FC - cmp r0, #0 - bne _021D769A - mov r0, #0 - bl OS_ResetSystem -_021D769A: - pop {r3, pc} - thumb_func_end MOD52_021D7688 - - thumb_func_start MOD52_021D769C -MOD52_021D769C: ; 0x021D769C - push {r4, lr} - add r4, r1, #0 - add r0, r4, #0 - bl Sav2_InitDynamicRegion - add r0, r4, #0 - bl FUN_020377E0 - add r0, r4, #0 - bl Sav2_PlayerData_GetProfileAddr - ldr r1, _021D76C4 ; =0x00000BB8 - bl PlayerProfile_SetMoney - add r0, r4, #0 - bl SavArray_Flags_get - bl FUN_0205ECD4 - pop {r4, pc} - .align 2, 0 -_021D76C4: .word 0x00000BB8 - thumb_func_end MOD52_021D769C - - .rodata - .global MOD52_021D76C8 -MOD52_021D76C8: ; 0x021D76C8 - .word MOD52_021D757C, MOD52_021D7594, MOD52_021D75E8, 0xFFFFFFFF - - .global MOD52_021D76D8 -MOD52_021D76D8: ; 0x021D76D8 - .word MOD52_021D7528, MOD52_021D7540, MOD52_021D7560, 0xFFFFFFFF - - .global MOD52_021D76E8 -MOD52_021D76E8: ; 0x021D76E8 - .word MOD52_021D74E0, MOD52_021D74F8, MOD52_021D750C, 0xFFFFFFFF - - .global MOD52_021D76F8 -MOD52_021D76F8: ; 0x021D76F8 - .byte 0x9B, 0x00, 0x01, 0x00, 0x95, 0x00, 0x01, 0x00, 0x96, 0x00, 0x01, 0x00, 0x97, 0x00, 0x01, 0x00 - .byte 0x9B, 0x00, 0x01, 0x00, 0x97, 0x00, 0x01, 0x00, 0xA4, 0x00, 0x02, 0x00, 0xA5, 0x00, 0x02, 0x00 - .byte 0x95, 0x00, 0x01, 0x00, 0x9B, 0x00, 0x02, 0x00, 0x9E, 0x00, 0x01, 0x00, 0xA7, 0x00, 0x02, 0x00 - .byte 0xA7, 0x00, 0x02, 0x00, 0xAA, 0x00, 0x01, 0x00, 0x95, 0x00, 0x01, 0x00, 0x97, 0x00, 0x01, 0x00 - .byte 0x9B, 0x00, 0x01, 0x00, 0x9B, 0x00, 0x01, 0x00, 0x98, 0x00, 0x01, 0x00, 0x98, 0x00, 0x01, 0x00 - .byte 0xA4, 0x00, 0x01, 0x00, 0xA4, 0x00, 0x01, 0x00, 0x95, 0x00, 0x01, 0x00, 0x9B, 0x00, 0x01, 0x00 - .byte 0x9B, 0x00, 0x01, 0x00, 0xA5, 0x00, 0x01, 0x00, 0xA6, 0x00, 0x02, 0x00, 0xA4, 0x00, 0x02, 0x00 - .byte 0xA5, 0x00, 0x02, 0x00, 0xA8, 0x00, 0x02, 0x00, 0x9A, 0x00, 0x01, 0x00, 0x96, 0x00, 0x01, 0x00 - .byte 0xA4, 0x00, 0x01, 0x00, 0xA4, 0x00, 0x01, 0x00, 0x9C, 0x00, 0x01, 0x00, 0xA6, 0x00, 0x01, 0x00 - .byte 0xA6, 0x00, 0x01, 0x00, 0x9F, 0x00, 0x01, 0x00, 0x99, 0x00, 0x01, 0x00, 0x99, 0x00, 0x01, 0x00 - .byte 0xA4, 0x00, 0x01, 0x00, 0xA8, 0x00, 0x01, 0x00, 0x9E, 0x00, 0x01, 0x00, 0x96, 0x00, 0x01, 0x00 - .byte 0xA0, 0x00, 0x01, 0x00, 0xA2, 0x00, 0x01, 0x00, 0x97, 0x00, 0x01, 0x00, 0x99, 0x00, 0x01, 0x00 - .byte 0xA3, 0x00, 0x01, 0x00, 0xAD, 0x00, 0x01, 0x00, 0x9E, 0x00, 0x01, 0x00, 0x99, 0x00, 0x01, 0x00 - .byte 0xAE, 0x00, 0x01, 0x00, 0x9D, 0x00, 0x01, 0x00, 0x97, 0x00, 0x01, 0x00, 0xA8, 0x00, 0x01, 0x00 - .byte 0xA8, 0x00, 0x01, 0x00, 0xA8, 0x00, 0x01, 0x00, 0x9C, 0x00, 0x01, 0x00, 0x9C, 0x00, 0x01, 0x00 - .byte 0xA6, 0x00, 0x01, 0x00, 0xA6, 0x00, 0x01, 0x00, 0xA2, 0x00, 0x01, 0x00, 0xA3, 0x00, 0x01, 0x00 - .byte 0x98, 0x00, 0x01, 0x00, 0x98, 0x00, 0x01, 0x00, 0x95, 0x00, 0x01, 0x00, 0x9E, 0x00, 0x01, 0x00 - .byte 0x96, 0x00, 0x01, 0x00, 0xA9, 0x00, 0x01, 0x00, 0x97, 0x00, 0x02, 0x00, 0xA5, 0x00, 0x02, 0x00 - .byte 0xA0, 0x00, 0x01, 0x00, 0xA1, 0x00, 0x01, 0x00, 0x98, 0x00, 0x01, 0x00, 0x9C, 0x00, 0x01, 0x00 - .byte 0x9F, 0x00, 0x01, 0x00, 0xA8, 0x00, 0x02, 0x00, 0x9A, 0x00, 0x01, 0x00, 0x97, 0x00, 0x01, 0x00 - .byte 0xA1, 0x00, 0x01, 0x00, 0xAC, 0x00, 0x01, 0x00, 0xA0, 0x00, 0x02, 0x00, 0xA1, 0x00, 0x02, 0x00 - .byte 0xA2, 0x00, 0x02, 0x00, 0xAB, 0x00, 0x01, 0x00, 0x9E, 0x00, 0x02, 0x00, 0xA5, 0x00, 0x03, 0x00 - .byte 0xA6, 0x00, 0x03, 0x00, 0xA7, 0x00, 0x03, 0x00, 0xA9, 0x00, 0x01, 0x00, 0xA9, 0x00, 0x01, 0x00 - .byte 0xAC, 0x00, 0x02, 0x00, 0xAC, 0x00, 0x02, 0x00, 0xAA, 0x00, 0x01, 0x00, 0xAA, 0x00, 0x01, 0x00 - .byte 0xAE, 0x00, 0x01, 0x00, 0xAE, 0x00, 0x01, 0x00, 0xAB, 0x00, 0x01, 0x00, 0xAB, 0x00, 0x01, 0x00 - .byte 0xA9, 0x00, 0x01, 0x00, 0xA9, 0x00, 0x01, 0x00, 0xAC, 0x00, 0x01, 0x00, 0xAC, 0x00, 0x01, 0x00 - .byte 0xAE, 0x00, 0x01, 0x00, 0xAE, 0x00, 0x01, 0x00, 0xAD, 0x00, 0x01, 0x00, 0xAD, 0x00, 0x01, 0x00 - .byte 0xAB, 0x00, 0x01, 0x00, 0xAB, 0x00, 0x01, 0x00, 0x9D, 0x00, 0x01, 0x00, 0x9A, 0x00, 0x01, 0x00 - .byte 0xAB, 0x00, 0x02, 0x00, 0xAD, 0x00, 0x02, 0x00, 0xAA, 0x00, 0x02, 0x00, 0xAA, 0x00, 0x02, 0x00 - .byte 0xAD, 0x00, 0x01, 0x00, 0xAD, 0x00, 0x01, 0x00 - - .data - .bss diff --git a/arm9/modules/52/src/module_52_c.c b/arm9/modules/52/src/module_52_c.c index cfd74a74..3e6d360f 100644 --- a/arm9/modules/52/src/module_52_c.c +++ b/arm9/modules/52/src/module_52_c.c @@ -1,31 +1,35 @@ #include "global.h" +#include "save_block_2.h" +#include "event_data.h" #include "main.h" +#include "math_util.h" #include "options.h" #include "overlay_manager.h" #include "player_data.h" #include "sav_system_info.h" +#include "unk_02024E64.h" #include "unk_020286F8.h" -#include "math_util.h" - extern void FUN_0201681C(u32 param0, u32 heap_id, u32 param2); extern int FUN_020168D0(u32 heap_id); -extern void MOD52_021D769C(u32 heap_id, struct SaveBlock2 *save); +extern void MOD52_021D769C(u32 heap_id, struct SaveBlock2 *sav2); extern struct Unk21DBE18 UNK_020FD144; extern struct Unk21DBE18 UNK_020F2B7C; extern struct Unk21DBE18 UNK_020F2B8C; -void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *save, u32 param2); +void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *sav2, BOOL set_trainerid); extern void FUN_02015E3C(struct IGT *igt); -extern void MOD52_021D7688(u32 heap_id, struct SaveBlock2 *save); +extern void MOD52_021D7688(u32 heap_id, struct SaveBlock2 *sav2); -extern void FUN_0206007C(struct SaveBlock2 *save); +extern void FUN_0206007C(struct SaveBlock2 *sav2); extern int FUN_02053678(u32 random, u32 gender, u32 param2); -extern void FUN_02024ECC(struct SaveBlock2 *save); -extern void FUN_020250C4(struct SaveBlock2 *save, u32 heap_id, u32 **param2, u32 param3); +extern void FUN_020250C4(void *sav_ptr, u32 heap_id, u8 *param2, u32 param3); -extern u32 *MOD52_021D76F8; +extern void FUN_020377E0(struct SaveBlock2 *sav2); +extern void FUN_0205ECD4(struct ScriptState *script_state); + +extern const u8 MOD52_021D76F8[]; THUMB_FUNC int MOD52_021D74E0() { @@ -37,9 +41,9 @@ THUMB_FUNC int MOD52_021D74E0() THUMB_FUNC int MOD52_021D74F8(struct UnkStruct_02006234 *param0) { - struct SaveBlock2 *save = OverlayManager_GetField18(param0)[2]; + struct SaveBlock2 *sav2 = OverlayManager_GetField18(param0)[2]; - MOD52_021D769C(0x4d, save); + MOD52_021D769C(0x4d, sav2); return 1; } @@ -62,9 +66,9 @@ THUMB_FUNC int MOD52_021D7528() THUMB_FUNC int MOD52_021D7540(struct UnkStruct_02006234 *param0) { - struct SaveBlock2 *save = OverlayManager_GetField18(param0)[2]; - MOD52_021D7604(0x4d, save, 1); - struct IGT *igt = Sav2_PlayerData_GetIGTAddr(save); + struct SaveBlock2 *sav2 = OverlayManager_GetField18(param0)[2]; + MOD52_021D7604(0x4d, sav2, 1); + struct IGT *igt = Sav2_PlayerData_GetIGTAddr(sav2); FUN_02015E3C(igt); return 1; @@ -88,19 +92,19 @@ THUMB_FUNC int MOD52_021D757C() THUMB_FUNC int MOD52_021D7594(struct UnkStruct_02006234 *param0) { - struct SaveBlock2 *save = OverlayManager_GetField18(param0)[2]; - struct SavSysInfo *save_info = Sav2_SysInfo_get(save); + struct SaveBlock2 *sav2 = OverlayManager_GetField18(param0)[2]; + struct SavSysInfo *sav2_info = Sav2_SysInfo_get(sav2); - MOD52_021D7688(0x4d, save); - Options_SetButtonModeOnMain(save, 0); + MOD52_021D7688(0x4d, sav2); + Options_SetButtonModeOnMain(sav2, 0); - if (!Sav2_SysInfo_MacAddressIsMine(save_info) || !Sav2_SysInfo_RTCOffsetIsMine(save_info)) + if (!Sav2_SysInfo_MacAddressIsMine(sav2_info) || !Sav2_SysInfo_RTCOffsetIsMine(sav2_info)) { - FUN_020238A4(Sav2_SysInfo_RTC_get(save)); - Sav2_SysInfo_InitFromSystem(save_info); + FUN_020238A4(Sav2_SysInfo_RTC_get(sav2)); + Sav2_SysInfo_InitFromSystem(sav2_info); } - FUN_02015E3C(Sav2_PlayerData_GetIGTAddr(save)); + FUN_02015E3C(Sav2_PlayerData_GetIGTAddr(sav2)); return 1; } @@ -113,85 +117,549 @@ THUMB_FUNC int MOD52_021D75E8() return 1; } +THUMB_FUNC void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *sav2, BOOL set_trainerid) +{ + Sav2_SysInfo_InitFromSystem(Sav2_SysInfo_get(sav2)); + Sav2_SysInfo_RTC_init(Sav2_SysInfo_RTC_get(sav2)); + + struct UnkSaveStruct_020286F8 *unk_sav2 = FUN_0202881C(sav2); + + FUN_02028788(unk_sav2, 1, MTRandom()); + FUN_0206007C(sav2); + + struct PlayerData *player_data = Sav2_PlayerData_GetProfileAddr(sav2); + u32 trainerid = MTRandom(); -// thumb_func_start MOD52_021D7604 -// MOD52_021D7604: ; 0x021D7604 -// push {r3, r4, r5, r6, r7, lr} -// add r5, r1, #0 -// str r0, [sp] -// add r0, r5, #0 -// add r6, r2, #0 -// bl Sav2_SysInfo_get -// bl Sav2_SysInfo_InitFromSystem -// add r0, r5, #0 -// bl Sav2_SysInfo_RTC_get -// bl Sav2_SysInfo_RTC_init -// add r0, r5, #0 -// bl FUN_0202881C -// add r4, r0, #0 -// bl MTRandom -// add r2, r0, #0 -// add r0, r4, #0 -// mov r1, #1 -// bl FUN_02028788 -// add r0, r5, #0 -// bl FUN_0206007C -// add r0, r5, #0 -// bl Sav2_PlayerData_GetProfileAddr -// add r4, r0, #0 -// bl MTRandom -// add r7, r0, #0 -// cmp r6, #0 -// beq _021D7656 -// add r0, r4, #0 -// add r1, r7, #0 -// bl PlayerProfile_SetTrainerID -// _021D7656: -// add r0, r4, #0 -// bl PlayerProfile_GetTrainerGender -// add r1, r0, #0 -// add r0, r7, #0 -// mov r2, #0 -// bl FUN_02053678 -// add r1, r0, #0 -// lsl r1, r1, #0x18 -// add r0, r4, #0 -// lsr r1, r1, #0x18 -// bl PlayerProfile_SetAvatar -// add r0, r5, #0 -// bl FUN_02024ECC -// ldr r1, [sp] -// ldr r2, _021D7684 ; =0x021D76F8 -// mov r3, #0x76 -// bl FUN_020250C4 -// pop {r3, r4, r5, r6, r7, pc} -// .align 2, 0 -// _021D7684: .word MOD52_021D76F8 -// thumb_func_end MOD52_021D7604 -THUMB_FUNC void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *save, u32 param2) { - Sav2_SysInfo_InitFromSystem(Sav2_SysInfo_get(save)); - Sav2_SysInfo_RTC_init(Sav2_SysInfo_RTC_get(save)); - - struct UnkSaveStruct_020286F8 *unk_save = FUN_0202881C(save); - u32 rand = MTRandom(); - - FUN_02028788(unk_save, 1, rand); - FUN_0206007C(save); - - struct PlayerData *player_data = Sav2_PlayerData_GetProfileAddr(save); - u32 rand2 = MTRandom(); - - if (param2 != 0) { - PlayerProfile_SetTrainerID(player_data, rand2); + if (set_trainerid) + { + PlayerProfile_SetTrainerID(player_data, trainerid); } u32 gender = PlayerProfile_GetTrainerGender(player_data); - u32 avatar = FUN_02053678(rand2, gender, 0); - avatar = avatar << 0x18; - avatar = avatar >> 0x18; + int avatar = FUN_02053678(trainerid, gender, 0); PlayerProfile_SetAvatar(player_data, avatar); - FUN_02024ECC(save); - FUN_020250C4(save, heap_id, &MOD52_021D76F8, 0x76); + FUN_020250C4(FUN_02024ECC(sav2), heap_id, &MOD52_021D76F8[0], 0x76); } + +THUMB_FUNC void MOD52_021D7688(u32 param0, struct SaveBlock2 *sav2) +{ + if (FUN_020226FC(sav2)) + { + return; + } + + OS_ResetSystem(0); +} + +THUMB_FUNC void MOD52_021D769C(u32 param0, struct SaveBlock2 *sav2) +{ + Sav2_InitDynamicRegion(sav2); + FUN_020377E0(sav2); + struct PlayerData *player_data = Sav2_PlayerData_GetProfileAddr(sav2); + PlayerProfile_SetMoney(player_data, 3000); + FUN_0205ECD4(SavArray_Flags_get(sav2)); +} + +// struct MOD52_Struct { +// int (*func1)(void); +// int (*func2)(struct UnkStruct_02006234 *param0); +// int (*func3)(void); +// }; + +const u32 MOD52_021D76C8[4] = { + MOD52_021D757C, + MOD52_021D7594, + MOD52_021D75E8, + 0xFFFFFFFF, +}; + +const u32 MOD52_021D76D8[4] = { + MOD52_021D7528, + MOD52_021D7540, + MOD52_021D7560, + 0xFFFFFFFF, +}; + +const u32 MOD52_021D76E8[4] = { + MOD52_021D74E0, + MOD52_021D74F8, + MOD52_021D750C, + 0xFFFFFFFF, +}; + +const u8 MOD52_021D76F8[] = { + 0x9B, + 0x00, + 0x01, + 0x00, + 0x95, + 0x00, + 0x01, + 0x00, + 0x96, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x01, + 0x00, + 0x9B, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x01, + 0x00, + 0xA4, + 0x00, + 0x02, + 0x00, + 0xA5, + 0x00, + 0x02, + 0x00, + 0x95, + 0x00, + 0x01, + 0x00, + 0x9B, + 0x00, + 0x02, + 0x00, + 0x9E, + 0x00, + 0x01, + 0x00, + 0xA7, + 0x00, + 0x02, + 0x00, + 0xA7, + 0x00, + 0x02, + 0x00, + 0xAA, + 0x00, + 0x01, + 0x00, + 0x95, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x01, + 0x00, + 0x9B, + 0x00, + 0x01, + 0x00, + 0x9B, + 0x00, + 0x01, + 0x00, + 0x98, + 0x00, + 0x01, + 0x00, + 0x98, + 0x00, + 0x01, + 0x00, + 0xA4, + 0x00, + 0x01, + 0x00, + 0xA4, + 0x00, + 0x01, + 0x00, + 0x95, + 0x00, + 0x01, + 0x00, + 0x9B, + 0x00, + 0x01, + 0x00, + 0x9B, + 0x00, + 0x01, + 0x00, + 0xA5, + 0x00, + 0x01, + 0x00, + 0xA6, + 0x00, + 0x02, + 0x00, + 0xA4, + 0x00, + 0x02, + 0x00, + 0xA5, + 0x00, + 0x02, + 0x00, + 0xA8, + 0x00, + 0x02, + 0x00, + 0x9A, + 0x00, + 0x01, + 0x00, + 0x96, + 0x00, + 0x01, + 0x00, + 0xA4, + 0x00, + 0x01, + 0x00, + 0xA4, + 0x00, + 0x01, + 0x00, + 0x9C, + 0x00, + 0x01, + 0x00, + 0xA6, + 0x00, + 0x01, + 0x00, + 0xA6, + 0x00, + 0x01, + 0x00, + 0x9F, + 0x00, + 0x01, + 0x00, + 0x99, + 0x00, + 0x01, + 0x00, + 0x99, + 0x00, + 0x01, + 0x00, + 0xA4, + 0x00, + 0x01, + 0x00, + 0xA8, + 0x00, + 0x01, + 0x00, + 0x9E, + 0x00, + 0x01, + 0x00, + 0x96, + 0x00, + 0x01, + 0x00, + 0xA0, + 0x00, + 0x01, + 0x00, + 0xA2, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x01, + 0x00, + 0x99, + 0x00, + 0x01, + 0x00, + 0xA3, + 0x00, + 0x01, + 0x00, + 0xAD, + 0x00, + 0x01, + 0x00, + 0x9E, + 0x00, + 0x01, + 0x00, + 0x99, + 0x00, + 0x01, + 0x00, + 0xAE, + 0x00, + 0x01, + 0x00, + 0x9D, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x01, + 0x00, + 0xA8, + 0x00, + 0x01, + 0x00, + 0xA8, + 0x00, + 0x01, + 0x00, + 0xA8, + 0x00, + 0x01, + 0x00, + 0x9C, + 0x00, + 0x01, + 0x00, + 0x9C, + 0x00, + 0x01, + 0x00, + 0xA6, + 0x00, + 0x01, + 0x00, + 0xA6, + 0x00, + 0x01, + 0x00, + 0xA2, + 0x00, + 0x01, + 0x00, + 0xA3, + 0x00, + 0x01, + 0x00, + 0x98, + 0x00, + 0x01, + 0x00, + 0x98, + 0x00, + 0x01, + 0x00, + 0x95, + 0x00, + 0x01, + 0x00, + 0x9E, + 0x00, + 0x01, + 0x00, + 0x96, + 0x00, + 0x01, + 0x00, + 0xA9, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x02, + 0x00, + 0xA5, + 0x00, + 0x02, + 0x00, + 0xA0, + 0x00, + 0x01, + 0x00, + 0xA1, + 0x00, + 0x01, + 0x00, + 0x98, + 0x00, + 0x01, + 0x00, + 0x9C, + 0x00, + 0x01, + 0x00, + 0x9F, + 0x00, + 0x01, + 0x00, + 0xA8, + 0x00, + 0x02, + 0x00, + 0x9A, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x01, + 0x00, + 0xA1, + 0x00, + 0x01, + 0x00, + 0xAC, + 0x00, + 0x01, + 0x00, + 0xA0, + 0x00, + 0x02, + 0x00, + 0xA1, + 0x00, + 0x02, + 0x00, + 0xA2, + 0x00, + 0x02, + 0x00, + 0xAB, + 0x00, + 0x01, + 0x00, + 0x9E, + 0x00, + 0x02, + 0x00, + 0xA5, + 0x00, + 0x03, + 0x00, + 0xA6, + 0x00, + 0x03, + 0x00, + 0xA7, + 0x00, + 0x03, + 0x00, + 0xA9, + 0x00, + 0x01, + 0x00, + 0xA9, + 0x00, + 0x01, + 0x00, + 0xAC, + 0x00, + 0x02, + 0x00, + 0xAC, + 0x00, + 0x02, + 0x00, + 0xAA, + 0x00, + 0x01, + 0x00, + 0xAA, + 0x00, + 0x01, + 0x00, + 0xAE, + 0x00, + 0x01, + 0x00, + 0xAE, + 0x00, + 0x01, + 0x00, + 0xAB, + 0x00, + 0x01, + 0x00, + 0xAB, + 0x00, + 0x01, + 0x00, + 0xA9, + 0x00, + 0x01, + 0x00, + 0xA9, + 0x00, + 0x01, + 0x00, + 0xAC, + 0x00, + 0x01, + 0x00, + 0xAC, + 0x00, + 0x01, + 0x00, + 0xAE, + 0x00, + 0x01, + 0x00, + 0xAE, + 0x00, + 0x01, + 0x00, + 0xAD, + 0x00, + 0x01, + 0x00, + 0xAD, + 0x00, + 0x01, + 0x00, + 0xAB, + 0x00, + 0x01, + 0x00, + 0xAB, + 0x00, + 0x01, + 0x00, + 0x9D, + 0x00, + 0x01, + 0x00, + 0x9A, + 0x00, + 0x01, + 0x00, + 0xAB, + 0x00, + 0x02, + 0x00, + 0xAD, + 0x00, + 0x02, + 0x00, + 0xAA, + 0x00, + 0x02, + 0x00, + 0xAA, + 0x00, + 0x02, + 0x00, + 0xAD, + 0x00, + 0x01, + 0x00, + 0xAD, + 0x00, + 0x01, + 0x00, +}; \ No newline at end of file -- cgit v1.2.3 From 000fd95ffcc81b03f0e25e46ce30884cf1ff59a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Tue, 16 Mar 2021 18:16:42 +0100 Subject: module 52 header --- arm9/arm9.lsf | 1 - arm9/modules/52/asm/module_52.s | 0 arm9/modules/52/include/module_52.h | 42 +++ arm9/modules/52/src/module_52.c | 643 ++++++++++++++++++++++++++++++++++ arm9/modules/52/src/module_52_c.c | 665 ------------------------------------ include/global.h | 2 + 6 files changed, 687 insertions(+), 666 deletions(-) delete mode 100644 arm9/modules/52/asm/module_52.s create mode 100644 arm9/modules/52/include/module_52.h create mode 100644 arm9/modules/52/src/module_52.c delete mode 100644 arm9/modules/52/src/module_52_c.c diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index 615430f9..b8accee4 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -899,7 +899,6 @@ Overlay MODULE_52 { ##Some kind of transition overlay for intro## After arm9 - Object module_52_c.o Object module_52.o } diff --git a/arm9/modules/52/asm/module_52.s b/arm9/modules/52/asm/module_52.s deleted file mode 100644 index e69de29b..00000000 diff --git a/arm9/modules/52/include/module_52.h b/arm9/modules/52/include/module_52.h new file mode 100644 index 00000000..46caf4e9 --- /dev/null +++ b/arm9/modules/52/include/module_52.h @@ -0,0 +1,42 @@ +#ifndef POKEDIAMOND_MODULE_52_H +#define POKEDIAMOND_MODULE_52_H + +#include "global.h" +#include "save_block_2.h" +#include "event_data.h" +#include "main.h" +#include "math_util.h" +#include "options.h" +#include "overlay_manager.h" +#include "player_data.h" +#include "sav_system_info.h" +#include "unk_02024E64.h" +#include "unk_020286F8.h" + +const u8 MOD52_021D76F8[]; + +THUMB_FUNC int MOD52_021D74E0(); +THUMB_FUNC int MOD52_021D74F8(struct UnkStruct_02006234 *param0); +THUMB_FUNC int MOD52_021D750C(); + +THUMB_FUNC int MOD52_021D7528(); +THUMB_FUNC int MOD52_021D7540(struct UnkStruct_02006234 *param0); +THUMB_FUNC int MOD52_021D7560(); + +THUMB_FUNC int MOD52_021D757C(); +THUMB_FUNC int MOD52_021D7594(struct UnkStruct_02006234 *param0); +THUMB_FUNC int MOD52_021D75E8(); + +THUMB_FUNC void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *sav2, BOOL set_trainerid); +THUMB_FUNC void MOD52_021D7688(u32 param0, struct SaveBlock2 *sav2); +THUMB_FUNC void MOD52_021D769C(u32 param0, struct SaveBlock2 *sav2); + +struct MOD52_Struct +{ + int (*func1)(void); + int (*func2)(struct UnkStruct_02006234 *param0); + int (*func3)(void); + u32 terminator; +}; + +#endif //POKEDIAMOND_MODULE_52_H \ No newline at end of file diff --git a/arm9/modules/52/src/module_52.c b/arm9/modules/52/src/module_52.c new file mode 100644 index 00000000..766d5169 --- /dev/null +++ b/arm9/modules/52/src/module_52.c @@ -0,0 +1,643 @@ +#include "module_52.h" + +extern struct Unk21DBE18 UNK_020FD144; +extern struct Unk21DBE18 UNK_020F2B7C; +extern struct Unk21DBE18 UNK_020F2B8C; + +extern void FUN_0201681C(u32 param0, u32 heap_id, u32 param2); +extern int FUN_020168D0(u32 heap_id); +extern void FUN_02015E3C(struct IGT *igt); +extern void FUN_0206007C(struct SaveBlock2 *sav2); +extern int FUN_02053678(u32 random, u32 gender, u32 param2); +extern void FUN_020250C4(void *sav_ptr, u32 heap_id, const u8 param2[], u32 param3); +extern void FUN_020377E0(struct SaveBlock2 *sav2); +extern void FUN_0205ECD4(struct ScriptState *script_state); + +THUMB_FUNC int MOD52_021D74E0() +{ + FUN_0201681C(3, 0x4d, 2 << 16); + InitializeMainRNG(); + + return 1; +} + +THUMB_FUNC int MOD52_021D74F8(struct UnkStruct_02006234 *param0) +{ + struct SaveBlock2 *sav2 = (struct SaveBlock2 *)OverlayManager_GetField18(param0)[2]; // weird + + MOD52_021D769C(0x4d, sav2); + + return 1; +} + +THUMB_FUNC int MOD52_021D750C() +{ + FUN_020168D0(0x4d); + RegisterMainOverlay(0XFFFFFFFF, &UNK_020FD144); + + return 1; +} + +THUMB_FUNC int MOD52_021D7528() +{ + FUN_0201681C(3, 0x4d, 2 << 16); + InitializeMainRNG(); + + return 1; +} + +THUMB_FUNC int MOD52_021D7540(struct UnkStruct_02006234 *param0) +{ + struct SaveBlock2 *sav2 = (struct SaveBlock2 *)OverlayManager_GetField18(param0)[2]; // weird + + MOD52_021D7604(0x4d, sav2, 1); + struct IGT *igt = Sav2_PlayerData_GetIGTAddr(sav2); + FUN_02015E3C(igt); + + return 1; +} + +THUMB_FUNC int MOD52_021D7560() +{ + FUN_020168D0(0x4d); + RegisterMainOverlay(0xFFFFFFFF, &UNK_020F2B7C); + + return 1; +} + +THUMB_FUNC int MOD52_021D757C() +{ + FUN_0201681C(3, 0x4d, 2 << 16); + InitializeMainRNG(); + + return 1; +} + +THUMB_FUNC int MOD52_021D7594(struct UnkStruct_02006234 *param0) +{ + struct SaveBlock2 *sav2 = (struct SaveBlock2 *)OverlayManager_GetField18(param0)[2]; // weird + + struct SavSysInfo *sav2_info = Sav2_SysInfo_get(sav2); + + MOD52_021D7688(0x4d, sav2); + Options_SetButtonModeOnMain(sav2, 0); + + if (!Sav2_SysInfo_MacAddressIsMine(sav2_info) || !Sav2_SysInfo_RTCOffsetIsMine(sav2_info)) + { + FUN_020238A4(Sav2_SysInfo_RTC_get(sav2)); + Sav2_SysInfo_InitFromSystem(sav2_info); + } + + FUN_02015E3C(Sav2_PlayerData_GetIGTAddr(sav2)); + + return 1; +} + +THUMB_FUNC int MOD52_021D75E8() +{ + FUN_020168D0(0x4d); + RegisterMainOverlay(0XFFFFFFFF, &UNK_020F2B8C); + + return 1; +} + +THUMB_FUNC void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *sav2, BOOL set_trainerid) +{ + Sav2_SysInfo_InitFromSystem(Sav2_SysInfo_get(sav2)); + Sav2_SysInfo_RTC_init(Sav2_SysInfo_RTC_get(sav2)); + + struct UnkSaveStruct_020286F8 *unk_sav2 = FUN_0202881C(sav2); + + FUN_02028788(unk_sav2, 1, MTRandom()); + FUN_0206007C(sav2); + + struct PlayerData *player_data = Sav2_PlayerData_GetProfileAddr(sav2); + u32 trainerid = MTRandom(); + + if (set_trainerid) + { + PlayerProfile_SetTrainerID(player_data, trainerid); + } + + u32 gender = PlayerProfile_GetTrainerGender(player_data); + int avatar = FUN_02053678(trainerid, gender, 0); + + PlayerProfile_SetAvatar(player_data, (u8)avatar); + + FUN_020250C4(FUN_02024ECC(sav2), heap_id, MOD52_021D76F8, 0x76); +} + +THUMB_FUNC void MOD52_021D7688(u32 unused UNUSED, struct SaveBlock2 *sav2) +{ + if (FUN_020226FC(sav2)) + { + return; + } + + OS_ResetSystem(0); +} + +THUMB_FUNC void MOD52_021D769C(u32 unused UNUSED, struct SaveBlock2 *sav2) +{ + Sav2_InitDynamicRegion(sav2); + FUN_020377E0(sav2); + struct PlayerData *player_data = Sav2_PlayerData_GetProfileAddr(sav2); + PlayerProfile_SetMoney(player_data, 3000); + FUN_0205ECD4(SavArray_Flags_get(sav2)); +} + +const struct MOD52_Struct MOD52_021D76C8 = { + MOD52_021D757C, + MOD52_021D7594, + MOD52_021D75E8, + 0xFFFFFFFF, +}; + +const struct MOD52_Struct MOD52_021D76D8 = { + MOD52_021D7528, + MOD52_021D7540, + MOD52_021D7560, + 0xFFFFFFFF, +}; + +const struct MOD52_Struct MOD52_021D76E8 = { + MOD52_021D74E0, + MOD52_021D74F8, + MOD52_021D750C, + 0xFFFFFFFF, +}; + +const u8 MOD52_021D76F8[] = { + 0x9B, + 0x00, + 0x01, + 0x00, + 0x95, + 0x00, + 0x01, + 0x00, + 0x96, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x01, + 0x00, + 0x9B, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x01, + 0x00, + 0xA4, + 0x00, + 0x02, + 0x00, + 0xA5, + 0x00, + 0x02, + 0x00, + 0x95, + 0x00, + 0x01, + 0x00, + 0x9B, + 0x00, + 0x02, + 0x00, + 0x9E, + 0x00, + 0x01, + 0x00, + 0xA7, + 0x00, + 0x02, + 0x00, + 0xA7, + 0x00, + 0x02, + 0x00, + 0xAA, + 0x00, + 0x01, + 0x00, + 0x95, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x01, + 0x00, + 0x9B, + 0x00, + 0x01, + 0x00, + 0x9B, + 0x00, + 0x01, + 0x00, + 0x98, + 0x00, + 0x01, + 0x00, + 0x98, + 0x00, + 0x01, + 0x00, + 0xA4, + 0x00, + 0x01, + 0x00, + 0xA4, + 0x00, + 0x01, + 0x00, + 0x95, + 0x00, + 0x01, + 0x00, + 0x9B, + 0x00, + 0x01, + 0x00, + 0x9B, + 0x00, + 0x01, + 0x00, + 0xA5, + 0x00, + 0x01, + 0x00, + 0xA6, + 0x00, + 0x02, + 0x00, + 0xA4, + 0x00, + 0x02, + 0x00, + 0xA5, + 0x00, + 0x02, + 0x00, + 0xA8, + 0x00, + 0x02, + 0x00, + 0x9A, + 0x00, + 0x01, + 0x00, + 0x96, + 0x00, + 0x01, + 0x00, + 0xA4, + 0x00, + 0x01, + 0x00, + 0xA4, + 0x00, + 0x01, + 0x00, + 0x9C, + 0x00, + 0x01, + 0x00, + 0xA6, + 0x00, + 0x01, + 0x00, + 0xA6, + 0x00, + 0x01, + 0x00, + 0x9F, + 0x00, + 0x01, + 0x00, + 0x99, + 0x00, + 0x01, + 0x00, + 0x99, + 0x00, + 0x01, + 0x00, + 0xA4, + 0x00, + 0x01, + 0x00, + 0xA8, + 0x00, + 0x01, + 0x00, + 0x9E, + 0x00, + 0x01, + 0x00, + 0x96, + 0x00, + 0x01, + 0x00, + 0xA0, + 0x00, + 0x01, + 0x00, + 0xA2, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x01, + 0x00, + 0x99, + 0x00, + 0x01, + 0x00, + 0xA3, + 0x00, + 0x01, + 0x00, + 0xAD, + 0x00, + 0x01, + 0x00, + 0x9E, + 0x00, + 0x01, + 0x00, + 0x99, + 0x00, + 0x01, + 0x00, + 0xAE, + 0x00, + 0x01, + 0x00, + 0x9D, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x01, + 0x00, + 0xA8, + 0x00, + 0x01, + 0x00, + 0xA8, + 0x00, + 0x01, + 0x00, + 0xA8, + 0x00, + 0x01, + 0x00, + 0x9C, + 0x00, + 0x01, + 0x00, + 0x9C, + 0x00, + 0x01, + 0x00, + 0xA6, + 0x00, + 0x01, + 0x00, + 0xA6, + 0x00, + 0x01, + 0x00, + 0xA2, + 0x00, + 0x01, + 0x00, + 0xA3, + 0x00, + 0x01, + 0x00, + 0x98, + 0x00, + 0x01, + 0x00, + 0x98, + 0x00, + 0x01, + 0x00, + 0x95, + 0x00, + 0x01, + 0x00, + 0x9E, + 0x00, + 0x01, + 0x00, + 0x96, + 0x00, + 0x01, + 0x00, + 0xA9, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x02, + 0x00, + 0xA5, + 0x00, + 0x02, + 0x00, + 0xA0, + 0x00, + 0x01, + 0x00, + 0xA1, + 0x00, + 0x01, + 0x00, + 0x98, + 0x00, + 0x01, + 0x00, + 0x9C, + 0x00, + 0x01, + 0x00, + 0x9F, + 0x00, + 0x01, + 0x00, + 0xA8, + 0x00, + 0x02, + 0x00, + 0x9A, + 0x00, + 0x01, + 0x00, + 0x97, + 0x00, + 0x01, + 0x00, + 0xA1, + 0x00, + 0x01, + 0x00, + 0xAC, + 0x00, + 0x01, + 0x00, + 0xA0, + 0x00, + 0x02, + 0x00, + 0xA1, + 0x00, + 0x02, + 0x00, + 0xA2, + 0x00, + 0x02, + 0x00, + 0xAB, + 0x00, + 0x01, + 0x00, + 0x9E, + 0x00, + 0x02, + 0x00, + 0xA5, + 0x00, + 0x03, + 0x00, + 0xA6, + 0x00, + 0x03, + 0x00, + 0xA7, + 0x00, + 0x03, + 0x00, + 0xA9, + 0x00, + 0x01, + 0x00, + 0xA9, + 0x00, + 0x01, + 0x00, + 0xAC, + 0x00, + 0x02, + 0x00, + 0xAC, + 0x00, + 0x02, + 0x00, + 0xAA, + 0x00, + 0x01, + 0x00, + 0xAA, + 0x00, + 0x01, + 0x00, + 0xAE, + 0x00, + 0x01, + 0x00, + 0xAE, + 0x00, + 0x01, + 0x00, + 0xAB, + 0x00, + 0x01, + 0x00, + 0xAB, + 0x00, + 0x01, + 0x00, + 0xA9, + 0x00, + 0x01, + 0x00, + 0xA9, + 0x00, + 0x01, + 0x00, + 0xAC, + 0x00, + 0x01, + 0x00, + 0xAC, + 0x00, + 0x01, + 0x00, + 0xAE, + 0x00, + 0x01, + 0x00, + 0xAE, + 0x00, + 0x01, + 0x00, + 0xAD, + 0x00, + 0x01, + 0x00, + 0xAD, + 0x00, + 0x01, + 0x00, + 0xAB, + 0x00, + 0x01, + 0x00, + 0xAB, + 0x00, + 0x01, + 0x00, + 0x9D, + 0x00, + 0x01, + 0x00, + 0x9A, + 0x00, + 0x01, + 0x00, + 0xAB, + 0x00, + 0x02, + 0x00, + 0xAD, + 0x00, + 0x02, + 0x00, + 0xAA, + 0x00, + 0x02, + 0x00, + 0xAA, + 0x00, + 0x02, + 0x00, + 0xAD, + 0x00, + 0x01, + 0x00, + 0xAD, + 0x00, + 0x01, + 0x00, +}; \ No newline at end of file diff --git a/arm9/modules/52/src/module_52_c.c b/arm9/modules/52/src/module_52_c.c deleted file mode 100644 index 3e6d360f..00000000 --- a/arm9/modules/52/src/module_52_c.c +++ /dev/null @@ -1,665 +0,0 @@ -#include "global.h" -#include "save_block_2.h" -#include "event_data.h" -#include "main.h" -#include "math_util.h" -#include "options.h" -#include "overlay_manager.h" -#include "player_data.h" -#include "sav_system_info.h" -#include "unk_02024E64.h" -#include "unk_020286F8.h" - -extern void FUN_0201681C(u32 param0, u32 heap_id, u32 param2); -extern int FUN_020168D0(u32 heap_id); -extern void MOD52_021D769C(u32 heap_id, struct SaveBlock2 *sav2); -extern struct Unk21DBE18 UNK_020FD144; -extern struct Unk21DBE18 UNK_020F2B7C; -extern struct Unk21DBE18 UNK_020F2B8C; - -void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *sav2, BOOL set_trainerid); -extern void FUN_02015E3C(struct IGT *igt); - -extern void MOD52_021D7688(u32 heap_id, struct SaveBlock2 *sav2); - -extern void FUN_0206007C(struct SaveBlock2 *sav2); -extern int FUN_02053678(u32 random, u32 gender, u32 param2); -extern void FUN_020250C4(void *sav_ptr, u32 heap_id, u8 *param2, u32 param3); - -extern void FUN_020377E0(struct SaveBlock2 *sav2); -extern void FUN_0205ECD4(struct ScriptState *script_state); - -extern const u8 MOD52_021D76F8[]; - -THUMB_FUNC int MOD52_021D74E0() -{ - FUN_0201681C(3, 0x4d, 2 << 16); - InitializeMainRNG(); - - return 1; -} - -THUMB_FUNC int MOD52_021D74F8(struct UnkStruct_02006234 *param0) -{ - struct SaveBlock2 *sav2 = OverlayManager_GetField18(param0)[2]; - - MOD52_021D769C(0x4d, sav2); - - return 1; -} - -THUMB_FUNC int MOD52_021D750C() -{ - FUN_020168D0(0x4d); - RegisterMainOverlay(-1, &UNK_020FD144); - - return 1; -} - -THUMB_FUNC int MOD52_021D7528() -{ - FUN_0201681C(3, 0x4d, 2 << 16); - InitializeMainRNG(); - - return 1; -} - -THUMB_FUNC int MOD52_021D7540(struct UnkStruct_02006234 *param0) -{ - struct SaveBlock2 *sav2 = OverlayManager_GetField18(param0)[2]; - MOD52_021D7604(0x4d, sav2, 1); - struct IGT *igt = Sav2_PlayerData_GetIGTAddr(sav2); - FUN_02015E3C(igt); - - return 1; -} - -THUMB_FUNC int MOD52_021D7560() -{ - FUN_020168D0(0x4d); - RegisterMainOverlay(-1, &UNK_020F2B7C); - - return 1; -} - -THUMB_FUNC int MOD52_021D757C() -{ - FUN_0201681C(3, 0x4d, 2 << 16); - InitializeMainRNG(); - - return 1; -} - -THUMB_FUNC int MOD52_021D7594(struct UnkStruct_02006234 *param0) -{ - struct SaveBlock2 *sav2 = OverlayManager_GetField18(param0)[2]; - struct SavSysInfo *sav2_info = Sav2_SysInfo_get(sav2); - - MOD52_021D7688(0x4d, sav2); - Options_SetButtonModeOnMain(sav2, 0); - - if (!Sav2_SysInfo_MacAddressIsMine(sav2_info) || !Sav2_SysInfo_RTCOffsetIsMine(sav2_info)) - { - FUN_020238A4(Sav2_SysInfo_RTC_get(sav2)); - Sav2_SysInfo_InitFromSystem(sav2_info); - } - - FUN_02015E3C(Sav2_PlayerData_GetIGTAddr(sav2)); - - return 1; -} - -THUMB_FUNC int MOD52_021D75E8() -{ - FUN_020168D0(0x4d); - RegisterMainOverlay(-1, &UNK_020F2B8C); - - return 1; -} - -THUMB_FUNC void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *sav2, BOOL set_trainerid) -{ - Sav2_SysInfo_InitFromSystem(Sav2_SysInfo_get(sav2)); - Sav2_SysInfo_RTC_init(Sav2_SysInfo_RTC_get(sav2)); - - struct UnkSaveStruct_020286F8 *unk_sav2 = FUN_0202881C(sav2); - - FUN_02028788(unk_sav2, 1, MTRandom()); - FUN_0206007C(sav2); - - struct PlayerData *player_data = Sav2_PlayerData_GetProfileAddr(sav2); - u32 trainerid = MTRandom(); - - if (set_trainerid) - { - PlayerProfile_SetTrainerID(player_data, trainerid); - } - - u32 gender = PlayerProfile_GetTrainerGender(player_data); - int avatar = FUN_02053678(trainerid, gender, 0); - - PlayerProfile_SetAvatar(player_data, avatar); - - FUN_020250C4(FUN_02024ECC(sav2), heap_id, &MOD52_021D76F8[0], 0x76); -} - -THUMB_FUNC void MOD52_021D7688(u32 param0, struct SaveBlock2 *sav2) -{ - if (FUN_020226FC(sav2)) - { - return; - } - - OS_ResetSystem(0); -} - -THUMB_FUNC void MOD52_021D769C(u32 param0, struct SaveBlock2 *sav2) -{ - Sav2_InitDynamicRegion(sav2); - FUN_020377E0(sav2); - struct PlayerData *player_data = Sav2_PlayerData_GetProfileAddr(sav2); - PlayerProfile_SetMoney(player_data, 3000); - FUN_0205ECD4(SavArray_Flags_get(sav2)); -} - -// struct MOD52_Struct { -// int (*func1)(void); -// int (*func2)(struct UnkStruct_02006234 *param0); -// int (*func3)(void); -// }; - -const u32 MOD52_021D76C8[4] = { - MOD52_021D757C, - MOD52_021D7594, - MOD52_021D75E8, - 0xFFFFFFFF, -}; - -const u32 MOD52_021D76D8[4] = { - MOD52_021D7528, - MOD52_021D7540, - MOD52_021D7560, - 0xFFFFFFFF, -}; - -const u32 MOD52_021D76E8[4] = { - MOD52_021D74E0, - MOD52_021D74F8, - MOD52_021D750C, - 0xFFFFFFFF, -}; - -const u8 MOD52_021D76F8[] = { - 0x9B, - 0x00, - 0x01, - 0x00, - 0x95, - 0x00, - 0x01, - 0x00, - 0x96, - 0x00, - 0x01, - 0x00, - 0x97, - 0x00, - 0x01, - 0x00, - 0x9B, - 0x00, - 0x01, - 0x00, - 0x97, - 0x00, - 0x01, - 0x00, - 0xA4, - 0x00, - 0x02, - 0x00, - 0xA5, - 0x00, - 0x02, - 0x00, - 0x95, - 0x00, - 0x01, - 0x00, - 0x9B, - 0x00, - 0x02, - 0x00, - 0x9E, - 0x00, - 0x01, - 0x00, - 0xA7, - 0x00, - 0x02, - 0x00, - 0xA7, - 0x00, - 0x02, - 0x00, - 0xAA, - 0x00, - 0x01, - 0x00, - 0x95, - 0x00, - 0x01, - 0x00, - 0x97, - 0x00, - 0x01, - 0x00, - 0x9B, - 0x00, - 0x01, - 0x00, - 0x9B, - 0x00, - 0x01, - 0x00, - 0x98, - 0x00, - 0x01, - 0x00, - 0x98, - 0x00, - 0x01, - 0x00, - 0xA4, - 0x00, - 0x01, - 0x00, - 0xA4, - 0x00, - 0x01, - 0x00, - 0x95, - 0x00, - 0x01, - 0x00, - 0x9B, - 0x00, - 0x01, - 0x00, - 0x9B, - 0x00, - 0x01, - 0x00, - 0xA5, - 0x00, - 0x01, - 0x00, - 0xA6, - 0x00, - 0x02, - 0x00, - 0xA4, - 0x00, - 0x02, - 0x00, - 0xA5, - 0x00, - 0x02, - 0x00, - 0xA8, - 0x00, - 0x02, - 0x00, - 0x9A, - 0x00, - 0x01, - 0x00, - 0x96, - 0x00, - 0x01, - 0x00, - 0xA4, - 0x00, - 0x01, - 0x00, - 0xA4, - 0x00, - 0x01, - 0x00, - 0x9C, - 0x00, - 0x01, - 0x00, - 0xA6, - 0x00, - 0x01, - 0x00, - 0xA6, - 0x00, - 0x01, - 0x00, - 0x9F, - 0x00, - 0x01, - 0x00, - 0x99, - 0x00, - 0x01, - 0x00, - 0x99, - 0x00, - 0x01, - 0x00, - 0xA4, - 0x00, - 0x01, - 0x00, - 0xA8, - 0x00, - 0x01, - 0x00, - 0x9E, - 0x00, - 0x01, - 0x00, - 0x96, - 0x00, - 0x01, - 0x00, - 0xA0, - 0x00, - 0x01, - 0x00, - 0xA2, - 0x00, - 0x01, - 0x00, - 0x97, - 0x00, - 0x01, - 0x00, - 0x99, - 0x00, - 0x01, - 0x00, - 0xA3, - 0x00, - 0x01, - 0x00, - 0xAD, - 0x00, - 0x01, - 0x00, - 0x9E, - 0x00, - 0x01, - 0x00, - 0x99, - 0x00, - 0x01, - 0x00, - 0xAE, - 0x00, - 0x01, - 0x00, - 0x9D, - 0x00, - 0x01, - 0x00, - 0x97, - 0x00, - 0x01, - 0x00, - 0xA8, - 0x00, - 0x01, - 0x00, - 0xA8, - 0x00, - 0x01, - 0x00, - 0xA8, - 0x00, - 0x01, - 0x00, - 0x9C, - 0x00, - 0x01, - 0x00, - 0x9C, - 0x00, - 0x01, - 0x00, - 0xA6, - 0x00, - 0x01, - 0x00, - 0xA6, - 0x00, - 0x01, - 0x00, - 0xA2, - 0x00, - 0x01, - 0x00, - 0xA3, - 0x00, - 0x01, - 0x00, - 0x98, - 0x00, - 0x01, - 0x00, - 0x98, - 0x00, - 0x01, - 0x00, - 0x95, - 0x00, - 0x01, - 0x00, - 0x9E, - 0x00, - 0x01, - 0x00, - 0x96, - 0x00, - 0x01, - 0x00, - 0xA9, - 0x00, - 0x01, - 0x00, - 0x97, - 0x00, - 0x02, - 0x00, - 0xA5, - 0x00, - 0x02, - 0x00, - 0xA0, - 0x00, - 0x01, - 0x00, - 0xA1, - 0x00, - 0x01, - 0x00, - 0x98, - 0x00, - 0x01, - 0x00, - 0x9C, - 0x00, - 0x01, - 0x00, - 0x9F, - 0x00, - 0x01, - 0x00, - 0xA8, - 0x00, - 0x02, - 0x00, - 0x9A, - 0x00, - 0x01, - 0x00, - 0x97, - 0x00, - 0x01, - 0x00, - 0xA1, - 0x00, - 0x01, - 0x00, - 0xAC, - 0x00, - 0x01, - 0x00, - 0xA0, - 0x00, - 0x02, - 0x00, - 0xA1, - 0x00, - 0x02, - 0x00, - 0xA2, - 0x00, - 0x02, - 0x00, - 0xAB, - 0x00, - 0x01, - 0x00, - 0x9E, - 0x00, - 0x02, - 0x00, - 0xA5, - 0x00, - 0x03, - 0x00, - 0xA6, - 0x00, - 0x03, - 0x00, - 0xA7, - 0x00, - 0x03, - 0x00, - 0xA9, - 0x00, - 0x01, - 0x00, - 0xA9, - 0x00, - 0x01, - 0x00, - 0xAC, - 0x00, - 0x02, - 0x00, - 0xAC, - 0x00, - 0x02, - 0x00, - 0xAA, - 0x00, - 0x01, - 0x00, - 0xAA, - 0x00, - 0x01, - 0x00, - 0xAE, - 0x00, - 0x01, - 0x00, - 0xAE, - 0x00, - 0x01, - 0x00, - 0xAB, - 0x00, - 0x01, - 0x00, - 0xAB, - 0x00, - 0x01, - 0x00, - 0xA9, - 0x00, - 0x01, - 0x00, - 0xA9, - 0x00, - 0x01, - 0x00, - 0xAC, - 0x00, - 0x01, - 0x00, - 0xAC, - 0x00, - 0x01, - 0x00, - 0xAE, - 0x00, - 0x01, - 0x00, - 0xAE, - 0x00, - 0x01, - 0x00, - 0xAD, - 0x00, - 0x01, - 0x00, - 0xAD, - 0x00, - 0x01, - 0x00, - 0xAB, - 0x00, - 0x01, - 0x00, - 0xAB, - 0x00, - 0x01, - 0x00, - 0x9D, - 0x00, - 0x01, - 0x00, - 0x9A, - 0x00, - 0x01, - 0x00, - 0xAB, - 0x00, - 0x02, - 0x00, - 0xAD, - 0x00, - 0x02, - 0x00, - 0xAA, - 0x00, - 0x02, - 0x00, - 0xAA, - 0x00, - 0x02, - 0x00, - 0xAD, - 0x00, - 0x01, - 0x00, - 0xAD, - 0x00, - 0x01, - 0x00, -}; \ No newline at end of file diff --git a/include/global.h b/include/global.h index e0e8cb22..be0e1870 100644 --- a/include/global.h +++ b/include/global.h @@ -14,6 +14,8 @@ #define GF_ASSERT(expr) do {if (!(expr)) ErrorHandling();} while (0) +#define UNUSED __attribute__((unused)) + #ifndef IN_MAIN_C extern const u8 gGameLanguage; extern const u8 gGameVersion; -- cgit v1.2.3 From 7da64ed729153ceb36a639365de5ae183257426a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Tue, 16 Mar 2021 18:19:33 +0100 Subject: remove unneeded includes --- arm9/global.inc | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/arm9/global.inc b/arm9/global.inc index 70a13375..d816d92a 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8519,15 +8519,3 @@ .extern CARDi_InitCommon .extern MonNotFaintedOrEgg .extern CountAlivePokemon -.extern MOD52_021D74E0 -.extern MOD52_021D74F8 -.extern MOD52_021D750C -.extern MOD52_021D7528 -.extern MOD52_021D7540 -.extern MOD52_021D7560 -.extern MOD52_021D757C -.extern MOD52_021D7594 -.extern MOD52_021D75E8 -.extern MOD52_021D7604 -.extern MOD52_021D7688 -.extern MOD52_021D769C -- cgit v1.2.3 From 6f4ef01cefe01b5c02e963c842f9f1515e12a5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Tue, 16 Mar 2021 18:26:05 +0100 Subject: header weirdness --- arm9/modules/52/include/module_52.h | 4 ++-- include/event_data.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arm9/modules/52/include/module_52.h b/arm9/modules/52/include/module_52.h index 46caf4e9..4c47a82d 100644 --- a/arm9/modules/52/include/module_52.h +++ b/arm9/modules/52/include/module_52.h @@ -2,7 +2,6 @@ #define POKEDIAMOND_MODULE_52_H #include "global.h" -#include "save_block_2.h" #include "event_data.h" #include "main.h" #include "math_util.h" @@ -10,6 +9,7 @@ #include "overlay_manager.h" #include "player_data.h" #include "sav_system_info.h" +#include "save_block_2.h" #include "unk_02024E64.h" #include "unk_020286F8.h" @@ -39,4 +39,4 @@ struct MOD52_Struct u32 terminator; }; -#endif //POKEDIAMOND_MODULE_52_H \ No newline at end of file +#endif // POKEDIAMOND_MODULE_52_H \ No newline at end of file diff --git a/include/event_data.h b/include/event_data.h index e1d46348..1f0f090a 100644 --- a/include/event_data.h +++ b/include/event_data.h @@ -1,6 +1,8 @@ #ifndef GUARD_SCRIPT_STATE_H #define GUARD_SCRIPT_STATE_H +#include "save_block_2.h" + struct ScriptState { u16 vars[288]; -- cgit v1.2.3 From e31be2804e19b75ba41312bac87239a2f068efe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Tue, 16 Mar 2021 18:43:20 +0100 Subject: use #pragma unused --- arm9/modules/52/src/module_52.c | 8 ++++++-- include/global.h | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arm9/modules/52/src/module_52.c b/arm9/modules/52/src/module_52.c index 766d5169..8b00f613 100644 --- a/arm9/modules/52/src/module_52.c +++ b/arm9/modules/52/src/module_52.c @@ -127,8 +127,10 @@ THUMB_FUNC void MOD52_021D7604(u32 heap_id, struct SaveBlock2 *sav2, BOOL set_tr FUN_020250C4(FUN_02024ECC(sav2), heap_id, MOD52_021D76F8, 0x76); } -THUMB_FUNC void MOD52_021D7688(u32 unused UNUSED, struct SaveBlock2 *sav2) +THUMB_FUNC void MOD52_021D7688(u32 unused, struct SaveBlock2 *sav2) { +#pragma unused(unused) + if (FUN_020226FC(sav2)) { return; @@ -137,8 +139,10 @@ THUMB_FUNC void MOD52_021D7688(u32 unused UNUSED, struct SaveBlock2 *sav2) OS_ResetSystem(0); } -THUMB_FUNC void MOD52_021D769C(u32 unused UNUSED, struct SaveBlock2 *sav2) +THUMB_FUNC void MOD52_021D769C(u32 unused, struct SaveBlock2 *sav2) { +#pragma unused(unused) + Sav2_InitDynamicRegion(sav2); FUN_020377E0(sav2); struct PlayerData *player_data = Sav2_PlayerData_GetProfileAddr(sav2); diff --git a/include/global.h b/include/global.h index be0e1870..e0e8cb22 100644 --- a/include/global.h +++ b/include/global.h @@ -14,8 +14,6 @@ #define GF_ASSERT(expr) do {if (!(expr)) ErrorHandling();} while (0) -#define UNUSED __attribute__((unused)) - #ifndef IN_MAIN_C extern const u8 gGameLanguage; extern const u8 gGameVersion; -- cgit v1.2.3