diff options
-rw-r--r-- | asm/trainer_tower.s | 66 | ||||
-rw-r--r-- | include/cereader_tool.h | 2 | ||||
-rw-r--r-- | ld_script.txt | 1 | ||||
-rw-r--r-- | src/trainer_tower.c | 33 |
4 files changed, 35 insertions, 67 deletions
diff --git a/asm/trainer_tower.s b/asm/trainer_tower.s index 5b65927d5..d5cf80b9f 100644 --- a/asm/trainer_tower.s +++ b/asm/trainer_tower.s @@ -5,72 +5,6 @@ .text - thumb_func_start sub_815D7BC -sub_815D7BC: @ 815D7BC - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - movs r0, 0x1E - bl TryCopySpecialSaveSection - cmp r0, 0x1 - bne _0815D804 - ldr r2, _0815D800 @ =0x00000f88 - adds r0, r5, 0 - adds r1, r4, 0 - bl memcpy - movs r0, 0x1F - adds r1, r4, 0 - bl TryCopySpecialSaveSection - cmp r0, 0x1 - bne _0815D804 - ldr r1, _0815D800 @ =0x00000f88 - adds r0, r5, r1 - movs r2, 0xF8 - lsls r2, 4 - adds r1, r4, 0 - bl memcpy - adds r0, r5, 0 - bl sub_815D6B4 - cmp r0, 0 - beq _0815D804 - movs r0, 0x1 - b _0815D806 - .align 2, 0 -_0815D800: .4byte 0x00000f88 -_0815D804: - movs r0, 0 -_0815D806: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_815D7BC - - thumb_func_start sub_815D80C -sub_815D80C: @ 815D80C - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x80 - lsls r0, 5 - bl AllocZeroed - adds r5, r0, 0 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_815D7BC - adds r4, r0, 0 - adds r0, r5, 0 - bl Free - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_815D80C - - thumb_func_start sub_815D834 -sub_815D834: @ 815D834 - movs r0, 0 - bx lr - thumb_func_end sub_815D834 - thumb_func_start sub_815D838 sub_815D838: @ 815D838 push {r4-r7,lr} diff --git a/include/cereader_tool.h b/include/cereader_tool.h index 28ef526eb..05677dc79 100644 --- a/include/cereader_tool.h +++ b/include/cereader_tool.h @@ -4,6 +4,6 @@ #include "global.h" bool32 sub_815D794(u8 *); -u8 sub_815D6B4(u8 *); +bool32 sub_815D6B4(u8 *); #endif //GUARD_CEREADER_TOOL_H diff --git a/ld_script.txt b/ld_script.txt index d37858b3f..f2f835c83 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -266,6 +266,7 @@ SECTIONS { asm/unk_815C980.o(.text); asm/ss_anne.o(.text); asm/cereader_tool.o(.text); + src/trainer_tower.o(.text); asm/trainer_tower.o(.text); asm/unk_815EDDC.o(.text); asm/unk_815F138.o(.text); diff --git a/src/trainer_tower.c b/src/trainer_tower.c new file mode 100644 index 000000000..9d6ea8a3b --- /dev/null +++ b/src/trainer_tower.c @@ -0,0 +1,33 @@ +#include "global.h" +#include "malloc.h" +#include "save.h" +#include "cereader_tool.h" + +bool32 sub_815D7BC(void * dest, void * buffer) +{ + if (TryCopySpecialSaveSection(30, buffer) != 1) + return FALSE; + memcpy(dest + 0x000, buffer, 0xF88); + + if (TryCopySpecialSaveSection(31, buffer) != 1) + return FALSE; + memcpy(dest + 0xF88, buffer, 0xF80); + + if (!sub_815D6B4(dest)) + return FALSE; + return TRUE; +} + +bool32 sub_815D80C(void * dest) +{ + void * buffer = AllocZeroed(0x1000); + bool32 success = sub_815D7BC(dest, buffer); + Free(buffer); + return success; +} + +bool32 sub_815D834(void) +{ + // Stubbed out? + return FALSE; +} |