More progress on prompt

This commit is contained in:
2026-05-04 15:27:28 -04:00
parent 9d37f02d44
commit 3e7e6a2ae4
10 changed files with 121 additions and 73 deletions

View File

@@ -14,6 +14,8 @@
#include "EnhancedInputComponent.h"
#include "Animation/AnimSequenceBase.h"
#include "GameFramework/Pawn.h"
#include "GameFramework/InputDeviceSubsystem.h"
#include "GameFramework/InputSettings.h"
#define LOCTEXT_NAMESPACE "Luprex Utility"
@@ -275,3 +277,23 @@ void UlxUtilityLibrary::ValidateLuaExpr(
FlxLockedWrapper w;
Status = w.ValidateLuaExpr(Code, ErrorMessage);
}
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;
}
FString DeviceName = Device.HardwareDeviceIdentifier.ToString();
if (DeviceName.Contains(TEXT("PS4")) || DeviceName.Contains(TEXT("PS5")) || DeviceName.Contains(TEXT("PlayStation")))
{
return ElxControllerType::PlayStationGamepad;
}
return ElxControllerType::XboxGamepad;
}