From 017c63f52c7808cac4c2da079bb3da894a500b1e Mon Sep 17 00:00:00 2001 From: Sean Devonport Date: Fri, 4 Mar 2022 16:36:47 +0200 Subject: [PATCH 1/3] feat: updates for UE5 preview --- Source/Managed/Framework/Framework.cs | 32 +++++++++++++++++-- .../UnrealCLR/Private/UnrealCLRFramework.cpp | 30 +++++++++++++++-- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/Source/Managed/Framework/Framework.cs b/Source/Managed/Framework/Framework.cs index 1b211cd2..7c37e398 100644 --- a/Source/Managed/Framework/Framework.cs +++ b/Source/Managed/Framework/Framework.cs @@ -633,6 +633,8 @@ public enum ControllerHand : byte { /// Gun, /// + HMD, + /// Special1, /// Special2, @@ -901,7 +903,33 @@ public enum PixelFormat : int { /// ETC2RG11EAC = 70, /// - R8 = 71 + R8 = 71, + /// + B5G5R5A1UNorm = 72, + /// + ASTC4x4HDR = 73, + /// + ASTC6x6HDR = 74, + /// + ASTC8x8HDR = 75, + /// + ASTC10x10HDR = 76, + /// + ASTC12x12HDR = 77, + /// + G16R16SNorm = 78, + /// + R8G8UInt = 79, + /// + R32G32B32UInt = 80, + /// + R32G32B32SInt = 81, + /// + R32G32B32F = 82, + /// + R8SInt = 83, + /// + R64UInt = 84, } /// @@ -1710,7 +1738,7 @@ public partial struct Bounds : IEquatable { /// /// Returns the radius of the bounding sphere /// - public float SphereRadius => sphereRadius; + public double SphereRadius => sphereRadius; /// /// Tests for equality between two objects diff --git a/Source/Native/Source/UnrealCLR/Private/UnrealCLRFramework.cpp b/Source/Native/Source/UnrealCLR/Private/UnrealCLRFramework.cpp index 4024fab5..7015bec8 100644 --- a/Source/Native/Source/UnrealCLR/Private/UnrealCLRFramework.cpp +++ b/Source/Native/Source/UnrealCLR/Private/UnrealCLRFramework.cpp @@ -384,6 +384,9 @@ namespace UnrealCLRFramework { #define UNREALCLR_COLOR_TO_INTEGER(Color) (Color.A << 24) + (Color.R << 16) + (Color.G << 8) + Color.B #if ENGINE_MAJOR_VERSION == 4 + #define UNREALCLR_CONTROLLER_HAND 17 + #define UNREALCLR_BOUNDS_SIZE 28 + #if ENGINE_MINOR_VERSION <= 26 #define UNREALCLR_BLEND_TYPE 5 #elif ENGINE_MINOR_VERSION >= 27 @@ -396,20 +399,37 @@ namespace UnrealCLRFramework { #define UNREALCLR_PIXEL_FORMAT 72 #endif #elif ENGINE_MAJOR_VERSION == 5 - #define UNREALCLR_PIXEL_FORMAT 72 #define UNREALCLR_BLEND_TYPE 6 + #define UNREALCLR_PIXEL_FORMAT 85 + #define UNREALCLR_CONTROLLER_HAND 18 + + // Large World Coordinates changed to double sphere radius to double but will be refactored to double in UE5 stable release. + // Currently this is aliased to FLargeWorldCoordinatesReal. Check Engine\Source\Runtime\CoreUObject\Public\UObject\NoExportTypes.h for FVector where it explains. + #define UNREALCLR_BOUNDS_SIZE 56 + + #ifdef BRANCH_NAME + // There may be a better way to get this information + #ifdef BRANCH_NAME == "++UE5+Release-5.0-EarlyAccess" + #define UNREALCLR_PIXEL_FORMAT 72 + #else + #define UNREALCLR_PIXEL_FORMAT 85 + #endif + #else + #define UNREALCLR_PIXEL_FORMAT 85 + #endif + #endif static_assert(AudioFadeCurve::Count == AudioFadeCurve(4), "Invalid elements count of the [AudioFadeCurve] enumeration"); static_assert(BlendType::VTBlend_MAX == BlendType(UNREALCLR_BLEND_TYPE), "Invalid elements count of the [BlendType] enumeration"); static_assert(CollisionChannel::ECC_MAX == CollisionChannel(33), "Invalid elements count of the [CollisionChannel] enumeration"); static_assert(CollisionResponse::ECR_MAX == CollisionResponse(3), "Invalid elements count of the [CollisionResponse] enumeration"); - static_assert(ControllerHand::ControllerHand_Count == ControllerHand(17), "Invalid elements count of the [ControllerHand] enumeration"); + static_assert(ControllerHand::ControllerHand_Count == ControllerHand(UNREALCLR_CONTROLLER_HAND), "Invalid elements count of the [ControllerHand] enumeration"); static_assert(InputEvent::IE_MAX == InputEvent(5), "Invalid elements count of the [InputEvent] enumeration"); static_assert(NetMode::NM_MAX == NetMode(4), "Invalid elements count of the [NetMode] enumeration"); static_assert(PixelFormat::PF_MAX == PixelFormat(UNREALCLR_PIXEL_FORMAT), "Invalid elements count of the [PixelFormat] enumeration"); - static_assert(sizeof(Bounds) == 28, "Invalid size of the [Bounds] structure"); + static_assert(sizeof(Bounds) == UNREALCLR_BOUNDS_SIZE, "Invalid size of the [Bounds] structure"); static_assert(sizeof(CollisionShape) == 16, "Invalid size of the [CollisionShape] structure"); namespace Assert { @@ -982,7 +1002,11 @@ namespace UnrealCLRFramework { namespace Engine { bool IsSplitScreen() { +#if ENGINE_MAJOR_VERSION >= 5 + return GEngine->HasMultipleLocalPlayers(UnrealCLR::Engine::World); +#else return GEngine->IsSplitScreen(UnrealCLR::Engine::World); +#endif } bool IsEditor() { From 27cb490a9560325ab7b0cc9f94bc7d25c592e55c Mon Sep 17 00:00:00 2001 From: Sean Devonport Date: Fri, 4 Mar 2022 16:37:16 +0200 Subject: [PATCH 2/3] docs: update docs for UE5 Preview changes --- API/Bounds-SphereRadius.md | 2 +- API/ControllerHand.md | 30 ++++++++++++----------- API/PixelFormat.md | 50 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 15 deletions(-) diff --git a/API/Bounds-SphereRadius.md b/API/Bounds-SphereRadius.md index 769d27d8..c8fcf990 100644 --- a/API/Bounds-SphereRadius.md +++ b/API/Bounds-SphereRadius.md @@ -2,7 +2,7 @@ ## Bounds.SphereRadius Property Returns the radius of the bounding sphere ```csharp -public float SphereRadius { get; } +public double SphereRadius { get; } ``` #### Property Value [System.Single](https://docs.microsoft.com/en-us/dotnet/api/System.Single 'System.Single') diff --git a/API/ControllerHand.md b/API/ControllerHand.md index c98afec2..8b211749 100644 --- a/API/ControllerHand.md +++ b/API/ControllerHand.md @@ -27,49 +27,51 @@ public enum ControllerHand : System.Byte `Gun` 5 + + + +`HMD` 6 - + -`Special1` 6 +`Special1` 7 -`Special2` 7 +`Special2` 8 -`Special3` 8 +`Special3` 9 -`Special4` 9 +`Special4` 10 -`Special5` 10 +`Special5` 11 -`Special6` 11 +`Special6` 12 -`Special7` 12 +`Special7` 13 -`Special8` 13 +`Special8` 14 -`Special9` 14 +`Special9` 15 -`Special10` 15 +`Special10` 16 -`Special11` 16 - - +`Special11` 17 \ No newline at end of file diff --git a/API/PixelFormat.md b/API/PixelFormat.md index dbe7d72a..cfd0da7c 100644 --- a/API/PixelFormat.md +++ b/API/PixelFormat.md @@ -291,5 +291,55 @@ public enum PixelFormat `R8` 71 + + + +`B5G5R5A1UNorm` 72 + +`ASTC4x4HDR` 73 + + + +`ASTC6x6HDR` 74 + + + +`ASTC8x8HDR` 75 + + + +`ASTC10x10HDR` 76 + + + +`ASTC12x12HDR` 77 + + + +`G16R16SNorm` 78 + + + +`R8G8UInt` 79 + + + +`R32G32B32UInt` 80 + + + +`R32G32B32SInt` 81 + + + +`R32G32B32F` 82 + + + +`R8SInt` 83 + + + +`R64UInt` 84 From 8b6bf23fb75e5cddf773cc00ce8d2e7ece204064 Mon Sep 17 00:00:00 2001 From: Sean Devonport Date: Fri, 4 Mar 2022 22:25:02 +0200 Subject: [PATCH 3/3] fix: typo in commit --- Source/Native/Source/UnrealCLR/Private/UnrealCLRFramework.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Native/Source/UnrealCLR/Private/UnrealCLRFramework.cpp b/Source/Native/Source/UnrealCLR/Private/UnrealCLRFramework.cpp index 7015bec8..6360d71e 100644 --- a/Source/Native/Source/UnrealCLR/Private/UnrealCLRFramework.cpp +++ b/Source/Native/Source/UnrealCLR/Private/UnrealCLRFramework.cpp @@ -403,7 +403,7 @@ namespace UnrealCLRFramework { #define UNREALCLR_PIXEL_FORMAT 85 #define UNREALCLR_CONTROLLER_HAND 18 - // Large World Coordinates changed to double sphere radius to double but will be refactored to double in UE5 stable release. + // Large World Coordinates changed float sphere radius to double but this will be refactored to double in UE5 stable release. // Currently this is aliased to FLargeWorldCoordinatesReal. Check Engine\Source\Runtime\CoreUObject\Public\UObject\NoExportTypes.h for FVector where it explains. #define UNREALCLR_BOUNDS_SIZE 56