mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Update Dalamud.Injector logic
- Added logic determine the game install path from process in case its not installed at the default path (Line 16, 88 and 98) - Made auto-detecting the game's PID (the -1 arg) the default behavior (Line 30-33) - Added a check to ensure the PID argugemt exist (Line 31) - Fixed check to ensure for start info argument exist (Line 51) - Added missing code to display the base64 encoded start info argument to include (Line 56)
This commit is contained in:
parent
311968ed57
commit
a7776fe15f
1 changed files with 11 additions and 5 deletions
|
|
@ -13,6 +13,8 @@ using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Dalamud.Injector {
|
namespace Dalamud.Injector {
|
||||||
internal static class Program {
|
internal static class Program {
|
||||||
|
static private Process process = null;
|
||||||
|
|
||||||
private static void Main(string[] args) {
|
private static void Main(string[] args) {
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs eventArgs)
|
AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs eventArgs)
|
||||||
|
|
@ -25,9 +27,10 @@ namespace Dalamud.Injector {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var pid = int.Parse(args[0]);
|
var pid = -1;
|
||||||
|
if (args.Length == 1) {
|
||||||
Process process = null;
|
pid = int.Parse(args[0]);
|
||||||
|
}
|
||||||
|
|
||||||
switch (pid) {
|
switch (pid) {
|
||||||
case -1:
|
case -1:
|
||||||
|
|
@ -45,10 +48,12 @@ namespace Dalamud.Injector {
|
||||||
}
|
}
|
||||||
|
|
||||||
DalamudStartInfo startInfo;
|
DalamudStartInfo startInfo;
|
||||||
if (args.Length == 1) {
|
if (args.Length <= 1) {
|
||||||
startInfo = GetDefaultStartInfo();
|
startInfo = GetDefaultStartInfo();
|
||||||
Console.WriteLine("\nA Dalamud start info was not found in the program arguments. One has been generated for you.");
|
Console.WriteLine("\nA Dalamud start info was not found in the program arguments. One has been generated for you.");
|
||||||
Console.WriteLine("\nCopy the following contents into the program arguments:");
|
Console.WriteLine("\nCopy the following contents into the program arguments:");
|
||||||
|
Console.WriteLine();
|
||||||
|
Console.WriteLine(Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(startInfo))));
|
||||||
} else {
|
} else {
|
||||||
startInfo = JsonConvert.DeserializeObject<DalamudStartInfo>(Encoding.UTF8.GetString(Convert.FromBase64String(args[1])));
|
startInfo = JsonConvert.DeserializeObject<DalamudStartInfo>(Encoding.UTF8.GetString(Convert.FromBase64String(args[1])));
|
||||||
}
|
}
|
||||||
|
|
@ -80,6 +85,7 @@ namespace Dalamud.Injector {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DalamudStartInfo GetDefaultStartInfo() {
|
private static DalamudStartInfo GetDefaultStartInfo() {
|
||||||
|
var ffxivDir = Path.GetDirectoryName(process.MainModule.FileName);
|
||||||
var startInfo = new DalamudStartInfo {
|
var startInfo = new DalamudStartInfo {
|
||||||
WorkingDirectory = null,
|
WorkingDirectory = null,
|
||||||
ConfigurationPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
|
ConfigurationPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
|
||||||
|
|
@ -89,7 +95,7 @@ namespace Dalamud.Injector {
|
||||||
DefaultPluginDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
|
DefaultPluginDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
|
||||||
@"\XIVLauncher\devPlugins",
|
@"\XIVLauncher\devPlugins",
|
||||||
|
|
||||||
GameVersion = File.ReadAllText(@"C:\Program Files (x86)\SquareEnix\FINAL FANTASY XIV - A Realm Reborn\game\ffxivgame.ver"),
|
GameVersion = File.ReadAllText(Path.Combine(ffxivDir, "ffxivgame.ver")),
|
||||||
Language = ClientLanguage.English
|
Language = ClientLanguage.English
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue