From d34b172d87a929f16df48d7af7239ee982be9844 Mon Sep 17 00:00:00 2001 From: "p.shestakov" <0xShestakov@gmail.com> Date: Sun, 5 May 2024 21:27:33 +0300 Subject: [PATCH 1/3] added ability to disable auto-fix process over scripting defines --- .../Editor/RedistInstall.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/com.rlabrecque.steamworks.net/Editor/RedistInstall.cs b/com.rlabrecque.steamworks.net/Editor/RedistInstall.cs index 8e02ecec..a16b5693 100644 --- a/com.rlabrecque.steamworks.net/Editor/RedistInstall.cs +++ b/com.rlabrecque.steamworks.net/Editor/RedistInstall.cs @@ -10,10 +10,30 @@ // This copies various files into their required locations when Unity is launched to make installation a breeze. [InitializeOnLoad] public class RedistInstall { + + const string STEAMWORKS_AUTOFIX_DISABLED_MENU_ITEM = "Steamworks.NET/Disable Autofix"; + const string STEAMWORKS_AUTOFIX_DISABLED = "STEAMWORKS_AUTOFIX_DISABLED"; + + [MenuItem(STEAMWORKS_AUTOFIX_DISABLED_MENU_ITEM)] + static void SwitchAutofixDisabled() { + var autofixDisabled = !IsAutofixDisabled(); + EditorPrefs.SetBool(STEAMWORKS_AUTOFIX_DISABLED, autofixDisabled); + UpdateMenuItems(); + } + + static bool IsAutofixDisabled(){ + return EditorPrefs.GetBool(STEAMWORKS_AUTOFIX_DISABLED, false); + } + + static void UpdateMenuItems() { + Menu.SetChecked(STEAMWORKS_AUTOFIX_DISABLED_MENU_ITEM, IsAutofixDisabled()); + } + static RedistInstall() { WriteSteamAppIdTxtFile(); AddDefineSymbols(); CheckForOldDlls(); + UpdateMenuItems(); } static void WriteSteamAppIdTxtFile() { @@ -57,6 +77,9 @@ static void CheckForOldDlls() { } static void AddDefineSymbols() { + if (IsAutofixDisabled()) + return; + string currentDefines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup); HashSet defines = new HashSet(currentDefines.Split(';')) { "STEAMWORKS_NET" From 901bbf4e7ad725bb275a1fe15eae36799687109e Mon Sep 17 00:00:00 2001 From: "p.shestakov" Date: Fri, 11 Oct 2024 17:56:27 +0300 Subject: [PATCH 2/3] added usage of MonoPInvokeCallback for SetWarningMessageHook static method --- com.rlabrecque.steamworks.net/Runtime/autogen/isteamclient.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/com.rlabrecque.steamworks.net/Runtime/autogen/isteamclient.cs b/com.rlabrecque.steamworks.net/Runtime/autogen/isteamclient.cs index 58b69ef7..ebcd4c13 100644 --- a/com.rlabrecque.steamworks.net/Runtime/autogen/isteamclient.cs +++ b/com.rlabrecque.steamworks.net/Runtime/autogen/isteamclient.cs @@ -228,6 +228,7 @@ public static uint GetIPCCallCount() { /// 'const char *' is the text of the message /// callbacks will occur directly after the API function is called that generated the warning or message. /// + [AOT.MonoPInvokeCallback(typeof(SteamAPIWarningMessageHook_t))] public static void SetWarningMessageHook(SteamAPIWarningMessageHook_t pFunction) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamClient_SetWarningMessageHook(CSteamAPIContext.GetSteamClient(), pFunction); From d797542de95cb836d741d7d3a4a5f9bb0b73d253 Mon Sep 17 00:00:00 2001 From: "p.shestakov" Date: Fri, 1 Nov 2024 09:49:24 +0200 Subject: [PATCH 3/3] RedistInstall's autofix should be disabled by default --- com.rlabrecque.steamworks.net/Editor/RedistInstall.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.rlabrecque.steamworks.net/Editor/RedistInstall.cs b/com.rlabrecque.steamworks.net/Editor/RedistInstall.cs index a16b5693..09a38842 100644 --- a/com.rlabrecque.steamworks.net/Editor/RedistInstall.cs +++ b/com.rlabrecque.steamworks.net/Editor/RedistInstall.cs @@ -22,7 +22,7 @@ static void SwitchAutofixDisabled() { } static bool IsAutofixDisabled(){ - return EditorPrefs.GetBool(STEAMWORKS_AUTOFIX_DISABLED, false); + return EditorPrefs.GetBool(STEAMWORKS_AUTOFIX_DISABLED, true); } static void UpdateMenuItems() {