Skip to content

Commit bec068b

Browse files
authored
Merge pull request #255 from SubnauticaModding/Dev
QModManager 4.3.0
2 parents a3e9e79 + d8c185d commit bec068b

39 files changed

+206
-66
lines changed

Data/latest-version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.2.1.0
1+
4.3.0
75.5 KB
Binary file not shown.
75.5 KB
Binary file not shown.
Binary file not shown.

Dependencies/BepInEx/BepInEx/core/0Harmony.xml

+39
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 Bytes
Binary file not shown.
Binary file not shown.
512 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Executable/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212

1313
[assembly: ComVisible(false)]
1414

15-
[assembly: AssemblyVersion("4.2.1.0")]
16-
[assembly: AssemblyFileVersion("4.2.1.0")]
15+
[assembly: AssemblyVersion("4.3.0")]
16+
[assembly: AssemblyFileVersion("4.3.0")]

Installer/BZ.EXP.iss

+1-1
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.2.1"
8+
#define Version "4.3.0"
99
#define Author "QModManager"
1010
#define URL "https://github.com/QModManager/QModManager"
1111
#define SupportURL "https://discord.gg/UpWuWwq"

Installer/BZ.STABLE.iss

+1-1
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.2.1"
8+
#define Version "4.3.0"
99
#define Author "QModManager"
1010
#define URL "https://github.com/QModManager/QModManager"
1111
#define SupportURL "https://discord.gg/UpWuWwq"

Installer/Properties/AssemblyInfo.cs

+2-2
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.2.1.0")]
18-
[assembly: AssemblyFileVersion("4.2.1.0")]
17+
[assembly: AssemblyVersion("4.3.0")]
18+
[assembly: AssemblyFileVersion("4.3.0")]

Installer/SN.EXP.iss

+1-1
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.2.1"
8+
#define Version "4.3.0"
99
#define Author "QModManager"
1010
#define URL "https://github.com/QModManager/QModManager"
1111
#define SupportURL "https://discord.gg/UpWuWwq"

Installer/SN.STABLE.iss

+1-1
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.2.1"
8+
#define Version "4.3.0"
99
#define Author "QModManager"
1010
#define URL "https://github.com/QModManager/QModManager"
1111
#define SupportURL "https://discord.gg/UpWuWwq"

OculusNewtonsoftRedirect/Properties/AssemblyInfo.cs

+2-2
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.2.1.0")]
36-
[assembly: AssemblyFileVersion("4.2.1.0")]
35+
[assembly: AssemblyVersion("4.3.0")]
36+
[assembly: AssemblyFileVersion("4.3.0")]

QModManager/API/IQModServices.cs

+16
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,21 @@ public interface IQModServices : IQModAPI
3131
/// <param name="color">The color of the text.</param>
3232
/// <param name="autoformat">Whether or not to apply formatting tags to the message, or show it as it is.</param>
3333
void AddCriticalMessage(string msg, int size = MainMenuMessages.defaultSize, string color = MainMenuMessages.defaultColor, bool autoformat = true);
34+
35+
/// <summary>
36+
/// Gets the currently running game.
37+
/// </summary>
38+
/// <value>
39+
/// The currently running game.
40+
/// </value>
41+
QModGame CurrentlyRunningGame { get; }
42+
43+
/// <summary>
44+
/// Gets a value indicating whether Nitrox is being used.
45+
/// </summary>
46+
/// <value>
47+
/// <c>true</c> if Nitrox is being used; otherwise, <c>false</c>.
48+
/// </value>
49+
bool NitroxRunning { get; }
3450
}
3551
}

QModManager/API/QModServices.cs

