diff --git a/1.5/Assemblies/BetterLoading.dll b/1.5/Assemblies/BetterLoading.dll
new file mode 100644
index 0000000..657e6c0
Binary files /dev/null and b/1.5/Assemblies/BetterLoading.dll differ
diff --git a/1.5/Assemblies/Tomlet.dll b/1.5/Assemblies/Tomlet.dll
new file mode 100644
index 0000000..a2dfea7
Binary files /dev/null and b/1.5/Assemblies/Tomlet.dll differ
diff --git a/About/About.xml b/About/About.xml
index e5ee1ad..dcd3169 100755
--- a/About/About.xml
+++ b/About/About.xml
@@ -10,6 +10,7 @@
1.2
1.3
1.4
+ 1.5
Ludeon.RimWorld
diff --git a/LoadFolders.xml b/LoadFolders.xml
index a295e35..ba05397 100644
--- a/LoadFolders.xml
+++ b/LoadFolders.xml
@@ -15,4 +15,8 @@
1.4
+
+ 1.5
+
+
\ No newline at end of file
diff --git a/Source/BetterLoading.csproj b/Source/BetterLoading.csproj
index 0bed12d..9aea8ae 100755
--- a/Source/BetterLoading.csproj
+++ b/Source/BetterLoading.csproj
@@ -9,12 +9,12 @@
true
- ..\1.4\Assemblies\
- ..\1.4\Assemblies\
+ ..\1.5\Assemblies\
+ ..\1.5\Assemblies\
- ..\1.4\Assemblies\
- ..\1.4\Assemblies\
+ ..\1.5\Assemblies\
+ ..\1.5\Assemblies\
diff --git a/Source/Stage/InitialLoad/7StageRunPostLoadPreFinalizeCallbacks.cs b/Source/Stage/InitialLoad/7StageRunPostLoadPreFinalizeCallbacks.cs
index f141027..6d1d14e 100755
--- a/Source/Stage/InitialLoad/7StageRunPostLoadPreFinalizeCallbacks.cs
+++ b/Source/Stage/InitialLoad/7StageRunPostLoadPreFinalizeCallbacks.cs
@@ -37,8 +37,16 @@ public override string GetStageName()
if (_currentAction == null)
return "Waiting for tasks to start being processed...";
- if(_currentAction is { Target: ModContentPack mcp, Method.Name: nameof(ModContentPack.ReloadContent) + "Int" })
- return $"Reloading content for {mcp.Name}";
+ if(_currentAction.Method is {} method && method.DeclaringType?.DeclaringType == typeof(ModContentPack))
+ {
+ //On 1.4 this Action was directly just a call to ModContentPack.ReloadContentInt.
+ //Now on 1.5 it's an anon method wrapping that call due to a hotReload bool being added.
+ //Let's try to grab the mod if we can
+ var anonTypeInst = _currentAction.Target;
+ //Compiler generated field `<>4__this` is the ModContentPack itself.
+ if(anonTypeInst.GetType()?.GetField("<>4__this", AccessTools.all) is {} theField && theField.GetValue(anonTypeInst) is ModContentPack mcp)
+ return $"Reloading content for {mcp.Name}";
+ }
var methodDeclaringType = _currentAction.Method.DeclaringType?.FullName ?? "";
var methodName = _currentAction.Method?.Name ?? "";
@@ -104,6 +112,7 @@ public static bool PreExecToExecWhenFinished(List ___toExecuteWhenFinish
2 => "b__4_2",
3 => "b__4_3",
4 => "b__4_5",
+ 5 => "b__4_4",
_ => throw new ArgumentOutOfRangeException()
};
diff --git a/Source/Stage/InitialLoad/8StageRunStaticCctors.cs b/Source/Stage/InitialLoad/8StageRunStaticCctors.cs
index b4f49e7..0b85516 100755
--- a/Source/Stage/InitialLoad/8StageRunStaticCctors.cs
+++ b/Source/Stage/InitialLoad/8StageRunStaticCctors.cs
@@ -62,11 +62,11 @@ public override bool IsCompleted()
public override void DoPatching(Harmony instance)
{
- if (VersionControl.CurrentMinor == 4)
+ if (VersionControl.CurrentMinor is 4 or 5)
{
//1.4, we need to patch the entire b__4_5 method and make it not run, instead of just CallAll, because there's 2 other method calls in that anon method which we don't wanna do until after static constructors
var anonType = typeof(PlayDataLoader).GetNestedTypes(AccessTools.all).First(t => t.Name.Contains("<>"));
- var method = AccessTools.Method(anonType, "b__4_5");
+ var method = AccessTools.Method(anonType, VersionControl.CurrentMinor == 4 ? "b__4_5" : "b__4_4");
instance.Patch(method, new HarmonyMethod(typeof(StageRunStaticCctors), nameof(PreCallAll)));
}
else
diff --git a/Source/Stage/SaveLoad/4FinalizeMap.cs b/Source/Stage/SaveLoad/4FinalizeMap.cs
index a3b53ff..e6ef758 100644
--- a/Source/Stage/SaveLoad/4FinalizeMap.cs
+++ b/Source/Stage/SaveLoad/4FinalizeMap.cs
@@ -94,7 +94,7 @@ public override void DoPatching(Harmony instance)
//SpawnThings
instance.Patch(
- AccessTools.Method(typeof(GenSpawn), nameof(GenSpawn.Spawn), new[] {typeof(Thing), typeof(IntVec3), typeof(Map), typeof(Rot4), typeof(WipeMode), typeof(bool)}),
+ AccessTools.Method(typeof(GenSpawn), nameof(GenSpawn.Spawn), new[] {typeof(Thing), typeof(IntVec3), typeof(Map), typeof(Rot4), typeof(WipeMode), typeof(bool), typeof(bool)}),
new(typeof(FinalizeMap), nameof(OnThingAboutToSpawn))
);