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>
<TargetFramework>net35</TargetFramework>
<Company>7EVENDAYS⇔HOLIDAYS</Company>
<Version>2.0.0</Version>
<Version>2.0.1</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<Platforms>x64</Platforms>

View File

@ -22,7 +22,7 @@ class patch_PlayMusic: PlayMusic {
}
public override bool updateState(float deltaTime = -1f) {
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)) {
Paused = !Paused;
pgm.pause(Paused);

View File

@ -4,17 +4,20 @@ namespace MU3;
class patch_Scene_30_NoticeReward: Scene_30_NoticeReward {
private Mode<Scene_30_NoticeReward, State> _mode;
public static bool Skipped { get; private set; }
private enum State {
RankingReward = 2,
FadeOut = 8,
}
private void Start() {
Skipped = false;
_mode = new Mode<Scene_30_NoticeReward, State>(this);
_mode.set(State.RankingReward);
SingletonMonoBehaviour<SystemUI>.instance.Panel.pushState(0, show: true);
}
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);
} else {
_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.Util;
using UnityEngine;
namespace MU3.Sequence;
@ -13,9 +12,9 @@ class patch_PlayMusic: PlayMusic {
orig_Execute_StartCutscene();
ForceSkipped = false;
if(Singleton<Sys.System>.instance.config.isQuickStart || Singleton<UIInput>.instance.getStateOn(UIInput.Key.MenuLeft)) {
ForceSkipped = true;
_gameEngine.skipStartCutscene();
setNextState(EState.Countdown);
ForceSkipped = true;
}
}
}

View File

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

View File

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

View File

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

View File

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