From da38d6ac0b3a607c8b5324316a7a0e1a328ef7f3 Mon Sep 17 00:00:00 2001 From: Jskt02 Date: Wed, 28 May 2025 13:32:38 -0600 Subject: [PATCH 1/2] EOS Disable and Bindings Fix --- Editor/EditorWindows/EncryptionKeyWindow.cs | 39 ++++++++----- Editor/EditorWindows/ModalEOSEditorWindow.cs | 4 +- Runtime/Core/EOSManager.cs | 22 ++++---- Runtime/EOS_SDK/Generated/Bindings.cs | 59 +++++++++++--------- 4 files changed, 71 insertions(+), 53 deletions(-) diff --git a/Editor/EditorWindows/EncryptionKeyWindow.cs b/Editor/EditorWindows/EncryptionKeyWindow.cs index ab7fa4e7..56f147c2 100644 --- a/Editor/EditorWindows/EncryptionKeyWindow.cs +++ b/Editor/EditorWindows/EncryptionKeyWindow.cs @@ -48,12 +48,16 @@ public EncryptionKeyWindow() : base("Client Credential Encryption Key", 600f, 50 /// public static void Show(string input, Action onSubmitCallback) { - ScheduleShow( - input, - onSubmitCallback, - EOSClientCredentials.IsEncryptionKeyValid, - "Enter the encryption key for these client credentials here:", - "Invalid encryption key. Encryption key must be 64 characters long and contain only alphanumeric characters."); +#if !EOS_DISABLE + ScheduleShow( + input, + onSubmitCallback, + EOSClientCredentials.IsEncryptionKeyValid, + "Enter the encryption key for these client credentials here:", + "Invalid encryption key. Encryption key must be 64 characters long and contain only alphanumeric characters."); +#else + Debug.LogWarning("EOS SDK is disabled. Encryption key window is not available."); +#endif } /// @@ -63,16 +67,25 @@ protected override void RenderModalContents() { GUILayout.BeginHorizontal(); - _input = GUILayout.TextField(_input, GUILayout.Width(GUIEditorUtility.MeasureLabelWidth(64)), GUILayout.Height(20)); + _input = GUILayout.TextField( + _input, + GUILayout.Width(EditorStyles.label.CalcSize(new GUIContent("Encryption Key")).x), + GUILayout.Height(20)); GUILayout.Space(5f); - if (GUILayout.Button( - new GUIContent(EditorGUIUtility.IconContent("Refresh").image, - "Click here to generate a new encryption key."), GUILayout.Height(20), GUILayout.Width(50))) - { - _input = EOSClientCredentials.GenerateEncryptionKey(); - } +#if !EOS_DISABLE + if (GUILayout.Button( + new GUIContent(EditorGUIUtility.IconContent("Refresh").image, + "Click here to generate a new encryption key."), + GUILayout.Height(20), GUILayout.Width(50))) + { + _input = EOSClientCredentials.GenerateEncryptionKey(); + } +#else + GUILayout.Label("EOS SDK is disabled."); +#endif + GUILayout.EndHorizontal(); } } diff --git a/Editor/EditorWindows/ModalEOSEditorWindow.cs b/Editor/EditorWindows/ModalEOSEditorWindow.cs index 5e883bc2..3640468e 100644 --- a/Editor/EditorWindows/ModalEOSEditorWindow.cs +++ b/Editor/EditorWindows/ModalEOSEditorWindow.cs @@ -189,9 +189,7 @@ protected override void RenderWindow() bool shouldClose = false; // Render the prompt text - EditorGUILayout.LabelField(_inputPrompt, GUILayout.Width( - GUIEditorUtility.MeasureLabelWidth(_inputPrompt)) - ); + EditorGUILayout.LabelField(_inputPrompt, GUILayout.Width(EditorStyles.label.CalcSize(new GUIContent(_inputPrompt)).x)); // Display error if it needs to be displayed. if (_showError) diff --git a/Runtime/Core/EOSManager.cs b/Runtime/Core/EOSManager.cs index c39d856b..c9302f35 100644 --- a/Runtime/Core/EOSManager.cs +++ b/Runtime/Core/EOSManager.cs @@ -184,17 +184,7 @@ enum EOSState static private bool s_isConstrained = true; static public bool ApplicationIsConstrained { get => s_isConstrained; } - /// - /// Actions that need to be executed on the main thread. - /// Lazy allocated in . - /// - private static List s_enqueuedTasks; - /// - /// Locak object used for , such that it can - /// be executed thread-safe way. - /// - private static System.Object s_enqueuedTasksLock = new System.Object(); //private static List //------------------------------------------------------------------------- @@ -1844,6 +1834,18 @@ static public EOSSingleton Instance } } + /// + /// Actions that need to be executed on the main thread. + /// Lazy allocated in . + /// + private static List s_enqueuedTasks; + + /// + /// Locak object used for , such that it can + /// be executed thread-safe way. + /// + private static System.Object s_enqueuedTasksLock = new System.Object(); + #if !EOS_DISABLE //------------------------------------------------------------------------- /// Unity [Awake](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Awake.html) is called when script instance is being loaded. diff --git a/Runtime/EOS_SDK/Generated/Bindings.cs b/Runtime/EOS_SDK/Generated/Bindings.cs index cf93bb7b..01708557 100644 --- a/Runtime/EOS_SDK/Generated/Bindings.cs +++ b/Runtime/EOS_SDK/Generated/Bindings.cs @@ -2,59 +2,62 @@ // This file is automatically generated. Changes to this file may be overwritten. #if DEBUG - #define EOS_DEBUG +#define EOS_DEBUG #endif #if UNITY_EDITOR - #define EOS_EDITOR +#define EOS_EDITOR #endif #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_PS4 || UNITY_XBOXONE || UNITY_SWITCH || UNITY_IOS || UNITY_ANDROID - #define EOS_UNITY +#define EOS_UNITY #endif #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || PLATFORM_64BITS || PLATFORM_32BITS - #if UNITY_EDITOR_WIN || UNITY_64 || PLATFORM_64BITS - #define EOS_PLATFORM_WINDOWS_64 - #else - #define EOS_PLATFORM_WINDOWS_32 - #endif +#if UNITY_EDITOR_WIN || UNITY_64 || PLATFORM_64BITS +#define EOS_PLATFORM_WINDOWS_64 +#else +#define EOS_PLATFORM_WINDOWS_32 +#endif #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX - #define EOS_PLATFORM_OSX +#define EOS_PLATFORM_OSX + +#elif UNITY_EDITOR_OSX +#define EOS_PLATFORM_OSX_INEDITOR #elif UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX - #define EOS_PLATFORM_LINUX +#define EOS_PLATFORM_LINUX #elif UNITY_PS4 - #define EOS_PLATFORM_PS4 +#define EOS_PLATFORM_PS4 #elif UNITY_XBOXONE - #define EOS_PLATFORM_XBOXONE +#define EOS_PLATFORM_XBOXONE #elif UNITY_SWITCH - #define EOS_PLATFORM_SWITCH +#define EOS_PLATFORM_SWITCH #elif UNITY_IOS || __IOS__ - #define EOS_PLATFORM_IOS +#define EOS_PLATFORM_IOS #elif UNITY_ANDROID || __ANDROID__ - #define EOS_PLATFORM_ANDROID +#define EOS_PLATFORM_ANDROID #endif #if EOS_EDITOR - #define EOS_DYNAMIC_BINDINGS +#define EOS_DYNAMIC_BINDINGS #endif #if EOS_DYNAMIC_BINDINGS - #if EOS_PLATFORM_WINDOWS_32 - #define EOS_DYNAMIC_BINDINGS_NAME_TYPE3 - #elif EOS_PLATFORM_OSX - #define EOS_DYNAMIC_BINDINGS_NAME_TYPE2 - #else - #define EOS_DYNAMIC_BINDINGS_NAME_TYPE1 - #endif +#if EOS_PLATFORM_WINDOWS_32 +#define EOS_DYNAMIC_BINDINGS_NAME_TYPE3 +#elif EOS_PLATFORM_OSX +#define EOS_DYNAMIC_BINDINGS_NAME_TYPE2 +#else +#define EOS_DYNAMIC_BINDINGS_NAME_TYPE1 +#endif #endif using System; @@ -2141,9 +2144,11 @@ public static void Hook(TLibraryHandle libraryHandle, Func(TLibraryHandle libraryHandle, Func - /// Unhooks the dynamic SDK API bindings. EOS_DYNAMIC_BINDINGS or EOS_EDITOR must be set. - /// - public static void Unhook() + /// + /// Unhooks the dynamic SDK API bindings. EOS_DYNAMIC_BINDINGS or EOS_EDITOR must be set. + /// + public static void Unhook() { EOS_Achievements_AddNotifyAchievementsUnlocked = null; EOS_Achievements_AddNotifyAchievementsUnlockedV2 = null; From 9e196a0d47a5e1abad21ba80bceabf87e28c56d0 Mon Sep 17 00:00:00 2001 From: Jskt02 Date: Thu, 12 Jun 2025 17:36:21 -0600 Subject: [PATCH 2/2] Update Config.cs --- Runtime/EOS_SDK/Core/Config.cs | 54 +++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/Runtime/EOS_SDK/Core/Config.cs b/Runtime/EOS_SDK/Core/Config.cs index 34046f39..19903ef6 100644 --- a/Runtime/EOS_SDK/Core/Config.cs +++ b/Runtime/EOS_SDK/Core/Config.cs @@ -46,45 +46,65 @@ namespace Epic.OnlineServices { - public static class Config + // PEW: Start Modify + // The partial attribute (added by PlayEveryWare) is the least intrusive + // means by which the following class can be expanded to support additional + // platforms. By making the class partial, supplementary partial + // class definition files can be added to the codebase that will expand + // 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 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 ; - - 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