mirror of
https://github.com/zeldaret/tww.git
synced 2026-09-05 10:27:35 -04:00
Remove fake CButton enum, use SDK button defines instead
This commit is contained in:
@@ -10,23 +10,6 @@ typedef void (*callbackFn)(int, void*);
|
||||
|
||||
extern u32 channel_mask[4];
|
||||
|
||||
namespace CButton {
|
||||
enum {
|
||||
/* 0x0001 */ DPAD_LEFT = 0x0001,
|
||||
/* 0x0002 */ DPAD_RIGHT = 0x0002,
|
||||
/* 0x0004 */ DPAD_DOWN = 0x0004,
|
||||
/* 0x0008 */ DPAD_UP = 0x0008,
|
||||
/* 0x0010 */ Z = 0x0010,
|
||||
/* 0x0020 */ R = 0x0020,
|
||||
/* 0x0040 */ L = 0x0040,
|
||||
/* 0x0100 */ A = 0x0100,
|
||||
/* 0x0200 */ B = 0x0200,
|
||||
/* 0x0400 */ X = 0x0400,
|
||||
/* 0x0800 */ Y = 0x0800,
|
||||
/* 0x1000 */ START = 0x1000,
|
||||
};
|
||||
}
|
||||
|
||||
struct JUTGamePadRecordBase {
|
||||
virtual void unk0() {}
|
||||
virtual void unk1(PADStatus* pad) {}
|
||||
|
||||
@@ -18,31 +18,31 @@ interface_of_controller_pad g_mDoCPd_cpadInfo[4];
|
||||
|
||||
/* 80007598-800078C0 .text mDoCPd_Convert__FP27interface_of_controller_padP10JUTGamePad */
|
||||
static s32 mDoCPd_Convert(interface_of_controller_pad* pInterface, JUTGamePad* pPad) {
|
||||
pInterface->mButtonHold.up = pPad->mButton.mButton & CButton::DPAD_UP;
|
||||
pInterface->mButtonHold.down = pPad->mButton.mButton & CButton::DPAD_DOWN;
|
||||
pInterface->mButtonHold.left = pPad->mButton.mButton & CButton::DPAD_LEFT;
|
||||
pInterface->mButtonHold.right = pPad->mButton.mButton & CButton::DPAD_RIGHT;
|
||||
pInterface->mButtonHold.z = pPad->mButton.mButton & CButton::Z;
|
||||
pInterface->mButtonHold.r = pPad->mButton.mButton & CButton::R;
|
||||
pInterface->mButtonHold.l = pPad->mButton.mButton & CButton::L;
|
||||
pInterface->mButtonHold.a = pPad->mButton.mButton & CButton::A;
|
||||
pInterface->mButtonHold.b = pPad->mButton.mButton & CButton::B;
|
||||
pInterface->mButtonHold.x = pPad->mButton.mButton & CButton::X;
|
||||
pInterface->mButtonHold.y = pPad->mButton.mButton & CButton::Y;
|
||||
pInterface->mButtonHold.start = pPad->mButton.mButton & CButton::START;
|
||||
pInterface->mButtonHold.up = pPad->mButton.mButton & PAD_BUTTON_UP;
|
||||
pInterface->mButtonHold.down = pPad->mButton.mButton & PAD_BUTTON_DOWN;
|
||||
pInterface->mButtonHold.left = pPad->mButton.mButton & PAD_BUTTON_LEFT;
|
||||
pInterface->mButtonHold.right = pPad->mButton.mButton & PAD_BUTTON_RIGHT;
|
||||
pInterface->mButtonHold.z = pPad->mButton.mButton & PAD_TRIGGER_Z;
|
||||
pInterface->mButtonHold.r = pPad->mButton.mButton & PAD_TRIGGER_R;
|
||||
pInterface->mButtonHold.l = pPad->mButton.mButton & PAD_TRIGGER_L;
|
||||
pInterface->mButtonHold.a = pPad->mButton.mButton & PAD_BUTTON_A;
|
||||
pInterface->mButtonHold.b = pPad->mButton.mButton & PAD_BUTTON_B;
|
||||
pInterface->mButtonHold.x = pPad->mButton.mButton & PAD_BUTTON_X;
|
||||
pInterface->mButtonHold.y = pPad->mButton.mButton & PAD_BUTTON_Y;
|
||||
pInterface->mButtonHold.start = pPad->mButton.mButton & PAD_BUTTON_START;
|
||||
|
||||
pInterface->mButtonTrig.up = pPad->mButton.mTrigger & CButton::DPAD_UP;
|
||||
pInterface->mButtonTrig.down = pPad->mButton.mTrigger & CButton::DPAD_DOWN;
|
||||
pInterface->mButtonTrig.left = pPad->mButton.mTrigger & CButton::DPAD_LEFT;
|
||||
pInterface->mButtonTrig.right = pPad->mButton.mTrigger & CButton::DPAD_RIGHT;
|
||||
pInterface->mButtonTrig.z = pPad->mButton.mTrigger & CButton::Z;
|
||||
pInterface->mButtonTrig.r = pPad->mButton.mTrigger & CButton::R;
|
||||
pInterface->mButtonTrig.l = pPad->mButton.mTrigger & CButton::L;
|
||||
pInterface->mButtonTrig.a = pPad->mButton.mTrigger & CButton::A;
|
||||
pInterface->mButtonTrig.b = pPad->mButton.mTrigger & CButton::B;
|
||||
pInterface->mButtonTrig.x = pPad->mButton.mTrigger & CButton::X;
|
||||
pInterface->mButtonTrig.y = pPad->mButton.mTrigger & CButton::Y;
|
||||
pInterface->mButtonTrig.start = pPad->mButton.mTrigger & CButton::START;
|
||||
pInterface->mButtonTrig.up = pPad->mButton.mTrigger & PAD_BUTTON_UP;
|
||||
pInterface->mButtonTrig.down = pPad->mButton.mTrigger & PAD_BUTTON_DOWN;
|
||||
pInterface->mButtonTrig.left = pPad->mButton.mTrigger & PAD_BUTTON_LEFT;
|
||||
pInterface->mButtonTrig.right = pPad->mButton.mTrigger & PAD_BUTTON_RIGHT;
|
||||
pInterface->mButtonTrig.z = pPad->mButton.mTrigger & PAD_TRIGGER_Z;
|
||||
pInterface->mButtonTrig.r = pPad->mButton.mTrigger & PAD_TRIGGER_R;
|
||||
pInterface->mButtonTrig.l = pPad->mButton.mTrigger & PAD_TRIGGER_L;
|
||||
pInterface->mButtonTrig.a = pPad->mButton.mTrigger & PAD_BUTTON_A;
|
||||
pInterface->mButtonTrig.b = pPad->mButton.mTrigger & PAD_BUTTON_B;
|
||||
pInterface->mButtonTrig.x = pPad->mButton.mTrigger & PAD_BUTTON_X;
|
||||
pInterface->mButtonTrig.y = pPad->mButton.mTrigger & PAD_BUTTON_Y;
|
||||
pInterface->mButtonTrig.start = pPad->mButton.mTrigger & PAD_BUTTON_START;
|
||||
|
||||
pInterface->mMainStickPosX = pPad->getMainStickX();
|
||||
pInterface->mMainStickPosY = pPad->getMainStickY();
|
||||
|
||||
+11
-11
@@ -160,8 +160,8 @@ int developKeyCheck(u32 btnTrig, u32 btnHold) {
|
||||
static u8 key_ganon;
|
||||
static u8 key_zelda;
|
||||
|
||||
if (btnHold == (CButton::L | CButton::R | CButton::Z | CButton::DPAD_DOWN) &&
|
||||
btnTrig == CButton::DPAD_DOWN) {
|
||||
if (btnHold == (PAD_TRIGGER_L | PAD_TRIGGER_R | PAD_TRIGGER_Z | PAD_BUTTON_DOWN) &&
|
||||
btnTrig == PAD_BUTTON_DOWN) {
|
||||
if (key_link == 3 && key_ganon == 6 && key_zelda == 5) {
|
||||
mDoMain::developmentMode = 1;
|
||||
} else {
|
||||
@@ -171,15 +171,15 @@ int developKeyCheck(u32 btnTrig, u32 btnHold) {
|
||||
}
|
||||
}
|
||||
|
||||
if (btnHold == (CButton::L | CButton::DPAD_RIGHT) && btnTrig == CButton::L) {
|
||||
if (btnHold == (PAD_TRIGGER_L | PAD_BUTTON_RIGHT) && btnTrig == PAD_TRIGGER_L) {
|
||||
key_link++;
|
||||
}
|
||||
|
||||
if (btnHold == (CButton::R | CButton::DPAD_UP) && btnTrig == CButton::R) {
|
||||
if (btnHold == (PAD_TRIGGER_R | PAD_BUTTON_UP) && btnTrig == PAD_TRIGGER_R) {
|
||||
key_ganon++;
|
||||
}
|
||||
|
||||
if (btnHold == (CButton::Z | CButton::DPAD_LEFT) && btnTrig == CButton::Z) {
|
||||
if (btnHold == (PAD_TRIGGER_Z | PAD_BUTTON_LEFT) && btnTrig == PAD_TRIGGER_Z) {
|
||||
key_zelda++;
|
||||
}
|
||||
|
||||
@@ -303,12 +303,12 @@ void fault_callback_scroll(OSError, OSContext* p_context, u32, u32) {
|
||||
}
|
||||
|
||||
bool waitRetrace = false;
|
||||
if (btnTrig == CButton::START) {
|
||||
if (btnTrig == PAD_BUTTON_START) {
|
||||
exception_addition(exConsole);
|
||||
waitRetrace = true;
|
||||
}
|
||||
|
||||
if (btnTrig == CButton::Z) {
|
||||
if (btnTrig == PAD_TRIGGER_Z) {
|
||||
JUTConsole* sysConsole = JFWSystem::getSystemConsole();
|
||||
if (JUTConsoleManager::getManager()->getDirectConsoel() != sysConsole) {
|
||||
exConsole = sysConsole;
|
||||
@@ -324,22 +324,22 @@ void fault_callback_scroll(OSError, OSContext* p_context, u32, u32) {
|
||||
waitRetrace = true;
|
||||
}
|
||||
|
||||
if (btnTrig == CButton::A) {
|
||||
if (btnTrig == PAD_BUTTON_A) {
|
||||
exConsole->scrollToLastLine();
|
||||
waitRetrace = true;
|
||||
}
|
||||
|
||||
if (btnTrig == CButton::B) {
|
||||
if (btnTrig == PAD_BUTTON_B) {
|
||||
exConsole->scrollToFirstLine();
|
||||
waitRetrace = true;
|
||||
}
|
||||
|
||||
if (btnHold == CButton::DPAD_UP) {
|
||||
if (btnHold == PAD_BUTTON_UP) {
|
||||
exConsole->scroll(holdUpCount < 3 ? -1 : (holdUpCount < 5 ? -2 : (holdUpCount < 7 ? -4 : -8)));
|
||||
waitRetrace = true;
|
||||
holdDownCount = 0;
|
||||
holdUpCount++;
|
||||
} else if (btnHold == CButton::DPAD_DOWN) {
|
||||
} else if (btnHold == PAD_BUTTON_DOWN) {
|
||||
exConsole->scroll(holdDownCount < 3 ? 1 : (holdDownCount < 5 ? 2 : (holdDownCount < 7 ? 4 : 8)));
|
||||
waitRetrace = true;
|
||||
holdUpCount = 0;
|
||||
|
||||
+17
-17
@@ -90,7 +90,7 @@ void CheckHeap(JUTGamePad* i_pad) {
|
||||
bool comboCheck = false;
|
||||
|
||||
// if L + R + Z is pressed
|
||||
if ((i_pad->getButton() & ~CButton::Z) == (CButton::L | CButton::R) && i_pad->testTrigger(CButton::Z) != false)
|
||||
if ((i_pad->getButton() & ~PAD_TRIGGER_Z) == (PAD_TRIGGER_L | PAD_TRIGGER_R) && i_pad->testTrigger(PAD_TRIGGER_Z) != false)
|
||||
comboCheck = true;
|
||||
|
||||
int saveRel = comboCheck;
|
||||
@@ -267,25 +267,25 @@ bool Debug_console(JUTGamePad* i_pad) {
|
||||
static f32 console_position_y = 30.0f;
|
||||
static f32 console_scroll = 0.0f;
|
||||
|
||||
if (i_pad->testTrigger(CButton::Z) && !(i_pad->getButton() & ~CButton::Z)) {
|
||||
if (i_pad->testTrigger(PAD_TRIGGER_Z) && !(i_pad->getButton() & ~PAD_TRIGGER_Z)) {
|
||||
console->setVisible(console->isVisible() == false);
|
||||
JUTAssertion::setMessageCount(0);
|
||||
}
|
||||
|
||||
if (console->isVisible()) {
|
||||
if ((i_pad->testButton(CButton::L) && i_pad->testButton(CButton::R)) ||
|
||||
if ((i_pad->testButton(PAD_TRIGGER_L) && i_pad->testButton(PAD_TRIGGER_R)) ||
|
||||
(i_pad->getAnalogL() != 0 && i_pad->getAnalogR() != 0))
|
||||
{
|
||||
f32 stick_x = i_pad->getMainStickX();
|
||||
f32 stick_y = i_pad->getMainStickY();
|
||||
|
||||
if (i_pad->testButton(CButton::X) && i_pad->testButton(CButton::Y) &&
|
||||
i_pad->testTrigger(CButton::START))
|
||||
if (i_pad->testButton(PAD_BUTTON_X) && i_pad->testButton(PAD_BUTTON_Y) &&
|
||||
i_pad->testTrigger(PAD_BUTTON_START))
|
||||
{
|
||||
console->clear();
|
||||
}
|
||||
|
||||
if (!i_pad->testButton(CButton::X) && !i_pad->testButton(CButton::Y)) {
|
||||
if (!i_pad->testButton(PAD_BUTTON_X) && !i_pad->testButton(PAD_BUTTON_Y)) {
|
||||
console_scroll -= stick_y;
|
||||
|
||||
int scrollAmount;
|
||||
@@ -302,16 +302,16 @@ bool Debug_console(JUTGamePad* i_pad) {
|
||||
console->scroll(scrollAmount);
|
||||
}
|
||||
} else {
|
||||
if (i_pad->testButton(CButton::X)) {
|
||||
if (i_pad->testButton(PAD_BUTTON_X)) {
|
||||
console_position_x += stick_x;
|
||||
}
|
||||
|
||||
if (i_pad->testButton(CButton::Y)) {
|
||||
if (i_pad->testButton(PAD_BUTTON_Y)) {
|
||||
console_position_y -= stick_y;
|
||||
}
|
||||
}
|
||||
|
||||
if (i_pad->testTrigger(CButton::A)) {
|
||||
if (i_pad->testTrigger(PAD_BUTTON_A)) {
|
||||
console->dumpToTerminal(0xFFFFFFFF);
|
||||
console->setOutput(JUTConsole::OUTPUT_OSREPORT | JUTConsole::OUTPUT_CONSOLE);
|
||||
}
|
||||
@@ -323,11 +323,11 @@ bool Debug_console(JUTGamePad* i_pad) {
|
||||
console->getPositionX(), console->getPositionY(), console->getOutput());
|
||||
} else {
|
||||
#if VERSION > VERSION_DEMO
|
||||
if (i_pad->testTrigger(CButton::DPAD_DOWN)) {
|
||||
if (i_pad->testTrigger(PAD_BUTTON_DOWN)) {
|
||||
g_HIO.mDisplayMeter ^= 1;
|
||||
}
|
||||
|
||||
if (i_pad->testTrigger(CButton::DPAD_LEFT)) {
|
||||
if (i_pad->testTrigger(PAD_BUTTON_LEFT)) {
|
||||
if (JKRAram::getAramHeap()) {
|
||||
JKRAram::getAramHeap()->dump();
|
||||
}
|
||||
@@ -336,11 +336,11 @@ bool Debug_console(JUTGamePad* i_pad) {
|
||||
dComIfG_dumpResControl();
|
||||
}
|
||||
|
||||
if (i_pad->testTrigger(CButton::DPAD_RIGHT)) {
|
||||
if (i_pad->testTrigger(PAD_BUTTON_RIGHT)) {
|
||||
JKRHeap::getSystemHeap()->dump_sort();
|
||||
}
|
||||
|
||||
if (i_pad->testTrigger(CButton::DPAD_UP)) {
|
||||
if (i_pad->testTrigger(PAD_BUTTON_UP)) {
|
||||
zeldaHeap->dump_sort();
|
||||
gameHeap->dump_sort();
|
||||
archiveHeap->dump_sort();
|
||||
@@ -380,11 +380,11 @@ void debug() {
|
||||
CheckHeap(g_mDoCPd_gamePad[2]);
|
||||
}
|
||||
|
||||
if ((g_mDoCPd_gamePad[2]->getButton() & ~CButton::Z) == CButton::R && g_mDoCPd_gamePad[2]->testTrigger(CButton::Z))
|
||||
if ((g_mDoCPd_gamePad[2]->getButton() & ~PAD_TRIGGER_Z) == PAD_TRIGGER_R && g_mDoCPd_gamePad[2]->testTrigger(PAD_TRIGGER_Z))
|
||||
mDisplayHeapSize ^= 1;
|
||||
|
||||
if (mDisplayHeapSize) {
|
||||
if ((g_mDoCPd_gamePad[2]->getButton() & ~CButton::Z) == CButton::L && g_mDoCPd_gamePad[2]->testTrigger(CButton::Z)) {
|
||||
if ((g_mDoCPd_gamePad[2]->getButton() & ~PAD_TRIGGER_Z) == PAD_TRIGGER_L && g_mDoCPd_gamePad[2]->testTrigger(PAD_TRIGGER_Z)) {
|
||||
if (mHeapBriefType < 5) {
|
||||
mHeapBriefType++;
|
||||
} else {
|
||||
@@ -469,11 +469,11 @@ void main01() {
|
||||
CheckHeap(g_mDoCPd_gamePad[2]);
|
||||
}
|
||||
|
||||
if ((g_mDoCPd_gamePad[2]->getButton() & ~CButton::Z) == CButton::R && g_mDoCPd_gamePad[2]->testTrigger(CButton::Z))
|
||||
if ((g_mDoCPd_gamePad[2]->getButton() & ~PAD_TRIGGER_Z) == PAD_TRIGGER_R && g_mDoCPd_gamePad[2]->testTrigger(PAD_TRIGGER_Z))
|
||||
mDisplayHeapSize ^= 1;
|
||||
|
||||
if (mDisplayHeapSize) {
|
||||
if ((g_mDoCPd_gamePad[2]->getButton() & ~CButton::Z) == CButton::L && g_mDoCPd_gamePad[2]->testTrigger(CButton::Z)) {
|
||||
if ((g_mDoCPd_gamePad[2]->getButton() & ~PAD_TRIGGER_Z) == PAD_TRIGGER_L && g_mDoCPd_gamePad[2]->testTrigger(PAD_TRIGGER_Z)) {
|
||||
if (mHeapBriefType < 5) {
|
||||
mHeapBriefType++;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user