fix: various fixes

This commit is contained in:
あかニャン 2024-07-12 08:14:06 +09:00
parent 26fffefbae
commit c349854cb0
9 changed files with 87 additions and 22 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net35</TargetFramework> <TargetFramework>net35</TargetFramework>
<Company>7EVENDAYS⇔HOLIDAYS</Company> <Company>7EVENDAYS⇔HOLIDAYS</Company>
<Version>2.0.0</Version> <Version>2.0.1</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>

View File

@ -22,7 +22,7 @@ class patch_PlayMusic: PlayMusic {
} }
public override bool updateState(float deltaTime = -1f) { public override bool updateState(float deltaTime = -1f) {
pauseTimer += deltaTime; pauseTimer += deltaTime;
if(Singleton<UIInput>.instance.getStateOn(UIInput.Key.Service)) { if(Singleton<UIInput>.instance.getStateOn(UIInput.Key.Service) && !Singleton<UIInput>.instance.getStateOn(UIInput.Key.Test)) {
if((!Paused && pauseTimer >= PAUSE_CD) || (Paused && pauseTimer >= UNPAUSE_CD)) { if((!Paused && pauseTimer >= PAUSE_CD) || (Paused && pauseTimer >= UNPAUSE_CD)) {
Paused = !Paused; Paused = !Paused;
pgm.pause(Paused); pgm.pause(Paused);

View File

@ -4,17 +4,20 @@ namespace MU3;
class patch_Scene_30_NoticeReward: Scene_30_NoticeReward { class patch_Scene_30_NoticeReward: Scene_30_NoticeReward {
private Mode<Scene_30_NoticeReward, State> _mode; private Mode<Scene_30_NoticeReward, State> _mode;
public static bool Skipped { get; private set; }
private enum State { private enum State {
RankingReward = 2, RankingReward = 2,
FadeOut = 8, FadeOut = 8,
} }
private void Start() { private void Start() {
Skipped = false;
_mode = new Mode<Scene_30_NoticeReward, State>(this); _mode = new Mode<Scene_30_NoticeReward, State>(this);
_mode.set(State.RankingReward); _mode.set(State.RankingReward);
SingletonMonoBehaviour<SystemUI>.instance.Panel.pushState(0, show: true); SingletonMonoBehaviour<SystemUI>.instance.Panel.pushState(0, show: true);
} }
private void Update() { private void Update() {
if(_mode.get() != (int)State.FadeOut && Singleton<UIInput>.instance.getStateOn(UIInput.Key.MenuLeft)) { if(_mode.get() < (int)State.FadeOut && Singleton<UIInput>.instance.getStateOn(UIInput.Key.MenuLeft)) {
Skipped = true;
_mode.set(State.FadeOut); _mode.set(State.FadeOut);
} else { } else {
_mode.update(); _mode.update();

View File

@ -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();
}
}
}

View File

@ -1,6 +1,5 @@
using MU3.Battle; using MU3.Battle;
using MU3.Util; using MU3.Util;
using UnityEngine;
namespace MU3.Sequence; namespace MU3.Sequence;
@ -13,9 +12,9 @@ class patch_PlayMusic: PlayMusic {
orig_Execute_StartCutscene(); orig_Execute_StartCutscene();
ForceSkipped = false; ForceSkipped = false;
if(Singleton<Sys.System>.instance.config.isQuickStart || Singleton<UIInput>.instance.getStateOn(UIInput.Key.MenuLeft)) { if(Singleton<Sys.System>.instance.config.isQuickStart || Singleton<UIInput>.instance.getStateOn(UIInput.Key.MenuLeft)) {
ForceSkipped = true;
_gameEngine.skipStartCutscene(); _gameEngine.skipStartCutscene();
setNextState(EState.Countdown); setNextState(EState.Countdown);
ForceSkipped = true;
} }
} }
} }

View File

@ -1,4 +1,5 @@
using MU3.Sequence; using MonoMod;
using MU3.Sequence;
using MU3.Util; using MU3.Util;
using System; using System;
using UnityEngine; using UnityEngine;
@ -6,11 +7,9 @@ using UnityEngine;
namespace MU3; namespace MU3;
class patch_BattleUI: BattleUI { class patch_BattleUI: BattleUI {
private extern System.Collections.IEnumerator orig_playReadyProc(Action onFinish); [MonoModIgnore]
private System.Collections.IEnumerator playReadyProc(Action onFinish) { private extern System.Collections.IEnumerator playReadyProc(Action onFinish);
if(!patch_PlayMusic.ForceSkipped) { private System.Collections.IEnumerator playReadyProcSkipped(Action onFinish) {
yield return orig_playReadyProc(onFinish);
}
if(!SystemUI.Exists) { if(!SystemUI.Exists) {
onFinish(); onFinish();
yield break; yield break;
@ -22,6 +21,15 @@ class patch_BattleUI: BattleUI {
time -= Time.deltaTime; time -= Time.deltaTime;
} }
onFinish(); 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));
}
} }
} }

View File

@ -1,11 +1,26 @@
using MU3.Game;
using MU3.Sys;
using MU3.Util;
namespace MU3.Notes; namespace MU3.Notes;
class patch_NotesManager: NotesManager { class patch_NotesManager: NotesManager {
private float _frame; private float _frame;
private float _frameReal; 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<Sys.System>.instance.config;
_altMode = cfg.isVsync || (cfg.framerate != 60);
}
private extern void orig_progressFrameAndFrameReal();
private void progressFrameAndFrameReal() { private void progressFrameAndFrameReal() {
if(_altMode) {
_frame = _frameReal; _frame = _frameReal;
} else {
orig_progressFrameAndFrameReal();
}
} }
} }

View File

@ -4,18 +4,31 @@ namespace MU3.Sys;
class patch_Config: Config { class patch_Config: Config {
public extern void orig_initialize(); public extern void orig_initialize();
public int framerate { get; private set; }
public bool isVsync { get; private set; }
public new void initialize() { public new void initialize() {
orig_initialize(); orig_initialize();
using IniFile iniFile = new("mu3.ini"); 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; QualitySettings.vSyncCount = 1;
framerate = -1;
Debug.Log("[UnlockFrameRate] VSync on"); Debug.Log("[UnlockFrameRate] VSync on");
} else { } else {
Application.targetFrameRate = iniFile.getIntValue("Video", "Framerate", 60); Application.targetFrameRate = framerate;
Debug.Log("[UnlockFrameRate] Framerate lock: " + Application.targetFrameRate); 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);
}
} }
} }
} }

View File

@ -1,20 +1,29 @@
using MU3.Util;
namespace MU3.Sys; namespace MU3.Sys;
class patch_Time: Time { class patch_Time: Time {
private static bool _init; private static bool _init;
private static float _deltaTime; private static float _deltaTime;
private static float _adjustAccumlation; private static float _adjustAccumlation;
private static float _realtimeSinceStartup; private static float _realtimeSinceStartup;
private static bool _altMode;
public extern static void orig_update();
public static new void update() { public static new void update() {
if(!_init) { if(!_init) {
_deltaTime = UnityEngine.Time.deltaTime;
_adjustAccumlation = 0f; _adjustAccumlation = 0f;
_realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartup;
var cfg = (patch_Config)Singleton<Sys.System>.instance.config;
_altMode = cfg.isVsync || (cfg.framerate != 60);
_init = true; _init = true;
} }
if(_altMode) {
_deltaTime = UnityEngine.Time.deltaTime; _deltaTime = UnityEngine.Time.deltaTime;
_realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartup; _realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartup;
} else {
orig_update();
}
} }
} }