summaryrefslogtreecommitdiff
path: root/src/d/d_debug_pad.cpp
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2026-01-24 23:36:23 -0800
committerGitHub <noreply@github.com>2026-01-24 23:36:23 -0800
commit5867eaf68b97bfe359849aafe93af5f73313c782 (patch)
tree09765780deff6345c89b4447a3b53b8cd9649f86 /src/d/d_debug_pad.cpp
parente01dbc3297f000dd440410d999c4f4f32d2e25d0 (diff)
general cleanup, d_menu_quit / d_a_obj_testcube mostly done, d_msg_scrn_explain debug (#3065)
* typedef for cPhs_Step * make sdk includes consistent * d_menu_quit / d_msg_scrn_explain debug * d_a_obj_testcube mostly done * d_debug_pad mostly done * jstudio tool library headers * some JStudioCameraEditor headers * d_jcam_editor mostly done * try fixing some shield regressions * d_bg_parts mostly done * fix merge errors * debug fix
Diffstat (limited to 'src/d/d_debug_pad.cpp')
-rw-r--r--src/d/d_debug_pad.cpp90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/d/d_debug_pad.cpp b/src/d/d_debug_pad.cpp
new file mode 100644
index 0000000000..23a31edcd3
--- /dev/null
+++ b/src/d/d_debug_pad.cpp
@@ -0,0 +1,90 @@
+#include "d/d_debug_pad.h"
+#include "m_Do/m_Do_controller_pad.h"
+#include "JSystem/JUtility/JUTDbPrint.h"
+#include "JSystem/JUtility/JUTReport.h"
+#include "f_ap/f_ap_game.h"
+
+dDebugPad_c::dDebugPad_c() {
+ mIsActive = false;
+ mMode = MODE_CAMERA_e;
+ mTrigger = false;
+}
+
+const char dDebugPad_c::mode_name[MODE_MAX_e][9] = {
+ "CAMERA",
+ "BsLight",
+ "WindTest",
+ "SDCARD",
+};
+
+bool dDebugPad_c::Update() {
+ mTrigger = false;
+
+ if (mDoCPd_c::getTrigStart(PAD_3)) {
+ mIsActive = mIsActive ? false : true;
+ mTrigger = true;
+ }
+
+ if (mIsActive) {
+ if (mDoCPd_c::getTrigZ(PAD_3)) {
+ mMode = (mMode + 1) % MODE_MAX_e;
+ }
+
+ int x = 10;
+ int y = 40;
+ int line_height = 15;
+ JUtility::TColor sp40(0xC8, 0x80, 0xFF, 0xC0);
+ JUtility::TColor sp3C(0xFF, 0xC0, 0xC0, 0xFF);
+
+ Report(x, y, sp40, "+-DEBUG-PAD-+");
+
+ int i;
+ for (i = 0; i < MODE_MAX_e; i++) {
+ y += line_height;
+
+ if (i == mMode) {
+ Report(x, y, sp40, "| |");
+ Report(x, y, sp3C, " @%-8s ", mode_name[i]);
+ } else {
+ Report(x, y, sp40, "| %-8s |", mode_name[i]);
+ }
+ }
+
+ for (i = 0; i < 1; i++) {
+ y += line_height;
+ Report(x, y, sp40, "| |");
+ }
+
+ y += line_height;
+ Report(x, y, sp40, "+-----------+");
+ }
+
+ return mIsActive;
+}
+
+bool dDebugPad_c::Report(int x, int y, JUtility::TColor color, const char* message, ...) {
+ char buffer[256];
+
+ static JUtility::TColor ShadowDarkColor(0, 0, 0, 0x80);
+
+ if (mIsActive) {
+ va_list list;
+ va_start(list, message);
+ vsnprintf(buffer, sizeof(buffer), message, list);
+ va_end(list);
+
+ JUTDbPrint::getManager()->flush();
+ JUTDbPrint::getManager()->setCharColor(ShadowDarkColor);
+ JUTReport(x + 2, y + 2, buffer);
+ JUTDbPrint::getManager()->flush();
+ JUTDbPrint::getManager()->setCharColor(color);
+ JUTReport(x, y, buffer);
+ JUTDbPrint::getManager()->flush();
+ JUTDbPrint::getManager()->setCharColor(g_HIO.mColor);
+ return true;
+ }
+
+ return false;
+}
+
+dDebugPad_c dDebugPad;