forked from akanyan/mu3-mods
fix(TestMenuConfig): proper handling of audiomode
This commit is contained in:
@ -34,10 +34,11 @@ class TestModePageModConfig: TestModePage {
|
|||||||
using IniFile iniFile = new("mu3.ini");
|
using IniFile iniFile = new("mu3.ini");
|
||||||
var previous = iniFile.getValue(sectionName, fieldName, values.ElementAt(indexDefault).Value);
|
var previous = iniFile.getValue(sectionName, fieldName, values.ElementAt(indexDefault).Value);
|
||||||
var found = this.values.FindIndex(i => i.Value == previous);
|
var found = this.values.FindIndex(i => i.Value == previous);
|
||||||
if(found == -1) {
|
if(found < 0) {
|
||||||
itemDefine.isSelectable = false;
|
itemDefine.isSelectable = false;
|
||||||
|
selection = indexDefault;
|
||||||
} else {
|
} else {
|
||||||
selection = found == -1 ? indexDefault : found;
|
selection = found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,7 +153,7 @@ class TestModePageModConfig: TestModePage {
|
|||||||
"AUDIO MODE*",
|
"AUDIO MODE*",
|
||||||
"WasapiExclusive",
|
"WasapiExclusive",
|
||||||
d,
|
d,
|
||||||
0,
|
1,
|
||||||
true,
|
true,
|
||||||
"Sound"
|
"Sound"
|
||||||
));
|
));
|
||||||
@ -221,7 +222,7 @@ class TestModePageModConfig: TestModePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override void onInitializeItem(Item item, int index) {
|
protected override void onInitializeItem(Item item, int index) {
|
||||||
item.setState(item.isSelectable ? Item.State.Selectable : Item.State.UnselectableTemp);
|
item.setState(item.define.isSelectable ? Item.State.Selectable : Item.State.UnselectableTemp);
|
||||||
|
|
||||||
if(!item.define.hasValueField) {
|
if(!item.define.hasValueField) {
|
||||||
return;
|
return;
|
||||||
@ -269,8 +270,24 @@ class TestModePageModConfig: TestModePage {
|
|||||||
|
|
||||||
_writeToFile.Invoke(iniFile, [sw]);
|
_writeToFile.Invoke(iniFile, [sw]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void onUpdateItem(Item item, int index) {
|
||||||
|
if(!item.define.hasValueField || !item.define.isSelectable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var op = _options[index];
|
||||||
|
if(op.fieldName == "WasapiExclusive") {
|
||||||
|
var next = _itemList[index + 1];
|
||||||
|
if(next != null) {
|
||||||
|
var enabled = op.selection != 0;
|
||||||
|
next.define.isSelectable = enabled;
|
||||||
|
next.setState(enabled ? Item.State.Selectable : Item.State.UnselectableTemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void rewriteOption(IniFile ini, string sectionName, string fieldName, string defaultValue) {
|
private void rewriteOption(IniFile ini, string sectionName, string fieldName, string defaultValue) {
|
||||||
;
|
|
||||||
ini.setValue(sectionName, fieldName, ini.getValue(sectionName, fieldName, defaultValue));
|
ini.setValue(sectionName, fieldName, ini.getValue(sectionName, fieldName, defaultValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user