diff --git a/Config/XUi/controls.xml b/Config/XUi/controls.xml index 2d1d2ca..0ef85f3 100644 --- a/Config/XUi/controls.xml +++ b/Config/XUi/controls.xml @@ -19,4 +19,11 @@ + + + true + WheelItemStack, InventoryMouseWheel + + + \ No newline at end of file diff --git a/Harmony/InventoryMouseWheel.cs b/Harmony/InventoryMouseWheel.cs index 98488f9..063d81d 100644 --- a/Harmony/InventoryMouseWheel.cs +++ b/Harmony/InventoryMouseWheel.cs @@ -6,7 +6,6 @@ public class InventoryMouseWheel : IModApi { - static readonly Type TypeItemStack = AccessTools.TypeByName("Quartz.ItemStack"); public void InitMod(Mod mod) { @@ -14,4 +13,50 @@ public void InitMod(Mod mod) var harmony = new Harmony(GetType().ToString()); harmony.PatchAll(Assembly.GetExecutingAssembly()); } + + + // **************************************************** + // Implementation to postpone our xml patching. + // Allows us to run after our dependencies :-) + // **************************************************** + + // Return in our load order + [HarmonyPatch(typeof(ModManager))] + [HarmonyPatch("GetLoadedMods")] + public class ModManager_GetLoadedMods + { + static void Postfix(ref List __result) + { + int myPos = -1, depPos = -1; + if (__result == null) return; + // Find position of mods we depend on + for (int i = 0; i < __result.Count; i += 1) + { + switch (__result[i].ModInfo.Name.Value) + { + // case "SMXui": + case "Z_Ravenhearst_ResizedBackpack": + depPos = Mathf.Max(depPos, i + 1); + break; + case "OcbInventoryMouseWheel": + myPos = i; + break; + } + } + // Didn't detect ourself? + if (myPos == -1) + { + Log.Error("Did not detect our own Mod?"); + return; + } + // Detected no dependencies? + if (depPos == -1) return; + // Move our mod after deps + var item = __result[myPos]; + __result.RemoveAt(myPos); + if (depPos > myPos) depPos--; + __result.Insert(depPos, item); + } + } + } diff --git a/InventoryMouseWheel.csproj b/InventoryMouseWheel.csproj index 6c35c0c..82d7c43 100644 --- a/InventoryMouseWheel.csproj +++ b/InventoryMouseWheel.csproj @@ -79,7 +79,6 @@ - diff --git a/InventoryMouseWheel.dll b/InventoryMouseWheel.dll index 4432093..47e830a 100644 Binary files a/InventoryMouseWheel.dll and b/InventoryMouseWheel.dll differ diff --git a/ModInfo.xml b/ModInfo.xml index 7f1d0d5..7f62dfc 100644 --- a/ModInfo.xml +++ b/ModInfo.xml @@ -5,6 +5,6 @@ - + \ No newline at end of file diff --git a/README.md b/README.md index 4a852ee..b25d95a 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,10 @@ Simply [download here from GitHub][1] and put into your A20 Mods folder: ## Changelog +### Version 0.1.1 + +- Add Ravenhearst 8.5 compatibility + ### Version 0.1.0 - Add Darkness Falls compatibility diff --git a/SmxCompat/InventoryMouseWheelSMX.dll b/SmxCompat/InventoryMouseWheelSMX.dll index 7050c37..d55dc97 100644 Binary files a/SmxCompat/InventoryMouseWheelSMX.dll and b/SmxCompat/InventoryMouseWheelSMX.dll differ