mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-04-28 13:27:58 +03:00
added experimental Steam Virtual Gamepad support
This commit is contained in:
parent
43091838af
commit
bec2cf65ba
2 changed files with 16 additions and 8 deletions
|
@ -38,20 +38,23 @@ public:
|
|||
|
||||
SDL_GameControllerType GetControllerType() const
|
||||
{
|
||||
return SDL_GameControllerTypeForIndex(index);
|
||||
return SDL_GameControllerGetType(controller);
|
||||
}
|
||||
|
||||
hid::EInputDevice GetInputDevice() const
|
||||
{
|
||||
switch (GetControllerType())
|
||||
{
|
||||
case SDL_CONTROLLER_TYPE_PS3:
|
||||
case SDL_CONTROLLER_TYPE_PS4:
|
||||
case SDL_CONTROLLER_TYPE_PS5:
|
||||
return hid::EInputDevice::PlayStation;
|
||||
case SDL_CONTROLLER_TYPE_PS3:
|
||||
case SDL_CONTROLLER_TYPE_PS4:
|
||||
case SDL_CONTROLLER_TYPE_PS5:
|
||||
return hid::EInputDevice::PlayStation;
|
||||
case SDL_CONTROLLER_TYPE_XBOX360:
|
||||
case SDL_CONTROLLER_TYPE_XBOXONE:
|
||||
return hid::EInputDevice::Xbox;
|
||||
default:
|
||||
return hid::EInputDevice::Unknown;
|
||||
}
|
||||
|
||||
return hid::EInputDevice::Xbox;
|
||||
}
|
||||
|
||||
void Close()
|
||||
|
@ -134,6 +137,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
std::array<Controller, 4> g_controllers;
|
||||
Controller* g_activeController;
|
||||
|
||||
|
@ -310,6 +314,8 @@ void hid::Init()
|
|||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1");
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_WII, "1");
|
||||
SDL_SetHint(SDL_HINT_XINPUT_ENABLED, "1");
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_STEAM, "1");
|
||||
|
||||
SDL_SetHint(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, "0");
|
||||
|
||||
SDL_InitSubSystem(SDL_INIT_EVENTS);
|
||||
|
@ -318,6 +324,7 @@ void hid::Init()
|
|||
SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||
}
|
||||
|
||||
|
||||
uint32_t hid::GetState(uint32_t dwUserIndex, XAMINPUT_STATE* pState)
|
||||
{
|
||||
static uint32_t packet;
|
||||
|
|
|
@ -7,7 +7,8 @@ namespace hid
|
|||
Keyboard,
|
||||
Mouse,
|
||||
Xbox,
|
||||
PlayStation
|
||||
PlayStation,
|
||||
Unknown
|
||||
};
|
||||
|
||||
enum class EInputDeviceExplicit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue