forked from akanyan/mu3-mods
feat: implement ExclusiveAudio
This commit is contained in:
@ -42,10 +42,10 @@ class TestModePageModConfig: TestModePage {
|
||||
}
|
||||
}
|
||||
|
||||
private bool isEnabled(string v) => typeof(TestMenuEnable).GetNestedType(v) != null;
|
||||
|
||||
private List<Option> _options;
|
||||
private Dictionary<string, string> _onOff;
|
||||
private bool _isDisableGPActive;
|
||||
private bool _isSkipCutscenesActive;
|
||||
private MethodInfo _writeToFile;
|
||||
|
||||
protected new void Awake() {
|
||||
@ -62,8 +62,7 @@ class TestModePageModConfig: TestModePage {
|
||||
{ "OFF", "0" },
|
||||
{ "ON", "1" }
|
||||
};
|
||||
_isDisableGPActive = typeof(UICredit).GetMethod("orig_initialize") != null;
|
||||
_isSkipCutscenesActive = typeof(Notes.NotesManager).GetMethod("orig_reset") != null;
|
||||
|
||||
_writeToFile = typeof(IniFile).GetMethod("writeToFile", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
|
||||
writeOtherOptions();
|
||||
@ -88,7 +87,7 @@ class TestModePageModConfig: TestModePage {
|
||||
{ "RANDOM", "0" }
|
||||
},
|
||||
5,
|
||||
typeof(Game.GameBGM).GetMethod("orig_playBGM") != null
|
||||
isEnabled("SelectBGM")
|
||||
));
|
||||
|
||||
_options.Add(new Option(
|
||||
@ -96,7 +95,7 @@ class TestModePageModConfig: TestModePage {
|
||||
"HideCredits",
|
||||
_onOff,
|
||||
1,
|
||||
_isDisableGPActive
|
||||
isEnabled("DisableGP")
|
||||
));
|
||||
|
||||
_options.Add(new Option(
|
||||
@ -104,7 +103,7 @@ class TestModePageModConfig: TestModePage {
|
||||
"HideGP",
|
||||
_onOff,
|
||||
1,
|
||||
_isDisableGPActive
|
||||
isEnabled("DisableGP")
|
||||
));
|
||||
|
||||
_options.Add(new Option(
|
||||
@ -112,7 +111,7 @@ class TestModePageModConfig: TestModePage {
|
||||
"HideVersion",
|
||||
_onOff,
|
||||
0,
|
||||
_isDisableGPActive
|
||||
isEnabled("DisableGP")
|
||||
));
|
||||
|
||||
_options.Add(new Option(
|
||||
@ -120,7 +119,7 @@ class TestModePageModConfig: TestModePage {
|
||||
"SkipCamera",
|
||||
_onOff,
|
||||
1,
|
||||
typeof(Data.DataStudioManager).GetMethod("orig_IsLoaded") != null,
|
||||
isEnabled("LoadBoost"),
|
||||
"Sequence"
|
||||
));
|
||||
|
||||
@ -129,7 +128,7 @@ class TestModePageModConfig: TestModePage {
|
||||
"QuickStart",
|
||||
_onOff,
|
||||
0,
|
||||
_isSkipCutscenesActive,
|
||||
isEnabled("SkipCutscenes"),
|
||||
"Sequence"
|
||||
));
|
||||
|
||||
@ -138,12 +137,42 @@ class TestModePageModConfig: TestModePage {
|
||||
"AutoContinue",
|
||||
_onOff,
|
||||
0,
|
||||
_isSkipCutscenesActive,
|
||||
isEnabled("SkipCutscenes"),
|
||||
"Sequence"
|
||||
));
|
||||
|
||||
var d = new Dictionary<string, string> {
|
||||
{ "SHARED", "0" },
|
||||
{ "EXCLUSIVE 6CH", "1" }
|
||||
};
|
||||
if(isEnabled("ExclusiveAudio")) {
|
||||
d.Add("EXCLUSIVE 2CH", "2");
|
||||
}
|
||||
_options.Add(new Option(
|
||||
"FRAMERATE",
|
||||
"AUDIO MODE*",
|
||||
"WasapiExclusive",
|
||||
d,
|
||||
0,
|
||||
true,
|
||||
"Sound"
|
||||
));
|
||||
|
||||
_options.Add(new Option(
|
||||
"SAMPLE RATE*",
|
||||
"SampleRate",
|
||||
new Dictionary<string, string> {
|
||||
{ "44100Hz", "44100" },
|
||||
{ "48000Hz", "48000" },
|
||||
{ "96000Hz", "96000" },
|
||||
{ "192000Hz", "192000" }
|
||||
},
|
||||
1,
|
||||
isEnabled("ExclusiveAudio"),
|
||||
"Sound"
|
||||
));
|
||||
|
||||
_options.Add(new Option(
|
||||
"FRAME RATE*",
|
||||
"Framerate",
|
||||
new Dictionary<string, string> {
|
||||
{ "60", "60" },
|
||||
@ -155,9 +184,9 @@ class TestModePageModConfig: TestModePage {
|
||||
{ "VSYNC", "V" }
|
||||
},
|
||||
0,
|
||||
typeof(Notes.NotesManager).GetMethod("orig_initialize") != null,
|
||||
isEnabled("FrameRate"),
|
||||
"Video"
|
||||
));
|
||||
));
|
||||
|
||||
var itemDefs = _options.Select((x, idx) => {
|
||||
x.itemDefine.lineNumber = idx;
|
||||
@ -165,7 +194,15 @@ class TestModePageModConfig: TestModePage {
|
||||
}).ToList();
|
||||
|
||||
itemDefs.Add(new() {
|
||||
lineNumber = 8,
|
||||
lineNumber = 11,
|
||||
label = "(*) REQUIRES A RESTART",
|
||||
isSelectable = false,
|
||||
isFinishOnSelect = false,
|
||||
isDefaultSelection = false
|
||||
});
|
||||
|
||||
itemDefs.Add(new() {
|
||||
lineNumber = 13,
|
||||
label = "終了",
|
||||
isSelectable = true,
|
||||
isFinishOnSelect = true,
|
||||
@ -184,11 +221,13 @@ class TestModePageModConfig: TestModePage {
|
||||
}
|
||||
|
||||
protected override void onInitializeItem(Item item, int index) {
|
||||
item.setState(item.isSelectable ? Item.State.Selectable : Item.State.UnselectableTemp);
|
||||
|
||||
if(!item.define.hasValueField) {
|
||||
return;
|
||||
}
|
||||
var op = _options[index];
|
||||
|
||||
var op = _options[index];
|
||||
if(op.fieldName == "Framerate") {
|
||||
using IniFile iniFile = new("mu3.ini");
|
||||
if(iniFile.getValue(op.sectionName, "VSync", false)) {
|
||||
@ -199,7 +238,6 @@ class TestModePageModConfig: TestModePage {
|
||||
}
|
||||
|
||||
item.setValueString(op.values[op.selection].Key);
|
||||
item.setState(op.itemDefine.isSelectable ? Item.State.Selectable : Item.State.UnselectableTemp);
|
||||
}
|
||||
|
||||
protected override void onSelectItem(Item item, int index) {
|
||||
@ -240,15 +278,14 @@ class TestModePageModConfig: TestModePage {
|
||||
using IniFile iniFile = new("mu3.ini");
|
||||
using StreamWriter sw = new("mu3.ini");
|
||||
|
||||
rewriteOption(iniFile, "Sound", "WasapiExclusive", "0");
|
||||
rewriteOption(iniFile, "AM", "IgnoreError", "1");
|
||||
rewriteOption(iniFile, "Device", "CameraType", "1");
|
||||
|
||||
rewriteOption(iniFile, "Extra", "CacheDir", ".");
|
||||
if(_isDisableGPActive) {
|
||||
if(isEnabled("DisableGP")) {
|
||||
rewriteOption(iniFile, "Extra", "GP", "999");
|
||||
}
|
||||
if(typeof(User.UserManager).GetMethod("orig_getUserFumen") != null) {
|
||||
if(isEnabled("Blacklist")) {
|
||||
rewriteOption(iniFile, "Extra", "BlacklistMin", "10000");
|
||||
rewriteOption(iniFile, "Extra", "BlacklistMin", "19999");
|
||||
}
|
||||
|
Reference in New Issue
Block a user