Skip to content

Commit c976a95

Browse files
authored
Merge pull request #237 from SubnauticaModding/Dev
QModManager 4.1.4 Patch time and Logging hotfixes
2 parents 164348e + 18b6a3e commit c976a95

File tree

12 files changed

+65
-56
lines changed

12 files changed

+65
-56
lines changed

Data/latest-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.1.3
1+
4.1.4.0

Executable/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212

1313
[assembly: ComVisible(false)]
1414

15-
[assembly: AssemblyVersion("4.1.3")]
16-
[assembly: AssemblyFileVersion("4.1.3")]
15+
[assembly: AssemblyVersion("4.1.4")]
16+
[assembly: AssemblyFileVersion("4.1.4")]

Installer/BZ.EXP.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#endif
66

77
#define Name "QModManager" ; The name of the game will be added after it
8-
#define Version "4.1.3"
8+
#define Version "4.1.4"
99
#define Author "QModManager"
1010
#define URL "https://github.com/QModManager/QModManager"
1111
#define SupportURL "https://discord.gg/UpWuWwq"

Installer/BZ.STABLE.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#endif
66

77
#define Name "QModManager" ; The name of the game will be added after it
8-
#define Version "4.1.3"
8+
#define Version "4.1.4"
99
#define Author "QModManager"
1010
#define URL "https://github.com/QModManager/QModManager"
1111
#define SupportURL "https://discord.gg/UpWuWwq"

Installer/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414

1515
[assembly: Guid("8c6c9a0b-80c4-43d2-89f2-749e6f09fdda")]
1616

17-
[assembly: AssemblyVersion("4.1.3")]
18-
[assembly: AssemblyFileVersion("4.1.3")]
17+
[assembly: AssemblyVersion("4.1.4")]
18+
[assembly: AssemblyFileVersion("4.1.4")]

Installer/SN.EXP.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#endif
66

77
#define Name "QModManager" ; The name of the game will be added after it
8-
#define Version "4.1.3"
8+
#define Version "4.1.4"
99
#define Author "QModManager"
1010
#define URL "https://github.com/QModManager/QModManager"
1111
#define SupportURL "https://discord.gg/UpWuWwq"

Installer/SN.STABLE.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#endif
66

77
#define Name "QModManager" ; The name of the game will be added after it
8-
#define Version "4.1.3"
8+
#define Version "4.1.4"
99
#define Author "QModManager"
1010
#define URL "https://github.com/QModManager/QModManager"
1111
#define SupportURL "https://discord.gg/UpWuWwq"

OculusNewtonsoftRedirect/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("4.1.3")]
36-
[assembly: AssemblyFileVersion("4.1.3")]
35+
[assembly: AssemblyVersion("4.1.4")]
36+
[assembly: AssemblyFileVersion("4.1.4")]

QModManager/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
[assembly: ComVisible(false)]
1515

16-
[assembly: AssemblyVersion("4.1.3")]
17-
[assembly: AssemblyFileVersion("4.1.3")]
16+
[assembly: AssemblyVersion("4.1.4")]
17+
[assembly: AssemblyFileVersion("4.1.4")]
1818

1919
[assembly: InternalsVisibleTo("QMMTests")]
2020
[assembly: InternalsVisibleTo("QModManager")]

QModPluginEmulator/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
// You can specify all the values or you can default the Build and Revision Numbers
3434
// by using the '*' as shown below:
3535
// [assembly: AssemblyVersion("1.0.*")]
36-
[assembly: AssemblyVersion("4.1.3")]
37-
[assembly: AssemblyFileVersion("4.1.3")]
36+
[assembly: AssemblyVersion("4.1.4")]
37+
[assembly: AssemblyFileVersion("4.1.4")]
3838
[assembly: NeutralResourcesLanguage("en")]
3939

4040
[assembly: InternalsVisibleTo("QModManager.QMMLoader")]

