summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2017-05-18 13:38:20 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2017-05-18 13:38:20 -0400
commitb97e078c6e84cf6cf5fe7539e4dcc2d24de494c8 (patch)
tree4a2f4f4c4a4677de93da22392729c5332499d3dc
parent095d071cab1950f404f7fb5b6c0ff04ccc6c37f2 (diff)
sub_80BFD44
-rw-r--r--asm/tv.s110
-rw-r--r--include/asm.inc.h2
-rw-r--r--src/record_mixing.c2
-rw-r--r--src/tv.c43
4 files changed, 45 insertions, 112 deletions
diff --git a/asm/tv.s b/asm/tv.s
index 0537eac33..c77e0b0dc 100644
--- a/asm/tv.s
+++ b/asm/tv.s
@@ -2909,116 +2909,6 @@ _080BF4F0: .4byte gSaveBlock1 + 0x2738
.section .text_80BF544
- thumb_func_start sub_80BFD44
-sub_80BFD44: @ 80BFD44
- push {r4-r7,lr}
- mov r7, r8
- push {r7}
- mov r8, r0
- adds r7, r1, 0
- lsls r2, 24
- lsrs r6, r2, 24
- movs r4, 0
-_080BFD54:
- lsls r0, r4, 3
- subs r0, r4
- lsls r0, 5
- adds r0, r4
- lsls r0, 2
- ldr r5, _080BFD8C @ =0x02007000
- adds r0, r5
- adds r1, r4, 0
- muls r1, r7
- add r1, r8
- movs r2, 0xE1
- lsls r2, 2
- bl memcpy
- adds r0, r4, 0x1
- lsls r0, 24
- lsrs r4, r0, 24
- cmp r4, 0x3
- bls _080BFD54
- adds r4, r5, 0
- cmp r6, 0x1
- beq _080BFDBC
- cmp r6, 0x1
- bgt _080BFD90
- cmp r6, 0
- beq _080BFD9A
- b _080BFDFC
- .align 2, 0
-_080BFD8C: .4byte 0x02007000
-_080BFD90:
- cmp r6, 0x2
- beq _080BFDCC
- cmp r6, 0x3
- beq _080BFDE8
- b _080BFDFC
-_080BFD9A:
- ldr r0, _080BFDB4 @ =gSaveBlock1 + 0x2738
- movs r2, 0xE1
- lsls r2, 2
- adds r1, r4, r2
- movs r3, 0xE1
- lsls r3, 3
- adds r2, r4, r3
- ldr r5, _080BFDB8 @ =0x00000a8c
- adds r3, r4, r5
- bl sub_80BFE24
- b _080BFDFC
- .align 2, 0
-_080BFDB4: .4byte gSaveBlock1 + 0x2738
-_080BFDB8: .4byte 0x00000a8c
-_080BFDBC:
- ldr r1, _080BFDC8 @ =gSaveBlock1 + 0x2738
- movs r0, 0xE1
- lsls r0, 3
- adds r2, r4, r0
- b _080BFDD4
- .align 2, 0
-_080BFDC8: .4byte gSaveBlock1 + 0x2738
-_080BFDCC:
- movs r0, 0xE1
- lsls r0, 2
- adds r1, r4, r0
- ldr r2, _080BFDE0 @ =gSaveBlock1 + 0x2738
-_080BFDD4:
- ldr r5, _080BFDE4 @ =0x00000a8c
- adds r3, r4, r5
- adds r0, r4, 0
- bl sub_80BFE24
- b _080BFDFC
- .align 2, 0
-_080BFDE0: .4byte gSaveBlock1 + 0x2738
-_080BFDE4: .4byte 0x00000a8c
-_080BFDE8:
- movs r0, 0xE1
- lsls r0, 2
- adds r1, r5, r0
- movs r3, 0xE1
- lsls r3, 3
- adds r2, r5, r3
- ldr r3, _080BFE20 @ =gSaveBlock1 + 0x2738
- adds r0, r5, 0
- bl sub_80BFE24
-_080BFDFC:
- ldr r4, _080BFE20 @ =gSaveBlock1 + 0x2738
- adds r0, r4, 0
- bl sub_80BF588
- bl sub_80C04A0
- adds r0, r4, 0
- bl sub_80BF588
- bl sub_80C01D4
- bl sub_80C0408
- pop {r3}
- mov r8, r3
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_080BFE20: .4byte gSaveBlock1 + 0x2738
- thumb_func_end sub_80BFD44
-
thumb_func_start sub_80BFE24
sub_80BFE24: @ 80BFE24
push {r4-r7,lr}
diff --git a/include/asm.inc.h b/include/asm.inc.h
index e13b4668a..3931f7f1c 100644
--- a/include/asm.inc.h
+++ b/include/asm.inc.h
@@ -293,7 +293,7 @@ void sub_80BF478(void);
u16 sub_80BF674(u16 species);
s8 sub_80BF720(TVShow *);
bool8 sub_80BF77C(u16);
-void sub_80BFD44(void *, u32, u8);
+void sub_80BFD44(u8 *, u32, u8);
void sub_80C0514(void *, u32, u8);
// src/tv.o
diff --git a/src/record_mixing.c b/src/record_mixing.c
index 76fe13059..ddf9a5376 100644
--- a/src/record_mixing.c
+++ b/src/record_mixing.c
@@ -185,7 +185,7 @@ _080B93AC: .4byte 0x000011c8\n\
void sub_80B93B0(u32 a)
{
sub_80BD674(unk_2008000.secretBases, sizeof(struct PlayerRecords), a);
- sub_80BFD44(unk_2008000.tvShows, sizeof(struct PlayerRecords), a);
+ sub_80BFD44((u8 *)unk_2008000.tvShows, sizeof(struct PlayerRecords), a);
sub_80C0514(unk_2008000.filler1004, sizeof(struct PlayerRecords), a);
sub_80B9B1C(unk_2008000.filler1044, sizeof(struct PlayerRecords), a);
//UB: Too many arguments for function "sub_80FA4E4"
diff --git a/src/tv.c b/src/tv.c
index a5a4690a2..665949feb 100644
--- a/src/tv.c
+++ b/src/tv.c
@@ -910,6 +910,49 @@ void sub_80BFD20(void)
RemoveFieldObjectByLocalIdAndMap(5, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup);
}
+extern u8 ewram[];
+#define gUnknown_02007000 (*(struct ewramStruct_0207000 *)(ewram + 0x7000))
+
+struct ewramStruct_0207000 {
+ struct SaveTVStruct tvshows[4];
+};
+
+void sub_80BFE24(struct SaveTVStruct *arg0, struct SaveTVStruct *arg1, struct SaveTVStruct *arg2, struct SaveTVStruct *arg3);
+
+void sub_80C04A0(void);
+void sub_80C01D4(void);
+void sub_80C0408(void);
+
+void sub_80BFD44(u8 *arg0, u32 arg1, u8 arg2)
+{
+ u8 i;
+ struct ewramStruct_0207000 *ewramTVShows;
+ for (i=0; i<4; i++) {
+ memcpy(&gUnknown_02007000.tvshows[i], &arg0[i * arg1], sizeof(struct SaveTVStruct));
+ }
+ ewramTVShows = &gUnknown_02007000;
+ switch (arg2) {
+ case 0:
+ sub_80BFE24(&gSaveBlock1.tvShows, &ewramTVShows->tvshows[1], &ewramTVShows->tvshows[2], &ewramTVShows->tvshows[3]);
+ break;
+ case 1:
+ sub_80BFE24(&ewramTVShows->tvshows[0], &gSaveBlock1.tvShows, &ewramTVShows->tvshows[2], &ewramTVShows->tvshows[3]);
+ break;
+ case 2:
+ sub_80BFE24(&ewramTVShows->tvshows[0], &ewramTVShows->tvshows[1], &gSaveBlock1.tvShows, &ewramTVShows->tvshows[3]);
+ break;
+ case 3:
+ sub_80BFE24(&ewramTVShows->tvshows[0], &ewramTVShows->tvshows[1], &ewramTVShows->tvshows[2], &gSaveBlock1.tvShows);
+ break;
+ }
+ sub_80BF588(gSaveBlock1.tvShows.shows);
+ sub_80C04A0();
+ sub_80BF588(gSaveBlock1.tvShows.shows);
+ sub_80C01D4();
+ sub_80C0408();
+}
+
+
asm(".section .text_c");
void DoTVShowPokemonNewsMassOutbreak(void)