Skip to content

Commit

Permalink
[RF] Move some settings to TimeSavingConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Sep 27, 2024
1 parent 24e6808 commit 9605264
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 96 deletions.
13 changes: 9 additions & 4 deletions AquaMai/AquaMai.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,14 @@
<Compile Include="Helpers\MessageHelper.cs" />
<Compile Include="Helpers\MusicDirHelper.cs" />
<Compile Include="Helpers\SharedInstances.cs" />
<Compile Include="Performance\ImproveLoadSpeed.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Main.cs" />
<Compile Include="TimeSaving\ImproveLoadSpeed.cs" />
<Compile Include="TimeSaving\IWontTapOrSlideVigorously.cs" />
<Compile Include="TimeSaving\SkipEventInfo.cs" />
<Compile Include="TimeSaving\SkipGameOverScreen.cs" />
<Compile Include="TimeSaving\SkipToMusicSelection.cs" />
<Compile Include="TimeSaving\SkipWarningScreen.cs" />
<Compile Include="TouchSensitivity\Enable.cs" />
<Compile Include="Utils\JudgeAdjust.cs" />
<Compile Include="Utils\LogUserId.cs" />
Expand All @@ -322,9 +327,6 @@
<Compile Include="UX\RunCommandOnEvents.cs" />
<Compile Include="UX\SelectionDetail.cs" />
<Compile Include="UX\SinglePlayer.cs" />
<Compile Include="UX\SkipEventInfo.cs" />
<Compile Include="UX\SkipWarningScreen.cs" />
<Compile Include="UX\SkipToMusicSelection.cs" />
<Compile Include="UX\TestProof.cs" />
</ItemGroup>
<ItemGroup>
Expand All @@ -338,6 +340,9 @@
<ItemGroup>
<Content Include="FodyWeavers.xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Performance\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\Fody.6.8.1\build\Fody.targets" Condition="Exists('packages\Fody.6.8.1\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
26 changes: 16 additions & 10 deletions AquaMai/AquaMai.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ DebugFeature=true
# ===================================
# UX: User Experience Improvements
[UX]
# Skip the warning screen and logo shown after the POST sequence
SkipWarningScreen=true
# Single player: Show 1P only, at the center of the screen
SinglePlayer=true
# !!EXPERIMENTAL!! Skip from the card-scanning screen directly to music selection screen
SkipToMusicSelection=false
# Set the version string displayed at the top-right corner of the screen
CustomVersionString=""
# Deprecated: Use `LoadAssetsPng` instead
Expand All @@ -33,8 +29,6 @@ LoadLocalBga=true
QuickSkip=true
# Add ".ab" image resources without the need of rebuilding a manifest
LoadAssetBundleWithoutManifest=true
# Skip "New Event" and "Information" text boxes for new users
SkipEventInfo=true
# Random BGM, put Mai2Cue.{acb,awb} of old version of the game in `LocalAssets\Mai2Cue` and rename them
# Do not enable when SinglePlayer is off
RandomBgm=false
Expand All @@ -59,10 +53,6 @@ HideSelfMadeCharts=true
# Show detail of selected song in music selection screen
SelectionDetail=true

[Performance]
# Disable some useless delays to speed up the game boot process
ImproveLoadSpeed=true

[Fix]
# Allow login with higher data version
SkipVersionCheck=true
Expand All @@ -85,6 +75,22 @@ JudgeAdjustB=0.0
# Touch screen delay, unit is milliseconds, one second = 1000 milliseconds. Must be an integer
TouchDelay=0

# ===================================
# Save some potentially unnecessary time
[TimeSaving]
# Skip the warning screen and logo shown after the POST sequence
SkipWarningScreen=true
# Disable some useless delays to speed up the game boot process
ImproveLoadSpeed=true
# Directly enter the song selection screen after login
SkipToMusicSelection=false
# Skip possible prompts like "New area discovered", "New songs added", "There are events" during game login/registration
SkipEventInfo=true
# Skip the "Do not tap or slide vigorously" screen, immediately proceed to the next screen once data is loaded
IWontTapOrSlideVigorously=true
# Skip the "Goodbye" screen at the end of the game
SkipGameOverScreen=true

[TouchSensitivity]
# Enable custom sensitivity
# When enabled, the settings in Test mode will not take effect
Expand Down
33 changes: 20 additions & 13 deletions AquaMai/AquaMai.zh.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

# 试试使用 MaiChartManager 图形化配置 AquaMai 吧!
# https://github.com/clansty/MaiChartManager

