summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscnorton <scnorton@biociphers.org>2017-09-03 13:02:20 -0400
committerscnorton <scnorton@biociphers.org>2017-09-03 13:02:20 -0400
commit92f40d920b26a13dfc7a3756382cdf97aff08288 (patch)
tree2fca361a090e0008c534154d8b843968e03f024c
parent7b5d41909bcf86103fe51eea0c1a8370ca4c478e (diff)
sub_804E22C
-rw-r--r--asm/trade.s45
-rw-r--r--include/graphics.h3
-rw-r--r--include/trade.h1
-rw-r--r--ld_script.txt1
-rw-r--r--src/trade.c14
5 files changed, 18 insertions, 46 deletions
diff --git a/asm/trade.s b/asm/trade.s
index e604ee56b..84c50d9a2 100644
--- a/asm/trade.s
+++ b/asm/trade.s
@@ -5393,49 +5393,4 @@ _0804DAC0:
_0804DAD0: .4byte gEnemyParty
thumb_func_end sub_804D948
-.section .text.sub_804DB2C
-
- thumb_func_start sub_804E22C
-sub_804E22C: @ 804E22C
- push {r4,lr}
- ldr r0, _0804E26C @ =gUnknown_08D00000
- movs r1, 0xC0
- lsls r1, 19
- bl LZDecompressVram
- ldr r0, _0804E270 @ =gUnknown_08D00524
- ldr r4, _0804E274 @ =0x02000000
- movs r2, 0x80
- lsls r2, 4
- adds r1, r4, 0
- bl CpuSet
- ldr r1, _0804E278 @ =0x06002800
- ldr r0, _0804E27C @ =0x040000d4
- str r4, [r0]
- str r1, [r0, 0x4]
- ldr r1, _0804E280 @ =0x80000280
- str r1, [r0, 0x8]
- ldr r0, [r0, 0x8]
- ldr r0, _0804E284 @ =gUnknown_08D004E0
- movs r1, 0
- movs r2, 0x20
- bl LoadCompressedPalette
- ldr r1, _0804E288 @ =REG_BG1CNT
- ldr r2, _0804E28C @ =0x00000502
- adds r0, r2, 0
- strh r0, [r1]
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_0804E26C: .4byte gUnknown_08D00000
-_0804E270: .4byte gUnknown_08D00524
-_0804E274: .4byte 0x02000000
-_0804E278: .4byte 0x06002800
-_0804E27C: .4byte 0x040000d4
-_0804E280: .4byte 0x80000280
-_0804E284: .4byte gUnknown_08D004E0
-_0804E288: .4byte REG_BG1CNT
-_0804E28C: .4byte 0x00000502
- thumb_func_end sub_804E22C
-
.align 2, 0 @ Don't pad with nop.
diff --git a/include/graphics.h b/include/graphics.h
index b196cfe1c..f3a722b40 100644
--- a/include/graphics.h
+++ b/include/graphics.h
@@ -2570,4 +2570,7 @@ extern const u16 gUnknown_08EA02C8[];
extern const u16 gUnknown_08EA0348[];
extern const u16 gUnknown_08EA15C8[];
extern const u16 gTradeMonBoxTilemap[];
+extern const u8 gUnknown_08D00000[];
+extern const u16 gUnknown_08D00524[];
+extern const u8 gUnknown_08D004E0[];
#endif // GUARD_GRAPHICS_H
diff --git a/include/trade.h b/include/trade.h
index 36561e413..5fa13ad03 100644
--- a/include/trade.h
+++ b/include/trade.h
@@ -9,5 +9,6 @@ void sub_8047CD8(void);
u16 sub_804DB2C(void);
void sub_804DB68(void);
void sub_804E174(void);
+void sub_804E22C(void);
#endif //POKERUBY_TRADE_H
diff --git a/ld_script.txt b/ld_script.txt
index ce4090847..6ecf65843 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -81,7 +81,6 @@ SECTIONS {
src/trade.o(.text);
asm/trade.o(.text);
src/trade.o(.text.sub_804DAD4);
- asm/trade.o(.text.sub_804DB2C);
src/berry_blender.o(.text);
src/play_time.o(.text);
src/new_game.o(.text);
diff --git a/src/trade.c b/src/trade.c
index 72f198511..db49b94e6 100644
--- a/src/trade.c
+++ b/src/trade.c
@@ -30,6 +30,7 @@
#include "save.h"
#include "script.h"
#include "field_fadetransition.h"
+#include "decompress.h"
#include "trade.h"
#ifdef ENGLISH
@@ -3407,3 +3408,16 @@ static void sub_804E1A0(u8 taskId)
if (numRibbons != 0)
FlagSet(SYS_RIBBON_GET);
}
+
+void sub_804E22C(void)
+{
+ const u16 *src;
+ u16 *dest;
+ LZDecompressVram(gUnknown_08D00000, (u8 *)VRAM);
+ CpuCopy16(gUnknown_08D00524, ewram, 0x1000);
+ src = (const u16 *)ewram;
+ dest = (u16 *)(BG_SCREEN_ADDR(5));
+ DmaCopy16(3, src, dest, 0x500)
+ LoadCompressedPalette(gUnknown_08D004E0, 0, 32);
+ REG_BG1CNT = BGCNT_PRIORITY(2) | BGCNT_SCREENBASE(5);
+}