Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
574afdf
Experimenting Button Label
AL2009man Mar 4, 2025
07d193e
Create c-cpp.yml
AL2009man Mar 5, 2025
176bb62
Create cmake-multi-platform.yml
AL2009man Mar 5, 2025
9a181e0
Create apply-patch.yml
AL2009man Mar 5, 2025
90b35bc
removing the workflows
AL2009man Mar 5, 2025
4309183
Merge branch 'hedge-dev:main' into main
AL2009man Mar 6, 2025
bec2cf6
added experimental Steam Virtual Gamepad support
AL2009man Mar 6, 2025
ef4e37c
restoring notes for Button Labels.
AL2009man Mar 6, 2025
a8cac87
Merge branch 'hedge-dev:main' into SDL2-Steam
AL2009man Mar 6, 2025
c9b3a5e
Initial Gamepad Hotplug Logic improvements
AL2009man Mar 6, 2025
a96fc60
Lightbar detection when using multiple PlayStation controllers at the…
AL2009man Mar 7, 2025
458938c
Attempt to reduce Input leaking
AL2009man Mar 7, 2025
75dacf5
Lightbar active fix when gamepad plugged first prior to game launch
AL2009man Mar 7, 2025
f3ddd80
Revert "restoring notes for Button Labels."
AL2009man Mar 7, 2025
bd07101
Reapply "restoring notes for Button Labels."
AL2009man Mar 7, 2025
7291987
Moving all Gamepad Hotplug changes to separate branch
AL2009man Mar 7, 2025
d95aad2
Merge branch 'hedge-dev:main' into SteamVirtualGamepad-Prompts
AL2009man Mar 7, 2025
22b2ba8
added SDL's GameController naming convention as Fallback
AL2009man Mar 9, 2025
31b2544
Official device naming scheme for EInputDeviceExplicit
AL2009man Mar 9, 2025
df2f95c
spacing formatting fix
AL2009man Mar 9, 2025
50fc64f
Merge branch 'hedge-dev:main' into SteamVirtualGamepad-Prompts
AL2009man Mar 12, 2025
570fab6
remove "SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS" hint
AL2009man Mar 20, 2025
5a57de3
moved EInputDevice Unknown class to the top priority
AL2009man Mar 20, 2025
c77ce2b
Replacing EInputDeviceExplicit with SDL_GameControllerName
AL2009man Mar 20, 2025
95d4917
remove hid::GetInputDeviceName() from hid.ccp
AL2009man Mar 20, 2025
a404f16
Fix indentation
hyperbx Mar 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions UnleashedRecomp/hid/driver/sdl_hid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Controller

SDL_GameControllerType GetControllerType() const
{
return SDL_GameControllerTypeForIndex(index);
return SDL_GameControllerGetType(controller);
}

hid::EInputDevice GetInputDevice() const
Expand All @@ -49,9 +49,22 @@ class Controller
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;
}
}

const char* GetControllerName() const
{
auto result = SDL_GameControllerName(controller);

if (!result)
return "Unknown Device";

return hid::EInputDevice::Xbox;
return result;
}

void Close()
Expand Down Expand Up @@ -178,12 +191,21 @@ static void SetControllerInputDevice(Controller* controller)
hid::g_inputDeviceController = hid::g_inputDevice;

auto controllerType = (hid::EInputDeviceExplicit)controller->GetControllerType();
auto controllerName = controller->GetControllerName();

// Only proceed if the controller type changes.
if (hid::g_inputDeviceExplicit != controllerType)
{
hid::g_inputDeviceExplicit = controllerType;

LOGFN("Detected controller: {}", hid::GetInputDeviceName());
if (controllerType == hid::EInputDeviceExplicit::Unknown)
{
LOGFN("Detected controller: {} (Unknown Controller Type)", controllerName);
}
else
{
LOGFN("Detected controller: {}", controllerName);
}
}
}

Expand Down
56 changes: 0 additions & 56 deletions UnleashedRecomp/hid/hid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,59 +27,3 @@ bool hid::IsInputDeviceController()
return hid::g_inputDevice != hid::EInputDevice::Keyboard &&
hid::g_inputDevice != hid::EInputDevice::Mouse;
}

std::string hid::GetInputDeviceName()
{
switch (g_inputDevice)
{
case EInputDevice::Keyboard:
return "Keyboard";

case EInputDevice::Mouse:
return "Mouse";
}

switch (g_inputDeviceExplicit)
{
case EInputDeviceExplicit::Xbox360:
return "Xbox 360";

case EInputDeviceExplicit::XboxOne:
return "Xbox One";

case EInputDeviceExplicit::DualShock3:
return "DualShock 3";

case EInputDeviceExplicit::DualShock4:
return "DualShock 4";

case EInputDeviceExplicit::SwitchPro:
return "Nintendo Switch Pro";

case EInputDeviceExplicit::Virtual:
return "Virtual";

case EInputDeviceExplicit::DualSense:
return "DualSense";

case EInputDeviceExplicit::Luna:
return "Amazon Luna";

case EInputDeviceExplicit::Stadia:
return "Google Stadia";

case EInputDeviceExplicit::NvShield:
return "NVIDIA Shield";

case EInputDeviceExplicit::SwitchJCLeft:
return "Nintendo Switch Joy-Con (Left)";

case EInputDeviceExplicit::SwitchJCRight:
return "Nintendo Switch Joy-Con (Right)";

case EInputDeviceExplicit::SwitchJCPair:
return "Nintendo Switch Joy-Con (Pair)";
}

return "Unknown";
}
2 changes: 1 addition & 1 deletion UnleashedRecomp/hid/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace hid
{
enum class EInputDevice
{
Unknown,
Keyboard,
Mouse,
Xbox,
Expand Down Expand Up @@ -45,5 +46,4 @@ namespace hid
void SetProhibitedInputs(uint16_t wButtons = 0, bool leftStick = false, bool rightStick = false);
bool IsInputAllowed();
bool IsInputDeviceController();
std::string GetInputDeviceName();
}
Loading