More work on Prompt Widget

This commit is contained in:
2026-05-07 04:11:37 -04:00
parent b5e121f884
commit 236693fca6
7 changed files with 193 additions and 37 deletions

View File

@@ -283,17 +283,12 @@ ElxControllerType UlxUtilityLibrary::DetectControllerType(ULocalPlayer *Player)
UInputDeviceSubsystem *IDS = GEngine->GetEngineSubsystem<UInputDeviceSubsystem>();
if (!IDS) return ElxControllerType::KeyboardMouse;
FHardwareDeviceIdentifier Device = IDS->GetMostRecentlyUsedHardwareDevice(Player->GetPlatformUserId());
if (Device.PrimaryDeviceType != EHardwareDevicePrimaryType::Gamepad)
{
return ElxControllerType::KeyboardMouse;
}
FName Id = IDS->GetMostRecentlyUsedHardwareDevice(Player->GetPlatformUserId()).HardwareDeviceIdentifier;
FString DeviceName = Device.HardwareDeviceIdentifier.ToString();
if (DeviceName.Contains(TEXT("PS4")) || DeviceName.Contains(TEXT("PS5")) || DeviceName.Contains(TEXT("PlayStation")))
{
return ElxControllerType::PlayStationGamepad;
}
return ElxControllerType::XboxGamepad;
if (Id == TEXT("ps3") || Id == TEXT("ps4") || Id == TEXT("ps5")) return ElxControllerType::PlayStationGamepad;
if (Id == TEXT("xbox360") || Id == TEXT("xboxone")) return ElxControllerType::XboxGamepad;
// Unknown or unrecognized device — assume keyboard/mouse
return ElxControllerType::KeyboardMouse;
}