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;
|
||||
|
||||
public new void resetGP() {
|
||||
if(_onResetGP != null) {
|
||||
_onResetGP(_gp);
|
||||
}
|
||||
_onResetGP?.Invoke(_gp);
|
||||
}
|
||||
|
||||
public new int GP {
|
||||
@ -17,9 +15,7 @@ class patch_UserManager: UserManager {
|
||||
return _gp;
|
||||
}
|
||||
private set {
|
||||
if(_onUpdateGP != null) {
|
||||
_onUpdateGP(_gp);
|
||||
}
|
||||
_onUpdateGP?.Invoke(_gp);
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
class patch_PlayMusic: PlayMusic {
|
||||
public class CutscenePatch { };
|
||||
|
||||
private GameEngine _gameEngine;
|
||||
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 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");
|
||||
}
|
||||
|
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>
|
||||
<TargetFramework>net35</TargetFramework>
|
||||
<Company>7EVENDAYS⇔HOLIDAYS</Company>
|
||||
<Version>3.0.1.0</Version>
|
||||
<Version>3.2.0.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Platforms>x64</Platforms>
|
||||
|
@ -50,6 +50,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestMenuScaling", "Fixes\Te
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestMenuConfig", "Extras\TestMenuConfig\TestMenuConfig.csproj", "{7043743F-24B5-4A39-838E-964091AC7FF1}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExclusiveAudio", "Fixes\ExclusiveAudio\ExclusiveAudio.csproj", "{0043743F-24B5-4A39-838E-964091AC7FF1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
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}.Release|x64.ActiveCfg = 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
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
Reference in New Issue
Block a user