From 54ff4d628fa37479fad199303a93b86f9bdae8f9 Mon Sep 17 00:00:00 2001 From: beer-psi Date: Thu, 8 Aug 2024 13:32:25 +0700 Subject: [PATCH] push a few more mods --- DisableEncryption/DisableEncryption.csproj | 30 ++++++ DisableEncryption/Net/Packet/patch_Packet.cs | 20 ++++ DisableEncryption/Net/patch_CipherAES.cs | 21 ++++ DisableEncryption/Net/patch_NetHttpClient.cs | 17 ++++ .../System/Net/patch_WebHeaderCollection.cs | 17 ++++ DisableReboot/DisableReboot.csproj | 30 ++++++ .../Operation/patch_MaintenanceTimer.cs | 21 ++++ .../Manager/Operation/patch_SegaBootTimer.cs | 39 ++++++++ FixLocaleIssues/FixLocaleIssues.csproj | 57 ++--------- .../MAI2System/patch_IniSection.cs | 2 +- FixLocaleIssues/Manager/patch_MA2Record.cs | 2 +- FixLocaleIssues/Manager/patch_SlideManager.cs | 4 +- ImproveLoadTimes/ImproveLoadTimes.csproj | 31 ++++++ .../MaiStudio/Serialize/SerializeBase.cs | 12 +++ .../MaiStudio/Serialize/patch_FilePath.cs | 20 ++++ ImproveLoadTimes/Manager/patch_DataManager.cs | 99 +++++++++++++++++++ .../Manager/patch_PowerOnProcess.cs | 21 ++++ LooseDBTables/LooseDBTables.csproj | 57 ++--------- MoreChartFormats/MoreChartFormats.csproj | 75 ++------------ MoreChartFormats/patch_NotesReader.cs | 19 ++-- README.md | 90 +++++++---------- Singleplayer/Main/patch_GameMainObject.cs | 30 ++++++ Singleplayer/Singleplayer.csproj | 31 ++++++ TouchPanel/IO/patch_NewTouchPanel.cs | 61 ++++++++++++ TouchPanel/TouchPanel.csproj | 31 ++++++ UnlockFrameRate/UnlockFrameRate.csproj | 83 +++++----------- sinmai-mods.sln | 85 +++++++++------- 27 files changed, 675 insertions(+), 330 deletions(-) create mode 100644 DisableEncryption/DisableEncryption.csproj create mode 100644 DisableEncryption/Net/Packet/patch_Packet.cs create mode 100644 DisableEncryption/Net/patch_CipherAES.cs create mode 100644 DisableEncryption/Net/patch_NetHttpClient.cs create mode 100644 DisableEncryption/System/Net/patch_WebHeaderCollection.cs create mode 100644 DisableReboot/DisableReboot.csproj create mode 100644 DisableReboot/Manager/Operation/patch_MaintenanceTimer.cs create mode 100644 DisableReboot/Manager/Operation/patch_SegaBootTimer.cs create mode 100644 ImproveLoadTimes/ImproveLoadTimes.csproj create mode 100644 ImproveLoadTimes/Manager/MaiStudio/Serialize/SerializeBase.cs create mode 100644 ImproveLoadTimes/Manager/MaiStudio/Serialize/patch_FilePath.cs create mode 100644 ImproveLoadTimes/Manager/patch_DataManager.cs create mode 100644 ImproveLoadTimes/Manager/patch_PowerOnProcess.cs create mode 100644 Singleplayer/Main/patch_GameMainObject.cs create mode 100644 Singleplayer/Singleplayer.csproj create mode 100644 TouchPanel/IO/patch_NewTouchPanel.cs create mode 100644 TouchPanel/TouchPanel.csproj diff --git a/DisableEncryption/DisableEncryption.csproj b/DisableEncryption/DisableEncryption.csproj new file mode 100644 index 0000000..378b8d9 --- /dev/null +++ b/DisableEncryption/DisableEncryption.csproj @@ -0,0 +1,30 @@ + + + + net46 + latest + enable + enable + Assembly-CSharp.DisableEncryption.mm + + + + + ..\External\MonoMod.exe + False + + + ..\External\Assembly-CSharp.dll + False + + + ..\External\UnityEngine.dll + False + + + ..\External\UnityEngine.CoreModule.dll + False + + + + diff --git a/DisableEncryption/Net/Packet/patch_Packet.cs b/DisableEncryption/Net/Packet/patch_Packet.cs new file mode 100644 index 0000000..1ffb195 --- /dev/null +++ b/DisableEncryption/Net/Packet/patch_Packet.cs @@ -0,0 +1,20 @@ +// ReSharper disable CheckNamespace +// ReSharper disable InconsistentNaming +using MonoMod; + +namespace Net.Packet; + +public class patch_Packet : Packet +{ + [MonoModIgnore] + public override PacketState Proc() + { + throw new NotImplementedException(); + } + + [MonoModReplace] + public new static string Obfuscator(string srcStr) + { + return srcStr; + } +} \ No newline at end of file diff --git a/DisableEncryption/Net/patch_CipherAES.cs b/DisableEncryption/Net/patch_CipherAES.cs new file mode 100644 index 0000000..74a182b --- /dev/null +++ b/DisableEncryption/Net/patch_CipherAES.cs @@ -0,0 +1,21 @@ +// ReSharper disable CheckNamespace +// ReSharper disable InconsistentNaming +using MonoMod; + +namespace Net; + +[MonoModPatch("global::Net.CipherAES")] +public class patch_CipherAES +{ + [MonoModReplace] + public static byte[] Encrypt(byte[] data) + { + return data; + } + + [MonoModReplace] + public static byte[] Decrypt(byte[] data) + { + return data; + } +} \ No newline at end of file diff --git a/DisableEncryption/Net/patch_NetHttpClient.cs b/DisableEncryption/Net/patch_NetHttpClient.cs new file mode 100644 index 0000000..7918f31 --- /dev/null +++ b/DisableEncryption/Net/patch_NetHttpClient.cs @@ -0,0 +1,17 @@ +// ReSharper disable CheckNamespace +// ReSharper disable InconsistentNaming +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; +using MonoMod; + +namespace Net; + +public class patch_NetHttpClient : NetHttpClient +{ + [MonoModReplace] + public new static bool CheckServerHash(object sender, X509Certificate certificate, X509Chain chain, + SslPolicyErrors sslPolicyErrors) + { + return true; + } +} \ No newline at end of file diff --git a/DisableEncryption/System/Net/patch_WebHeaderCollection.cs b/DisableEncryption/System/Net/patch_WebHeaderCollection.cs new file mode 100644 index 0000000..1607cf0 --- /dev/null +++ b/DisableEncryption/System/Net/patch_WebHeaderCollection.cs @@ -0,0 +1,17 @@ +// ReSharper disable CheckNamespace +// ReSharper disable InconsistentNaming +namespace System.Net; + +public class patch_WebHeaderCollection : WebHeaderCollection +{ + public extern void orig_Add(string header, string value); + public new void Add(string header, string value) + { + if (header.ToLowerInvariant() == "mai-encoding") + { + return; + } + + orig_Add(header, value); + } +} \ No newline at end of file diff --git a/DisableReboot/DisableReboot.csproj b/DisableReboot/DisableReboot.csproj new file mode 100644 index 0000000..3675ae9 --- /dev/null +++ b/DisableReboot/DisableReboot.csproj @@ -0,0 +1,30 @@ + + + + net46 + latest + enable + enable + Assembly-CSharp.DisableReboot.mm + + + + + ..\External\MonoMod.exe + False + + + ..\External\Assembly-CSharp.dll + False + + + ..\External\UnityEngine.dll + False + + + ..\External\UnityEngine.CoreModule.dll + False + + + + diff --git a/DisableReboot/Manager/Operation/patch_MaintenanceTimer.cs b/DisableReboot/Manager/Operation/patch_MaintenanceTimer.cs new file mode 100644 index 0000000..8b5cc80 --- /dev/null +++ b/DisableReboot/Manager/Operation/patch_MaintenanceTimer.cs @@ -0,0 +1,21 @@ +// ReSharper disable CheckNamespace +// ReSharper disable InconsistentNaming + +using MonoMod; + +namespace Manager.Operation; + +public class patch_MaintenanceTimer : MaintenanceTimer +{ + [MonoModReplace] + public new bool IsAutoRebootNeeded() + { + return false; + } + + [MonoModReplace] + public new int GetAutoRebootSec() + { + return 86400; + } +} \ No newline at end of file diff --git a/DisableReboot/Manager/Operation/patch_SegaBootTimer.cs b/DisableReboot/Manager/Operation/patch_SegaBootTimer.cs new file mode 100644 index 0000000..70c2417 --- /dev/null +++ b/DisableReboot/Manager/Operation/patch_SegaBootTimer.cs @@ -0,0 +1,39 @@ +// ReSharper disable CheckNamespace +// ReSharper disable InconsistentNaming + +using MonoMod; + +namespace Manager.Operation; + +public class patch_SegaBootTimer : SegaBootTimer +{ + [MonoModReplace] + public new bool IsSegaBootTime() + { + return false; + } + + [MonoModReplace] + public new int GetGotoSegaBootSec() + { + return 86400; + } + + [MonoModReplace] + public new bool IsSegaBootNeeded() + { + return false; + } + + [MonoModReplace] + public new int GetRemainingMinutes() + { + return 1440; + } + + [MonoModReplace] + public new bool IsCoinAcceptable() + { + return true; + } +} \ No newline at end of file diff --git a/FixLocaleIssues/FixLocaleIssues.csproj b/FixLocaleIssues/FixLocaleIssues.csproj index bfc949a..4298fba 100644 --- a/FixLocaleIssues/FixLocaleIssues.csproj +++ b/FixLocaleIssues/FixLocaleIssues.csproj @@ -1,43 +1,14 @@ - - - + + - Debug - AnyCPU - {48B5F480-D749-48E9-9D26-E0E5260D95DE} - Library - Properties - FixLocaleIssues - Assembly-CSharp.FixLocaleIssues.mm - v4.6.2 - 512 + net46 latest + enable + enable + Assembly-CSharp.FixLocaleIssues.mm - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - + - - - - ..\External\MonoMod.exe False @@ -55,19 +26,5 @@ False - - - - - - - - diff --git a/FixLocaleIssues/MAI2System/patch_IniSection.cs b/FixLocaleIssues/MAI2System/patch_IniSection.cs index b387af0..826c7db 100644 --- a/FixLocaleIssues/MAI2System/patch_IniSection.cs +++ b/FixLocaleIssues/MAI2System/patch_IniSection.cs @@ -18,4 +18,4 @@ class patch_IniSection : IniSection { return float.TryParse(_variableValue, NumberStyles.Float, CultureInfo.InvariantCulture, out value); } -} +} \ No newline at end of file diff --git a/FixLocaleIssues/Manager/patch_MA2Record.cs b/FixLocaleIssues/Manager/patch_MA2Record.cs index f36f87c..bfa5144 100644 --- a/FixLocaleIssues/Manager/patch_MA2Record.cs +++ b/FixLocaleIssues/Manager/patch_MA2Record.cs @@ -6,7 +6,7 @@ using MonoMod; namespace Manager; -class patch_MA2Record : MA2Record +public class patch_MA2Record : MA2Record { [MonoModIgnore] private static extern Ma2fileParamID.Def getParamIDFromRec(Ma2fileRecordID.Def rec, int index); diff --git a/FixLocaleIssues/Manager/patch_SlideManager.cs b/FixLocaleIssues/Manager/patch_SlideManager.cs index 784efca..bf2add1 100644 --- a/FixLocaleIssues/Manager/patch_SlideManager.cs +++ b/FixLocaleIssues/Manager/patch_SlideManager.cs @@ -1,9 +1,7 @@ // ReSharper disable CheckNamespace // ReSharper disable InconsistentNaming -using System.Collections.Generic; using System.Globalization; -using System.IO; using System.Text.RegularExpressions; using System.Xml; using MonoMod; @@ -16,7 +14,9 @@ public class patch_SlideManager : SlideManager [MonoModIgnore] private struct SlidePath { +#pragma warning disable CS0649 public List Points; +#pragma warning restore CS0649 } [MonoModIgnore] diff --git a/ImproveLoadTimes/ImproveLoadTimes.csproj b/ImproveLoadTimes/ImproveLoadTimes.csproj new file mode 100644 index 0000000..4cf4acf --- /dev/null +++ b/ImproveLoadTimes/ImproveLoadTimes.csproj @@ -0,0 +1,31 @@ + + + + net46 + latest + enable + enable + Assembly-CSharp.ImproveLoadTimes.mm + CS0626 + + + + + ..\External\MonoMod.exe + False + + + ..\External\Assembly-CSharp.dll + False + + + ..\External\UnityEngine.dll + False + + + ..\External\UnityEngine.CoreModule.dll + False + + + + diff --git a/ImproveLoadTimes/Manager/MaiStudio/Serialize/SerializeBase.cs b/ImproveLoadTimes/Manager/MaiStudio/Serialize/SerializeBase.cs new file mode 100644 index 0000000..c74e994 --- /dev/null +++ b/ImproveLoadTimes/Manager/MaiStudio/Serialize/SerializeBase.cs @@ -0,0 +1,12 @@ +// ReSharper disable CheckNamespace + +using MonoMod; + +namespace Manager.MaiStudio.Serialize; + +[MonoModReplace] +[Serializable] +public class SerializeBase +{ + public virtual void AddPath(string parentPath) { } +} \ No newline at end of file diff --git a/ImproveLoadTimes/Manager/MaiStudio/Serialize/patch_FilePath.cs b/ImproveLoadTimes/Manager/MaiStudio/Serialize/patch_FilePath.cs new file mode 100644 index 0000000..4d16e78 --- /dev/null +++ b/ImproveLoadTimes/Manager/MaiStudio/Serialize/patch_FilePath.cs @@ -0,0 +1,20 @@ +// ReSharper disable CheckNamespace +// ReSharper disable InconsistentNaming + +using MonoMod; + +namespace Manager.MaiStudio.Serialize; + +public class patch_FilePath : FilePath +{ + [MonoModReplace] + public override void AddPath(string parentPath) + { + if (string.IsNullOrEmpty(path) || path.StartsWith(parentPath)) + { + return; + } + + path = parentPath + path; + } +} \ No newline at end of file diff --git a/ImproveLoadTimes/Manager/patch_DataManager.cs b/ImproveLoadTimes/Manager/patch_DataManager.cs new file mode 100644 index 0000000..70a7c8a --- /dev/null +++ b/ImproveLoadTimes/Manager/patch_DataManager.cs @@ -0,0 +1,99 @@ +// ReSharper disable CheckNamespace +// ReSharper disable InconsistentNaming +using System.Runtime.Serialization.Formatters.Binary; + +namespace Manager; + +public class patch_DataManager : DataManager +{ + private const string _cacheFilename = "data_cache.bin"; + private static Dictionary? _cache; + private static bool _cacheBusted; + + private static extern bool orig_Deserialize(string filePath, out T dsr) where T : new(); + private static bool Deserialize(string filePath, out T dsr) where T : new() + { + try + { + _cache ??= LoadCache(_cacheFilename); + } + catch (Exception e) + { + System.Console.WriteLine("[ImproveLoadTimes] Could not load data cache: {0}", e); + _cache ??= new Dictionary(); + } + + try + { + if (_cache.TryGetValue(filePath, out var dsrObject)) + { + dsr = (T)dsrObject; + return true; + } + + if (!orig_Deserialize(filePath, out dsr)) + { + return false; + } + + // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract + if (filePath == null || dsr == null) + { + return true; + } + + _cache.Add(filePath, dsr); + _cacheBusted = true; + + return true; + } + catch (Exception e) + { + System.Console.WriteLine("[ImproveLoadTimes] [ERROR] Could not load from cache: {0}", e); + return orig_Deserialize(filePath, out dsr); + } + } + + private extern bool orig_IsLoaded(); + public new bool IsLoaded() + { + var loaded = orig_IsLoaded(); + + if (!loaded || !_cacheBusted || _cache == null) + { + return loaded; + } + + try + { + SaveCache(_cacheFilename, _cache); + } + catch (Exception e) + { + System.Console.WriteLine("[ImproveLoadTimes] [ERROR] Could not save to cache: {0}", e); + } + + _cacheBusted = false; + + return true; + } + + private static Dictionary LoadCache(string fileName) + { + if (!File.Exists(fileName)) + { + return new Dictionary(); + } + + System.Console.WriteLine("[ImproveLoadTimes] Loading data cache..."); + + using var fs = File.OpenRead(fileName); + return (Dictionary)new BinaryFormatter().Deserialize(fs); + } + + private static void SaveCache(string fileName, Dictionary cache) + { + using var fs = File.Open(fileName, FileMode.Create, FileAccess.Write); + new BinaryFormatter().Serialize(fs, cache); + } +} diff --git a/ImproveLoadTimes/Manager/patch_PowerOnProcess.cs b/ImproveLoadTimes/Manager/patch_PowerOnProcess.cs new file mode 100644 index 0000000..f3b6ace --- /dev/null +++ b/ImproveLoadTimes/Manager/patch_PowerOnProcess.cs @@ -0,0 +1,21 @@ +// ReSharper disable CheckNamespace +// ReSharper disable InconsistentNaming + +using MonoMod; +using Process; + +namespace Manager; + +public class patch_PowerOnProcess : PowerOnProcess +{ +#pragma warning disable CS0414 // Field is assigned but its value is never used + [MonoModIgnore] + private float _waitTime; +#pragma warning restore CS0414 // Field is assigned but its value is never used + + [MonoModConstructor] + public patch_PowerOnProcess(ProcessDataContainer dataContainer) : base(dataContainer) + { + _waitTime = 0f; + } +} \ No newline at end of file diff --git a/LooseDBTables/LooseDBTables.csproj b/LooseDBTables/LooseDBTables.csproj index 2e39277..2ba653c 100644 --- a/LooseDBTables/LooseDBTables.csproj +++ b/LooseDBTables/LooseDBTables.csproj @@ -1,43 +1,14 @@ - - - + + - Debug - AnyCPU - {F15988CC-BDF0-4F86-811B-BAE18EEA6519} - Library - Properties - LooseDBTables - Assembly-CSharp.LooseDBTables.mm - v4.6.2 - 512 + net46 latest + enable + enable + Assembly-CSharp.LooseDBTables.mm - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - + - - - - ..\External\MonoMod.exe False @@ -59,19 +30,5 @@ False - - - - - - - - diff --git a/MoreChartFormats/MoreChartFormats.csproj b/MoreChartFormats/MoreChartFormats.csproj index cb90251..2ca7c8e 100644 --- a/MoreChartFormats/MoreChartFormats.csproj +++ b/MoreChartFormats/MoreChartFormats.csproj @@ -1,43 +1,14 @@ - - - + + - Debug - AnyCPU - {A375F626-7238-4227-95C9-2BB1E5E099F6} - Library - Properties - MoreChartFormats - Assembly-CSharp.MoreChartFormats.mm - v4.6.2 - 512 + net46 latest + enable + enable + Assembly-CSharp.MoreChartFormats.mm - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - + - - - - ..\External\MonoMod.exe False @@ -55,37 +26,5 @@ False - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MoreChartFormats/patch_NotesReader.cs b/MoreChartFormats/patch_NotesReader.cs index 2988947..8ad0352 100644 --- a/MoreChartFormats/patch_NotesReader.cs +++ b/MoreChartFormats/patch_NotesReader.cs @@ -1,8 +1,6 @@ // ReSharper disable CheckNamespace // ReSharper disable InconsistentNaming -using System; -using System.IO; using System.Xml.Serialization; using Manager.MaiStudio.Serialize; using MonoMod; @@ -133,7 +131,15 @@ class patch_NotesReader : NotesReader { note.time.calcMsec(this); note.end.calcMsec(this); - note.startButtonPos = ConvertMirrorPosition(note.startButtonPos); + + if (note.type.isTouch() && note.touchArea is TouchSensorType.D or TouchSensorType.E) + { + note.startButtonPos = ConvertMirrorTouchEPosition(note.startButtonPos); + } + else + { + note.startButtonPos = ConvertMirrorPosition(note.startButtonPos); + } if (note.type.isSlide() || note.type == NotesTypeID.Def.ConnectSlide) { @@ -142,14 +148,11 @@ class patch_NotesReader : NotesReader note.slideData.targetNote = ConvertMirrorPosition(note.slideData.targetNote); note.slideData.type = ConvertMirrorSlide(note.slideData.type); } - - if (note.type.isTouch() && note.touchArea is TouchSensorType.D or TouchSensorType.E) - { - note.startButtonPos = ConvertMirrorTouchEPosition(note.startButtonPos); - } } +#if DEBUG System.Console.WriteLine("[MoreChartFormats] [Simai] Calculating chart data"); +#endif calcAll(); #if DEBUG System.Console.WriteLine("[MoreChartFormats] [Simai] Loaded {0} notes", _total.GetAllNoteNum()); diff --git a/README.md b/README.md index ff1c17f..f0df9c6 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,50 @@ ## sinmai-mods -Miscellaneous mods for maimai DX. Mods are MonoMod unless specified otherwise. +Mods for maimai DX. Patch with MonoMod except specified +otherwise. -### CachedDataManager -Speeds up game reboots by caching loaded data. Cache is stored in the `dataCache` folder -and should be deleted if any issues arise. +## Mod list + +### DisableEncryption +Disables title server encryption. + +### DisableReboot +Disables automatic reboots. ### FixLocaleIssues -Attempts to fix charts not loading on some system locales. +Attempt to fix charts not loading on regions where the system's +decimal separator is not the dot (`.`). -Adds `CultureInfo.InvariantCulture` to all instances of `float.Parse` and `float.TryParse` -so charts will still load on locales where the comma is the decimal separator. +### ImproveLoadTimes +Speed up game reboots by caching game data. Cache data is stored +in `data_cache.bin` and can be safely deleted if issues arise. -### LooseDBTables -Enables loading tables from loose `.json` files in `Sinmai_Data/StreamingAssets/DB`. -Useful for string edits (a.k.a. english patch). +### Singleplayer +Show only the left monitor at the center of the screen. -Tables are automatically generated if `Sinmai_Data/StreamingAssets/DB` doesn't exist. +### TouchPanel +Set touch panel sensitivity for individual regions, or introduce +delay on the touch panel. It is configured by adding a section +to `mai2.ini`: -### MoreChartFormats +```ini +[TouchPanel] +; Introduce delay to touch inputs to make it line up with +; button inputs +DelayMs=0 -Loads charts written in various known formats: -- [simai](https://w.atwiki.jp/simai) (powered by a custom fork of [SimaiSharp](https://github.com/reflektone-games/SimaiSharp)) -- srt/szt/sct/sdt (maimai classic chart format) - -To use, edit Music.xml to point the chart file path to your chart file: -```xml - - - {filename}.sdt - - - +; Customize the activation threshold for specific touch +; sensors. The touch sensor values can be found by going +; into input test in the game test menu. +SensitivityA1=90 +SensitivityA2=90 +... ``` -The chart loader used depends on the file extension: -- simai chart files must end with `.simai` -- srt chart files must end with `.srt` -- szt/sct/sdt files can use `.szt`/`.sct`/`.sdt` interchangeably, since they only -differ by two ending columns. [details](https://listed.to/@donmai/18173/the-four-chart-formats-of-maimai-classic) - -#### Simai caveats -- **`maidata.txt` is not supported. If you have one, paste the content of each -`inote_x` into their own `.simai` file.** -- Both `?` and `!` will create a slide without a star note, but both of them will -make the slide fade in (`!` makes the slide suddenly appear in standard simai). -- `$` cannot be used to create a tapless slide (maiPad PLUS syntax). -- `$$` is ignored, as star notes only spin when there's an associated slide. -- `[BPM#a:b]` is not supported for specifying hold time. -- `` ` `` (fake EACH) makes taps 1/384 measures apart. - -#### SXT caveats -- Encrypted chart files (`.srb`/`.szb`/`.scb`/`.sdb`) are not supported. Decrypt -them before loading into the game. -- Since this chart format does not contain timing data, the song's BPM is retrieved -by loading the `Music.xml` associated with the chart, **and it is assumed that the -chart and `Music.xml` is in the same folder**. The SXT loader will not work if the -chart file is somehow in a different folder from `Music.xml`. - ### UnlockFrameRate -Change the target FPS. Also comes with an FPS counter. +**BepInEx mod.** -Unlike other mods in this collection, this is a **BepInEx** mod. You will need to -install BepInEx and drop this into `BepInEx/plugins` to enable the mod. - -The configuration file for changing the FPS is at `BepInEx/config/io.github.beerpsi.sinmai.framerate.cfg` -and is already documented. +Change the target FPS. Also comes with an FPS counter. The +configuration file for changing the FPS is at +`BepInEx/config/io.github.beerpsi.sinmai.framerate.cfg` and is +already documented. diff --git a/Singleplayer/Main/patch_GameMainObject.cs b/Singleplayer/Main/patch_GameMainObject.cs new file mode 100644 index 0000000..ff9de30 --- /dev/null +++ b/Singleplayer/Main/patch_GameMainObject.cs @@ -0,0 +1,30 @@ +// ReSharper disable CheckNamespace +// ReSharper disable InconsistentNaming + +using MonoMod; +using UnityEngine; + +namespace Main; + +public class patch_GameMainObject : GameMainObject +{ + [MonoModIgnore] + private Transform rightMonitor; + + private extern void orig_Start(); + private void Start() + { + orig_Start(); + + var mainCamera = Camera.main; + + if (mainCamera == null) + { + return; + } + + var position = mainCamera.gameObject.transform.position; + mainCamera.gameObject.transform.position = new Vector3(-540f, position.y, position.z); + rightMonitor.transform.localScale = Vector3.zero; + } +} \ No newline at end of file diff --git a/Singleplayer/Singleplayer.csproj b/Singleplayer/Singleplayer.csproj new file mode 100644 index 0000000..242a4d4 --- /dev/null +++ b/Singleplayer/Singleplayer.csproj @@ -0,0 +1,31 @@ + + + + net46 + latest + enable + enable + Assembly-CSharp.Singleplayer.mm + CS0626,CS0649,CS8618 + + + + + ..\External\MonoMod.exe + False + + + ..\External\Assembly-CSharp.dll + False + + + ..\External\UnityEngine.dll + False + + + ..\External\UnityEngine.CoreModule.dll + False + + + + diff --git a/TouchPanel/IO/patch_NewTouchPanel.cs b/TouchPanel/IO/patch_NewTouchPanel.cs new file mode 100644 index 0000000..ce28cbf --- /dev/null +++ b/TouchPanel/IO/patch_NewTouchPanel.cs @@ -0,0 +1,61 @@ +// ReSharper disable CheckNamespace +// ReSharper disable InconsistentNaming + +using System.Globalization; +using MAI2System; +using Manager; + +namespace IO; + +class patch_NewTouchPanel : NewTouchPanel +{ + private int _touchPanelDelayMsec; + private Dictionary _sensitivityOverrides = new(); + + public extern void orig_Initialize(uint index); + public new void Initialize(uint index) + { + orig_Initialize(index); + + using var ini = new IniFile("mai2.ini"); + + _touchPanelDelayMsec = ini.getIntValue("TouchPanel", "DelayMs", 0); + foreach (InputManager.TouchPanelArea sensor in Enum.GetValues(typeof(InputManager.TouchPanelArea))) + { + var sensitivityStr = ini.getValue("TouchPanel", $"Sensitivity{sensor}", null); + + if (sensitivityStr == null) + { + continue; + } + + if (byte.TryParse(sensitivityStr, NumberStyles.Integer, CultureInfo.InvariantCulture, out var sensitivity)) + { + System.Console.WriteLine($"[TouchPanel] [WARN] Invalid value for TouchPanel.Sensitivity{sensor}: {sensitivityStr}"); + continue; + } + + _sensitivityOverrides[sensor] = sensitivity; + } + + } + + private extern void orig_Recv(); + private void Recv() + { + Thread.Sleep(_touchPanelDelayMsec); + orig_Recv(); + } + + private extern void orig_SetTouchPanelSensitivity(List sensitivity); + private void SetTouchPanelSensitivity(List sensitivity) + { + foreach (var s in _sensitivityOverrides) + { + System.Console.WriteLine($"[TouchPanel] Overriding sensitivity for panel {s.Key}: {s.Value}"); + sensitivity[(int)s.Key] = s.Value; + } + + orig_SetTouchPanelSensitivity(sensitivity); + } +} \ No newline at end of file diff --git a/TouchPanel/TouchPanel.csproj b/TouchPanel/TouchPanel.csproj new file mode 100644 index 0000000..97d3cc0 --- /dev/null +++ b/TouchPanel/TouchPanel.csproj @@ -0,0 +1,31 @@ + + + + net46 + latest + enable + enable + Assembly-CSharp.TouchPanel.mm + CS0626 + + + + + ..\External\MonoMod.exe + False + + + ..\External\Assembly-CSharp.dll + False + + + ..\External\UnityEngine.dll + False + + + ..\External\UnityEngine.CoreModule.dll + False + + + + diff --git a/UnlockFrameRate/UnlockFrameRate.csproj b/UnlockFrameRate/UnlockFrameRate.csproj index 91078ca..4fbe61c 100644 --- a/UnlockFrameRate/UnlockFrameRate.csproj +++ b/UnlockFrameRate/UnlockFrameRate.csproj @@ -1,77 +1,38 @@ - - - + + - Debug - AnyCPU - {03F046DF-EE3C-4596-87F3-F5AA131EF401} - Library - Properties - UnlockFrameRate - UnlockFrameRate - v4.6.2 - 512 + net45 + latest + UnlockFrameRate + 1.0.0 + true latest - - https://api.nuget.org/v3/index.json; - https://nuget.bepinex.dev/v3/index.json; - https://nuget.samboy.dev/v3/index.json - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + + + + + + + ..\External\MonoMod.exe + False + ..\External\Assembly-CSharp.dll + False - - - - - - - ..\External\UnityEngine.dll + False ..\External\UnityEngine.CoreModule.dll - - - - ..\External\UnityEngine.IMGUIModule.dll + False - - - - - - + + + - - \ No newline at end of file diff --git a/sinmai-mods.sln b/sinmai-mods.sln index 4c9fbaf..e25c573 100644 --- a/sinmai-mods.sln +++ b/sinmai-mods.sln @@ -1,55 +1,70 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.9.34728.123 +VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CachedDataManager", "CachedDataManager\CachedDataManager.csproj", "{F1C1B6BF-626C-4F10-8672-2F9596706CA6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FixLocaleIssues", "FixLocaleIssues\FixLocaleIssues.csproj", "{C1D1272C-5BC5-4EFD-A9DA-BB8BE8B16280}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FixLocaleIssues", "FixLocaleIssues\FixLocaleIssues.csproj", "{48B5F480-D749-48E9-9D26-E0E5260D95DE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImproveLoadTimes", "ImproveLoadTimes\ImproveLoadTimes.csproj", "{B18FA6C6-79C3-4851-A88E-161D273CBC0F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LooseDBTables", "LooseDBTables\LooseDBTables.csproj", "{F15988CC-BDF0-4F86-811B-BAE18EEA6519}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TouchPanel", "TouchPanel\TouchPanel.csproj", "{B8E4A429-DE84-4565-AD51-87ECCBD629C5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LooseDBTables.GeneratePatches", "LooseDBTables.GeneratePatches\LooseDBTables.GeneratePatches.csproj", "{7DF53594-C7B2-44D1-ADF7-CCE4BC9E7625}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Singleplayer", "Singleplayer\Singleplayer.csproj", "{0A9D8A7E-984F-4406-B497-E45CFF1073E6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoreChartFormats", "MoreChartFormats\MoreChartFormats.csproj", "{A375F626-7238-4227-95C9-2BB1E5E099F6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DisableEncryption", "DisableEncryption\DisableEncryption.csproj", "{FCBAB1FC-A47F-4939-B17B-F07F1A9DF4F7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnlockFrameRate", "UnlockFrameRate\UnlockFrameRate.csproj", "{03F046DF-EE3C-4596-87F3-F5AA131EF401}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DisableReboot", "DisableReboot\DisableReboot.csproj", "{B645EB54-CC74-437F-9255-2D9BFED87DF2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoreChartFormats", "MoreChartFormats\MoreChartFormats.csproj", "{1966AAE3-19E7-4BA0-862A-A3C54DB51B3F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LooseDBTables", "LooseDBTables\LooseDBTables.csproj", "{10E43267-ADB6-44AC-BABA-80D4CF4C7BC8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnlockFrameRate", "UnlockFrameRate\UnlockFrameRate.csproj", "{54622F97-9187-482C-A9DC-06E1855EF2D7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F1C1B6BF-626C-4F10-8672-2F9596706CA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F1C1B6BF-626C-4F10-8672-2F9596706CA6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F1C1B6BF-626C-4F10-8672-2F9596706CA6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F1C1B6BF-626C-4F10-8672-2F9596706CA6}.Release|Any CPU.Build.0 = Release|Any CPU - {48B5F480-D749-48E9-9D26-E0E5260D95DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {48B5F480-D749-48E9-9D26-E0E5260D95DE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {48B5F480-D749-48E9-9D26-E0E5260D95DE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {48B5F480-D749-48E9-9D26-E0E5260D95DE}.Release|Any CPU.Build.0 = Release|Any CPU - {F15988CC-BDF0-4F86-811B-BAE18EEA6519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F15988CC-BDF0-4F86-811B-BAE18EEA6519}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F15988CC-BDF0-4F86-811B-BAE18EEA6519}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F15988CC-BDF0-4F86-811B-BAE18EEA6519}.Release|Any CPU.Build.0 = Release|Any CPU - {7DF53594-C7B2-44D1-ADF7-CCE4BC9E7625}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7DF53594-C7B2-44D1-ADF7-CCE4BC9E7625}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7DF53594-C7B2-44D1-ADF7-CCE4BC9E7625}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7DF53594-C7B2-44D1-ADF7-CCE4BC9E7625}.Release|Any CPU.Build.0 = Release|Any CPU - {A375F626-7238-4227-95C9-2BB1E5E099F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A375F626-7238-4227-95C9-2BB1E5E099F6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A375F626-7238-4227-95C9-2BB1E5E099F6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A375F626-7238-4227-95C9-2BB1E5E099F6}.Release|Any CPU.Build.0 = Release|Any CPU - {03F046DF-EE3C-4596-87F3-F5AA131EF401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {03F046DF-EE3C-4596-87F3-F5AA131EF401}.Debug|Any CPU.Build.0 = Debug|Any CPU - {03F046DF-EE3C-4596-87F3-F5AA131EF401}.Release|Any CPU.ActiveCfg = Release|Any CPU - {03F046DF-EE3C-4596-87F3-F5AA131EF401}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {DDE68F38-1E1E-40F9-AD55-2F5F6C804758} + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C1D1272C-5BC5-4EFD-A9DA-BB8BE8B16280}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C1D1272C-5BC5-4EFD-A9DA-BB8BE8B16280}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C1D1272C-5BC5-4EFD-A9DA-BB8BE8B16280}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C1D1272C-5BC5-4EFD-A9DA-BB8BE8B16280}.Release|Any CPU.Build.0 = Release|Any CPU + {B18FA6C6-79C3-4851-A88E-161D273CBC0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B18FA6C6-79C3-4851-A88E-161D273CBC0F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B18FA6C6-79C3-4851-A88E-161D273CBC0F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B18FA6C6-79C3-4851-A88E-161D273CBC0F}.Release|Any CPU.Build.0 = Release|Any CPU + {B8E4A429-DE84-4565-AD51-87ECCBD629C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B8E4A429-DE84-4565-AD51-87ECCBD629C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B8E4A429-DE84-4565-AD51-87ECCBD629C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B8E4A429-DE84-4565-AD51-87ECCBD629C5}.Release|Any CPU.Build.0 = Release|Any CPU + {0A9D8A7E-984F-4406-B497-E45CFF1073E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0A9D8A7E-984F-4406-B497-E45CFF1073E6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0A9D8A7E-984F-4406-B497-E45CFF1073E6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0A9D8A7E-984F-4406-B497-E45CFF1073E6}.Release|Any CPU.Build.0 = Release|Any CPU + {FCBAB1FC-A47F-4939-B17B-F07F1A9DF4F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FCBAB1FC-A47F-4939-B17B-F07F1A9DF4F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FCBAB1FC-A47F-4939-B17B-F07F1A9DF4F7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FCBAB1FC-A47F-4939-B17B-F07F1A9DF4F7}.Release|Any CPU.Build.0 = Release|Any CPU + {B645EB54-CC74-437F-9255-2D9BFED87DF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B645EB54-CC74-437F-9255-2D9BFED87DF2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B645EB54-CC74-437F-9255-2D9BFED87DF2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B645EB54-CC74-437F-9255-2D9BFED87DF2}.Release|Any CPU.Build.0 = Release|Any CPU + {1966AAE3-19E7-4BA0-862A-A3C54DB51B3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1966AAE3-19E7-4BA0-862A-A3C54DB51B3F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1966AAE3-19E7-4BA0-862A-A3C54DB51B3F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1966AAE3-19E7-4BA0-862A-A3C54DB51B3F}.Release|Any CPU.Build.0 = Release|Any CPU + {10E43267-ADB6-44AC-BABA-80D4CF4C7BC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {10E43267-ADB6-44AC-BABA-80D4CF4C7BC8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {10E43267-ADB6-44AC-BABA-80D4CF4C7BC8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {10E43267-ADB6-44AC-BABA-80D4CF4C7BC8}.Release|Any CPU.Build.0 = Release|Any CPU + {54622F97-9187-482C-A9DC-06E1855EF2D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {54622F97-9187-482C-A9DC-06E1855EF2D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {54622F97-9187-482C-A9DC-06E1855EF2D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {54622F97-9187-482C-A9DC-06E1855EF2D7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal