Skip to content

Commit

Permalink
Merge pull request #35 from KSP2Community/dev
Browse files Browse the repository at this point in the history
0.9.3 Fix
  • Loading branch information
cheese3660 authored Jan 15, 2024
2 parents 9ce0bb9 + 027d0f1 commit 72cc588
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 121 deletions.
10 changes: 0 additions & 10 deletions PatchManager.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Project("{5F1D0BAA-A518-423E-B128-A97490E64B50}") = "PatchManager", "src\PatchMa
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PatchManager.Core", "src\PatchManager.Core\PatchManager.Core.csproj", "{F14D175D-865C-47E8-BCE8-AA14A39FB084}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PatchManager.PreloadPatcher", "src\PatchManager.PreloadPatcher\PatchManager.PreloadPatcher.csproj", "{8BD0F66F-7C47-477D-B519-0118A9F55428}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PatchManager.SassyPatching", "src\PatchManager.SassyPatching\PatchManager.SassyPatching.csproj", "{38D713EA-A57C-4C0E-9B72-09346D3034EE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PatchManager.SassyPatching.Tests", "src\PatchManager.SassyPatching.Tests\PatchManager.SassyPatching.Tests.csproj", "{95F3322B-A566-4BAB-8370-20C92EACDBC1}"
Expand Down Expand Up @@ -48,14 +46,6 @@ Global
{F14D175D-865C-47E8-BCE8-AA14A39FB084}.Deploy|Any CPU.Build.0 = Deploy|Any CPU
{F14D175D-865C-47E8-BCE8-AA14A39FB084}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU
{F14D175D-865C-47E8-BCE8-AA14A39FB084}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU
{8BD0F66F-7C47-477D-B519-0118A9F55428}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BD0F66F-7C47-477D-B519-0118A9F55428}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BD0F66F-7C47-477D-B519-0118A9F55428}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BD0F66F-7C47-477D-B519-0118A9F55428}.Release|Any CPU.Build.0 = Release|Any CPU
{8BD0F66F-7C47-477D-B519-0118A9F55428}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU
{8BD0F66F-7C47-477D-B519-0118A9F55428}.Deploy|Any CPU.Build.0 = Deploy|Any CPU
{8BD0F66F-7C47-477D-B519-0118A9F55428}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU
{8BD0F66F-7C47-477D-B519-0118A9F55428}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU
{38D713EA-A57C-4C0E-9B72-09346D3034EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{38D713EA-A57C-4C0E-9B72-09346D3034EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{38D713EA-A57C-4C0E-9B72-09346D3034EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
11 changes: 9 additions & 2 deletions plugin_template/swinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Patch Manager",
"description": "A mod for generic patching needs similar to KSP 1's Module Manager.",
"source": "https://github.com/KSP2Community/PatchManager",
"version": "0.9.2",
"version": "0.9.3",
"version_check": "https://raw.githubusercontent.com/KSP2Community/PatchManager/main/plugin_template/swinfo.json",
"ksp2_version": {
"min": "0.2.0",
Expand All @@ -15,7 +15,14 @@
{
"id": "com.github.x606.spacewarp",
"version": {
"min": "1.7.0",
"min": "1.8.0",
"max": "*"
}
},
{
"id": "premonition",
"version": {
"min": "0.2.0",
"max": "*"
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/PatchManager.Core/CoreModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public class CoreModule : BaseModule

private bool _wasCacheInvalidated;

private static bool ShouldLoad(string[] disabled, string modInfoLocation)
private static bool ShouldLoad(IEnumerable<string> disabled, string modInfoLocation)
{
if (!File.Exists(modInfoLocation))
return false;
try
{
var metadata = JsonConvert.DeserializeObject<ModInfo>(File.ReadAllText(modInfoLocation));
return metadata.ModID == null || !disabled.Contains(metadata.ModID);
return metadata.ModID == null || disabled.All(x => x != metadata.ModID);
}
catch
{
Expand Down Expand Up @@ -90,8 +90,8 @@ public override void PreLoad()
var gameDataModsExists = Directory.Exists(Path.Combine(Paths.GameRootPath, "GameData/Mods"));

// Go here instead so that the static constructor recognizes everything
var disabledPlugins = File.ReadAllText(Path.Combine(Paths.BepInExRootPath, "disabled_plugins.cfg"))
.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
var disabledPlugins = File.ReadAllText(SpaceWarp.Preload.API.CommonPaths.DisabledPluginsFilepath)
.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList();

var modFolders = Directory.GetDirectories(Paths.PluginPath, "*", SearchOption.AllDirectories)
.Where(dir => ShouldLoad(disabledPlugins, Path.Combine(dir, "swinfo.json")))
Expand Down
3 changes: 2 additions & 1 deletion src/PatchManager.Core/PatchManager.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<ItemGroup Label="NuGet package references">
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" PrivateAssets="all" />
<PackageReference Include="KerbalSpaceProgram2.GameLibs" Version="0.2.0" PrivateAssets="all" Publicize="true" />
<PackageReference Include="SpaceWarp" Version="1.7.0" PrivateAssets="all" Publicize="true" />
<PackageReference Include="Premonition.Core" Version="0.1.0" />
<PackageReference Include="SpaceWarp" Version="1.8.1" PrivateAssets="all" Publicize="true" />
</ItemGroup>
<ItemGroup Label="Project references">
<ProjectReference Include="$(SolutionDir)/src/PatchManager.SassyPatching/PatchManager.SassyPatching.csproj" Private="false" />
Expand Down
5 changes: 5 additions & 0 deletions src/PatchManager.Core/Patches/Preload/AssetProviderPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
using KSP.Assets;
using KSP.Game;
using PatchManager.Core.Assets;
using Premonition.Core.Attributes;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityObject = UnityEngine.Object;

namespace PatchManager.Core.Patches.Preload;

[PremonitionAssembly("Assembly-CSharp")]
[PremonitionType("KSP.Assets.AssetProvider")]
internal static class AssetProviderPatch
{
[PremonitionMethod("LoadByLabel")]
[PremonitionTrampoline]
[UsedImplicitly]
public static void LoadByLabel<T>(
string label,
Expand Down
11 changes: 0 additions & 11 deletions src/PatchManager.PreloadPatcher/Directory.Build.props

This file was deleted.

This file was deleted.

80 changes: 0 additions & 80 deletions src/PatchManager.PreloadPatcher/Patcher.cs

This file was deleted.

3 changes: 0 additions & 3 deletions src/PatchManager.PreloadPatcher/Properties/AssemblyInfo.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal override DataValue GetResult(DataValue leftHandSide, DataValue rightHan
{
try
{
return leftHandSide.Real - rightHandSide.Integer;
return leftHandSide - rightHandSide;
}
catch (DataValueOperationException)
{
Expand Down

0 comments on commit 72cc588

Please sign in to comment.