+26-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace QModManager.API
1+
using QModManager.Checks;
2+
3+
namespace QModManager.API
24
{
35
using System.Collections.Generic;
46
using System.Collections.ObjectModel;
@@ -10,13 +12,13 @@
1012
/// Services offered to mods.
1113
/// </summary>
1214
/// <seealso cref="IQModServices" />
13-
public class QModServices : IQModServices
15+
public class QModServices: IQModServices
1416
{
1517
private static readonly Dictionary<string, IQMod> knownMods = new Dictionary<string, IQMod>();
1618

1719
internal static void LoadKnownMods(List<QMod> loadedMods)
1820
{
19-
foreach (QMod mod in loadedMods)
21+
foreach(QMod mod in loadedMods)
2022
knownMods.Add(mod.Id, mod);
2123
}
2224

@@ -39,7 +41,7 @@ private QModServices()
3941
/// <returns></returns>
4042
public IQMod FindModById(string modId)
4143
{
42-
if (knownMods.TryGetValue(modId, out IQMod mod) && mod.Enable)
44+
if(knownMods.TryGetValue(modId, out IQMod mod) && mod.Enable)
4345
{
4446
return mod;
4547
}
@@ -56,7 +58,7 @@ public IQMod FindModById(string modId)
5658
/// </returns>
5759
public bool ModPresent(string modId)
5860
{
59-
if (knownMods.TryGetValue(modId, out IQMod mod))
61+
if(knownMods.TryGetValue(modId, out IQMod mod))
6062
{
6163
return mod.Enable;
6264
}
@@ -72,9 +74,9 @@ public bool ModPresent(string modId)
7274
/// <exception cref="System.NotImplementedException"></exception>
7375
public IQMod FindModByAssembly(Assembly modAssembly)
7476
{
75-
foreach (IQMod mod in knownMods.Values)
77+
foreach(IQMod mod in knownMods.Values)
7678
{
77-
if (mod.LoadedAssembly == modAssembly)
79+
if(mod.LoadedAssembly == modAssembly)
7880
{
7981
return mod;
8082
}
@@ -138,5 +140,22 @@ public void AddCriticalMessage(string msg, int size = MainMenuMessages.defaultSi
138140
var callingMod = GetMod(ReflectionHelper.CallingAssemblyByStackTrace());
139141
MainMenuMessages.Add(msg, callingMod?.DisplayName, size, color, autoformat);
140142
}
143+
144+
/// <summary>
145+
/// Gets the currently running game.
146+
/// </summary>
147+
/// <value>
148+
/// The currently running game.
149+
/// </value>
150+
public QModGame CurrentlyRunningGame => Patcher.CurrentlyRunningGame;
151+
152+
153+
/// <summary>
154+
/// Gets a value indicating whether Nitrox is being used.
155+
/// </summary>
156+
/// <value>
157+
/// <c>true</c> if Nitrox is being used; otherwise, <c>false</c>.
158+
/// </value>
159+
public bool NitroxRunning => NitroxCheck.IsRunning;
141160
}
142161
}

QModManager/BepInex/Plugins/LogFilter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal class LogFilter : BaseUnityPlugin
1313
{
1414
internal const string PluginGuid = "QModManager.LogFilter";
1515
internal const string PluginName = PluginGuid;
16-
internal const string PluginVersion = "4.2.1.0";
16+
internal const string PluginVersion = "4.3.0";
1717

1818
private void Awake()
1919
{

QModManager/BepInex/Plugins/QMMLoader.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class QMMLoader : BaseUnityPlugin
2323
{
2424
internal const string PluginGuid = "QModManager.QMMLoader";
2525
internal const string PluginName = "QMMLoader";
26-
internal const string PluginVersion = "4.2.1.0";
26+
internal const string PluginVersion = "4.3.0";
2727

2828
internal static List<QMod> QModsToLoad;
2929
private static Initializer Initializer;

QModManager/Checks/NitroxCheck.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ namespace QModManager.Checks
77
{
88
internal static class NitroxCheck
99
{
10-
internal static bool IsInstalled { get; set; } = false;
10+
internal static bool IsRunning { get; set; } = false;
1111

12+
1213
[HarmonyPatch(typeof(GameInput), nameof(GameInput.Awake))]
1314
internal static class AwakePatch
1415
{
@@ -22,7 +23,7 @@ internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruct
2223

2324
if (method.DeclaringType.Name == "Main" && method.Name == "Execute")
2425
{
25-
IsInstalled = true;
26+
IsRunning = true;
2627
}
2728
}
2829
}

QModManager/HarmonyPatches/EnableConsoleSetting.cs

+15-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,27 @@ internal static class DevConsole_Awake_Patch
1212
[HarmonyPostfix]
1313
internal static void Postfix()
1414
{
15-
if(DevConsole.disableConsole != !Config.EnableConsole)
15+
#if BELOWZERO
16+
if (PlatformUtils.GetDevToolsEnabled() != Config.EnableConsole)
17+
#elif SUBNAUTICA_EXP
18+
if (PlatformUtils.devToolsEnabled != Config.EnableConsole)
19+
#else
20+
if (DevConsole.disableConsole != !Config.EnableConsole)
21+
#endif
1622
{
23+
#if BELOWZERO
24+
PlatformUtils.SetDevToolsEnabled(Config.EnableConsole);
25+
#elif SUBNAUTICA_EXP
26+
PlatformUtils.devToolsEnabled = Config.EnableConsole;
27+
#else
1728
DevConsole.disableConsole = !Config.EnableConsole;
1829
PlayerPrefs.SetInt("UWE.DisableConsole", Config.EnableConsole ? 0 : 1);
30+
#endif
1931
}
2032
}
2133
}
2234

35+
#if SUBNAUTICA_STABLE // the toggle is removed in Subnautica.exp and BelowZero
2336
[HarmonyPatch(typeof(PlayerPrefsUtils), nameof(PlayerPrefsUtils.PrefsToggle))]
2437
internal static class PlayerPrefsUtils_PrefsToggle_Patch
2538
{
@@ -34,4 +47,5 @@ public static void Postfix(bool defaultVal, string key, string label, ref bool _
3447
}
3548
}
3649
}
50+
#endif
3751
}

QModManager/OptionsManager.cs

+6
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,14 @@ internal static void Postfix(uGUI_OptionsPanel __instance)
2222
__instance.AddToggleOption(ModsTab, "Enable console", Config.EnableConsole, new UnityAction<bool>(value =>
2323
{
2424
Config.EnableConsole = value;
25+
#if SUBNAUTICA_STABLE
2526
DevConsole.disableConsole = !value;
2627
UnityEngine.PlayerPrefs.SetInt("UWE.DisableConsole", value ? 0 : 1);
28+
#elif SUBNAUTICA_EXP
29+
PlatformUtils.devToolsEnabled = value;
30+
#else
31+
PlatformUtils.SetDevToolsEnabled(value);
32+
#endif
2733
}));
2834

2935
__instance.AddToggleOption(ModsTab, "Enable debug logs", Config.EnableDebugLogs, new UnityAction<bool>(value => Config.EnableDebugLogs = value));

QModManager/Patching/GameDetector.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ internal class GameDetector
2121
#if SUBNAUTICA_STABLE
2222
{ QModGame.Subnautica, 65786 }
2323
#elif BELOWZERO_STABLE
24-
{ QModGame.BelowZero, 44290 }
24+
{ QModGame.BelowZero, 45391 }
2525
#elif SUBNAUTICA_EXP
26-
{ QModGame.Subnautica, 67843 }
26+
{ QModGame.Subnautica, 68186 }
2727
#elif BELOWZERO_EXP
28-
{ QModGame.BelowZero, 44291 }
28+
{ QModGame.BelowZero, 45500 }
2929
#endif
3030
};
3131

QModManager/Patching/Initializer.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace QModManager.API.ModLoading
1+
using QModManager.Checks;
2+
3+
namespace QModManager.API.ModLoading
24
{
35
using QModManager.Patching;
46
using QModManager.Utility;
@@ -30,6 +32,14 @@ internal void InitializeMods(List<QMod> modsToInitialize, PatchingOrder order)
3032
continue;
3133
}
3234

35+
36+
if(!mod.NitroxCompat && NitroxCheck.IsRunning)
37+
{
38+
mod.PatchMethods.Clear(); // Do not attempt any other patch methods
39+
mod.Status = ModStatus.NitroxIncompatible;
40+
continue;
41+
}
42+
3343
if (!mod.PatchMethods.TryGetValue(order, out QModPatchMethod patchMethod))
3444
continue; // Nothing to patch at this stage
3545

QModManager/Patching/ManifestValidator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void ValidateBasicManifest(QMod mod)
3535
string.IsNullOrEmpty(mod.DisplayName) ||
3636
string.IsNullOrEmpty(mod.Author))
3737
{
38-
mod.Status = ModStatus.MissingCoreInfo;
38+
mod.Status = ModStatus.InvalidCoreInfo;
3939
return;
4040
}
4141

QModManager/Patching/ModStatus.cs

+8-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{
33
internal enum ModStatus
44
{
5+
NitroxIncompatible = -5,
56
Obsolete = -4,
67
Merged = -3,
78
//CanceledByAuthor = -2,
@@ -18,11 +19,12 @@ internal enum ModStatus
1819
FailedIdentifyingGame = 9,
1920
DuplicateIdDetected = 10,
2021
DuplicatePatchAttemptDetected = 11,
21-
MissingCoreInfo = 12,
22-
InvalidCoreInfo = 13,
23-
MissingAssemblyFile = 14,
24-
FailedLoadingAssemblyFile = 15,
25-
UnidentifiedMod = 16,
26-
BannedID = 17,
22+
MissingManifest = 12,
23+
ManifestParsingError = 13,
24+
InvalidCoreInfo = 14,
25+
MissingAssemblyFile = 15,
26+
FailedLoadingAssemblyFile = 16,
27+
UnidentifiedMod = 17,
28+
BannedID = 18,
2729
}
2830
}

0 commit comments

Comments
 (0)