wip bindings upgrade

This commit is contained in:
goaaats 2025-04-06 20:59:23 +02:00
parent bd7e56850a
commit 0690cce995
272 changed files with 139041 additions and 1541 deletions

5
.gitignore vendored
View file

@ -327,4 +327,7 @@ ASALocalRun/
*.nvuser *.nvuser
# MFractors (Xamarin productivity tool) working folder # MFractors (Xamarin productivity tool) working folder
.mfractor/ .mfractor/
# HexaGen generated files
imgui/**/Generated/**/*

View file

@ -38,9 +38,6 @@
<ProjectReference Include="..\Dalamud\Dalamud.csproj"> <ProjectReference Include="..\Dalamud\Dalamud.csproj">
<Private>false</Private> <Private>false</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\lib\ImGui.NET\src\ImGui.NET-472\ImGui.NET-472.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -2,7 +2,7 @@ using System;
using System.Numerics; using System.Numerics;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.CorePlugin namespace Dalamud.CorePlugin
{ {

View file

@ -440,7 +440,7 @@ namespace Dalamud.Injector
#region Methods #region Methods
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Auto)] [DllImport("advapi32.dll", CharSet = CharSet.Auto)]
public static extern void BuildExplicitAccessWithName( public static extern void BuildExplicitAccessWithName(
ref EXPLICIT_ACCESS pExplicitAccess, ref EXPLICIT_ACCESS pExplicitAccess,
string pTrusteeName, string pTrusteeName,
@ -448,26 +448,26 @@ namespace Dalamud.Injector
uint accessMode, uint accessMode,
uint inheritance); uint inheritance);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Auto)] [DllImport("advapi32.dll", CharSet = CharSet.Auto)]
public static extern int SetEntriesInAcl( public static extern int SetEntriesInAcl(
int cCountOfExplicitEntries, int cCountOfExplicitEntries,
ref EXPLICIT_ACCESS pListOfExplicitEntries, ref EXPLICIT_ACCESS pListOfExplicitEntries,
IntPtr oldAcl, IntPtr oldAcl,
out IntPtr newAcl); out IntPtr newAcl);
[DllImport("advapi32.dll", SetLastError = true)] [DllImport("advapi32.dll")]
public static extern bool InitializeSecurityDescriptor( public static extern bool InitializeSecurityDescriptor(
out SECURITY_DESCRIPTOR pSecurityDescriptor, out SECURITY_DESCRIPTOR pSecurityDescriptor,
uint dwRevision); uint dwRevision);
[DllImport("advapi32.dll", SetLastError = true)] [DllImport("advapi32.dll")]
public static extern bool SetSecurityDescriptorDacl( public static extern bool SetSecurityDescriptorDacl(
ref SECURITY_DESCRIPTOR pSecurityDescriptor, ref SECURITY_DESCRIPTOR pSecurityDescriptor,
bool bDaclPresent, bool bDaclPresent,
IntPtr pDacl, IntPtr pDacl,
bool bDaclDefaulted); bool bDaclDefaulted);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern bool CreateProcess( public static extern bool CreateProcess(
string lpApplicationName, string lpApplicationName,
string lpCommandLine, string lpCommandLine,
@ -480,39 +480,39 @@ namespace Dalamud.Injector
[In] ref STARTUPINFO lpStartupInfo, [In] ref STARTUPINFO lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation); out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll", SetLastError = true)] [DllImport("kernel32.dll")]
public static extern bool CloseHandle(IntPtr hObject); public static extern bool CloseHandle(IntPtr hObject);
[DllImport("kernel32.dll", SetLastError = true)] [DllImport("kernel32.dll")]
public static extern uint ResumeThread(IntPtr hThread); public static extern uint ResumeThread(IntPtr hThread);
[DllImport("advapi32.dll", SetLastError = true)] [DllImport("advapi32.dll")]
public static extern bool ImpersonateSelf( public static extern bool ImpersonateSelf(
SECURITY_IMPERSONATION_LEVEL impersonationLevel); SECURITY_IMPERSONATION_LEVEL impersonationLevel);
[DllImport("advapi32.dll", SetLastError = true)] [DllImport("advapi32.dll")]
public static extern bool OpenProcessToken( public static extern bool OpenProcessToken(
IntPtr processHandle, IntPtr processHandle,
UInt32 desiredAccess, UInt32 desiredAccess,
out IntPtr tokenHandle); out IntPtr tokenHandle);
[DllImport("advapi32.dll", SetLastError = true)] [DllImport("advapi32.dll")]
public static extern bool OpenThreadToken( public static extern bool OpenThreadToken(
IntPtr threadHandle, IntPtr threadHandle,
uint desiredAccess, uint desiredAccess,
bool openAsSelf, bool openAsSelf,
out IntPtr tokenHandle); out IntPtr tokenHandle);
[DllImport("advapi32.dll", SetLastError = true)] [DllImport("advapi32.dll")]
public static extern bool LookupPrivilegeValue(string lpSystemName, string lpName, ref LUID lpLuid); public static extern bool LookupPrivilegeValue(string lpSystemName, string lpName, ref LUID lpLuid);
[DllImport("advapi32.dll", SetLastError = true)] [DllImport("advapi32.dll")]
public static extern bool PrivilegeCheck( public static extern bool PrivilegeCheck(
IntPtr clientToken, IntPtr clientToken,
ref PRIVILEGE_SET requiredPrivileges, ref PRIVILEGE_SET requiredPrivileges,
out bool pfResult); out bool pfResult);
[DllImport("advapi32.dll", SetLastError = true)] [DllImport("advapi32.dll")]
public static extern bool AdjustTokenPrivileges( public static extern bool AdjustTokenPrivileges(
IntPtr tokenHandle, IntPtr tokenHandle,
bool disableAllPrivileges, bool disableAllPrivileges,
@ -521,7 +521,7 @@ namespace Dalamud.Injector
IntPtr previousState, IntPtr previousState,
IntPtr cbOutPreviousState); IntPtr cbOutPreviousState);
[DllImport("advapi32.dll", SetLastError = true)] [DllImport("advapi32.dll")]
public static extern uint GetSecurityInfo( public static extern uint GetSecurityInfo(
IntPtr handle, IntPtr handle,
SE_OBJECT_TYPE objectType, SE_OBJECT_TYPE objectType,
@ -532,7 +532,7 @@ namespace Dalamud.Injector
IntPtr pSacl, IntPtr pSacl,
IntPtr pSecurityDescriptor); IntPtr pSecurityDescriptor);
[DllImport("advapi32.dll", SetLastError = true)] [DllImport("advapi32.dll")]
public static extern uint SetSecurityInfo( public static extern uint SetSecurityInfo(
IntPtr handle, IntPtr handle,
SE_OBJECT_TYPE objectType, SE_OBJECT_TYPE objectType,
@ -542,16 +542,16 @@ namespace Dalamud.Injector
IntPtr pDacl, IntPtr pDacl,
IntPtr pSacl); IntPtr pSacl);
[DllImport("kernel32.dll", SetLastError = true)] [DllImport("kernel32.dll")]
public static extern IntPtr GetCurrentProcess(); public static extern IntPtr GetCurrentProcess();
[DllImport("kernel32.dll", SetLastError = true)] [DllImport("kernel32.dll")]
public static extern IntPtr GetCurrentThread(); public static extern IntPtr GetCurrentThread();
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll")]
public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr hWndChildAfter, string className, IntPtr windowTitle); public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr hWndChildAfter, string className, IntPtr windowTitle);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll")]
public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
[DllImport("user32.dll")] [DllImport("user32.dll")]

View file

@ -62,7 +62,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cimplot", "external\cimplot
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cimguizmo", "external\cimguizmo\cimguizmo.vcxproj", "{F258347D-31BE-4605-98CE-40E43BDF6F9D}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cimguizmo", "external\cimguizmo\cimguizmo.vcxproj", "{F258347D-31BE-4605-98CE-40E43BDF6F9D}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImGui.NET-472", "lib\ImGui.NET\src\ImGui.NET-472\ImGui.NET-472.csproj", "{A0A3C0AC-18D9-4C74-8CFC-14E53512846D}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dalamud.ImGui", "imgui\Dalamud.ImGui\Dalamud.ImGui.csproj", "{B0AA8737-33A3-4766-8CBE-A48F2EF283BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dalamud.ImGuizmo", "imgui\Dalamud.ImGuizmo\Dalamud.ImGuizmo.csproj", "{5E6EDD75-AE95-43A6-9D67-95B840EB4B71}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dalamud.ImPlot", "imgui\Dalamud.ImPlot\Dalamud.ImPlot.csproj", "{9C70BD06-D52C-425E-9C14-5D66BC6046EF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Bindings", "Bindings", "{A217B3DF-607A-4EFB-B107-3C4809348043}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -138,10 +144,18 @@ Global
{F258347D-31BE-4605-98CE-40E43BDF6F9D}.Debug|Any CPU.Build.0 = Debug|x64 {F258347D-31BE-4605-98CE-40E43BDF6F9D}.Debug|Any CPU.Build.0 = Debug|x64
{F258347D-31BE-4605-98CE-40E43BDF6F9D}.Release|Any CPU.ActiveCfg = Release|x64 {F258347D-31BE-4605-98CE-40E43BDF6F9D}.Release|Any CPU.ActiveCfg = Release|x64
{F258347D-31BE-4605-98CE-40E43BDF6F9D}.Release|Any CPU.Build.0 = Release|x64 {F258347D-31BE-4605-98CE-40E43BDF6F9D}.Release|Any CPU.Build.0 = Release|x64
{A0A3C0AC-18D9-4C74-8CFC-14E53512846D}.Debug|Any CPU.ActiveCfg = Debug|x64 {B0AA8737-33A3-4766-8CBE-A48F2EF283BA}.Debug|Any CPU.ActiveCfg = Debug|x64
{A0A3C0AC-18D9-4C74-8CFC-14E53512846D}.Debug|Any CPU.Build.0 = Debug|x64 {B0AA8737-33A3-4766-8CBE-A48F2EF283BA}.Debug|Any CPU.Build.0 = Debug|x64
{A0A3C0AC-18D9-4C74-8CFC-14E53512846D}.Release|Any CPU.ActiveCfg = Release|x64 {B0AA8737-33A3-4766-8CBE-A48F2EF283BA}.Release|Any CPU.ActiveCfg = Release|x64
{A0A3C0AC-18D9-4C74-8CFC-14E53512846D}.Release|Any CPU.Build.0 = Release|x64 {B0AA8737-33A3-4766-8CBE-A48F2EF283BA}.Release|Any CPU.Build.0 = Release|x64
{5E6EDD75-AE95-43A6-9D67-95B840EB4B71}.Debug|Any CPU.ActiveCfg = Debug|x64
{5E6EDD75-AE95-43A6-9D67-95B840EB4B71}.Debug|Any CPU.Build.0 = Debug|x64
{5E6EDD75-AE95-43A6-9D67-95B840EB4B71}.Release|Any CPU.ActiveCfg = Release|x64
{5E6EDD75-AE95-43A6-9D67-95B840EB4B71}.Release|Any CPU.Build.0 = Release|x64
{9C70BD06-D52C-425E-9C14-5D66BC6046EF}.Debug|Any CPU.ActiveCfg = Debug|x64
{9C70BD06-D52C-425E-9C14-5D66BC6046EF}.Debug|Any CPU.Build.0 = Debug|x64
{9C70BD06-D52C-425E-9C14-5D66BC6046EF}.Release|Any CPU.ActiveCfg = Release|x64
{9C70BD06-D52C-425E-9C14-5D66BC6046EF}.Release|Any CPU.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -160,7 +174,9 @@ Global
{8BBACF2D-7AB8-4610-A115-0E363D35C291} = {E15BDA6D-E881-4482-94BA-BE5527E917FF} {8BBACF2D-7AB8-4610-A115-0E363D35C291} = {E15BDA6D-E881-4482-94BA-BE5527E917FF}
{76CAA246-C405-4A8C-B0AE-F4A0EF3D4E16} = {DBE5345E-6594-4A59-B183-1C3D5592269D} {76CAA246-C405-4A8C-B0AE-F4A0EF3D4E16} = {DBE5345E-6594-4A59-B183-1C3D5592269D}
{F258347D-31BE-4605-98CE-40E43BDF6F9D} = {DBE5345E-6594-4A59-B183-1C3D5592269D} {F258347D-31BE-4605-98CE-40E43BDF6F9D} = {DBE5345E-6594-4A59-B183-1C3D5592269D}
{A0A3C0AC-18D9-4C74-8CFC-14E53512846D} = {DBE5345E-6594-4A59-B183-1C3D5592269D} {B0AA8737-33A3-4766-8CBE-A48F2EF283BA} = {A217B3DF-607A-4EFB-B107-3C4809348043}
{5E6EDD75-AE95-43A6-9D67-95B840EB4B71} = {A217B3DF-607A-4EFB-B107-3C4809348043}
{9C70BD06-D52C-425E-9C14-5D66BC6046EF} = {A217B3DF-607A-4EFB-B107-3C4809348043}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {79B65AC9-C940-410E-AB61-7EA7E12C7599} SolutionGuid = {79B65AC9-C940-410E-AB61-7EA7E12C7599}

3
Dalamud/AssemblyInfo.cs Normal file
View file

@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;
//[assembly: DisableRuntimeMarshalling]

View file

@ -66,7 +66,7 @@
<PackageReference Include="Lumina" Version="$(LuminaVersion)" /> <PackageReference Include="Lumina" Version="$(LuminaVersion)" />
<PackageReference Include="Lumina.Excel" Version="$(LuminaExcelVersion)" /> <PackageReference Include="Lumina.Excel" Version="$(LuminaExcelVersion)" />
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="9.0.0-preview.1.24081.5" /> <PackageReference Include="Microsoft.Extensions.ObjectPool" Version="9.0.0-preview.1.24081.5" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.46-beta"> <PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.183">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="MinSharp" Version="1.0.4" /> <PackageReference Include="MinSharp" Version="1.0.4" />
@ -103,8 +103,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Dalamud.Common\Dalamud.Common.csproj" /> <ProjectReference Include="..\Dalamud.Common\Dalamud.Common.csproj" />
<ProjectReference Include="..\imgui\Dalamud.ImGuizmo\Dalamud.ImGuizmo.csproj" />
<ProjectReference Include="..\imgui\Dalamud.ImGui\Dalamud.ImGui.csproj" />
<ProjectReference Include="..\imgui\Dalamud.ImPlot\Dalamud.ImPlot.csproj" />
<ProjectReference Include="..\lib\FFXIVClientStructs\FFXIVClientStructs\FFXIVClientStructs.csproj" /> <ProjectReference Include="..\lib\FFXIVClientStructs\FFXIVClientStructs\FFXIVClientStructs.csproj" />
<ProjectReference Include="..\lib\ImGui.NET\src\ImGui.NET-472\ImGui.NET-472.csproj" />
<ProjectReference Include="..\lib\FFXIVClientStructs\InteropGenerator.Runtime\InteropGenerator.Runtime.csproj" /> <ProjectReference Include="..\lib\FFXIVClientStructs\InteropGenerator.Runtime\InteropGenerator.Runtime.csproj" />
</ItemGroup> </ItemGroup>

View file

@ -1,10 +1,14 @@
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Windows.Win32.Foundation;
using Windows.Win32.UI.WindowsAndMessaging;
using Dalamud.Common; using Dalamud.Common;
using Dalamud.Configuration.Internal; using Dalamud.Configuration.Internal;
using Dalamud.Interface.Internal.Windows; using Dalamud.Interface.Internal.Windows;
@ -58,7 +62,7 @@ public sealed class EntryPoint
var info = JsonConvert.DeserializeObject<DalamudStartInfo>(infoStr)!; var info = JsonConvert.DeserializeObject<DalamudStartInfo>(infoStr)!;
if ((info.BootWaitMessageBox & 4) != 0) if ((info.BootWaitMessageBox & 4) != 0)
MessageBoxW(IntPtr.Zero, "Press OK to continue (BeforeDalamudConstruct)", "Dalamud Boot", MessageBoxType.Ok); Windows.Win32.PInvoke.MessageBox(HWND.Null, "Press OK to continue (BeforeDalamudConstruct)", "Dalamud Boot", MESSAGEBOX_STYLE.MB_OK);
new Thread(() => RunThread(info, mainThreadContinueEvent)).Start(); new Thread(() => RunThread(info, mainThreadContinueEvent)).Start();
} }
@ -135,6 +139,8 @@ public sealed class EntryPoint
/// <param name="mainThreadContinueEvent">Event used to signal the main thread to continue.</param> /// <param name="mainThreadContinueEvent">Event used to signal the main thread to continue.</param>
private static void RunThread(DalamudStartInfo info, IntPtr mainThreadContinueEvent) private static void RunThread(DalamudStartInfo info, IntPtr mainThreadContinueEvent)
{ {
NativeLibrary.Load(Path.Combine(info.WorkingDirectory!, "cimgui.dll"));
// Setup logger // Setup logger
InitLogging(info.LogPath!, info.BootShowConsole, true, info.LogName); InitLogging(info.LogPath!, info.BootShowConsole, true, info.LogName);
SerilogEventSink.Instance.LogLine += SerilogOnLogLine; SerilogEventSink.Instance.LogLine += SerilogOnLogLine;
@ -304,14 +310,14 @@ public sealed class EntryPoint
// ignored // ignored
} }
const MessageBoxType flags = NativeFunctions.MessageBoxType.YesNo | NativeFunctions.MessageBoxType.IconError | NativeFunctions.MessageBoxType.SystemModal; const MESSAGEBOX_STYLE flags = MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONERROR | MESSAGEBOX_STYLE.MB_SYSTEMMODAL;
var result = MessageBoxW( var result = Windows.Win32.PInvoke.MessageBox(
Process.GetCurrentProcess().MainWindowHandle, new HWND(Process.GetCurrentProcess().MainWindowHandle),
$"An internal error in a Dalamud plugin occurred.\nThe game must close.\n\n{ex.GetType().Name}\n{info}\n\n{pluginInfo}More information has been recorded separately{supportText}.\n\nDo you want to disable all plugins the next time you start the game?", $"An internal error in a Dalamud plugin occurred.\nThe game must close.\n\n{ex.GetType().Name}\n{info}\n\n{pluginInfo}More information has been recorded separately{supportText}.\n\nDo you want to disable all plugins the next time you start the game?",
"Dalamud", "Dalamud",
flags); flags);
if (result == (int)User32.MessageBoxResult.IDYES) if (result == MESSAGEBOX_RESULT.IDYES)
{ {
Log.Information("User chose to disable plugins on next launch..."); Log.Information("User chose to disable plugins on next launch...");
var config = Service<DalamudConfiguration>.Get(); var config = Service<DalamudConfiguration>.Get();

View file

@ -7,7 +7,7 @@ using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.System.Input; using FFXIVClientStructs.FFXIV.Client.System.Input;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Serilog; using Serilog;
namespace Dalamud.Game.ClientState.GamePad; namespace Dalamud.Game.ClientState.GamePad;

View file

@ -18,7 +18,7 @@ using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using FFXIVClientStructs.FFXIV.Common.Component.BGCollision; using FFXIVClientStructs.FFXIV.Common.Component.BGCollision;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Vector2 = System.Numerics.Vector2; using Vector2 = System.Numerics.Vector2;
using Vector3 = System.Numerics.Vector3; using Vector3 = System.Numerics.Vector3;
@ -75,7 +75,7 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui
} }
// Hooked delegates // Hooked delegates
[UnmanagedFunctionPointer(CallingConvention.ThisCall)] [UnmanagedFunctionPointer(CallingConvention.ThisCall)]
private delegate char HandleImmDelegate(IntPtr framework, char a2, byte a3); private delegate char HandleImmDelegate(IntPtr framework, char a2, byte a3);

View file

