diff --git a/BepinexPackages/BelowZero_Packages/QModManager/manifest.json b/BepinexPackages/BelowZero_Packages/QModManager/manifest.json index 4aba822c..15a6d4a9 100644 --- a/BepinexPackages/BelowZero_Packages/QModManager/manifest.json +++ b/BepinexPackages/BelowZero_Packages/QModManager/manifest.json @@ -1,6 +1,6 @@ { "name": "QModManager_BZ", - "version_number": "4.4.4", + "version_number": "4.5.0", "website_url": "https://github.com/SubnauticaModding/QModManager", "description": "QModManager is an intermidiate loader for mods made for the QMM system.", "dependencies": [ diff --git a/BepinexPackages/BelowZero_Packages/QModManager_Exp/manifest.json b/BepinexPackages/BelowZero_Packages/QModManager_Exp/manifest.json index d8bd850d..722161d6 100644 --- a/BepinexPackages/BelowZero_Packages/QModManager_Exp/manifest.json +++ b/BepinexPackages/BelowZero_Packages/QModManager_Exp/manifest.json @@ -1,6 +1,6 @@ { "name": "QModManager_BZ_Experimental", - "version_number": "4.4.4", + "version_number": "4.5.0", "website_url": "https://github.com/SubnauticaModding/QModManager", "description": "QModManager is an intermidiate loader for mods made for the QMM system.", "dependencies": [ diff --git a/BepinexPackages/Subnautica_Packages/QModManager/manifest.json b/BepinexPackages/Subnautica_Packages/QModManager/manifest.json index df0c8354..e6b555c1 100644 --- a/BepinexPackages/Subnautica_Packages/QModManager/manifest.json +++ b/BepinexPackages/Subnautica_Packages/QModManager/manifest.json @@ -1,6 +1,6 @@ { "name": "QModManager", - "version_number": "4.4.4", + "version_number": "4.5.0", "website_url": "https://github.com/SubnauticaModding/QModManager", "description": "QModManager is an intermidiate loader for mods made for the QMM system.", "dependencies": [ diff --git a/BepinexPackages/Subnautica_Packages/QModManager_Exp/manifest.json b/BepinexPackages/Subnautica_Packages/QModManager_Exp/manifest.json index 4258511c..4427b4a3 100644 --- a/BepinexPackages/Subnautica_Packages/QModManager_Exp/manifest.json +++ b/BepinexPackages/Subnautica_Packages/QModManager_Exp/manifest.json @@ -1,6 +1,6 @@ { "name": "QModManager_Experimental", - "version_number": "4.4.4", + "version_number": "4.5.0", "website_url": "https://github.com/SubnauticaModding/QModManager", "description": "QModManager is an intermidiate loader for mods made for the QMM system.", "dependencies": [ diff --git a/Data/latest-version.txt b/Data/latest-version.txt index 06eac6ae..5ae5281f 100644 --- a/Data/latest-version.txt +++ b/Data/latest-version.txt @@ -1 +1 @@ -4.4.4.0 \ No newline at end of file +4.5.0.0 \ No newline at end of file diff --git a/OculusNewtonsoftRedirect/Properties/AssemblyInfo.cs b/OculusNewtonsoftRedirect/Properties/AssemblyInfo.cs index 4bbd819b..d9fd9a26 100644 --- a/OculusNewtonsoftRedirect/Properties/AssemblyInfo.cs +++ b/OculusNewtonsoftRedirect/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("4.4.4")] -[assembly: AssemblyFileVersion("4.4.4")] +[assembly: AssemblyVersion("4.5.0")] +[assembly: AssemblyFileVersion("4.5.0")] diff --git a/QModManager/BepInex/Plugins/LogFilter.cs b/QModManager/BepInex/Plugins/LogFilter.cs index 5280357e..96d6104e 100644 --- a/QModManager/BepInex/Plugins/LogFilter.cs +++ b/QModManager/BepInex/Plugins/LogFilter.cs @@ -13,7 +13,7 @@ internal class LogFilter : BaseUnityPlugin { internal const string PluginGuid = "QModManager.LogFilter"; internal const string PluginName = PluginGuid; - internal const string PluginVersion = "4.4.4"; + internal const string PluginVersion = "4.5.0"; private void Awake() { diff --git a/QModManager/BepInex/Plugins/QMMLoader.cs b/QModManager/BepInex/Plugins/QMMLoader.cs index c0ee8881..d218b786 100644 --- a/QModManager/BepInex/Plugins/QMMLoader.cs +++ b/QModManager/BepInex/Plugins/QMMLoader.cs @@ -1,8 +1,6 @@ using BepInEx; -#if !SUBNAUTICA_STABLE using HarmonyLib; using System.Collections; -#endif using System.Collections.Generic; using UnityEngine; @@ -23,7 +21,7 @@ public class QMMLoader : BaseUnityPlugin { internal const string PluginGuid = "QModManager.QMMLoader"; internal const string PluginName = "QMMLoader"; - internal const string PluginVersion = "4.4.4"; + internal const string PluginVersion = "4.5.0"; internal static List QModsToLoad; private static Initializer Initializer; @@ -70,18 +68,6 @@ private void PreInitializeQMods() Initializer.InitializeMods(QModsToLoad, PatchingOrder.MetaPreInitialize); Initializer.InitializeMods(QModsToLoad, PatchingOrder.PreInitialize); -#if SUBNAUTICA_STABLE - Initializer.InitializeMods(QModsToLoad, PatchingOrder.NormalInitialize); - Initializer.InitializeMods(QModsToLoad, PatchingOrder.PostInitialize); - Initializer.InitializeMods(QModsToLoad, PatchingOrder.MetaPostInitialize); - - SummaryLogger.ReportIssues(QModsToLoad); - SummaryLogger.LogSummaries(QModsToLoad); - foreach (Dialog dialog in Patcher.Dialogs) - { - dialog.Show(); - } -#else var harmony = new Harmony(PluginGuid); harmony.Patch( AccessTools.Method( @@ -115,7 +101,6 @@ private static IEnumerator InitializeQMods(IEnumerator result) { dialog.Show(); } -#endif } } } \ No newline at end of file diff --git a/QModManager/HarmonyPatches/DisableDevErrorReporting.cs b/QModManager/HarmonyPatches/DisableDevErrorReporting.cs index 5b53594a..8a1b8650 100644 --- a/QModManager/HarmonyPatches/DisableDevErrorReporting.cs +++ b/QModManager/HarmonyPatches/DisableDevErrorReporting.cs @@ -18,7 +18,6 @@ internal static bool Prefix(SentrySdk __instance) return false; } -#if !SUBNAUTICA_STABLE [HarmonyPostfix] [HarmonyPatch(typeof(SystemsSpawner), nameof(SystemsSpawner.SetupSingleton))] internal static IEnumerator Postfix(IEnumerator enumerator) @@ -26,6 +25,5 @@ internal static IEnumerator Postfix(IEnumerator enumerator) yield return null; yield break; } -#endif } } diff --git a/QModManager/HarmonyPatches/EnableConsoleSetting.cs b/QModManager/HarmonyPatches/EnableConsoleSetting.cs index c1d637ac..71c55229 100644 --- a/QModManager/HarmonyPatches/EnableConsoleSetting.cs +++ b/QModManager/HarmonyPatches/EnableConsoleSetting.cs @@ -2,7 +2,6 @@ { using HarmonyLib; using QModManager.Utility; - using UnityEngine; [HarmonyPatch(typeof(DevConsole), nameof(DevConsole.Awake))] internal static class DevConsole_Awake_Patch @@ -12,36 +11,10 @@ internal static class DevConsole_Awake_Patch [HarmonyPostfix] internal static void Postfix() { -#if !SUBNAUTICA_STABLE if (PlatformUtils.GetDevToolsEnabled() != Config.EnableConsole) -#else - if (DevConsole.disableConsole != !Config.EnableConsole) -#endif { -#if !SUBNAUTICA_STABLE PlatformUtils.SetDevToolsEnabled(Config.EnableConsole); -#else - DevConsole.disableConsole = !Config.EnableConsole; - PlayerPrefs.SetInt("UWE.DisableConsole", Config.EnableConsole ? 0 : 1); -#endif } } } - -#if SUBNAUTICA_STABLE // the toggle is removed in Subnautica.exp and BelowZero - [HarmonyPatch(typeof(PlayerPrefsUtils), nameof(PlayerPrefsUtils.PrefsToggle))] - internal static class PlayerPrefsUtils_PrefsToggle_Patch - { - // This patch syncronizes the "Disable console" UI element in the F3 debug menu - - [HarmonyPostfix] - public static void Postfix(bool defaultVal, string key, string label, ref bool __result) - { - if (key == "UWE.DisableConsole") - { - Config.EnableConsole = !__result; - } - } - } -#endif } diff --git a/QModManager/HarmonyPatches/MaskTelemetryLogging.cs b/QModManager/HarmonyPatches/MaskTelemetryLogging.cs index b8f01be3..8d23eefe 100644 --- a/QModManager/HarmonyPatches/MaskTelemetryLogging.cs +++ b/QModManager/HarmonyPatches/MaskTelemetryLogging.cs @@ -1,51 +1,54 @@ namespace QModManager.HarmonyPatches { using HarmonyLib; - using QModManager.Utility; + using System; + using System.Collections; + using UnityEngine; + using UnityEngine.Networking; - //transpiller - using System.Collections.Generic; - using System.Reflection.Emit; - -#if BELOWZERO - [HarmonyPatch(typeof(Telemetry),MethodType.Enumerator)] - [HarmonyPatch(nameof(Telemetry.SendSesionStart))] + [HarmonyPatch(typeof(Telemetry), nameof(Telemetry.SendSesionStart))] static class MaskTelemetryLogging { - [HarmonyTranspiler] - public static IEnumerable Transpiler(IEnumerable instructions) + public static IEnumerator Postfix(IEnumerator values, Telemetry __instance, string setPlatformName, string setUserId) { - string thistranspiler = "Telemetry_SendSesionStart"; - Logger.Log(Logger.Level.Debug, $"{thistranspiler} - Start Transpiler"); - var Index = -1; - var codes = new List(instructions); - - //analyse the code to find the right place for injection - for (var i = 0; i < codes.Count; i++) + yield return __instance.platformServices.TryEnsureServerAccessAsync(false); + if (!__instance.platformServices.CanAccessServers()) { - //determinde the check to find the right place and not missmatch it accidentally with a other one - if (codes[i].opcode == OpCodes.Ldstr && codes[i + 17].opcode == OpCodes.Box && codes[i + 21].opcode == OpCodes.Ret) - { - Index = i; - break; - } + yield break; } - - //Check if Index was changed to any other Value. If yes the Position was likely found. - if (Index > -1) + __instance.platformName = (string.IsNullOrEmpty(setPlatformName) ? "Null" : setPlatformName); + __instance.userId = (string.IsNullOrEmpty(setUserId) ? "Null" : setUserId); + __instance.csId = SNUtils.GetPlasticChangeSetOfBuild(0); + WWWForm wwwform = new WWWForm(); + wwwform.AddField("product_id", Telemetry.productId); + wwwform.AddField("platform", __instance.platformName); + wwwform.AddField("platform_user_id", __instance.userId); + wwwform.AddField("cs_id", __instance.csId); + wwwform.AddField("language", Language.main.GetCurrentLanguage()); + wwwform.AddField("arguments", string.Join(", ", Environment.GetCommandLineArgs())); + wwwform.AddField("used_cheats", DevConsole.HasUsedConsole().ToString()); + wwwform.AddField("gpu_name", SystemInfo.graphicsDeviceName); + wwwform.AddField("gpu_memory", SystemInfo.graphicsMemorySize); + wwwform.AddField("gpu_api", SystemInfo.graphicsDeviceType.ToString()); + wwwform.AddField("cpu_name", SystemInfo.processorType); + wwwform.AddField("system_memory", SystemInfo.systemMemorySize); + wwwform.AddField("system_os", SystemInfo.operatingSystem); + wwwform.AddField("quality", QualitySettings.GetQualityLevel()); + wwwform.AddField("res_x", Screen.width); + wwwform.AddField("res_y", Screen.height); + UnityWebRequest webRequest = UnityWebRequest.Post(string.Format("{0}/session-start", "https://analytics.unknownworlds.com/api"), wwwform); + yield return webRequest.SendWebRequest(); + if (webRequest.isNetworkError || webRequest.isHttpError) { - Logger.Log(Logger.Level.Debug, $"{thistranspiler} - Transpiler injection position found"); - codes[Index] = new CodeInstruction(OpCodes.Ldstr, "Telemetry session started. Platform: '{0}', UserId: ->Masked by QModManager for privacy Reason<-, SessionId: {1}"); - codes.RemoveRange(Index, 0); - codes.RemoveRange(Index+10, 5); + Debug.LogError(webRequest.error); } else { - Logger.Log(Logger.Level.Error, $"{thistranspiler} - Index was not found"); + SessionStartResponse sessionStartResponse = SessionStartResponse.CreateFromJSON(webRequest.downloadHandler.text); + __instance.sessionId = sessionStartResponse.session_id; + Debug.LogFormat("Telemetry session started. Platform: '{0}', UserId: ->Masked by QModManager for privacy reason<-, SessionId: {1}", new object[] { __instance.platformName, __instance.sessionId }); } - - return codes; + yield break; } } -#endif } diff --git a/QModManager/OptionsManager.cs b/QModManager/OptionsManager.cs index be4921ba..15ced8ff 100644 --- a/QModManager/OptionsManager.cs +++ b/QModManager/OptionsManager.cs @@ -30,12 +30,7 @@ internal static void Postfix(uGUI_OptionsPanel __instance) AddToggleOption.Invoke(__instance, new object[] { ModsTab, "Enable console", Config.EnableConsole, new UnityAction(value => { Config.EnableConsole = value; -#if SUBNAUTICA_STABLE - DevConsole.disableConsole = !value; - UnityEngine.PlayerPrefs.SetInt("UWE.DisableConsole", value ? 0 : 1); -#elif BELOWZERO || SUBNAUTICA_EXP PlatformUtils.SetDevToolsEnabled(value); -#endif }) }); AddToggleOption.Invoke(__instance, new object[] { ModsTab, "Enable debug logs", Config.EnableDebugLogs, new UnityAction(value => Config.EnableDebugLogs = value) }); @@ -49,12 +44,7 @@ internal static void Postfix(uGUI_OptionsPanel __instance) AddToggleOption.Invoke(__instance, new object[] { ModsTab, "Enable console", Config.EnableConsole, new UnityAction(value => { Config.EnableConsole = value; -#if SUBNAUTICA_STABLE - DevConsole.disableConsole = !value; - UnityEngine.PlayerPrefs.SetInt("UWE.DisableConsole", value ? 0 : 1); -#elif BELOWZERO || SUBNAUTICA_EXP PlatformUtils.SetDevToolsEnabled(value); -#endif }), null }); AddToggleOption.Invoke(__instance, new object[] { ModsTab, "Enable debug logs", Config.EnableDebugLogs, new UnityAction(value => Config.EnableDebugLogs = value), null }); diff --git a/QModManager/Patching/GameDetector.cs b/QModManager/Patching/GameDetector.cs index 01a646e9..280c3a16 100644 --- a/QModManager/Patching/GameDetector.cs +++ b/QModManager/Patching/GameDetector.cs @@ -18,12 +18,8 @@ internal class GameDetector /// private static readonly Dictionary SupportedGameVersions = new Dictionary { -#if SUBNAUTICA_STABLE - { QModGame.Subnautica, 65786 } -#else { QModGame.BelowZero, 49184 }, - { QModGame.Subnautica, 68186 } -#endif + { QModGame.Subnautica, 71137 } }; internal bool IsValidGameRunning => SupportedGameVersions.ContainsKey(CurrentlyRunningGame); diff --git a/QModManager/Patching/QMod.cs b/QModManager/Patching/QMod.cs index 6b966e69..5ddaf1a2 100644 --- a/QModManager/Patching/QMod.cs +++ b/QModManager/Patching/QMod.cs @@ -1,10 +1,6 @@ namespace QModManager.Patching { -#if SUBNAUTICA_STABLE - using Oculus.Newtonsoft.Json; -#else using Newtonsoft.Json; -#endif using QModManager.API; using QModManager.DataStructures; using System; diff --git a/QModManager/Patching/QModFactory.cs b/QModManager/Patching/QModFactory.cs index 788c733e..0f629cc9 100644 --- a/QModManager/Patching/QModFactory.cs +++ b/QModManager/Patching/QModFactory.cs @@ -1,11 +1,7 @@ namespace QModManager.Patching { using BepInEx; -#if SUBNAUTICA_STABLE - using Oculus.Newtonsoft.Json; -#else using Newtonsoft.Json; -#endif using QModManager.API; using QModManager.DataStructures; using QModManager.Utility; diff --git a/QModManager/Properties/AssemblyInfo.cs b/QModManager/Properties/AssemblyInfo.cs index 08e54c05..bd6d4ea1 100644 --- a/QModManager/Properties/AssemblyInfo.cs +++ b/QModManager/Properties/AssemblyInfo.cs @@ -13,8 +13,8 @@ [assembly: ComVisible(false)] -[assembly: AssemblyVersion("4.4.4")] -[assembly: AssemblyFileVersion("4.4.4")] +[assembly: AssemblyVersion("4.5.0")] +[assembly: AssemblyFileVersion("4.5.0")] [assembly: InternalsVisibleTo("QMMTests")] [assembly: InternalsVisibleTo("QModManager")] diff --git a/QModManager/Utility/Config.cs b/QModManager/Utility/Config.cs index 2153a8b9..e94ecd0f 100644 --- a/QModManager/Utility/Config.cs +++ b/QModManager/Utility/Config.cs @@ -1,10 +1,6 @@ namespace QModManager.Utility { -#if SUBNAUTICA_STABLE - using Oculus.Newtonsoft.Json; -#else using Newtonsoft.Json; -#endif using System; using System.Collections.Generic; using System.IO; diff --git a/QModManager/Utility/MainMenuMessages.cs b/QModManager/Utility/MainMenuMessages.cs index d721a1fd..d0816db5 100644 --- a/QModManager/Utility/MainMenuMessages.cs +++ b/QModManager/Utility/MainMenuMessages.cs @@ -114,11 +114,9 @@ static IEnumerator _waitForLoad() yield return new WaitForSeconds(1f); yield return new WaitWhile(() => SaveLoadManager.main.isLoading); -#if SUBNAUTICA_STABLE - float time = Time.time; -#else + float time = PDA.time; -#endif + messages.ForEach(msg => msg.timeEnd = time + 1f); yield return new WaitForSeconds(1.1f); // wait for messages to dissapear @@ -191,7 +189,7 @@ public static void Unpatch() Patcher.hInstance.Unpatch(AccessTools.Method(typeof(ErrorMessage), nameof(ErrorMessage.Awake)), HarmonyPatchType.Postfix, Patcher.hInstance.Id); - Patcher.hInstance.Unpatch(AccessTools.Method(typeof(ErrorMessage), nameof(ErrorMessage.OnUpdate)), + Patcher.hInstance.Unpatch(AccessTools.Method(typeof(ErrorMessage), nameof(ErrorMessage.OnLateUpdate)), HarmonyPatchType.Transpiler, Patcher.hInstance.Id); } @@ -212,7 +210,7 @@ private static void ErrorMessage_Awake_Postfix() // we changing result for 'float value = Mathf.Clamp01(MathExtensions.EvaluateLine(...' to 1.0f // so text don't stay in the center of the screen (because of changed 'timeEnd') - [HarmonyTranspiler, HarmonyPatch(typeof(ErrorMessage), nameof(ErrorMessage.OnUpdate))] + [HarmonyTranspiler, HarmonyPatch(typeof(ErrorMessage), nameof(ErrorMessage.OnLateUpdate))] private static IEnumerable ErrorMessage_OnUpdate_Transpiler(IEnumerable cins) { try @@ -233,7 +231,7 @@ private static IEnumerable ErrorMessage_OnUpdate_Transpiler(IEn } catch (Exception e) { - Logger.Error($"Failed to patch ErrorMessage.OnUpdate() ({e})"); + Logger.Error($"Failed to patch ErrorMessage.OnLateUpdate() ({e})"); return cins; } } diff --git a/QModPluginEmulator/Properties/AssemblyInfo.cs b/QModPluginEmulator/Properties/AssemblyInfo.cs index 9d56b699..717bae2b 100644 --- a/QModPluginEmulator/Properties/AssemblyInfo.cs +++ b/QModPluginEmulator/Properties/AssemblyInfo.cs @@ -33,8 +33,8 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("4.4.4")] -[assembly: AssemblyFileVersion("4.4.4")] +[assembly: AssemblyVersion("4.5.0")] +[assembly: AssemblyFileVersion("4.5.0")] [assembly: NeutralResourcesLanguage("en")] [assembly: InternalsVisibleTo("QModManager.QMMLoader")] diff --git a/QModPluginEmulator/QModPluginGenerator.cs b/QModPluginEmulator/QModPluginGenerator.cs index 207f2d90..a4c862d9 100644 --- a/QModPluginEmulator/QModPluginGenerator.cs +++ b/QModPluginEmulator/QModPluginGenerator.cs @@ -3,12 +3,7 @@ using BepInEx.Logging; using HarmonyLib; using Mono.Cecil; -#if SUBNAUTICA_STABLE -using System.Collections; -using Oculus.Newtonsoft.Json; -#else using Newtonsoft.Json; -#endif using QModManager.API; using QModManager.Patching; using QModManager.Utility; @@ -70,9 +65,7 @@ public static void Finish() private readonly static string[] QMMKnownAssemblyPaths = new[] { -#if !SUBNAUTICA_STABLE Path.Combine(QMMPatchersPath, "QModManager.OculusNewtonsoftRedirect.dll"), -#endif Path.Combine(QMMPatchersPath, "QModManager.QModPluginGenerator.dll"), Path.Combine(QMMPluginsPath, "QModInstaller.dll"), }; diff --git a/References.targets b/References.targets index d6a062bc..63d15430 100644 --- a/References.targets +++ b/References.targets @@ -203,8 +203,6 @@ False - - False @@ -235,11 +233,20 @@ False - - False + + False + + + False + + + False + + + False @@ -255,16 +262,5 @@ False - - False - - - False - - - - False - - \ No newline at end of file diff --git a/UnityAudioFixer/Properties/AssemblyInfo.cs b/UnityAudioFixer/Properties/AssemblyInfo.cs index 9169fa7c..983b231f 100644 --- a/UnityAudioFixer/Properties/AssemblyInfo.cs +++ b/UnityAudioFixer/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("4.4.4")] -[assembly: AssemblyFileVersion("4.4.4")] +[assembly: AssemblyVersion("4.5.0")] +[assembly: AssemblyFileVersion("4.5.0")]