forked from akanyan/mu3-mods
feat!: rename and reorganize
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user