@ -1,18 +1,23 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Windows.Win32.System.Memory;
using Dalamud.Memory; using Dalamud.Memory;
using JetBrains.Annotations; using JetBrains.Annotations;
using PInvoke;
using Win32Exception = System.ComponentModel.Win32Exception;
namespace Dalamud.Hooking.Internal; namespace Dalamud.Hooking.Internal;
/// <summary> /// <summary>
/// Manages a hook with MinHook. /// Manages a hook with MinHook.
/// </summary> /// </summary>
/// <typeparam name="T">Delegate type to represents a function prototype. This must be the same prototype as original function do.</typeparam> /// <typeparam name="T">Delegate type to represents a function prototype. This must be the same prototype as original function do.</typeparam>
internal class FunctionPointerVariableHook<T> : Hook<T> internal unsafe class FunctionPointerVariableHook<T> : Hook<T>
where T : Delegate where T : Delegate
{ {
private readonly nint pfnDetour; private readonly nint pfnDetour;
@ -55,11 +60,11 @@ internal class FunctionPointerVariableHook<T> : Hook<T>
// Note: WINE seemingly tries to clean up all heap allocations on process exit. // Note: WINE seemingly tries to clean up all heap allocations on process exit.
// We want our allocation to be kept there forever, until no running thread remains. // We want our allocation to be kept there forever, until no running thread remains.
// Therefore we're using VirtualAlloc instead of HeapCreate/HeapAlloc. // Therefore we're using VirtualAlloc instead of HeapCreate/HeapAlloc.
var pfnThunkBytes = (byte*)NativeFunctions.VirtualAlloc( var pfnThunkBytes = (byte*)Windows.Win32.PInvoke.VirtualAlloc(
0, null,
12, 12,
NativeFunctions.AllocationType.Reserve | NativeFunctions.AllocationType.Commit, VIRTUAL_ALLOCATION_TYPE.MEM_RESERVE | VIRTUAL_ALLOCATION_TYPE.MEM_COMMIT,
MemoryProtection.ExecuteReadWrite); PAGE_PROTECTION_FLAGS.PAGE_EXECUTE_READWRITE);
if (pfnThunkBytes == null) if (pfnThunkBytes == null)
{ {
throw new OutOfMemoryException("Failed to allocate memory for import hooks."); throw new OutOfMemoryException("Failed to allocate memory for import hooks.");
@ -78,10 +83,10 @@ internal class FunctionPointerVariableHook<T> : Hook<T>
this.ppfnThunkJumpTarget = this.pfnThunk + 2; this.ppfnThunkJumpTarget = this.pfnThunk + 2;
if (!NativeFunctions.VirtualProtect( if (!Windows.Win32.PInvoke.VirtualProtect(
this.Address, this.Address.ToPointer(),
(UIntPtr)Marshal.SizeOf<IntPtr>(), (UIntPtr)Marshal.SizeOf<IntPtr>(),
MemoryProtection.ExecuteReadWrite, PAGE_PROTECTION_FLAGS.PAGE_EXECUTE_READWRITE,
out var oldProtect)) out var oldProtect))
{ {
throw new Win32Exception(Marshal.GetLastWin32Error()); throw new Win32Exception(Marshal.GetLastWin32Error());
@ -93,7 +98,7 @@ internal class FunctionPointerVariableHook<T> : Hook<T>
Marshal.WriteIntPtr(this.Address, this.pfnThunk); Marshal.WriteIntPtr(this.Address, this.pfnThunk);
// This really should not fail, but then even if it does, whatever. // This really should not fail, but then even if it does, whatever.
NativeFunctions.VirtualProtect(this.Address, (UIntPtr)Marshal.SizeOf<IntPtr>(), oldProtect, out _); Windows.Win32.PInvoke.VirtualProtect(this.Address.ToPointer(), (UIntPtr)Marshal.SizeOf<IntPtr>(), oldProtect, out _);
// Add afterwards, so the hookIdent starts at 0. // Add afterwards, so the hookIdent starts at 0.
indexList.Add(this); indexList.Add(this);

View file

@ -3,7 +3,7 @@ using System.Numerics;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components; namespace Dalamud.Interface.Components;

View file

@ -2,7 +2,7 @@ using System.Numerics;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components; namespace Dalamud.Interface.Components;

View file

@ -2,7 +2,7 @@ using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Common.Math; using FFXIVClientStructs.FFXIV.Common.Math;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components; namespace Dalamud.Interface.Components;

View file

@ -3,7 +3,7 @@ using System.Numerics;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components; namespace Dalamud.Interface.Components;

View file

@ -4,7 +4,7 @@ using System.Numerics;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components; namespace Dalamud.Interface.Components;

View file

@ -1,4 +1,4 @@
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components; namespace Dalamud.Interface.Components;

View file

@ -1,6 +1,6 @@
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components; namespace Dalamud.Interface.Components;

View file

@ -1,6 +1,6 @@
using System.Numerics; using System.Numerics;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components; namespace Dalamud.Interface.Components;

View file

@ -5,7 +5,7 @@ using Dalamud.Interface.Internal;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Serilog; using Serilog;
namespace Dalamud.Interface.DragDrop; namespace Dalamud.Interface.DragDrop;
@ -103,7 +103,7 @@ internal partial class DragDropManager : IInternalDisposableService, IDragDropMa
} }
/// <inheritdoc cref="IDragDropManager.CreateImGuiSource(string, Func{IDragDropManager, bool}, Func{IDragDropManager, bool})"/> /// <inheritdoc cref="IDragDropManager.CreateImGuiSource(string, Func{IDragDropManager, bool}, Func{IDragDropManager, bool})"/>
public void CreateImGuiSource(string label, Func<IDragDropManager, bool> validityCheck, Func<IDragDropManager, bool> tooltipBuilder) public unsafe void CreateImGuiSource(string label, Func<IDragDropManager, bool> validityCheck, Func<IDragDropManager, bool> tooltipBuilder)
{ {
if (!this.IsDragging && !this.IsDropping()) if (!this.IsDragging && !this.IsDropping())
{ {
@ -115,7 +115,7 @@ internal partial class DragDropManager : IInternalDisposableService, IDragDropMa
return; return;
} }
ImGui.SetDragDropPayload(label, nint.Zero, 0); ImGui.SetDragDropPayload(label, null, 0);
if (this.CheckTooltipFrame(out var frame) && tooltipBuilder(this)) if (this.CheckTooltipFrame(out var frame) && tooltipBuilder(this))
{ {
this.lastTooltipFrame = frame; this.lastTooltipFrame = frame;
@ -136,7 +136,7 @@ internal partial class DragDropManager : IInternalDisposableService, IDragDropMa
unsafe unsafe
{ {
if (ImGui.AcceptDragDropPayload(label, ImGuiDragDropFlags.AcceptBeforeDelivery).NativePtr != null && this.IsDropping()) if (ImGui.AcceptDragDropPayload(label, ImGuiDragDropFlags.AcceptBeforeDelivery).Handle != null && this.IsDropping())
{ {
this.lastDropFrame = -2; this.lastDropFrame = -2;
files = this.Files; files = this.Files;

View file

@ -5,7 +5,7 @@ using System.Runtime.InteropServices.ComTypes;
using System.Text; using System.Text;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Serilog; using Serilog;
namespace Dalamud.Interface.DragDrop; namespace Dalamud.Interface.DragDrop;

View file

@ -3,7 +3,7 @@ using System.Collections.Generic;
using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Storage.Assets; using Dalamud.Storage.Assets;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Newtonsoft.Json; using Newtonsoft.Json;

View file

@ -2,7 +2,7 @@ using System.Collections.Generic;
using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Newtonsoft.Json; using Newtonsoft.Json;

View file

@ -3,7 +3,7 @@ using System.Collections.Generic;
using Dalamud.Interface.GameFonts; using Dalamud.Interface.GameFonts;
using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Newtonsoft.Json; using Newtonsoft.Json;

View file

@ -1,6 +1,6 @@
using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.FontIdentifier; namespace Dalamud.Interface.FontIdentifier;

View file

@ -1,6 +1,6 @@
using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.FontIdentifier; namespace Dalamud.Interface.FontIdentifier;

View file

@ -6,7 +6,7 @@ using System.Text;
using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Newtonsoft.Json; using Newtonsoft.Json;

View file

@ -5,7 +5,7 @@ using System.Linq;
using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -38,7 +38,7 @@ public sealed class SystemFontId : IFontId
this.EnglishName = name; this.EnglishName = name;
else if (this.LocaleNames.TryGetValue("en", out name)) else if (this.LocaleNames.TryGetValue("en", out name))
this.EnglishName = name; this.EnglishName = name;
else else
this.EnglishName = this.LocaleNames.Values.First(); this.EnglishName = this.LocaleNames.Values.First();
} }

View file

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Numerics; using System.Numerics;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.GameFonts; namespace Dalamud.Interface.GameFonts;

View file

@ -1,15 +1,19 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Dalamud.Bindings.ImGui;
using Dalamud.Bindings.ImGuizmo;
using Dalamud.Bindings.ImPlot;
using Dalamud.Interface.ImGuiBackend.Helpers; using Dalamud.Interface.ImGuiBackend.Helpers;
using Dalamud.Interface.ImGuiBackend.InputHandler; using Dalamud.Interface.ImGuiBackend.InputHandler;
using Dalamud.Interface.ImGuiBackend.Renderers; using Dalamud.Interface.ImGuiBackend.Renderers;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Serilog;
using ImGuizmoNET;
using ImPlotNET;
using TerraFX.Interop.DirectX; using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;
@ -67,6 +71,58 @@ internal sealed unsafe class Dx11Win32Backend : IWin32Backend
this.WindowHandle = desc.OutputWindow; this.WindowHandle = desc.OutputWindow;
var ctx = ImGui.CreateContext(); var ctx = ImGui.CreateContext();
Debug.Assert(!ctx.IsNull);
var windowOff = Marshal.OffsetOf<ImGuiContext>("CurrentWindow");
//Debug.Assert(windowOff == 16368);
/*
void ShowOffset<T>(string name)
{
// var off = Marshal.OffsetOf<T>(name);
var fieldInfo = typeof(T).GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
var off = fieldInfo?.GetFieldOffset();
Log.Information($"{name} {typeof(T).Name} {off}");
}
//Util.Fatal($"{Marshal.SizeOf<Test>()} - {sizeof(Test)}", "", false);
ShowOffset<ImGuiIO>("ClipboardUserData");
ShowOffset<ImGuiIO>("MouseDrawCursor");
ShowOffset<ImGuiIO>("MouseDelta");
ShowOffset<ImGuiIO>("KeysDown_0");
ShowOffset<ImGuiIO>("MousePos");
ShowOffset<ImGuiIO>("KeyMods");
*/
void ShowAllFields<T>()
{
var fields = typeof(T).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
foreach (var field in fields)
{
var off = field.GetFieldOffset();
Log.Information($"{field.Name} {typeof(T).Name} {off}");
}
}
ShowAllFields<ImGuiIO>();
var contextSize = Unsafe.SizeOf<ImGuiContext>();
var ioSize = Unsafe.SizeOf<ImGuiIO>();
var platformIoSize = Unsafe.SizeOf<ImGuiPlatformIO>();
//Debug.Assert(contextSize == 22688);
//Debug.Assert(ioSize == 14352);
//Debug.Assert(platformIoSize == 216);
//var platformIoOff = Unsafe.OffsetOf<ImGuiContext>("PlatformIO");
//Debug.Assert(platformIoOff == 14360);
Util.Fatal("bleh", "bleh", false);
ImGuizmo.SetImGuiContext(ctx); ImGuizmo.SetImGuiContext(ctx);
ImPlot.SetImGuiContext(ctx); ImPlot.SetImGuiContext(ctx);
ImPlot.CreateContext(); ImPlot.CreateContext();
@ -234,8 +290,8 @@ internal sealed unsafe class Dx11Win32Backend : IWin32Backend
if (this.device.IsEmpty()) if (this.device.IsEmpty())
return; return;
this.imguiRenderer.Dispose(); this.imguiRenderer?.Dispose();
this.imguiInput.Dispose(); this.imguiInput?.Dispose();
ImGui.DestroyContext(); ImGui.DestroyContext();
@ -245,3 +301,4 @@ internal sealed unsafe class Dx11Win32Backend : IWin32Backend
this.swapChainPossiblyWrapped.Dispose(); this.swapChainPossiblyWrapped.Dispose();
} }
} }

View file

@ -3,7 +3,7 @@ using System.Linq;
using System.Numerics; using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;
@ -68,7 +68,7 @@ internal static class ImGuiViewportHelpers
/// <param name="viewport">An instance of <see cref="ImGuiViewportPtr"/>.</param> /// <param name="viewport">An instance of <see cref="ImGuiViewportPtr"/>.</param>
/// <returns>Same value with <paramref name="returnStorage"/>.</returns> /// <returns>Same value with <paramref name="returnStorage"/>.</returns>
public unsafe delegate Vector2* GetWindowPosDelegate(Vector2* returnStorage, ImGuiViewportPtr viewport); public unsafe delegate Vector2* GetWindowPosDelegate(Vector2* returnStorage, ImGuiViewportPtr viewport);
/// <summary> /// <summary>
/// Delegate to be called when the window should be moved. /// Delegate to be called when the window should be moved.
/// </summary> /// </summary>
@ -83,7 +83,7 @@ internal static class ImGuiViewportHelpers
/// <param name="viewport">An instance of <see cref="ImGuiViewportPtr"/>.</param> /// <param name="viewport">An instance of <see cref="ImGuiViewportPtr"/>.</param>
/// <returns>Same value with <paramref name="returnStorage"/>.</returns> /// <returns>Same value with <paramref name="returnStorage"/>.</returns>
public unsafe delegate Vector2* GetWindowSizeDelegate(Vector2* returnStorage, ImGuiViewportPtr viewport); public unsafe delegate Vector2* GetWindowSizeDelegate(Vector2* returnStorage, ImGuiViewportPtr viewport);
/// <summary> /// <summary>
/// Delegate to be called when the window should be given focus. /// Delegate to be called when the window should be given focus.
/// </summary> /// </summary>

View file

@ -1,6 +1,6 @@
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;
@ -75,16 +75,16 @@ internal sealed partial class Win32InputHandler
VK.VK_RMENU => ImGuiKey.RightAlt, VK.VK_RMENU => ImGuiKey.RightAlt,
VK.VK_RWIN => ImGuiKey.RightSuper, VK.VK_RWIN => ImGuiKey.RightSuper,
VK.VK_APPS => ImGuiKey.Menu, VK.VK_APPS => ImGuiKey.Menu,
'0' => ImGuiKey._0, '0' => ImGuiKey.Key0,
'1' => ImGuiKey._1, '1' => ImGuiKey.Key1,
'2' => ImGuiKey._2, '2' => ImGuiKey.Key2,
'3' => ImGuiKey._3, '3' => ImGuiKey.Key3,
'4' => ImGuiKey._4, '4' => ImGuiKey.Key4,
'5' => ImGuiKey._5, '5' => ImGuiKey.Key5,
'6' => ImGuiKey._6, '6' => ImGuiKey.Key6,
'7' => ImGuiKey._7, '7' => ImGuiKey.Key7,
'8' => ImGuiKey._8, '8' => ImGuiKey.Key8,
'9' => ImGuiKey._9, '9' => ImGuiKey.Key9,
'A' => ImGuiKey.A, 'A' => ImGuiKey.A,
'B' => ImGuiKey.B, 'B' => ImGuiKey.B,
'C' => ImGuiKey.C, 'C' => ImGuiKey.C,
@ -190,16 +190,16 @@ internal sealed partial class Win32InputHandler
ImGuiKey.RightAlt => VK.VK_RMENU, ImGuiKey.RightAlt => VK.VK_RMENU,
ImGuiKey.RightSuper => VK.VK_RWIN, ImGuiKey.RightSuper => VK.VK_RWIN,
ImGuiKey.Menu => VK.VK_APPS, ImGuiKey.Menu => VK.VK_APPS,
ImGuiKey._0 => '0', ImGuiKey.Key0 => '0',
ImGuiKey._1 => '1', ImGuiKey.Key1 => '1',
ImGuiKey._2 => '2', ImGuiKey.Key2 => '2',
ImGuiKey._3 => '3', ImGuiKey.Key3 => '3',
ImGuiKey._4 => '4', ImGuiKey.Key4 => '4',
ImGuiKey._5 => '5', ImGuiKey.Key5 => '5',
ImGuiKey._6 => '6', ImGuiKey.Key6 => '6',
ImGuiKey._7 => '7', ImGuiKey.Key7 => '7',
ImGuiKey._8 => '8', ImGuiKey.Key8 => '8',
ImGuiKey._9 => '9', ImGuiKey.Key9 => '9',
ImGuiKey.A => 'A', ImGuiKey.A => 'A',
ImGuiKey.B => 'B', ImGuiKey.B => 'B',
ImGuiKey.C => 'C', ImGuiKey.C => 'C',
@ -274,14 +274,14 @@ internal sealed partial class Win32InputHandler
private static void UpAllKeys() private static void UpAllKeys()
{ {
var io = ImGui.GetIO(); var io = ImGui.GetIO();
for (var i = (int)ImGuiKey.NamedKey_BEGIN; i < (int)ImGuiKey.NamedKey_END; i++) for (var i = (int)ImGuiKey.NamedKeyBegin; i < (int)ImGuiKey.NamedKeyEnd; i++)
io.AddKeyEvent((ImGuiKey)i, false); io.AddKeyEvent((ImGuiKey)i, false);
} }
private static void UpAllMouseButton() private static void UpAllMouseButton()
{ {
var io = ImGui.GetIO(); var io = ImGui.GetIO();
for (var i = 0; i < io.MouseDown.Count; i++) for (var i = 0; i < io.MouseDown.Length; i++)
io.MouseDown[i] = false; io.MouseDown[i] = false;
} }

View file

@ -6,7 +6,9 @@ using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Serilog;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;
@ -51,7 +53,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
public Win32InputHandler(HWND hWnd) public Win32InputHandler(HWND hWnd)
{ {
var io = ImGui.GetIO(); var io = ImGui.GetIO();
if (ImGui.GetIO().NativePtr->BackendPlatformName is not null) if (ImGui.GetIO().Handle->BackendPlatformName is not null)
throw new InvalidOperationException("ImGui backend platform seems to be have been already attached."); throw new InvalidOperationException("ImGui backend platform seems to be have been already attached.");
this.hWnd = hWnd; this.hWnd = hWnd;
@ -66,7 +68,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
ImGuiBackendFlags.PlatformHasViewports; ImGuiBackendFlags.PlatformHasViewports;
this.platformNamePtr = Marshal.StringToHGlobalAnsi("imgui_impl_win32_c#"); this.platformNamePtr = Marshal.StringToHGlobalAnsi("imgui_impl_win32_c#");
io.NativePtr->BackendPlatformName = (byte*)this.platformNamePtr; io.Handle->BackendPlatformName = (byte*)this.platformNamePtr;
var mainViewport = ImGui.GetMainViewport(); var mainViewport = ImGui.GetMainViewport();
mainViewport.PlatformHandle = mainViewport.PlatformHandleRaw = hWnd; mainViewport.PlatformHandle = mainViewport.PlatformHandleRaw = hWnd;
@ -79,10 +81,10 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
this.cursors[(int)ImGuiMouseCursor.Arrow] = LoadCursorW(default, IDC.IDC_ARROW); this.cursors[(int)ImGuiMouseCursor.Arrow] = LoadCursorW(default, IDC.IDC_ARROW);
this.cursors[(int)ImGuiMouseCursor.TextInput] = LoadCursorW(default, IDC.IDC_IBEAM); this.cursors[(int)ImGuiMouseCursor.TextInput] = LoadCursorW(default, IDC.IDC_IBEAM);
this.cursors[(int)ImGuiMouseCursor.ResizeAll] = LoadCursorW(default, IDC.IDC_SIZEALL); this.cursors[(int)ImGuiMouseCursor.ResizeAll] = LoadCursorW(default, IDC.IDC_SIZEALL);
this.cursors[(int)ImGuiMouseCursor.ResizeEW] = LoadCursorW(default, IDC.IDC_SIZEWE); this.cursors[(int)ImGuiMouseCursor.ResizeEw] = LoadCursorW(default, IDC.IDC_SIZEWE);
this.cursors[(int)ImGuiMouseCursor.ResizeNS] = LoadCursorW(default, IDC.IDC_SIZENS); this.cursors[(int)ImGuiMouseCursor.ResizeNs] = LoadCursorW(default, IDC.IDC_SIZENS);
this.cursors[(int)ImGuiMouseCursor.ResizeNESW] = LoadCursorW(default, IDC.IDC_SIZENESW); this.cursors[(int)ImGuiMouseCursor.ResizeNesw] = LoadCursorW(default, IDC.IDC_SIZENESW);
this.cursors[(int)ImGuiMouseCursor.ResizeNWSE] = LoadCursorW(default, IDC.IDC_SIZENWSE); this.cursors[(int)ImGuiMouseCursor.ResizeNwse] = LoadCursorW(default, IDC.IDC_SIZENWSE);
this.cursors[(int)ImGuiMouseCursor.Hand] = LoadCursorW(default, IDC.IDC_HAND); this.cursors[(int)ImGuiMouseCursor.Hand] = LoadCursorW(default, IDC.IDC_HAND);
this.cursors[(int)ImGuiMouseCursor.NotAllowed] = LoadCursorW(default, IDC.IDC_NO); this.cursors[(int)ImGuiMouseCursor.NotAllowed] = LoadCursorW(default, IDC.IDC_NO);
} }
@ -136,7 +138,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
this.iniPathPtr = newAlloc; this.iniPathPtr = newAlloc;
} }
ImGui.GetIO().NativePtr->IniFilename = (byte*)this.iniPathPtr; ImGui.GetIO().Handle->IniFilename = (byte*)this.iniPathPtr;
} }
} }
@ -199,7 +201,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
// would become unresponsive // would become unresponsive
if (!io.WantCaptureMouse) if (!io.WantCaptureMouse)
{ {
for (var i = 0; i < io.MouseDown.Count; i++) for (var i = 0; i < io.MouseDown.Length; i++)
{ {
io.MouseDown[i] = false; io.MouseDown[i] = false;
} }
@ -216,7 +218,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
/// <returns>Return value, if not doing further processing.</returns> /// <returns>Return value, if not doing further processing.</returns>
public LRESULT? ProcessWndProcW(HWND hWndCurrent, uint msg, WPARAM wParam, LPARAM lParam) public LRESULT? ProcessWndProcW(HWND hWndCurrent, uint msg, WPARAM wParam, LPARAM lParam)
{ {
if (ImGui.GetCurrentContext() == nint.Zero) if (ImGui.GetCurrentContext().IsNull)
return null; return null;
var io = ImGui.GetIO(); var io = ImGui.GetIO();
@ -469,7 +471,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
// See: https://github.com/goatcorp/ImGuiScene/pull/13 // See: https://github.com/goatcorp/ImGuiScene/pull/13
// > GetForegroundWindow from winuser.h is a surprisingly expensive function. // > GetForegroundWindow from winuser.h is a surprisingly expensive function.
var isForeground = GetForegroundWindow() == this.hWnd; var isForeground = GetForegroundWindow() == this.hWnd;
for (var i = (int)ImGuiKey.NamedKey_BEGIN; i < (int)ImGuiKey.NamedKey_END; i++) for (var i = (int)ImGuiKey.NamedKeyBegin; i < (int)ImGuiKey.NamedKeyEnd; i++)
{ {
// Skip raising modifier keys if the game is focused. // Skip raising modifier keys if the game is focused.
// This allows us to raise the keys when one is held and the window becomes unfocused, // This allows us to raise the keys when one is held and the window becomes unfocused,
@ -495,11 +497,11 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
// The message wasn't handled, but it's a platform window // The message wasn't handled, but it's a platform window
// So we have to handle some messages ourselves // So we have to handle some messages ourselves
// BUT we might have disposed the context, so check that // BUT we might have disposed the context, so check that
if (ImGui.GetCurrentContext() == nint.Zero) if (ImGui.GetCurrentContext().IsNull)
return DefWindowProcW(hWndCurrent, msg, wParam, lParam); return DefWindowProcW(hWndCurrent, msg, wParam, lParam);
var viewport = ImGui.FindViewportByPlatformHandle(hWndCurrent); var viewport = ImGui.FindViewportByPlatformHandle(hWndCurrent);
if (viewport.NativePtr == null) if (viewport.Handle == null)
return DefWindowProcW(hWndCurrent, msg, wParam, lParam); return DefWindowProcW(hWndCurrent, msg, wParam, lParam);
switch (msg) switch (msg)
@ -556,14 +558,14 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
this.cursors.AsSpan().Clear(); this.cursors.AsSpan().Clear();
if (ImGui.GetIO().NativePtr->BackendPlatformName == (void*)this.platformNamePtr) if (ImGui.GetIO().Handle->BackendPlatformName == (void*)this.platformNamePtr)
ImGui.GetIO().NativePtr->BackendPlatformName = null; ImGui.GetIO().Handle->BackendPlatformName = null;
if (this.platformNamePtr != nint.Zero) if (this.platformNamePtr != nint.Zero)
Marshal.FreeHGlobal(this.platformNamePtr); Marshal.FreeHGlobal(this.platformNamePtr);
if (this.iniPathPtr != nint.Zero) if (this.iniPathPtr != nint.Zero)
{ {
ImGui.GetIO().NativePtr->IniFilename = null; ImGui.GetIO().Handle->IniFilename = null;
Marshal.FreeHGlobal(this.iniPathPtr); Marshal.FreeHGlobal(this.iniPathPtr);
this.iniPathPtr = nint.Zero; this.iniPathPtr = nint.Zero;
} }
@ -587,20 +589,20 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
this.classNamePtr = Marshal.StringToHGlobalUni("ImGui Platform"); this.classNamePtr = Marshal.StringToHGlobalUni("ImGui Platform");
var pio = ImGui.GetPlatformIO(); var pio = ImGui.GetPlatformIO();
pio.Platform_CreateWindow = this.RegisterFunctionPointer<CreateWindowDelegate>(this.OnCreateWindow); pio.PlatformCreateWindow = this.RegisterFunctionPointer<CreateWindowDelegate>(this.OnCreateWindow);
pio.Platform_DestroyWindow = this.RegisterFunctionPointer<DestroyWindowDelegate>(this.OnDestroyWindow); pio.PlatformDestroyWindow = this.RegisterFunctionPointer<DestroyWindowDelegate>(this.OnDestroyWindow);
pio.Platform_ShowWindow = this.RegisterFunctionPointer<ShowWindowDelegate>(this.OnShowWindow); pio.PlatformShowWindow = this.RegisterFunctionPointer<ShowWindowDelegate>(this.OnShowWindow);
pio.Platform_SetWindowPos = this.RegisterFunctionPointer<SetWindowPosDelegate>(this.OnSetWindowPos); pio.PlatformSetWindowPos = this.RegisterFunctionPointer<SetWindowPosDelegate>(this.OnSetWindowPos);
pio.Platform_GetWindowPos = this.RegisterFunctionPointer<GetWindowPosDelegate>(this.OnGetWindowPos); pio.PlatformGetWindowPos = this.RegisterFunctionPointer<GetWindowPosDelegate>(this.OnGetWindowPos);
pio.Platform_SetWindowSize = this.RegisterFunctionPointer<SetWindowSizeDelegate>(this.OnSetWindowSize); pio.PlatformSetWindowSize = this.RegisterFunctionPointer<SetWindowSizeDelegate>(this.OnSetWindowSize);
pio.Platform_GetWindowSize = this.RegisterFunctionPointer<GetWindowSizeDelegate>(this.OnGetWindowSize); pio.PlatformGetWindowSize = this.RegisterFunctionPointer<GetWindowSizeDelegate>(this.OnGetWindowSize);
pio.Platform_SetWindowFocus = this.RegisterFunctionPointer<SetWindowFocusDelegate>(this.OnSetWindowFocus); pio.PlatformSetWindowFocus = this.RegisterFunctionPointer<SetWindowFocusDelegate>(this.OnSetWindowFocus);
pio.Platform_GetWindowFocus = this.RegisterFunctionPointer<GetWindowFocusDelegate>(this.OnGetWindowFocus); pio.PlatformGetWindowFocus = this.RegisterFunctionPointer<GetWindowFocusDelegate>(this.OnGetWindowFocus);
pio.Platform_GetWindowMinimized = pio.PlatformGetWindowMinimized =
this.RegisterFunctionPointer<GetWindowMinimizedDelegate>(this.OnGetWindowMinimized); this.RegisterFunctionPointer<GetWindowMinimizedDelegate>(this.OnGetWindowMinimized);
pio.Platform_SetWindowTitle = this.RegisterFunctionPointer<SetWindowTitleDelegate>(this.OnSetWindowTitle); pio.PlatformSetWindowTitle = this.RegisterFunctionPointer<SetWindowTitleDelegate>(this.OnSetWindowTitle);
pio.Platform_SetWindowAlpha = this.RegisterFunctionPointer<SetWindowAlphaDelegate>(this.OnSetWindowAlpha); pio.PlatformSetWindowAlpha = this.RegisterFunctionPointer<SetWindowAlphaDelegate>(this.OnSetWindowAlpha);
pio.Platform_UpdateWindow = this.RegisterFunctionPointer<UpdateWindowDelegate>(this.OnUpdateWindow); pio.PlatformUpdateWindow = this.RegisterFunctionPointer<UpdateWindowDelegate>(this.OnUpdateWindow);
// pio.Platform_SetImeInputPos = this.RegisterFunctionPointer<SetImeInputPosDelegate>(this.OnSetImeInputPos); // pio.Platform_SetImeInputPos = this.RegisterFunctionPointer<SetImeInputPosDelegate>(this.OnSetImeInputPos);
// pio.Platform_GetWindowDpiScale = this.RegisterFunctionPointer<GetWindowDpiScaleDelegate>(this.OnGetWindowDpiScale); // pio.Platform_GetWindowDpiScale = this.RegisterFunctionPointer<GetWindowDpiScaleDelegate>(this.OnGetWindowDpiScale);
// pio.Platform_ChangedViewport = this.RegisterFunctionPointer<ChangedViewportDelegate>(this.OnChangedViewport); // pio.Platform_ChangedViewport = this.RegisterFunctionPointer<ChangedViewportDelegate>(this.OnChangedViewport);
@ -624,7 +626,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
var mainViewport = ImGui.GetMainViewport(); var mainViewport = ImGui.GetMainViewport();
var data = (ImGuiViewportDataWin32*)Marshal.AllocHGlobal(Marshal.SizeOf<ImGuiViewportDataWin32>()); var data = (ImGuiViewportDataWin32*)Marshal.AllocHGlobal(Marshal.SizeOf<ImGuiViewportDataWin32>());
mainViewport.PlatformUserData = (nint)data; mainViewport.PlatformUserData = data;
data->Hwnd = this.input.hWnd; data->Hwnd = this.input.hWnd;
data->HwndOwned = false; data->HwndOwned = false;
mainViewport.PlatformHandle = this.input.hWnd; mainViewport.PlatformHandle = this.input.hWnd;
@ -637,12 +639,12 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
var pio = ImGui.GetPlatformIO(); var pio = ImGui.GetPlatformIO();
if (ImGui.GetPlatformIO().NativePtr->Monitors.Data != 0) if (ImGui.GetPlatformIO().Handle->Monitors.Data != null)
{ {
// We allocated the platform monitor data in OnUpdateMonitors ourselves, // We allocated the platform monitor data in OnUpdateMonitors ourselves,
// so we have to free it ourselves to ImGui doesn't try to, or else it will crash // so we have to free it ourselves to ImGui doesn't try to, or else it will crash
Marshal.FreeHGlobal(ImGui.GetPlatformIO().NativePtr->Monitors.Data); Marshal.FreeHGlobal(new IntPtr(ImGui.GetPlatformIO().Handle->Monitors.Data));
ImGui.GetPlatformIO().NativePtr->Monitors = default; ImGui.GetPlatformIO().Handle->Monitors = default;
} }
if (this.classNamePtr != 0) if (this.classNamePtr != 0)
@ -652,19 +654,19 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
this.classNamePtr = 0; this.classNamePtr = 0;
} }
pio.Platform_CreateWindow = nint.Zero; pio.PlatformCreateWindow = null;
pio.Platform_DestroyWindow = nint.Zero; pio.PlatformDestroyWindow = null;
pio.Platform_ShowWindow = nint.Zero; pio.PlatformShowWindow = null;
pio.Platform_SetWindowPos = nint.Zero; pio.PlatformSetWindowPos = null;
pio.Platform_GetWindowPos = nint.Zero; pio.PlatformGetWindowPos = null;
pio.Platform_SetWindowSize = nint.Zero; pio.PlatformSetWindowSize = null;
pio.Platform_GetWindowSize = nint.Zero; pio.PlatformGetWindowSize = null;
pio.Platform_SetWindowFocus = nint.Zero; pio.PlatformSetWindowFocus = null;
pio.Platform_GetWindowFocus = nint.Zero; pio.PlatformGetWindowFocus = null;
pio.Platform_GetWindowMinimized = nint.Zero; pio.PlatformGetWindowMinimized = null;
pio.Platform_SetWindowTitle = nint.Zero; pio.PlatformSetWindowTitle = null;
pio.Platform_SetWindowAlpha = nint.Zero; pio.PlatformSetWindowAlpha = null;
pio.Platform_UpdateWindow = nint.Zero; pio.PlatformUpdateWindow = null;
// pio.Platform_SetImeInputPos = nint.Zero; // pio.Platform_SetImeInputPos = nint.Zero;
// pio.Platform_GetWindowDpiScale = nint.Zero; // pio.Platform_GetWindowDpiScale = nint.Zero;
// pio.Platform_ChangedViewport = nint.Zero; // pio.Platform_ChangedViewport = nint.Zero;
@ -685,15 +687,15 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
var pio = ImGui.GetPlatformIO(); var pio = ImGui.GetPlatformIO();
var numMonitors = GetSystemMetrics(SM.SM_CMONITORS); var numMonitors = GetSystemMetrics(SM.SM_CMONITORS);
var data = Marshal.AllocHGlobal(Marshal.SizeOf<ImGuiPlatformMonitor>() * numMonitors); var data = Marshal.AllocHGlobal(Marshal.SizeOf<ImGuiPlatformMonitor>() * numMonitors);
if (pio.NativePtr->Monitors.Data != 0) if (pio.Handle->Monitors.Data != null)
Marshal.FreeHGlobal(pio.NativePtr->Monitors.Data); Marshal.FreeHGlobal(new IntPtr(pio.Handle->Monitors.Data));
pio.NativePtr->Monitors = new(numMonitors, numMonitors, data); pio.Handle->Monitors = new(numMonitors, numMonitors, (ImGuiPlatformMonitor*)data.ToPointer());
// ImGuiPlatformIOPtr platformIO = ImGui.GetPlatformIO(); // ImGuiPlatformIOPtr platformIO = ImGui.GetPlatformIO();
// Marshal.FreeHGlobal(platformIO.NativePtr->Monitors.Data); // Marshal.FreeHGlobal(platformIO.Handle->Monitors.Data);
// int numMonitors = GetSystemMetrics(SystemMetric.SM_CMONITORS); // int numMonitors = GetSystemMetrics(SystemMetric.SM_CMONITORS);
// nint data = Marshal.AllocHGlobal(Marshal.SizeOf<ImGuiPlatformMonitor>() * numMonitors); // nint data = Marshal.AllocHGlobal(Marshal.SizeOf<ImGuiPlatformMonitor>() * numMonitors);
// platformIO.NativePtr->Monitors = new ImVector(numMonitors, numMonitors, data); // platformIO.Handle->Monitors = new ImVector(numMonitors, numMonitors, data);
var monitorIndex = -1; var monitorIndex = -1;
var enumfn = new MonitorEnumProcDelegate( var enumfn = new MonitorEnumProcDelegate(
@ -710,7 +712,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
var workRb = new Vector2(info.rcWork.right, info.rcWork.bottom); var workRb = new Vector2(info.rcWork.right, info.rcWork.bottom);
// Give ImGui the info for this display // Give ImGui the info for this display
var imMonitor = ImGui.GetPlatformIO().Monitors[monitorIndex]; ref var imMonitor = ref ImGui.GetPlatformIO().Monitors.Ref(monitorIndex);
imMonitor.MainPos = monitorLt; imMonitor.MainPos = monitorLt;
imMonitor.MainSize = monitorRb - monitorLt; imMonitor.MainSize = monitorRb - monitorLt;
imMonitor.WorkPos = workLt; imMonitor.WorkPos = workLt;
@ -723,18 +725,31 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
null, null,
(delegate* unmanaged<HMONITOR, HDC, RECT*, LPARAM, BOOL>)Marshal.GetFunctionPointerForDelegate(enumfn), (delegate* unmanaged<HMONITOR, HDC, RECT*, LPARAM, BOOL>)Marshal.GetFunctionPointerForDelegate(enumfn),
default); default);
Log.Information("Monitors set up!");
for (var i = 0; i < numMonitors; i++)
{
var monitor = pio.Handle->Monitors[i];
Log.Information(
"Monitor {Index}: {MainPos} {MainSize} {WorkPos} {WorkSize}",
i,
monitor.MainPos,
monitor.MainSize,
monitor.WorkPos,
monitor.WorkSize);
}
} }
private nint RegisterFunctionPointer<T>(T obj) private void* RegisterFunctionPointer<T>(T obj)
{ {
this.delegateReferences.Add(obj); this.delegateReferences.Add(obj);
return Marshal.GetFunctionPointerForDelegate(obj); return Marshal.GetFunctionPointerForDelegate(obj).ToPointer();
} }
private void OnCreateWindow(ImGuiViewportPtr viewport) private void OnCreateWindow(ImGuiViewportPtr viewport)
{ {
var data = (ImGuiViewportDataWin32*)Marshal.AllocHGlobal(Marshal.SizeOf<ImGuiViewportDataWin32>()); var data = (ImGuiViewportDataWin32*)Marshal.AllocHGlobal(Marshal.SizeOf<ImGuiViewportDataWin32>());
viewport.PlatformUserData = (nint)data; viewport.PlatformUserData = data;
viewport.Flags = viewport.Flags =
ImGuiViewportFlags.NoTaskBarIcon | ImGuiViewportFlags.NoTaskBarIcon |
ImGuiViewportFlags.NoFocusOnClick | ImGuiViewportFlags.NoFocusOnClick |
@ -784,7 +799,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
private void OnDestroyWindow(ImGuiViewportPtr viewport) private void OnDestroyWindow(ImGuiViewportPtr viewport)
{ {
// This is also called on the main viewport for some reason, and we never set that viewport's PlatformUserData // This is also called on the main viewport for some reason, and we never set that viewport's PlatformUserData
if (viewport.PlatformUserData == nint.Zero) return; if (viewport.PlatformUserData == null) return;
var data = (ImGuiViewportDataWin32*)viewport.PlatformUserData; var data = (ImGuiViewportDataWin32*)viewport.PlatformUserData;
@ -807,8 +822,8 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
} }
data->Hwnd = default; data->Hwnd = default;
Marshal.FreeHGlobal(viewport.PlatformUserData); Marshal.FreeHGlobal(new IntPtr(viewport.PlatformUserData));
viewport.PlatformUserData = viewport.PlatformHandle = nint.Zero; viewport.PlatformUserData = viewport.PlatformHandle = null;
} }
private void OnShowWindow(ImGuiViewportPtr viewport) private void OnShowWindow(ImGuiViewportPtr viewport)

View file

@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using Dalamud.Interface.ImGuiBackend.Helpers; using Dalamud.Interface.ImGuiBackend.Helpers;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using TerraFX.Interop.DirectX; using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;
@ -36,11 +36,11 @@ internal unsafe partial class Dx11Renderer
this.renderer = renderer; this.renderer = renderer;
var pio = ImGui.GetPlatformIO(); var pio = ImGui.GetPlatformIO();
pio.Renderer_CreateWindow = Marshal.GetFunctionPointerForDelegate(this.cwd = this.OnCreateWindow); pio.RendererCreateWindow = Marshal.GetFunctionPointerForDelegate(this.cwd = this.OnCreateWindow).ToPointer();
pio.Renderer_DestroyWindow = (nint)(delegate* unmanaged<ImGuiViewportPtr, void>)&OnDestroyWindow; pio.RendererDestroyWindow = (delegate* unmanaged<ImGuiViewportPtr, void>)&OnDestroyWindow;
pio.Renderer_SetWindowSize = (nint)(delegate* unmanaged<ImGuiViewportPtr, Vector2, void>)&OnSetWindowSize; pio.RendererSetWindowSize = (delegate* unmanaged<ImGuiViewportPtr, Vector2, void>)&OnSetWindowSize;
pio.Renderer_RenderWindow = (nint)(delegate* unmanaged<ImGuiViewportPtr, nint, void>)&OnRenderWindow; pio.RendererRenderWindow = (delegate* unmanaged<ImGuiViewportPtr, nint, void>)&OnRenderWindow;
pio.Renderer_SwapBuffers = (nint)(delegate* unmanaged<ImGuiViewportPtr, nint, void>)&OnSwapBuffers; pio.RendererSwapBuffers = (delegate* unmanaged<ImGuiViewportPtr, nint, void>)&OnSwapBuffers;
} }
~ViewportHandler() => ReleaseUnmanagedResources(); ~ViewportHandler() => ReleaseUnmanagedResources();
@ -54,20 +54,20 @@ internal unsafe partial class Dx11Renderer
private static void ReleaseUnmanagedResources() private static void ReleaseUnmanagedResources()
{ {
var pio = ImGui.GetPlatformIO(); var pio = ImGui.GetPlatformIO();
pio.Renderer_CreateWindow = nint.Zero; pio.RendererCreateWindow = null;
pio.Renderer_DestroyWindow = nint.Zero; pio.RendererDestroyWindow = null;
pio.Renderer_SetWindowSize = nint.Zero; pio.RendererSetWindowSize = null;
pio.Renderer_RenderWindow = nint.Zero; pio.RendererRenderWindow = null;
pio.Renderer_SwapBuffers = nint.Zero; pio.RendererSwapBuffers = null;
} }
[UnmanagedCallersOnly] [UnmanagedCallersOnly]
private static void OnDestroyWindow(ImGuiViewportPtr viewport) private static void OnDestroyWindow(ImGuiViewportPtr viewport)
{ {
if (viewport.RendererUserData == nint.Zero) if (viewport.RendererUserData == null)
return; return;
ViewportData.Attach(viewport.RendererUserData).Dispose(); ViewportData.Attach(viewport.RendererUserData).Dispose();
viewport.RendererUserData = nint.Zero; viewport.RendererUserData = null;
} }
[UnmanagedCallersOnly] [UnmanagedCallersOnly]
@ -87,7 +87,7 @@ internal unsafe partial class Dx11Renderer
// PlatformHandleRaw should always be a HWND, whereas PlatformHandle might be a higher-level handle (e.g. GLFWWindow*, SDL_Window*). // PlatformHandleRaw should always be a HWND, whereas PlatformHandle might be a higher-level handle (e.g. GLFWWindow*, SDL_Window*).
// Some backend will leave PlatformHandleRaw NULL, in which case we assume PlatformHandle will contain the HWND. // Some backend will leave PlatformHandleRaw NULL, in which case we assume PlatformHandle will contain the HWND.
var hWnd = viewport.PlatformHandleRaw; var hWnd = viewport.PlatformHandleRaw;
if (hWnd == 0) if (hWnd == null)
hWnd = viewport.PlatformHandle; hWnd = viewport.PlatformHandle;
try try
{ {
@ -135,12 +135,12 @@ internal unsafe partial class Dx11Renderer
public IDXGISwapChain* SwapChain => this.swapChain; public IDXGISwapChain* SwapChain => this.swapChain;
public nint Handle => GCHandle.ToIntPtr(this.selfGcHandle); public void* Handle => GCHandle.ToIntPtr(this.selfGcHandle).ToPointer();
private DXGI_FORMAT RtvFormat => this.parent.rtvFormat; private DXGI_FORMAT RtvFormat => this.parent.rtvFormat;
public static ViewportData Attach(nint handle) => public static ViewportData Attach(void* handle) =>
(ViewportData)GCHandle.FromIntPtr(handle).Target ?? throw new InvalidOperationException(); (ViewportData)GCHandle.FromIntPtr(new IntPtr(handle)).Target ?? throw new InvalidOperationException();
public static ViewportData Create( public static ViewportData Create(
Dx11Renderer renderer, Dx11Renderer renderer,
@ -220,7 +220,7 @@ internal unsafe partial class Dx11Renderer
dcVisual.Get()->SetContent((IUnknown*)swapChain1.Get()).ThrowOnError(); dcVisual.Get()->SetContent((IUnknown*)swapChain1.Get()).ThrowOnError();
dcTarget.Get()->SetRoot(dcVisual).ThrowOnError(); dcTarget.Get()->SetRoot(dcVisual).ThrowOnError();
renderer.dcompDevice.Get()->Commit().ThrowOnError(); renderer.dcompDevice.Get()->Commit().ThrowOnError();
using var swapChain = default(ComPtr<IDXGISwapChain>); using var swapChain = default(ComPtr<IDXGISwapChain>);
swapChain1.As(&swapChain).ThrowOnError(); swapChain1.As(&swapChain).ThrowOnError();
return Create(renderer, swapChain, dcVisual, dcTarget); return Create(renderer, swapChain, dcVisual, dcTarget);
@ -272,7 +272,7 @@ internal unsafe partial class Dx11Renderer
return Create(renderer, swapChain, null, null); return Create(renderer, swapChain, null, null);
} }
public void Dispose() public void Dispose()
{ {
if (!this.selfGcHandle.IsAllocated) if (!this.selfGcHandle.IsAllocated)

View file

@ -15,7 +15,7 @@ using Dalamud.Interface.Textures.TextureWraps.Internal;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using TerraFX.Interop.DirectX; using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;
@ -67,7 +67,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
public Dx11Renderer(IDXGISwapChain* swapChain, ID3D11Device* device, ID3D11DeviceContext* context) public Dx11Renderer(IDXGISwapChain* swapChain, ID3D11Device* device, ID3D11DeviceContext* context)
{ {
var io = ImGui.GetIO(); var io = ImGui.GetIO();
if (ImGui.GetIO().NativePtr->BackendRendererName is not null) if (ImGui.GetIO().Handle->BackendRendererName is not null)
throw new InvalidOperationException("ImGui backend renderer seems to be have been already attached."); throw new InvalidOperationException("ImGui backend renderer seems to be have been already attached.");
try try
{ {
@ -81,7 +81,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
io.BackendFlags |= ImGuiBackendFlags.RendererHasVtxOffset | ImGuiBackendFlags.RendererHasViewports; io.BackendFlags |= ImGuiBackendFlags.RendererHasVtxOffset | ImGuiBackendFlags.RendererHasViewports;
this.renderNamePtr = Marshal.StringToHGlobalAnsi("imgui_impl_dx11_c#"); this.renderNamePtr = Marshal.StringToHGlobalAnsi("imgui_impl_dx11_c#");
io.NativePtr->BackendRendererName = (byte*)this.renderNamePtr; io.Handle->BackendRendererName = (byte*)this.renderNamePtr;
if (io.ConfigFlags.HasFlag(ImGuiConfigFlags.ViewportsEnable)) if (io.ConfigFlags.HasFlag(ImGuiConfigFlags.ViewportsEnable))
{ {
@ -102,7 +102,8 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
} }
this.mainViewport = ViewportData.Create(this, swapChain, null, null); this.mainViewport = ViewportData.Create(this, swapChain, null, null);
ImGui.GetPlatformIO().Viewports[0].RendererUserData = this.mainViewport.Handle; var vp = ImGui.GetPlatformIO().Viewports[0];
vp.RendererUserData = this.mainViewport.Handle;
} }
catch catch
{ {
@ -205,7 +206,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
this.device.Get()->CreateTexture2D(&texDesc, &subrdata, texture.GetAddressOf())); this.device.Get()->CreateTexture2D(&texDesc, &subrdata, texture.GetAddressOf()));
} }
} }
texture.Get()->SetDebugName($"Texture:{debugName}:SRV"); texture.Get()->SetDebugName($"Texture:{debugName}:SRV");
using var srvTemp = default(ComPtr<ID3D11ShaderResourceView>); using var srvTemp = default(ComPtr<ID3D11ShaderResourceView>);
@ -243,7 +244,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
if (!drawData.Valid || drawData.CmdListsCount == 0) if (!drawData.Valid || drawData.CmdListsCount == 0)
return; return;
var cmdLists = new Span<ImDrawListPtr>(drawData.NativePtr->CmdLists, drawData.NativePtr->CmdListsCount); var cmdLists = new Span<ImDrawListPtr>(drawData.Handle->CmdLists, drawData.Handle->CmdListsCount);
// Create and grow vertex/index buffers if needed // Create and grow vertex/index buffers if needed
if (this.vertexBufferSize < drawData.TotalVtxCount) if (this.vertexBufferSize < drawData.TotalVtxCount)
@ -298,8 +299,8 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
var targetIndices = new Span<ushort>(indexData.pData, this.indexBufferSize); var targetIndices = new Span<ushort>(indexData.pData, this.indexBufferSize);
foreach (ref var cmdList in cmdLists) foreach (ref var cmdList in cmdLists)
{ {
var vertices = new ImVectorWrapper<ImDrawVert>(&cmdList.NativePtr->VtxBuffer); var vertices = new ImVectorWrapper<ImDrawVert>(cmdList.Handle->VtxBuffer.ToUntyped());
var indices = new ImVectorWrapper<ushort>(&cmdList.NativePtr->IdxBuffer); var indices = new ImVectorWrapper<ushort>(cmdList.Handle->IdxBuffer.ToUntyped());
vertices.DataSpan.CopyTo(targetVertices); vertices.DataSpan.CopyTo(targetVertices);
indices.DataSpan.CopyTo(targetIndices); indices.DataSpan.CopyTo(targetIndices);
@ -346,7 +347,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
var clipOff = new Vector4(drawData.DisplayPos, drawData.DisplayPos.X, drawData.DisplayPos.Y); var clipOff = new Vector4(drawData.DisplayPos, drawData.DisplayPos.X, drawData.DisplayPos.Y);
foreach (ref var cmdList in cmdLists) foreach (ref var cmdList in cmdLists)
{ {
var cmds = new ImVectorWrapper<ImDrawCmd>(&cmdList.NativePtr->CmdBuffer); var cmds = new ImVectorWrapper<ImDrawCmd>(cmdList.Handle->CmdBuffer.ToUntyped());
foreach (ref var cmd in cmds.DataSpan) foreach (ref var cmd in cmds.DataSpan)
{ {
var clipV4 = cmd.ClipRect - clipOff; var clipV4 = cmd.ClipRect - clipOff;
@ -358,10 +359,10 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
this.context.Get()->RSSetScissorRects(1, &clipRect); this.context.Get()->RSSetScissorRects(1, &clipRect);
if (cmd.UserCallback == nint.Zero) if (cmd.UserCallback != null)
{ {
// Bind texture and draw // Bind texture and draw
var srv = (ID3D11ShaderResourceView*)cmd.TextureId; var srv = (ID3D11ShaderResourceView*)cmd.TextureId.Handle;
this.context.Get()->PSSetShader(this.pixelShader, null, 0); this.context.Get()->PSSetShader(this.pixelShader, null, 0);
this.context.Get()->PSSetSamplers(0, 1, this.sampler.GetAddressOf()); this.context.Get()->PSSetSamplers(0, 1, this.sampler.GetAddressOf());
this.context.Get()->PSSetShaderResources(0, 1, &srv); this.context.Get()->PSSetShaderResources(0, 1, &srv);
@ -397,13 +398,16 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
textureIndex < textureCount; textureIndex < textureCount;
textureIndex++) textureIndex++)
{ {
int width = 0, height = 0, bytespp = 0;
byte* fontPixels = null;
// Build texture atlas // Build texture atlas
io.Fonts.GetTexDataAsRGBA32( io.Fonts.GetTexDataAsRGBA32(
textureIndex, textureIndex,
out byte* fontPixels, &fontPixels,
out var width, ref width,
out var height, ref height,
out var bytespp); ref bytespp);
var tex = this.CreateTexture2D( var tex = this.CreateTexture2D(
new(fontPixels, width * height * bytespp), new(fontPixels, width * height * bytespp),
@ -539,7 +543,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
fixed (ID3D11SamplerState** ppSampler = &this.sampler.GetPinnableReference()) fixed (ID3D11SamplerState** ppSampler = &this.sampler.GetPinnableReference())
this.device.Get()->CreateSamplerState(&samplerDesc, ppSampler).ThrowOnError(); this.device.Get()->CreateSamplerState(&samplerDesc, ppSampler).ThrowOnError();
} }
// Create the constant buffer // Create the constant buffer
if (this.vertexConstantBuffer.IsEmpty()) if (this.vertexConstantBuffer.IsEmpty())
{ {
@ -630,14 +634,15 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
this.releaseUnmanagedResourceCalled = true; this.releaseUnmanagedResourceCalled = true;
this.mainViewport.Dispose(); this.mainViewport.Dispose();
ImGui.GetPlatformIO().Viewports[0].RendererUserData = nint.Zero; var vp = ImGui.GetPlatformIO().Viewports[0];
vp.RendererUserData = null;
ImGui.DestroyPlatformWindows(); ImGui.DestroyPlatformWindows();
this.viewportHandler.Dispose(); this.viewportHandler.Dispose();
var io = ImGui.GetIO(); var io = ImGui.GetIO();
if (io.NativePtr->BackendRendererName == (void*)this.renderNamePtr) if (io.Handle->BackendRendererName == (void*)this.renderNamePtr)
io.NativePtr->BackendRendererName = null; io.Handle->BackendRendererName = null;
if (this.renderNamePtr != 0) if (this.renderNamePtr != 0)
Marshal.FreeHGlobal(this.renderNamePtr); Marshal.FreeHGlobal(this.renderNamePtr);
@ -645,7 +650,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
fontResourceView.Dispose(); fontResourceView.Dispose();
foreach (var i in Enumerable.Range(0, io.Fonts.Textures.Size)) foreach (var i in Enumerable.Range(0, io.Fonts.Textures.Size))
io.Fonts.SetTexID(i, nint.Zero); io.Fonts.SetTexID(i, ImTextureID.Null);
this.device.Reset(); this.device.Reset();
this.context.Reset(); this.context.Reset();

View file

@ -3,7 +3,7 @@
using Dalamud.Interface.Textures; using Dalamud.Interface.Textures;
using Dalamud.Interface.Textures.TextureWraps; using Dalamud.Interface.Textures.TextureWraps;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiBackend.Renderers; namespace Dalamud.Interface.ImGuiBackend.Renderers;

View file

@ -5,7 +5,7 @@ using System.Numerics;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiFileDialog; namespace Dalamud.Interface.ImGuiFileDialog;
@ -397,7 +397,7 @@ public partial class FileDialog
ImGuiListClipperPtr clipper; ImGuiListClipperPtr clipper;
unsafe unsafe
{ {
clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper()); clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
} }
lock (this.filesLock) lock (this.filesLock)

View file

@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiFileDialog; namespace Dalamud.Interface.ImGuiFileDialog;

View file

@ -1,6 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiFileDialog; namespace Dalamud.Interface.ImGuiFileDialog;

View file

@ -5,6 +5,7 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Dalamud.Bindings.ImGui;
using Dalamud.Configuration.Internal; using Dalamud.Configuration.Internal;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.FontIdentifier; using Dalamud.Interface.FontIdentifier;
@ -12,9 +13,6 @@ using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Interface.ManagedFontAtlas.Internals; using Dalamud.Interface.ManagedFontAtlas.Internals;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET;
using TerraFX.Interop.DirectX; using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;
@ -89,7 +87,7 @@ public sealed class SingleFontChooserDialog : IDisposable
private bool popupSizeChanged; private bool popupSizeChanged;
private Vector2 popupPosition = new(float.NaN); private Vector2 popupPosition = new(float.NaN);
private Vector2 popupSize = new(float.NaN); private Vector2 popupSize = new(float.NaN);
/// <summary>Initializes a new instance of the <see cref="SingleFontChooserDialog"/> class.</summary> /// <summary>Initializes a new instance of the <see cref="SingleFontChooserDialog"/> class.</summary>
/// <param name="uiBuilder">The relevant instance of UiBuilder.</param> /// <param name="uiBuilder">The relevant instance of UiBuilder.</param>
/// <param name="isGlobalScaled">Whether the fonts in the atlas is global scaled.</param> /// <param name="isGlobalScaled">Whether the fonts in the atlas is global scaled.</param>
@ -274,7 +272,7 @@ public sealed class SingleFontChooserDialog : IDisposable
return new Vector2(40, 30) * ImGui.GetTextLineHeight(); return new Vector2(40, 30) * ImGui.GetTextLineHeight();
} }
/// <inheritdoc/> /// <inheritdoc/>
public void Dispose() public void Dispose()
{ {
this.fontHandle?.Dispose(); this.fontHandle?.Dispose();
@ -432,7 +430,7 @@ public sealed class SingleFontChooserDialog : IDisposable
this.firstDrawAfterRefresh = false; this.firstDrawAfterRefresh = false;
} }
private static float GetDistanceFromMonitor(Vector2 point, ImGuiPlatformMonitorPtr monitor) private static float GetDistanceFromMonitor(Vector2 point, ImGuiPlatformMonitor monitor)
{ {
var lt = monitor.MainPos; var lt = monitor.MainPos;
var rb = monitor.MainPos + monitor.MainSize; var rb = monitor.MainPos + monitor.MainSize;
@ -565,7 +563,7 @@ public sealed class SingleFontChooserDialog : IDisposable
fixed (byte* buf = this.fontPreviewText) fixed (byte* buf = this.fontPreviewText)
fixed (byte* label = "##fontPreviewText"u8) fixed (byte* label = "##fontPreviewText"u8)
{ {
ImGuiNative.igInputTextMultiline( ImGui.InputTextMultiline(
label, label,
buf, buf,
(uint)this.fontPreviewText.Length, (uint)this.fontPreviewText.Length,
@ -691,7 +689,7 @@ public sealed class SingleFontChooserDialog : IDisposable
if (ImGui.BeginChild("##familyList", ImGui.GetContentRegionAvail())) if (ImGui.BeginChild("##familyList", ImGui.GetContentRegionAvail()))
{ {
var clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper()); var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
var lineHeight = ImGui.GetTextLineHeightWithSpacing(); var lineHeight = ImGui.GetTextLineHeightWithSpacing();
if ((changed || this.firstDrawAfterRefresh) && this.selectedFamilyIndex != -1) if ((changed || this.firstDrawAfterRefresh) && this.selectedFamilyIndex != -1)
@ -858,7 +856,7 @@ public sealed class SingleFontChooserDialog : IDisposable
if (ImGui.BeginChild("##fontList")) if (ImGui.BeginChild("##fontList"))
{ {
var clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper()); var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
var lineHeight = ImGui.GetTextLineHeightWithSpacing(); var lineHeight = ImGui.GetTextLineHeightWithSpacing();
if ((changed || this.firstDrawAfterRefresh) && this.selectedFontIndex != -1) if ((changed || this.firstDrawAfterRefresh) && this.selectedFontIndex != -1)
@ -962,7 +960,7 @@ public sealed class SingleFontChooserDialog : IDisposable
if (ImGui.BeginChild("##fontSizeList")) if (ImGui.BeginChild("##fontSizeList"))
{ {
var clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper()); var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
var lineHeight = ImGui.GetTextLineHeightWithSpacing(); var lineHeight = ImGui.GetTextLineHeightWithSpacing();
if (changed && this.selectedFontIndex != -1) if (changed && this.selectedFontIndex != -1)
@ -1149,7 +1147,7 @@ public sealed class SingleFontChooserDialog : IDisposable
return 0; return 0;
}); });
if (stylePushed) if (stylePushed)
ImGui.PopStyleColor(); ImGui.PopStyleColor();

View file

@ -5,7 +5,7 @@ using Dalamud.Interface.Internal;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiNotification.Internal; namespace Dalamud.Interface.ImGuiNotification.Internal;
@ -88,7 +88,11 @@ internal sealed partial class ActiveNotification
if (!isTakingKeyboardInput && !isHovered && isFocused) if (!isTakingKeyboardInput && !isHovered && isFocused)
{ {
ImGui.SetWindowFocus(null); unsafe
{
ImGui.SetWindowFocus((byte*)null);
}
isFocused = false; isFocused = false;
} }
@ -529,9 +533,9 @@ internal sealed partial class ActiveNotification
verts[vertPtr++] = lastOff; verts[vertPtr++] = lastOff;
unsafe unsafe
{ {
var dlist = ImGui.GetWindowDrawList().NativePtr; var dlist = ImGui.GetWindowDrawList().Handle;
fixed (Vector2* pvert = verts) fixed (Vector2* pvert = verts)
ImGuiNative.ImDrawList_AddConvexPolyFilled(dlist, pvert, vertPtr, color); dlist->AddConvexPolyFilled(pvert, vertPtr, color);
} }
} }

View file

@ -11,7 +11,7 @@ using Dalamud.IoC.Internal;
using Dalamud.Plugin.Internal.Types; using Dalamud.Plugin.Internal.Types;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiNotification.Internal; namespace Dalamud.Interface.ImGuiNotification.Internal;

View file

@ -13,7 +13,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Plugin.Internal.Types; using Dalamud.Plugin.Internal.Types;
using Dalamud.Storage.Assets; using Dalamud.Storage.Assets;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiNotification; namespace Dalamud.Interface.ImGuiNotification;
@ -56,7 +56,7 @@ public static class NotificationUtilities
using (fontHandle.Push()) using (fontHandle.Push())
{ {
var font = ImGui.GetFont(); var font = ImGui.GetFont();
var glyphPtr = (ImGuiHelpers.ImFontGlyphReal*)font.FindGlyphNoFallback(c).NativePtr; var glyphPtr = (ImGuiHelpers.ImFontGlyphReal*)font.FindGlyphNoFallback(c);
if (glyphPtr is null) if (glyphPtr is null)
return false; return false;

View file

@ -15,7 +15,7 @@ using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.System.String; using FFXIVClientStructs.FFXIV.Client.System.String;
using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Lumina.Excel.Sheets; using Lumina.Excel.Sheets;
using Lumina.Text; using Lumina.Text;
@ -58,7 +58,7 @@ internal unsafe class SeStringRenderer : IInternalDisposableService
private readonly SeStringColorStackSet colorStackSet; private readonly SeStringColorStackSet colorStackSet;
/// <summary>Splits a draw list so that different layers of a single glyph can be drawn out of order.</summary> /// <summary>Splits a draw list so that different layers of a single glyph can be drawn out of order.</summary>
private ImDrawListSplitter* splitter = ImGuiNative.ImDrawListSplitter_ImDrawListSplitter(); private ImDrawListSplitter* splitter = ImGui.ImDrawListSplitter();
[ServiceManager.ServiceConstructor] [ServiceManager.ServiceConstructor]
private SeStringRenderer(DataManager dm, TargetSigScanner sigScanner) private SeStringRenderer(DataManager dm, TargetSigScanner sigScanner)
@ -146,15 +146,25 @@ internal unsafe class SeStringRenderer : IInternalDisposableService
size = Vector2.Max(size, fragment.Offset + new Vector2(fragment.VisibleWidth, state.LineHeight)); size = Vector2.Max(size, fragment.Offset + new Vector2(fragment.VisibleWidth, state.LineHeight));
// If we're not drawing at all, stop further processing. // If we're not drawing at all, stop further processing.
if (state.DrawList.NativePtr is null) if (state.DrawList.Handle is null)
return new() { Size = size }; return new() { Size = size };
state.SplitDrawList(); state.SplitDrawList();
// Handle cases where ImGui.AlignTextToFramePadding has been called. // Handle cases where ImGui.AlignTextToFramePadding has been called.
var pCurrentWindow = *(nint*)(ImGui.GetCurrentContext() + ImGuiContextCurrentWindowOffset); var context = ImGui.GetCurrentContext();
var pWindowDc = pCurrentWindow + ImGuiWindowDcOffset; var currLineTextBaseOffset = 0f;
var currLineTextBaseOffset = *(float*)(pWindowDc + ImGuiWindowTempDataCurrLineTextBaseOffset); /*
if (!context.IsNull)
{
var currentWindow = context.CurrentWindow;
if (!currentWindow.IsNull)
{
currLineTextBaseOffset = currentWindow.DC.CurrLineTextBaseOffset;
}
}
*/
var itemSize = size; var itemSize = size;
if (currLineTextBaseOffset != 0f) if (currLineTextBaseOffset != 0f)
{ {
@ -280,7 +290,7 @@ internal unsafe class SeStringRenderer : IInternalDisposableService
{ {
if (this.splitter is not null) if (this.splitter is not null)
{ {
ImGuiNative.ImDrawListSplitter_destroy(this.splitter); this.splitter->Destroy();
this.splitter = null; this.splitter = null;
} }
} }
@ -295,7 +305,7 @@ internal unsafe class SeStringRenderer : IInternalDisposableService
var link = -1; var link = -1;
foreach (var (breakAt, mandatory) in new LineBreakEnumerator(state.Span, UtfEnumeratorFlags.Utf8SeString)) foreach (var (breakAt, mandatory) in new LineBreakEnumerator(state.Span, UtfEnumeratorFlags.Utf8SeString))
{ {
// Might have happened if custom entity was longer than the previous break unit. // Might have happened if custom entity was longer than the previous break unit.
if (prev > breakAt) if (prev > breakAt)
continue; continue;
@ -487,7 +497,7 @@ internal unsafe class SeStringRenderer : IInternalDisposableService
if (gfdTextureSrv != 0) if (gfdTextureSrv != 0)
{ {
state.Draw( state.Draw(
gfdTextureSrv, new ImTextureID(gfdTextureSrv),
offset + new Vector2(x, MathF.Round((state.LineHeight - size.Y) / 2)), offset + new Vector2(x, MathF.Round((state.LineHeight - size.Y) / 2)),
size, size,
useHq ? gfdEntry.HqUv0 : gfdEntry.Uv0, useHq ? gfdEntry.HqUv0 : gfdEntry.Uv0,

View file

@ -1,6 +1,6 @@
using System.Numerics; using System.Numerics;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Lumina.Text.Payloads; using Lumina.Text.Payloads;
@ -105,8 +105,8 @@ public record struct SeStringDrawParams
/// <summary>Gets the effective font.</summary> /// <summary>Gets the effective font.</summary>
internal readonly unsafe ImFont* EffectiveFont => internal readonly unsafe ImFont* EffectiveFont =>
(this.Font ?? ImGui.GetFont()) is var f && f.NativePtr is not null (this.Font ?? ImGui.GetFont()) is var f && f.Handle is not null
? f.NativePtr ? f.Handle
: throw new ArgumentException("Specified font is empty."); : throw new ArgumentException("Specified font is empty.");
/// <summary>Gets the effective line height in pixels.</summary> /// <summary>Gets the effective line height in pixels.</summary>

View file

@ -8,7 +8,7 @@ using Dalamud.Interface.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Lumina.Text.Payloads; using Lumina.Text.Payloads;
using Lumina.Text.ReadOnly; using Lumina.Text.ReadOnly;
@ -150,7 +150,7 @@ public unsafe ref struct SeStringDrawState
/// <param name="channelIndex">Channel to switch to.</param> /// <param name="channelIndex">Channel to switch to.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly void SetCurrentChannel(SeStringDrawChannel channelIndex) => public readonly void SetCurrentChannel(SeStringDrawChannel channelIndex) =>
ImGuiNative.ImDrawListSplitter_SetCurrentChannel(this.splitter, this.drawList, (int)channelIndex); this.splitter->SetCurrentChannel(this.drawList, (int)channelIndex);
/// <summary>Draws a single texture.</summary> /// <summary>Draws a single texture.</summary>
/// <param name="igTextureId">ImGui texture ID to draw from.</param> /// <param name="igTextureId">ImGui texture ID to draw from.</param>
@ -160,7 +160,7 @@ public unsafe ref struct SeStringDrawState
/// <param name="uv1">Right bottom corner of the glyph w.r.t. its glyph origin in the source texture.</param> /// <param name="uv1">Right bottom corner of the glyph w.r.t. its glyph origin in the source texture.</param>
/// <param name="color">Color of the glyph in RGBA.</param> /// <param name="color">Color of the glyph in RGBA.</param>
public readonly void Draw( public readonly void Draw(
nint igTextureId, ImTextureID igTextureId,
Vector2 offset, Vector2 offset,
Vector2 size, Vector2 size,
Vector2 uv0, Vector2 uv0,
@ -193,7 +193,7 @@ public unsafe ref struct SeStringDrawState
/// top and bottom pixels to apply faux italicization by <see cref="Vector2.X"/> and <see cref="Vector2.Y"/> /// top and bottom pixels to apply faux italicization by <see cref="Vector2.X"/> and <see cref="Vector2.Y"/>
/// respectively.</param> /// respectively.</param>
public readonly void Draw( public readonly void Draw(
nint igTextureId, ImTextureID igTextureId,
Vector2 offset, Vector2 offset,
Vector2 xy0, Vector2 xy0,
Vector2 xy1, Vector2 xy1,
@ -305,7 +305,7 @@ public unsafe ref struct SeStringDrawState
internal readonly ref ImGuiHelpers.ImFontGlyphReal FindGlyph(Rune rune) internal readonly ref ImGuiHelpers.ImFontGlyphReal FindGlyph(Rune rune)
{ {
var p = rune.Value is >= ushort.MinValue and < ushort.MaxValue var p = rune.Value is >= ushort.MinValue and < ushort.MaxValue
? ImGuiNative.ImFont_FindGlyph(this.Font, (ushort)rune.Value) ? this.Font->FindGlyph((ushort)rune.Value)
: this.Font->FallbackGlyph; : this.Font->FallbackGlyph;
return ref *(ImGuiHelpers.ImFontGlyphReal*)p; return ref *(ImGuiHelpers.ImFontGlyphReal*)p;
} }
@ -340,8 +340,7 @@ public unsafe ref struct SeStringDrawState
return 0; return 0;
return MathF.Round( return MathF.Round(
ImGuiNative.ImFont_GetDistanceAdjustmentForPair( this.Font->GetDistanceAdjustmentForPair(
this.Font,
(ushort)left.Value, (ushort)left.Value,
(ushort)right.Value) * this.FontSizeScale); (ushort)right.Value) * this.FontSizeScale);
} }
@ -398,9 +397,9 @@ public unsafe ref struct SeStringDrawState
/// <summary>Splits the draw list.</summary> /// <summary>Splits the draw list.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal readonly void SplitDrawList() => internal readonly void SplitDrawList() =>
ImGuiNative.ImDrawListSplitter_Split(this.splitter, this.drawList, ChannelCount); this.splitter->Split(this.drawList, ChannelCount);
/// <summary>Merges the draw list.</summary> /// <summary>Merges the draw list.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal readonly void MergeDrawList() => ImGuiNative.ImDrawListSplitter_Merge(this.splitter, this.drawList); internal readonly void MergeDrawList() => this.splitter->Merge(this.drawList);
} }

View file

@ -140,12 +140,6 @@ internal class DalamudCommands : IServiceType
"Open Dalamud's startup timing profiler."), "Open Dalamud's startup timing profiler."),
}); });
commandManager.AddHandler("/imdebug", new CommandInfo(this.OnDebugImInfoCommand)
{
HelpMessage = "ImGui DEBUG",
ShowInHelp = false,
});
commandManager.AddHandler("/xlcopylog", new CommandInfo(this.OnCopyLogCommand) commandManager.AddHandler("/xlcopylog", new CommandInfo(this.OnCopyLogCommand)
{ {
HelpMessage = Loc.Localize( HelpMessage = Loc.Localize(
@ -300,29 +294,6 @@ internal class DalamudCommands : IServiceType
Service<DalamudInterface>.Get().ToggleLogWindow(); Service<DalamudInterface>.Get().ToggleLogWindow();
} }
private void OnDebugImInfoCommand(string command, string arguments)
{
var io = Service<InterfaceManager>.Get().LastImGuiIoPtr;
var info = $"WantCaptureKeyboard: {io.WantCaptureKeyboard}\n";
info += $"WantCaptureMouse: {io.WantCaptureMouse}\n";
info += $"WantSetMousePos: {io.WantSetMousePos}\n";
info += $"WantTextInput: {io.WantTextInput}\n";
info += $"WantSaveIniSettings: {io.WantSaveIniSettings}\n";
info += $"BackendFlags: {(int)io.BackendFlags}\n";
info += $"DeltaTime: {io.DeltaTime}\n";
info += $"DisplaySize: {io.DisplaySize.X} {io.DisplaySize.Y}\n";
info += $"Framerate: {io.Framerate}\n";
info += $"MetricsActiveWindows: {io.MetricsActiveWindows}\n";
info += $"MetricsRenderWindows: {io.MetricsRenderWindows}\n";
info += $"MousePos: {io.MousePos.X} {io.MousePos.Y}\n";
info += $"MouseClicked: {io.MouseClicked}\n";
info += $"MouseDown: {io.MouseDown}\n";
info += $"NavActive: {io.NavActive}\n";
info += $"NavVisible: {io.NavVisible}\n";
Log.Information(info);
}
private void OnVersionInfoCommand(string command, string arguments) private void OnVersionInfoCommand(string command, string arguments)
{ {
var chatGui = Service<ChatGui>.Get(); var chatGui = Service<ChatGui>.Get();

View file

@ -19,7 +19,7 @@ using Dalamud.Interface.GameFonts;
using Dalamud.Interface.ManagedFontAtlas.Internals; using Dalamud.Interface.ManagedFontAtlas.Internals;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
#if IMEDEBUG #if IMEDEBUG
using Serilog; using Serilog;
@ -136,7 +136,8 @@ internal sealed unsafe class DalamudIme : IInternalDisposableService
this.interfaceManager = imws.Manager; this.interfaceManager = imws.Manager;
this.setPlatformImeDataDelegate = this.ImGuiSetPlatformImeData; this.setPlatformImeDataDelegate = this.ImGuiSetPlatformImeData;
ImGui.GetIO().SetPlatformImeDataFn = Marshal.GetFunctionPointerForDelegate(this.setPlatformImeDataDelegate); var io = ImGui.GetIO();
io.SetPlatformImeDataFn = Marshal.GetFunctionPointerForDelegate(this.setPlatformImeDataDelegate).ToPointer();
this.interfaceManager.Draw += this.Draw; this.interfaceManager.Draw += this.Draw;
this.wndProcHookManager.PreWndProc += this.WndProcHookManagerOnPreWndProc; this.wndProcHookManager.PreWndProc += this.WndProcHookManagerOnPreWndProc;
} }
@ -278,7 +279,10 @@ internal sealed unsafe class DalamudIme : IInternalDisposableService
private void ReleaseUnmanagedResources() private void ReleaseUnmanagedResources()
{ {
if (ImGuiHelpers.IsImGuiInitialized) if (ImGuiHelpers.IsImGuiInitialized)
ImGui.GetIO().SetPlatformImeDataFn = nint.Zero; {
var io = ImGui.GetIO();
io.SetPlatformImeDataFn = null;
}
} }
private void WndProcHookManagerOnPreWndProc(WndProcEventArgs args) private void WndProcHookManagerOnPreWndProc(WndProcEventArgs args)
@ -477,7 +481,7 @@ internal sealed unsafe class DalamudIme : IInternalDisposableService
if (!string.IsNullOrEmpty(ImmGetCompositionString(hImc, GCS.GCS_COMPSTR))) if (!string.IsNullOrEmpty(ImmGetCompositionString(hImc, GCS.GCS_COMPSTR)))
{ {
ImmNotifyIME(hImc, NI.NI_COMPOSITIONSTR, CPS_COMPLETE, 0); ImmNotifyIME(hImc, NI.NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
// Disable further handling of mouse button down event, or something would lock up the cursor. // Disable further handling of mouse button down event, or something would lock up the cursor.
args.SuppressWithValue(1); args.SuppressWithValue(1);
} }
@ -670,7 +674,7 @@ internal sealed unsafe class DalamudIme : IInternalDisposableService
return; return;
var viewport = ime.associatedViewport; var viewport = ime.associatedViewport;
if (viewport.NativePtr is null) if (viewport.Handle is null)
return; return;
var drawCand = ime.candidateStrings.Count != 0; var drawCand = ime.candidateStrings.Count != 0;

View file

@ -40,9 +40,9 @@ using FFXIVClientStructs.FFXIV.Client.System.Framework;
using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Dalamud.Bindings.ImPlot;
using ImPlotNET;
using PInvoke; using PInvoke;
using Serilog.Events; using Serilog.Events;
@ -580,7 +580,10 @@ internal class DalamudInterface : IInternalDisposableService
var io = ImGui.GetIO(); var io = ImGui.GetIO();
if (!io.WantCaptureMouse && (User32.GetKeyState((int)User32.VirtualKey.VK_LBUTTON) & 0x8000) != 0) if (!io.WantCaptureMouse && (User32.GetKeyState((int)User32.VirtualKey.VK_LBUTTON) & 0x8000) != 0)
{ {
ImGui.SetWindowFocus(null); unsafe
{
ImGui.SetWindowFocus((byte*)null);
}
} }
} }
catch (Exception ex) catch (Exception ex)
@ -661,7 +664,7 @@ internal class DalamudInterface : IInternalDisposableService
} }
} }
private void DrawDevMenu() private unsafe void DrawDevMenu()
{ {
if (this.isImGuiDrawDevMenu) if (this.isImGuiDrawDevMenu)
{ {
@ -702,7 +705,7 @@ internal class DalamudInterface : IInternalDisposableService
} }
var logSynchronously = this.configuration.LogSynchronously; var logSynchronously = this.configuration.LogSynchronously;
if (ImGui.MenuItem("Log Synchronously", null, ref logSynchronously)) if (ImGui.MenuItem("Log Synchronously", (byte*)null, ref logSynchronously))
{ {
this.configuration.LogSynchronously = logSynchronously; this.configuration.LogSynchronously = logSynchronously;
this.configuration.QueueSave(); this.configuration.QueueSave();
@ -715,7 +718,7 @@ internal class DalamudInterface : IInternalDisposableService
} }
var antiDebug = Service<AntiDebug>.Get(); var antiDebug = Service<AntiDebug>.Get();
if (ImGui.MenuItem("Disable Debugging Protections", null, antiDebug.IsEnabled)) if (ImGui.MenuItem("Disable Debugging Protections", (byte*)null, antiDebug.IsEnabled))
{ {
var newEnabled = !antiDebug.IsEnabled; var newEnabled = !antiDebug.IsEnabled;
if (newEnabled) if (newEnabled)
@ -854,7 +857,7 @@ internal class DalamudInterface : IInternalDisposableService
ImGui.EndMenu(); ImGui.EndMenu();
} }
if (ImGui.MenuItem("Report crashes at shutdown", null, this.configuration.ReportShutdownCrashes)) if (ImGui.MenuItem("Report crashes at shutdown", (byte*)null, this.configuration.ReportShutdownCrashes))
{ {
this.configuration.ReportShutdownCrashes = !this.configuration.ReportShutdownCrashes; this.configuration.ReportShutdownCrashes = !this.configuration.ReportShutdownCrashes;
this.configuration.QueueSave(); this.configuration.QueueSave();
@ -896,7 +899,7 @@ internal class DalamudInterface : IInternalDisposableService
} }
var assertsEnabled = this.configuration.ImGuiAssertsEnabledAtStartup ?? false; var assertsEnabled = this.configuration.ImGuiAssertsEnabledAtStartup ?? false;
if (ImGui.MenuItem("Enable asserts at startup", null, assertsEnabled)) if (ImGui.MenuItem("Enable asserts at startup", (byte*)null, assertsEnabled))
{ {
this.configuration.ImGuiAssertsEnabledAtStartup = !assertsEnabled; this.configuration.ImGuiAssertsEnabledAtStartup = !assertsEnabled;
this.configuration.QueueSave(); this.configuration.QueueSave();
@ -906,7 +909,7 @@ internal class DalamudInterface : IInternalDisposableService
if (ImGui.MenuItem("Clear focus")) if (ImGui.MenuItem("Clear focus"))
{ {
ImGui.SetWindowFocus(null); ImGui.SetWindowFocus((byte*)null);
} }
if (ImGui.MenuItem("Clear stacks")) if (ImGui.MenuItem("Clear stacks"))
@ -947,7 +950,7 @@ internal class DalamudInterface : IInternalDisposableService
Log.Information(info); Log.Information(info);
} }
if (ImGui.MenuItem("Show dev bar info", null, this.configuration.ShowDevBarInfo)) if (ImGui.MenuItem("Show dev bar info", (byte*)null, this.configuration.ShowDevBarInfo))
{ {
this.configuration.ShowDevBarInfo = !this.configuration.ShowDevBarInfo; this.configuration.ShowDevBarInfo = !this.configuration.ShowDevBarInfo;
} }
@ -1018,12 +1021,12 @@ internal class DalamudInterface : IInternalDisposableService
ImGui.Separator(); ImGui.Separator();
if (ImGui.MenuItem("Load all API levels (ONLY FOR DEVELOPERS!!!)", null, pluginManager.LoadAllApiLevels)) if (ImGui.MenuItem("Load all API levels", (byte*)null, pluginManager.LoadAllApiLevels))
{ {
pluginManager.LoadAllApiLevels = !pluginManager.LoadAllApiLevels; pluginManager.LoadAllApiLevels = !pluginManager.LoadAllApiLevels;
} }
if (ImGui.MenuItem("Load blacklisted plugins", null, pluginManager.LoadBannedPlugins)) if (ImGui.MenuItem("Load blacklisted plugins", (byte*)null, pluginManager.LoadBannedPlugins))
{ {
pluginManager.LoadBannedPlugins = !pluginManager.LoadBannedPlugins; pluginManager.LoadBannedPlugins = !pluginManager.LoadBannedPlugins;
} }

View file

@ -4,7 +4,7 @@ using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.DesignSystem; namespace Dalamud.Interface.Internal.DesignSystem;
@ -45,7 +45,7 @@ internal static partial class DalamudComponents
return Button(text); return Button(text);
} }
} }
private static bool Button(string text) private static bool Button(string text)
{ {
using (ImRaii.PushStyle(ImGuiStyleVar.FramePadding, ButtonPadding)) using (ImRaii.PushStyle(ImGuiStyleVar.FramePadding, ButtonPadding))

View file

@ -9,7 +9,7 @@ using Dalamud.Plugin.Internal;
using Dalamud.Plugin.Internal.Types; using Dalamud.Plugin.Internal.Types;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.DesignSystem; namespace Dalamud.Interface.Internal.DesignSystem;

View file

@ -8,7 +8,7 @@ using Dalamud.Game.Gui.Toast;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Logging.Internal; using Dalamud.Logging.Internal;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;
@ -38,13 +38,13 @@ namespace Dalamud.Interface.Internal;
internal sealed unsafe class ImGuiClipboardFunctionProvider : IInternalDisposableService internal sealed unsafe class ImGuiClipboardFunctionProvider : IInternalDisposableService
{ {
private static readonly ModuleLog Log = new(nameof(ImGuiClipboardFunctionProvider)); private static readonly ModuleLog Log = new(nameof(ImGuiClipboardFunctionProvider));
private readonly nint clipboardUserDataOriginal; private readonly void* clipboardUserDataOriginal;
private readonly nint setTextOriginal; private readonly void* setTextOriginal;
private readonly nint getTextOriginal; private readonly void* getTextOriginal;
[ServiceManager.ServiceDependency] [ServiceManager.ServiceDependency]
private readonly ToastGui toastGui = Service<ToastGui>.Get(); private readonly ToastGui toastGui = Service<ToastGui>.Get();
private ImVectorWrapper<byte> clipboardData; private ImVectorWrapper<byte> clipboardData;
private GCHandle clipboardUserData; private GCHandle clipboardUserData;
@ -58,9 +58,9 @@ internal sealed unsafe class ImGuiClipboardFunctionProvider : IInternalDisposabl
this.clipboardUserDataOriginal = io.ClipboardUserData; this.clipboardUserDataOriginal = io.ClipboardUserData;
this.setTextOriginal = io.SetClipboardTextFn; this.setTextOriginal = io.SetClipboardTextFn;
this.getTextOriginal = io.GetClipboardTextFn; this.getTextOriginal = io.GetClipboardTextFn;
io.ClipboardUserData = GCHandle.ToIntPtr(this.clipboardUserData = GCHandle.Alloc(this)); io.ClipboardUserData = GCHandle.ToIntPtr(this.clipboardUserData = GCHandle.Alloc(this)).ToPointer();
io.SetClipboardTextFn = (nint)(delegate* unmanaged<nint, byte*, void>)&StaticSetClipboardTextImpl; io.SetClipboardTextFn = (delegate* unmanaged<nint, byte*, void>)&StaticSetClipboardTextImpl;
io.GetClipboardTextFn = (nint)(delegate* unmanaged<nint, byte*>)&StaticGetClipboardTextImpl; io.GetClipboardTextFn = (delegate* unmanaged<nint, byte*>)&StaticGetClipboardTextImpl;
this.clipboardData = new(0); this.clipboardData = new(0);
return; return;
@ -118,7 +118,7 @@ internal sealed unsafe class ImGuiClipboardFunctionProvider : IInternalDisposabl
var hMem = GlobalAlloc(GMEM.GMEM_MOVEABLE, (nuint)((str.Length + 1) * 2)); var hMem = GlobalAlloc(GMEM.GMEM_MOVEABLE, (nuint)((str.Length + 1) * 2));
if (hMem == 0) if (hMem == 0)
throw new OutOfMemoryException(); throw new OutOfMemoryException();
var ptr = (char*)GlobalLock(hMem); var ptr = (char*)GlobalLock(hMem);
if (ptr == null) if (ptr == null)
{ {
@ -150,7 +150,7 @@ internal sealed unsafe class ImGuiClipboardFunctionProvider : IInternalDisposabl
private byte* GetClipboardTextImpl() private byte* GetClipboardTextImpl()
{ {
this.clipboardData.Clear(); this.clipboardData.Clear();
var formats = stackalloc uint[] { CF.CF_UNICODETEXT, CF.CF_TEXT }; var formats = stackalloc uint[] { CF.CF_UNICODETEXT, CF.CF_TEXT };
if (GetPriorityClipboardFormat(formats, 2) < 1 || !this.OpenClipboardOrShowError()) if (GetPriorityClipboardFormat(formats, 2) < 1 || !this.OpenClipboardOrShowError())
{ {

View file

@ -37,7 +37,7 @@ using Dalamud.Utility.Timing;
using FFXIVClientStructs.FFXIV.Client.Graphics.Environment; using FFXIVClientStructs.FFXIV.Client.Graphics.Environment;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using JetBrains.Annotations; using JetBrains.Annotations;
@ -826,7 +826,7 @@ internal partial class InterfaceManager : IInternalDisposableService
() => () =>
{ {
// Update the ImGui default font. // Update the ImGui default font.
ImGui.GetIO().NativePtr->FontDefault = fontLocked.ImFont; ImGui.GetIO().Handle->FontDefault = fontLocked.ImFont;
// Update the reference to the resources of the default font. // Update the reference to the resources of the default font.
this.defaultFontResourceLock?.Dispose(); this.defaultFontResourceLock?.Dispose();

View file

@ -10,7 +10,7 @@ using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.System.String; using FFXIVClientStructs.FFXIV.Client.System.String;
using FFXIVClientStructs.FFXIV.Client.UI.Misc; using FFXIVClientStructs.FFXIV.Client.UI.Misc;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Lumina.Text.ReadOnly; using Lumina.Text.ReadOnly;
@ -213,7 +213,7 @@ internal unsafe class UiDebug
ImGui.SameLine(); ImGui.SameLine();
Service<SeStringRenderer>.Get().Draw(textNode->NodeText); Service<SeStringRenderer>.Get().Draw(textNode->NodeText);
ImGui.InputText($"Replace Text##{(ulong)textNode:X}", new IntPtr(textNode->NodeText.StringPtr), (uint)textNode->NodeText.BufSize); ImGui.InputText($"Replace Text##{(ulong)textNode:X}", textNode->NodeText.StringPtr, (uint)textNode->NodeText.BufSize);
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.Button($"Encode##{(ulong)textNode:X}")) if (ImGui.Button($"Encode##{(ulong)textNode:X}"))
@ -301,7 +301,7 @@ internal unsafe class UiDebug
if (ImGui.TreeNode($"Texture##{(ulong)kernelTexture->D3D11ShaderResourceView:X}")) if (ImGui.TreeNode($"Texture##{(ulong)kernelTexture->D3D11ShaderResourceView:X}"))
{ {
ImGui.Image( ImGui.Image(
new IntPtr(kernelTexture->D3D11ShaderResourceView), new ImTextureID(kernelTexture->D3D11ShaderResourceView),
new Vector2(kernelTexture->ActualWidth, kernelTexture->ActualHeight)); new Vector2(kernelTexture->ActualWidth, kernelTexture->ActualHeight));
ImGui.TreePop(); ImGui.TreePop();
} }
@ -312,7 +312,7 @@ internal unsafe class UiDebug
$"Texture##{(ulong)textureInfo->AtkTexture.KernelTexture->D3D11ShaderResourceView:X}")) $"Texture##{(ulong)textureInfo->AtkTexture.KernelTexture->D3D11ShaderResourceView:X}"))
{ {
ImGui.Image( ImGui.Image(
new IntPtr(textureInfo->AtkTexture.KernelTexture->D3D11ShaderResourceView), new ImTextureID(textureInfo->AtkTexture.KernelTexture->D3D11ShaderResourceView),
new Vector2( new Vector2(
textureInfo->AtkTexture.KernelTexture->ActualWidth, textureInfo->AtkTexture.KernelTexture->ActualWidth,
textureInfo->AtkTexture.KernelTexture->ActualHeight)); textureInfo->AtkTexture.KernelTexture->ActualHeight));

View file

@ -5,7 +5,7 @@ using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType; using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;

View file

@ -5,7 +5,7 @@ using System.Numerics;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.FontAwesomeIcon; using static Dalamud.Interface.FontAwesomeIcon;
using static Dalamud.Interface.Internal.UiDebug2.ElementSelector; using static Dalamud.Interface.Internal.UiDebug2.ElementSelector;

View file

@ -4,10 +4,10 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static ImGuiNET.ImGuiTableColumnFlags; using static Dalamud.Bindings.ImGui.ImGuiTableColumnFlags;
using static ImGuiNET.ImGuiTableFlags; using static Dalamud.Bindings.ImGui.ImGuiTableFlags;
namespace Dalamud.Interface.Internal.UiDebug2.Browsing; namespace Dalamud.Interface.Internal.UiDebug2.Browsing;

View file

@ -1,7 +1,7 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui; using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;
using static Dalamud.Utility.Util; using static Dalamud.Utility.Util;

View file

@ -6,16 +6,16 @@ using Dalamud.Interface.Internal.UiDebug2.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.ColorHelpers; using static Dalamud.Interface.ColorHelpers;
using static Dalamud.Interface.FontAwesomeIcon; using static Dalamud.Interface.FontAwesomeIcon;
using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui; using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;
using static Dalamud.Interface.Utility.ImGuiHelpers; using static Dalamud.Interface.Utility.ImGuiHelpers;
using static ImGuiNET.ImGuiColorEditFlags; using static Dalamud.Bindings.ImGui.ImGuiColorEditFlags;
using static ImGuiNET.ImGuiInputTextFlags; using static Dalamud.Bindings.ImGui.ImGuiInputTextFlags;
using static ImGuiNET.ImGuiTableColumnFlags; using static Dalamud.Bindings.ImGui.ImGuiTableColumnFlags;
using static ImGuiNET.ImGuiTableFlags; using static Dalamud.Bindings.ImGui.ImGuiTableFlags;
namespace Dalamud.Interface.Internal.UiDebug2.Browsing; namespace Dalamud.Interface.Internal.UiDebug2.Browsing;
@ -266,7 +266,7 @@ internal unsafe partial class NineGridNodeTree
ImGui.Text("Ninegrid Offsets:"); ImGui.Text("Ninegrid Offsets:");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.SetNextItemWidth(150); ImGui.SetNextItemWidth(150);
if (ImGui.DragFloat2($"##{(nint)this.Node:X}ngOffsetLR", ref lr, 1, 0)) if (ImGui.DragFloat2($"##{(nint)this.Node:X}ngOffsetLR", ref lr, 1f, 0f))
{ {
this.NgNode->LeftOffset = (short)Math.Max(0, lr.X); this.NgNode->LeftOffset = (short)Math.Max(0, lr.X);
this.NgNode->RightOffset = (short)Math.Max(0, lr.Y); this.NgNode->RightOffset = (short)Math.Max(0, lr.Y);
@ -278,7 +278,7 @@ internal unsafe partial class NineGridNodeTree
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.SetNextItemWidth(150); ImGui.SetNextItemWidth(150);
if (ImGui.DragFloat2($"##{(nint)this.Node:X}ngOffsetTB", ref tb, 1, 0)) if (ImGui.DragFloat2($"##{(nint)this.Node:X}ngOffsetTB", ref tb, 1f, 0f))
{ {
this.NgNode->TopOffset = (short)Math.Max(0, tb.X); this.NgNode->TopOffset = (short)Math.Max(0, tb.X);
this.NgNode->BottomOffset = (short)Math.Max(0, tb.Y); this.NgNode->BottomOffset = (short)Math.Max(0, tb.Y);

View file

@ -5,15 +5,15 @@ using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.ColorHelpers; using static Dalamud.Interface.ColorHelpers;
using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui; using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;
using static Dalamud.Utility.Util; using static Dalamud.Utility.Util;
using static FFXIVClientStructs.FFXIV.Component.GUI.TextureType; using static FFXIVClientStructs.FFXIV.Component.GUI.TextureType;
using static ImGuiNET.ImGuiTableColumnFlags; using static Dalamud.Bindings.ImGui.ImGuiTableColumnFlags;
using static ImGuiNET.ImGuiTableFlags; using static Dalamud.Bindings.ImGui.ImGuiTableFlags;
using static ImGuiNET.ImGuiTreeNodeFlags; using static Dalamud.Bindings.ImGui.ImGuiTreeNodeFlags;
namespace Dalamud.Interface.Internal.UiDebug2.Browsing; namespace Dalamud.Interface.Internal.UiDebug2.Browsing;

View file

@ -1,7 +1,7 @@
using Dalamud.Interface.Internal.UiDebug2.Utility; using Dalamud.Interface.Internal.UiDebug2.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.ColorHelpers; using static Dalamud.Interface.ColorHelpers;
using static Dalamud.Utility.Util; using static Dalamud.Utility.Util;

View file

@ -2,13 +2,14 @@ using System.Linq;
using System.Numerics; using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using Dalamud.Interface.Internal.UiDebug2.Utility; using Dalamud.Interface.Internal.UiDebug2.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET;
using static Dalamud.Bindings.ImGui.ImGuiCol;
using static Dalamud.Bindings.ImGui.ImGuiTreeNodeFlags;
using static Dalamud.Interface.ColorHelpers; using static Dalamud.Interface.ColorHelpers;
using static Dalamud.Interface.FontAwesomeIcon; using static Dalamud.Interface.FontAwesomeIcon;
using static Dalamud.Interface.Internal.UiDebug2.Browsing.Events; using static Dalamud.Interface.Internal.UiDebug2.Browsing.Events;
@ -18,9 +19,6 @@ using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;
using static Dalamud.Utility.Util; using static Dalamud.Utility.Util;
using static FFXIVClientStructs.FFXIV.Component.GUI.NodeFlags; using static FFXIVClientStructs.FFXIV.Component.GUI.NodeFlags;
using static ImGuiNET.ImGuiCol;
using static ImGuiNET.ImGuiTreeNodeFlags;
namespace Dalamud.Interface.Internal.UiDebug2.Browsing; namespace Dalamud.Interface.Internal.UiDebug2.Browsing;
/// <summary> /// <summary>

View file

@ -9,7 +9,7 @@ using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.System.String; using FFXIVClientStructs.FFXIV.Client.System.String;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.ColorHelpers; using static Dalamud.Interface.ColorHelpers;
using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui; using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;

View file

@ -1,6 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.UiDebug2.Browsing; namespace Dalamud.Interface.Internal.UiDebug2.Browsing;

View file

@ -7,15 +7,15 @@ using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.Graphics; using FFXIVClientStructs.FFXIV.Client.Graphics;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.ColorHelpers; using static Dalamud.Interface.ColorHelpers;
using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui; using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;
using static Dalamud.Utility.Util; using static Dalamud.Utility.Util;
using static FFXIVClientStructs.FFXIV.Component.GUI.NodeType; using static FFXIVClientStructs.FFXIV.Component.GUI.NodeType;
using static ImGuiNET.ImGuiTableColumnFlags; using static Dalamud.Bindings.ImGui.ImGuiTableColumnFlags;
using static ImGuiNET.ImGuiTableFlags; using static Dalamud.Bindings.ImGui.ImGuiTableFlags;
using static ImGuiNET.ImGuiTreeNodeFlags; using static Dalamud.Bindings.ImGui.ImGuiTreeNodeFlags;
// ReSharper disable SuggestBaseTypeForParameter // ReSharper disable SuggestBaseTypeForParameter
namespace Dalamud.Interface.Internal.UiDebug2.Browsing; namespace Dalamud.Interface.Internal.UiDebug2.Browsing;

View file

@ -9,7 +9,7 @@ using Dalamud.Interface.Internal.UiDebug2.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static System.Globalization.NumberFormatInfo; using static System.Globalization.NumberFormatInfo;
@ -18,8 +18,8 @@ using static Dalamud.Interface.Internal.UiDebug2.UiDebug2;
using static Dalamud.Interface.UiBuilder; using static Dalamud.Interface.UiBuilder;
using static Dalamud.Interface.Utility.ImGuiHelpers; using static Dalamud.Interface.Utility.ImGuiHelpers;
using static FFXIVClientStructs.FFXIV.Component.GUI.NodeFlags; using static FFXIVClientStructs.FFXIV.Component.GUI.NodeFlags;
using static ImGuiNET.ImGuiCol; using static Dalamud.Bindings.ImGui.ImGuiCol;
using static ImGuiNET.ImGuiWindowFlags; using static Dalamud.Bindings.ImGui.ImGuiWindowFlags;
// ReSharper disable StructLacksIEquatable.Global // ReSharper disable StructLacksIEquatable.Global
#pragma warning disable CS0659 #pragma warning disable CS0659

View file

@ -3,7 +3,7 @@ using System.Numerics;
using Dalamud.Interface.Internal.UiDebug2.Browsing; using Dalamud.Interface.Internal.UiDebug2.Browsing;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.UiDebug2; namespace Dalamud.Interface.Internal.UiDebug2;

View file

@ -4,7 +4,7 @@ using Dalamud.Interface.Internal.UiDebug2.Browsing;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.Internal.UiDebug2.UiDebug2; using static Dalamud.Interface.Internal.UiDebug2.UiDebug2;

View file

@ -6,7 +6,7 @@ using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static System.StringComparison; using static System.StringComparison;
using static Dalamud.Interface.FontAwesomeIcon; using static Dalamud.Interface.FontAwesomeIcon;

View file

@ -9,9 +9,9 @@ using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static ImGuiNET.ImGuiWindowFlags; using static Dalamud.Bindings.ImGui.ImGuiWindowFlags;
namespace Dalamud.Interface.Internal.UiDebug2; namespace Dalamud.Interface.Internal.UiDebug2;

View file

@ -4,10 +4,10 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.Graphics; using FFXIVClientStructs.FFXIV.Client.Graphics;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.ColorHelpers; using static Dalamud.Interface.ColorHelpers;
using static ImGuiNET.ImGuiCol; using static Dalamud.Bindings.ImGui.ImGuiCol;
namespace Dalamud.Interface.Internal.UiDebug2.Utility; namespace Dalamud.Interface.Internal.UiDebug2.Utility;

View file

@ -4,7 +4,7 @@ using System.Numerics;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using static System.MathF; using static System.MathF;
using static Dalamud.Interface.ColorHelpers; using static Dalamud.Interface.ColorHelpers;

View file

@ -11,7 +11,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Networking.Http; using Dalamud.Networking.Http;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Dalamud.Interface.Internal.Windows; namespace Dalamud.Interface.Internal.Windows;

View file

@ -25,7 +25,7 @@ using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows; namespace Dalamud.Interface.Internal.Windows;
@ -35,7 +35,7 @@ namespace Dalamud.Interface.Internal.Windows;
internal sealed class ChangelogWindow : Window, IDisposable internal sealed class ChangelogWindow : Window, IDisposable
{ {
private const string WarrantsChangelogForMajorMinor = "10.0."; private const string WarrantsChangelogForMajorMinor = "10.0.";
private const string ChangeLog = private const string ChangeLog =
@"• Updated Dalamud for compatibility with Patch 7.0 @"• Updated Dalamud for compatibility with Patch 7.0
Made a lot of behind-the-scenes changes to make Dalamud and plugins more stable and reliable Made a lot of behind-the-scenes changes to make Dalamud and plugins more stable and reliable
@ -43,7 +43,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
Refreshed the Dalamud/plugin installer UI Refreshed the Dalamud/plugin installer UI
"; ";
private static readonly TimeSpan TitleScreenWaitTime = TimeSpan.FromSeconds(0.5f); private static readonly TimeSpan TitleScreenWaitTime = TimeSpan.FromSeconds(0.5f);
private readonly TitleScreenMenuWindow tsmWindow; private readonly TitleScreenMenuWindow tsmWindow;
@ -54,40 +54,40 @@ internal sealed class ChangelogWindow : Window, IDisposable
private readonly Lazy<IFontHandle> bannerFont; private readonly Lazy<IFontHandle> bannerFont;
private readonly Lazy<IDalamudTextureWrap> apiBumpExplainerTexture; private readonly Lazy<IDalamudTextureWrap> apiBumpExplainerTexture;
private readonly Lazy<IDalamudTextureWrap> logoTexture; private readonly Lazy<IDalamudTextureWrap> logoTexture;
private readonly InOutCubic windowFade = new(TimeSpan.FromSeconds(2.5f)) private readonly InOutCubic windowFade = new(TimeSpan.FromSeconds(2.5f))
{ {
Point1 = Vector2.Zero, Point1 = Vector2.Zero,
Point2 = new Vector2(2f), Point2 = new Vector2(2f),
}; };
private readonly InOutCubic bodyFade = new(TimeSpan.FromSeconds(0.8f)) private readonly InOutCubic bodyFade = new(TimeSpan.FromSeconds(0.8f))
{ {
Point1 = Vector2.Zero, Point1 = Vector2.Zero,
Point2 = Vector2.One, Point2 = Vector2.One,
}; };
private readonly InOutCubic titleFade = new(TimeSpan.FromSeconds(0.5f)) private readonly InOutCubic titleFade = new(TimeSpan.FromSeconds(0.5f))
{ {
Point1 = Vector2.Zero, Point1 = Vector2.Zero,
Point2 = Vector2.One, Point2 = Vector2.One,
}; };
private readonly InOutCubic fadeOut = new(TimeSpan.FromSeconds(0.5f)) private readonly InOutCubic fadeOut = new(TimeSpan.FromSeconds(0.5f))
{ {
Point1 = Vector2.One, Point1 = Vector2.One,
Point2 = Vector2.Zero, Point2 = Vector2.Zero,
}; };
private State state = State.WindowFadeIn; private State state = State.WindowFadeIn;
private bool needFadeRestart = false; private bool needFadeRestart = false;
private bool isFadingOutForStateChange = false; private bool isFadingOutForStateChange = false;
private State? stateAfterFadeOut; private State? stateAfterFadeOut;
private AutoUpdateBehavior? chosenAutoUpdateBehavior; private AutoUpdateBehavior? chosenAutoUpdateBehavior;
private Dictionary<string, int> currentFtueLevels = new(); private Dictionary<string, int> currentFtueLevels = new();
private DateTime? isEligibleSince; private DateTime? isEligibleSince;
@ -110,7 +110,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
: base("What's new in Dalamud?##ChangelogWindow", ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse, true) : base("What's new in Dalamud?##ChangelogWindow", ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse, true)
{ {
this.gameGui = gameGui; this.gameGui = gameGui;
this.tsmWindow = tsmWindow; this.tsmWindow = tsmWindow;
this.Namespace = "DalamudChangelogWindow"; this.Namespace = "DalamudChangelogWindow";
this.privateAtlas = this.scopedFinalizer.Add( this.privateAtlas = this.scopedFinalizer.Add(
@ -125,7 +125,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
// If we are going to show a changelog, make sure we have the font ready, otherwise it will hitch // If we are going to show a changelog, make sure we have the font ready, otherwise it will hitch
if (WarrantsChangelog()) if (WarrantsChangelog())
_ = this.bannerFont.Value; _ = this.bannerFont.Value;
framework.Update += this.FrameworkOnUpdate; framework.Update += this.FrameworkOnUpdate;
this.scopedFinalizer.Add(() => framework.Update -= this.FrameworkOnUpdate); this.scopedFinalizer.Add(() => framework.Update -= this.FrameworkOnUpdate);
} }
@ -138,7 +138,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
AskAutoUpdate, AskAutoUpdate,
Links, Links,
} }
/// <summary> /// <summary>
/// Check if a changelog should be shown. /// Check if a changelog should be shown.
/// </summary> /// </summary>
@ -163,7 +163,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
this.isFadingOutForStateChange = false; this.isFadingOutForStateChange = false;
this.stateAfterFadeOut = null; this.stateAfterFadeOut = null;
this.state = State.WindowFadeIn; this.state = State.WindowFadeIn;
this.windowFade.Reset(); this.windowFade.Reset();
this.bodyFade.Reset(); this.bodyFade.Reset();
@ -172,9 +172,9 @@ internal sealed class ChangelogWindow : Window, IDisposable
this.needFadeRestart = true; this.needFadeRestart = true;
this.chosenAutoUpdateBehavior = null; this.chosenAutoUpdateBehavior = null;
this.currentFtueLevels = Service<DalamudConfiguration>.Get().SeenFtueLevels; this.currentFtueLevels = Service<DalamudConfiguration>.Get().SeenFtueLevels;
base.OnOpen(); base.OnOpen();
} }
@ -182,17 +182,17 @@ internal sealed class ChangelogWindow : Window, IDisposable
public override void OnClose() public override void OnClose()
{ {
base.OnClose(); base.OnClose();
this.tsmWindow.AllowDrawing = true; this.tsmWindow.AllowDrawing = true;
Service<DalamudInterface>.Get().SetCreditsDarkeningAnimation(false); Service<DalamudInterface>.Get().SetCreditsDarkeningAnimation(false);
var configuration = Service<DalamudConfiguration>.Get(); var configuration = Service<DalamudConfiguration>.Get();
if (this.chosenAutoUpdateBehavior.HasValue) if (this.chosenAutoUpdateBehavior.HasValue)
{ {
configuration.AutoUpdateBehavior = this.chosenAutoUpdateBehavior.Value; configuration.AutoUpdateBehavior = this.chosenAutoUpdateBehavior.Value;
} }
configuration.SeenFtueLevels = this.currentFtueLevels; configuration.SeenFtueLevels = this.currentFtueLevels;
configuration.QueueSave(); configuration.QueueSave();
} }
@ -203,7 +203,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0); ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0);
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, Vector2.Zero); ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, Vector2.Zero);
ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 10f); ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 10f);
base.PreDraw(); base.PreDraw();
if (this.needFadeRestart) if (this.needFadeRestart)
@ -212,15 +212,15 @@ internal sealed class ChangelogWindow : Window, IDisposable
this.titleFade.Restart(); this.titleFade.Restart();
this.needFadeRestart = false; this.needFadeRestart = false;
} }
this.windowFade.Update(); this.windowFade.Update();
this.titleFade.Update(); this.titleFade.Update();
this.fadeOut.Update(); this.fadeOut.Update();
ImGui.SetNextWindowBgAlpha(Math.Clamp(this.windowFade.EasedPoint.X, 0, 0.9f)); ImGui.SetNextWindowBgAlpha(Math.Clamp(this.windowFade.EasedPoint.X, 0, 0.9f));
this.Size = new Vector2(900, 400); this.Size = new Vector2(900, 400);
this.SizeCondition = ImGuiCond.Always; this.SizeCondition = ImGuiCond.Always;
// Center the window on the main viewport // Center the window on the main viewport
var viewportPos = ImGuiHelpers.MainViewport.Pos; var viewportPos = ImGuiHelpers.MainViewport.Pos;
var viewportSize = ImGuiHelpers.MainViewport.Size; var viewportSize = ImGuiHelpers.MainViewport.Size;
@ -233,9 +233,9 @@ internal sealed class ChangelogWindow : Window, IDisposable
public override void PostDraw() public override void PostDraw()
{ {
ImGui.PopStyleVar(3); ImGui.PopStyleVar(3);
this.ResetMovieTimer(); this.ResetMovieTimer();
base.PostDraw(); base.PostDraw();
} }
@ -248,13 +248,13 @@ internal sealed class ChangelogWindow : Window, IDisposable
configuration.LastChangelogMajorMinor = WarrantsChangelogForMajorMinor; configuration.LastChangelogMajorMinor = WarrantsChangelogForMajorMinor;
configuration.QueueSave(); configuration.QueueSave();
} }
var windowSize = ImGui.GetWindowSize(); var windowSize = ImGui.GetWindowSize();
var dummySize = 10 * ImGuiHelpers.GlobalScale; var dummySize = 10 * ImGuiHelpers.GlobalScale;
ImGui.Dummy(new Vector2(dummySize)); ImGui.Dummy(new Vector2(dummySize));
ImGui.SameLine(); ImGui.SameLine();
var logoContainerSize = new Vector2(windowSize.X * 0.2f - dummySize, windowSize.Y); var logoContainerSize = new Vector2(windowSize.X * 0.2f - dummySize, windowSize.Y);
using (var child = ImRaii.Child("###logoContainer", logoContainerSize, false)) using (var child = ImRaii.Child("###logoContainer", logoContainerSize, false))
{ {
@ -262,23 +262,23 @@ internal sealed class ChangelogWindow : Window, IDisposable
return; return;
var logoSize = new Vector2(logoContainerSize.X); var logoSize = new Vector2(logoContainerSize.X);
// Center the logo in the container // Center the logo in the container
ImGui.SetCursorPos(new Vector2(logoContainerSize.X / 2 - logoSize.X / 2, logoContainerSize.Y / 2 - logoSize.Y / 2)); ImGui.SetCursorPos(new Vector2(logoContainerSize.X / 2 - logoSize.X / 2, logoContainerSize.Y / 2 - logoSize.Y / 2));
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, Math.Clamp(this.windowFade.EasedPoint.X - 0.5f, 0f, 1f))) using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, Math.Clamp(this.windowFade.EasedPoint.X - 0.5f, 0f, 1f)))
ImGui.Image(this.logoTexture.Value.ImGuiHandle, logoSize); ImGui.Image(this.logoTexture.Value.ImGuiHandle, logoSize);
} }
ImGui.SameLine(); ImGui.SameLine();
ImGui.Dummy(new Vector2(dummySize)); ImGui.Dummy(new Vector2(dummySize));
ImGui.SameLine(); ImGui.SameLine();
using (var child = ImRaii.Child("###textContainer", new Vector2((windowSize.X * 0.8f) - dummySize * 4, windowSize.Y), false)) using (var child = ImRaii.Child("###textContainer", new Vector2((windowSize.X * 0.8f) - dummySize * 4, windowSize.Y), false))
{ {
if (!child) if (!child)
return; return;
ImGuiHelpers.ScaledDummy(20); ImGuiHelpers.ScaledDummy(20);
var titleFadeVal = this.isFadingOutForStateChange ? this.fadeOut.EasedPoint.X : this.titleFade.EasedPoint.X; var titleFadeVal = this.isFadingOutForStateChange ? this.fadeOut.EasedPoint.X : this.titleFade.EasedPoint.X;
@ -292,21 +292,21 @@ internal sealed class ChangelogWindow : Window, IDisposable
case State.ExplainerIntro: case State.ExplainerIntro:
ImGuiHelpers.CenteredText("New And Improved"); ImGuiHelpers.CenteredText("New And Improved");
break; break;
case State.ExplainerApiBump: case State.ExplainerApiBump:
ImGuiHelpers.CenteredText("Plugin Updates"); ImGuiHelpers.CenteredText("Plugin Updates");
break; break;
case State.AskAutoUpdate: case State.AskAutoUpdate:
ImGuiHelpers.CenteredText("Auto-Updates"); ImGuiHelpers.CenteredText("Auto-Updates");
break; break;
case State.Links: case State.Links:
ImGuiHelpers.CenteredText("Enjoy!"); ImGuiHelpers.CenteredText("Enjoy!");
break; break;
} }
} }
ImGuiHelpers.ScaledDummy(8); ImGuiHelpers.ScaledDummy(8);
if (this.state == State.WindowFadeIn && this.windowFade.EasedPoint.X > 1.5f) if (this.state == State.WindowFadeIn && this.windowFade.EasedPoint.X > 1.5f)
@ -321,11 +321,11 @@ internal sealed class ChangelogWindow : Window, IDisposable
this.bodyFade.Restart(); this.bodyFade.Restart();
this.titleFade.Restart(); this.titleFade.Restart();
this.isFadingOutForStateChange = false; this.isFadingOutForStateChange = false;
this.stateAfterFadeOut = null; this.stateAfterFadeOut = null;
} }
this.bodyFade.Update(); this.bodyFade.Update();
var bodyFadeVal = this.isFadingOutForStateChange ? this.fadeOut.EasedPoint.X : this.bodyFade.EasedPoint.X; var bodyFadeVal = this.isFadingOutForStateChange ? this.fadeOut.EasedPoint.X : this.bodyFade.EasedPoint.X;
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, Math.Clamp(bodyFadeVal, 0, 1f))) using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, Math.Clamp(bodyFadeVal, 0, 1f)))
@ -334,10 +334,10 @@ internal sealed class ChangelogWindow : Window, IDisposable
{ {
this.isFadingOutForStateChange = true; this.isFadingOutForStateChange = true;
this.stateAfterFadeOut = nextState; this.stateAfterFadeOut = nextState;
this.fadeOut.Restart(); this.fadeOut.Restart();
} }
bool DrawNextButton(State nextState) bool DrawNextButton(State nextState)
{ {
// Draw big, centered next button at the bottom of the window // Draw big, centered next button at the bottom of the window
@ -346,7 +346,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
var buttonWidth = ImGui.CalcTextSize(buttonText).X + 40 * ImGuiHelpers.GlobalScale; var buttonWidth = ImGui.CalcTextSize(buttonText).X + 40 * ImGuiHelpers.GlobalScale;
ImGui.SetCursorPosY(windowSize.Y - buttonHeight - (20 * ImGuiHelpers.GlobalScale)); ImGui.SetCursorPosY(windowSize.Y - buttonHeight - (20 * ImGuiHelpers.GlobalScale));
ImGuiHelpers.CenterCursorFor((int)buttonWidth); ImGuiHelpers.CenterCursorFor((int)buttonWidth);
if (ImGui.Button(buttonText, new Vector2(buttonWidth, buttonHeight)) && !this.isFadingOutForStateChange) if (ImGui.Button(buttonText, new Vector2(buttonWidth, buttonHeight)) && !this.isFadingOutForStateChange)
{ {
GoToNextState(nextState); GoToNextState(nextState);
@ -355,7 +355,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
return false; return false;
} }
switch (this.state) switch (this.state)
{ {
case State.WindowFadeIn: case State.WindowFadeIn:
@ -366,10 +366,10 @@ internal sealed class ChangelogWindow : Window, IDisposable
ImGuiHelpers.ScaledDummy(5); ImGuiHelpers.ScaledDummy(5);
ImGui.TextWrapped("This changelog is a quick overview of the most important changes in this version."); ImGui.TextWrapped("This changelog is a quick overview of the most important changes in this version.");
ImGui.TextWrapped("Please click next to see a quick guide to updating your plugins."); ImGui.TextWrapped("Please click next to see a quick guide to updating your plugins.");
DrawNextButton(State.ExplainerApiBump); DrawNextButton(State.ExplainerApiBump);
break; break;
case State.ExplainerApiBump: case State.ExplainerApiBump:
ImGui.TextWrapped("Take care! Due to changes in this patch, all of your plugins need to be updated and were disabled automatically."); ImGui.TextWrapped("Take care! Due to changes in this patch, all of your plugins need to be updated and were disabled automatically.");
ImGui.TextWrapped("This is normal and required for major game updates."); ImGui.TextWrapped("This is normal and required for major game updates.");
@ -378,14 +378,14 @@ internal sealed class ChangelogWindow : Window, IDisposable
ImGuiHelpers.ScaledDummy(5); ImGuiHelpers.ScaledDummy(5);
ImGui.TextWrapped("Please keep in mind that not all of your plugins may already be updated for the new version."); ImGui.TextWrapped("Please keep in mind that not all of your plugins may already be updated for the new version.");
ImGui.TextWrapped("If some plugins are displayed with a red cross in the 'Installed Plugins' tab, they may not yet be available."); ImGui.TextWrapped("If some plugins are displayed with a red cross in the 'Installed Plugins' tab, they may not yet be available.");
ImGuiHelpers.ScaledDummy(15); ImGuiHelpers.ScaledDummy(15);
ImGuiHelpers.CenterCursorFor(this.apiBumpExplainerTexture.Value.Width); ImGuiHelpers.CenterCursorFor(this.apiBumpExplainerTexture.Value.Width);
ImGui.Image( ImGui.Image(
this.apiBumpExplainerTexture.Value.ImGuiHandle, this.apiBumpExplainerTexture.Value.ImGuiHandle,
this.apiBumpExplainerTexture.Value.Size); this.apiBumpExplainerTexture.Value.Size);
if (!this.currentFtueLevels.TryGetValue(FtueLevels.AutoUpdate.Name, out var autoUpdateLevel) || autoUpdateLevel < FtueLevels.AutoUpdate.AutoUpdateInitial) if (!this.currentFtueLevels.TryGetValue(FtueLevels.AutoUpdate.Name, out var autoUpdateLevel) || autoUpdateLevel < FtueLevels.AutoUpdate.AutoUpdateInitial)
{ {
if (DrawNextButton(State.AskAutoUpdate)) if (DrawNextButton(State.AskAutoUpdate))
@ -397,23 +397,23 @@ internal sealed class ChangelogWindow : Window, IDisposable
{ {
DrawNextButton(State.Links); DrawNextButton(State.Links);
} }
break; break;
case State.AskAutoUpdate: case State.AskAutoUpdate:
ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudWhite, Loc.Localize("DalamudSettingsAutoUpdateHint", ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudWhite, Loc.Localize("DalamudSettingsAutoUpdateHint",
"Dalamud can update your plugins automatically, making sure that you always " + "Dalamud can update your plugins automatically, making sure that you always " +
"have the newest features and bug fixes. You can choose when and how auto-updates are run here.")); "have the newest features and bug fixes. You can choose when and how auto-updates are run here."));
ImGuiHelpers.ScaledDummy(2); ImGuiHelpers.ScaledDummy(2);
ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsAutoUpdateDisclaimer1", ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsAutoUpdateDisclaimer1",
"You can always update your plugins manually by clicking the update button in the plugin list. " + "You can always update your plugins manually by clicking the update button in the plugin list. " +
"You can also opt into updates for specific plugins by right-clicking them and selecting \"Always auto-update\".")); "You can also opt into updates for specific plugins by right-clicking them and selecting \"Always auto-update\"."));
ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsAutoUpdateDisclaimer2", ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsAutoUpdateDisclaimer2",
"Dalamud will only notify you about updates while you are idle.")); "Dalamud will only notify you about updates while you are idle."));
ImGuiHelpers.ScaledDummy(15); ImGuiHelpers.ScaledDummy(15);
bool DrawCenteredButton(string text, float height) bool DrawCenteredButton(string text, float height)
{ {
var buttonHeight = height * ImGuiHelpers.GlobalScale; var buttonHeight = height * ImGuiHelpers.GlobalScale;
@ -427,97 +427,97 @@ internal sealed class ChangelogWindow : Window, IDisposable
using (ImRaii.PushColor(ImGuiCol.Button, ImGuiColors.DPSRed)) using (ImRaii.PushColor(ImGuiCol.Button, ImGuiColors.DPSRed))
{ {
if (DrawCenteredButton("Enable auto-updates", 30)) if (DrawCenteredButton("Enable auto-updates", 30))
{ {
this.chosenAutoUpdateBehavior = AutoUpdateBehavior.UpdateMainRepo; this.chosenAutoUpdateBehavior = AutoUpdateBehavior.UpdateMainRepo;
GoToNextState(State.Links); GoToNextState(State.Links);
} }
} }
ImGuiHelpers.ScaledDummy(2); ImGuiHelpers.ScaledDummy(2);
using (ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, 1)) using (ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, 1))
using (var buttonColor = ImRaii.PushColor(ImGuiCol.Button, Vector4.Zero)) using (var buttonColor = ImRaii.PushColor(ImGuiCol.Button, Vector4.Zero))
{ {
buttonColor.Push(ImGuiCol.Border, ImGuiColors.DalamudGrey3); buttonColor.Push(ImGuiCol.Border, ImGuiColors.DalamudGrey3);
if (DrawCenteredButton("Disable auto-updates", 25)) if (DrawCenteredButton("Disable auto-updates", 25))
{ {
this.chosenAutoUpdateBehavior = AutoUpdateBehavior.OnlyNotify; this.chosenAutoUpdateBehavior = AutoUpdateBehavior.OnlyNotify;
GoToNextState(State.Links); GoToNextState(State.Links);
} }
} }
break; break;
case State.Links: case State.Links:
ImGui.TextWrapped("If you note any issues or need help, please check the FAQ, and reach out on our Discord if you need help."); ImGui.TextWrapped("If you note any issues or need help, please check the FAQ, and reach out on our Discord if you need help.");
ImGui.TextWrapped("Enjoy your time with the game and Dalamud!"); ImGui.TextWrapped("Enjoy your time with the game and Dalamud!");
ImGuiHelpers.ScaledDummy(45); ImGuiHelpers.ScaledDummy(45);
bool CenteredIconButton(FontAwesomeIcon icon, string text) bool CenteredIconButton(FontAwesomeIcon icon, string text)
{ {
var buttonWidth = ImGuiComponents.GetIconButtonWithTextWidth(icon, text); var buttonWidth = ImGuiComponents.GetIconButtonWithTextWidth(icon, text);
ImGuiHelpers.CenterCursorFor((int)buttonWidth); ImGuiHelpers.CenterCursorFor((int)buttonWidth);
return ImGuiComponents.IconButtonWithText(icon, text); return ImGuiComponents.IconButtonWithText(icon, text);
} }
if (CenteredIconButton(FontAwesomeIcon.Download, "Open Plugin Installer")) if (CenteredIconButton(FontAwesomeIcon.Download, "Open Plugin Installer"))
{ {
Service<DalamudInterface>.Get().OpenPluginInstaller(); Service<DalamudInterface>.Get().OpenPluginInstaller();
this.IsOpen = false; this.IsOpen = false;
Dismiss(); Dismiss();
} }
ImGuiHelpers.ScaledDummy(5); ImGuiHelpers.ScaledDummy(5);
ImGuiHelpers.CenterCursorFor( ImGuiHelpers.CenterCursorFor(
(int)(ImGuiComponents.GetIconButtonWithTextWidth(FontAwesomeIcon.Globe, "See the FAQ") + (int)(ImGuiComponents.GetIconButtonWithTextWidth(FontAwesomeIcon.Globe, "See the FAQ") +
ImGuiComponents.GetIconButtonWithTextWidth(FontAwesomeIcon.LaughBeam, "Join our Discord server") + ImGuiComponents.GetIconButtonWithTextWidth(FontAwesomeIcon.LaughBeam, "Join our Discord server") +
(5 * ImGuiHelpers.GlobalScale) + (5 * ImGuiHelpers.GlobalScale) +
(ImGui.GetStyle().ItemSpacing.X * 4))); (ImGui.GetStyle().ItemSpacing.X * 4)));
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Globe, "See the FAQ")) if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Globe, "See the FAQ"))
{ {
Util.OpenLink("https://goatcorp.github.io/faq/"); Util.OpenLink("https://goatcorp.github.io/faq/");
} }
ImGui.SameLine(); ImGui.SameLine();
ImGuiHelpers.ScaledDummy(5); ImGuiHelpers.ScaledDummy(5);
ImGui.SameLine(); ImGui.SameLine();
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.LaughBeam, "Join our Discord server")) if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.LaughBeam, "Join our Discord server"))
{ {
Util.OpenLink("https://discord.gg/3NMcUV5"); Util.OpenLink("https://discord.gg/3NMcUV5");
} }
ImGuiHelpers.ScaledDummy(5); ImGuiHelpers.ScaledDummy(5);
if (CenteredIconButton(FontAwesomeIcon.Heart, "Support what we care about")) if (CenteredIconButton(FontAwesomeIcon.Heart, "Support what we care about"))
{ {
Util.OpenLink("https://goatcorp.github.io/faq/support"); Util.OpenLink("https://goatcorp.github.io/faq/support");
} }
var buttonHeight = 30 * ImGuiHelpers.GlobalScale; var buttonHeight = 30 * ImGuiHelpers.GlobalScale;
var buttonText = "Close"; var buttonText = "Close";
var buttonWidth = ImGui.CalcTextSize(buttonText).X + 40 * ImGuiHelpers.GlobalScale; var buttonWidth = ImGui.CalcTextSize(buttonText).X + 40 * ImGuiHelpers.GlobalScale;
ImGui.SetCursorPosY(windowSize.Y - buttonHeight - (20 * ImGuiHelpers.GlobalScale)); ImGui.SetCursorPosY(windowSize.Y - buttonHeight - (20 * ImGuiHelpers.GlobalScale));
ImGuiHelpers.CenterCursorFor((int)buttonWidth); ImGuiHelpers.CenterCursorFor((int)buttonWidth);
if (ImGui.Button(buttonText, new Vector2(buttonWidth, buttonHeight))) if (ImGui.Button(buttonText, new Vector2(buttonWidth, buttonHeight)))
{ {
this.IsOpen = false; this.IsOpen = false;
Dismiss(); Dismiss();
} }
break; break;
} }
} }
// Draw close button in the top right corner // Draw close button in the top right corner
ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 100f); ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 100f);
var btnAlpha = Math.Clamp(this.windowFade.EasedPoint.X - 0.5f, 0f, 1f); var btnAlpha = Math.Clamp(this.windowFade.EasedPoint.X - 0.5f, 0f, 1f);
ImGui.PushStyleColor(ImGuiCol.Button, ImGuiColors.DPSRed.WithAlpha(btnAlpha).Desaturate(0.3f)); ImGui.PushStyleColor(ImGuiCol.Button, ImGuiColors.DPSRed.WithAlpha(btnAlpha).Desaturate(0.3f));
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudWhite.WithAlpha(btnAlpha)); ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudWhite.WithAlpha(btnAlpha));
var childSize = ImGui.GetWindowSize(); var childSize = ImGui.GetWindowSize();
var closeButtonSize = 15 * ImGuiHelpers.GlobalScale; var closeButtonSize = 15 * ImGuiHelpers.GlobalScale;
ImGui.SetCursorPos(new Vector2(childSize.X - closeButtonSize - (10 * ImGuiHelpers.GlobalScale), 10 * ImGuiHelpers.GlobalScale)); ImGui.SetCursorPos(new Vector2(childSize.X - closeButtonSize - (10 * ImGuiHelpers.GlobalScale), 10 * ImGuiHelpers.GlobalScale));
@ -544,7 +544,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
{ {
this.scopedFinalizer.Dispose(); this.scopedFinalizer.Dispose();
} }
private void FrameworkOnUpdate(IFramework unused) private void FrameworkOnUpdate(IFramework unused)
{ {
if (!WarrantsChangelog()) if (!WarrantsChangelog())
@ -555,7 +555,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
if (this.openedThroughEligibility) if (this.openedThroughEligibility)
return; return;
var isEligible = this.gameGui.GetAddonByName("_TitleMenu", 1) != IntPtr.Zero; var isEligible = this.gameGui.GetAddonByName("_TitleMenu", 1) != IntPtr.Zero;
var charaSelect = this.gameGui.GetAddonByName("CharaSelect", 1); var charaSelect = this.gameGui.GetAddonByName("CharaSelect", 1);
@ -572,14 +572,14 @@ internal sealed class ChangelogWindow : Window, IDisposable
{ {
this.isEligibleSince = null; this.isEligibleSince = null;
} }
if (this.isEligibleSince != null && DateTime.Now - this.isEligibleSince > TitleScreenWaitTime) if (this.isEligibleSince != null && DateTime.Now - this.isEligibleSince > TitleScreenWaitTime)
{ {
this.IsOpen = true; this.IsOpen = true;
this.openedThroughEligibility = true; this.openedThroughEligibility = true;
} }
} }
private unsafe void ResetMovieTimer() private unsafe void ResetMovieTimer()
{ {
var uiModule = UIModule.Instance(); var uiModule = UIModule.Instance();

View file

@ -5,7 +5,7 @@ using System.Reflection;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows; namespace Dalamud.Interface.Internal.Windows;

View file

@ -7,7 +7,7 @@ using Dalamud.Interface.Colors;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows; namespace Dalamud.Interface.Internal.Windows;

View file

@ -22,7 +22,7 @@ using Dalamud.Plugin.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Serilog; using Serilog;
using Serilog.Events; using Serilog.Events;
@ -41,9 +41,9 @@ internal class ConsoleWindow : Window, IDisposable
// Fields below should be touched only from the main thread. // Fields below should be touched only from the main thread.
private readonly RollingList<LogEntry> logText; private readonly RollingList<LogEntry> logText;
private readonly RollingList<LogEntry> filteredLogEntries; private readonly RollingList<LogEntry> filteredLogEntries;
private readonly List<PluginFilterEntry> pluginFilters = new(); private readonly List<PluginFilterEntry> pluginFilters = new();
private readonly DalamudConfiguration configuration; private readonly DalamudConfiguration configuration;
private int newRolledLines; private int newRolledLines;
@ -87,14 +87,14 @@ internal class ConsoleWindow : Window, IDisposable
: base("Dalamud Console", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse) : base("Dalamud Console", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse)
{ {
this.configuration = configuration; this.configuration = configuration;
this.autoScroll = configuration.LogAutoScroll; this.autoScroll = configuration.LogAutoScroll;
this.autoOpen = configuration.LogOpenAtStartup; this.autoOpen = configuration.LogOpenAtStartup;
Service<Framework>.GetAsync().ContinueWith(r => r.Result.Update += this.FrameworkOnUpdate); Service<Framework>.GetAsync().ContinueWith(r => r.Result.Update += this.FrameworkOnUpdate);
var cm = Service<ConsoleManager>.Get(); var cm = Service<ConsoleManager>.Get();
cm.AddCommand("clear", "Clear the console log", () => cm.AddCommand("clear", "Clear the console log", () =>
{ {
this.QueueClear(); this.QueueClear();
return true; return true;
@ -116,7 +116,7 @@ internal class ConsoleWindow : Window, IDisposable
unsafe unsafe
{ {
this.clipperPtr = new(ImGuiNative.ImGuiListClipper_ImGuiListClipper()); this.clipperPtr = new(ImGui.ImGuiListClipper());
} }
} }
@ -578,7 +578,7 @@ internal class ConsoleWindow : Window, IDisposable
inputWidth = ImGui.GetWindowWidth() - (ImGui.GetStyle().WindowPadding.X * 2); inputWidth = ImGui.GetWindowWidth() - (ImGui.GetStyle().WindowPadding.X * 2);
if (!breakInputLines) if (!breakInputLines)
inputWidth = (inputWidth - ImGui.GetStyle().ItemSpacing.X) / 2; inputWidth = (inputWidth - ImGui.GetStyle().ItemSpacing.X) / 2;
} }
else else
{ {
@ -799,15 +799,15 @@ internal class ConsoleWindow : Window, IDisposable
{ {
if (string.IsNullOrEmpty(this.commandText)) if (string.IsNullOrEmpty(this.commandText))
return; return;
this.historyPos = -1; this.historyPos = -1;
if (this.commandText != this.configuration.LogCommandHistory.LastOrDefault()) if (this.commandText != this.configuration.LogCommandHistory.LastOrDefault())
this.configuration.LogCommandHistory.Add(this.commandText); this.configuration.LogCommandHistory.Add(this.commandText);
if (this.configuration.LogCommandHistory.Count > HistorySize) if (this.configuration.LogCommandHistory.Count > HistorySize)
this.configuration.LogCommandHistory.RemoveAt(0); this.configuration.LogCommandHistory.RemoveAt(0);
this.configuration.QueueSave(); this.configuration.QueueSave();
this.lastCmdSuccess = Service<ConsoleManager>.Get().ProcessCommand(this.commandText); this.lastCmdSuccess = Service<ConsoleManager>.Get().ProcessCommand(this.commandText);
@ -832,7 +832,7 @@ internal class ConsoleWindow : Window, IDisposable
this.completionZipText = null; this.completionZipText = null;
this.completionTabIdx = 0; this.completionTabIdx = 0;
break; break;
case ImGuiInputTextFlags.CallbackCompletion: case ImGuiInputTextFlags.CallbackCompletion:
var textBytes = new byte[data->BufTextLen]; var textBytes = new byte[data->BufTextLen];
Marshal.Copy((IntPtr)data->Buf, textBytes, 0, data->BufTextLen); Marshal.Copy((IntPtr)data->Buf, textBytes, 0, data->BufTextLen);
@ -843,11 +843,11 @@ internal class ConsoleWindow : Window, IDisposable
// We can't do any completion for parameters at the moment since it just calls into CommandHandler // We can't do any completion for parameters at the moment since it just calls into CommandHandler
if (words.Length > 1) if (words.Length > 1)
return 0; return 0;
var wordToComplete = words[0]; var wordToComplete = words[0];
if (wordToComplete.IsNullOrWhitespace()) if (wordToComplete.IsNullOrWhitespace())
return 0; return 0;
if (this.completionZipText is not null) if (this.completionZipText is not null)
wordToComplete = this.completionZipText; wordToComplete = this.completionZipText;
@ -878,7 +878,7 @@ internal class ConsoleWindow : Window, IDisposable
toComplete = candidates.ElementAt(this.completionTabIdx); toComplete = candidates.ElementAt(this.completionTabIdx);
this.completionTabIdx = (this.completionTabIdx + 1) % candidates.Count(); this.completionTabIdx = (this.completionTabIdx + 1) % candidates.Count();
} }
if (toComplete != null) if (toComplete != null)
{ {
ptr.DeleteChars(0, ptr.BufTextLen); ptr.DeleteChars(0, ptr.BufTextLen);
@ -1103,7 +1103,7 @@ internal class ConsoleWindow : Window, IDisposable
charOffsets[charOffsetsIndex++] = line.Length; charOffsets[charOffsetsIndex++] = line.Length;
var screenPos = ImGui.GetCursorScreenPos(); var screenPos = ImGui.GetCursorScreenPos();
var drawList = ImGui.GetWindowDrawList().NativePtr; var drawList = ImGui.GetWindowDrawList().Handle;
var font = ImGui.GetFont(); var font = ImGui.GetFont();
var size = ImGui.GetFontSize(); var size = ImGui.GetFontSize();
var scale = size / font.FontSize; var scale = size / font.FontSize;

View file

@ -8,7 +8,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Serilog; using Serilog;
namespace Dalamud.Interface.Internal.Windows.Data; namespace Dalamud.Interface.Internal.Windows.Data;

View file

@ -3,7 +3,7 @@ using System.Numerics;
using Dalamud.Interface.ImGuiNotification; using Dalamud.Interface.ImGuiNotification;
using Dalamud.Interface.ImGuiNotification.Internal; using Dalamud.Interface.ImGuiNotification.Internal;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data; namespace Dalamud.Interface.Internal.Windows.Data;
@ -50,7 +50,7 @@ internal static class DataWindowWidgetExtensions
{ {
ImGui.SetClipboardText(s); ImGui.SetClipboardText(s);
Service<NotificationManager>.Get().AddNotification( Service<NotificationManager>.Get().AddNotification(
$"Copied {ImGui.TableGetColumnName()} to clipboard.", $"Copied {ImGui.TableGetColumnNameS()} to clipboard.",
widget.DisplayName, widget.DisplayName,
NotificationType.Success); NotificationType.Success);
} }

View file

@ -8,7 +8,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using Dalamud.Logging.Internal; using Dalamud.Logging.Internal;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Serilog.Events; using Serilog.Events;
@ -46,7 +46,7 @@ internal class GameInventoryTestWidget : IDataWindowWidget
ImGuiColors.DalamudRed, ImGuiColors.DalamudRed,
"Enable LogLevel=Information display to see the logs."); "Enable LogLevel=Information display to see the logs.");
} }
using var table = ImRaii.Table(this.DisplayName, 3, ImGuiTableFlags.SizingFixedFit); using var table = ImRaii.Table(this.DisplayName, 3, ImGuiTableFlags.SizingFixedFit);
if (!table.Success) if (!table.Success)
return; return;

View file

@ -1,6 +1,6 @@
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data; namespace Dalamud.Interface.Internal.Windows.Data;

View file

@ -5,7 +5,7 @@ using Dalamud.Game.Addon.Lifecycle;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -19,11 +19,11 @@ public class AddonLifecycleWidget : IDataWindowWidget
/// <inheritdoc/> /// <inheritdoc/>
public string DisplayName { get; init; } = "Addon Lifecycle"; public string DisplayName { get; init; } = "Addon Lifecycle";
/// <inheritdoc/> /// <inheritdoc/>
[MemberNotNullWhen(true, "AddonLifecycle")] [MemberNotNullWhen(true, "AddonLifecycle")]
public bool Ready { get; set; } public bool Ready { get; set; }
private AddonLifecycle? AddonLifecycle { get; set; } private AddonLifecycle? AddonLifecycle { get; set; }
/// <inheritdoc/> /// <inheritdoc/>
@ -38,7 +38,7 @@ public class AddonLifecycleWidget : IDataWindowWidget
this.Ready = true; this.Ready = true;
}); });
} }
/// <inheritdoc/> /// <inheritdoc/>
public void Draw() public void Draw()
{ {
@ -62,11 +62,11 @@ public class AddonLifecycleWidget : IDataWindowWidget
ImGui.Unindent(); ImGui.Unindent();
} }
} }
private void DrawEventListeners() private void DrawEventListeners()
{ {
if (!this.Ready) return; if (!this.Ready) return;
foreach (var eventType in Enum.GetValues<AddonEvent>()) foreach (var eventType in Enum.GetValues<AddonEvent>())
{ {
if (ImGui.CollapsingHeader(eventType.ToString())) if (ImGui.CollapsingHeader(eventType.ToString()))
@ -78,7 +78,7 @@ public class AddonLifecycleWidget : IDataWindowWidget
{ {
ImGui.Text("No Listeners Registered for Event"); ImGui.Text("No Listeners Registered for Event");
} }
if (ImGui.BeginTable("AddonLifecycleListenersTable", 2)) if (ImGui.BeginTable("AddonLifecycleListenersTable", 2))
{ {
ImGui.TableSetupColumn("##AddonName", ImGuiTableColumnFlags.WidthFixed, 100.0f * ImGuiHelpers.GlobalScale); ImGui.TableSetupColumn("##AddonName", ImGuiTableColumnFlags.WidthFixed, 100.0f * ImGuiHelpers.GlobalScale);
@ -92,10 +92,10 @@ public class AddonLifecycleWidget : IDataWindowWidget
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.Text($"{listener.FunctionDelegate.Method.DeclaringType?.FullName ?? "Unknown Declaring Type"}::{listener.FunctionDelegate.Method.Name}"); ImGui.Text($"{listener.FunctionDelegate.Method.DeclaringType?.FullName ?? "Unknown Declaring Type"}::{listener.FunctionDelegate.Method.Name}");
} }
ImGui.EndTable(); ImGui.EndTable();
} }
ImGui.Unindent(); ImGui.Unindent();
} }
} }
@ -111,7 +111,7 @@ public class AddonLifecycleWidget : IDataWindowWidget
{ {
ImGui.Text("No ReceiveEvent Hooks are Registered"); ImGui.Text("No ReceiveEvent Hooks are Registered");
} }
foreach (var receiveEventListener in this.AddonLifecycle.ReceiveEventListeners) foreach (var receiveEventListener in this.AddonLifecycle.ReceiveEventListeners)
{ {
if (ImGui.CollapsingHeader(string.Join(", ", receiveEventListener.AddonNames))) if (ImGui.CollapsingHeader(string.Join(", ", receiveEventListener.AddonNames)))
@ -135,7 +135,7 @@ public class AddonLifecycleWidget : IDataWindowWidget
var text = receiveEventListener.Hook.IsEnabled ? "Enabled" : "Disabled"; var text = receiveEventListener.Hook.IsEnabled ? "Enabled" : "Disabled";
ImGui.TextColored(color, text); ImGui.TextColored(color, text);
} }
ImGui.Columns(1); ImGui.Columns(1);
} }
} }

