summaryrefslogtreecommitdiff
path: root/src/debug.c
diff options
context:
space:
mode:
authortheo3 <arisstephenson2@gmail.com>2022-01-05 20:41:34 -0800
committertheo3 <arisstephenson2@gmail.com>2022-01-05 20:49:51 -0800
commitbde85fd004f20b594e2fb00fa1e2c870d73e9dda (patch)
tree616b8c21d5c61ee2a22193f7d8ed8c0d8f2cb5a8 /src/debug.c
parentc7ee010e47fca132fa829a6cbf53ec4193f38f0b (diff)
doxygen groups
Diffstat (limited to 'src/debug.c')
-rw-r--r--src/debug.c103
1 files changed, 103 insertions, 0 deletions
diff --git a/src/debug.c b/src/debug.c
new file mode 100644
index 00000000..19b3ae04
--- /dev/null
+++ b/src/debug.c
@@ -0,0 +1,103 @@
+/**
+ * @file debug.c
+ * @ingroup Tasks
+ *
+ * @brief Debug task
+ */
+
+#include "global.h"
+#include "sound.h"
+#include "common.h"
+#include "functions.h"
+#include "main.h"
+#include "menu.h"
+#include "screen.h"
+#include "message.h"
+#include "game.h"
+
+extern void (*const gUnk_08109A30[])(void);
+
+void DebugTask(void) {
+ gUnk_08109A30[gMain.state]();
+}
+
+void sub_0805FA04(void) {
+ DispReset(1);
+ MemClear(&gBG0Buffer, sizeof(gBG0Buffer));
+ MemClear(&gBG3Buffer, sizeof(gBG3Buffer));
+ gScreen.lcd.displayControl = DISPCNT_BG0_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_1D_MAP;
+ gScreen.bg0.xOffset = 0;
+ gScreen.bg0.yOffset = 0;
+ gScreen.bg3.xOffset = 0;
+ gScreen.bg3.yOffset = 0;
+ gScreen.bg3.control = BGCNT_SCREENBASE(30) | BGCNT_PRIORITY(3) | BGCNT_CHARBASE(3);
+ gScreen.bg3.updated = 1;
+ MessageInitialize();
+ MemClear((void*)&gUnk_02032EC0, sizeof(UI));
+ MemClear((void*)&gMenu, sizeof(Menu));
+ gMenu.unk16 = gSaveHeader->language;
+ LoadGfxGroups();
+ SetColor(0, 0x1144);
+ gMain.state = 1;
+ InitSoundPlayingInfo();
+ ResetFadeMask();
+}
+
+void sub_0805FA98(void) {
+ int iVar1;
+
+ switch (gInput.newKeys) {
+ case DPAD_UP:
+ gMenu.focusCoords[1] -= 1;
+ break;
+ case DPAD_DOWN:
+ gMenu.focusCoords[1] += 1;
+ break;
+ case L_BUTTON:
+ gMenu.focusCoords[0] ^= 1;
+ if (gMenu.focusCoords[0] == 0) {
+ gScreen.bg0.control = BGCNT_SCREENBASE(31) | BGCNT_CHARBASE(3);
+ gScreen.bg3.control = BGCNT_SCREENBASE(30) | BGCNT_CHARBASE(3) | BGCNT_PRIORITY(3);
+ } else {
+ gScreen.bg0.control = BGCNT_SCREENBASE(31) | BGCNT_CHARBASE(3) | BGCNT_PRIORITY(3);
+ gScreen.bg3.control = BGCNT_SCREENBASE(30) | BGCNT_CHARBASE(3);
+ }
+ break;
+ case R_BUTTON:
+ gSaveHeader->language = gMenu.unk16;
+ MessageFromTarget(gMenu.unk14 * 0x100 + gMenu.unk15);
+ break;
+ case B_BUTTON:
+ MessageInitialize();
+ break;
+ default:
+ switch (gInput.unk4) {
+ case DPAD_LEFT:
+ iVar1 = -1;
+ break;
+ case DPAD_RIGHT:
+ iVar1 = 1;
+ break;
+ default:
+ iVar1 = 0;
+ break;
+ }
+ switch (gMenu.focusCoords[1]) {
+ case 0:
+ gMenu.unk14 = (gMenu.unk14 + iVar1 + 0x50) % 0x50;
+ break;
+ case 1:
+ gMenu.unk15 += iVar1;
+ break;
+ case 2:
+ gMenu.unk16 = (gMenu.unk16 + iVar1 + 7) % 7;
+ break;
+ }
+ }
+ gMenu.focusCoords[1] = (gMenu.focusCoords[1] + 3) % 3;
+ gScreen.bg3.updated = 1;
+}
+
+void sub_0805FBC4(void) {
+ SetTask(TASK_TITLE);
+}