summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarijn van der Werf <marijn.vanderwerf@gmail.com>2017-05-08 22:23:56 +0200
committerYamaArashi <YamaArashi@users.noreply.github.com>2017-05-08 14:19:49 -0700
commit64412ee4c45a53712dd94410966ec68771b83fdd (patch)
treeee4b7196a647cebcf27eac8c7ea6b1cc93531c3a
parentbb1440fde21a36209bf61160172d922e21fbef12 (diff)
Decompile ShowLinkBattleRecords
-rw-r--r--asm/battle_records.s42
-rw-r--r--include/global.h6
-rw-r--r--ld_script.txt2
-rw-r--r--src/battle_records.c27
4 files changed, 34 insertions, 43 deletions
diff --git a/asm/battle_records.s b/asm/battle_records.s
index 60d7b9b2b..e10f2f4e5 100644
--- a/asm/battle_records.s
+++ b/asm/battle_records.s
@@ -635,47 +635,7 @@ _0811042E:
_08110438: .4byte gStringVar1
thumb_func_end PrintLinkBattleRecord
- thumb_func_start ShowLinkBattleRecords
-ShowLinkBattleRecords: @ 811043C
- push {r4,lr}
- movs r0, 0x1
- movs r1, 0
- movs r2, 0x1C
- movs r3, 0x12
- bl MenuDrawTextWindow
- ldr r0, _08110488 @ =gOtherText_BattleResults
- movs r1, 0
- movs r2, 0x1
- movs r3, 0xF0
- bl sub_8072BD8
- ldr r0, _0811048C @ =gSaveBlock1 + 0x30B8
- bl PrintLinkBattleWinsLossesDraws
- ldr r0, _08110490 @ =gOtherText_WinLoseDraw
- movs r1, 0xC
- movs r2, 0x6
- bl MenuPrint
- movs r4, 0
-_08110468:
- lsls r0, r4, 4
- ldr r1, _0811048C @ =gSaveBlock1 + 0x30B8
- adds r0, r1
- adds r4, 0x1
- lsls r1, r4, 25
- movs r2, 0xC0
- lsls r2, 19
- adds r1, r2
- lsrs r1, 24
- bl PrintLinkBattleRecord
- cmp r4, 0x4
- ble _08110468
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_08110488: .4byte gOtherText_BattleResults
-_0811048C: .4byte gSaveBlock1 + 0x30B8
-_08110490: .4byte gOtherText_WinLoseDraw
- thumb_func_end ShowLinkBattleRecords
+.section .text_8110494
thumb_func_start sub_8110494
sub_8110494: @ 8110494
diff --git a/include/global.h b/include/global.h
index 5de9f48d3..ce17d78a1 100644
--- a/include/global.h
+++ b/include/global.h
@@ -402,7 +402,9 @@ struct SaveBlock1 /* 0x02025734 */
/*0x303C*/ u8 filler_303C[0x38];
/*0x3074*/ u8 filler_3074[0x42];
/*0x30B6*/ u8 filler_30B6;
- /*0x30B7*/ u8 filler_30B7[0x59];
+ /*0x30B7*/ u8 filler_30B7[1];
+ /*0x30B8*/ u8 linkBattleRecords[5][16];
+ /*0x3108*/ u8 filler_3108[8];
/*0x3110*/ u8 giftRibbons[7];
/*0x3117*/ u8 filler_311B[0x2D];
/*0x3144*/ struct Roamer roamer;
@@ -495,7 +497,7 @@ struct UnkStruct_8054FF8
// wasnt defined so I had to define it
struct HallOfFame
{
- u8 filler[0x1F00];
+ u8 filler[0x1F00];
};
extern struct HallOfFame gHallOfFame;
diff --git a/ld_script.txt b/ld_script.txt
index f1d398cf0..f6a9ade48 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -222,6 +222,8 @@ SECTIONS {
src/field_specials.o(.text);
asm/field_specials.o(.text);
asm/battle_records.o(.text);
+ src/battle_records.o(.text);
+ asm/battle_records.o(.text_8110494);
asm/pokedex_area_screen.o(.text);
asm/evolution_scene.o(.text);
asm/roulette.o(.text);
diff --git a/src/battle_records.c b/src/battle_records.c
new file mode 100644
index 000000000..3290bbebe
--- /dev/null
+++ b/src/battle_records.c
@@ -0,0 +1,27 @@
+#include "global.h"
+#include "menu.h"
+
+extern const u8 gOtherText_BattleResults[];
+extern const u8 gOtherText_WinLoseDraw[];
+
+void PrintLinkBattleWinsLossesDraws(void *);
+
+void PrintLinkBattleRecord(void *, u8);
+
+void ShowLinkBattleRecords(void) {
+ s32 i;
+ MenuDrawTextWindow(1, 0, 28, 18);
+ sub_8072BD8((u8 *) gOtherText_BattleResults, 0, 1, 240);
+
+ PrintLinkBattleWinsLossesDraws(gSaveBlock1.linkBattleRecords);
+#if ENGLISH
+ MenuPrint(gOtherText_WinLoseDraw, 12, 6);
+#elif GERMAN
+ MenuPrint_PixelCoords((u8 *) gOtherText_WinLoseDraw, 88, 48, 1);
+#endif
+
+ for (i = 0; i < 5; i++)
+ {
+ PrintLinkBattleRecord(gSaveBlock1.linkBattleRecords[i], 6 + (i + 1) * 2);
+ }
+}