QModPluginEmulator/QModPluginGenerator.cs

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66
#if SUBNAUTICA_STABLE
77
using Oculus.Newtonsoft.Json;
88
#else
9-
using Newtonsoft.Json;
9+
using Newtonsoft.Json;
1010
#endif
1111
using QModManager.API;
1212
using QModManager.Patching;
1313
using QModManager.Utility;
1414
using System;
15+
using System.Collections;
1516
using System.Collections.Generic;
1617
using System.Diagnostics;
1718
using System.IO;
1819
using System.Linq;
1920
using System.Reflection;
21+
using System.Text.RegularExpressions;
22+
using QModManager.API.ModLoading;
2023
using TypeloaderCache = System.Collections.Generic.Dictionary<string, BepInEx.Bootstrap.CachedAssembly<BepInEx.PluginInfo>>;
2124
using QMMAssemblyCache = System.Collections.Generic.Dictionary<string, long>;
22-
using QModManager.API.ModLoading;
23-
using System.Collections;
2425

2526
namespace QModManager
2627
{
@@ -57,14 +58,14 @@ public static void Finish()
5758
{
5859
PluginCache = GetPluginCache();
5960
Harmony = new Harmony("QModManager.QModPluginGenerator");
60-
foreach(Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
61+
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
6162
{
62-
if(assembly?.GetName()?.Name?.Contains("MirrorInternalLogs") ?? false)
63+
if (assembly?.GetName()?.Name?.Contains("MirrorInternalLogs") ?? false)
6364
{
6465
Type type = AccessTools.TypeByName("MirrorInternalLogs.Util.LibcHelper");
6566
var method = type?.GetMethod("Format");
6667

67-
if(method != null)
68+
if (method != null)
6869
Harmony.Patch(method, postfix: new HarmonyMethod(typeof(QModPluginGenerator), nameof(QModPluginGenerator.LibcHelper_Format_Postfix)));
6970
break;
7071
}
@@ -82,44 +83,51 @@ public static void Finish()
8283
}
8384
}
8485

85-
public static List<string> DirtyStartStrings = new List<string>()
86-
{
87-
"Resetting cell with", "Replacing cell",
88-
"PerformGarbage", "Fallback handler could not load"
89-
};
90-
91-
public static List<string> DirtyMidStrings = new List<string>()
92-
{
93-
"\n(Filename",
86+
private readonly static List<Regex> DirtyRegexPatterns = new List<Regex>() {
87+
new Regex(@"([\r\n]+)?(\(Filename: .*\))$", RegexOptions.Compiled | RegexOptions.Multiline),
88+
new Regex(@"^(Replacing cell.*)$", RegexOptions.Compiled | RegexOptions.Multiline),
89+
new Regex(@"^(Resetting cell with.*)$", RegexOptions.Compiled | RegexOptions.Multiline),
90+
new Regex(@"^(PerformGarbage.*)$", RegexOptions.Compiled | RegexOptions.Multiline),
91+
new Regex(@"^(Fallback handler could not load.*)$", RegexOptions.Compiled | RegexOptions.Multiline),
92+
new Regex(@"^(Heartbeat CSV.*,[0-9])$", RegexOptions.Compiled | RegexOptions.Multiline),
93+
new Regex(@"^(L0: PerformGarbageCollection ->.*)$", RegexOptions.Compiled | RegexOptions.Multiline),
94+
new Regex(@"^(L0: CellManager::EstimateBytes.*)$", RegexOptions.Compiled | RegexOptions.Multiline),
95+
new Regex(@"^(Kinematic body only supports Speculative Continuous collision detection.*)$", RegexOptions.Compiled | RegexOptions.Multiline),
9496
};
9597

9698
private static void LibcHelper_Format_Postfix(ref string __result)
9799
{
98-
foreach(string dirtyString in DirtyStartStrings)
100+
foreach (Regex pattern in DirtyRegexPatterns)
99101
{
100-
if(__result.StartsWith(dirtyString))
101-
{
102-
__result = "";
103-
return;
104-
}
105-
}
106-
107-
foreach(string dirtyString in DirtyMidStrings)
108-
{
109-
int i = __result.IndexOf(dirtyString);
110-
if(i >= 0)
111-
{
112-
__result = __result.Remove(i);
113-
return;
114-
}
102+
__result = pattern.Replace(__result, string.Empty).Trim();
115103
}
116104
}
117105

118106
#if SUBNAUTICA_STABLE
119107
[HarmonyPatch(typeof(SystemsSpawner), nameof(SystemsSpawner.Awake))]
108+
[HarmonyPrefix]
109+
private static void PreInitializeQMM()
110+
{
111+
Patcher.Patch(); // Run QModManager patch
112+
113+
ModsToLoad = QModsToLoad.ToList();
114+
Initializer = new Initializer(Patcher.CurrentlyRunningGame);
115+
Initializer.InitializeMods(ModsToLoad, PatchingOrder.MetaPreInitialize);
116+
Initializer.InitializeMods(ModsToLoad, PatchingOrder.PreInitialize);
117+
Initializer.InitializeMods(ModsToLoad, PatchingOrder.NormalInitialize);
118+
Initializer.InitializeMods(ModsToLoad, PatchingOrder.PostInitialize);
119+
Initializer.InitializeMods(ModsToLoad, PatchingOrder.MetaPostInitialize);
120+
121+
SummaryLogger.ReportIssues(ModsToLoad);
122+
SummaryLogger.LogSummaries(ModsToLoad);
123+
foreach(Dialog dialog in Patcher.Dialogs)
124+
{
125+
dialog.Show();
126+
}
127+
128+
}
120129
#else
121130
[HarmonyPatch(typeof(PreStartScreen), nameof(PreStartScreen.Start))]
122-
#endif
123131
[HarmonyPrefix]
124132
private static void PreInitializeQMM()
125133
{
@@ -142,10 +150,10 @@ private static void PreInitializeQMM()
142150
), postfix: new HarmonyMethod(AccessTools.Method(typeof(QModPluginGenerator), nameof(QModPluginGenerator.InitializeQMM))));
143151
}
144152

145-
#if SUBNAUTICA
153+
#if SUBNAUTICA_EXP
146154
private static IEnumerator InitializeQMM(IEnumerator result)
147155
{
148-
if(ModsToLoad != null)
156+
if (ModsToLoad != null)
149157
{
150158
yield return result;
151159

@@ -155,7 +163,7 @@ private static IEnumerator InitializeQMM(IEnumerator result)
155163

156164
SummaryLogger.ReportIssues(ModsToLoad);
157165
SummaryLogger.LogSummaries(ModsToLoad);
158-
foreach(Dialog dialog in Patcher.Dialogs)
166+
foreach (Dialog dialog in Patcher.Dialogs)
159167
{
160168
dialog.Show();
161169
}
@@ -165,7 +173,7 @@ private static IEnumerator InitializeQMM(IEnumerator result)
165173
#elif BELOWZERO
166174
private static void InitializeQMM()
167175
{
168-
if(ModsToLoad != null)
176+
if (ModsToLoad != null)
169177
{
170178
Initializer.InitializeMods(ModsToLoad, PatchingOrder.NormalInitialize);
171179
Initializer.InitializeMods(ModsToLoad, PatchingOrder.PostInitialize);
@@ -174,12 +182,13 @@ private static void InitializeQMM()
174182
SummaryLogger.ReportIssues(ModsToLoad);
175183
SummaryLogger.LogSummaries(ModsToLoad);
176184

177-
foreach(Dialog dialog in Patcher.Dialogs)
185+
foreach (Dialog dialog in Patcher.Dialogs)
178186
{
179187
dialog.Show();
180188
}
181189
}
182190
}
191+
#endif
183192
#endif
184193

185194
private static string[] QMMKnownAssemblyPaths = new[] {
@@ -254,7 +263,7 @@ private static void SaveQMMAssemblyCache()
254263

255264
using (var ms = new MemoryStream())
256265
using (var writer = new StreamWriter(ms))
257-
using(var jsreader = new JsonTextWriter(writer))
266+
using (var jsreader = new JsonTextWriter(writer))
258267
{
259268
var serializer = new JsonSerializer();
260269
serializer.Serialize(jsreader, QMMAssemblyCache);
@@ -283,7 +292,7 @@ private static void ClearBepInExCache()
283292
{
284293
Directory.Delete(BepInExCachePath, true);
285294
}
286-
catch(IOException e)
295+
catch (IOException e)
287296
{
288297
Logger.LogDebug($"Clearing BepInEx cache failed with exception. \n{e}");
289298
}

UnityAudioFixer/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("4.1.3")]
36-
[assembly: AssemblyFileVersion("4.1.3")]
35+
[assembly: AssemblyVersion("4.1.4")]
36+
[assembly: AssemblyFileVersion("4.1.4")]

0 commit comments

Comments
 (0)