diff --git a/Generics/FullSettingsMod.cs b/Generics/FullSettingsMod.cs index 9a6a198..f594640 100644 --- a/Generics/FullSettingsMod.cs +++ b/Generics/FullSettingsMod.cs @@ -3,21 +3,24 @@ namespace SFCore.Generics { - public abstract class FullSettingsMod : Mod where TSave : ModSettings, new() where TGlobal : ModSettings, new() + public abstract class FullSettingsMod : Mod, ILocalSettings, IGlobalSettings where TSave : new() where TGlobal : new() { - public override ModSettings SaveSettings - { - get => _saveSettings; - set => _saveSettings = (TSave) value; - } - public override ModSettings GlobalSettings - { - get => _globalSettings; - set => _globalSettings = (TGlobal) value; - } - protected TSave _saveSettings = new TSave(); - protected Type _saveSettingsType = typeof(TSave); - protected TGlobal _globalSettings = new TGlobal(); + // The global settings for this mod. The settings load will only occur once + // so a static field should be used to prevent loss of data + public static TGlobal _globalSettings { get; protected set; } + // Implement the GlobalSettings interface. + // This method gets called when the mod loader loads the global settings. + public void OnLoadGlobal(TGlobal s) => _globalSettings = s; + // This method gets called when the mod loader needs to save the global settings. + public TGlobal OnSaveGlobal() => _globalSettings; + + // The save data specific to a certain savefile. This setting will be loaded each time a save is opened. + public TSave _saveSettings { get; protected set; } + // Implement the LocalSettings interface. + // This method gets called when a save is loaded. + public void OnLoadLocal(TSave s) => this._saveSettings = s; + // This method gets called when the player saves their file. + public TSave OnSaveLocal() => this._saveSettings; public FullSettingsMod() {} public FullSettingsMod(string name) : base(name) {} diff --git a/Generics/GlobalSettingsMod.cs b/Generics/GlobalSettingsMod.cs index 5fe268f..8699666 100644 --- a/Generics/GlobalSettingsMod.cs +++ b/Generics/GlobalSettingsMod.cs @@ -1,17 +1,17 @@ -using System; -using Modding; +using Modding; namespace SFCore.Generics { - public abstract class GlobalSettingsMod : Mod where TGlobal : ModSettings, new() + public abstract class GlobalSettingsMod : Mod, IGlobalSettings where TGlobal : new() { - public override ModSettings GlobalSettings - { - get => _globalSettings; - set => _globalSettings = (TGlobal) value; - } - protected TGlobal _globalSettings = new TGlobal(); - protected Type _globalSettingsType = typeof(TGlobal); + // The global settings for this mod. The settings load will only occur once + // so a static field should be used to prevent loss of data + public static TGlobal _globalSettings { get; protected set; } + // Implement the GlobalSettings interface. + // This method gets called when the mod loader loads the global settings. + public void OnLoadGlobal(TGlobal s) => _globalSettings = s; + // This method gets called when the mod loader needs to save the global settings. + public TGlobal OnSaveGlobal() => _globalSettings; public GlobalSettingsMod() { } public GlobalSettingsMod(string name) : base(name) { } diff --git a/Generics/SaveSettingsMod.cs b/Generics/SaveSettingsMod.cs index af96ea5..dce9172 100644 --- a/Generics/SaveSettingsMod.cs +++ b/Generics/SaveSettingsMod.cs @@ -1,17 +1,16 @@ -using System; -using Modding; +using Modding; namespace SFCore.Generics { - public abstract class SaveSettingsMod : Mod where TSave : ModSettings, new() + public abstract class SaveSettingsMod : Mod, ILocalSettings where TSave : new() { - public override ModSettings SaveSettings - { - get => _saveSettings; - set => _saveSettings = (TSave) value; - } - protected TSave _saveSettings = new TSave(); - protected Type _saveSettingsType = typeof(TSave); + // The save data specific to a certain savefile. This setting will be loaded each time a save is opened. + public TSave _saveSettings { get; protected set; } + // Implement the LocalSettings interface. + // This method gets called when a save is loaded. + public void OnLoadLocal(TSave s) => this._saveSettings = s; + // This method gets called when the player saves their file. + public TSave OnSaveLocal() => this._saveSettings; public SaveSettingsMod() { } public SaveSettingsMod(string name) : base(name) { } diff --git a/ItemHelper.cs b/ItemHelper.cs index 4e892f3..e2d1c6f 100644 --- a/ItemHelper.cs +++ b/ItemHelper.cs @@ -1,4 +1,5 @@ -using SFCore.Utils; +using System; +using SFCore.Utils; using UnityEngine; using HutongGames.PlayMaker; using HutongGames.PlayMaker.Actions; @@ -59,9 +60,9 @@ static ItemHelper() langStrings = new LanguageStrings(Assembly.GetExecutingAssembly(), "SFCore.Resources.Language.json", Encoding.UTF8); - ModHooks.Instance.LanguageGetHook += LanguageGetHook; - ModHooks.Instance.GetPlayerBoolHook += GetPlayerBoolHook; - ModHooks.Instance.GetPlayerIntHook += GetPlayerIntHook; + ModHooks.LanguageGetHook += LanguageGetHook; + ModHooks.GetPlayerBoolHook += GetPlayerBoolHook; + ModHooks.GetPlayerIntHook += GetPlayerIntHook; On.GameCameras.Start += GameCamerasOnStart; } diff --git a/MonoBehaviours/BlurPlanePatcher.cs b/MonoBehaviours/BlurPlanePatcher.cs index b7b53d0..5798cba 100644 --- a/MonoBehaviours/BlurPlanePatcher.cs +++ b/MonoBehaviours/BlurPlanePatcher.cs @@ -28,7 +28,9 @@ public void Start() blurPlaneMaterials[0].SetInt(Shader.PropertyToID("_StencilReadMask"), 255); } - var bp = gameObject.AddComponent(); + var bp = gameObject.GetComponent(); + if (bp == null) + bp = gameObject.AddComponent(); var mr = gameObject.GetComponent(); mr.materials = blurPlaneMaterials; mr.material = blurPlaneMaterials[0]; diff --git a/MonoBehaviours/CueHolder.cs b/MonoBehaviours/CueHolder.cs new file mode 100644 index 0000000..ed1b06a --- /dev/null +++ b/MonoBehaviours/CueHolder.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using HutongGames.PlayMaker.Actions; +using SFCore.Utils; +using UnityEngine; +using UnityEngine.Audio; + +namespace SFCore.MonoBehaviours +{ + internal static class CueHolder + { + public static Dictionary MusicCues = new Dictionary(); + public static Dictionary AtmosCues = new Dictionary(); + + public static MusicCue GetMusicCue(string set, AudioMixerSnapshot snapshot, AudioClip[] clips, SceneManagerPatcher.MusicChannelSync[] syncs) + { + if (!MusicCues.ContainsKey(set)) + { + var tmpMC = ScriptableObject.CreateInstance(); + tmpMC.SetAttr("originalMusicEventName", "CROSSROADS"); + tmpMC.SetAttr("originalMusicTrackNumber", 2); + tmpMC.SetAttr("snapshot", snapshot); + tmpMC.SetAttr("alternatives", null); + MusicCue.MusicChannelInfo[] musicChannelInfos = new MusicCue.MusicChannelInfo[] + { + new MusicCue.MusicChannelInfo(), new MusicCue.MusicChannelInfo(), + new MusicCue.MusicChannelInfo(), new MusicCue.MusicChannelInfo(), + new MusicCue.MusicChannelInfo(), new MusicCue.MusicChannelInfo() + }; + musicChannelInfos[(int) MusicChannels.Main].SetAttr("clip", clips[(int) MusicChannels.Main]); + musicChannelInfos[(int) MusicChannels.Action].SetAttr("clip", clips[(int) MusicChannels.Action]); + musicChannelInfos[(int) MusicChannels.Sub].SetAttr("clip", clips[(int) MusicChannels.Sub]); + musicChannelInfos[(int) MusicChannels.Tension].SetAttr("clip", clips[(int) MusicChannels.Tension]); + musicChannelInfos[(int) MusicChannels.MainAlt].SetAttr("clip", clips[(int) MusicChannels.MainAlt]); + musicChannelInfos[(int) MusicChannels.Extra].SetAttr("clip", clips[(int) MusicChannels.Extra]); + musicChannelInfos[(int) MusicChannels.Main].SetAttr("sync", (MusicChannelSync) syncs[(int) MusicChannels.Main]); + musicChannelInfos[(int) MusicChannels.Action].SetAttr("sync", (MusicChannelSync) syncs[(int) MusicChannels.Action]); + musicChannelInfos[(int) MusicChannels.Sub].SetAttr("sync", (MusicChannelSync) syncs[(int) MusicChannels.Sub]); + musicChannelInfos[(int) MusicChannels.Tension].SetAttr("sync", (MusicChannelSync) syncs[(int) MusicChannels.Tension]); + musicChannelInfos[(int) MusicChannels.MainAlt].SetAttr("sync", (MusicChannelSync) syncs[(int) MusicChannels.MainAlt]); + musicChannelInfos[(int) MusicChannels.Extra].SetAttr("sync", (MusicChannelSync) syncs[(int) MusicChannels.Extra]); + tmpMC.SetAttr("channelInfos", musicChannelInfos); + MusicCues.Add(set, tmpMC); + } + return MusicCues[set]; + } + public static AtmosCue GetAtmosCue(string set, AudioMixerSnapshot snapshot, bool[] isChannelEnabled) + { + if (!AtmosCues.ContainsKey(set)) + { + var tmpAC = ScriptableObject.CreateInstance(); + tmpAC.SetAttr("snapshot", snapshot); + tmpAC.SetAttr("isChannelEnabled", isChannelEnabled); + AtmosCues.Add(set, tmpAC); + } + return AtmosCues[set]; + } + } +} diff --git a/MonoBehaviours/PatchMusicRegions.cs b/MonoBehaviours/PatchMusicRegions.cs index db5af21..c2f4a2a 100644 --- a/MonoBehaviours/PatchMusicRegions.cs +++ b/MonoBehaviours/PatchMusicRegions.cs @@ -11,7 +11,6 @@ namespace SFCore.MonoBehaviours public class PatchMusicRegions : MonoBehaviour { private static AudioMixer am = null; - private static Dictionary cues = new Dictionary(); public bool useAlts = false; public static bool altMusic = false; @@ -63,16 +62,16 @@ public void Start() mr.exitMusicSnapshot = null; mr.exitTrackEvent = ""; mr.exitTransitionTime = 0; - if (!cues.ContainsKey(MusicRegionSet)) + if (!CueHolder.MusicCues.ContainsKey(MusicRegionSet)) { var tmpMC = ScriptableObject.CreateInstance(); tmpMC.SetAttr("originalMusicEventName", EnterTrackEvent); tmpMC.SetAttr("originalMusicTrackNumber", 2); - tmpMC.SetAttr("snapshot", am.FindSnapshot("Normal")); + tmpMC.SetAttr("snapshot", snapshot); tmpMC.SetAttr("alternatives", null); - cues.Add(MusicRegionSet, tmpMC); + CueHolder.MusicCues.Add(MusicRegionSet, tmpMC); } - mr.enterMusicCue = cues[MusicRegionSet]; + mr.enterMusicCue = CueHolder.MusicCues[MusicRegionSet]; MusicCue.MusicChannelInfo[] musicChannelInfos = new MusicCue.MusicChannelInfo[] { diff --git a/MonoBehaviours/SceneManagerPatcher.cs b/MonoBehaviours/SceneManagerPatcher.cs new file mode 100644 index 0000000..e713916 --- /dev/null +++ b/MonoBehaviours/SceneManagerPatcher.cs @@ -0,0 +1,271 @@ +using GlobalEnums; +using SFCore.Utils; +using System.Linq; +using UnityEngine; +using UnityEngine.Audio; + +namespace SFCore.MonoBehaviours +{ + public class SceneManagerPatcher : MonoBehaviour + { + private static AudioMixer MusicAM = null; + private static AudioMixer AtmosAM = null; + private static AudioMixer EnviroAM = null; + private static AudioMixer ActorAM = null; + private static AudioMixer ShadeAM = null; + + [Header("Gameplay Scene Settings")] + [Tooltip("The area of the map this scene belongs to.")] + [Space(6f)] + public MapZone mapZone = MapZone.TOWN; + [Tooltip("Determines if this area is currently windy.")] + public bool isWindy = false; + [Tooltip("Determines if this level experiences tremors.")] + public bool isTremorZone = false; + [Tooltip("Set environment type on scene entry.")] + public EnviromentType environmentType = EnviromentType.Dust; + [Tooltip("Set darkness level on scene entry.")] + public DarknessLevel darknessLevel = DarknessLevel.Normal; + [Tooltip("Determines if the lantern is deactivated.")] + public bool noLantern = false; + + [Header("Camera Color Correction Curves")] + [Range(0f, 5f)] + public float saturation = 0.7f; + public bool ignorePlatformSaturationModifiers = false; + public AnimationCurve redChannel = AnimationCurve.Linear(0, 0, 1, 1); + public AnimationCurve greenChannel = AnimationCurve.Linear(0, 0, 1, 1); + public AnimationCurve blueChannel = AnimationCurve.Linear(0, 0, 1, 1); + + [Header("Ambient Light")] + [Tooltip("The default ambient light colour for this scene.")] + [Space(6f)] + public Color defaultColor = new Color(1, 1, 1, 1); + [Tooltip("The intensity of the ambient light in this scene.")] + [Range(0f, 1f)] + public float defaultIntensity = 0.8f; + + [Header("Hero Light")] + [Tooltip("Color of the hero's light gradient (not point lights)")] + [Space(6f)] + public Color heroLightColor = new Color(1, 1, 1, 0.48f); + + [Header("Scene Particles")] + public bool noParticles = false; + public MapZone overrideParticlesWith = MapZone.NONE; + + [Header("Audio Snapshots")] + [Space(6f)] + public string AtmosCueSet = ""; + public string AtmosCueSnapshotName = "at Surface"; // AtmosCue + public AtmosChoices AtmosCueSnapshotIndex = AtmosChoices.Surface; // AtmosCue + [ArrayForEnum(typeof(AtmosChannels))] + public bool[] AtmosCueIsChannelEnabled = new[] { false, true, false, true, false, true, true, false, false, false, false, false, false, false, false, false }; // AtmosCue + public string MusicCueSet = ""; + public string MusicCueSnapshotName = "Silent"; // MusicCue + public MusicChoices MusicCueSnapshotIndex = MusicChoices.Silent; // MusicCue + [ArrayForEnum(typeof(MusicChannels))] + public AudioClip[] MusicCueChannelInfoClips = new AudioClip[] { null, null, null, null, null, null }; // MusicCue + [ArrayForEnum(typeof(MusicChannels))] + public MusicChannelSync[] MusicCueChannelInfoSyncs = new MusicChannelSync[] { MusicChannelSync.Implicit, MusicChannelSync.Implicit, MusicChannelSync.Implicit, MusicChannelSync.Implicit, MusicChannelSync.Implicit, MusicChannelSync.Implicit }; // MusicCue + public string InfectedMusicCueSet = ""; + public string InfectedMusicCueSnapshotName = "Silent"; // InfectedMusicCue + public MusicChoices InfectedMusicCueSnapshotIndex = MusicChoices.Silent; // InfectedMusicCue + [ArrayForEnum(typeof(MusicChannels))] + public AudioClip[] InfectedMusicCueChannelInfoClips = new AudioClip[] { null, null, null, null, null, null }; // InfectedMusicCue + [ArrayForEnum(typeof(MusicChannels))] + public MusicChannelSync[] InfectedMusicCueChannelInfoSyncs = new MusicChannelSync[] { MusicChannelSync.Implicit, MusicChannelSync.Implicit, MusicChannelSync.Implicit, MusicChannelSync.Implicit, MusicChannelSync.Implicit, MusicChannelSync.Implicit }; // InfectedMusicCue + public string MsSnapshotName = "Silent"; // MusicSnapshot + public MusicChoices MsSnapshotIndex = MusicChoices.Silent; // MusicSnapshot + public float musicDelayTime = 0; + public float musicTransitionTime = 3; + public string AtsSnapshotName = "at Surface"; // AtmosSnapshot + public AtmosChoices AtsSnapshotIndex = AtmosChoices.Surface; // AtmosSnapshot + public string EsSnapshotName = "en Cliffs"; // EnviroSnapshot + public EnviroChoices EsSnapshotIndex = EnviroChoices.Cliffs; // EnviroSnapshot + public string AcsSnapshotName = "On"; // ActorSnapshot + public ActorChoices AcsSnapshotIndex = ActorChoices.On; // ActorSnapshot + public string SsSnapshotName = "Away"; // ShadeSnapshot + public ShadeChoices SsSnapshotIndex = ShadeChoices.Away; // ShadeSnapshot + public float transitionTime = 0.5f; + + [Header("Mapping")] + [Space(6f)] + public bool manualMapTrigger = false; + + public void Awake() + { + if (MusicAM == null) + { + var ams = Resources.FindObjectsOfTypeAll(); + MusicAM = ams.First(x => x.name == "Music"); + AtmosAM = ams.First(x => x.name == "Atmos"); + EnviroAM = ams.First(x => x.name == "EnviroEffects"); + ActorAM = ams.First(x => x.name == "Actors"); + ShadeAM = ams.First(x => x.name == "ShadeMixer"); + } + + GameObject smGo = new GameObject("_SceneManager"); + smGo.SetActive(false); + var sm = smGo.AddComponent(); + sm.sceneType = SceneType.GAMEPLAY; + sm.mapZone = mapZone; + sm.isWindy = isWindy; + sm.isTremorZone = isTremorZone; + sm.environmentType = (int) environmentType; + sm.darknessLevel = (int) darknessLevel; + sm.noLantern = noLantern; + sm.saturation = saturation; + sm.ignorePlatformSaturationModifiers = ignorePlatformSaturationModifiers; + sm.redChannel = redChannel; + sm.greenChannel = greenChannel; + sm.blueChannel = blueChannel; + sm.defaultColor = defaultColor; + sm.defaultIntensity = defaultIntensity; + sm.heroLightColor = heroLightColor; + sm.noParticles = noParticles; + sm.overrideParticlesWith = overrideParticlesWith; + Modding.Logger.Log($"AtmosCueSnapshotName: {AtmosCueSnapshotName}"); + sm.SetAttr("atmosCue", CueHolder.GetAtmosCue(AtmosCueSet, AtmosAM.FindSnapshot(AtmosCueSnapshotName), AtmosCueIsChannelEnabled)); + Modding.Logger.Log($"MusicCueSnapshotName: {MusicCueSnapshotName}"); + sm.SetAttr("musicCue", CueHolder.GetMusicCue(MusicCueSet, MusicAM.FindSnapshot(MusicCueSnapshotName), MusicCueChannelInfoClips, MusicCueChannelInfoSyncs)); + Modding.Logger.Log($"InfectedMusicCueSnapshotName: {InfectedMusicCueSnapshotName}"); + sm.SetAttr("infectedMusicCue", CueHolder.GetMusicCue(InfectedMusicCueSet, MusicAM.FindSnapshot(InfectedMusicCueSnapshotName), InfectedMusicCueChannelInfoClips, InfectedMusicCueChannelInfoSyncs)); + Modding.Logger.Log($"MsSnapshotName: {MsSnapshotName}"); + sm.SetAttr("musicSnapshot", MusicAM.FindSnapshot(MsSnapshotName)); + sm.SetAttr("musicDelayTime", musicDelayTime); + sm.SetAttr("musicTransitionTime", musicTransitionTime); + Modding.Logger.Log($"AtsSnapshotName: {AtsSnapshotName}"); + sm.atmosSnapshot = AtmosAM.FindSnapshot(AtsSnapshotName); + Modding.Logger.Log($"EsSnapshotName: {EsSnapshotName}"); + sm.enviroSnapshot = EnviroAM.FindSnapshot(EsSnapshotName); + Modding.Logger.Log($"AcsSnapshotName: {AcsSnapshotName}"); + sm.actorSnapshot = ActorAM.FindSnapshot(AcsSnapshotName); + Modding.Logger.Log($"SsSnapshotName: {SsSnapshotName}"); + sm.shadeSnapshot = ShadeAM.FindSnapshot(SsSnapshotName); + sm.transitionTime = transitionTime; + sm.borderPrefab = GameObject.Find("SceneBorder"); + sm.manualMapTrigger = manualMapTrigger; + sm.hollowShadeObject = GameObject.Find("Hollow Shade"); + sm.dreamgateObject = GameObject.Find("dream_gate_object"); + + smGo.SetActive(true); + } + + public enum EnviromentType + { + Dust = 0, + Grass, + Bone, + Spa, + Metal, + NoEffect, + Wet + } + public enum DarknessLevel + { + Undark1 = -1, + Normal = 0, + Dark1, + Dark2 + } + public enum MusicChoices + { + Normal, + NormalAlt, + NormalSoft, + NormalSofter, + NormalFlange, + NormalFlangier, + Action, + ActionAndSub, + SubArea, + Silent, + SilentFlange, + Off, + TensionOnly, + NormalGramaphone, + ActionOnly, + MainOnly, + HKDecline2, + HKDecline3, + HKDecline4, + HKDecline5, + HKDecline6 + } + public enum AtmosChoices + { + None, + Cave, + Surface, + SurfaceInterior, + SurfaceBasement, + SurfaceNook, + RainyIndoors, + RainyOutdoors, + DistantRain, + DistantRainRoom, + Greenpath, + QueensGardens, + Fungus, + FogCanyon, + WaterwaysFlowing, + Waterways, + GreenpathInterior, + FogCanyonMinor, + MinesCrystal, + MinesMachinery, + Deepnest, + DeepnestQuiet, + WindTunnel, + MiscWind + } + public enum EnviroChoices + { + Cave, + Spa, + Cliffs, + Room, + Arena, + Sewerpipe, + FogCanyon, + Dream, + Silent + } + public enum ActorChoices + { + On, + Off + } + public enum ShadeChoices + { + Away, + Close + } + public enum AtmosChannels + { + CaveWind, + SurfaceWind1, + GrassyWind, + SurfaceWind2, + CaveNoises, + RainIndoor, + RainOutdoor, + Greenpath, + Fungus, + FogCanyon, + Waterways, + WaterfallMed, + MinesCrystal, + MinesMachinery, + Deepnest, + MiscWind + } + public enum MusicChannelSync + { + Implicit, + ExplicitOn, + ExplicitOff + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index ac573c9..dc60eed 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ // Buildnummer // Revision // -[assembly: AssemblyVersion("1.4.3.4")] -[assembly: AssemblyFileVersion("1.4.3.4")] +[assembly: AssemblyVersion("1.5.0.0")] +[assembly: AssemblyFileVersion("1.5.0.0")] diff --git a/SFCore.csproj b/SFCore.csproj index 2cee3bc..fd82d2c 100644 --- a/SFCore.csproj +++ b/SFCore.csproj @@ -9,7 +9,7 @@ Properties SFCore SFCore - v3.5 + v4.7.2 512 @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -29,6 +30,7 @@ TRACE prompt 4 + false true @@ -36,43 +38,6 @@ sgKey.snk - - - ..\..\..\GOG\Hollow Knight 1432 Modded\hollow_knight_Data\Managed\Assembly-CSharp.dll - - - False - ..\..\..\GOG\Hollow Knight 1432 Modded\hollow_knight_Data\Managed\Assembly-CSharp-firstpass.dll - - - False - ..\..\..\GOG\Hollow Knight 1432 Modded\hollow_knight_Data\Managed\PlayMaker.dll - - - False - ..\..\..\GOG\Hollow Knight 1432 Modded\hollow_knight_Data\Managed\UnityEngine.dll - - - False - ..\..\..\GOG\Hollow Knight 1432 Modded\hollow_knight_Data\Managed\UnityEngine.AudioModule.dll - - - False - ..\..\..\GOG\Hollow Knight 1432 Modded\hollow_knight_Data\Managed\UnityEngine.CoreModule.dll - - - False - ..\..\..\GOG\Hollow Knight 1432 Modded\hollow_knight_Data\Managed\UnityEngine.ParticleSystemModule.dll - - - False - ..\..\..\GOG\Hollow Knight 1432 Modded\hollow_knight_Data\Managed\UnityEngine.Physics2DModule.dll - - - False - ..\..\..\GOG\Hollow Knight 1432 Modded\hollow_knight_Data\Managed\UnityEngine.UI.dll - - @@ -83,8 +48,10 @@ + + @@ -104,6 +71,348 @@ + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Assembly-CSharp.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Assembly-CSharp-firstpass.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\GalaxyCSharp.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\MMHOOK_Assembly-CSharp.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\MMHOOK_PlayMaker.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mono.Cecil.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mono.Security.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\MonoMod.RuntimeDetour.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\MonoMod.Utils.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\netstandard.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Newtonsoft.Json.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\PlayMaker.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.ComponentModel.Composition.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.Configuration.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.Data.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.Diagnostics.StackTrace.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.Drawing.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.EnterpriseServices.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.Globalization.Extensions.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.IO.Compression.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.IO.Compression.FileSystem.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.Net.Http.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.Numerics.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.Runtime.Serialization.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.Runtime.Serialization.Xml.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.ServiceModel.Internals.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.Transactions.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.Xml.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\System.Xml.XPath.XDocument.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Unity.Timeline.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.AccessibilityModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.AIModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.AndroidJNIModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.AnimationModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.ARModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.AssetBundleModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.AudioModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.ClothModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.ClusterInputModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.ClusterRendererModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.CoreModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.CrashReportingModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.DirectorModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.DSPGraphModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.GameCenterModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.GIModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.GridModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.HotReloadModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.ImageConversionModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.IMGUIModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.InputLegacyModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.InputModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.JSONSerializeModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.LocalizationModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.ParticleSystemModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.PerformanceReportingModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.Physics2DModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.PhysicsModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.ProfilerModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.ScreenCaptureModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.SharedInternalsModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.SpriteMaskModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.SpriteShapeModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.StreamingModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.SubstanceModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.SubsystemsModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.TerrainModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.TerrainPhysicsModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.TextCoreModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.TextRenderingModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.TilemapModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.TLSModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UI.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UIElementsModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UIElementsNativeModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UIModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UmbraModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UNETModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UnityAnalyticsModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UnityConnectModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UnityCurlModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UnityTestProtocolModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UnityWebRequestAssetBundleModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UnityWebRequestAudioModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UnityWebRequestModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UnityWebRequestTextureModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UnityWebRequestWWWModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.VehiclesModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.VFXModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.VideoModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.VirtualTexturingModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.VRModule.dll + + + False + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.WindModule.dll + + + ..\..\..\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.XRModule.dll + + @@ -111,7 +420,7 @@ rem "Copy the Mod's dll into the Mods folder" - copy "$(ProjectDir)$(OutputPath)\$(ProjectName).dll" "E:\GOG\Hollow Knight 1432 Modded\hollow_knight_Data\Managed\Mods\$(ProjectName).dll" + copy "$(ProjectDir)$(OutputPath)\$(ProjectName).dll" "E:\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\$(ProjectName).dll" diff --git a/TitleLogoHelper.cs b/TitleLogoHelper.cs index 5e71dae..ce4ac28 100644 --- a/TitleLogoHelper.cs +++ b/TitleLogoHelper.cs @@ -7,18 +7,17 @@ namespace SFCore { public class TitleLogoHelper { - private static bool initialized = false; private static bool isntanceChanged = false; private static List customLogos = new List(); + static TitleLogoHelper() + { + On.MenuStyleTitle.ctor += OnMenuStyleTitleConstructor; + On.MenuStyleTitle.SetTitle += OnMenuStyleTitleSetTitle; + } + public static void Initialize() { - if (!initialized) - { - On.MenuStyleTitle.ctor += OnMenuStyleTitleConstructor; - On.MenuStyleTitle.SetTitle += OnMenuStyleTitleSetTitle; - initialized = true; - } } public static int AddLogo(Sprite logo) diff --git a/Util/FsmUtil.cs b/Util/FsmUtil.cs index 6932dde..81aa302 100644 --- a/Util/FsmUtil.cs +++ b/Util/FsmUtil.cs @@ -26,7 +26,7 @@ public static FsmEvent AddTransition(this PlayMakerFSM fsm, string stateName, st list.Add(new FsmTransition { ToState = toState, - //ToFsmState = fsm.GetState(toState), + ToFsmState = fsm.GetState(toState), FsmEvent = ret }); state.Transitions = list.ToArray(); @@ -40,7 +40,7 @@ public static FsmEvent AddGlobalTransition(this PlayMakerFSM fsm, string globalE tmpFsmGlobalTransitions.Add(new FsmTransition { ToState = toState, - //ToFsmState = fsm.GetState(toState), + ToFsmState = fsm.GetState(toState), FsmEvent = ret }); fsm.Fsm.GlobalTransitions = tmpFsmGlobalTransitions.ToArray(); @@ -52,7 +52,7 @@ public static void ChangeTransition(this PlayMakerFSM fsm, string stateName, str var state = fsm.Fsm.GetState(stateName); var transition = state.Transitions.First(t => t.EventName.Equals(eventName)); transition.ToState = toState; - //transition.ToFsmState = fsm.GetState(toState); + transition.ToFsmState = fsm.GetState(toState); } public static FsmState GetState(this PlayMakerFSM fsm, string stateName) @@ -66,10 +66,10 @@ public static FsmState CopyState(this PlayMakerFSM fsm, string fromState, string { Name = toState }; - //foreach (var t in copy.Transitions) - //{ - // t.ToFsmState = fsm.GetState(t.ToState); - //} + foreach (var t in copy.Transitions) + { + t.ToFsmState = fsm.GetState(t.ToState); + } List tmpList = new List(fsm.FsmStates); tmpList.Add(copy); fsm.Fsm.States = tmpList.ToArray(); diff --git a/Util/Util.cs b/Util/Util.cs index 2fe22d7..f4d61ba 100644 --- a/Util/Util.cs +++ b/Util/Util.cs @@ -2,6 +2,7 @@ using System.IO; using System.Reflection; using System.Security.Cryptography; +using Modding; using UnityEngine; namespace SFCore.Utils @@ -10,11 +11,11 @@ public static class Util { public static void SetAttr(this TSelf o, string fieldname, TVal value) { - typeof(TSelf).GetField(fieldname, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static).SetValue(o, value); + ReflectionHelper.SetAttr(o, fieldname, value); } public static TVal GetAttr(this TSelf o, string fieldname) { - return (TVal)typeof(TSelf).GetField(fieldname, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static).GetValue(o); + return ReflectionHelper.GetAttr(o, fieldname); } public static string GetVersion(Assembly asm)