mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
chore: remove C# GameFixes infrastructure
This commit is contained in:
parent
75de126c9d
commit
21ae9c018c
5 changed files with 4 additions and 141 deletions
|
|
@ -7,7 +7,6 @@ using System.Threading;
|
|||
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Fixes;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.Command;
|
||||
|
|
@ -110,11 +109,6 @@ namespace Dalamud
|
|||
Service<SigScanner>.Set(new SigScanner(true));
|
||||
Service<HookManager>.Set();
|
||||
|
||||
// Initialize game fixes
|
||||
var gameFixes = Service<GameFixes>.Set();
|
||||
gameFixes.Apply();
|
||||
Log.Information("[T1] GameFixes OK!");
|
||||
|
||||
// Signal the main game thread to continue
|
||||
NativeFunctions.SetEvent(this.mainThreadContinueEvent);
|
||||
Log.Information("[T1] Game thread continued!");
|
||||
|
|
@ -388,8 +382,6 @@ namespace Dalamud
|
|||
Service<Framework>.GetNullable()?.ExplicitDispose();
|
||||
Service<ClientState>.GetNullable()?.ExplicitDispose();
|
||||
|
||||
Service<GameFixes>.GetNullable()?.ExplicitDispose();
|
||||
|
||||
this.unloadSignal?.Dispose();
|
||||
|
||||
Service<WinSockHandlers>.GetNullable()?.Dispose();
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Fixes;
|
||||
|
||||
/// <summary>
|
||||
/// Class responsible for executing game fixes.
|
||||
/// </summary>
|
||||
internal class GameFixes : IDisposable
|
||||
{
|
||||
private readonly IGameFix[] fixes =
|
||||
{
|
||||
new WndProcNullRefFix(),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Apply all game fixes.
|
||||
/// </summary>
|
||||
public void Apply()
|
||||
{
|
||||
foreach (var gameFix in this.fixes)
|
||||
{
|
||||
try
|
||||
{
|
||||
gameFix.Apply();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Could not apply game fix: {FixName}", gameFix.GetType().FullName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (var disposable in this.fixes.OfType<IDisposable>())
|
||||
{
|
||||
disposable.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Dalamud.Fixes;
|
||||
|
||||
/// <summary>
|
||||
/// Base interface to be implemented by game fixes.
|
||||
/// </summary>
|
||||
internal interface IGameFix
|
||||
{
|
||||
/// <summary>
|
||||
/// Apply the patch to the game.
|
||||
/// </summary>
|
||||
public void Apply();
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
using System;
|
||||
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.Memory;
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Fixes;
|
||||
|
||||
/// <summary>
|
||||
/// This fix is for the following issue:
|
||||
/// Null reference in the game's WndProc function when certain window messages arrive
|
||||
/// before an object on the game's input manager is initialized.
|
||||
/// </summary>
|
||||
internal class WndProcNullRefFix : IGameFix, IDisposable
|
||||
{
|
||||
private Hook<WndProcDelegate>? wndProcHook;
|
||||
|
||||
private IntPtr object1Address;
|
||||
private IntPtr object2Address;
|
||||
|
||||
private delegate IntPtr WndProcDelegate(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Apply()
|
||||
{
|
||||
var sigScanner = Service<SigScanner>.Get();
|
||||
|
||||
if (!sigScanner.TryScanText("40 55 53 41 54 41 56 48 8D 6C 24 ??", out var patchAddress))
|
||||
{
|
||||
Log.Error("Failed to find WndProc address");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sigScanner.TryGetStaticAddressFromSig("74 1F E8 ?? ?? ?? ?? 48 83 38 00 ", out this.object1Address))
|
||||
{
|
||||
Log.Error("Failed to find object1 address");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sigScanner.TryGetStaticAddressFromSig("E8 ?? ?? ?? ?? 48 83 38 00 74 14", out this.object2Address, 0x7))
|
||||
{
|
||||
Log.Error("Failed to find object2 address");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.Information($"Applying WndProcNullRefFix at {patchAddress:X} with o1 {this.object1Address:X}, o2 {this.object2Address:X}");
|
||||
|
||||
this.wndProcHook = new Hook<WndProcDelegate>(patchAddress, this.WndProcDetour, true);
|
||||
Log.Information("Set up hook");
|
||||
this.wndProcHook.Enable();
|
||||
Log.Information("Enabled hook");
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
this.wndProcHook?.Dispose();
|
||||
}
|
||||
|
||||
private IntPtr WndProcDetour(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
|
||||
{
|
||||
if (msg == 0x219 && wParam.ToInt64() == 7 && (MemoryHelper.Read<IntPtr>(this.object1Address) == IntPtr.Zero || MemoryHelper.Read<IntPtr>(this.object2Address) == IntPtr.Zero))
|
||||
{
|
||||
Log.Information("Filtered WM_DEVICE_CHANGE message");
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
return this.wndProcHook!.Original(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
|
@ -265,7 +265,7 @@ namespace Dalamud.Interface.Internal
|
|||
public void OpenStyleEditor() => this.styleEditorWindow.IsOpen = true;
|
||||
|
||||
/// <summary>
|
||||
/// Opens the <see cref="ProfilerWindow>"/>.
|
||||
/// Opens the <see cref="ProfilerWindow"/>.
|
||||
/// </summary>
|
||||
public void OpenProfiler() => this.profilerWindow.IsOpen = true;
|
||||
|
||||
|
|
@ -376,10 +376,10 @@ namespace Dalamud.Interface.Internal
|
|||
{
|
||||
this.signaledBoot = true;
|
||||
|
||||
Task.Run(async () =>
|
||||
System.Threading.Tasks.Task.Run(async () =>
|
||||
{
|
||||
using var client = new HttpClient();
|
||||
await client.PostAsync("http://localhost:1415/aging/success", new StringContent(string.Empty));
|
||||
using var client = new System.Net.Http.HttpClient();
|
||||
await client.PostAsync("http://localhost:1415/aging/success", new System.Net.Http.StringContent(string.Empty));
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue