Skip to content

Commit

Permalink
Merge pull request #1000 from PlayEveryWare/feat/eosconfig-class-library
Browse files Browse the repository at this point in the history
feat: Introduce C# class library exposing `Config` related implementation.
  • Loading branch information
paulhazen authored Nov 7, 2024
2 parents bf26985 + 596efdb commit 9c6c20d
Show file tree
Hide file tree
Showing 13 changed files with 535 additions and 28 deletions.
54 changes: 30 additions & 24 deletions com.playeveryware.eos/Runtime/EOS_SDK/Core/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,51 +54,57 @@ namespace Epic.OnlineServices
// platform support.
public static partial class Config
{
// This conditional (added by PlayEveryWare) is here (in conjunction with
// the class it is contained within being marked as "partial") so that
// other platforms can be supported by adding to this code-base another
// part of the partial class that sets the LibraryName differently
// depending on the presence of other scripting defines that indicate
// available functionality on other platforms.
#if EOS_PLATFORM_WINDOWS_32 || EOS_PLATFORM_WINDOWS_64 || EOS_PLATFORM_OSX || EOS_PLATFORM_LINUX || EOS_PLATFORM_IOS || EOS_PLATFORM_ANDROID
// This conditional (added by PlayEveryWare) is here (in conjunction with
// the class it is contained within being marked as "partial") so that
// other platforms can be supported by adding to this code-base another
// part of the partial class that sets the LibraryName differently
// depending on the presence of other scripting defines that indicate
// available functionality on other platforms.
#if EOS_PLATFORM_WINDOWS_32 || EOS_PLATFORM_WINDOWS_64 || EOS_PLATFORM_OSX || EOS_PLATFORM_LINUX || EOS_PLATFORM_IOS || EOS_PLATFORM_ANDROID
public const string LibraryName =
#if EOS_PLATFORM_WINDOWS_32 && EOS_UNITY
#if EOS_PLATFORM_WINDOWS_32 && EOS_UNITY
"EOSSDK-Win32-Shipping"
#elif EOS_PLATFORM_WINDOWS_32
#elif EOS_PLATFORM_WINDOWS_32
"EOSSDK-Win32-Shipping.dll"

#elif EOS_PLATFORM_WINDOWS_64 && EOS_UNITY
#elif EOS_PLATFORM_WINDOWS_64 && EOS_UNITY
"EOSSDK-Win64-Shipping"
#elif EOS_PLATFORM_WINDOWS_64
#elif EOS_PLATFORM_WINDOWS_64
"EOSSDK-Win64-Shipping.dll"

#elif EOS_PLATFORM_OSX && EOS_UNITY
#elif EOS_PLATFORM_OSX && EOS_UNITY
"libEOSSDK-Mac-Shipping"
#elif EOS_PLATFORM_OSX
#elif EOS_PLATFORM_OSX
"libEOSSDK-Mac-Shipping.dylib"

#elif EOS_PLATFORM_LINUX && EOS_UNITY
#elif EOS_PLATFORM_LINUX && EOS_UNITY
"libEOSSDK-Linux-Shipping"
#elif EOS_PLATFORM_LINUX
#elif EOS_PLATFORM_LINUX
"libEOSSDK-Linux-Shipping.so"

#elif EOS_PLATFORM_IOS && EOS_UNITY && EOS_EDITOR
#elif EOS_PLATFORM_IOS && EOS_UNITY && EOS_EDITOR
"EOSSDK"
#elif EOS_PLATFORM_IOS
#elif EOS_PLATFORM_IOS
"EOSSDK.framework/EOSSDK"

#elif EOS_PLATFORM_ANDROID
#elif EOS_PLATFORM_ANDROID
"EOSSDK"

#else
#error Unable to determine the name of the EOSSDK library. Ensure you have set the correct EOS compilation symbol for the current platform, such as EOS_PLATFORM_WINDOWS_32 or EOS_PLATFORM_WINDOWS_64, so that the correct EOSSDK library can be targeted.
#else
#error Unable to determine the name of the EOSSDK library. Ensure you have set the correct EOS compilation symbol for the current platform, such as EOS_PLATFORM_WINDOWS_32 or EOS_PLATFORM_WINDOWS_64, so that the correct EOSSDK library can be targeted.
"EOSSDK-UnknownPlatform-Shipping"

#endif
#endif
;
#endif
// PEW: End modify
public const CallingConvention LibraryCallingConvention =
#elif EXTERNAL_TO_UNITY
#if PLATFORM_64
public const string LibraryName = "EOSSDK-Win64-Shipping.dll";
#else
public const string LibraryName = "EOSSDK-Win32-Shipping.dll";
#endif
#endif
// PEW: End modify
public const CallingConvention LibraryCallingConvention =
#if EOS_PLATFORM_WINDOWS_32
CallingConvention.StdCall
#else
Expand Down
10 changes: 10 additions & 0 deletions com.playeveryware.eos/Runtime/EOS_SDK/Core/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,16 @@ private static IntPtr AddPinnedBuffer(Utf8String str)
return AddPinnedBuffer(str.Bytes, 0);
}

// PEW: Start Modify
// This function is added because this file is included in a class
// library with a lower supported version of C# that does not allow a
// byte array to be automatically converted into an ArraySegment
internal static IntPtr AddPinnedBuffer(byte[] array)
{
return array == null ? IntPtr.Zero : AddPinnedBuffer(new ArraySegment<byte>(array));
}
// PEW: End Modify

internal static IntPtr AddPinnedBuffer(ArraySegment<byte> array)
{
if (array == null)
Expand Down
2 changes: 2 additions & 0 deletions lib/NativeCode/DynamicLibraryLoaderHelper/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Exclude nuget packages
packages/*
Build/*
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<Project>
<PropertyGroup>
<OutputUnityAssetsDirectory>$(SolutionDir)..\..\..\Assets\Plugins\Windows\$(Platform)\</OutputUnityAssetsDirectory>
<!-- Define a property with the SolutionDir path but with backslashes replaced by forward slashes -->
<SolutionDirForwardSlashes>$(SolutionDir.Replace('\', '/'))</SolutionDirForwardSlashes>
<UnityStreamingAssetsDirectory>$(SolutionDirForwardSlashes)../../../Assets/StreamingAssets/</UnityStreamingAssetsDirectory>
<OutputUnityAssetsDirectory>$(SolutionDirForwardSlashes)../../../Assets/Plugins/Windows/$(Platform)/</OutputUnityAssetsDirectory>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34408.163
# Visual Studio Version 16
VisualStudioVersion = 16.0.31025.194
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DynamicLibraryLoaderHelper", "DynamicLibraryLoaderHelper\DynamicLibraryLoaderHelper.vcxproj", "{3C24168C-C23B-4F82-9E8D-15B900621C93}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GfxPluginNativeRender", "NativeRender\NativeRender.vcxproj", "{251D4477-4C90-4FE1-94A2-52377327D3B2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EOSPluginConfig", "EOSPluginConfig\EOSPluginConfig.csproj", "{7C3CF875-0B42-493F-958B-9D068C8EF018}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleApplication", "ConsoleApplication\ConsoleApplication.vcxproj", "{D7462EAF-0024-4EA5-9D89-DBBBC7766333}"
EndProject
Global
Expand All @@ -33,6 +35,14 @@ Global
{251D4477-4C90-4FE1-94A2-52377327D3B2}.Release|x64.Build.0 = Release|x64
{251D4477-4C90-4FE1-94A2-52377327D3B2}.Release|x86.ActiveCfg = Release|Win32
{251D4477-4C90-4FE1-94A2-52377327D3B2}.Release|x86.Build.0 = Release|Win32
{7C3CF875-0B42-493F-958B-9D068C8EF018}.Debug|x64.ActiveCfg = Debug|x64
{7C3CF875-0B42-493F-958B-9D068C8EF018}.Debug|x64.Build.0 = Debug|x64
{7C3CF875-0B42-493F-958B-9D068C8EF018}.Debug|x86.ActiveCfg = Debug|Win32
{7C3CF875-0B42-493F-958B-9D068C8EF018}.Debug|x86.Build.0 = Debug|Win32
{7C3CF875-0B42-493F-958B-9D068C8EF018}.Release|x64.ActiveCfg = Release|x64
{7C3CF875-0B42-493F-958B-9D068C8EF018}.Release|x64.Build.0 = Release|x64
{7C3CF875-0B42-493F-958B-9D068C8EF018}.Release|x86.ActiveCfg = Release|Win32
{7C3CF875-0B42-493F-958B-9D068C8EF018}.Release|x86.Build.0 = Release|Win32
{D7462EAF-0024-4EA5-9D89-DBBBC7766333}.Debug|x64.ActiveCfg = Debug|x64
{D7462EAF-0024-4EA5-9D89-DBBBC7766333}.Debug|x64.Build.0 = Debug|x64
{D7462EAF-0024-4EA5-9D89-DBBBC7766333}.Debug|x86.ActiveCfg = Debug|Win32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<ProjectGuid>{3C24168C-C23B-4F82-9E8D-15B900621C93}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>DynamicLibraryLoaderHelper</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<!-- Consolidated Configuration Groups -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Debug/*
Release/*
x64/*
x32/*
bin/
obj/
config.json
Newtonsoft.Json.dll
Newtonsoft.Json.xml
Loading

0 comments on commit 9c6c20d

Please sign in to comment.