forked from akanyan/mu3-mods
feat!: rename and reorganize
This commit is contained in:
8
Fixes/FrameRate/FrameRate.csproj
Normal file
8
Fixes/FrameRate/FrameRate.csproj
Normal file
@ -0,0 +1,8 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Assembly-CSharp.FrameRate.mm</AssemblyName>
|
||||
<Description>Unlock frame rate</Description>
|
||||
<OutCategory>fixes</OutCategory>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\..\Mu3Mods.csproj" />
|
||||
</Project>
|
26
Fixes/FrameRate/MU3.Notes/patch_NotesManager.cs
Normal file
26
Fixes/FrameRate/MU3.Notes/patch_NotesManager.cs
Normal file
@ -0,0 +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() {
|
||||
if(_altMode) {
|
||||
_frame = _frameReal;
|
||||
} else {
|
||||
orig_progressFrameAndFrameReal();
|
||||
}
|
||||
}
|
||||
}
|
38
Fixes/FrameRate/MU3.Sys/patch_Config.cs
Normal file
38
Fixes/FrameRate/MU3.Sys/patch_Config.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace MU3.Sys;
|
||||
|
||||
class patch_Config: Config {
|
||||
public int framerate { get; private set; }
|
||||
public bool isVsync { get; private set; }
|
||||
|
||||
public extern void orig_initialize();
|
||||
public new void initialize() {
|
||||
orig_initialize();
|
||||
|
||||
using IniFile iniFile = new("mu3.ini");
|
||||
|
||||
framerate = iniFile.getIntValue("Video", "Framerate", 60);
|
||||
isVsync = iniFile.getValue("Video", "VSync", false);
|
||||
|
||||
if(framerate == 0) {
|
||||
framerate = -1;
|
||||
}
|
||||
|
||||
if(isVsync) {
|
||||
QualitySettings.vSyncCount = 1;
|
||||
framerate = -1;
|
||||
Debug.Log("[UnlockFrameRate] VSync on");
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
29
Fixes/FrameRate/MU3.Sys/patch_Time.cs
Normal file
29
Fixes/FrameRate/MU3.Sys/patch_Time.cs
Normal file
@ -0,0 +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;
|
||||
}
|
||||
if(_altMode) {
|
||||
_deltaTime = UnityEngine.Time.deltaTime;
|
||||
_realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartup;
|
||||
} else {
|
||||
orig_update();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user