chore: add .clang_format for consistent code formatting

This commit is contained in:
Patoke
2026-03-01 20:03:40 -03:00
parent 67332bbc79
commit 6e6440f0f3
25 changed files with 3956 additions and 3996 deletions
+36 -36
View File
@@ -1,153 +1,153 @@
#include "4J_Input.h"
#include "INP_Main.h"
#include "INP_Keyboard.h"
#include "INP_Main.h"
C_4JInput InputManager;
CKeyboard InternalKeyboard;
void C_4JInput::Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC)
{
InternalInputManager.Initialise(iInputStateC, ucMapC, ucActionC, ucMenuActionC);
InternalInputManager.Initialise(iInputStateC, ucMapC, ucActionC, ucMenuActionC);
}
void C_4JInput::Tick(void)
{
InternalInputManager.Tick();
InternalInputManager.Tick();
}
void C_4JInput::SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax)
{
InternalInputManager.SetDeadzoneAndMovementRange(uiDeadzone, uiMovementRangeMax);
InternalInputManager.SetDeadzoneAndMovementRange(uiDeadzone, uiMovementRangeMax);
}
void C_4JInput::SetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction, unsigned int uiActionVal)
{
InternalInputManager.SetGameJoypadMaps(ucMap, ucAction, uiActionVal);
InternalInputManager.SetGameJoypadMaps(ucMap, ucAction, uiActionVal);
}
unsigned int C_4JInput::GetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction)
{
return InternalInputManager.GetGameJoypadMaps(ucMap, ucAction);
return InternalInputManager.GetGameJoypadMaps(ucMap, ucAction);
}
void C_4JInput::SetJoypadMapVal(int iPad, unsigned char ucMap)
{
InternalInputManager.SetJoypadMapVal(iPad, ucMap);
InternalInputManager.SetJoypadMapVal(iPad, ucMap);
}
unsigned char C_4JInput::GetJoypadMapVal(int iPad)
{
return InternalInputManager.GetJoypadMapVal(iPad);
return InternalInputManager.GetJoypadMapVal(iPad);
}
void C_4JInput::SetJoypadSensitivity(int iPad, float fSensitivity)
{
InternalInputManager.SetJoypadSensitivity(iPad, fSensitivity);
InternalInputManager.SetJoypadSensitivity(iPad, fSensitivity);
}
unsigned int C_4JInput::GetValue(int iPad, unsigned char ucAction, bool bRepeat)
{
return InternalInputManager.GetValue(iPad, ucAction, bRepeat);
return InternalInputManager.GetValue(iPad, ucAction, bRepeat);
}
bool C_4JInput::ButtonPressed(int iPad, unsigned char ucAction)
{
return InternalInputManager.ButtonPressed(iPad, ucAction);
return InternalInputManager.ButtonPressed(iPad, ucAction);
}
bool C_4JInput::ButtonReleased(int iPad, unsigned char ucAction)
{
return InternalInputManager.ButtonReleased(iPad, ucAction);
return InternalInputManager.ButtonReleased(iPad, ucAction);
}
bool C_4JInput::ButtonDown(int iPad, unsigned char ucAction)
{
return InternalInputManager.ButtonDown(iPad, ucAction);
return InternalInputManager.ButtonDown(iPad, ucAction);
}
void C_4JInput::SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo)
{
InternalInputManager.SetJoypadStickAxisMap(iPad, uiFrom, uiTo);
InternalInputManager.SetJoypadStickAxisMap(iPad, uiFrom, uiTo);
}
void C_4JInput::SetJoypadStickTriggerMap(int iPad, unsigned int uiFrom, unsigned int uiTo)
{
InternalInputManager.SetJoypadStickTriggerMap(iPad, uiFrom, uiTo);
InternalInputManager.SetJoypadStickTriggerMap(iPad, uiFrom, uiTo);
}
void C_4JInput::SetKeyRepeatRate(float fRepeatDelaySecs, float fRepeatRateSecs)
{
InternalInputManager.SetKeyRepeatRate(fRepeatDelaySecs, fRepeatRateSecs);
InternalInputManager.SetKeyRepeatRate(fRepeatDelaySecs, fRepeatRateSecs);
}
void C_4JInput::SetDebugSequence(const char* chSequenceA, int(*Func)(LPVOID), LPVOID lpParam)
void C_4JInput::SetDebugSequence(const char *chSequenceA, int (*Func)(LPVOID), LPVOID lpParam)
{
InternalInputManager.SetDebugSequence(chSequenceA, Func, lpParam);
InternalInputManager.SetDebugSequence(chSequenceA, Func, lpParam);
}
FLOAT C_4JInput::GetIdleSeconds(int iPad)
{
return InternalInputManager.GetIdleSeconds(iPad);
return InternalInputManager.GetIdleSeconds(iPad);
}
bool C_4JInput::IsPadConnected(int iPad)
{
return InternalInputManager.IsPadConnected(iPad);
return InternalInputManager.IsPadConnected(iPad);
}
float C_4JInput::GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay)
{
return InternalInputManager.GetJoypadStick_LX(iPad, bCheckMenuDisplay);
return InternalInputManager.GetJoypadStick_LX(iPad, bCheckMenuDisplay);
}
float C_4JInput::GetJoypadStick_LY(int iPad, bool bCheckMenuDisplay)
{
return InternalInputManager.GetJoypadStick_LY(iPad, bCheckMenuDisplay);
return InternalInputManager.GetJoypadStick_LY(iPad, bCheckMenuDisplay);
}
float C_4JInput::GetJoypadStick_RX(int iPad, bool bCheckMenuDisplay)
{
return InternalInputManager.GetJoypadStick_RX(iPad, bCheckMenuDisplay);
return InternalInputManager.GetJoypadStick_RX(iPad, bCheckMenuDisplay);
}
float C_4JInput::GetJoypadStick_RY(int iPad, bool bCheckMenuDisplay)
{
return InternalInputManager.GetJoypadStick_RY(iPad, bCheckMenuDisplay);
return InternalInputManager.GetJoypadStick_RY(iPad, bCheckMenuDisplay);
}
unsigned char C_4JInput::GetJoypadLTrigger(int iPad, bool bCheckMenuDisplay)
{
return InternalInputManager.GetJoypadLTrigger(iPad, bCheckMenuDisplay);
return InternalInputManager.GetJoypadLTrigger(iPad, bCheckMenuDisplay);
}
unsigned char C_4JInput::GetJoypadRTrigger(int iPad, bool bCheckMenuDisplay)
{
return InternalInputManager.GetJoypadRTrigger(iPad, bCheckMenuDisplay);
return InternalInputManager.GetJoypadRTrigger(iPad, bCheckMenuDisplay);
}
void C_4JInput::SetMenuDisplayed(int iPad, bool bVal)
{
InternalInputManager.SetMenuDisplayed(iPad, bVal);
InternalInputManager.SetMenuDisplayed(iPad, bVal);
}
EKeyboardResult C_4JInput::RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int(*Func)(LPVOID, const bool), LPVOID lpParam, C_4JInput::EKeyboardMode eMode)
EKeyboardResult C_4JInput::RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int (*Func)(LPVOID, const bool), LPVOID lpParam,
C_4JInput::EKeyboardMode eMode)
{
return InternalKeyboard.RequestKeyboard(Title, Text, dwPad, uiMaxChars, Func, lpParam, eMode);
return InternalKeyboard.RequestKeyboard(Title, Text, dwPad, uiMaxChars, Func, lpParam, eMode);
}
void C_4JInput::GetText(uint16_t* UTF16String)
void C_4JInput::GetText(uint16_t *UTF16String)
{
InternalKeyboard.GetText(UTF16String);
InternalKeyboard.GetText(UTF16String);
}
bool C_4JInput::VerifyStrings(WCHAR** pwStringA, int iStringC, int(*Func)(LPVOID, STRING_VERIFY_RESPONSE*), LPVOID lpParam)
bool C_4JInput::VerifyStrings(WCHAR **pwStringA, int iStringC, int (*Func)(LPVOID, STRING_VERIFY_RESPONSE *), LPVOID lpParam)
{
return true;
return true;
}
void C_4JInput::CancelQueuedVerifyStrings(int(*Func)(LPVOID, STRING_VERIFY_RESPONSE*), LPVOID lpParam) {}
void C_4JInput::CancelQueuedVerifyStrings(int (*Func)(LPVOID, STRING_VERIFY_RESPONSE *), LPVOID lpParam) {}
void C_4JInput::CancelAllVerifyInProgress(void) {}
//bool C_4JInput::InputDetected(DWORD dwUserIndex,WCHAR *pwchInput) {}
// bool C_4JInput::InputDetected(DWORD dwUserIndex,WCHAR *pwchInput) {}
+24 -33
View File
@@ -2,7 +2,7 @@
void CForceFeedback::Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC)
{
m_Effects = new FF_EFFECT[MAX_EFFECTS];
m_Effects = new FF_EFFECT[MAX_EFFECTS];
m_EffectC = 0;
LARGE_INTEGER qwTicksPerSec;
@@ -12,16 +12,13 @@ void CForceFeedback::Initialise(int iInputStateC, unsigned char ucMapC, unsigned
m_unkBool = 0;
}
void CForceFeedback::RumbleEnable(int iQuadrant, bool bRumbleEnabled)
{
}
void CForceFeedback::RumbleEnable(int iQuadrant, bool bRumbleEnabled) {}
void CForceFeedback::CreateEffect(void)
{
assert(m_EffectC<MAX_EFFECTS);
assert(m_EffectC < MAX_EFFECTS);
FF_EFFECT* pEffect = &m_Effects[m_EffectC];
FF_EFFECT *pEffect = &m_Effects[m_EffectC];
pEffect->m_uiDurationMs = 5;
pEffect->m_uiMagnitude = 500;
pEffect->m_uiEffectType = 0;
@@ -33,18 +30,18 @@ void CForceFeedback::CreateEffect(void)
void CForceFeedback::AddEffectInstance(unsigned int uiEffect)
{
FF_EFFECT_INSTANCE* pEffectInst = new FF_EFFECT_INSTANCE();
pEffectInst->m_Effect = &m_Effects[uiEffect];
FF_EFFECT_INSTANCE *pEffectInst = new FF_EFFECT_INSTANCE();
pEffectInst->m_Effect = &m_Effects[uiEffect];
pEffectInst->m_uiInst = 0;
m_EffectList.AddToTail(pEffectInst);
m_EffectList.AddToTail(pEffectInst);
}
void CForceFeedback::SetEffectInstanceState(unsigned int uiEffectInstance, unsigned int uiState)
{
int iCount = 0;
LinkedList::_LL_NODE* pNode;
for (pNode = m_EffectList.m_Head; ; pNode = pNode->m_Next)
LinkedList::_LL_NODE *pNode;
for (pNode = m_EffectList.m_Head;; pNode = pNode->m_Next)
{
if ((iCount++) == uiEffectInstance)
break;
@@ -52,34 +49,28 @@ void CForceFeedback::SetEffectInstanceState(unsigned int uiEffectInstance, unsig
pNode->GetDataAs<FF_EFFECT_INSTANCE>()->m_bIsActive = true;
}
void CForceFeedback::ProcessEventInstance(FF_EFFECT_INSTANCE* pEffectInst)
{
void CForceFeedback::ProcessEventInstance(FF_EFFECT_INSTANCE *pEffectInst) {}
}
void CForceFeedback::PauseEventInstance(FF_EFFECT_INSTANCE* pEffectInst)
{
}
void CForceFeedback::PauseEventInstance(FF_EFFECT_INSTANCE *pEffectInst) {}
void CForceFeedback::AddRumble(unsigned int uiPad, WORD leftMotorSpeed, WORD rightMotorSpeed, float fSeconds)
{
RUMBLE_EFFECT* pRumble = new RUMBLE_EFFECT();
RUMBLE_EFFECT *pRumble = new RUMBLE_EFFECT();
LARGE_INTEGER qwCurrentTime;
QueryPerformanceCounter(&qwCurrentTime);
LARGE_INTEGER qwCurrentTime;
QueryPerformanceCounter(&qwCurrentTime);
pRumble->m_TimeLeft = (m_TicksPerSecond * fSeconds) + qwCurrentTime.QuadPart;
pRumble->m_RumbleData.wLeftMotorSpeed = leftMotorSpeed;
pRumble->m_RumbleData.wRightMotorSpeed = rightMotorSpeed;
pRumble->m_Pad = uiPad;
pRumble->m_TimeLeft = (m_TicksPerSecond * fSeconds) + qwCurrentTime.QuadPart;
pRumble->m_RumbleData.wLeftMotorSpeed = leftMotorSpeed;
pRumble->m_RumbleData.wRightMotorSpeed = rightMotorSpeed;
pRumble->m_Pad = uiPad;
m_RumbleList.AddToTail(pRumble);
m_RumbleList.AddToTail(pRumble);
}
void CForceFeedback::Tick(void)
{
for (LinkedList::_LL_NODE* pEffectNode = m_EffectList.m_Head; pEffectNode; pEffectNode = pEffectNode->m_Next)
for (LinkedList::_LL_NODE *pEffectNode = m_EffectList.m_Head; pEffectNode; pEffectNode = pEffectNode->m_Next)
{
if (pEffectNode->GetDataAs<FF_EFFECT_INSTANCE>()->m_bIsActive)
{
@@ -90,21 +81,21 @@ void CForceFeedback::Tick(void)
LARGE_INTEGER qwCurrentTime;
QueryPerformanceCounter(&qwCurrentTime);
LinkedList::_LL_NODE* pRumbleNode = m_RumbleList.m_Head;
LinkedList::_LL_NODE *pRumbleNode = m_RumbleList.m_Head;
while (pRumbleNode)
{
if (pRumbleNode->GetDataAs<RUMBLE_EFFECT>()->m_TimeLeft <= qwCurrentTime.QuadPart)
{
RUMBLE_EFFECT* pRumble = pRumbleNode->GetDataAs<RUMBLE_EFFECT>();
RUMBLE_EFFECT *pRumble = pRumbleNode->GetDataAs<RUMBLE_EFFECT>();
pRumble->m_RumbleData.wLeftMotorSpeed = 0;
pRumble->m_RumbleData.wRightMotorSpeed = 0;
XInputSetState(pRumble->m_Pad, &pRumble->m_RumbleData);
m_RumbleList.RemoveNode(pRumbleNode);
m_RumbleList.RemoveNode(pRumbleNode);
LinkedList::_LL_NODE* pTemp = pRumbleNode;
LinkedList::_LL_NODE *pTemp = pRumbleNode;
pRumbleNode = pRumbleNode->m_Next;
delete pTemp->m_pvData;
+43 -44
View File
@@ -6,56 +6,55 @@
class CForceFeedback
{
public:
enum FF_PARAMS
{
FF_PARAMS_RAMP,
FF_PARAMS_PERIODIC
};
enum FF_PARAMS
{
FF_PARAMS_RAMP,
FF_PARAMS_PERIODIC
};
struct RUMBLE_EFFECT
{
DWORD m_Pad;
uint64_t m_TimeLeft;
XINPUT_VIBRATION m_RumbleData;
WORD unk;
};
struct RUMBLE_EFFECT
{
DWORD m_Pad;
uint64_t m_TimeLeft;
XINPUT_VIBRATION m_RumbleData;
WORD unk;
};
struct FF_EFFECT
{
unsigned int m_uiEffectType;
unsigned int m_uiDurationMs;
BYTE gap8[4];
unsigned int m_uiMagnitude;
BYTE gap10[8];
DWORD dword18;
DWORD dword1C;
};
struct FF_EFFECT
{
unsigned int m_uiEffectType;
unsigned int m_uiDurationMs;
BYTE gap8[4];
unsigned int m_uiMagnitude;
BYTE gap10[8];
DWORD dword18;
DWORD dword1C;
};
struct FF_EFFECT_INSTANCE
{
bool m_bIsActive;
unsigned int m_uiInst;
CForceFeedback::FF_EFFECT *m_Effect;
};
struct FF_EFFECT_INSTANCE
{
bool m_bIsActive;
unsigned int m_uiInst;
CForceFeedback::FF_EFFECT* m_Effect;
};
void Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC);
void RumbleEnable(int iQuadrant, bool bRumbleEnabled);
void CreateEffect(void);
void AddEffectInstance(unsigned int uiEffect);
void SetEffectInstanceState(unsigned int uiEffectInstance, unsigned int uiState);
void Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC);
void RumbleEnable(int iQuadrant, bool bRumbleEnabled);
void CreateEffect(void);
void AddEffectInstance(unsigned int uiEffect);
void SetEffectInstanceState(unsigned int uiEffectInstance, unsigned int uiState);
void ProcessEventInstance(FF_EFFECT_INSTANCE *pEffectInst);
void PauseEventInstance(FF_EFFECT_INSTANCE *pEffectInst);
void ProcessEventInstance(FF_EFFECT_INSTANCE* pEffectInst);
void PauseEventInstance(FF_EFFECT_INSTANCE* pEffectInst);
void AddRumble(unsigned int uiPad, WORD leftMotorSpeed, WORD rightMotorSpeed, float fSeconds);
void AddRumble(unsigned int uiPad, WORD leftMotorSpeed, WORD rightMotorSpeed, float fSeconds);
void Tick(void);
void Tick(void);
LinkedList m_EffectList;
FF_EFFECT* m_Effects;
int m_EffectC;
LinkedList m_RumbleList;
float m_TicksPerSecond;
bool m_unkBool;
LinkedList m_EffectList;
FF_EFFECT *m_Effects;
int m_EffectC;
LinkedList m_RumbleList;
float m_TicksPerSecond;
bool m_unkBool;
};
+15 -17
View File
@@ -1,24 +1,22 @@
#include "INP_Keyboard.h"
void CKeyboard::Tick(void)
{
void CKeyboard::Tick(void) {}
EKeyboardResult CKeyboard::RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int (*Func)(LPVOID, const bool), LPVOID lpParam,
C_4JInput::EKeyboardMode eMode)
{
ClearGlobalText();
SeedEditBox();
Func(lpParam, C_4JInput::EKeyboardMode_Numeric);
return EKeyboard_ResultAccept;
}
EKeyboardResult CKeyboard::RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int(*Func)(LPVOID, const bool), LPVOID lpParam, C_4JInput::EKeyboardMode eMode)
{
ClearGlobalText();
SeedEditBox();
Func(lpParam, C_4JInput::EKeyboardMode_Numeric);
return EKeyboard_ResultAccept;
}
void CKeyboard::GetText(uint16_t* UTF16String)
void CKeyboard::GetText(uint16_t *UTF16String)
{
uint16_t* keyString = GetGlobalText();
for (unsigned int index = 0; keyString[index] && index < 0x200; index++)
{
UTF16String[index] = keyString[index];
}
uint16_t *keyString = GetGlobalText();
for (unsigned int index = 0; keyString[index] && index < 0x200; index++)
{
UTF16String[index] = keyString[index];
}
}
+12 -15
View File
@@ -2,28 +2,25 @@
#include "4J_Input.h"
void ClearGlobalText();
uint16_t* GetGlobalText();
uint16_t *GetGlobalText();
void SeedEditBox();
class CKeyboard
{
public:
enum EKeyboardProcessState
{
};
enum EKeyboardProcessState
{
struct SKeyboardInfo
{
};
};
void Tick(void);
struct SKeyboardInfo
{
EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int (*Func)(LPVOID, const bool), LPVOID lpParam,
C_4JInput::EKeyboardMode eMode);
void GetText(uint16_t *UTF16String);
};
void Tick(void);
EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int(*Func)(LPVOID, const bool), LPVOID lpParam, C_4JInput::EKeyboardMode eMode);
void GetText(uint16_t* UTF16String);
BYTE gap0[0x68];
BYTE gap0[0x68];
};
File diff suppressed because it is too large Load Diff
+112 -115
View File
@@ -7,155 +7,152 @@
class CInput
{
public:
struct JOYPAD
{
bool m_bIsDisabled;
bool m_bIsConnected;
bool m_bWasConnected;
bool m_bHasConnected;
unsigned int m_uiButtons;
unsigned int m_uiOldButtons;
int m_uiButtonsPressed;
int m_uiButtonsReleased;
struct JOYPAD
{
bool m_bIsDisabled;
bool m_bIsConnected;
bool m_bWasConnected;
bool m_bHasConnected;
int m_iRightThumbX;
int m_iRightThumbY;
int m_iLeftThumbX;
int m_iLeftThumbY;
unsigned int m_uiButtons;
unsigned int m_uiOldButtons;
int m_uiButtonsPressed;
int m_uiButtonsReleased;
DWORD m_iNormalizedRightThumbX;
DWORD m_iNormalizedRightThumbY;
DWORD m_iNormalizedLeftThumbX;
DWORD m_iNormalizedLeftThumbY;
int m_iRightThumbX;
int m_iRightThumbY;
int m_iLeftThumbX;
int m_iLeftThumbY;
float m_fNormalizedRightThumbX;
float m_fNormalizedRightThumbY;
float m_fNormalizedLeftThumbX;
float m_fNormalizedLeftThumbY;
DWORD m_iNormalizedRightThumbX;
DWORD m_iNormalizedRightThumbY;
DWORD m_iNormalizedLeftThumbX;
DWORD m_iNormalizedLeftThumbY;
unsigned char m_ucLeftTriggerState;
unsigned char m_ucRightTriggerState;
float m_fNormalizedRightThumbX;
float m_fNormalizedRightThumbY;
float m_fNormalizedLeftThumbX;
float m_fNormalizedLeftThumbY;
float *m_pfLeftThumbXAxisMap;
float *m_pfLeftThumbYAxisMap;
float *m_pfRightThumbXAxisMap;
float *m_pfRightThumbYAxisMap;
unsigned char m_ucLeftTriggerState;
unsigned char m_ucRightTriggerState;
float m_fSensitivity;
float* m_pfLeftThumbXAxisMap;
float* m_pfLeftThumbYAxisMap;
float* m_pfRightThumbXAxisMap;
float* m_pfRightThumbYAxisMap;
BYTE *m_pucLeftTriggerAxisMap;
BYTE *m_pucRightTriggerAxisMap;
float m_fSensitivity;
unsigned char m_ucMappingValue;
unsigned char m_ucInputStateIndex;
XINPUT_STATE *m_pInputStates;
};
BYTE* m_pucLeftTriggerAxisMap;
BYTE* m_pucRightTriggerAxisMap;
struct JOYPADS
{
};
unsigned char m_ucMappingValue;
unsigned char m_ucInputStateIndex;
XINPUT_STATE* m_pInputStates;
};
struct TimeInfo
{
LARGE_INTEGER m_qwStartTime;
LARGE_INTEGER m_qwTotalHoldTicks;
float m_fTotalHoldTime;
float m_fLastRepeatTime;
bool m_bInitialPressHandled;
};
struct JOYPADS
{
CInput();
};
void Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC);
void Tick(void);
struct TimeInfo
{
LARGE_INTEGER m_qwStartTime;
LARGE_INTEGER m_qwTotalHoldTicks;
float m_fTotalHoldTime;
float m_fLastRepeatTime;
bool m_bInitialPressHandled;
};
void SetJoypadValues(JOYPAD *pThisPad);
void SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax);
void SetJoypadSensitivity(int iPad, float fSensitivity);
CInput();
void SetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction, unsigned int uiActionVal);
unsigned int GetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction);
void SetJoypadMapVal(int iPad, unsigned char ucMap);
unsigned char GetJoypadMapVal(int iPad);
void Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC);
void Tick(void);
void SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
void SetJoypadStickTriggerMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
void SetJoypadValues(JOYPAD* pThisPad);
void SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax);
void SetJoypadSensitivity(int iPad, float fSensitivity);
bool IsPadConnected(int iPad);
void SetSigninJoypadMask(unsigned int mask);
unsigned int GetValue(int iPad, unsigned char ucAction, bool bRepeat = false);
bool IsSet(int iPad, unsigned char ucAction);
void SetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction, unsigned int uiActionVal);
unsigned int GetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction);
void SetJoypadMapVal(int iPad, unsigned char ucMap);
unsigned char GetJoypadMapVal(int iPad);
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
void SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
void SetJoypadStickTriggerMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
float GetJoypadStick_Menu_LX(unsigned char ucPad);
float GetJoypadStick_Menu_LY(unsigned char ucPad);
float GetJoypadStick_Menu_RX(unsigned char ucPad);
float GetJoypadStick_Menu_RY(unsigned char ucPad);
unsigned char GetJoypadLTrigger_Menu(unsigned char ucPad);
unsigned char GetJoypadRTrigger_Menu(unsigned char ucPad);
bool IsPadConnected(int iPad);
void SetSigninJoypadMask(unsigned int mask);
unsigned int GetValue(int iPad, unsigned char ucAction, bool bRepeat = false);
bool IsSet(int iPad, unsigned char ucAction);
float GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay = true);
float GetJoypadStick_LY(int iPad, bool bCheckMenuDisplay = true);
float GetJoypadStick_RX(int iPad, bool bCheckMenuDisplay = true);
float GetJoypadStick_RY(int iPad, bool bCheckMenuDisplay = true);
unsigned char GetJoypadLTrigger(int iPad, bool bCheckMenuDisplay = true);
unsigned char GetJoypadRTrigger(int iPad, bool bCheckMenuDisplay = true);
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
void SetMenuDisplayed(int iPad, bool bVal);
float GetJoypadStick_Menu_LX(unsigned char ucPad);
float GetJoypadStick_Menu_LY(unsigned char ucPad);
float GetJoypadStick_Menu_RX(unsigned char ucPad);
float GetJoypadStick_Menu_RY(unsigned char ucPad);
unsigned char GetJoypadLTrigger_Menu(unsigned char ucPad);
unsigned char GetJoypadRTrigger_Menu(unsigned char ucPad);
void SetKeyRepeatRate(float fRepeatDelaySecs, float fRepeatRateSecs);
void SetDebugSequence(const char *chSequenceA, int (*Func)(LPVOID), LPVOID lpParam);
FLOAT GetIdleSeconds(int iPad);
float GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay = true);
float GetJoypadStick_LY(int iPad, bool bCheckMenuDisplay = true);
float GetJoypadStick_RX(int iPad, bool bCheckMenuDisplay = true);
float GetJoypadStick_RY(int iPad, bool bCheckMenuDisplay = true);
unsigned char GetJoypadLTrigger(int iPad, bool bCheckMenuDisplay = true);
unsigned char GetJoypadRTrigger(int iPad, bool bCheckMenuDisplay = true);
bool UpdateJoypads(void);
void ClearJoypadValues(JOYPAD *pThisPad);
void SetMenuDisplayed(int iPad, bool bVal);
void InitTime(void);
void GetStartTime(int iPad, int iKey);
void UpdateTime(int iPad, int iKey);
void SetKeyRepeatRate(float fRepeatDelaySecs, float fRepeatRateSecs);
void SetDebugSequence(const char* chSequenceA, int(*Func)(LPVOID), LPVOID lpParam);
FLOAT GetIdleSeconds(int iPad);
BYTE gap0[16];
bool UpdateJoypads(void);
void ClearJoypadValues(JOYPAD* pThisPad);
JOYPAD m_Joypads[MAX_JOYPADS];
void InitTime(void);
void GetStartTime(int iPad, int iKey);
void UpdateTime(int iPad, int iKey);
int m_iDeadzone;
int m_iMovementRangeMax;
int m_iEffectiveRange;
int m_iHalfRange;
float m_fEffectiveRange;
BYTE gap0[16];
unsigned char m_ucInputStateC;
unsigned char m_ucJoypadMapC;
unsigned char m_ucJoypadMapActionC;
unsigned char m_ucMenuActionC;
JOYPAD m_Joypads[MAX_JOYPADS];
unsigned int **m_JoypadMap;
int m_iDeadzone;
int m_iMovementRangeMax;
int m_iEffectiveRange;
int m_iHalfRange;
float m_fEffectiveRange;
bool m_bJoypadMapArrayIsSetup;
unsigned int m_uiSigninJoypadMask;
bool m_bIsMenuDisplayed[MAX_JOYPADS];
unsigned char m_ucInputStateC;
unsigned char m_ucJoypadMapC;
unsigned char m_ucJoypadMapActionC;
unsigned char m_ucMenuActionC;
CForceFeedback m_ForceFeedback;
CKeyboard m_Keyboard;
unsigned int** m_JoypadMap;
float m_fTickToSeconds;
float m_fRepeatDelaySecs;
float m_fRepeatRateSecs;
bool m_bJoypadMapArrayIsSetup;
unsigned int m_uiSigninJoypadMask;
bool m_bIsMenuDisplayed[MAX_JOYPADS];
TimeInfo m_Timers[MAX_JOYPADS][24];
LARGE_INTEGER m_LastActivityTime[MAX_JOYPADS];
CForceFeedback m_ForceFeedback;
CKeyboard m_Keyboard;
float m_fTickToSeconds;
float m_fRepeatDelaySecs;
float m_fRepeatRateSecs;
TimeInfo m_Timers[MAX_JOYPADS][24];
LARGE_INTEGER m_LastActivityTime[MAX_JOYPADS];
char* m_sDebugSequenceName;
unsigned int m_uiDebugSequenceIndex;
int (*m_pDebugSequenceFn)(void*);
LPVOID m_pDebugSequenceParam;
char *m_sDebugSequenceName;
unsigned int m_uiDebugSequenceIndex;
int (*m_pDebugSequenceFn)(void *);
LPVOID m_pDebugSequenceParam;
};
// Singleton
+14 -13
View File
@@ -7,9 +7,9 @@ LinkedList::LinkedList()
this->m_Tail = nullptr;
}
void LinkedList::AddToHead(void* pvData)
void LinkedList::AddToHead(void *pvData)
{
_LL_NODE* pNode = new _LL_NODE();
_LL_NODE *pNode = new _LL_NODE();
pNode->m_pvData = pvData;
if (!m_Tail)
@@ -27,9 +27,9 @@ void LinkedList::AddToHead(void* pvData)
m_NodeC++;
}
void LinkedList::AddToTail(void* pvData)
void LinkedList::AddToTail(void *pvData)
{
_LL_NODE* pNode = new _LL_NODE();
_LL_NODE *pNode = new _LL_NODE();
pNode->m_pvData = pvData;
if (!m_Head)
@@ -37,7 +37,8 @@ void LinkedList::AddToTail(void* pvData)
m_Head = pNode;
}
if (m_Tail) {
if (m_Tail)
{
m_Tail->m_Next = pNode;
pNode->m_Prev = m_Tail;
}
@@ -49,9 +50,9 @@ void LinkedList::AddToTail(void* pvData)
m_NodeC++;
}
void LinkedList::RemoveNode(_LL_NODE* pNodeToRemove)
void LinkedList::RemoveNode(_LL_NODE *pNodeToRemove)
{
_LL_NODE* pCurrentNode;
_LL_NODE *pCurrentNode;
for (pCurrentNode = m_Head; pCurrentNode != pNodeToRemove; pCurrentNode = pCurrentNode->m_Next)
{
;
@@ -61,7 +62,7 @@ void LinkedList::RemoveNode(_LL_NODE* pNodeToRemove)
{
m_Head = m_Head->m_Next;
}
else
else
{
pCurrentNode->m_Prev->m_Next = pCurrentNode->m_Next;
@@ -74,9 +75,9 @@ void LinkedList::RemoveNode(_LL_NODE* pNodeToRemove)
m_NodeC--;
}
LinkedList::_LL_NODE* LinkedList::RemoveHeadNode()
LinkedList::_LL_NODE *LinkedList::RemoveHeadNode()
{
_LL_NODE* pHeadNode = m_Head;
_LL_NODE *pHeadNode = m_Head;
if (m_NodeC > 0)
{
@@ -87,11 +88,11 @@ LinkedList::_LL_NODE* LinkedList::RemoveHeadNode()
return pHeadNode;
}
void LinkedList::ClearList()
void LinkedList::ClearList()
{
while (true)
while (true)
{
_LL_NODE* pHeadNode = RemoveHeadNode();
_LL_NODE *pHeadNode = RemoveHeadNode();
if (!pHeadNode)
{
break;
+20 -22
View File
@@ -3,29 +3,27 @@
class LinkedList
{
public:
struct _LL_NODE
{
template <typename T>
T *GetDataAs()
{
return (T *)m_pvData;
}
void *m_pvData;
_LL_NODE *m_Next;
_LL_NODE *m_Prev;
};
struct _LL_NODE
{
template<typename T>
T* GetDataAs()
{
return (T*)m_pvData;
}
int m_NodeC;
_LL_NODE *m_Head;
_LL_NODE *m_Tail;
void* m_pvData;
_LL_NODE* m_Next;
_LL_NODE* m_Prev;
};
int m_NodeC;
_LL_NODE* m_Head;
_LL_NODE* m_Tail;
LinkedList();
void AddToHead(void* pvData);
void AddToTail(void* pvData);
void RemoveNode(_LL_NODE* pNodeToRemove);
_LL_NODE* RemoveHeadNode();
void ClearList();
LinkedList();
void AddToHead(void *pvData);
void AddToTail(void *pvData);
void RemoveNode(_LL_NODE *pNodeToRemove);
_LL_NODE *RemoveHeadNode();
void ClearList();
};