summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/unk_debug_menu_3.s25
-rw-r--r--data/debug_menu_3.s1
-rw-r--r--include/mystery_event_script.h4
-rw-r--r--include/util.h2
-rw-r--r--ld_script.txt2
-rw-r--r--src/debug/unk_debug_menu_3.c10
-rw-r--r--src/mystery_event_script.c6
-rw-r--r--src/util.c2
8 files changed, 23 insertions, 29 deletions
diff --git a/asm/unk_debug_menu_3.s b/asm/unk_debug_menu_3.s
index aa156a99b..968c53b11 100644
--- a/asm/unk_debug_menu_3.s
+++ b/asm/unk_debug_menu_3.s
@@ -5,31 +5,6 @@
.text
- thumb_func_start debug_sub_813C404
-debug_sub_813C404:
- push {r4, r5, r6, lr}
- add r6, r0, #0
- ldr r5, ._1 @ gUnknown_Debug_845DDB2
- ldr r4, ._1 + 4 @ gUnknown_Debug_845DAE1
- sub r5, r5, r4
- add r1, r4, #0
- add r2, r5, #0
- bl memcpy
- add r0, r6, #0
- add r1, r4, #0
- bl unref_sub_812620C
- add r0, r5, #0
- pop {r4, r5, r6}
- pop {r1}
- bx r1
-._2:
- .align 2, 0
-._1:
- .word gUnknown_Debug_845DDB2
- .word gUnknown_Debug_845DAE1
-
- thumb_func_end debug_sub_813C404
-
thumb_func_start debug_sub_813C430
debug_sub_813C430:
push {r4, r5, r6, lr}
diff --git a/data/debug_menu_3.s b/data/debug_menu_3.s
index 65c4e4514..3652b1dc6 100644
--- a/data/debug_menu_3.s
+++ b/data/debug_menu_3.s
@@ -118,6 +118,7 @@ _0845DD95:
.string "Deine BASIS-TASCHE ist voll.$"
_0845DAFFEnd:
.size _0845DAFF, _0845DAFFEnd - _0845DAFF
+gUnknown_Debug_845DAE1End::
gUnknown_Debug_845DDB2::
me_checkcompat gUnknown_Debug_845DDB2, 4, 4, 4, 0x80
diff --git a/include/mystery_event_script.h b/include/mystery_event_script.h
index ab23a8d00..a92bb6667 100644
--- a/include/mystery_event_script.h
+++ b/include/mystery_event_script.h
@@ -4,5 +4,9 @@
u32 RunMysteryEventScript(u8 *);
void SetMysteryEventScriptStatus(u32 val);
u16 GetRecordMixingGift(void);
+#if DEBUG
+bool8 unref_sub_812620C(u8 *a1, const u8 * _a2);
+bool8 unref_sub_81261B4(u8 *a1, const u8 * _a2);
+#endif // DEBUG
#endif // GUARD_MYSTERY_EVENT_SCRIPT_H
diff --git a/include/util.h b/include/util.h
index 676c3bd9b..02c503f75 100644
--- a/include/util.h
+++ b/include/util.h
@@ -9,7 +9,7 @@ extern const u32 gBitTable[];
u8 CreateInvisibleSpriteWithCallback(void (*)(struct Sprite *));
void StoreWordInTwoHalfwords(u16 *, u32);
void LoadWordFromTwoHalfwords(u16 *, u32 *);
-u16 CalcCRC16(u8 *data, int length);
+u16 CalcCRC16(const u8 *data, int length);
void DoBgAffineSet(struct BgAffineDstData *dest, u32 texX, u32 texY, s16 scrX, s16 scrY, s16 sx, s16 sy, u16 alpha);
void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output);
diff --git a/ld_script.txt b/ld_script.txt
index 74cca392b..2cfd8bf6f 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -363,6 +363,7 @@ SECTIONS {
src/unused_8124F94.o(.text);
src/save.o(.text);
src/mystery_event_script.o(.text);
+ src/debug/unk_debug_menu_3.o(.text);
asm/unk_debug_menu_3.o(.text);
src/field_effect_helpers.o(.text);
src/contest_ai.o(.text);
@@ -648,6 +649,7 @@ SECTIONS {
src/choose_party.o(.rodata);
src/cable_car.o(.rodata);
src/save.o(.rodata);
+ src/debug/unk_debug_menu_3.o(.rodata);
data/unk_debug_menu_3.o(.rodata);
src/field_effect_helpers.o(.rodata);
src/contest_ai.o(.rodata);
diff --git a/src/debug/unk_debug_menu_3.c b/src/debug/unk_debug_menu_3.c
index 5f2ede62a..8603cb1e7 100644
--- a/src/debug/unk_debug_menu_3.c
+++ b/src/debug/unk_debug_menu_3.c
@@ -2,7 +2,17 @@
#include "global.h"
#include "debug.h"
+#include "mystery_event_script.h"
+extern const u8 gUnknown_Debug_845DAE1[];
+extern const u8 gUnknown_Debug_845DAE1End[];
+size_t debug_sub_813C404(void * dest)
+{
+ size_t size = gUnknown_Debug_845DAE1End - gUnknown_Debug_845DAE1;
+ memcpy(dest, gUnknown_Debug_845DAE1, size);
+ unref_sub_812620C(dest, gUnknown_Debug_845DAE1);
+ return size;
+}
#endif // DEBUG
diff --git a/src/mystery_event_script.c b/src/mystery_event_script.c
index 6fcad66ac..83aa90102 100644
--- a/src/mystery_event_script.c
+++ b/src/mystery_event_script.c
@@ -114,8 +114,9 @@ static void SetWord(u8 *ptr, u32 val)
ptr[3] = val >> 24;
}
-bool8 unref_sub_81261B4(u8 *a1, int a2)
+bool8 unref_sub_81261B4(u8 *a1, const u8 * _a2)
{
+ int a2 = (int)_a2;
if (a1[0x0] == 1 && a1[0x11] == 15 && !GetWord(a1 + 0x12))
{
int v4 = GetWord(a1 + 0x16) - a2 + (int)a1;
@@ -128,8 +129,9 @@ bool8 unref_sub_81261B4(u8 *a1, int a2)
return FALSE;
}
-bool8 unref_sub_812620C(u8 *a1, int a2)
+bool8 unref_sub_812620C(u8 *a1, const u8 * _a2)
{
+ int a2 = (int)_a2;
if (a1[0x0] == 1 && a1[0x11] == 16 && !GetWord(a1 + 0x12))
{
int v4 = GetWord(a1 + 0x16) - a2 + (int)a1;
diff --git a/src/util.c b/src/util.c
index 582b9f806..e14665a03 100644
--- a/src/util.c
+++ b/src/util.c
@@ -490,7 +490,7 @@ int CountTrailingZeroBits(u32 value)
return 0;
}
-u16 CalcCRC16(u8 *data, int length)
+u16 CalcCRC16(const u8 *data, int length)
{
u16 i, j;
u16 crc = 0x1121;