mirror of
https://gitea.tendokyu.moe/yellowberry/WACCALauncher.git
synced 2026-09-22 22:58:00 +03:00
Support injecting multiple DLLs, use first one for amdaemon
This commit is contained in:
+13
-17
@@ -486,16 +486,8 @@ namespace WACCALauncher
|
||||
si.WorkingDirectory = Path.Combine(profile.GetBaseDir().FullName, "bin");
|
||||
si.WindowStyle = ProcessWindowStyle.Minimized;
|
||||
si.FileName = "inject.exe";
|
||||
|
||||
var args = new string[] {
|
||||
"-d -k",
|
||||
profile.InjectDLL,
|
||||
"amdaemon.exe",
|
||||
profile.GetAmdaemonArgs()
|
||||
};
|
||||
|
||||
si.Arguments = string.Join(" ", args);
|
||||
|
||||
|
||||
si.Arguments = string.Join(" ", "-d", $"-k {profile.InjectDLLs[0]}", "amdaemon.exe", profile.GetAmdaemonArgs());
|
||||
return si;
|
||||
}
|
||||
|
||||
@@ -557,11 +549,8 @@ namespace WACCALauncher
|
||||
_amdaemonProcess.Start();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayError("No amdaemon configs specified");
|
||||
return;
|
||||
}
|
||||
DisplayError("No amdaemon configs specified");
|
||||
return;
|
||||
}
|
||||
case ProfileType.Generic:
|
||||
{
|
||||
@@ -579,7 +568,7 @@ namespace WACCALauncher
|
||||
var gamePath = _gameProcess.StartInfo.FileName;
|
||||
_gameProcess.StartInfo.FileName = "inject.exe";
|
||||
_gameProcess.StartInfo.WorkingDirectory = Path.Combine(profile.GetBaseDir().FullName, "bin");
|
||||
_gameProcess.StartInfo.Arguments = string.Join(" ", new string[] { "-d -k", profile.InjectDLL, $"\"{gamePath}\"" });
|
||||
_gameProcess.StartInfo.Arguments = string.Join(" ", "-d", profile.GetInjectDLLArgs(), $"\"{gamePath}\"");
|
||||
_gameProcess.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
|
||||
}
|
||||
else _gameProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
|
||||
@@ -603,7 +592,14 @@ namespace WACCALauncher
|
||||
Invoke(new Action(() => _state = LauncherState.GameClosed));
|
||||
|
||||
// it will stay open if we don't close it
|
||||
_amdaemonProcess.Kill();
|
||||
try
|
||||
{
|
||||
_amdaemonProcess.Kill();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// amdaemon wasn't running
|
||||
}
|
||||
|
||||
if (settings.UseWatchdog)
|
||||
{
|
||||
|
||||
+18
-5
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace WACCALauncher
|
||||
{
|
||||
@@ -64,8 +65,20 @@ namespace WACCALauncher
|
||||
[JsonProperty]
|
||||
public bool InjectGame = true;
|
||||
|
||||
[JsonProperty, Obsolete("Use InjectDLLs instead.", true)]
|
||||
public string InjectDLL
|
||||
{
|
||||
get => null;
|
||||
set => InjectDLLs.Add(value);
|
||||
}
|
||||
|
||||
[JsonProperty]
|
||||
public string InjectDLL = "mercuryhook.dll";
|
||||
public List<string> InjectDLLs = new List<string> { "mercuryhook.dll" };
|
||||
|
||||
public string GetInjectDLLArgs()
|
||||
{
|
||||
return string.Join(" ", InjectDLLs.Select(s => $"-k {s}"));
|
||||
}
|
||||
|
||||
public string GetAmdaemonArgs()
|
||||
{
|
||||
@@ -83,7 +96,7 @@ namespace WACCALauncher
|
||||
{
|
||||
throw new ProfileLoadException("Base dir not found");
|
||||
}
|
||||
else if (!File.Exists(loaded.GetGamePath()))
|
||||
if (!File.Exists(loaded.GetGamePath()))
|
||||
{
|
||||
throw new ProfileLoadException("Game file not found");
|
||||
}
|
||||
@@ -95,7 +108,7 @@ namespace WACCALauncher
|
||||
{
|
||||
throw new ProfileLoadException("configs missing, check config and files");
|
||||
}
|
||||
else if (!CheckForInjector(binPath, loaded.InjectDLL))
|
||||
if (!CheckForInjector(binPath, loaded.InjectDLLs))
|
||||
{
|
||||
throw new ProfileLoadException("Segatools missing, check config and files");
|
||||
}
|
||||
@@ -109,9 +122,9 @@ namespace WACCALauncher
|
||||
File.WriteAllText(ConfigPath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||
}
|
||||
|
||||
private static bool CheckForInjector(string path, string dll)
|
||||
private static bool CheckForInjector(string path, List<string> dlls)
|
||||
{
|
||||
return File.Exists(Path.Combine(path, dll)) &&
|
||||
return dlls.TrueForAll(dll => File.Exists(Path.Combine(path, dll))) &&
|
||||
File.Exists(Path.Combine(path, "segatools.ini")) &&
|
||||
File.Exists(Path.Combine(path, "inject.exe"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user