Merge pull request 'input: expose unmapped button state' (#2) from Nesuwu/4JLibs:master into master

Reviewed-on: https://git.neolegacy.dev/neoStudiosLCE/4JLibs/pulls/2
This commit is contained in:
Fireblade
2026-08-02 22:09:08 +01:00
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;
+4
View File
@@ -82,6 +82,7 @@ public:
void SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax);
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);
void SetJoypadSensitivity(int iPad, float fSensitivity);
@@ -89,6 +90,9 @@ public:
bool ButtonPressed(int iPad, unsigned char ucAction = 255); // toggled
bool ButtonReleased(int iPad, unsigned char ucAction); //toggled
bool ButtonDown(int iPad, unsigned char ucAction = 255); // button held down
unsigned int GetRawButtons(int iPad);
unsigned int GetRawButtonsPressed(int iPad);
unsigned int ApplyButtonSwap(int iPad, unsigned int uiInput);
// Functions to remap the axis and triggers for in-game (not menus) - SouthPaw, etc
void SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
void SetJoypadStickTriggerMap(int iPad, unsigned int uiFrom, unsigned int uiTo);