input: expose unmapped button state

Everything on C_4JInput resolves through the joypad map, so a caller that wants to
know which physical button moved - a rebinding screen, say - has nowhere to ask.

GetGameJoypadMapsRaw is the same idea for the map itself. GetGameJoypadMaps applies
the button swap on the way out, and for pad 0's setting regardless of which pad you
asked about, which is wrong for anything copying maps around.
This commit is contained in:
Nesuwu
2026-08-02 22:01:53 +02:00
parent 14abb60207
commit 5a92910c18
4 changed files with 50 additions and 0 deletions
+6
View File
@@ -100,6 +100,7 @@ public:
void SetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction, unsigned int uiActionVal);
unsigned int GetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction);
unsigned int GetGameJoypadMapsRaw(unsigned char ucMap, unsigned char ucAction);
void SetJoypadMapVal(int iPad, unsigned char ucMap);
unsigned char GetJoypadMapVal(int iPad);
@@ -115,6 +116,11 @@ public:
bool ButtonReleased(int iPad, unsigned char ucAction); // toggled
bool ButtonDown(int iPad, unsigned char ucAction = 255); // button held down
// unmapped, unswapped button words - for anything that needs to know which physical
// button moved rather than which action fired
unsigned int GetRawButtons(int iPad);
unsigned int GetRawButtonsPressed(int iPad);
float GetJoypadStick_Menu_LX(unsigned char ucPad);
float GetJoypadStick_Menu_LY(unsigned char ucPad);
float GetJoypadStick_Menu_RX(unsigned char ucPad);
+20
View File
@@ -54,6 +54,11 @@ unsigned int C_4JInput::GetGameJoypadMaps(unsigned char ucMap, unsigned char ucA
return InternalInputManager.GetGameJoypadMaps(ucMap, ucAction);
}
unsigned int C_4JInput::GetGameJoypadMapsRaw(unsigned char ucMap, unsigned char ucAction)
{
return InternalInputManager.GetGameJoypadMapsRaw(ucMap, ucAction);
}
void C_4JInput::SetJoypadMapVal(int iPad, unsigned char ucMap)
{
InternalInputManager.SetJoypadMapVal(iPad, ucMap);
@@ -89,6 +94,21 @@ bool C_4JInput::ButtonDown(int iPad, unsigned char ucAction)
return InternalInputManager.ButtonDown(iPad, ucAction);
}
unsigned int C_4JInput::GetRawButtons(int iPad)
{
return InternalInputManager.GetRawButtons(iPad);
}
unsigned int C_4JInput::GetRawButtonsPressed(int iPad)
{
return InternalInputManager.GetRawButtonsPressed(iPad);
}
unsigned int C_4JInput::ApplyButtonSwap(int iPad, unsigned int uiInput)
{
return InternalInputManager.ApplyButtonSwap(iPad, uiInput);
}
void C_4JInput::SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo)
{
InternalInputManager.SetJoypadStickAxisMap(iPad, uiFrom, uiTo);
+20
View File
@@ -298,6 +298,26 @@ unsigned int CInput::GetGameJoypadMaps(unsigned char ucMap, unsigned char ucActi
return ApplyButtonSwap(0, uiVal);
}
unsigned int CInput::GetGameJoypadMapsRaw(unsigned char ucMap, unsigned char ucAction)
{
assert(ucMap < m_ucJoypadMapC);
assert(ucAction < m_ucJoypadMapActionC);
return m_JoypadMap[ucMap][ucAction];
}
unsigned int CInput::GetRawButtons(int iPad)
{
if (iPad < 0 || iPad >= MAX_JOYPADS) return 0;
return m_Joypads[iPad].m_uiButtons;
}
unsigned int CInput::GetRawButtonsPressed(int iPad)
{
if (iPad < 0 || iPad >= MAX_JOYPADS) return 0;
return (unsigned int)m_Joypads[iPad].m_uiButtonsPressed;
}
void CInput::SetJoypadMapVal(int iPad, unsigned char ucMap)
{
m_bJoypadMapArrayIsSetup = true;