mirror of https://github.com/hykilpikonna/AquaDX
[+] Execute some command on game idle or on game start
parent
86164ba518
commit
21309cddf0
|
@ -278,6 +278,7 @@
|
|||
<Compile Include="UX\LoadAssetBundleWithoutManifest.cs" />
|
||||
<Compile Include="UX\QuickSkip.cs" />
|
||||
<Compile Include="UX\RandomBgm.cs" />
|
||||
<Compile Include="UX\RunCommandOnEvents.cs" />
|
||||
<Compile Include="UX\SinglePlayer.cs" />
|
||||
<Compile Include="UX\SkipEventInfo.cs" />
|
||||
<Compile Include="UX\SkipWarningScreen.cs" />
|
||||
|
|
|
@ -26,6 +26,9 @@ LoadAssetBundleWithoutManifest=true
|
|||
SkipEventInfo=true
|
||||
# Random BGM, put Mai2Cue.{acb,awb} of old version of the game in `LocalAssets\Mai2Cue` and rename them
|
||||
RandomBgm=false
|
||||
# Execute some command on game idle or on game start
|
||||
ExecOnIdle=""
|
||||
ExecOnEntry=""
|
||||
|
||||
[Performance]
|
||||
# Disable some useless delays to speed up the game boot process
|
||||
|
|
|
@ -24,6 +24,8 @@ namespace AquaMai
|
|||
public bool QuickSkip { get; set; }
|
||||
public bool RandomBgm { get; set; }
|
||||
public string CustomVersionString { get; set; }
|
||||
public string ExecOnIdle { get; set; }
|
||||
public string ExecOnEntry { get; set; }
|
||||
}
|
||||
|
||||
public class PerformanceConfig
|
||||
|
|
|
@ -80,6 +80,7 @@ namespace AquaMai
|
|||
Patch(typeof(FixCharaCrash));
|
||||
Patch(typeof(CustomVersionString));
|
||||
Patch(typeof(DisableReboot));
|
||||
Patch(typeof(RunCommandOnEvents));
|
||||
|
||||
MelonLogger.Msg("Loaded!");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using HarmonyLib;
|
||||
using MelonLoader;
|
||||
using Process;
|
||||
|
||||
namespace AquaMai.UX
|
||||
{
|
||||
public class RunCommandOnEvents
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(AdvertiseProcess), "OnStart")]
|
||||
public static void AdvertiseProcessPreStart()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(AquaMai.AppConfig.UX.ExecOnIdle))
|
||||
{
|
||||
Exec(AquaMai.AppConfig.UX.ExecOnIdle);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(EntryProcess), "OnStart")]
|
||||
public static void EntryProcessPreStart()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(AquaMai.AppConfig.UX.ExecOnEntry))
|
||||
{
|
||||
Exec(AquaMai.AppConfig.UX.ExecOnEntry);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Exec(string command)
|
||||
{
|
||||
var process = new System.Diagnostics.Process();
|
||||
process.StartInfo.FileName = "cmd.exe";
|
||||
process.StartInfo.Arguments = "/c " + command;
|
||||
process.StartInfo.UseShellExecute = true;
|
||||
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
process.StartInfo.WorkingDirectory = Environment.CurrentDirectory;
|
||||
|
||||
process.Start();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue