diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index a902fc2d0..102c09ec5 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -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.Set(new SigScanner(true)); Service.Set(); - // Initialize game fixes - var gameFixes = Service.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.GetNullable()?.ExplicitDispose(); Service.GetNullable()?.ExplicitDispose(); - Service.GetNullable()?.ExplicitDispose(); - this.unloadSignal?.Dispose(); Service.GetNullable()?.Dispose(); diff --git a/Dalamud/Fixes/GameFixes.cs b/Dalamud/Fixes/GameFixes.cs deleted file mode 100644 index 01fc15f74..000000000 --- a/Dalamud/Fixes/GameFixes.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Linq; - -using Serilog; - -namespace Dalamud.Fixes; - -/// -/// Class responsible for executing game fixes. -/// -internal class GameFixes : IDisposable -{ - private readonly IGameFix[] fixes = - { - new WndProcNullRefFix(), - }; - - /// - /// Apply all game fixes. - /// - 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); - } - } - } - - /// - public void Dispose() - { - foreach (var disposable in this.fixes.OfType()) - { - disposable.Dispose(); - } - } -} diff --git a/Dalamud/Fixes/IGameFix.cs b/Dalamud/Fixes/IGameFix.cs deleted file mode 100644 index 818c09bf4..000000000 --- a/Dalamud/Fixes/IGameFix.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace Dalamud.Fixes; - -/// -/// Base interface to be implemented by game fixes. -/// -internal interface IGameFix -{ - /// - /// Apply the patch to the game. - /// - public void Apply(); -} diff --git a/Dalamud/Fixes/WndProcNullRefFix.cs b/Dalamud/Fixes/WndProcNullRefFix.cs deleted file mode 100644 index d97263560..000000000 --- a/Dalamud/Fixes/WndProcNullRefFix.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; - -using Dalamud.Game; -using Dalamud.Hooking; -using Dalamud.Memory; -using Serilog; - -namespace Dalamud.Fixes; - -/// -/// 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. -/// -internal class WndProcNullRefFix : IGameFix, IDisposable -{ - private Hook? wndProcHook; - - private IntPtr object1Address; - private IntPtr object2Address; - - private delegate IntPtr WndProcDelegate(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam); - - /// - public void Apply() - { - var sigScanner = Service.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(patchAddress, this.WndProcDetour, true); - Log.Information("Set up hook"); - this.wndProcHook.Enable(); - Log.Information("Enabled hook"); - } - - /// - 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(this.object1Address) == IntPtr.Zero || MemoryHelper.Read(this.object2Address) == IntPtr.Zero)) - { - Log.Information("Filtered WM_DEVICE_CHANGE message"); - return IntPtr.Zero; - } - - return this.wndProcHook!.Original(hWnd, msg, wParam, lParam); - } -} diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs index 34bb6e5c3..a25279e26 100644 --- a/Dalamud/Interface/Internal/DalamudInterface.cs +++ b/Dalamud/Interface/Internal/DalamudInterface.cs @@ -265,7 +265,7 @@ namespace Dalamud.Interface.Internal public void OpenStyleEditor() => this.styleEditorWindow.IsOpen = true; /// - /// Opens the . + /// Opens the . /// 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