Skip to content

Commit

Permalink
Merge pull request #142 from SubnauticaModding/dev
Browse files Browse the repository at this point in the history
QModManager 3.2.1
  • Loading branch information
PrimeSonic authored May 12, 2020
2 parents 620ab15 + b62482c commit 2e04ca4
Show file tree
Hide file tree
Showing 24 changed files with 367 additions and 61 deletions.
Binary file modified Build/InstallerExtensions.dll
Binary file not shown.
Binary file modified Build/QModInstaller.dll
Binary file not shown.
34 changes: 34 additions & 0 deletions Build/QModInstaller.xml

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

Binary file modified Build/QModManager.exe
Binary file not shown.
Binary file modified Build/QModManager_Setup.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion Data/latest-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0.0
3.2.1.0
30 changes: 13 additions & 17 deletions Dependencies/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
## Dependencies

| Dependency | Link | Redistributed |
|:-------------------------------:|:------------------------------------------------------:|:----------------------------------------:|
| `0Harmony.dll` | https://github.com/pardeike/Harmony | ☑ |
| `0Harmony-1.2.0.1.dll` | https://github.com/pardeike/Harmony | ☑ |
| `Assembly-CSharp.dll` | https://github.com/unknownworlds | &#9744; <br>Game file |
| `Assembly-CSharp-firstpass.dll` | https://github.com/unknownworlds | &#9744; <br>Game file |
| `AssetsTools.NET.dll` | https://github.com/nesrak1/AssetsTools.NET | &#9745; |
| `Carbon.vsf` | https://github.com/RRUZ/vcl-styles-plugins | &#9744; <br>Bundled with the installer |
| `cldb.dat` | https://github.com/DerPopo/UABE | &#9745; <br>Only for Subnautica installs |
| `cldb2018.dat` | https://github.com/DerPopo/UABE | &#9745; <br>Only for Below Zero installs |
| `Mono.Cecil.dll` | https://github.com/jbevain/cecil | &#9745; |
| `Netwonsoft.Json.dll` | https://github.com/JamesNK/Newtonsoft.Json | &#9744; <br>Game file |
| `RGiesecke.DllExport.Metadata.dll` | https://www.nuget.org/packages/UnmanagedExports | &#9744; |
| `SemVer.dll` | https://github.com/adamreeve/semver.net | &#9745; |
| `UnityEngine.dll` | https://github.com/Unity-Technologies/UnityCsReference | &#9744; <br>Game file |
| `UnityEngine.UI.dll` | https://github.com/Unity-Technologies/UnityCsReference | &#9744; <br>Game file |
| `VclStylesinno.dll` | https://github.com/RRUZ/vcl-styles-plugins | &#9744; <br>Bundled with the installer |
| Dependency | Link | Redistributed? | License |
|:----------------------------------:|:------------------------------------------------------:|:--------------------------------------:|:-----------------------------------------------------------------------------------------------:|
| `0Harmony(-*).dll` | https://github.com/pardeike/Harmony | &#9745; | [MIT](https://github.com/pardeike/Harmony/blob/master/LICENSE) |
| `Assembly-CSharp.dll` | https://github.com/unknownworlds | &#9744; <br>Game file | |
| `Assembly-CSharp-firstpass.dll` | https://github.com/unknownworlds | &#9744; <br>Game file | |
| `AssetsTools.NET.dll` | https://github.com/nesrak1/AssetsTools.NET | &#9745; | [MIT](https://github.com/nesrak1/AssetsTools.NET/blob/master/LICENSE) |
| `Carbon.vsf` | https://github.com/RRUZ/vcl-styles-plugins | &#9744; <br>Bundled with the installer | |
| `cldb.dat` | https://github.com/DerPopo/UABE | &#9745; | |
| `Mono.Cecil.dll` | https://github.com/jbevain/cecil | &#9745; | [MIT](https://github.com/jbevain/cecil/blob/master/LICENSE.txt) |
| `Netwonsoft.Json.dll` | https://github.com/JamesNK/Newtonsoft.Json | &#9744; <br>Game file | [MIT](https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md) |
| `RGiesecke.DllExport.Metadata.dll` | https://www.nuget.org/packages/UnmanagedExports | &#9744; | [MIT](https://opensource.org/licenses/mit-license.php) |
| `UnityEngine(.*).dll` | https://github.com/Unity-Technologies/UnityCsReference | &#9744; <br>Game file | [Unity Reference-Only License](https://unity3d.com/legal/licenses/Unity_Reference_Only_License) |
| `VclStylesinno.dll` | https://github.com/RRUZ/vcl-styles-plugins | &#9744; <br>Bundled with the installer | |
4 changes: 2 additions & 2 deletions Executable/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@

