|
| 1 | +#include "d/d_debug_pad.h" |
| 2 | +#include "m_Do/m_Do_controller_pad.h" |
| 3 | +#include "JSystem/JUtility/JUTDbPrint.h" |
| 4 | +#include "JSystem/JUtility/JUTReport.h" |
| 5 | +#include "f_ap/f_ap_game.h" |
| 6 | + |
| 7 | +dDebugPad_c::dDebugPad_c() { |
| 8 | + mIsActive = false; |
| 9 | + mMode = MODE_CAMERA_e; |
| 10 | + mTrigger = false; |
| 11 | +} |
| 12 | + |
| 13 | +const char dDebugPad_c::mode_name[MODE_MAX_e][9] = { |
| 14 | + "CAMERA", |
| 15 | + "BsLight", |
| 16 | + "WindTest", |
| 17 | + "SDCARD", |
| 18 | +}; |
| 19 | + |
| 20 | +bool dDebugPad_c::Update() { |
| 21 | + mTrigger = false; |
| 22 | + |
| 23 | + if (mDoCPd_c::getTrigStart(PAD_3)) { |
| 24 | + mIsActive = mIsActive ? false : true; |
| 25 | + mTrigger = true; |
| 26 | + } |
| 27 | + |
| 28 | + if (mIsActive) { |
| 29 | + if (mDoCPd_c::getTrigZ(PAD_3)) { |
| 30 | + mMode = (mMode + 1) % MODE_MAX_e; |
| 31 | + } |
| 32 | + |
| 33 | + int x = 10; |
| 34 | + int y = 40; |
| 35 | + int line_height = 15; |
| 36 | + JUtility::TColor sp40(0xC8, 0x80, 0xFF, 0xC0); |
| 37 | + JUtility::TColor sp3C(0xFF, 0xC0, 0xC0, 0xFF); |
| 38 | + |
| 39 | + Report(x, y, sp40, "+-DEBUG-PAD-+"); |
| 40 | + |
| 41 | + int i; |
| 42 | + for (i = 0; i < MODE_MAX_e; i++) { |
| 43 | + y += line_height; |
| 44 | + |
| 45 | + if (i == mMode) { |
| 46 | + Report(x, y, sp40, "| |"); |
| 47 | + Report(x, y, sp3C, " @%-8s ", mode_name[i]); |
| 48 | + } else { |
| 49 | + Report(x, y, sp40, "| %-8s |", mode_name[i]); |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | + for (i = 0; i < 1; i++) { |
| 54 | + y += line_height; |
| 55 | + Report(x, y, sp40, "| |"); |
| 56 | + } |
| 57 | + |
| 58 | + y += line_height; |
| 59 | + Report(x, y, sp40, "+-----------+"); |
| 60 | + } |
| 61 | + |
| 62 | + return mIsActive; |
| 63 | +} |
| 64 | + |
| 65 | +bool dDebugPad_c::Report(int x, int y, JUtility::TColor color, const char* message, ...) { |
| 66 | + char buffer[256]; |
| 67 | + |
| 68 | + static JUtility::TColor ShadowDarkColor(0, 0, 0, 0x80); |
| 69 | + |
| 70 | + if (mIsActive) { |
| 71 | + va_list list; |
| 72 | + va_start(list, message); |
| 73 | + vsnprintf(buffer, sizeof(buffer), message, list); |
| 74 | + va_end(list); |
| 75 | + |
| 76 | + JUTDbPrint::getManager()->flush(); |
| 77 | + JUTDbPrint::getManager()->setCharColor(ShadowDarkColor); |
| 78 | + JUTReport(x + 2, y + 2, buffer); |
| 79 | + JUTDbPrint::getManager()->flush(); |
| 80 | + JUTDbPrint::getManager()->setCharColor(color); |
| 81 | + JUTReport(x, y, buffer); |
| 82 | + JUTDbPrint::getManager()->flush(); |
| 83 | + JUTDbPrint::getManager()->setCharColor(g_HIO.mColor); |
| 84 | + return true; |
| 85 | + } |
| 86 | + |
| 87 | + return false; |
| 88 | +} |
| 89 | + |
| 90 | +dDebugPad_c dDebugPad; |
0 commit comments