From c514181dc37782b8fe67a3054425617577c9dbb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AC=9D=E8=87=B4=E9=82=A6=20=28XIE=20Zhibang=29?= Date: Wed, 17 Apr 2019 16:38:17 +0800 Subject: [PATCH 1/5] Make CheckSteamAPIDLL usable --- Plugins/Steamworks.NET/InteropHelp.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Plugins/Steamworks.NET/InteropHelp.cs b/Plugins/Steamworks.NET/InteropHelp.cs index a920435f..920a7a5a 100644 --- a/Plugins/Steamworks.NET/InteropHelp.cs +++ b/Plugins/Steamworks.NET/InteropHelp.cs @@ -201,10 +201,11 @@ public class DllCheck { /// This is an optional runtime check to ensure that the dlls are the correct version. Returns false only if the steam_api.dll is found and it's the wrong size or version number. /// public static bool Test() { -#if DISABLED - bool ret = CheckSteamAPIDLL(); -#endif +#if DISABLED && STEAMWORKS_WIN + return CheckSteamAPIDLL(); +#else return true; +#endif } #if DISABLED From 2f5e87b3f2036f8211103f13c5cbab653d4566b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AC=9D=E8=87=B4=E9=82=A6=20=28XIE=20Zhibang=29?= Date: Thu, 18 Apr 2019 02:03:43 +0800 Subject: [PATCH 2/5] Update InteropHelp.cs --- Plugins/Steamworks.NET/InteropHelp.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Steamworks.NET/InteropHelp.cs b/Plugins/Steamworks.NET/InteropHelp.cs index 920a7a5a..de324eee 100644 --- a/Plugins/Steamworks.NET/InteropHelp.cs +++ b/Plugins/Steamworks.NET/InteropHelp.cs @@ -19,7 +19,7 @@ namespace Steamworks { public class InteropHelp { public static void TestIfPlatformSupported() { -#if !UNITY_EDITOR && !UNITY_STANDALONE && !STEAMWORKS_WIN && !STEAMWORKS_LIN_OSX +#if !UNITY_EDITOR && !UNITY_STANDALONE throw new System.InvalidOperationException("Steamworks functions can only be called on platforms that Steam is available on."); #endif } @@ -65,7 +65,7 @@ public static string PtrToStringUTF8(IntPtr nativeUtf8) { // This is for 'const char *' arguments which we need to ensure do not get GC'd while Steam is using them. // We can't use an ICustomMarshaler because Unity crashes when a string between 96 and 127 characters long is defined/initialized at the top of class scope... -#if UNITY_EDITOR || UNITY_STANDALONE || STEAMWORKS_WIN || STEAMWORKS_LIN_OSX +#if UNITY_EDITOR || UNITY_STANDALONE public class UTF8StringHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid { public UTF8StringHandle(string str) : base(true) { @@ -201,7 +201,7 @@ public class DllCheck { /// This is an optional runtime check to ensure that the dlls are the correct version. Returns false only if the steam_api.dll is found and it's the wrong size or version number. /// public static bool Test() { -#if DISABLED && STEAMWORKS_WIN +#if DISABLED return CheckSteamAPIDLL(); #else return true; From 08aeea15214da9081e703ce70b0ec8bba267dc10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AC=9D=E8=87=B4=E9=82=A6=20=28XIE=20Zhibang=29?= Date: Wed, 8 May 2019 11:26:05 +0800 Subject: [PATCH 3/5] Add DISABLED macro --- Plugins/Steamworks.NET/InteropHelp.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Plugins/Steamworks.NET/InteropHelp.cs b/Plugins/Steamworks.NET/InteropHelp.cs index de324eee..46a1d34b 100644 --- a/Plugins/Steamworks.NET/InteropHelp.cs +++ b/Plugins/Steamworks.NET/InteropHelp.cs @@ -11,6 +11,10 @@ #if !DISABLESTEAMWORKS +#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN +#define DISABLED +#endif + using System.Runtime.InteropServices; using IntPtr = System.IntPtr; From 5f1164e363c92d27d1b08bbadc61c7cae3adc868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AC=9D=E8=87=B4=E9=82=A6=20=28XIE=20Zhibang=29?= Date: Wed, 15 May 2019 21:26:37 +0800 Subject: [PATCH 4/5] IL2CPP NOT IMPLEMENTED GetVersionInfo_internal --- Plugins/Steamworks.NET/InteropHelp.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/Steamworks.NET/InteropHelp.cs b/Plugins/Steamworks.NET/InteropHelp.cs index 46a1d34b..4a83279c 100644 --- a/Plugins/Steamworks.NET/InteropHelp.cs +++ b/Plugins/Steamworks.NET/InteropHelp.cs @@ -240,10 +240,11 @@ private static bool CheckSteamAPIDLL() { if (fInfo.Length != fileBytes) { return false; } - +#if !ENABLE_IL2CPP if (System.Diagnostics.FileVersionInfo.GetVersionInfo(file).FileVersion != Version.SteamAPIDLLVersion) { return false; } +#endif } return true; } From 5b6fbf70a7d3f85a2c44c5de3831eb138365916e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AC=9D=E8=87=B4=E9=82=A6=20=28XIE=20Zhibang=29?= Date: Thu, 6 Jun 2019 16:58:57 +0800 Subject: [PATCH 5/5] Rename DISABLED macro to DLLCHECK --- Plugins/Steamworks.NET/InteropHelp.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Plugins/Steamworks.NET/InteropHelp.cs b/Plugins/Steamworks.NET/InteropHelp.cs index 4a83279c..ad51e447 100644 --- a/Plugins/Steamworks.NET/InteropHelp.cs +++ b/Plugins/Steamworks.NET/InteropHelp.cs @@ -12,7 +12,7 @@ #if !DISABLESTEAMWORKS #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN -#define DISABLED +#define DLLCHECK #endif using System.Runtime.InteropServices; @@ -193,7 +193,7 @@ public static implicit operator IntPtr(MMKVPMarshaller that) { } public class DllCheck { -#if DISABLED +#if DLLCHECK [DllImport("kernel32.dll")] public static extern IntPtr GetModuleHandle(string lpModuleName); @@ -205,14 +205,14 @@ public class DllCheck { /// This is an optional runtime check to ensure that the dlls are the correct version. Returns false only if the steam_api.dll is found and it's the wrong size or version number. /// public static bool Test() { -#if DISABLED +#if DLLCHECK return CheckSteamAPIDLL(); #else return true; #endif } -#if DISABLED +#if DLLCHECK private static bool CheckSteamAPIDLL() { string fileName; int fileBytes;