View file

@ -1,7 +1,7 @@
using Dalamud.Game.Gui; using Dalamud.Game.Gui;
using Dalamud.Memory; using Dalamud.Memory;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -15,7 +15,7 @@ internal unsafe class AddonWidget : IDataWindowWidget
private nint findAgentInterfacePtr; private nint findAgentInterfacePtr;
/// <inheritdoc/> /// <inheritdoc/>
public string DisplayName { get; init; } = "Addon"; public string DisplayName { get; init; } = "Addon";
/// <inheritdoc/> /// <inheritdoc/>
public string[]? CommandShortcuts { get; init; } public string[]? CommandShortcuts { get; init; }

View file

@ -3,7 +3,7 @@
using Dalamud.Game; using Dalamud.Game;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -19,7 +19,7 @@ internal class AddressesWidget : IDataWindowWidget
public string[]? CommandShortcuts { get; init; } = { "address" }; public string[]? CommandShortcuts { get; init; } = { "address" };
/// <inheritdoc/> /// <inheritdoc/>
public string DisplayName { get; init; } = "Addresses"; public string DisplayName { get; init; } = "Addresses";
/// <inheritdoc/> /// <inheritdoc/>
public bool Ready { get; set; } public bool Ready { get; set; }
@ -29,7 +29,7 @@ internal class AddressesWidget : IDataWindowWidget
{ {
this.Ready = true; this.Ready = true;
} }
/// <inheritdoc/> /// <inheritdoc/>
public void Draw() public void Draw()
{ {

View file

@ -1,6 +1,6 @@
using Dalamud.Game.ClientState.Aetherytes; using Dalamud.Game.ClientState.Aetherytes;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -14,9 +14,9 @@ internal class AetherytesWidget : IDataWindowWidget
/// <inheritdoc/> /// <inheritdoc/>
public string[]? CommandShortcuts { get; init; } = { "aetherytes" }; public string[]? CommandShortcuts { get; init; } = { "aetherytes" };
/// <inheritdoc/> /// <inheritdoc/>
public string DisplayName { get; init; } = "Aetherytes"; public string DisplayName { get; init; } = "Aetherytes";
/// <inheritdoc/> /// <inheritdoc/>
public void Load() public void Load()

View file

@ -6,7 +6,7 @@ using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Lumina.Text.ReadOnly; using Lumina.Text.ReadOnly;
@ -36,7 +36,7 @@ internal unsafe class AtkArrayDataBrowserWidget : IDataWindowWidget
/// <inheritdoc/> /// <inheritdoc/>
public string[]? CommandShortcuts { get; init; } = { "atkarray" }; public string[]? CommandShortcuts { get; init; } = { "atkarray" };
/// <inheritdoc/> /// <inheritdoc/>
public string DisplayName { get; init; } = "Atk Array Data"; public string DisplayName { get; init; } = "Atk Array Data";

View file

@ -1,6 +1,6 @@
using Dalamud.Game.ClientState.Buddy; using Dalamud.Game.ClientState.Buddy;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -16,9 +16,9 @@ internal class BuddyListWidget : IDataWindowWidget
/// <inheritdoc/> /// <inheritdoc/>
public string[]? CommandShortcuts { get; init; } = { "buddy", "buddylist" }; public string[]? CommandShortcuts { get; init; } = { "buddy", "buddylist" };
/// <inheritdoc/> /// <inheritdoc/>
public string DisplayName { get; init; } = "Buddy List"; public string DisplayName { get; init; } = "Buddy List";
/// <inheritdoc/> /// <inheritdoc/>
public void Load() public void Load()

View file

@ -3,7 +3,7 @@
using Dalamud.Game.Command; using Dalamud.Game.Command;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -14,9 +14,9 @@ internal class CommandWidget : IDataWindowWidget
{ {
/// <inheritdoc/> /// <inheritdoc/>
public string[]? CommandShortcuts { get; init; } = { "command" }; public string[]? CommandShortcuts { get; init; } = { "command" };
/// <inheritdoc/> /// <inheritdoc/>
public string DisplayName { get; init; } = "Command"; public string DisplayName { get; init; } = "Command";
/// <inheritdoc/> /// <inheritdoc/>
public bool Ready { get; set; } public bool Ready { get; set; }
@ -44,7 +44,7 @@ internal class CommandWidget : IDataWindowWidget
ImGui.TableSetupColumn("HelpMessage", ImGuiTableColumnFlags.NoSort); ImGui.TableSetupColumn("HelpMessage", ImGuiTableColumnFlags.NoSort);
ImGui.TableSetupColumn("In Help?", ImGuiTableColumnFlags.NoSort); ImGui.TableSetupColumn("In Help?", ImGuiTableColumnFlags.NoSort);
ImGui.TableHeadersRow(); ImGui.TableHeadersRow();
var sortSpecs = ImGui.TableGetSortSpecs(); var sortSpecs = ImGui.TableGetSortSpecs();
var commands = commandManager.Commands.ToArray(); var commands = commandManager.Commands.ToArray();
@ -65,16 +65,16 @@ internal class CommandWidget : IDataWindowWidget
foreach (var command in commands) foreach (var command in commands)
{ {
ImGui.TableNextRow(); ImGui.TableNextRow();
ImGui.TableSetColumnIndex(0); ImGui.TableSetColumnIndex(0);
ImGui.Text(command.Key); ImGui.Text(command.Key);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.Text(commandManager.GetHandlerAssemblyName(command.Key, command.Value)); ImGui.Text(commandManager.GetHandlerAssemblyName(command.Key, command.Value));
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.TextWrapped(command.Value.HelpMessage); ImGui.TextWrapped(command.Value.HelpMessage);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.Text(command.Value.ShowInHelp ? "Yes" : "No"); ImGui.Text(command.Value.ShowInHelp ? "Yes" : "No");
} }

View file

@ -1,7 +1,7 @@
using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Conditions;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -15,9 +15,9 @@ internal class ConditionWidget : IDataWindowWidget
/// <inheritdoc/> /// <inheritdoc/>
public string[]? CommandShortcuts { get; init; } = { "condition" }; public string[]? CommandShortcuts { get; init; } = { "condition" };
/// <inheritdoc/> /// <inheritdoc/>
public string DisplayName { get; init; } = "Condition"; public string DisplayName { get; init; } = "Condition";
/// <inheritdoc/> /// <inheritdoc/>
public void Load() public void Load()

View file

@ -11,7 +11,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using Dalamud.Plugin.Ipc.Internal; using Dalamud.Plugin.Ipc.Internal;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -124,13 +124,13 @@ internal class DataShareWidget : IDataWindowWidget
if (ImGui.Button("Copy")) if (ImGui.Button("Copy"))
{ {
fixed (byte* pData = data) fixed (byte* pData = data)
ImGuiNative.igSetClipboardText(pData); ImGui.SetClipboardText(pData);
} }
fixed (byte* pLabel = "text"u8) fixed (byte* pLabel = "text"u8)
fixed (byte* pData = data) fixed (byte* pData = data)
{ {
ImGuiNative.igInputTextMultiline( ImGui.InputTextMultiline(
pLabel, pLabel,
pData, pData,
(uint)data.Length, (uint)data.Length,
@ -148,7 +148,7 @@ internal class DataShareWidget : IDataWindowWidget
{ {
if (mi is null) if (mi is null)
return "-"; return "-";
var sb = new StringBuilder(); var sb = new StringBuilder();
sb.Append(ReprType(mi.DeclaringType)) sb.Append(ReprType(mi.DeclaringType))
.Append("::") .Append("::")
@ -245,7 +245,7 @@ internal class DataShareWidget : IDataWindowWidget
{ {
ImGui.SetClipboardText(tooltip?.Invoke() ?? s); ImGui.SetClipboardText(tooltip?.Invoke() ?? s);
Service<NotificationManager>.Get().AddNotification( Service<NotificationManager>.Get().AddNotification(
$"Copied {ImGui.TableGetColumnName()} to clipboard.", $"Copied {ImGui.TableGetColumnNameS()} to clipboard.",
this.DisplayName, this.DisplayName,
NotificationType.Success); NotificationType.Success);
} }

View file

@ -5,7 +5,7 @@ using Dalamud.Configuration.Internal;
using Dalamud.Game; using Dalamud.Game;
using Dalamud.Game.Gui.Dtr; using Dalamud.Game.Gui.Dtr;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;

View file

@ -3,7 +3,7 @@ using Dalamud.Interface.Textures.Internal;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -14,9 +14,9 @@ internal class FateTableWidget : IDataWindowWidget
{ {
/// <inheritdoc/> /// <inheritdoc/>
public string[]? CommandShortcuts { get; init; } = { "fate", "fatetable" }; public string[]? CommandShortcuts { get; init; } = { "fate", "fatetable" };
/// <inheritdoc/> /// <inheritdoc/>
public string DisplayName { get; init; } = "Fate Table"; public string DisplayName { get; init; } = "Fate Table";
/// <inheritdoc/> /// <inheritdoc/>
public bool Ready { get; set; } public bool Ready { get; set; }

View file

@ -2,7 +2,7 @@
using Dalamud.Game.Gui.FlyText; using Dalamud.Game.Gui.FlyText;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -20,12 +20,12 @@ internal class FlyTextWidget : IDataWindowWidget
private int flyIcon; private int flyIcon;
private int flyDmgIcon; private int flyDmgIcon;
private Vector4 flyColor = new(1, 0, 0, 1); private Vector4 flyColor = new(1, 0, 0, 1);
/// <inheritdoc/> /// <inheritdoc/>
public string[]? CommandShortcuts { get; init; } = { "flytext" }; public string[]? CommandShortcuts { get; init; } = { "flytext" };
/// <inheritdoc/> /// <inheritdoc/>
public string DisplayName { get; init; } = "Fly Text"; public string DisplayName { get; init; } = "Fly Text";
/// <inheritdoc/> /// <inheritdoc/>
public bool Ready { get; set; } public bool Ready { get; set; }

View file

@ -3,7 +3,7 @@ using System.Linq;
using System.Numerics; using System.Numerics;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -19,12 +19,12 @@ internal class FontAwesomeTestWidget : IDataWindowWidget
private string iconSearchInput = string.Empty; private string iconSearchInput = string.Empty;
private bool iconSearchChanged = true; private bool iconSearchChanged = true;
private bool useFixedWidth = false; private bool useFixedWidth = false;
/// <inheritdoc/> /// <inheritdoc/>
public string[]? CommandShortcuts { get; init; } = { "fa", "fatest", "fontawesome" }; public string[]? CommandShortcuts { get; init; } = { "fa", "fatest", "fontawesome" };
/// <inheritdoc/> /// <inheritdoc/>
public string DisplayName { get; init; } = "Font Awesome Test"; public string DisplayName { get; init; } = "Font Awesome Test";
/// <inheritdoc/> /// <inheritdoc/>
public bool Ready { get; set; } public bool Ready { get; set; }
@ -81,7 +81,7 @@ internal class FontAwesomeTestWidget : IDataWindowWidget
{ {
this.iconSearchChanged = true; this.iconSearchChanged = true;
} }
ImGui.Checkbox("Use fixed width font", ref this.useFixedWidth); ImGui.Checkbox("Use fixed width font", ref this.useFixedWidth);
ImGuiHelpers.ScaledDummy(10f); ImGuiHelpers.ScaledDummy(10f);
@ -96,7 +96,7 @@ internal class FontAwesomeTestWidget : IDataWindowWidget
ImGui.PopFont(); ImGui.PopFont();
ImGuiHelpers.ScaledDummy(2f); ImGuiHelpers.ScaledDummy(2f);
} }
ImGui.PopStyleVar(); ImGui.PopStyleVar();
} }
} }

View file

@ -2,9 +2,11 @@
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Dalamud.Bindings.ImGui;
using Dalamud.Game; using Dalamud.Game;
using Dalamud.Interface.FontIdentifier; using Dalamud.Interface.FontIdentifier;
using Dalamud.Interface.GameFonts; using Dalamud.Interface.GameFonts;
@ -13,9 +15,6 @@ using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Interface.ManagedFontAtlas.Internals; using Dalamud.Interface.ManagedFontAtlas.Internals;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET;
using Serilog; using Serilog;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -66,10 +65,10 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
this.ClearAtlas(); this.ClearAtlas();
fixed (byte* labelPtr = "Global Scale for Atlas"u8) fixed (byte* labelPtr = "Global Scale for Atlas"u8)
{ {
var v = (byte)(this.atlasScaleMode ? 1 : 0); var v = this.atlasScaleMode;
if (ImGuiNative.igCheckbox(labelPtr, &v) != 0) if (ImGui.Checkbox(labelPtr, ref v))
{ {
this.atlasScaleMode = v != 0; this.atlasScaleMode = v;
this.ClearAtlas(); this.ClearAtlas();
} }
} }
@ -77,40 +76,40 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
ImGui.SameLine(); ImGui.SameLine();
fixed (byte* labelPtr = "Word Wrap"u8) fixed (byte* labelPtr = "Word Wrap"u8)
{ {
var v = (byte)(this.useWordWrap ? 1 : 0); var v = this.useWordWrap;
if (ImGuiNative.igCheckbox(labelPtr, &v) != 0) if (ImGui.Checkbox(labelPtr, &v))
this.useWordWrap = v != 0; this.useWordWrap = v;
} }
ImGui.SameLine(); ImGui.SameLine();
fixed (byte* labelPtr = "Italic"u8) fixed (byte* labelPtr = "Italic"u8)
{ {
var v = (byte)(this.useItalic ? 1 : 0); var v = this.useItalic;
if (ImGuiNative.igCheckbox(labelPtr, &v) != 0) if (ImGui.Checkbox(labelPtr, &v))
{ {
this.useItalic = v != 0; this.useItalic = v;
this.ClearAtlas(); this.ClearAtlas();
} }
} }
ImGui.SameLine(); ImGui.SameLine();
fixed (byte* labelPtr = "Bold"u8) fixed (byte* labelPtr = "Bold"u8)
{ {
var v = (byte)(this.useBold ? 1 : 0); var v = this.useBold;
if (ImGuiNative.igCheckbox(labelPtr, &v) != 0) if (ImGui.Checkbox(labelPtr, &v))
{ {
this.useBold = v != 0; this.useBold = v;
this.ClearAtlas(); this.ClearAtlas();
} }
} }
ImGui.SameLine(); ImGui.SameLine();
fixed (byte* labelPtr = "Minimum Range"u8) fixed (byte* labelPtr = "Minimum Range"u8)
{ {
var v = (byte)(this.useMinimumBuild ? 1 : 0); var v = this.useMinimumBuild;
if (ImGuiNative.igCheckbox(labelPtr, &v) != 0) if (ImGui.Checkbox(labelPtr, &v))
{ {
this.useMinimumBuild = v != 0; this.useMinimumBuild = v;
this.ClearAtlas(); this.ClearAtlas();
} }
} }
@ -211,17 +210,17 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
fixed (byte* labelPtr = "Test Input"u8) fixed (byte* labelPtr = "Test Input"u8)
{ {
if (!this.atlasScaleMode) if (!this.atlasScaleMode)
ImGuiNative.igSetWindowFontScale(1 / ImGuiHelpers.GlobalScale); ImGui.SetWindowFontScale(1 / ImGuiHelpers.GlobalScale);
using (this.fontDialogHandle.Push()) using (this.fontDialogHandle.Push())
{ {
if (ImGuiNative.igInputTextMultiline( if (ImGui.InputTextMultiline(
labelPtr, labelPtr,
this.testStringBuffer.Data, this.testStringBuffer.Data,
(uint)this.testStringBuffer.Capacity, (uint)this.testStringBuffer.Capacity,
new(ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeight() * 3), new(ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeight() * 3),
0, 0,
null, null,
null) != 0) null))
{ {
var len = this.testStringBuffer.StorageSpan.IndexOf((byte)0); var len = this.testStringBuffer.StorageSpan.IndexOf((byte)0);
if (len + 4 >= this.testStringBuffer.Capacity) if (len + 4 >= this.testStringBuffer.Capacity)
@ -238,7 +237,7 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
} }
if (!this.atlasScaleMode) if (!this.atlasScaleMode)
ImGuiNative.igSetWindowFontScale(1); ImGui.SetWindowFontScale(1);
} }
this.fontHandles ??= this.fontHandles ??=
@ -285,7 +284,7 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
{ {
ImGui.TextUnformatted($"{gfs.SizePt}pt"); ImGui.TextUnformatted($"{gfs.SizePt}pt");
ImGui.SameLine(offsetX); ImGui.SameLine(offsetX);
ImGuiNative.igPushTextWrapPos(this.useWordWrap ? 0f : -1f); ImGui.PushTextWrapPos(this.useWordWrap ? 0f : -1f);
try try
{ {
if (handle.Value.LoadException is { } exc) if (handle.Value.LoadException is { } exc)
@ -295,23 +294,23 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
else if (!handle.Value.Available) else if (!handle.Value.Available)
{ {
fixed (byte* labelPtr = "Loading..."u8) fixed (byte* labelPtr = "Loading..."u8)
ImGuiNative.igTextUnformatted(labelPtr, labelPtr + 8 + ((Environment.TickCount / 200) % 3)); ImGui.TextUnformatted(labelPtr, labelPtr + 8 + ((Environment.TickCount / 200) % 3));
} }
else else
{ {
if (!this.atlasScaleMode) if (!this.atlasScaleMode)
ImGuiNative.igSetWindowFontScale(1 / ImGuiHelpers.GlobalScale); ImGui.SetWindowFontScale(1 / ImGuiHelpers.GlobalScale);
if (counter++ % 2 == 0) if (counter++ % 2 == 0)
{ {
using var pushPop = handle.Value.Push(); using var pushPop = handle.Value.Push();
ImGuiNative.igTextUnformatted( ImGui.TextUnformatted(
this.testStringBuffer.Data, this.testStringBuffer.Data,
this.testStringBuffer.Data + this.testStringBuffer.Length); this.testStringBuffer.Data + this.testStringBuffer.Length);
} }
else else
{ {
handle.Value.Push(); handle.Value.Push();
ImGuiNative.igTextUnformatted( ImGui.TextUnformatted(
this.testStringBuffer.Data, this.testStringBuffer.Data,
this.testStringBuffer.Data + this.testStringBuffer.Length); this.testStringBuffer.Data + this.testStringBuffer.Length);
handle.Value.Pop(); handle.Value.Pop();
@ -320,8 +319,8 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
} }
finally finally
{ {
ImGuiNative.igSetWindowFontScale(1); ImGui.SetWindowFontScale(1);
ImGuiNative.igPopTextWrapPos(); ImGui.PopTextWrapPos();
} }
} }
} }
@ -385,7 +384,7 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
var dim = default(Vector2); var dim = default(Vector2);
var test = "Test string"u8; var test = "Test string"u8;
fixed (byte* pTest = test) fixed (byte* pTest = test)
ImGuiNative.ImFont_CalcTextSizeA(&dim, fontPtr, fontPtr.FontSize, float.MaxValue, 0, pTest, null, null); ImGui.CalcTextSizeA(ref dim, fontPtr, fontPtr.FontSize, float.MaxValue, 0f, pTest, (string)null, null);
Log.Information($"{nameof(GamePrebakedFontsTestWidget)}: {handle} => {dim}"); Log.Information($"{nameof(GamePrebakedFontsTestWidget)}: {handle} => {dim}");
} }
} }

View file

@ -1,7 +1,7 @@
using Dalamud.Game.ClientState.GamePad; using Dalamud.Game.ClientState.GamePad;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;

View file

@ -2,7 +2,7 @@ using Dalamud.Game.ClientState;
using Dalamud.Game.ClientState.JobGauge; using Dalamud.Game.ClientState.JobGauge;
using Dalamud.Game.ClientState.JobGauge.Types; using Dalamud.Game.ClientState.JobGauge.Types;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -13,9 +13,9 @@ internal class GaugeWidget : IDataWindowWidget
{ {
/// <inheritdoc/> /// <inheritdoc/>
public string[]? CommandShortcuts { get; init; } = { "gauge", "jobgauge", "job" }; public string[]? CommandShortcuts { get; init; } = { "gauge", "jobgauge", "job" };
/// <inheritdoc/> /// <inheritdoc/>
public string DisplayName { get; init; } = "Job Gauge"; public string DisplayName { get; init; } = "Job Gauge";
/// <inheritdoc/> /// <inheritdoc/>
public bool Ready { get; set; } public bool Ready { get; set; }

View file

@ -1,7 +1,10 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Windows.Win32.Foundation;
using Windows.Win32.UI.WindowsAndMessaging;
using Dalamud.Hooking; using Dalamud.Hooking;
using ImGuiNET; using Dalamud.Bindings.ImGui;
using PInvoke; using PInvoke;
using Serilog; using Serilog;
@ -14,19 +17,19 @@ internal class HookWidget : IDataWindowWidget
{ {
private Hook<MessageBoxWDelegate>? messageBoxMinHook; private Hook<MessageBoxWDelegate>? messageBoxMinHook;
private bool hookUseMinHook; private bool hookUseMinHook;
private delegate int MessageBoxWDelegate( private delegate int MessageBoxWDelegate(
IntPtr hWnd, IntPtr hWnd,
[MarshalAs(UnmanagedType.LPWStr)] string text, [MarshalAs(UnmanagedType.LPWStr)] string text,
[MarshalAs(UnmanagedType.LPWStr)] string caption, [MarshalAs(UnmanagedType.LPWStr)] string caption,
NativeFunctions.MessageBoxType type); MESSAGEBOX_STYLE type);
/// <inheritdoc/> /// <inheritdoc/>
public string DisplayName { get; init; } = "Hook"; public string DisplayName { get; init; } = "Hook";
/// <inheritdoc/> /// <inheritdoc/>
public string[]? CommandShortcuts { get; init; } = { "hook" }; public string[]? CommandShortcuts { get; init; } = { "hook" };
/// <inheritdoc/> /// <inheritdoc/>
public bool Ready { get; set; } public bool Ready { get; set; }
@ -53,7 +56,7 @@ internal class HookWidget : IDataWindowWidget
this.messageBoxMinHook?.Disable(); this.messageBoxMinHook?.Disable();
if (ImGui.Button("Call Original")) if (ImGui.Button("Call Original"))
this.messageBoxMinHook?.Original(IntPtr.Zero, "Hello from .Original", "Hook Test", NativeFunctions.MessageBoxType.Ok); this.messageBoxMinHook?.Original(IntPtr.Zero, "Hello from .Original", "Hook Test", MESSAGEBOX_STYLE.MB_OK);
if (ImGui.Button("Dispose")) if (ImGui.Button("Dispose"))
{ {
@ -62,7 +65,7 @@ internal class HookWidget : IDataWindowWidget
} }
if (ImGui.Button("Test")) if (ImGui.Button("Test"))
_ = NativeFunctions.MessageBoxW(IntPtr.Zero, "Hi", "Hello", NativeFunctions.MessageBoxType.Ok); _ = global::Windows.Win32.PInvoke.MessageBox(HWND.Null, "Hi", "Hello", MESSAGEBOX_STYLE.MB_OK);
if (this.messageBoxMinHook != null) if (this.messageBoxMinHook != null)
ImGui.Text("Enabled: " + this.messageBoxMinHook?.IsEnabled); ImGui.Text("Enabled: " + this.messageBoxMinHook?.IsEnabled);
@ -72,12 +75,12 @@ internal class HookWidget : IDataWindowWidget
Log.Error(ex, "MinHook error caught"); Log.Error(ex, "MinHook error caught");
} }
} }
private int MessageBoxWDetour(IntPtr hwnd, string text, string caption, NativeFunctions.MessageBoxType type) private int MessageBoxWDetour(IntPtr hwnd, string text, string caption, MESSAGEBOX_STYLE type)
{ {
Log.Information("[DATAHOOK] {Hwnd} {Text} {Caption} {Type}", hwnd, text, caption, type); Log.Information("[DATAHOOK] {Hwnd} {Text} {Caption} {Type}", hwnd, text, caption, type);
var result = this.messageBoxMinHook!.Original(hwnd, "Cause Access Violation?", caption, NativeFunctions.MessageBoxType.YesNo); var result = this.messageBoxMinHook!.Original(hwnd, "Cause Access Violation?", caption, MESSAGEBOX_STYLE.MB_YESNO);
if (result == (int)User32.MessageBoxResult.IDYES) if (result == (int)User32.MessageBoxResult.IDYES)
{ {

View file

@ -8,7 +8,7 @@ using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Internal; using Dalamud.Interface.Utility.Internal;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;

View file

@ -11,7 +11,7 @@ using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Storage.Assets; using Dalamud.Storage.Assets;
using ImGuiNET; using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -457,7 +457,7 @@ internal class ImGuiWidget : IDataWindowWidget
public DisposeLoggingTextureWrap(IDalamudTextureWrap inner) => this.inner = inner; public DisposeLoggingTextureWrap(IDalamudTextureWrap inner) => this.inner = inner;
public nint ImGuiHandle => this.inner.ImGuiHandle; public ImTextureID ImGuiHandle => this.inner.ImGuiHandle;
public int Width => this.inner.Width; public int Width => this.inner.Width;

Some files were not shown because too many files have changed in this diff Show more