diff --git a/Source/Core/Core/HW/GCPad.cpp b/Source/Core/Core/HW/GCPad.cpp index 0c4f6660c5..7a6d3336d3 100644 --- a/Source/Core/Core/HW/GCPad.cpp +++ b/Source/Core/Core/HW/GCPad.cpp @@ -58,10 +58,10 @@ void GetStatus(u8 _numPAD, GCPadStatus* _pPADStatus) { // if gui has lock (messing with controls), skip this input cycle // center axes and return - _pPADStatus->stickX = 0x80; - _pPADStatus->stickY = 0x80; - _pPADStatus->substickX = 0x80; - _pPADStatus->substickY = 0x80; + _pPADStatus->stickX = GCPadStatus::MAIN_STICK_CENTER_X; + _pPADStatus->stickY = GCPadStatus::MAIN_STICK_CENTER_Y; + _pPADStatus->substickX = GCPadStatus::C_STICK_CENTER_X; + _pPADStatus->substickY = GCPadStatus::C_STICK_CENTER_Y; return; } diff --git a/Source/Core/Core/HW/GCPadEmu.cpp b/Source/Core/Core/HW/GCPadEmu.cpp index a065604cb1..67af7caffa 100644 --- a/Source/Core/Core/HW/GCPadEmu.cpp +++ b/Source/Core/Core/HW/GCPadEmu.cpp @@ -103,12 +103,12 @@ void GCPad::GetInput(GCPadStatus* const pad) // sticks m_main_stick->GetState(&x, &y); - pad->stickX = 0x80 + (x * 0x7F); - pad->stickY = 0x80 + (y * 0x7F); + pad->stickX = GCPadStatus::MAIN_STICK_CENTER_X + (x * GCPadStatus::MAIN_STICK_RADIUS); + pad->stickY = GCPadStatus::MAIN_STICK_CENTER_Y + (y * GCPadStatus::MAIN_STICK_RADIUS); m_c_stick->GetState(&x, &y); - pad->substickX = 0x80 + (x * 0x7F); - pad->substickY = 0x80 + (y * 0x7F); + pad->substickX = GCPadStatus::C_STICK_CENTER_X + (x * GCPadStatus::C_STICK_RADIUS); + pad->substickY = GCPadStatus::C_STICK_CENTER_Y + (y * GCPadStatus::C_STICK_RADIUS); // triggers m_triggers->GetState(&pad->button, trigger_bitmasks, triggers); diff --git a/Source/Core/DolphinWX/TASInputDlg.cpp b/Source/Core/DolphinWX/TASInputDlg.cpp index 7db1c55822..e7ace99911 100644 --- a/Source/Core/DolphinWX/TASInputDlg.cpp +++ b/Source/Core/DolphinWX/TASInputDlg.cpp @@ -244,7 +244,7 @@ void TASInputDlg::ResetValues() void TASInputDlg::GetKeyBoardInput(GCPadStatus* PadStatus) { - if (PadStatus->stickX != 128) + if (PadStatus->stickX != GCPadStatus::MAIN_STICK_CENTER_X) { mainX = PadStatus->stickX; mstickx = true; @@ -254,11 +254,11 @@ void TASInputDlg::GetKeyBoardInput(GCPadStatus* PadStatus) else if (mstickx) { mstickx = false; - mainX = 128; + mainX = GCPadStatus::MAIN_STICK_CENTER_X; wx_mainX_t->SetValue(wxString::Format("%i", mainX)); } - if (PadStatus->stickY != 128) + if (PadStatus->stickY != GCPadStatus::MAIN_STICK_CENTER_Y) { mainY = PadStatus->stickY; msticky = true; @@ -267,11 +267,11 @@ void TASInputDlg::GetKeyBoardInput(GCPadStatus* PadStatus) else if (msticky) { msticky = false; - mainY = 128; + mainY = GCPadStatus::MAIN_STICK_CENTER_Y; wx_mainY_t->SetValue(wxString::Format("%i", mainY)); } - if (PadStatus->substickX != 128) + if (PadStatus->substickX != GCPadStatus::C_STICK_CENTER_X) { cX = PadStatus->substickX; cstickx = true; @@ -280,11 +280,11 @@ void TASInputDlg::GetKeyBoardInput(GCPadStatus* PadStatus) else if (cstickx) { cstickx = false; - cX = 128; + cX = GCPadStatus::C_STICK_CENTER_X; wx_cX_t->SetValue(wxString::Format("%i", cX)); } - if (PadStatus->substickY != 128) + if (PadStatus->substickY != GCPadStatus::C_STICK_CENTER_Y) { cY = PadStatus->substickY; csticky = true; @@ -293,7 +293,7 @@ void TASInputDlg::GetKeyBoardInput(GCPadStatus* PadStatus) else if (csticky) { csticky = false; - cY = 128; + cY = GCPadStatus::C_STICK_CENTER_Y; wx_cY_t->SetValue(wxString::Format("%i", cY)); } diff --git a/Source/Core/InputCommon/GCPadStatus.h b/Source/Core/InputCommon/GCPadStatus.h index c65fca23e4..aa31982783 100644 --- a/Source/Core/InputCommon/GCPadStatus.h +++ b/Source/Core/InputCommon/GCPadStatus.h @@ -45,4 +45,11 @@ struct GCPadStatus unsigned char analogA; // 0 <= analogA <= 255 unsigned char analogB; // 0 <= analogB <= 255 signed char err; // one of PAD_ERR_* number + + static const u8 MAIN_STICK_CENTER_X = 0x80; + static const u8 MAIN_STICK_CENTER_Y = 0x80; + static const u8 MAIN_STICK_RADIUS = 0x7f; + static const u8 C_STICK_CENTER_X = 0x80; + static const u8 C_STICK_CENTER_Y = 0x80; + static const u8 C_STICK_RADIUS = 0x7f; };