[assembly: ComVisible(false)]

[assembly: AssemblyVersion("3.1")]
[assembly: AssemblyFileVersion("3.1")]
[assembly: AssemblyVersion("3.2.1.0")]
[assembly: AssemblyFileVersion("3.2.1.0")]
4 changes: 2 additions & 2 deletions Installer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

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

[assembly: AssemblyVersion("3.1")]
[assembly: AssemblyFileVersion("3.1")]
[assembly: AssemblyVersion("3.2.1.0")]
[assembly: AssemblyFileVersion("3.2.1.0")]
2 changes: 1 addition & 1 deletion Installer/QModsInstallerScript.iss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#endif

#define Name "QModManager" ; The name of the game will be added after it
#define Version "3.1"
#define Version "3.2.1"
#define Author "QModManager"
#define URL "https://github.com/QModManager/QModManager"
#define SupportURL "https://discord.gg/UpWuWwq"
Expand Down
11 changes: 11 additions & 0 deletions QModManager/API/IQModServices.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace QModManager.API
{
using System.Reflection;
using QModManager.Utility;

/// <summary>
/// An set of services provided by QModManager for mods to use.
Expand All @@ -20,5 +21,15 @@ public interface IQModServices : IQModAPI
/// <param name="modAssembly">The mod assembly.</param>
/// <returns>The <see cref="IQMod"/> instance of the mod if found; otherwise returns <c>null</c>.</returns>
IQMod FindModByAssembly(Assembly modAssembly);

/// <summary>
/// Adds a critical message to the main menu.
/// Message will stay in the main menu and on the loading screen.
/// </summary>
/// <param name="msg">The message to add.</param>
/// <param name="size">The size of the text.</param>
/// <param name="color">The color of the text.</param>
/// <param name="autoformat">Whether or not to apply formatting tags to the message, or show it as it is.</param>
void AddCriticalMessage(string msg, int size = MainMenuMessages.defaultSize, string color = MainMenuMessages.defaultColor, bool autoformat = true);
}
}
15 changes: 15 additions & 0 deletions QModManager/API/QModServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.ObjectModel;
using System.Reflection;
using QModManager.Patching;
using QModManager.Utility;

/// <summary>
/// Services offered to mods.
Expand Down Expand Up @@ -116,5 +117,19 @@ public IQMod GetMod(string id)
{
return FindModById(id);
}

/// <summary>
/// Adds a critical message to the main menu.
/// Message will stay in the main menu and on the loading screen.
/// </summary>
/// <param name="msg">The message to add.</param>
/// <param name="size">The size of the text.</param>
/// <param name="color">The color of the text.</param>
/// <param name="autoformat">Whether or not to apply formatting tags to the message, or show it as it is.</param>
public void AddCriticalMessage(string msg, int size = MainMenuMessages.defaultSize, string color = MainMenuMessages.defaultColor, bool autoformat = true)
{
var callingMod = GetMod(ReflectionHelper.CallingAssemblyByStackTrace());
MainMenuMessages.Add(msg, callingMod?.DisplayName, size, color, autoformat);
}
}
}
4 changes: 3 additions & 1 deletion QModManager/Patching/ManifestValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,12 @@ internal ModStatus FindPatchMethods(QMod qMod)
string entryType = string.Join(".", entryMethodSig.Take(entryMethodSig.Length - 1).ToArray());
string entryMethod = entryMethodSig[entryMethodSig.Length - 1];

