mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Initial commit
This commit is contained in:
commit
ac838687f8
157 changed files with 27905 additions and 0 deletions
29
Dalamud.Injector/Dalamud.Injector.csproj
Normal file
29
Dalamud.Injector/Dalamud.Injector.csproj
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup Label="Target">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<LangVersion>7.2</LangVersion>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Build">
|
||||
<OutputType>Exe</OutputType>
|
||||
<OutputPath>$(SolutionDir)/bin</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>Portable</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Feature">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>2.4.0.0</AssemblyVersion>
|
||||
<FileVersion>2.4.0.0</FileVersion>
|
||||
<Description>XIVLauncher addon injection</Description>
|
||||
<Version>2.4.0</Version>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EasyHook" Version="2.7.6270" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dalamud\Dalamud.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
49
Dalamud.Injector/Program.cs
Normal file
49
Dalamud.Injector/Program.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Dalamud.DiscordBot;
|
||||
using Dalamud.Game.Chat;
|
||||
using EasyHook;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dalamud.Injector {
|
||||
internal static class Program {
|
||||
private static void Main(string[] args) {
|
||||
AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs eventArgs)
|
||||
{
|
||||
File.WriteAllText("InjectorException.txt", eventArgs.ExceptionObject.ToString());
|
||||
|
||||
Process.GetCurrentProcess().Kill();
|
||||
};
|
||||
|
||||
int pid = int.Parse(args[0]);
|
||||
|
||||
Process process = null;
|
||||
process = pid == -1 ? Process.GetProcessesByName("ffxiv_dx11")[0] : Process.GetProcessById(pid);
|
||||
|
||||
var startInfo = JsonConvert.DeserializeObject<DalamudStartInfo>(Encoding.UTF8.GetString(Convert.FromBase64String(args[1])));
|
||||
startInfo.WorkingDirectory = Directory.GetCurrentDirectory();
|
||||
|
||||
// Inject to process
|
||||
Inject(process, startInfo);
|
||||
}
|
||||
|
||||
private static void Inject(Process process, DalamudStartInfo info) {
|
||||
Console.WriteLine($"Injecting to {process.Id}");
|
||||
|
||||
// File check
|
||||
var libPath = Path.GetFullPath("Dalamud.dll");
|
||||
if (!File.Exists(libPath)) {
|
||||
Console.WriteLine($"Can't find a dll on {libPath}");
|
||||
return;
|
||||
}
|
||||
|
||||
RemoteHooking.Inject(process.Id, InjectionOptions.DoNotRequireStrongName, libPath, libPath, info);
|
||||
|
||||
Console.WriteLine("Injected");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue