Skip to content

Commit

Permalink
Finished initial work on PlayStation->GameInput translation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaldaien committed Nov 28, 2024
1 parent 2795d5d commit 021d8b6
Show file tree
Hide file tree
Showing 4 changed files with 786 additions and 89 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
24.11.28.4
24.11.28.5
==========
+ Implemented PlayStation->GameInput translation for DualShock 3/4 and
DualSense controllers over USB and Bluetooth (DS4/DualSense only).
+ Removed warning about needing DS4Windows in GameInput games.

24.11.28.4
==========
+ Implement haptic/rumble blocking support for GameInput; S.T.A.L.K.E.R. 2
uses impulse triggers, so next step is to translate those to DualSense.
Expand Down
4 changes: 2 additions & 2 deletions include/SpecialK/DLL_VERSION.H
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#define SK_YEAR 24
#define SK_MONTH 11
#define SK_DATE 28
#define SK_REV_N 4
#define SK_REV 4
#define SK_REV_N 5
#define SK_REV 5

#ifndef _A2
#define _A2(a) #a
Expand Down
54 changes: 52 additions & 2 deletions include/SpecialK/input/game_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ class SK_IWrapGameInput : IGameInput
};


class SK_IWrapGameInputDevice : IGameInputDevice
class SK_IGameInputDevice : IGameInputDevice
{
public:
SK_IWrapGameInputDevice (IGameInputDevice *pGameInputDevice) : pReal (pGameInputDevice),
SK_IGameInputDevice (IGameInputDevice *pGameInputDevice) : pReal (pGameInputDevice),
ver_ (0)
{
if (pGameInputDevice == nullptr)
Expand Down Expand Up @@ -222,6 +222,56 @@ class SK_IWrapGameInputReading : IGameInputReading
unsigned int ver_ = 0;
};

class SK_IPlayStationGameInputReading : IGameInputReading
{
public:
SK_IPlayStationGameInputReading (HANDLE hDeviceFile) : hDevice (hDeviceFile),
ver_ (0)
{
};

#pragma region IUnknown
virtual HRESULT __stdcall QueryInterface (REFIID riid, void **ppvObject) noexcept override;
virtual ULONG __stdcall AddRef (void) noexcept override;
virtual ULONG __stdcall Release (void) noexcept override;
#pragma endregion

#pragma region IGameInputReading
virtual GameInputKind __stdcall GetInputKind (void) noexcept override;
virtual uint64_t __stdcall GetSequenceNumber (GameInputKind inputKind) noexcept override;
virtual uint64_t __stdcall GetTimestamp (void) noexcept override;
virtual void __stdcall GetDevice (IGameInputDevice **device) noexcept override;
virtual bool __stdcall GetRawReport (IGameInputRawDeviceReport **report) noexcept override;
virtual uint32_t __stdcall GetControllerAxisCount (void) noexcept override;
virtual uint32_t __stdcall GetControllerAxisState (uint32_t stateArrayCount,
float *stateArray) noexcept override;
virtual uint32_t __stdcall GetControllerButtonCount (void) noexcept override;
virtual uint32_t __stdcall GetControllerButtonState (uint32_t stateArrayCount,
bool *stateArray) noexcept override;
virtual uint32_t __stdcall GetControllerSwitchCount (void) noexcept override;
virtual uint32_t __stdcall GetControllerSwitchState (uint32_t stateArrayCount,
GameInputSwitchPosition *stateArray) noexcept override;
virtual uint32_t __stdcall GetKeyCount (void) noexcept override;
virtual uint32_t __stdcall GetKeyState (uint32_t stateArrayCount,
GameInputKeyState *stateArray) noexcept override;
virtual bool __stdcall GetMouseState (GameInputMouseState *state) noexcept override;
virtual uint32_t __stdcall GetTouchCount (void) noexcept override;
virtual uint32_t __stdcall GetTouchState (uint32_t stateArrayCount,
GameInputTouchState *stateArray) noexcept override;
virtual bool __stdcall GetMotionState (GameInputMotionState *state) noexcept override;
virtual bool __stdcall GetArcadeStickState (GameInputArcadeStickState *state) noexcept override;
virtual bool __stdcall GetFlightStickState (GameInputFlightStickState *state) noexcept override;
virtual bool __stdcall GetGamepadState (GameInputGamepadState *state) noexcept override;
virtual bool __stdcall GetRacingWheelState (GameInputRacingWheelState *state) noexcept override;
virtual bool __stdcall GetUiNavigationState (GameInputUiNavigationState *state) noexcept override;
#pragma endregion

private:
volatile LONG refs_ = 1;
HANDLE hDevice;
unsigned int ver_ = 0;
};

void SK_Input_HookGameInput (void);

#endif /* __SK__GAME_INPUT_H__ */
Loading

0 comments on commit 021d8b6

Please sign in to comment.