MethodInfo jsonPatchMethod = qMod.LoadedAssembly.GetType(entryType).GetMethod(entryMethod, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
MethodInfo jsonPatchMethod = qMod.LoadedAssembly.GetType(entryType)?.GetMethod(entryMethod, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);

if (jsonPatchMethod != null && jsonPatchMethod.GetParameters().Length == 0)
{
qMod.PatchMethods[PatchingOrder.NormalInitialize] = new QModPatchMethod(jsonPatchMethod, qMod, PatchingOrder.NormalInitialize);
return ModStatus.Success;
}
}

Expand Down Expand Up @@ -202,6 +203,7 @@ internal ModStatus FindPatchMethods(QMod qMod)
else
{
qMod.PatchMethods[patch.PatchOrder] = new QModPatchMethod(method, qMod, patch.PatchOrder);
continue;
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions QModManager/Patching/QModFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ internal void LoadModsFromDirectories(string[] subDirectories, SortedCollection<

QMod mod = CreateFromJsonManifestFile(subDir);

if(mod == null)
{
Logger.Error($"Unable to set up mod in folder \"{folderName}\"");
earlyErrors.Add(new QModPlaceholder(folderName, ModStatus.MissingCoreInfo));
continue;
}

this.Validator.CheckRequiredMods(mod);

Logger.Debug($"Sorting mod {mod.Id}");
Expand Down
1 change: 0 additions & 1 deletion QModManager/Patching/QModPlaceholder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Reflection;
using System.Text.RegularExpressions;
using QModManager.API;
using System.Reflection;

internal class QModPlaceholder : QMod, IQMod
{
Expand Down
4 changes: 2 additions & 2 deletions QModManager/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

[assembly: ComVisible(false)]

[assembly: AssemblyVersion("3.1")]
[assembly: AssemblyFileVersion("3.1")]
[assembly: AssemblyVersion("3.2.1.0")]
[assembly: AssemblyFileVersion("3.2.1.0")]

[assembly: InternalsVisibleTo("QMMTests")]
[assembly: InternalsVisibleTo("QModManager")]
14 changes: 11 additions & 3 deletions QModManager/QModManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>7.3</LangVersion>
<LangVersion>latest</LangVersion>
<DocumentationFile>..\Build\QModInstaller.xml</DocumentationFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
Expand All @@ -46,37 +47,43 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<LangVersion>latest</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\Build\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>latest</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\Build\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<LangVersion>latest</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\Build\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>latest</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony-1.2.0.1, Version=1.2.0.1, Culture=neutral, processorArchitecture=MSIL">
Expand Down Expand Up @@ -161,6 +168,7 @@
<Compile Include="Patching\QModPlaceholder.cs" />
<Compile Include="Patching\QModPatchMethod.cs" />
<Compile Include="Utility\Config.cs" />
<Compile Include="Utility\MainMenuMessages.cs" />
<Compile Include="Utility\SummaryLogger.cs" />
<Compile Include="Utility\IOUtilities.cs" />
<Compile Include="Utility\Logger.cs" />
Expand Down
5 changes: 5 additions & 0 deletions QModManager/Utility/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ private static void Load()
if (!File.Exists(ConfigPath)) File.WriteAllText(ConfigPath, "{}");
string text = File.ReadAllText(ConfigPath);
Cfg = JsonConvert.DeserializeObject<Dictionary<string, object>>(text);
if (Cfg == null)
{
File.WriteAllText(ConfigPath, "{}");
Cfg = new Dictionary<string, object>();
}

Loaded = true;
}
Expand Down
Loading

0 comments on commit 2e04ca4

Please sign in to comment.