diff --git a/About/Manifest.xml b/About/Manifest.xml index 2868cbd..9418e9a 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@  net.pardeike.rimworld.mod.cameraplus - 2.0.1.1 + 2.0.1.3
  • 1.0.0
  • 1.1.0
  • diff --git a/About/ModSync.xml b/About/ModSync.xml index b380c3e..4660f3b 100644 --- a/About/ModSync.xml +++ b/About/ModSync.xml @@ -2,7 +2,7 @@ d47b5c8c-3f08-4ab6-8d0a-bc67e509d15c Camera+ - 2.0.1.1 + 2.0.1.3 False pardeike diff --git a/Source/CameraPlus.csproj b/Source/CameraPlus.csproj index a3e0da6..ef3e9a3 100644 --- a/Source/CameraPlus.csproj +++ b/Source/CameraPlus.csproj @@ -40,17 +40,15 @@ - - - - ..\packages\Lib.Harmony.2.0.0.3\lib\net472\0Harmony.dll + + ..\packages\Lib.Harmony.2.0.0.5\lib\net472\0Harmony.dll ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\Assembly-CSharp.dll @@ -90,6 +88,7 @@ + diff --git a/Source/CrossPromotion.cs b/Source/CrossPromotion.cs index 0cef483..efa28cf 100644 --- a/Source/CrossPromotion.cs +++ b/Source/CrossPromotion.cs @@ -34,8 +34,8 @@ static CrossPromotion() var instance = new Harmony(_crosspromotion); _ = instance.Patch( - SymbolExtensions.GetMethodInfo(() => MainMenuDrawer.Init()), - postfix: new HarmonyMethod(SymbolExtensions.GetMethodInfo(() => MainMenuDrawer_Init_Postfix())) + SymbolExtensions.GetMethodInfo(() => ModLister.RebuildModList()), + postfix: new HarmonyMethod(SymbolExtensions.GetMethodInfo(() => ModLister_RebuildModList_Postfix())) ); _ = instance.Patch( @@ -54,7 +54,7 @@ static CrossPromotion() ); } - static void MainMenuDrawer_Init_Postfix() + static void ModLister_RebuildModList_Postfix() { _ = ModPreviewPath(0); new Thread(() => { FetchPromotionMods(); }).Start(); @@ -167,7 +167,7 @@ static void AsyncDownloadQuery(UGCHandle_t content, string path, Action> cachedVersions = new Dictionary>(); - - static MultiVersionModFix() - { - var instance = new Harmony(_multiversionmodfix); - var aBool = false; - var m_VersionCompatible = AccessTools.Property(typeof(ModMetaData), nameof(ModMetaData.VersionCompatible)).GetGetMethod(); - var m_VersionCompatiblePostfix = SymbolExtensions.GetMethodInfo(() => VersionCompatible_Postfix(null, ref aBool)); - instance.PostfixOnce(m_VersionCompatible, m_VersionCompatiblePostfix); - var m_SetWorkshopItemDataFrom = AccessTools.Method(typeof(Workshop), "SetWorkshopItemDataFrom"); - var m_SetWorkshopItemDataFrom_Postfix = SymbolExtensions.GetMethodInfo(() => SetWorkshopItemDataFrom_Postfix(default, null)); - instance.PostfixOnce(m_SetWorkshopItemDataFrom, m_SetWorkshopItemDataFrom_Postfix); - } - - static void PostfixOnce(this Harmony instance, MethodInfo original, MethodInfo postfix) - { - var postfixes = Harmony.GetPatchInfo(original)?.Postfixes; - if (postfixes == null || !postfixes.Any(patch => patch != null && patch.owner == _multiversionmodfix)) - _ = instance.Patch(original, postfix: new HarmonyMethod(postfix)); - } - - static List GetTaggedVersions(string rootDir) - { - if (cachedVersions.TryGetValue(rootDir, out var cached)) - return cached; - try - { - var xml = new XmlDocument(); - xml.Load(rootDir + Path.DirectorySeparatorChar + "About" + Path.DirectorySeparatorChar + "About.xml"); - var tags = xml.SelectNodes("/ModMetaData/supportedVersions/li").Cast().Select(node => node.InnerText); - var result = tags - .Where(tag => VersionControl.IsWellFormattedVersionString(tag)) - .Select(tag => VersionControl.VersionFromString(tag)).ToList(); - cachedVersions[rootDir] = result; - return result; - } - catch - { - cachedVersions[rootDir] = null; - return null; - } - } - - static void VersionCompatible_Postfix(ModMetaData __instance, ref bool __result) - { - var taggedVersions = GetTaggedVersions(__instance.RootDir.FullName); - if (taggedVersions.NullOrEmpty()) return; - var currentVersion = VersionControl.CurrentVersion; - __result = taggedVersions - .Any(version => - version.Major == currentVersion.Major && - version.Minor == currentVersion.Minor && - (version.Build == 0 || version.Build == currentVersion.Build)); - } - - static void SetWorkshopItemDataFrom_Postfix(UGCUpdateHandle_t updateHandle, WorkshopItemHook hook) - { - var taggedVersions = GetTaggedVersions(hook.Directory.FullName); - if (!taggedVersions.NullOrEmpty()) - { - var tags = taggedVersions.Select(version => version.Major + "." + version.Minor); - _ = tags.AddItem("Mod"); - _ = SteamUGC.SetItemTags(updateHandle, tags.Distinct().ToList()); - } - } -} \ No newline at end of file diff --git a/Source/Properties/AssemblyInfo.cs b/Source/Properties/AssemblyInfo.cs index 880fd5c..9a0ffe6 100644 --- a/Source/Properties/AssemblyInfo.cs +++ b/Source/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.1.1")] -[assembly: AssemblyFileVersion("2.0.1.1")] +[assembly: AssemblyVersion("2.0.1.3")] +[assembly: AssemblyFileVersion("2.0.1.3")] diff --git a/Source/Settings.cs b/Source/Settings.cs index 50d7991..3ace26a 100644 --- a/Source/Settings.cs +++ b/Source/Settings.cs @@ -47,7 +47,7 @@ public class CameraPlusSettings : ModSettings public KeyCode[] cameraSettingsMod = new[] { KeyCode.LeftShift, KeyCode.None }; public KeyCode cameraSettingsKey = KeyCode.Tab; - public KeyCode[] cameraSettingsSave = new [] { KeyCode.LeftAlt, KeyCode.None }; + public KeyCode[] cameraSettingsSave = new[] { KeyCode.LeftAlt, KeyCode.None }; public KeyCode[] cameraSettingsLoad = new[] { KeyCode.LeftShift, KeyCode.None }; public static float minRootResult = 2; @@ -108,7 +108,7 @@ public void DoWindowContents(Rect inRect) list.Gap(16f); - list.Label("Zoom".Translate()); + _ = list.Label("Zoom".Translate()); previous = zoomedInPercent; list.Slider(ref zoomedInPercent, 0.1f, 20f, () => "Near".Translate() + ": " + Math.Round(zoomedInPercent, 1) + "%"); @@ -121,7 +121,7 @@ public void DoWindowContents(Rect inRect) } previous = zoomedOutPercent; - list.Slider(ref zoomedOutPercent, 50f, 100f, () => "Far".Translate() + ": " + Math.Round(zoomedOutPercent, 1) + "%"); + list.Slider(ref zoomedOutPercent, 25f, 100f, () => "Far".Translate() + ": " + Math.Round(zoomedOutPercent, 1) + "%"); maxRootResult = zoomedOutPercent * 2; if (previous != zoomedOutPercent && map != null) { @@ -132,14 +132,14 @@ public void DoWindowContents(Rect inRect) list.Gap(12f); - list.Label("Exponentiality".Translate()); + _ = list.Label("Exponentiality".Translate()); if (list.RadioButton("Off", exponentiality == 0, 8f)) exponentiality = 0; for (var i = 1; i <= 3; i++) if (list.RadioButton(i + "x", exponentiality == i, 8f)) exponentiality = i; list.Gap(16f); - list.Label("SoundNearness".Translate() + ": " + Math.Round(soundNearness * 100, 1) + "%"); + _ = list.Label("SoundNearness".Translate() + ": " + Math.Round(soundNearness * 100, 1) + "%"); list.Slider(ref soundNearness, 0f, 1f, null); list.Gap(6f); @@ -148,7 +148,7 @@ public void DoWindowContents(Rect inRect) list.Gap(24f); - list.Label("HotKeys".Translate()); + _ = list.Label("HotKeys".Translate()); list.Gap(6f); rect = list.GetRect(28f); @@ -200,13 +200,13 @@ public void DoWindowContents(Rect inRect) list.NewColumn(); list.Gap(16f); - list.Label("DollyPercentLabel".Translate()); + _ = list.Label("DollyPercentLabel".Translate()); list.Slider(ref zoomedInDollyPercent, 0f, 4f, () => "Near".Translate() + ": " + Math.Round(zoomedInDollyPercent * 100, 1) + "%"); list.Slider(ref zoomedOutDollyPercent, 0f, 4f, () => "Far".Translate() + ": " + Math.Round(zoomedOutDollyPercent * 100, 1) + " % "); list.Gap(12f); - list.Label("DollyFrictionLabel".Translate()); + _ = list.Label("DollyFrictionLabel".Translate()); list.Slider(ref zoomedInDollyFrictionPercent, 0f, 1f, () => "Near".Translate() + ": " + Math.Round(zoomedInDollyFrictionPercent * 100, 1) + "%"); list.Slider(ref zoomedOutDollyFrictionPercent, 0f, 1f, () => "Far".Translate() + ": " + Math.Round(zoomedOutDollyFrictionPercent * 100, 1) + "%"); list.Gap(-2); diff --git a/Source/packages.config b/Source/packages.config index 8f4ccc5..3a34556 100644 --- a/Source/packages.config +++ b/Source/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/v1.1/Assemblies/0Harmony.dll b/v1.1/Assemblies/0Harmony.dll index a9927f9..0478399 100644 Binary files a/v1.1/Assemblies/0Harmony.dll and b/v1.1/Assemblies/0Harmony.dll differ diff --git a/v1.1/Assemblies/0Harmony.xml b/v1.1/Assemblies/0Harmony.xml index 67e0a83..6fa1ff6 100644 --- a/v1.1/Assemblies/0Harmony.xml +++ b/v1.1/Assemblies/0Harmony.xml @@ -720,7 +720,7 @@ - Set to true before instantiating Harmony to debug Harmony + Set to true before instantiating Harmony to debug Harmony or use an environment variable to set HARMONY_DEBUG to '1' like this: cmd /C "set HARMONY_DEBUG=1 && game.exe" This is for full debugging. To debug only specific patches, use the attribute diff --git a/v1.1/Assemblies/CameraPlus.dll b/v1.1/Assemblies/CameraPlus.dll index 74eeaea..41a126b 100644 Binary files a/v1.1/Assemblies/CameraPlus.dll and b/v1.1/Assemblies/CameraPlus.dll differ