Skip to content

Commit

Permalink
Update to support UE 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
N7Alpha committed May 11, 2024
1 parent a147af3 commit f6f4c30
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ jobs:
- {major: 5, minor: 1}
- {major: 5, minor: 2}
- {major: 5, minor: 3}

- {major: 5, minor: 4}

steps:
- uses: actions/[email protected]

Expand Down
3 changes: 3 additions & 0 deletions Source/UnrealLibretro/Public/LibretroGameMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "HeadMountedDisplayFunctionLibrary.h"
#if ENGINE_MAJOR_VERSION == 5 \
&& ENGINE_MINOR_VERSION >= 1 \
&& ENGINE_MINOR_VERSION < 4 \
&& WITH_EDITOR
#include "Misc/MessageDialog.h"
#include "OpenXRInputSettings.h"
Expand Down Expand Up @@ -63,8 +64,10 @@ class UNREALLIBRETRO_API ALibretroGameMode : public AGameModeBase
SpawnParams.Owner = NewPlayer;
SpawnParams.Instigator = nullptr;

// @todo This check broke in 5.4 so I've disabled it. Check commit 8529eca in the UnrealEngine repo for how to fix
#if ENGINE_MAJOR_VERSION == 5 \
&& ENGINE_MINOR_VERSION >= 1 \
&& ENGINE_MINOR_VERSION < 4 \
&& WITH_EDITOR
UOpenXRInputSettings* OpenXRInputSettings = GetMutableDefault<UOpenXRInputSettings>();
if (OpenXRInputSettings && OpenXRInputSettings->MappableInputConfig != nullptr)
Expand Down
2 changes: 1 addition & 1 deletion Source/UnrealLibretro/Public/LibretroInputDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct FLibretroOptionDescription
{
GENERATED_BODY()

static CONSTEXPR int DefaultOptionIndex = 0; // By libretro convention
static constexpr int DefaultOptionIndex = 0; // By libretro convention

UPROPERTY(BlueprintReadOnly, Category = "Libretro")
FString Key;
Expand Down
18 changes: 15 additions & 3 deletions Source/UnrealLibretro/Public/LibretroVRPawn.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ class UNREALLIBRETRO_API ALibretroVRPawn : public APawn

MotionControllerLeft->MotionSource = "Left";
MotionControllerRight->MotionSource = "Right";

// Controllers not displayed on 5.4 @todo
#if ENGINE_MAJOR_VERSION < 5 \
|| ENGINE_MINOR_VERSION < 4
MotionControllerLeft->bDisplayDeviceModel = true;
MotionControllerRight->bDisplayDeviceModel = true;
#endif

#if ENGINE_MAJOR_VERSION > 4 \
|| ENGINE_MINOR_VERSION >= 26
Expand Down Expand Up @@ -139,7 +144,7 @@ class UNREALLIBRETRO_API ALibretroVRPawn : public APawn
decltype(MotionControllerLeftAim)& MotionControllerAim;
};

CONSTEXPR FHand GetHand(EControllerHand ControllerHand)
constexpr FHand GetHand(EControllerHand ControllerHand)
{
if (ControllerHand == EControllerHand::Left)
{
Expand All @@ -151,7 +156,7 @@ class UNREALLIBRETRO_API ALibretroVRPawn : public APawn
}
}

CONSTEXPR FHand GetOtherHand(EControllerHand ControllerHand)
constexpr FHand GetOtherHand(EControllerHand ControllerHand)
{
if (ControllerHand == EControllerHand::Left)
{
Expand All @@ -170,7 +175,14 @@ class UNREALLIBRETRO_API ALibretroVRPawn : public APawn
// Begin Play - Set Tracking Origin to floor
if (UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled())
{
UHeadMountedDisplayFunctionLibrary::SetTrackingOrigin(EHMDTrackingOrigin::Floor);
UHeadMountedDisplayFunctionLibrary::SetTrackingOrigin(
#if ENGINE_MAJOR_VERSION == 5 \
&& ENGINE_MINOR_VERSION >= 4
EHMDTrackingOrigin::LocalFloor
#else
EHMDTrackingOrigin::Floor
#endif
);
}
}

Expand Down

0 comments on commit f6f4c30

Please sign in to comment.