# ===================================
# “作弊”功能
[Cheat]
Expand All @@ -14,12 +17,8 @@ DebugFeature=true
# ===================================
# 用户体验改进
[UX]
# 跳过日服启动时候的 WARNING 界面
SkipWarningScreen=true
# 单人模式,不显示 2P
SinglePlayer=true
# 登录完成后直接进入选歌界面
SkipToMusicSelection=false
# 把右上角的版本更改为自定义文本
CustomVersionString=""
# 已弃用,请使用 LoadAssetsPng
Expand All @@ -38,8 +37,6 @@ QuickSkip=true
# 优化图片资源的加载,就算没有 AssetBundleImages.manifest 也可以正常加载 ab 格式的图片资源
# 导入了删除曲包之类的话,应该需要开启这个
LoadAssetBundleWithoutManifest=true
# 跳过登录 / 注册游戏时候可能的 “发现了新的区域哟” “乐曲增加” “有活动哟” 之类的提示
SkipEventInfo=true
# 在 `LocalAssets\Mai2Cue` 这个目录下放置了旧版游戏的 Mai2Cue.{acb,awb} 并重命名的话,可以在播放游戏 BGM 的时候随机播放这里面的旧版游戏 BGM
# 和 2P 模式有冲突,如果你没有开启 'SinglePlayer' 的话,请关闭这个
RandomBgm=false
Expand All @@ -65,13 +62,6 @@ HideSelfMadeCharts=true
# 选歌界面显示选择的歌曲的详情
SelectionDetail=true

# ===================================
# 一些性能优化
[Performance]
# 在自检界面,每个屏幕结束的时候都会等两秒才进入下一个屏幕,很浪费时间
# 开了这个选项之后就不会等了
ImproveLoadSpeed=true

# ===================================
# 修复一些潜在的问题
[Fix]
Expand Down Expand Up @@ -101,6 +91,23 @@ JudgeAdjustB=0.0
# 触摸屏延迟,单位为毫秒,一秒 = 1000 毫秒。必须是整数
TouchDelay=0

# ===================================
# 节省一些不知道有用没用的时间
[TimeSaving]
# 跳过日服启动时候的 WARNING 界面
SkipWarningScreen=true
# 在自检界面,每个屏幕结束的时候都会等两秒才进入下一个屏幕,很浪费时间
# 开了这个选项之后就不会等了
ImproveLoadSpeed=true
# 登录完成后直接进入选歌界面
SkipToMusicSelection=false
# 跳过登录 / 注册游戏时候可能的 “发现了新的区域哟” “乐曲增加” “有活动哟” 之类的提示
SkipEventInfo=true
# 跳过“不要大力拍打或滑动哦”这个界面,数据一旦加载完就立马进入下一个界面
IWontTapOrSlideVigorously=true
# 跳过游戏结束的“再见”界面
SkipGameOverScreen=true

