From d393bd4e2adc90e5f6fd6ee1250f6c8aa7773cd7 Mon Sep 17 00:00:00 2001 From: goat Date: Sun, 28 May 2023 13:16:32 +0200 Subject: [PATCH 1/6] IM logs on information --- .../Interface/Internal/InterfaceManager.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Dalamud/Interface/Internal/InterfaceManager.cs b/Dalamud/Interface/Internal/InterfaceManager.cs index 5796056a3..cde3f1c42 100644 --- a/Dalamud/Interface/Internal/InterfaceManager.cs +++ b/Dalamud/Interface/Internal/InterfaceManager.cs @@ -80,31 +80,31 @@ internal class InterfaceManager : IDisposable, IServiceType [ServiceManager.ServiceConstructor] private InterfaceManager(SigScanner sigScanner) { - Log.Verbose("ctor called"); + Log.Information("ctor called"); this.dispatchMessageWHook = Hook.FromImport( null, "user32.dll", "DispatchMessageW", 0, this.DispatchMessageWDetour); this.setCursorHook = Hook.FromImport( null, "user32.dll", "SetCursor", 0, this.SetCursorDetour); - Log.Verbose("Import hooks applied"); + Log.Information("Import hooks applied"); this.fontBuildSignal = new ManualResetEvent(false); this.address = new SwapChainVtableResolver(); this.address.Setup(); - Log.Verbose("Resolver setup complete"); + Log.Information("Resolver setup complete"); - Log.Verbose("===== S W A P C H A I N ====="); - Log.Verbose($"Is ReShade: {this.address.IsReshade}"); - Log.Verbose($"Present address 0x{this.address.Present.ToInt64():X}"); - Log.Verbose($"ResizeBuffers address 0x{this.address.ResizeBuffers.ToInt64():X}"); + Log.Information("===== S W A P C H A I N ====="); + Log.Information($"Is ReShade: {this.address.IsReshade}"); + Log.Information($"Present address 0x{this.address.Present.ToInt64():X}"); + Log.Information($"ResizeBuffers address 0x{this.address.ResizeBuffers.ToInt64():X}"); this.presentHook = Hook.FromAddress(this.address.Present, this.PresentDetour); this.resizeBuffersHook = Hook.FromAddress(this.address.ResizeBuffers, this.ResizeBuffersDetour); - Log.Verbose("Present and ResizeBuffers hooked"); + Log.Information("Present and ResizeBuffers hooked"); var wndProcAddress = sigScanner.ScanText("E8 ?? ?? ?? ?? 80 7C 24 ?? ?? 74 ?? B8"); - Log.Verbose($"WndProc address 0x{wndProcAddress.ToInt64():X}"); + Log.Information($"WndProc address 0x{wndProcAddress.ToInt64():X}"); this.processMessageHook = Hook.FromAddress(wndProcAddress, this.ProcessMessageDetour); this.setCursorHook.Enable(); @@ -112,7 +112,7 @@ internal class InterfaceManager : IDisposable, IServiceType this.resizeBuffersHook.Enable(); this.dispatchMessageWHook.Enable(); this.processMessageHook.Enable(); - Log.Verbose("Hooks enabled"); + Log.Information("Hooks enabled"); } [UnmanagedFunctionPointer(CallingConvention.ThisCall)] From 0014bfa6fcfa12ab025fd06eebfc070d8f32ecb5 Mon Sep 17 00:00:00 2001 From: Ava Chaney Date: Sun, 28 May 2023 22:30:12 -0700 Subject: [PATCH 2/6] revert IM changes for now due to instability (#1226) Revert "hook Present and ResizeBuffers immediately when InterfaceManager is created" This reverts commit e1a56d6d64391c7bf6b297580f21fd52b9360c6a. Revert "add a bunch of logging to IM setup" This reverts commit 6870c8e7d20cbf915a9c9757f1d3e31828b15de1. Revert "more IM logging tweaks" This reverts commit 4139dc14e772273d508ebca0979b365895010f7e. Revert "IM logs on information" This reverts commit d393bd4e2adc90e5f6fd6ee1250f6c8aa7773cd7. --- .../Interface/Internal/InterfaceManager.cs | 53 ++++++++----------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/Dalamud/Interface/Internal/InterfaceManager.cs b/Dalamud/Interface/Internal/InterfaceManager.cs index cde3f1c42..f02baa890 100644 --- a/Dalamud/Interface/Internal/InterfaceManager.cs +++ b/Dalamud/Interface/Internal/InterfaceManager.cs @@ -20,12 +20,12 @@ using Dalamud.Interface.Internal.ManagedAsserts; using Dalamud.Interface.Internal.Notifications; using Dalamud.Interface.Style; using Dalamud.Interface.Windowing; -using Dalamud.Logging.Internal; using Dalamud.Utility; using Dalamud.Utility.Timing; using ImGuiNET; using ImGuiScene; using PInvoke; +using Serilog; // general dev notes, here because it's easiest @@ -47,8 +47,6 @@ namespace Dalamud.Interface.Internal; [ServiceManager.BlockingEarlyLoadedService] internal class InterfaceManager : IDisposable, IServiceType { - private static ModuleLog Log = new ModuleLog("IM"); - private const float DefaultFontSizePt = 12.0f; private const float DefaultFontSizePx = DefaultFontSizePt * 4.0f / 3.0f; private const ushort Fallback1Codepoint = 0x3013; // Geta mark; FFXIV uses this to indicate that a glyph is missing. @@ -78,41 +76,16 @@ internal class InterfaceManager : IDisposable, IServiceType private bool isOverrideGameCursor = true; [ServiceManager.ServiceConstructor] - private InterfaceManager(SigScanner sigScanner) + private InterfaceManager() { - Log.Information("ctor called"); - this.dispatchMessageWHook = Hook.FromImport( null, "user32.dll", "DispatchMessageW", 0, this.DispatchMessageWDetour); this.setCursorHook = Hook.FromImport( null, "user32.dll", "SetCursor", 0, this.SetCursorDetour); - Log.Information("Import hooks applied"); this.fontBuildSignal = new ManualResetEvent(false); this.address = new SwapChainVtableResolver(); - this.address.Setup(); - Log.Information("Resolver setup complete"); - - Log.Information("===== S W A P C H A I N ====="); - Log.Information($"Is ReShade: {this.address.IsReshade}"); - Log.Information($"Present address 0x{this.address.Present.ToInt64():X}"); - Log.Information($"ResizeBuffers address 0x{this.address.ResizeBuffers.ToInt64():X}"); - - this.presentHook = Hook.FromAddress(this.address.Present, this.PresentDetour); - this.resizeBuffersHook = Hook.FromAddress(this.address.ResizeBuffers, this.ResizeBuffersDetour); - Log.Information("Present and ResizeBuffers hooked"); - - var wndProcAddress = sigScanner.ScanText("E8 ?? ?? ?? ?? 80 7C 24 ?? ?? 74 ?? B8"); - Log.Information($"WndProc address 0x{wndProcAddress.ToInt64():X}"); - this.processMessageHook = Hook.FromAddress(wndProcAddress, this.ProcessMessageDetour); - - this.setCursorHook.Enable(); - this.presentHook.Enable(); - this.resizeBuffersHook.Enable(); - this.dispatchMessageWHook.Enable(); - this.processMessageHook.Enable(); - Log.Information("Hooks enabled"); } [UnmanagedFunctionPointer(CallingConvention.ThisCall)] @@ -1009,9 +982,10 @@ internal class InterfaceManager : IDisposable, IServiceType } [ServiceManager.CallWhenServicesReady] - private void ContinueConstruction() + private void ContinueConstruction(SigScanner sigScanner, Framework framework) { - this.framework.RunOnFrameworkThread(() => + this.address.Setup(sigScanner); + framework.RunOnFrameworkThread(() => { while ((this.GameWindowHandle = NativeFunctions.FindWindowEx(IntPtr.Zero, this.GameWindowHandle, "FFXIVGAME", IntPtr.Zero)) != IntPtr.Zero) { @@ -1030,6 +1004,23 @@ internal class InterfaceManager : IDisposable, IServiceType { Log.Error(ex, "Could not enable immersive mode"); } + + this.presentHook = Hook.FromAddress(this.address.Present, this.PresentDetour, true); + this.resizeBuffersHook = Hook.FromAddress(this.address.ResizeBuffers, this.ResizeBuffersDetour, true); + + Log.Verbose("===== S W A P C H A I N ====="); + Log.Verbose($"Present address 0x{this.presentHook!.Address.ToInt64():X}"); + Log.Verbose($"ResizeBuffers address 0x{this.resizeBuffersHook!.Address.ToInt64():X}"); + + var wndProcAddress = sigScanner.ScanText("E8 ?? ?? ?? ?? 80 7C 24 ?? ?? 74 ?? B8"); + Log.Verbose($"WndProc address 0x{wndProcAddress.ToInt64():X}"); + this.processMessageHook = Hook.FromAddress(wndProcAddress, this.ProcessMessageDetour); + + this.setCursorHook.Enable(); + this.presentHook.Enable(); + this.resizeBuffersHook.Enable(); + this.dispatchMessageWHook.Enable(); + this.processMessageHook.Enable(); }); } From 956e310041fe7f0456ec158373261f873865daaf Mon Sep 17 00:00:00 2001 From: KazWolfe Date: Sun, 28 May 2023 22:46:49 -0700 Subject: [PATCH 3/6] Clean up Happy Eyeballs Verbose Spam (#1224) * Clean up HappyEyeballs verbose spam - Cancellations should be properly suppressed now * Bump ClientStructs --- Dalamud/Networking/Http/HappyEyeballsCallback.cs | 10 +++------- Dalamud/Utility/AsyncUtils.cs | 2 +- lib/FFXIVClientStructs | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Dalamud/Networking/Http/HappyEyeballsCallback.cs b/Dalamud/Networking/Http/HappyEyeballsCallback.cs index af854fb2c..7ca77576c 100644 --- a/Dalamud/Networking/Http/HappyEyeballsCallback.cs +++ b/Dalamud/Networking/Http/HappyEyeballsCallback.cs @@ -91,11 +91,7 @@ public class HappyEyeballsCallback : IDisposable private async Task AttemptConnection(IPAddress address, int port, CancellationToken token, CancellationToken delayToken) { await AsyncUtils.CancellableDelay(-1, delayToken).ConfigureAwait(false); - - if (token.IsCancellationRequested) - { - return Task.FromCanceled(token).Result; - } + token.ThrowIfCancellationRequested(); var socket = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp) { @@ -116,9 +112,9 @@ public class HappyEyeballsCallback : IDisposable private async Task> GetSortedAddresses(string hostname, CancellationToken token) { - // This method abuses DNS ordering and LINQ a bit. We can normally assume that "addresses" will be provided in + // This method abuses DNS ordering and LINQ a bit. We can normally assume that addresses will be provided in // the order the system wants to use. GroupBy will return its groups *in the order they're discovered*. Meaning, - // the first group created will always be the "preferred" group, and all other groups are in preference order. + // the first group created will always be the preferred group, and all other groups are in preference order. // This means a straight zipper merge is nice and clean and gives us most -> least preferred, repeating. var dnsRecords = await Dns.GetHostAddressesAsync(hostname, this.forcedAddressFamily, token); diff --git a/Dalamud/Utility/AsyncUtils.cs b/Dalamud/Utility/AsyncUtils.cs index d252bd5d5..c0fbbb8a4 100644 --- a/Dalamud/Utility/AsyncUtils.cs +++ b/Dalamud/Utility/AsyncUtils.cs @@ -51,7 +51,7 @@ public static class AsyncUtils { try { - await Task.Delay(millisecondsDelay, cancellationToken); + await Task.Delay(millisecondsDelay, cancellationToken).ConfigureAwait(false); } catch (TaskCanceledException) { diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index 5e9568845..8e25367e5 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit 5e9568845ac302540ce1135abbff7bef98314714 +Subproject commit 8e25367e5f7d3acbe8e2b2a81121852b1ea1291c From 7573575985f6ce229b7819254e068b1d94c6a682 Mon Sep 17 00:00:00 2001 From: Ava Chaney Date: Sun, 28 May 2023 22:59:43 -0700 Subject: [PATCH 4/6] bump clientstructs (#1227) --- lib/FFXIVClientStructs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index 8e25367e5..7c59a8393 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit 8e25367e5f7d3acbe8e2b2a81121852b1ea1291c +Subproject commit 7c59a83931338d7124d3fd75a2d7734dcc5dc2a1 From dcdfd3c403d4f06920af77445ad9f474d882bace Mon Sep 17 00:00:00 2001 From: Ava Chaney Date: Sun, 28 May 2023 23:41:33 -0700 Subject: [PATCH 5/6] chore: ci + readme fixes, make editorconfig consistent with usage in yml files (#1228) --- .editorconfig | 5 +++++ .github/workflows/tag-build.yml | 7 ++++++- README.md | 23 +++++++++++------------ 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.editorconfig b/.editorconfig index a0cd5584f..1b1377fca 100644 --- a/.editorconfig +++ b/.editorconfig @@ -140,3 +140,8 @@ indent_style = space indent_size = 4 tab_width = 4 dotnet_style_parentheses_in_other_operators=always_for_clarity:silent + +[*.{yaml,yml}] +indent_style = space +indent_size = 2 +tab_width = 2 diff --git a/.github/workflows/tag-build.yml b/.github/workflows/tag-build.yml index f367c2fc9..042630191 100644 --- a/.github/workflows/tag-build.yml +++ b/.github/workflows/tag-build.yml @@ -1,5 +1,10 @@ name: Tag Build -on: [push] +on: + push: + branches: + - master + tags-ignore: + - '*' # don't needlessly execute on tags jobs: tag: diff --git a/README.md b/README.md index f98961c3e..97dd4e9dd 100644 --- a/README.md +++ b/README.md @@ -26,23 +26,22 @@ Thanks to Mino, whose work has made this possible! These components are used in order to load Dalamud into a target process. Dalamud can be loaded via DLL injection, or by rewriting a process' entrypoint. -| Name | Purpose | -|---|---| -| *Dalamud.Injector.Boot* (C++) | Loads the .NET Core runtime into a process via hostfxr and kicks off Dalamud.Injector | -| *Dalamud.Injector* (C#) | Performs DLL injection on the target process | -| *Dalamud.Boot* (C++) | Loads the .NET Core runtime into the active process and kicks off Dalamud, or rewrites a target process' entrypoint to do so | -| *Dalamud* (C#) | Core API, game bindings, plugin framework | -| *Dalamud.CorePlugin* (C#) | Testbed plugin that can access Dalamud internals, to prototype new Dalamud features | +| Name | Purpose | +|-------------------------------|------------------------------------------------------------------------------------------------------------------------------| +| *Dalamud.Injector.Boot* (C++) | Loads the .NET Core runtime into a process via hostfxr and kicks off Dalamud.Injector | +| *Dalamud.Injector* (C#) | Performs DLL injection on the target process | +| *Dalamud.Boot* (C++) | Loads the .NET Core runtime into the active process and kicks off Dalamud, or rewrites a target process' entrypoint to do so | +| *Dalamud* (C#) | Core API, game bindings, plugin framework | +| *Dalamud.CorePlugin* (C#) | Testbed plugin that can access Dalamud internals, to prototype new Dalamud features | ## Branches We are currently working from the following branches. -| Name | Purpose | .NET Version | Track | -|---|---|---|---| -| *master* | Current release branch | .NET 6.0.3 (March 2022) | Release & Staging | -| *net7* | Upgrade to .NET 7 | .NET 7.0.0 (November 2022) | net7 | -| *api3* | Legacy version, no longer in active use | .NET Framework 4.7.2 (April 2017) | - | +| Name | API Level | Purpose | .NET Version | Track | +|----------|-----------|------------------------------------------------------------|----------------------------|-------------------| +| *master* | **8** | Current release branch | .NET 7.0.0 (November 2022) | Release & Staging | +| *v9* | **9** | Next major version, slated for release alongside Patch 6.5 | .NET 7.0.0 (November 2022) | v9 |
From ab39b58a38dff2460427ed84210f952f5b247737 Mon Sep 17 00:00:00 2001 From: Ava Chaney Date: Mon, 29 May 2023 10:38:18 -0700 Subject: [PATCH 6/6] build: 7.6.1.0 (#1229) --- Dalamud/Dalamud.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index 116ebd008..7263072d0 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -8,7 +8,7 @@ - 7.6.0.0 + 7.6.1.0 XIV Launcher addon framework $(DalamudVersion) $(DalamudVersion)