Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fad8c9c
Fix small Misstake. Shame on me.
desperationfighter Apr 10, 2022
e4b53e5
Added internal Modlist Tab
desperationfighter Apr 10, 2022
8f20346
Change to alphabetical sorted Mod List
desperationfighter Apr 10, 2022
8d11859
integrated deactivated Mod list + improvments
desperationfighter Apr 11, 2022
8f2842b
reduce overhead + clearup appearance
desperationfighter Apr 11, 2022
c035e4a
Merge pull request #1 from desperationfighter/Dev-Desp
desperationfighter Apr 13, 2022
0e0c2ab
Coding consistency cleanup from previous PR
Metious Apr 14, 2022
a125c8d
Better game store checks
Metious Apr 14, 2022
b33e15d
Update QModManager/OptionsManager.cs
desperationfighter Apr 14, 2022
12e4503
Update QModManager/OptionsManager.cs
desperationfighter Apr 14, 2022
59cd0f6
First try of getting the enable disable Check box
desperationfighter Apr 14, 2022
4f0d5a4
First test to implement a List of chaning mods
desperationfighter Apr 17, 2022
c74fbc7
backup
desperationfighter Apr 17, 2022
96c55d8
Onchange Methode cleared up
desperationfighter Apr 17, 2022
1627b32
Adding Apply Function and false confirm prevention
desperationfighter Apr 17, 2022
9694aa0
start writing to disk
desperationfighter Apr 18, 2022
a33d1ef
Save to Mod.json first time working fine
desperationfighter Apr 18, 2022
a88324c
backup
desperationfighter Apr 18, 2022
9cd1e88
Rework Code + Deactivated Mods can now be changed too
desperationfighter Apr 18, 2022
32c377d
Update Pirate Check
desperationfighter Apr 19, 2022
e68a324
Merge pull request #2 from desperationfighter/Dev-Pirate
desperationfighter Apr 19, 2022
2332055
added cancel changes function
desperationfighter Apr 24, 2022
54a8500
code Cleanup
desperationfighter Apr 24, 2022
761d8b2
Merge pull request #3 from desperationfighter/Dev-ChangeModStatus
desperationfighter Apr 24, 2022
acba05c
Added QMM Option Entry to make Mod List Menu optional
desperationfighter Apr 25, 2022
6c767a7
Merge pull request #4 from desperationfighter/Dev-ShowModlistOptional
desperationfighter Apr 25, 2022
1c526f4
Fix for QMM Versionchecker parsing + Fix Gameversion Logger (#5)
desperationfighter May 7, 2022
642d684
Adding API for Mods to get current running QMM Version. (#6)
desperationfighter May 15, 2022
5214db2
Added detailed Error Catch for Folder Tree Logger (#7)
desperationfighter May 25, 2022
dc389ec
additional Error Catching + Mod.json Information on Filetree (#8)
desperationfighter Jun 16, 2022
374f0ec
returnfrom save game warning (#9)
desperationfighter Jun 16, 2022
41ff307
Error Catching for Date and Time Logging.
desperationfighter Jul 20, 2022
d5f7470
pass through Exception Message
desperationfighter Aug 15, 2022
15ebab5
Merge branch 'SubnauticaModding:Dev' into Dev
desperationfighter Sep 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion QModManager/API/IQModServices.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace QModManager.API
{
using System;
using System.Reflection;
using QModManager.Utility;

Expand Down Expand Up @@ -48,13 +49,28 @@ public interface IQModServices : IQModAPI
/// </value>
bool NitroxRunning { get; }


/// <summary>
/// Gets a value indicating whether Piracy was detected.
/// </summary>
/// <value>
/// <c>true</c> if Piracy was detected; otherwise, <c>false</c>.
/// </value>
bool PirateDetected { get; }

/// <summary>
/// Gets the current Q Mod Manager Version.
/// </summary>
/// <value>
/// Return Running QMM Version.
/// </value>
Version QMMrunningVersion { get; }

/// <summary>
/// Gets a value indicating when a Savegame was already loaded. (Turns <c>true</c> when entering the Mainmenu again.)
/// </summary>
/// <value>
/// <c>true</c> Mainmenu is entered AFTER a Savegame was loaded already; otherwise, <c>false</c>.
/// </value>
bool AnySavegamewasalreadyloaded { get; }
}
}
17 changes: 17 additions & 0 deletions QModManager/API/QModServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace QModManager.API
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Reflection;
Expand Down Expand Up @@ -165,5 +166,21 @@ public void AddCriticalMessage(string msg, int size = MainMenuMessages.defaultSi
/// <c>true</c> if Piracy was detected; otherwise, <c>false</c>.
/// </value>
public bool PirateDetected => PirateCheck.PirateDetected;

/// <summary>
/// Gets the current Q Mod Manager Version.
/// </summary>
/// <value>
/// Return Running QMM Version.
/// </value>
public Version QMMrunningVersion => Assembly.GetExecutingAssembly().GetName().Version;

/// <summary>
/// Gets a value indicating when a Savegame was already loaded (Turn true when entering the Mainmenu again.
/// </summary>
/// <value>
/// <c>true</c> Mainmenu is entered AFTER a Savegame was loaded already; otherwise, <c>false</c>.
/// </value>
public bool AnySavegamewasalreadyloaded => ReturnfromSavegameWarning.AnySavegamewasloaded;
}
}
19 changes: 10 additions & 9 deletions QModManager/Checks/PirateCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ namespace QModManager.Checks
{
internal static class PirateCheck
{
internal static string Steamapi => "steam_api64.dll";
internal static int Steamapilengh => 220000;


internal static string folder = Environment.CurrentDirectory;
internal const string SteamApiName = "steam_api64.dll";
internal const int SteamApiLength = 220000;
internal static bool PirateDetected;

private static readonly string _folder = Environment.CurrentDirectory;

internal static readonly HashSet<string> CrackedFiles = new HashSet<string>()
{
"steam_api64.cdx",
Expand All @@ -26,18 +25,20 @@ internal static class PirateCheck
"Subnautica_Data/Plugins/steam_emu.ini",
"Profile/SteamUserID.cfg",
"Profile/Stats/Achievements.Bin",
"Profile/VALVE/SteamUserID.cfg",
"Profile/VALVE/Stats/Achievements.Bin",
"launcher.bat",
"chuj.cdx",
};

internal static void IsPirate()
{
string steamDll = Path.Combine(folder, Steamapi);
string steamDll = Path.Combine(_folder, SteamApiName);
bool steamStore = File.Exists(steamDll);
if (steamStore)
{
FileInfo fileInfo = new FileInfo(steamDll);
if (fileInfo.Length > Steamapilengh)
if (fileInfo.Length > SteamApiLength)
{
PirateDetected = true;
}
Expand All @@ -47,15 +48,15 @@ internal static void IsPirate()
{
foreach (string file in CrackedFiles)
{
if (File.Exists(Path.Combine(folder, file)))
if (File.Exists(Path.Combine(_folder, file)))
{
PirateDetected = true;
break;
}
}
}

Logger.Info(PirateDetected? "Ahoy, matey! Ye be a pirate!":"Seems Legit.");
Logger.Info(PirateDetected ? "Ahoy, matey! Ye be a pirate!" : "Seems legit.");
}
}
}
28 changes: 18 additions & 10 deletions QModManager/Checks/VersionCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ internal static void Check()
{
if (!Config.CheckForUpdates)
{
Logger.Info("Update check disabled");
Logger.Info("QMM Internal Versionchecker: Update check disabled");
return;
}

if (!NetworkUtilities.CheckConnection())
{
Logger.Info("Cannot check for updates, internet disabled");
Logger.Info("QMM Internal Versionchecker: Cannot check for updates, internet disabled");
return;
}

Expand All @@ -37,14 +37,14 @@ internal static void Check()
{
if (e.Error != null)
{
Logger.Error("There was an error retrieving the latest version from GitHub!");
Logger.Error("QMM Internal Versionchecker: There was an error retrieving the latest version from GitHub!");
Logger.Exception(e.Error);
return;
}
Parse(e.Result);
};

Logger.Debug("Getting the latest version...");
Logger.Debug("QMM Internal Versionchecker: Getting the latest version...");
client.DownloadStringAsync(new Uri(VersionURL));
}
}
Expand All @@ -56,32 +56,40 @@ internal static void Parse(string versionStr)
Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version;
if (versionStr == null)
{
Logger.Error("There was an error retrieving the latest version from GitHub!");
Logger.Error("QMM Internal Versionchecker: There was an error retrieving the latest version from GitHub!");
return;
}
var latestVersion = new Version(versionStr);

string[] versionStr_splittet = versionStr.Split('.');
string version_builder = $"{versionStr_splittet[0]}.{(versionStr_splittet.Length >= 2 ? $"{versionStr_splittet[1]}" : "0")}.{(versionStr_splittet.Length >= 3 ? $"{versionStr_splittet[2]}" : "0")}.{(versionStr_splittet.Length >= 4 ? $"{versionStr_splittet[3]}" : "0")}";
var latestVersion = new Version(version_builder);

if (latestVersion == null)
{
Logger.Error("There was an error retrieving the latest version from GitHub!");
Logger.Error("QMM Internal Versionchecker: There was an error retrieving the latest version from GitHub!");
return;
}

//Logger.Debug($"QMM Version Checker - Parse - current Version value: {currentVersion}");
//Logger.Debug($"QMM Version Checker - Parse - latest Version value: {latestVersion}");

if (latestVersion > currentVersion)
{
Logger.Info($"Newer version found: {latestVersion.ToStringParsed()} (current version: {currentVersion.ToStringParsed()})");
result = latestVersion;
}
else if (latestVersion < currentVersion)
{
Logger.Info($"Received latest version from GitHub. We're ahead. This is probably a development build.");
Logger.Info($"QMM Internal Versionchecker: Received latest version ({latestVersion.ToStringParsed()}) from GitHub. We're ahead. This is probably a development build (current version: {currentVersion.ToStringParsed()}).");
}
else
{
Logger.Info($"Received latest version from GitHub. We are up to date!");
Logger.Info($"QMM Internal Versionchecker: Received latest version from GitHub. We are up to date!");
}
}
catch (Exception e)
{
Logger.Error("There was an error retrieving the latest version from GitHub!");
Logger.Error("QMM Internal Versionchecker: There was an error retrieving the latest version from GitHub!");
Logger.Exception(e);
return;
}
Expand Down
58 changes: 58 additions & 0 deletions QModManager/HarmonyPatches/ReturnfromSavegameWarning.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
namespace QModManager.Patching
{
using HarmonyLib;
using QModManager.API;
using MyLogger = Utility;
using UWE;
using System.Collections;
using UnityEngine;

internal static class ReturnfromSavegameWarning
{
public static bool AnySavegamewasloaded = false;
}

[HarmonyPatch(typeof(Player), nameof(Player.Awake))]
internal static class ReturnfromSavegameWarningPlayerAwake
{
[HarmonyPostfix]
internal static void Postfix(Player __instance)
{
if (ReturnfromSavegameWarning.AnySavegamewasloaded)
{
MyLogger.Logger.Error("Entering a Savegame after playing a other one without restarting the Game. Modders do not recommend that. Restart the Game to prevent errors or unexpected behaviour");
if (Utility.Config.ShowWarnOnLoadSecondSave)
{
CoroutineHost.StartCoroutine(ShowIngameMessage_async("Modders do not recommend loading multiple savegames without restarting the game."));
}
}
else
{
ReturnfromSavegameWarning.AnySavegamewasloaded = true;
}
}
public static IEnumerator ShowIngameMessage_async(string Message)
{
yield return new WaitForSecondsRealtime(2);
yield return new WaitForSeconds(3);
ErrorMessage.AddMessage(Message);
}
}

[HarmonyPatch(typeof(uGUI_MainMenu), nameof(uGUI_MainMenu.Awake))]
internal static class ReturnfromSavegameWarninguGUI_MainMenuAwake
{
[HarmonyPostfix]
internal static void Postfix(uGUI_OptionsPanel __instance)
{
if (ReturnfromSavegameWarning.AnySavegamewasloaded)
{
MyLogger.Logger.Error("Entering Main Menu after playing a Savegame. Modders do not recommend to start or load a Savegame now. Restart the Game to prevent errors or unexpected behaviour");
if (Utility.Config.ShowWarnOnLoadSecondSave)
{
//QModServices.Main.AddCriticalMessage("Note that Modders recommend to restart the Game before loading the next Savegame", 15, "orange");
}
}
}
}
}
Loading