forked from akanyan/mu3-mods
feat: implement ExclusiveAudio
This commit is contained in:
5
Enhancements/DisableGP/MU3.Mod/TestMenuEnable.cs
Normal file
5
Enhancements/DisableGP/MU3.Mod/TestMenuEnable.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
namespace MU3.Mod;
|
||||||
|
|
||||||
|
class TestMenuEnable {
|
||||||
|
public class DisableGP { };
|
||||||
|
}
|
@ -7,9 +7,7 @@ class patch_UserManager: UserManager {
|
|||||||
private OnReset _onResetGP;
|
private OnReset _onResetGP;
|
||||||
|
|
||||||
public new void resetGP() {
|
public new void resetGP() {
|
||||||
if(_onResetGP != null) {
|
_onResetGP?.Invoke(_gp);
|
||||||
_onResetGP(_gp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public new int GP {
|
public new int GP {
|
||||||
@ -17,9 +15,7 @@ class patch_UserManager: UserManager {
|
|||||||
return _gp;
|
return _gp;
|
||||||
}
|
}
|
||||||
private set {
|
private set {
|
||||||
if(_onUpdateGP != null) {
|
_onUpdateGP?.Invoke(_gp);
|
||||||
_onUpdateGP(_gp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public new bool checkBattleGP(int needed) {
|
public new bool checkBattleGP(int needed) {
|
||||||
|
5
Extras/Blacklist/MU3.Mod/TestMenuEnable.cs
Normal file
5
Extras/Blacklist/MU3.Mod/TestMenuEnable.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
namespace MU3.Mod;
|
||||||
|
|
||||||
|
class TestMenuEnable {
|
||||||
|
public class Blacklist { };
|
||||||
|
}
|
5
Extras/SelectBGM/MU3.Mod/TestMenuEnable.cs
Normal file
5
Extras/SelectBGM/MU3.Mod/TestMenuEnable.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
namespace MU3.Mod;
|
||||||
|
|
||||||
|
class TestMenuEnable {
|
||||||
|
public class SelectBGM { };
|
||||||
|
}
|
5
Extras/SkipCutscenes/MU3.Mod/TestMenuEnable.cs
Normal file
5
Extras/SkipCutscenes/MU3.Mod/TestMenuEnable.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
namespace MU3.Mod;
|
||||||
|
|
||||||
|
class TestMenuEnable {
|
||||||
|
public class SkipCutscenes { };
|
||||||
|
}
|
@ -8,6 +8,8 @@ using UnityEngine;
|
|||||||
namespace MU3.Sequence;
|
namespace MU3.Sequence;
|
||||||
|
|
||||||
class patch_PlayMusic: PlayMusic {
|
class patch_PlayMusic: PlayMusic {
|
||||||
|
public class CutscenePatch { };
|
||||||
|
|
||||||
private GameEngine _gameEngine;
|
private GameEngine _gameEngine;
|
||||||
private bool _quickStart = false;
|
private bool _quickStart = false;
|
||||||
|
|
||||||
|
3
Extras/TestMenuConfig/MU3.Mod/TestMenuEnable.cs
Normal file
3
Extras/TestMenuConfig/MU3.Mod/TestMenuEnable.cs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
namespace MU3.Mod;
|
||||||
|
|
||||||
|
class TestMenuEnable { }
|
@ -42,10 +42,10 @@ class TestModePageModConfig: TestModePage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool isEnabled(string v) => typeof(TestMenuEnable).GetNestedType(v) != null;
|
||||||
|
|
||||||
private List<Option> _options;
|
private List<Option> _options;
|
||||||
private Dictionary<string, string> _onOff;
|
private Dictionary<string, string> _onOff;
|
||||||
private bool _isDisableGPActive;
|
|
||||||
private bool _isSkipCutscenesActive;
|
|
||||||
private MethodInfo _writeToFile;
|
private MethodInfo _writeToFile;
|
||||||
|
|
||||||
protected new void Awake() {
|
protected new void Awake() {
|
||||||
@ -62,8 +62,7 @@ class TestModePageModConfig: TestModePage {
|
|||||||
{ "OFF", "0" },
|
{ "OFF", "0" },
|
||||||
{ "ON", "1" }
|
{ "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);
|
_writeToFile = typeof(IniFile).GetMethod("writeToFile", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
|
|
||||||
writeOtherOptions();
|
writeOtherOptions();
|
||||||
@ -88,7 +87,7 @@ class TestModePageModConfig: TestModePage {
|
|||||||
{ "RANDOM", "0" }
|
{ "RANDOM", "0" }
|
||||||
},
|
},
|
||||||
5,
|
5,
|
||||||
typeof(Game.GameBGM).GetMethod("orig_playBGM") != null
|
isEnabled("SelectBGM")
|
||||||
));
|
));
|
||||||
|
|
||||||
_options.Add(new Option(
|
_options.Add(new Option(
|
||||||
@ -96,7 +95,7 @@ class TestModePageModConfig: TestModePage {
|
|||||||
"HideCredits",
|
"HideCredits",
|
||||||
_onOff,
|
_onOff,
|
||||||
1,
|
1,
|
||||||
_isDisableGPActive
|
isEnabled("DisableGP")
|
||||||
));
|
));
|
||||||
|
|
||||||
_options.Add(new Option(
|
_options.Add(new Option(
|
||||||
@ -104,7 +103,7 @@ class TestModePageModConfig: TestModePage {
|
|||||||
"HideGP",
|
"HideGP",
|
||||||
_onOff,
|
_onOff,
|
||||||
1,
|
1,
|
||||||
_isDisableGPActive
|
isEnabled("DisableGP")
|
||||||
));
|
));
|
||||||
|
|
||||||
_options.Add(new Option(
|
_options.Add(new Option(
|
||||||
@ -112,7 +111,7 @@ class TestModePageModConfig: TestModePage {
|
|||||||
"HideVersion",
|
"HideVersion",
|
||||||
_onOff,
|
_onOff,
|
||||||
0,
|
0,
|
||||||
_isDisableGPActive
|
isEnabled("DisableGP")
|
||||||
));
|
));
|
||||||
|
|
||||||
_options.Add(new Option(
|
_options.Add(new Option(
|
||||||
@ -120,7 +119,7 @@ class TestModePageModConfig: TestModePage {
|
|||||||
"SkipCamera",
|
"SkipCamera",
|
||||||
_onOff,
|
_onOff,
|
||||||
1,
|
1,
|
||||||
typeof(Data.DataStudioManager).GetMethod("orig_IsLoaded") != null,
|
isEnabled("LoadBoost"),
|
||||||
"Sequence"
|
"Sequence"
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -129,7 +128,7 @@ class TestModePageModConfig: TestModePage {
|
|||||||
"QuickStart",
|
"QuickStart",
|
||||||
_onOff,
|
_onOff,
|
||||||
0,
|
0,
|
||||||
_isSkipCutscenesActive,
|
isEnabled("SkipCutscenes"),
|
||||||
"Sequence"
|
"Sequence"
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -138,12 +137,42 @@ class TestModePageModConfig: TestModePage {
|
|||||||
"AutoContinue",
|
"AutoContinue",
|
||||||
_onOff,
|
_onOff,
|
||||||
0,
|
0,
|
||||||
_isSkipCutscenesActive,
|
isEnabled("SkipCutscenes"),
|
||||||
"Sequence"
|
"Sequence"
|
||||||
));
|
));
|
||||||
|
|
||||||
|
var d = new Dictionary<string, string> {
|
||||||
|
{ "SHARED", "0" },
|
||||||
|
{ "EXCLUSIVE 6CH", "1" }
|
||||||
|
};
|
||||||
|
if(isEnabled("ExclusiveAudio")) {
|
||||||
|
d.Add("EXCLUSIVE 2CH", "2");
|
||||||
|
}
|
||||||
_options.Add(new Option(
|
_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",
|
"Framerate",
|
||||||
new Dictionary<string, string> {
|
new Dictionary<string, string> {
|
||||||
{ "60", "60" },
|
{ "60", "60" },
|
||||||
@ -155,7 +184,7 @@ class TestModePageModConfig: TestModePage {
|
|||||||
{ "VSYNC", "V" }
|
{ "VSYNC", "V" }
|
||||||
},
|
},
|
||||||
0,
|
0,
|
||||||
typeof(Notes.NotesManager).GetMethod("orig_initialize") != null,
|
isEnabled("FrameRate"),
|
||||||
"Video"
|
"Video"
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -165,7 +194,15 @@ class TestModePageModConfig: TestModePage {
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
itemDefs.Add(new() {
|
itemDefs.Add(new() {
|
||||||
lineNumber = 8,
|
lineNumber = 11,
|
||||||
|
label = "(*) REQUIRES A RESTART",
|
||||||
|
isSelectable = false,
|
||||||
|
isFinishOnSelect = false,
|
||||||
|
isDefaultSelection = false
|
||||||
|
});
|
||||||
|
|
||||||
|
itemDefs.Add(new() {
|
||||||
|
lineNumber = 13,
|
||||||
label = "終了",
|
label = "終了",
|
||||||
isSelectable = true,
|
isSelectable = true,
|
||||||
isFinishOnSelect = true,
|
isFinishOnSelect = true,
|
||||||
@ -184,11 +221,13 @@ 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);
|
||||||
|
|
||||||
if(!item.define.hasValueField) {
|
if(!item.define.hasValueField) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var op = _options[index];
|
|
||||||
|
|
||||||
|
var op = _options[index];
|
||||||
if(op.fieldName == "Framerate") {
|
if(op.fieldName == "Framerate") {
|
||||||
using IniFile iniFile = new("mu3.ini");
|
using IniFile iniFile = new("mu3.ini");
|
||||||
if(iniFile.getValue(op.sectionName, "VSync", false)) {
|
if(iniFile.getValue(op.sectionName, "VSync", false)) {
|
||||||
@ -199,7 +238,6 @@ class TestModePageModConfig: TestModePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
item.setValueString(op.values[op.selection].Key);
|
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) {
|
protected override void onSelectItem(Item item, int index) {
|
||||||
@ -240,15 +278,14 @@ class TestModePageModConfig: TestModePage {
|
|||||||
using IniFile iniFile = new("mu3.ini");
|
using IniFile iniFile = new("mu3.ini");
|
||||||
using StreamWriter sw = new("mu3.ini");
|
using StreamWriter sw = new("mu3.ini");
|
||||||
|
|
||||||
rewriteOption(iniFile, "Sound", "WasapiExclusive", "0");
|
|
||||||
rewriteOption(iniFile, "AM", "IgnoreError", "1");
|
rewriteOption(iniFile, "AM", "IgnoreError", "1");
|
||||||
rewriteOption(iniFile, "Device", "CameraType", "1");
|
rewriteOption(iniFile, "Device", "CameraType", "1");
|
||||||
|
|
||||||
rewriteOption(iniFile, "Extra", "CacheDir", ".");
|
rewriteOption(iniFile, "Extra", "CacheDir", ".");
|
||||||
if(_isDisableGPActive) {
|
if(isEnabled("DisableGP")) {
|
||||||
rewriteOption(iniFile, "Extra", "GP", "999");
|
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", "10000");
|
||||||
rewriteOption(iniFile, "Extra", "BlacklistMin", "19999");
|
rewriteOption(iniFile, "Extra", "BlacklistMin", "19999");
|
||||||
}
|
}
|
||||||
|
8
Fixes/ExclusiveAudio/ExclusiveAudio.csproj
Normal file
8
Fixes/ExclusiveAudio/ExclusiveAudio.csproj
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<AssemblyName>Assembly-CSharp.ExclusiveAudio.mm</AssemblyName>
|
||||||
|
<Description>2ch exclusive audio</Description>
|
||||||
|
<OutCategory>fixes</OutCategory>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="..\..\Mu3Mods.csproj" />
|
||||||
|
</Project>
|
5
Fixes/ExclusiveAudio/MU3.Mod/TestMenuEnable.cs
Normal file
5
Fixes/ExclusiveAudio/MU3.Mod/TestMenuEnable.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
namespace MU3.Mod;
|
||||||
|
|
||||||
|
class TestMenuEnable {
|
||||||
|
public class ExclusiveAudio { };
|
||||||
|
}
|
27
Fixes/ExclusiveAudio/MU3.Sound/patch_SoundManager.cs
Normal file
27
Fixes/ExclusiveAudio/MU3.Sound/patch_SoundManager.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace MU3.Sound;
|
||||||
|
|
||||||
|
class patch_SoundManager: SoundManager {
|
||||||
|
public class SoundPatch { };
|
||||||
|
private void setWasapiExclusive() {
|
||||||
|
using IniFile iniFile = new IniFile("mu3.ini");
|
||||||
|
var sixCh = iniFile.getValue("Sound", "WasapiExclusive", 1) == 1;
|
||||||
|
var sampleRate = (uint)iniFile.getValue("Sound", "SampleRate", 48000);
|
||||||
|
|
||||||
|
CriAtomUserExtension.WaveFormatExtensible format = default;
|
||||||
|
format.Format = default;
|
||||||
|
format.Format.wFormatTag = 65534;
|
||||||
|
format.Format.nChannels = (ushort)(sixCh ? 6 : 2);
|
||||||
|
format.Format.nSamplesPerSec = sampleRate;
|
||||||
|
format.Format.wBitsPerSample = 32;
|
||||||
|
format.Format.nBlockAlign = (ushort)(format.Format.wBitsPerSample / 8 * format.Format.nChannels);
|
||||||
|
format.Format.nAvgBytesPerSec = format.Format.nSamplesPerSec * format.Format.nBlockAlign;
|
||||||
|
format.Format.cbSize = 22;
|
||||||
|
format.Samples.wValidBitsPerSample = 24;
|
||||||
|
format.dwChannelMask = sixCh ? 0b111111u : 0b11u;
|
||||||
|
format.SubFormat = new Guid("00000001-0000-0010-8000-00aa00389b71");
|
||||||
|
CriAtomUserExtension.SetAudioClientShareMode(CriAtomUserExtension.AudioClientShareMode.Exclusive);
|
||||||
|
CriAtomUserExtension.SetAudioClientFormat(ref format);
|
||||||
|
}
|
||||||
|
}
|
5
Fixes/FrameRate/MU3.Mod/TestMenuEnable.cs
Normal file
5
Fixes/FrameRate/MU3.Mod/TestMenuEnable.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
namespace MU3.Mod;
|
||||||
|
|
||||||
|
class TestMenuEnable {
|
||||||
|
public class FrameRate { };
|
||||||
|
}
|
5
Fixes/LoadBoost/MU3.Mod/TestMenuEnable.cs
Normal file
5
Fixes/LoadBoost/MU3.Mod/TestMenuEnable.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
namespace MU3.Mod;
|
||||||
|
|
||||||
|
class TestMenuEnable {
|
||||||
|
public class LoadBoost { };
|
||||||
|
}
|
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net35</TargetFramework>
|
<TargetFramework>net35</TargetFramework>
|
||||||
<Company>7EVENDAYS⇔HOLIDAYS</Company>
|
<Company>7EVENDAYS⇔HOLIDAYS</Company>
|
||||||
<Version>3.0.1.0</Version>
|
<Version>3.2.0.0</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
|
@ -50,6 +50,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestMenuScaling", "Fixes\Te
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestMenuConfig", "Extras\TestMenuConfig\TestMenuConfig.csproj", "{7043743F-24B5-4A39-838E-964091AC7FF1}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestMenuConfig", "Extras\TestMenuConfig\TestMenuConfig.csproj", "{7043743F-24B5-4A39-838E-964091AC7FF1}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExclusiveAudio", "Fixes\ExclusiveAudio\ExclusiveAudio.csproj", "{0043743F-24B5-4A39-838E-964091AC7FF1}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
@ -152,6 +154,10 @@ Global
|
|||||||
{7043743F-24B5-4A39-838E-964091AC7FF1}.Debug|x64.Build.0 = Debug|x64
|
{7043743F-24B5-4A39-838E-964091AC7FF1}.Debug|x64.Build.0 = Debug|x64
|
||||||
{7043743F-24B5-4A39-838E-964091AC7FF1}.Release|x64.ActiveCfg = Release|x64
|
{7043743F-24B5-4A39-838E-964091AC7FF1}.Release|x64.ActiveCfg = Release|x64
|
||||||
{7043743F-24B5-4A39-838E-964091AC7FF1}.Release|x64.Build.0 = Release|x64
|
{7043743F-24B5-4A39-838E-964091AC7FF1}.Release|x64.Build.0 = Release|x64
|
||||||
|
{0043743F-24B5-4A39-838E-964091AC7FF1}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{0043743F-24B5-4A39-838E-964091AC7FF1}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{0043743F-24B5-4A39-838E-964091AC7FF1}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{0043743F-24B5-4A39-838E-964091AC7FF1}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
Reference in New Issue
Block a user