diff --git a/Mu3Mods.csproj b/Mu3Mods.csproj index e249e6c..46a0de9 100644 --- a/Mu3Mods.csproj +++ b/Mu3Mods.csproj @@ -2,7 +2,7 @@ net35 7EVENDAYS⇔HOLIDAYS - 2.0.0 + 2.0.1 true latest x64 diff --git a/Pause/MU3.Sequence/patch_PlayMusic.cs b/Pause/MU3.Sequence/patch_PlayMusic.cs index 8a19624..d6a8383 100644 --- a/Pause/MU3.Sequence/patch_PlayMusic.cs +++ b/Pause/MU3.Sequence/patch_PlayMusic.cs @@ -22,7 +22,7 @@ class patch_PlayMusic: PlayMusic { } public override bool updateState(float deltaTime = -1f) { pauseTimer += deltaTime; - if(Singleton.instance.getStateOn(UIInput.Key.Service)) { + if(Singleton.instance.getStateOn(UIInput.Key.Service) && !Singleton.instance.getStateOn(UIInput.Key.Test)) { if((!Paused && pauseTimer >= PAUSE_CD) || (Paused && pauseTimer >= UNPAUSE_CD)) { Paused = !Paused; pgm.pause(Paused); diff --git a/SkipNotice/MU3/patch_Scene_30_NoticeReward.cs b/SkipNotice/MU3/patch_Scene_30_NoticeReward.cs index 39d92d5..27efb18 100644 --- a/SkipNotice/MU3/patch_Scene_30_NoticeReward.cs +++ b/SkipNotice/MU3/patch_Scene_30_NoticeReward.cs @@ -4,17 +4,20 @@ namespace MU3; class patch_Scene_30_NoticeReward: Scene_30_NoticeReward { private Mode _mode; + public static bool Skipped { get; private set; } private enum State { RankingReward = 2, FadeOut = 8, } private void Start() { + Skipped = false; _mode = new Mode(this); _mode.set(State.RankingReward); SingletonMonoBehaviour.instance.Panel.pushState(0, show: true); } private void Update() { - if(_mode.get() != (int)State.FadeOut && Singleton.instance.getStateOn(UIInput.Key.MenuLeft)) { + if(_mode.get() < (int)State.FadeOut && Singleton.instance.getStateOn(UIInput.Key.MenuLeft)) { + Skipped = true; _mode.set(State.FadeOut); } else { _mode.update(); diff --git a/SkipNotice/MU3/patch_UIGetRewards.cs b/SkipNotice/MU3/patch_UIGetRewards.cs new file mode 100644 index 0000000..30f7b61 --- /dev/null +++ b/SkipNotice/MU3/patch_UIGetRewards.cs @@ -0,0 +1,18 @@ +namespace MU3; +class patch_UIGetRewards: UIGetRewards { + private extern void orig_invokeOnFinish(); + private extern void orig_startNextItem(); + private void invokeOnFinish() => orig_invokeOnFinish(); + private void startNextItem() { + if(!patch_Scene_30_NoticeReward.Skipped) { + orig_startNextItem(); + } + } + void Update() { + // The panel state will still be screwed up for some reason but it won't crash + // This could be improved + if(patch_Scene_30_NoticeReward.Skipped) { + invokeOnFinish(); + } + } +} diff --git a/SkipPreMusicRitual/MU3.Sequence/patch_PlayMusic.cs b/SkipPreMusicRitual/MU3.Sequence/patch_PlayMusic.cs index 119e69c..6f8799b 100644 --- a/SkipPreMusicRitual/MU3.Sequence/patch_PlayMusic.cs +++ b/SkipPreMusicRitual/MU3.Sequence/patch_PlayMusic.cs @@ -1,6 +1,5 @@ using MU3.Battle; using MU3.Util; -using UnityEngine; namespace MU3.Sequence; @@ -13,9 +12,9 @@ class patch_PlayMusic: PlayMusic { orig_Execute_StartCutscene(); ForceSkipped = false; if(Singleton.instance.config.isQuickStart || Singleton.instance.getStateOn(UIInput.Key.MenuLeft)) { + ForceSkipped = true; _gameEngine.skipStartCutscene(); setNextState(EState.Countdown); - ForceSkipped = true; } } } \ No newline at end of file diff --git a/SkipPreMusicRitual/MU3/patch_BattleUI.cs b/SkipPreMusicRitual/MU3/patch_BattleUI.cs index 95352a7..636fa00 100644 --- a/SkipPreMusicRitual/MU3/patch_BattleUI.cs +++ b/SkipPreMusicRitual/MU3/patch_BattleUI.cs @@ -1,4 +1,5 @@ -using MU3.Sequence; +using MonoMod; +using MU3.Sequence; using MU3.Util; using System; using UnityEngine; @@ -6,11 +7,9 @@ using UnityEngine; namespace MU3; class patch_BattleUI: BattleUI { - private extern System.Collections.IEnumerator orig_playReadyProc(Action onFinish); - private System.Collections.IEnumerator playReadyProc(Action onFinish) { - if(!patch_PlayMusic.ForceSkipped) { - yield return orig_playReadyProc(onFinish); - } + [MonoModIgnore] + private extern System.Collections.IEnumerator playReadyProc(Action onFinish); + private System.Collections.IEnumerator playReadyProcSkipped(Action onFinish) { if(!SystemUI.Exists) { onFinish(); yield break; @@ -22,6 +21,15 @@ class patch_BattleUI: BattleUI { time -= Time.deltaTime; } onFinish(); - systemUI.removeCanvas(MU3.Graphics.Const.SortOrder.UI); + systemUI.removeCanvas(Graphics.Const.SortOrder.UI); + } + + public new void playReady(Action onFinish) { + if(patch_PlayMusic.ForceSkipped) { + StartCoroutine(playReadyProcSkipped(onFinish)); + } else { + StartCoroutine(playReadyProc(onFinish)); + } + } } \ No newline at end of file diff --git a/UnlockFrameRate/MU3.Notes/patch_NotesManager.cs b/UnlockFrameRate/MU3.Notes/patch_NotesManager.cs index f35a789..be2973d 100644 --- a/UnlockFrameRate/MU3.Notes/patch_NotesManager.cs +++ b/UnlockFrameRate/MU3.Notes/patch_NotesManager.cs @@ -1,11 +1,26 @@ +using MU3.Game; +using MU3.Sys; +using MU3.Util; + namespace MU3.Notes; class patch_NotesManager: NotesManager { private float _frame; - private float _frameReal; + private bool _altMode; + public extern void orig_initialize(SessionInfo sessionInfo); + public new void initialize(SessionInfo sessionInfo) { + orig_initialize(sessionInfo); + var cfg = (patch_Config)Singleton.instance.config; + _altMode = cfg.isVsync || (cfg.framerate != 60); + } + private extern void orig_progressFrameAndFrameReal(); private void progressFrameAndFrameReal() { - _frame = _frameReal; + if(_altMode) { + _frame = _frameReal; + } else { + orig_progressFrameAndFrameReal(); + } } } diff --git a/UnlockFrameRate/MU3.Sys/patch_Config.cs b/UnlockFrameRate/MU3.Sys/patch_Config.cs index 9675a3d..fb24db2 100644 --- a/UnlockFrameRate/MU3.Sys/patch_Config.cs +++ b/UnlockFrameRate/MU3.Sys/patch_Config.cs @@ -4,18 +4,31 @@ namespace MU3.Sys; class patch_Config: Config { public extern void orig_initialize(); + public int framerate { get; private set; } + public bool isVsync { get; private set; } public new void initialize() { orig_initialize(); using IniFile iniFile = new("mu3.ini"); - if(iniFile.getIntValue("Video", "VSync", 0) != 0) { + framerate = iniFile.getIntValue("Video", "Framerate", -1); + isVsync = iniFile.getValue("Video", "VSync", false); + + if(isVsync) { QualitySettings.vSyncCount = 1; + framerate = -1; Debug.Log("[UnlockFrameRate] VSync on"); } else { - Application.targetFrameRate = iniFile.getIntValue("Video", "Framerate", 60); - Debug.Log("[UnlockFrameRate] Framerate lock: " + Application.targetFrameRate); + Application.targetFrameRate = framerate; + QualitySettings.vSyncCount = 0; + if(framerate == 60) { + Debug.Log("[UnlockFrameRate] Framerate locked to 60 (vanilla)"); + } else if(framerate == -1) { + Debug.Log("[UnlockFrameRate] Framerate unlocked)"); + } else { + Debug.Log("[UnlockFrameRate] Framerate locked to " + framerate); + } } } } diff --git a/UnlockFrameRate/MU3.Sys/patch_Time.cs b/UnlockFrameRate/MU3.Sys/patch_Time.cs index a00b13e..fbf7992 100644 --- a/UnlockFrameRate/MU3.Sys/patch_Time.cs +++ b/UnlockFrameRate/MU3.Sys/patch_Time.cs @@ -1,20 +1,29 @@ +using MU3.Util; + namespace MU3.Sys; class patch_Time: Time { private static bool _init; - private static float _deltaTime; - private static float _adjustAccumlation; - private static float _realtimeSinceStartup; + private static bool _altMode; + public extern static void orig_update(); public static new void update() { if(!_init) { + _deltaTime = UnityEngine.Time.deltaTime; _adjustAccumlation = 0f; + _realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartup; + var cfg = (patch_Config)Singleton.instance.config; + _altMode = cfg.isVsync || (cfg.framerate != 60); _init = true; } - _deltaTime = UnityEngine.Time.deltaTime; - _realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartup; + if(_altMode) { + _deltaTime = UnityEngine.Time.deltaTime; + _realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartup; + } else { + orig_update(); + } } }