[TouchSensitivity]
# 是否启用自定义灵敏度
# 这里启用之后 Test 里的就不再起作用了
Expand Down
20 changes: 11 additions & 9 deletions AquaMai/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class Config
{
public UXConfig UX { get; set; } = new();
public CheatConfig Cheat { get; set; } = new();
public PerformanceConfig Performance { get; set; } = new();
public FixConfig Fix { get; set; } = new();
public UtilsConfig Utils { get; set; } = new();
public TimeSavingConfig TimeSaving { get; set; } = new();
public TouchSensitivityConfig TouchSensitivity { get; set; } = new();

public class CheatConfig
Expand All @@ -23,17 +23,14 @@ public class CheatConfig

public class UXConfig
{
public bool SkipWarningScreen { get; set; }
public bool SinglePlayer { get; set; }
public bool SkipToMusicSelection { get; set; }
public bool LoadAssetsPng { get; set; }
public bool LoadJacketPng { get; set; }
public bool LoadAssetBundleWithoutManifest { get; set; }
public bool QuickSkip { get; set; }
public bool RandomBgm { get; set; }
public bool DemoMaster { get; set; }
public bool ExtendTimer { get; set; }
public bool SkipEventInfo { get; set; }
public bool ImmediateSave { get; set; }
public bool LoadLocalBga { get; set; }
public bool TestProof { get; set; }
Expand All @@ -45,11 +42,6 @@ public class UXConfig
public string ExecOnEntry { get; set; } = "";
}

public class PerformanceConfig
{
public bool ImproveLoadSpeed { get; set; }
}

public class FixConfig
{
public bool SkipVersionCheck { get; set; }
Expand All @@ -68,6 +60,16 @@ public class UtilsConfig
public int TouchDelay { get; set; }
}

public class TimeSavingConfig
{
public bool SkipWarningScreen { get; set; }
public bool ImproveLoadSpeed { get; set; }
public bool SkipToMusicSelection { get; set; }
public bool SkipEventInfo { get; set; }
public bool IWontTapOrSlideVigorously { get; set; }
public bool SkipGameOverScreen { get; set; }
}

public class TouchSensitivityConfig
{
public bool Enable { get; set; }
Expand Down
15 changes: 15 additions & 0 deletions AquaMai/TimeSaving/IWontTapOrSlideVigorously.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using HarmonyLib;
using Monitor;

namespace AquaMai.TimeSaving;

public class IWontTapOrSlideVigorously
{
[HarmonyPrefix]
[HarmonyPatch(typeof(PlInformationMonitor), "IsPlayPlInfoEnd")]
public static bool Patch(ref bool __result)
{
__result = true;
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using HarmonyLib;
using Process;

namespace AquaMai.Performance
namespace AquaMai.TimeSaving
{
public class ImproveLoadSpeed
{
Expand All @@ -23,4 +23,4 @@ public static void PreStartupUpdate(byte ____state, ref Stopwatch ___timer)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Process;
using Process.Information;

namespace AquaMai.UX
namespace AquaMai.TimeSaving
{
public class SkipEventInfo
{
Expand All @@ -21,4 +21,4 @@ public static void RegionalSelectProcessPreStart(ref Queue<int>[] ____discoverLi
____discoverList = new Queue<int>[] { new Queue<int>(), new Queue<int>() };
}
}
}
}
26 changes: 26 additions & 0 deletions AquaMai/TimeSaving/SkipGameOverScreen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using HarmonyLib;
using Monitor;
using Process;

namespace AquaMai.TimeSaving;

public class SkipGameOverScreen
{
[HarmonyPrefix]
[HarmonyPatch(typeof(GameOverMonitor), "IsPlayEnd")]
public static bool GameOverMonitorPlayEnd(ref bool __result)
{
__result = true;
return false;
}

[HarmonyPrefix]
[HarmonyPatch(typeof(GameOverProcess), "OnUpdate")]
public static void GameOverProcessOnUpdate(ref GameOverProcess.GameOverSequence ____state)
{
if (____state == GameOverProcess.GameOverSequence.SkyChange)
{
____state = GameOverProcess.GameOverSequence.Disp;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Process;
using Process.Information;

namespace AquaMai.UX
namespace AquaMai.TimeSaving
{
public class SkipToMusicSelection
{
Expand Down Expand Up @@ -35,4 +35,4 @@ public static void MapResultMonitorPreInitialize(int monIndex)
userData.MapList.Clear();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
using HarmonyLib;
using Monitor;

namespace AquaMai.UX
{
public class SkipWarningScreen
{
/*
* Patch PlayLogo to disable the warning screen
*/
[HarmonyPrefix]
[HarmonyPatch(typeof (WarningMonitor), "PlayLogo")]
public static bool PlayLogo()
{
// Return false to block the original method
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof (WarningMonitor), "IsLogoAnimationEnd")]
public static bool IsLogoAnimationEnd(ref bool __result)
{
// Always return true to indicate the animation has ended
__result = true;
return false;
}
}
}
using HarmonyLib;
using Monitor;

namespace AquaMai.TimeSaving
{
public class SkipWarningScreen
{
/*
* Patch PlayLogo to disable the warning screen
*/
[HarmonyPrefix]
[HarmonyPatch(typeof (WarningMonitor), "PlayLogo")]
public static bool PlayLogo()
{
// Return false to block the original method
return false;
}

[HarmonyPrefix]
[HarmonyPatch(typeof (WarningMonitor), "IsLogoAnimationEnd")]
public static bool IsLogoAnimationEnd(ref bool __result)
{
// Always return true to indicate the animation has ended
__result = true;
return false;
}
}
}
26 changes: 0 additions & 26 deletions AquaMai/UX/ExtendTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,31 +52,5 @@ public static void PhotoEditProcess(PhotoEditMonitor[] ____monitors, PhotoEditPr
____monitors[0].SetButtonPressed(InputManager.ButtonSetting.Button04);
Traverse.Create(__instance).Method("OnTimeUp").GetValue();
}

[HarmonyPrefix]
[HarmonyPatch(typeof(PlInformationMonitor), "IsPlayPlInfoEnd")]
public static bool IWontTapOrSlideVigorously(ref bool __result)
{
__result = true;
return false;
}

[HarmonyPrefix]
[HarmonyPatch(typeof(GameOverMonitor), "IsPlayEnd")]
public static bool GameOverMonitorPlayEnd(ref bool __result)
{
__result = true;
return false;
}

[HarmonyPrefix]
[HarmonyPatch(typeof(GameOverProcess), "OnUpdate")]
public static void GameOverProcessOnUpdate(ref GameOverProcess.GameOverSequence ____state)
{
if (____state == GameOverProcess.GameOverSequence.SkyChange)
{
____state = GameOverProcess.GameOverSequence.Disp;
}
}
}
}

0 comments on commit 9605264

Please sign in to comment.