mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-21 07:17:45 +01:00
wip
This commit is contained in:
parent
b6f9051898
commit
57e046cd71
4 changed files with 19 additions and 65 deletions
|
|
@ -42,7 +42,7 @@ namespace Dalamud.Injector
|
||||||
VerboseLog = false,
|
VerboseLog = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
RemoteInjector.Inject(pid, corehookConfig, );
|
RemoteInjector.Inject((int)pid, corehookConfig, new PipePlatform(), m_options.RootDirectory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,14 @@ Global
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Debug|x64.ActiveCfg = Debug|x64
|
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Debug|x64.Build.0 = Debug|x64
|
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Debug|x86.Build.0 = Debug|Any CPU
|
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Release|Any CPU.Build.0 = Release|Any CPU
|
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Release|x64.ActiveCfg = Release|x64
|
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Release|x64.Build.0 = Release|x64
|
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Release|x86.ActiveCfg = Release|Any CPU
|
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Release|x86.Build.0 = Release|Any CPU
|
{B92DAB43-2279-4A2C-96E3-D9D5910EDBEA}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{5B832F73-5F54-4ADC-870F-D0095EF72C9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{5B832F73-5F54-4ADC-870F-D0095EF72C9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
<PackageReference Include="Serilog" Version="2.6.0" />
|
<PackageReference Include="Serilog" Version="2.6.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.1.0" />
|
<PackageReference Include="Serilog.Sinks.Async" Version="1.1.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
|
||||||
<PackageReference Include="EasyHook" Version="2.7.6270" />
|
|
||||||
<PackageReference Include="SharpDX.Desktop" Version="4.2.0" />
|
<PackageReference Include="SharpDX.Desktop" Version="4.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -2,70 +2,25 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
using EasyHook;
|
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Core;
|
using Serilog.Core;
|
||||||
|
using CoreHook;
|
||||||
|
|
||||||
namespace Dalamud {
|
namespace Dalamud
|
||||||
public sealed class EntryPoint : IEntryPoint {
|
{
|
||||||
public EntryPoint(RemoteHooking.IContext ctx, DalamudStartInfo info) {
|
/// <summary>
|
||||||
// Required by EasyHook
|
///
|
||||||
}
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
///
|
||||||
|
/// </remarks>
|
||||||
|
public sealed class EntryPoint : IEntryPoint
|
||||||
|
{
|
||||||
|
public EntryPoint(IContext context, string rootDirectory) { }
|
||||||
|
|
||||||
public void Run(RemoteHooking.IContext ctx, DalamudStartInfo info) {
|
public void Run(IContext context, string rootDirectory)
|
||||||
// Setup logger
|
{
|
||||||
Log.Logger = NewLogger(info.WorkingDirectory);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Log.Information("Initializing a session..");
|
|
||||||
|
|
||||||
// This is due to GitHub not supporting TLS 1.0, so we enable all TLS versions globally
|
|
||||||
System.Net.ServicePointManager.SecurityProtocol =
|
|
||||||
SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
|
|
||||||
|
|
||||||
// Log any unhandled exception.
|
|
||||||
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
|
|
||||||
|
|
||||||
using (var dalamud = new Dalamud(info)) {
|
|
||||||
Log.Information("Starting a session..");
|
|
||||||
|
|
||||||
// Run session
|
|
||||||
dalamud.Start();
|
|
||||||
dalamud.WaitForUnload();
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
Log.Fatal(ex, "Unhandled exception on main thread.");
|
|
||||||
} finally {
|
|
||||||
AppDomain.CurrentDomain.UnhandledException -= OnUnhandledException;
|
|
||||||
|
|
||||||
Log.Information("Session has ended.");
|
|
||||||
Log.CloseAndFlush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Logger NewLogger(string baseDirectory) {
|
|
||||||
var logPath = Path.Combine(baseDirectory, "dalamud.txt");
|
|
||||||
|
|
||||||
return new LoggerConfiguration()
|
|
||||||
.WriteTo.Async(a => a.File(logPath))
|
|
||||||
.WriteTo.EventSink()
|
|
||||||
#if DEBUG
|
|
||||||
.MinimumLevel.Verbose()
|
|
||||||
#else
|
|
||||||
.MinimumLevel.Information()
|
|
||||||
#endif
|
|
||||||
.CreateLogger();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnUnhandledException(object sender, UnhandledExceptionEventArgs arg) {
|
|
||||||
switch (arg.ExceptionObject) {
|
|
||||||
case Exception ex:
|
|
||||||
Log.Fatal(ex, "Unhandled exception on AppDomain");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Log.Fatal("Unhandled SEH object on AppDomain: {Object}", arg.ExceptionObject);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue