diff --git a/.gitignore b/.gitignore
index 7023fb37f..593ad30ea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -327,4 +327,7 @@ ASALocalRun/
*.nvuser
# MFractors (Xamarin productivity tool) working folder
-.mfractor/
\ No newline at end of file
+.mfractor/
+
+# HexaGen generated files
+imgui/**/Generated/**/*
\ No newline at end of file
diff --git a/Dalamud.CorePlugin/Dalamud.CorePlugin.csproj b/Dalamud.CorePlugin/Dalamud.CorePlugin.csproj
index f51622c7e..bf718b28e 100644
--- a/Dalamud.CorePlugin/Dalamud.CorePlugin.csproj
+++ b/Dalamud.CorePlugin/Dalamud.CorePlugin.csproj
@@ -38,9 +38,6 @@
false
-
- false
-
diff --git a/Dalamud.CorePlugin/PluginWindow.cs b/Dalamud.CorePlugin/PluginWindow.cs
index 27be82f41..07c935f7d 100644
--- a/Dalamud.CorePlugin/PluginWindow.cs
+++ b/Dalamud.CorePlugin/PluginWindow.cs
@@ -2,7 +2,7 @@ using System;
using System.Numerics;
using Dalamud.Interface.Windowing;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.CorePlugin
{
diff --git a/Dalamud.Injector/GameStart.cs b/Dalamud.Injector/GameStart.cs
index e34048978..8ce2c3ce3 100644
--- a/Dalamud.Injector/GameStart.cs
+++ b/Dalamud.Injector/GameStart.cs
@@ -440,7 +440,7 @@ namespace Dalamud.Injector
#region Methods
- [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Auto)]
+ [DllImport("advapi32.dll", CharSet = CharSet.Auto)]
public static extern void BuildExplicitAccessWithName(
ref EXPLICIT_ACCESS pExplicitAccess,
string pTrusteeName,
@@ -448,26 +448,26 @@ namespace Dalamud.Injector
uint accessMode,
uint inheritance);
- [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Auto)]
+ [DllImport("advapi32.dll", CharSet = CharSet.Auto)]
public static extern int SetEntriesInAcl(
int cCountOfExplicitEntries,
ref EXPLICIT_ACCESS pListOfExplicitEntries,
IntPtr oldAcl,
out IntPtr newAcl);
- [DllImport("advapi32.dll", SetLastError = true)]
+ [DllImport("advapi32.dll")]
public static extern bool InitializeSecurityDescriptor(
out SECURITY_DESCRIPTOR pSecurityDescriptor,
uint dwRevision);
- [DllImport("advapi32.dll", SetLastError = true)]
+ [DllImport("advapi32.dll")]
public static extern bool SetSecurityDescriptorDacl(
ref SECURITY_DESCRIPTOR pSecurityDescriptor,
bool bDaclPresent,
IntPtr pDacl,
bool bDaclDefaulted);
- [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
+ [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern bool CreateProcess(
string lpApplicationName,
string lpCommandLine,
@@ -480,39 +480,39 @@ namespace Dalamud.Injector
[In] ref STARTUPINFO lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
- [DllImport("kernel32.dll", SetLastError = true)]
+ [DllImport("kernel32.dll")]
public static extern bool CloseHandle(IntPtr hObject);
- [DllImport("kernel32.dll", SetLastError = true)]
+ [DllImport("kernel32.dll")]
public static extern uint ResumeThread(IntPtr hThread);
- [DllImport("advapi32.dll", SetLastError = true)]
+ [DllImport("advapi32.dll")]
public static extern bool ImpersonateSelf(
SECURITY_IMPERSONATION_LEVEL impersonationLevel);
- [DllImport("advapi32.dll", SetLastError = true)]
+ [DllImport("advapi32.dll")]
public static extern bool OpenProcessToken(
IntPtr processHandle,
UInt32 desiredAccess,
out IntPtr tokenHandle);
- [DllImport("advapi32.dll", SetLastError = true)]
+ [DllImport("advapi32.dll")]
public static extern bool OpenThreadToken(
IntPtr threadHandle,
uint desiredAccess,
bool openAsSelf,
out IntPtr tokenHandle);
- [DllImport("advapi32.dll", SetLastError = true)]
+ [DllImport("advapi32.dll")]
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(
IntPtr clientToken,
ref PRIVILEGE_SET requiredPrivileges,
out bool pfResult);
- [DllImport("advapi32.dll", SetLastError = true)]
+ [DllImport("advapi32.dll")]
public static extern bool AdjustTokenPrivileges(
IntPtr tokenHandle,
bool disableAllPrivileges,
@@ -521,7 +521,7 @@ namespace Dalamud.Injector
IntPtr previousState,
IntPtr cbOutPreviousState);
- [DllImport("advapi32.dll", SetLastError = true)]
+ [DllImport("advapi32.dll")]
public static extern uint GetSecurityInfo(
IntPtr handle,
SE_OBJECT_TYPE objectType,
@@ -532,7 +532,7 @@ namespace Dalamud.Injector
IntPtr pSacl,
IntPtr pSecurityDescriptor);
- [DllImport("advapi32.dll", SetLastError = true)]
+ [DllImport("advapi32.dll")]
public static extern uint SetSecurityInfo(
IntPtr handle,
SE_OBJECT_TYPE objectType,
@@ -542,16 +542,16 @@ namespace Dalamud.Injector
IntPtr pDacl,
IntPtr pSacl);
- [DllImport("kernel32.dll", SetLastError = true)]
+ [DllImport("kernel32.dll")]
public static extern IntPtr GetCurrentProcess();
- [DllImport("kernel32.dll", SetLastError = true)]
+ [DllImport("kernel32.dll")]
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);
- [DllImport("user32.dll", SetLastError = true)]
+ [DllImport("user32.dll")]
public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
[DllImport("user32.dll")]
diff --git a/Dalamud.sln b/Dalamud.sln
index 65f43952f..4109bf8f6 100644
--- a/Dalamud.sln
+++ b/Dalamud.sln
@@ -62,7 +62,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cimplot", "external\cimplot
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cimguizmo", "external\cimguizmo\cimguizmo.vcxproj", "{F258347D-31BE-4605-98CE-40E43BDF6F9D}"
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
Global
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}.Release|Any CPU.ActiveCfg = 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
- {A0A3C0AC-18D9-4C74-8CFC-14E53512846D}.Debug|Any CPU.Build.0 = Debug|x64
- {A0A3C0AC-18D9-4C74-8CFC-14E53512846D}.Release|Any CPU.ActiveCfg = Release|x64
- {A0A3C0AC-18D9-4C74-8CFC-14E53512846D}.Release|Any CPU.Build.0 = Release|x64
+ {B0AA8737-33A3-4766-8CBE-A48F2EF283BA}.Debug|Any CPU.ActiveCfg = Debug|x64
+ {B0AA8737-33A3-4766-8CBE-A48F2EF283BA}.Debug|Any CPU.Build.0 = Debug|x64
+ {B0AA8737-33A3-4766-8CBE-A48F2EF283BA}.Release|Any CPU.ActiveCfg = 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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -160,7 +174,9 @@ Global
{8BBACF2D-7AB8-4610-A115-0E363D35C291} = {E15BDA6D-E881-4482-94BA-BE5527E917FF}
{76CAA246-C405-4A8C-B0AE-F4A0EF3D4E16} = {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
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {79B65AC9-C940-410E-AB61-7EA7E12C7599}
diff --git a/Dalamud/AssemblyInfo.cs b/Dalamud/AssemblyInfo.cs
new file mode 100644
index 000000000..a22fbd183
--- /dev/null
+++ b/Dalamud/AssemblyInfo.cs
@@ -0,0 +1,3 @@
+using System.Runtime.CompilerServices;
+
+//[assembly: DisableRuntimeMarshalling]
diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj
index 210ada844..f6566d2c3 100644
--- a/Dalamud/Dalamud.csproj
+++ b/Dalamud/Dalamud.csproj
@@ -66,7 +66,7 @@
-
+
all
@@ -103,8 +103,10 @@
+
+
+
-
diff --git a/Dalamud/EntryPoint.cs b/Dalamud/EntryPoint.cs
index f6ba990e6..c870b23a8 100644
--- a/Dalamud/EntryPoint.cs
+++ b/Dalamud/EntryPoint.cs
@@ -1,10 +1,14 @@
using System.Diagnostics;
using System.IO;
using System.Net;
+using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
+using Windows.Win32.Foundation;
+using Windows.Win32.UI.WindowsAndMessaging;
+
using Dalamud.Common;
using Dalamud.Configuration.Internal;
using Dalamud.Interface.Internal.Windows;
@@ -58,7 +62,7 @@ public sealed class EntryPoint
var info = JsonConvert.DeserializeObject(infoStr)!;
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();
}
@@ -135,6 +139,8 @@ public sealed class EntryPoint
/// Event used to signal the main thread to continue.
private static void RunThread(DalamudStartInfo info, IntPtr mainThreadContinueEvent)
{
+ NativeLibrary.Load(Path.Combine(info.WorkingDirectory!, "cimgui.dll"));
+
// Setup logger
InitLogging(info.LogPath!, info.BootShowConsole, true, info.LogName);
SerilogEventSink.Instance.LogLine += SerilogOnLogLine;
@@ -304,14 +310,14 @@ public sealed class EntryPoint
// ignored
}
- const MessageBoxType flags = NativeFunctions.MessageBoxType.YesNo | NativeFunctions.MessageBoxType.IconError | NativeFunctions.MessageBoxType.SystemModal;
- var result = MessageBoxW(
- Process.GetCurrentProcess().MainWindowHandle,
+ const MESSAGEBOX_STYLE flags = MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONERROR | MESSAGEBOX_STYLE.MB_SYSTEMMODAL;
+ var result = Windows.Win32.PInvoke.MessageBox(
+ 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?",
"Dalamud",
flags);
- if (result == (int)User32.MessageBoxResult.IDYES)
+ if (result == MESSAGEBOX_RESULT.IDYES)
{
Log.Information("User chose to disable plugins on next launch...");
var config = Service.Get();
diff --git a/Dalamud/Game/ClientState/GamePad/GamepadState.cs b/Dalamud/Game/ClientState/GamePad/GamepadState.cs
index 5237c6f0c..90484f0f1 100644
--- a/Dalamud/Game/ClientState/GamePad/GamepadState.cs
+++ b/Dalamud/Game/ClientState/GamePad/GamepadState.cs
@@ -7,7 +7,7 @@ using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.System.Input;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
namespace Dalamud.Game.ClientState.GamePad;
diff --git a/Dalamud/Game/Gui/GameGui.cs b/Dalamud/Game/Gui/GameGui.cs
index d3fe444ea..9e161bcd3 100644
--- a/Dalamud/Game/Gui/GameGui.cs
+++ b/Dalamud/Game/Gui/GameGui.cs
@@ -18,7 +18,7 @@ using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using FFXIVClientStructs.FFXIV.Common.Component.BGCollision;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Vector2 = System.Numerics.Vector2;
using Vector3 = System.Numerics.Vector3;
@@ -75,7 +75,7 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui
}
// Hooked delegates
-
+
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
private delegate char HandleImmDelegate(IntPtr framework, char a2, byte a3);
diff --git a/Dalamud/Hooking/Internal/FunctionPointerVariableHook.cs b/Dalamud/Hooking/Internal/FunctionPointerVariableHook.cs
index 40a33fc1b..399643592 100644
--- a/Dalamud/Hooking/Internal/FunctionPointerVariableHook.cs
+++ b/Dalamud/Hooking/Internal/FunctionPointerVariableHook.cs
@@ -1,18 +1,23 @@
using System.Collections.Generic;
-using System.ComponentModel;
using System.Reflection;
using System.Runtime.InteropServices;
+using Windows.Win32.System.Memory;
+
using Dalamud.Memory;
using JetBrains.Annotations;
+using PInvoke;
+
+using Win32Exception = System.ComponentModel.Win32Exception;
+
namespace Dalamud.Hooking.Internal;
///
/// Manages a hook with MinHook.
///
/// Delegate type to represents a function prototype. This must be the same prototype as original function do.
-internal class FunctionPointerVariableHook : Hook
+internal unsafe class FunctionPointerVariableHook : Hook
where T : Delegate
{
private readonly nint pfnDetour;
@@ -55,11 +60,11 @@ internal class FunctionPointerVariableHook : Hook
// 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.
// Therefore we're using VirtualAlloc instead of HeapCreate/HeapAlloc.
- var pfnThunkBytes = (byte*)NativeFunctions.VirtualAlloc(
- 0,
+ var pfnThunkBytes = (byte*)Windows.Win32.PInvoke.VirtualAlloc(
+ null,
12,
- NativeFunctions.AllocationType.Reserve | NativeFunctions.AllocationType.Commit,
- MemoryProtection.ExecuteReadWrite);
+ VIRTUAL_ALLOCATION_TYPE.MEM_RESERVE | VIRTUAL_ALLOCATION_TYPE.MEM_COMMIT,
+ PAGE_PROTECTION_FLAGS.PAGE_EXECUTE_READWRITE);
if (pfnThunkBytes == null)
{
throw new OutOfMemoryException("Failed to allocate memory for import hooks.");
@@ -78,10 +83,10 @@ internal class FunctionPointerVariableHook : Hook
this.ppfnThunkJumpTarget = this.pfnThunk + 2;
- if (!NativeFunctions.VirtualProtect(
- this.Address,
+ if (!Windows.Win32.PInvoke.VirtualProtect(
+ this.Address.ToPointer(),
(UIntPtr)Marshal.SizeOf(),
- MemoryProtection.ExecuteReadWrite,
+ PAGE_PROTECTION_FLAGS.PAGE_EXECUTE_READWRITE,
out var oldProtect))
{
throw new Win32Exception(Marshal.GetLastWin32Error());
@@ -93,7 +98,7 @@ internal class FunctionPointerVariableHook : Hook
Marshal.WriteIntPtr(this.Address, this.pfnThunk);
// This really should not fail, but then even if it does, whatever.
- NativeFunctions.VirtualProtect(this.Address, (UIntPtr)Marshal.SizeOf(), oldProtect, out _);
+ Windows.Win32.PInvoke.VirtualProtect(this.Address.ToPointer(), (UIntPtr)Marshal.SizeOf(), oldProtect, out _);
// Add afterwards, so the hookIdent starts at 0.
indexList.Add(this);
diff --git a/Dalamud/Interface/Components/ImGuiComponents.ColorPickerWithPalette.cs b/Dalamud/Interface/Components/ImGuiComponents.ColorPickerWithPalette.cs
index e2f68eab2..106938a9c 100644
--- a/Dalamud/Interface/Components/ImGuiComponents.ColorPickerWithPalette.cs
+++ b/Dalamud/Interface/Components/ImGuiComponents.ColorPickerWithPalette.cs
@@ -3,7 +3,7 @@ using System.Numerics;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components;
diff --git a/Dalamud/Interface/Components/ImGuiComponents.DisabledButton.cs b/Dalamud/Interface/Components/ImGuiComponents.DisabledButton.cs
index ab2ed4724..e864d13d4 100644
--- a/Dalamud/Interface/Components/ImGuiComponents.DisabledButton.cs
+++ b/Dalamud/Interface/Components/ImGuiComponents.DisabledButton.cs
@@ -2,7 +2,7 @@ using System.Numerics;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components;
diff --git a/Dalamud/Interface/Components/ImGuiComponents.HelpMarker.cs b/Dalamud/Interface/Components/ImGuiComponents.HelpMarker.cs
index 3392136d1..4312aed83 100644
--- a/Dalamud/Interface/Components/ImGuiComponents.HelpMarker.cs
+++ b/Dalamud/Interface/Components/ImGuiComponents.HelpMarker.cs
@@ -2,7 +2,7 @@ using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Common.Math;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components;
diff --git a/Dalamud/Interface/Components/ImGuiComponents.IconButton.cs b/Dalamud/Interface/Components/ImGuiComponents.IconButton.cs
index 3e61e16bb..20eda4ce8 100644
--- a/Dalamud/Interface/Components/ImGuiComponents.IconButton.cs
+++ b/Dalamud/Interface/Components/ImGuiComponents.IconButton.cs
@@ -3,7 +3,7 @@ using System.Numerics;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components;
diff --git a/Dalamud/Interface/Components/ImGuiComponents.IconButtonSelect.cs b/Dalamud/Interface/Components/ImGuiComponents.IconButtonSelect.cs
index 99050473f..89442ca73 100644
--- a/Dalamud/Interface/Components/ImGuiComponents.IconButtonSelect.cs
+++ b/Dalamud/Interface/Components/ImGuiComponents.IconButtonSelect.cs
@@ -4,7 +4,7 @@ using System.Numerics;
using Dalamud.Interface.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components;
diff --git a/Dalamud/Interface/Components/ImGuiComponents.Test.cs b/Dalamud/Interface/Components/ImGuiComponents.Test.cs
index ddc083cd8..ee2496513 100644
--- a/Dalamud/Interface/Components/ImGuiComponents.Test.cs
+++ b/Dalamud/Interface/Components/ImGuiComponents.Test.cs
@@ -1,4 +1,4 @@
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components;
diff --git a/Dalamud/Interface/Components/ImGuiComponents.TextWithLabel.cs b/Dalamud/Interface/Components/ImGuiComponents.TextWithLabel.cs
index 43b54fc93..42c3a6e4b 100644
--- a/Dalamud/Interface/Components/ImGuiComponents.TextWithLabel.cs
+++ b/Dalamud/Interface/Components/ImGuiComponents.TextWithLabel.cs
@@ -1,6 +1,6 @@
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components;
diff --git a/Dalamud/Interface/Components/ImGuiComponents.ToggleSwitch.cs b/Dalamud/Interface/Components/ImGuiComponents.ToggleSwitch.cs
index 6d6e0f6c3..b114eafd7 100644
--- a/Dalamud/Interface/Components/ImGuiComponents.ToggleSwitch.cs
+++ b/Dalamud/Interface/Components/ImGuiComponents.ToggleSwitch.cs
@@ -1,6 +1,6 @@
using System.Numerics;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Components;
diff --git a/Dalamud/Interface/DragDrop/DragDropManager.cs b/Dalamud/Interface/DragDrop/DragDropManager.cs
index f3acd704d..0f75d90af 100644
--- a/Dalamud/Interface/DragDrop/DragDropManager.cs
+++ b/Dalamud/Interface/DragDrop/DragDropManager.cs
@@ -5,7 +5,7 @@ using Dalamud.Interface.Internal;
using Dalamud.IoC;
using Dalamud.IoC.Internal;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
namespace Dalamud.Interface.DragDrop;
@@ -103,7 +103,7 @@ internal partial class DragDropManager : IInternalDisposableService, IDragDropMa
}
///
- public void CreateImGuiSource(string label, Func validityCheck, Func tooltipBuilder)
+ public unsafe void CreateImGuiSource(string label, Func validityCheck, Func tooltipBuilder)
{
if (!this.IsDragging && !this.IsDropping())
{
@@ -115,7 +115,7 @@ internal partial class DragDropManager : IInternalDisposableService, IDragDropMa
return;
}
- ImGui.SetDragDropPayload(label, nint.Zero, 0);
+ ImGui.SetDragDropPayload(label, null, 0);
if (this.CheckTooltipFrame(out var frame) && tooltipBuilder(this))
{
this.lastTooltipFrame = frame;
@@ -136,7 +136,7 @@ internal partial class DragDropManager : IInternalDisposableService, IDragDropMa
unsafe
{
- if (ImGui.AcceptDragDropPayload(label, ImGuiDragDropFlags.AcceptBeforeDelivery).NativePtr != null && this.IsDropping())
+ if (ImGui.AcceptDragDropPayload(label, ImGuiDragDropFlags.AcceptBeforeDelivery).Handle != null && this.IsDropping())
{
this.lastDropFrame = -2;
files = this.Files;
diff --git a/Dalamud/Interface/DragDrop/DragDropTarget.cs b/Dalamud/Interface/DragDrop/DragDropTarget.cs
index 8115e7353..344b7fbb8 100644
--- a/Dalamud/Interface/DragDrop/DragDropTarget.cs
+++ b/Dalamud/Interface/DragDrop/DragDropTarget.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices.ComTypes;
using System.Text;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
namespace Dalamud.Interface.DragDrop;
diff --git a/Dalamud/Interface/FontIdentifier/DalamudAssetFontAndFamilyId.cs b/Dalamud/Interface/FontIdentifier/DalamudAssetFontAndFamilyId.cs
index a6d40e4b7..eaf867924 100644
--- a/Dalamud/Interface/FontIdentifier/DalamudAssetFontAndFamilyId.cs
+++ b/Dalamud/Interface/FontIdentifier/DalamudAssetFontAndFamilyId.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Storage.Assets;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Newtonsoft.Json;
diff --git a/Dalamud/Interface/FontIdentifier/DalamudDefaultFontAndFamilyId.cs b/Dalamud/Interface/FontIdentifier/DalamudDefaultFontAndFamilyId.cs
index 7c6a69622..7bad13f11 100644
--- a/Dalamud/Interface/FontIdentifier/DalamudDefaultFontAndFamilyId.cs
+++ b/Dalamud/Interface/FontIdentifier/DalamudDefaultFontAndFamilyId.cs
@@ -2,7 +2,7 @@ using System.Collections.Generic;
using Dalamud.Interface.ManagedFontAtlas;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Newtonsoft.Json;
diff --git a/Dalamud/Interface/FontIdentifier/GameFontAndFamilyId.cs b/Dalamud/Interface/FontIdentifier/GameFontAndFamilyId.cs
index dd4ba0d66..065b71e33 100644
--- a/Dalamud/Interface/FontIdentifier/GameFontAndFamilyId.cs
+++ b/Dalamud/Interface/FontIdentifier/GameFontAndFamilyId.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using Dalamud.Interface.GameFonts;
using Dalamud.Interface.ManagedFontAtlas;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Newtonsoft.Json;
diff --git a/Dalamud/Interface/FontIdentifier/IFontId.cs b/Dalamud/Interface/FontIdentifier/IFontId.cs
index 4c611edf8..21b06f25b 100644
--- a/Dalamud/Interface/FontIdentifier/IFontId.cs
+++ b/Dalamud/Interface/FontIdentifier/IFontId.cs
@@ -1,6 +1,6 @@
using Dalamud.Interface.ManagedFontAtlas;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.FontIdentifier;
diff --git a/Dalamud/Interface/FontIdentifier/IFontSpec.cs b/Dalamud/Interface/FontIdentifier/IFontSpec.cs
index 4d0719d4e..7ae1e5914 100644
--- a/Dalamud/Interface/FontIdentifier/IFontSpec.cs
+++ b/Dalamud/Interface/FontIdentifier/IFontSpec.cs
@@ -1,6 +1,6 @@
using Dalamud.Interface.ManagedFontAtlas;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.FontIdentifier;
diff --git a/Dalamud/Interface/FontIdentifier/SingleFontSpec.cs b/Dalamud/Interface/FontIdentifier/SingleFontSpec.cs
index 946215b85..e362f1308 100644
--- a/Dalamud/Interface/FontIdentifier/SingleFontSpec.cs
+++ b/Dalamud/Interface/FontIdentifier/SingleFontSpec.cs
@@ -6,7 +6,7 @@ using System.Text;
using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Interface.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Newtonsoft.Json;
diff --git a/Dalamud/Interface/FontIdentifier/SystemFontId.cs b/Dalamud/Interface/FontIdentifier/SystemFontId.cs
index 0a350fc3a..21ccccd3e 100644
--- a/Dalamud/Interface/FontIdentifier/SystemFontId.cs
+++ b/Dalamud/Interface/FontIdentifier/SystemFontId.cs
@@ -5,7 +5,7 @@ using System.Linq;
using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Newtonsoft.Json;
@@ -38,7 +38,7 @@ public sealed class SystemFontId : IFontId
this.EnglishName = name;
else if (this.LocaleNames.TryGetValue("en", out name))
this.EnglishName = name;
- else
+ else
this.EnglishName = this.LocaleNames.Values.First();
}
diff --git a/Dalamud/Interface/GameFonts/GameFontLayoutPlan.cs b/Dalamud/Interface/GameFonts/GameFontLayoutPlan.cs
index 6b602d911..5b0fe100b 100644
--- a/Dalamud/Interface/GameFonts/GameFontLayoutPlan.cs
+++ b/Dalamud/Interface/GameFonts/GameFontLayoutPlan.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Numerics;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.GameFonts;
diff --git a/Dalamud/Interface/ImGuiBackend/Dx11Win32Backend.cs b/Dalamud/Interface/ImGuiBackend/Dx11Win32Backend.cs
index 1346de439..1331b6cfe 100644
--- a/Dalamud/Interface/ImGuiBackend/Dx11Win32Backend.cs
+++ b/Dalamud/Interface/ImGuiBackend/Dx11Win32Backend.cs
@@ -1,15 +1,19 @@
+using System.Diagnostics;
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.InputHandler;
using Dalamud.Interface.ImGuiBackend.Renderers;
using Dalamud.Utility;
-using ImGuiNET;
-
-using ImGuizmoNET;
-
-using ImPlotNET;
+using Serilog;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -67,6 +71,58 @@ internal sealed unsafe class Dx11Win32Backend : IWin32Backend
this.WindowHandle = desc.OutputWindow;
var ctx = ImGui.CreateContext();
+
+ Debug.Assert(!ctx.IsNull);
+ var windowOff = Marshal.OffsetOf("CurrentWindow");
+ //Debug.Assert(windowOff == 16368);
+
+ /*
+ void ShowOffset(string name)
+ {
+ // var off = Marshal.OffsetOf(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()} - {sizeof(Test)}", "", false);
+
+ ShowOffset("ClipboardUserData");
+ ShowOffset("MouseDrawCursor");
+
+ ShowOffset("MouseDelta");
+ ShowOffset("KeysDown_0");
+ ShowOffset("MousePos");
+
+ ShowOffset("KeyMods");
+ */
+
+ void ShowAllFields()
+ {
+ 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();
+
+ var contextSize = Unsafe.SizeOf();
+ var ioSize = Unsafe.SizeOf();
+ var platformIoSize = Unsafe.SizeOf();
+
+ //Debug.Assert(contextSize == 22688);
+ //Debug.Assert(ioSize == 14352);
+ //Debug.Assert(platformIoSize == 216);
+
+ //var platformIoOff = Unsafe.OffsetOf("PlatformIO");
+ //Debug.Assert(platformIoOff == 14360);
+
+ Util.Fatal("bleh", "bleh", false);
+
ImGuizmo.SetImGuiContext(ctx);
ImPlot.SetImGuiContext(ctx);
ImPlot.CreateContext();
@@ -234,8 +290,8 @@ internal sealed unsafe class Dx11Win32Backend : IWin32Backend
if (this.device.IsEmpty())
return;
- this.imguiRenderer.Dispose();
- this.imguiInput.Dispose();
+ this.imguiRenderer?.Dispose();
+ this.imguiInput?.Dispose();
ImGui.DestroyContext();
@@ -245,3 +301,4 @@ internal sealed unsafe class Dx11Win32Backend : IWin32Backend
this.swapChainPossiblyWrapped.Dispose();
}
}
+
diff --git a/Dalamud/Interface/ImGuiBackend/Helpers/ImGuiViewportHelpers.cs b/Dalamud/Interface/ImGuiBackend/Helpers/ImGuiViewportHelpers.cs
index c951eab1b..bbcaa618e 100644
--- a/Dalamud/Interface/ImGuiBackend/Helpers/ImGuiViewportHelpers.cs
+++ b/Dalamud/Interface/ImGuiBackend/Helpers/ImGuiViewportHelpers.cs
@@ -3,7 +3,7 @@ using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using TerraFX.Interop.Windows;
@@ -68,7 +68,7 @@ internal static class ImGuiViewportHelpers
/// An instance of .
/// Same value with .
public unsafe delegate Vector2* GetWindowPosDelegate(Vector2* returnStorage, ImGuiViewportPtr viewport);
-
+
///
/// Delegate to be called when the window should be moved.
///
@@ -83,7 +83,7 @@ internal static class ImGuiViewportHelpers
/// An instance of .
/// Same value with .
public unsafe delegate Vector2* GetWindowSizeDelegate(Vector2* returnStorage, ImGuiViewportPtr viewport);
-
+
///
/// Delegate to be called when the window should be given focus.
///
diff --git a/Dalamud/Interface/ImGuiBackend/InputHandler/Win32InputHandler.StaticLookupFunctions.cs b/Dalamud/Interface/ImGuiBackend/InputHandler/Win32InputHandler.StaticLookupFunctions.cs
index 7732f0867..5710a5991 100644
--- a/Dalamud/Interface/ImGuiBackend/InputHandler/Win32InputHandler.StaticLookupFunctions.cs
+++ b/Dalamud/Interface/ImGuiBackend/InputHandler/Win32InputHandler.StaticLookupFunctions.cs
@@ -1,6 +1,6 @@
using System.Runtime.CompilerServices;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using TerraFX.Interop.Windows;
@@ -75,16 +75,16 @@ internal sealed partial class Win32InputHandler
VK.VK_RMENU => ImGuiKey.RightAlt,
VK.VK_RWIN => ImGuiKey.RightSuper,
VK.VK_APPS => ImGuiKey.Menu,
- '0' => ImGuiKey._0,
- '1' => ImGuiKey._1,
- '2' => ImGuiKey._2,
- '3' => ImGuiKey._3,
- '4' => ImGuiKey._4,
- '5' => ImGuiKey._5,
- '6' => ImGuiKey._6,
- '7' => ImGuiKey._7,
- '8' => ImGuiKey._8,
- '9' => ImGuiKey._9,
+ '0' => ImGuiKey.Key0,
+ '1' => ImGuiKey.Key1,
+ '2' => ImGuiKey.Key2,
+ '3' => ImGuiKey.Key3,
+ '4' => ImGuiKey.Key4,
+ '5' => ImGuiKey.Key5,
+ '6' => ImGuiKey.Key6,
+ '7' => ImGuiKey.Key7,
+ '8' => ImGuiKey.Key8,
+ '9' => ImGuiKey.Key9,
'A' => ImGuiKey.A,
'B' => ImGuiKey.B,
'C' => ImGuiKey.C,
@@ -190,16 +190,16 @@ internal sealed partial class Win32InputHandler
ImGuiKey.RightAlt => VK.VK_RMENU,
ImGuiKey.RightSuper => VK.VK_RWIN,
ImGuiKey.Menu => VK.VK_APPS,
- ImGuiKey._0 => '0',
- ImGuiKey._1 => '1',
- ImGuiKey._2 => '2',
- ImGuiKey._3 => '3',
- ImGuiKey._4 => '4',
- ImGuiKey._5 => '5',
- ImGuiKey._6 => '6',
- ImGuiKey._7 => '7',
- ImGuiKey._8 => '8',
- ImGuiKey._9 => '9',
+ ImGuiKey.Key0 => '0',
+ ImGuiKey.Key1 => '1',
+ ImGuiKey.Key2 => '2',
+ ImGuiKey.Key3 => '3',
+ ImGuiKey.Key4 => '4',
+ ImGuiKey.Key5 => '5',
+ ImGuiKey.Key6 => '6',
+ ImGuiKey.Key7 => '7',
+ ImGuiKey.Key8 => '8',
+ ImGuiKey.Key9 => '9',
ImGuiKey.A => 'A',
ImGuiKey.B => 'B',
ImGuiKey.C => 'C',
@@ -274,14 +274,14 @@ internal sealed partial class Win32InputHandler
private static void UpAllKeys()
{
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);
}
private static void UpAllMouseButton()
{
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;
}
diff --git a/Dalamud/Interface/ImGuiBackend/InputHandler/Win32InputHandler.cs b/Dalamud/Interface/ImGuiBackend/InputHandler/Win32InputHandler.cs
index 18fd82651..ff71ecdf7 100644
--- a/Dalamud/Interface/ImGuiBackend/InputHandler/Win32InputHandler.cs
+++ b/Dalamud/Interface/ImGuiBackend/InputHandler/Win32InputHandler.cs
@@ -6,7 +6,9 @@ using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
+
+using Serilog;
using TerraFX.Interop.Windows;
@@ -51,7 +53,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
public Win32InputHandler(HWND hWnd)
{
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.");
this.hWnd = hWnd;
@@ -66,7 +68,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
ImGuiBackendFlags.PlatformHasViewports;
this.platformNamePtr = Marshal.StringToHGlobalAnsi("imgui_impl_win32_c#");
- io.NativePtr->BackendPlatformName = (byte*)this.platformNamePtr;
+ io.Handle->BackendPlatformName = (byte*)this.platformNamePtr;
var mainViewport = ImGui.GetMainViewport();
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.TextInput] = LoadCursorW(default, IDC.IDC_IBEAM);
this.cursors[(int)ImGuiMouseCursor.ResizeAll] = LoadCursorW(default, IDC.IDC_SIZEALL);
- this.cursors[(int)ImGuiMouseCursor.ResizeEW] = LoadCursorW(default, IDC.IDC_SIZEWE);
- this.cursors[(int)ImGuiMouseCursor.ResizeNS] = LoadCursorW(default, IDC.IDC_SIZENS);
- this.cursors[(int)ImGuiMouseCursor.ResizeNESW] = LoadCursorW(default, IDC.IDC_SIZENESW);
- this.cursors[(int)ImGuiMouseCursor.ResizeNWSE] = LoadCursorW(default, IDC.IDC_SIZENWSE);
+ this.cursors[(int)ImGuiMouseCursor.ResizeEw] = LoadCursorW(default, IDC.IDC_SIZEWE);
+ this.cursors[(int)ImGuiMouseCursor.ResizeNs] = LoadCursorW(default, IDC.IDC_SIZENS);
+ this.cursors[(int)ImGuiMouseCursor.ResizeNesw] = LoadCursorW(default, IDC.IDC_SIZENESW);
+ this.cursors[(int)ImGuiMouseCursor.ResizeNwse] = LoadCursorW(default, IDC.IDC_SIZENWSE);
this.cursors[(int)ImGuiMouseCursor.Hand] = LoadCursorW(default, IDC.IDC_HAND);
this.cursors[(int)ImGuiMouseCursor.NotAllowed] = LoadCursorW(default, IDC.IDC_NO);
}
@@ -136,7 +138,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
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
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;
}
@@ -216,7 +218,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
/// Return value, if not doing further processing.
public LRESULT? ProcessWndProcW(HWND hWndCurrent, uint msg, WPARAM wParam, LPARAM lParam)
{
- if (ImGui.GetCurrentContext() == nint.Zero)
+ if (ImGui.GetCurrentContext().IsNull)
return null;
var io = ImGui.GetIO();
@@ -469,7 +471,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
// See: https://github.com/goatcorp/ImGuiScene/pull/13
// > GetForegroundWindow from winuser.h is a surprisingly expensive function.
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.
// 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
// So we have to handle some messages ourselves
// 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);
var viewport = ImGui.FindViewportByPlatformHandle(hWndCurrent);
- if (viewport.NativePtr == null)
+ if (viewport.Handle == null)
return DefWindowProcW(hWndCurrent, msg, wParam, lParam);
switch (msg)
@@ -556,14 +558,14 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
this.cursors.AsSpan().Clear();
- if (ImGui.GetIO().NativePtr->BackendPlatformName == (void*)this.platformNamePtr)
- ImGui.GetIO().NativePtr->BackendPlatformName = null;
+ if (ImGui.GetIO().Handle->BackendPlatformName == (void*)this.platformNamePtr)
+ ImGui.GetIO().Handle->BackendPlatformName = null;
if (this.platformNamePtr != nint.Zero)
Marshal.FreeHGlobal(this.platformNamePtr);
if (this.iniPathPtr != nint.Zero)
{
- ImGui.GetIO().NativePtr->IniFilename = null;
+ ImGui.GetIO().Handle->IniFilename = null;
Marshal.FreeHGlobal(this.iniPathPtr);
this.iniPathPtr = nint.Zero;
}
@@ -587,20 +589,20 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
this.classNamePtr = Marshal.StringToHGlobalUni("ImGui Platform");
var pio = ImGui.GetPlatformIO();
- pio.Platform_CreateWindow = this.RegisterFunctionPointer(this.OnCreateWindow);
- pio.Platform_DestroyWindow = this.RegisterFunctionPointer(this.OnDestroyWindow);
- pio.Platform_ShowWindow = this.RegisterFunctionPointer(this.OnShowWindow);
- pio.Platform_SetWindowPos = this.RegisterFunctionPointer(this.OnSetWindowPos);
- pio.Platform_GetWindowPos = this.RegisterFunctionPointer(this.OnGetWindowPos);
- pio.Platform_SetWindowSize = this.RegisterFunctionPointer(this.OnSetWindowSize);
- pio.Platform_GetWindowSize = this.RegisterFunctionPointer(this.OnGetWindowSize);
- pio.Platform_SetWindowFocus = this.RegisterFunctionPointer(this.OnSetWindowFocus);
- pio.Platform_GetWindowFocus = this.RegisterFunctionPointer(this.OnGetWindowFocus);
- pio.Platform_GetWindowMinimized =
+ pio.PlatformCreateWindow = this.RegisterFunctionPointer(this.OnCreateWindow);
+ pio.PlatformDestroyWindow = this.RegisterFunctionPointer(this.OnDestroyWindow);
+ pio.PlatformShowWindow = this.RegisterFunctionPointer(this.OnShowWindow);
+ pio.PlatformSetWindowPos = this.RegisterFunctionPointer(this.OnSetWindowPos);
+ pio.PlatformGetWindowPos = this.RegisterFunctionPointer(this.OnGetWindowPos);
+ pio.PlatformSetWindowSize = this.RegisterFunctionPointer(this.OnSetWindowSize);
+ pio.PlatformGetWindowSize = this.RegisterFunctionPointer(this.OnGetWindowSize);
+ pio.PlatformSetWindowFocus = this.RegisterFunctionPointer(this.OnSetWindowFocus);
+ pio.PlatformGetWindowFocus = this.RegisterFunctionPointer(this.OnGetWindowFocus);
+ pio.PlatformGetWindowMinimized =
this.RegisterFunctionPointer(this.OnGetWindowMinimized);
- pio.Platform_SetWindowTitle = this.RegisterFunctionPointer(this.OnSetWindowTitle);
- pio.Platform_SetWindowAlpha = this.RegisterFunctionPointer(this.OnSetWindowAlpha);
- pio.Platform_UpdateWindow = this.RegisterFunctionPointer(this.OnUpdateWindow);
+ pio.PlatformSetWindowTitle = this.RegisterFunctionPointer(this.OnSetWindowTitle);
+ pio.PlatformSetWindowAlpha = this.RegisterFunctionPointer(this.OnSetWindowAlpha);
+ pio.PlatformUpdateWindow = this.RegisterFunctionPointer(this.OnUpdateWindow);
// pio.Platform_SetImeInputPos = this.RegisterFunctionPointer(this.OnSetImeInputPos);
// pio.Platform_GetWindowDpiScale = this.RegisterFunctionPointer(this.OnGetWindowDpiScale);
// pio.Platform_ChangedViewport = this.RegisterFunctionPointer(this.OnChangedViewport);
@@ -624,7 +626,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
var mainViewport = ImGui.GetMainViewport();
var data = (ImGuiViewportDataWin32*)Marshal.AllocHGlobal(Marshal.SizeOf());
- mainViewport.PlatformUserData = (nint)data;
+ mainViewport.PlatformUserData = data;
data->Hwnd = this.input.hWnd;
data->HwndOwned = false;
mainViewport.PlatformHandle = this.input.hWnd;
@@ -637,12 +639,12 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
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,
// 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);
- ImGui.GetPlatformIO().NativePtr->Monitors = default;
+ Marshal.FreeHGlobal(new IntPtr(ImGui.GetPlatformIO().Handle->Monitors.Data));
+ ImGui.GetPlatformIO().Handle->Monitors = default;
}
if (this.classNamePtr != 0)
@@ -652,19 +654,19 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
this.classNamePtr = 0;
}
- pio.Platform_CreateWindow = nint.Zero;
- pio.Platform_DestroyWindow = nint.Zero;
- pio.Platform_ShowWindow = nint.Zero;
- pio.Platform_SetWindowPos = nint.Zero;
- pio.Platform_GetWindowPos = nint.Zero;
- pio.Platform_SetWindowSize = nint.Zero;
- pio.Platform_GetWindowSize = nint.Zero;
- pio.Platform_SetWindowFocus = nint.Zero;
- pio.Platform_GetWindowFocus = nint.Zero;
- pio.Platform_GetWindowMinimized = nint.Zero;
- pio.Platform_SetWindowTitle = nint.Zero;
- pio.Platform_SetWindowAlpha = nint.Zero;
- pio.Platform_UpdateWindow = nint.Zero;
+ pio.PlatformCreateWindow = null;
+ pio.PlatformDestroyWindow = null;
+ pio.PlatformShowWindow = null;
+ pio.PlatformSetWindowPos = null;
+ pio.PlatformGetWindowPos = null;
+ pio.PlatformSetWindowSize = null;
+ pio.PlatformGetWindowSize = null;
+ pio.PlatformSetWindowFocus = null;
+ pio.PlatformGetWindowFocus = null;
+ pio.PlatformGetWindowMinimized = null;
+ pio.PlatformSetWindowTitle = null;
+ pio.PlatformSetWindowAlpha = null;
+ pio.PlatformUpdateWindow = null;
// pio.Platform_SetImeInputPos = nint.Zero;
// pio.Platform_GetWindowDpiScale = nint.Zero;
// pio.Platform_ChangedViewport = nint.Zero;
@@ -685,15 +687,15 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
var pio = ImGui.GetPlatformIO();
var numMonitors = GetSystemMetrics(SM.SM_CMONITORS);
var data = Marshal.AllocHGlobal(Marshal.SizeOf() * numMonitors);
- if (pio.NativePtr->Monitors.Data != 0)
- Marshal.FreeHGlobal(pio.NativePtr->Monitors.Data);
- pio.NativePtr->Monitors = new(numMonitors, numMonitors, data);
+ if (pio.Handle->Monitors.Data != null)
+ Marshal.FreeHGlobal(new IntPtr(pio.Handle->Monitors.Data));
+ pio.Handle->Monitors = new(numMonitors, numMonitors, (ImGuiPlatformMonitor*)data.ToPointer());
// ImGuiPlatformIOPtr platformIO = ImGui.GetPlatformIO();
- // Marshal.FreeHGlobal(platformIO.NativePtr->Monitors.Data);
+ // Marshal.FreeHGlobal(platformIO.Handle->Monitors.Data);
// int numMonitors = GetSystemMetrics(SystemMetric.SM_CMONITORS);
// nint data = Marshal.AllocHGlobal(Marshal.SizeOf() * numMonitors);
- // platformIO.NativePtr->Monitors = new ImVector(numMonitors, numMonitors, data);
+ // platformIO.Handle->Monitors = new ImVector(numMonitors, numMonitors, data);
var monitorIndex = -1;
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);
// 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.MainSize = monitorRb - monitorLt;
imMonitor.WorkPos = workLt;
@@ -723,18 +725,31 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
null,
(delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(enumfn),
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 obj)
+ private void* RegisterFunctionPointer(T obj)
{
this.delegateReferences.Add(obj);
- return Marshal.GetFunctionPointerForDelegate(obj);
+ return Marshal.GetFunctionPointerForDelegate(obj).ToPointer();
}
private void OnCreateWindow(ImGuiViewportPtr viewport)
{
var data = (ImGuiViewportDataWin32*)Marshal.AllocHGlobal(Marshal.SizeOf());
- viewport.PlatformUserData = (nint)data;
+ viewport.PlatformUserData = data;
viewport.Flags =
ImGuiViewportFlags.NoTaskBarIcon |
ImGuiViewportFlags.NoFocusOnClick |
@@ -784,7 +799,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
private void OnDestroyWindow(ImGuiViewportPtr viewport)
{
// 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;
@@ -807,8 +822,8 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
}
data->Hwnd = default;
- Marshal.FreeHGlobal(viewport.PlatformUserData);
- viewport.PlatformUserData = viewport.PlatformHandle = nint.Zero;
+ Marshal.FreeHGlobal(new IntPtr(viewport.PlatformUserData));
+ viewport.PlatformUserData = viewport.PlatformHandle = null;
}
private void OnShowWindow(ImGuiViewportPtr viewport)
diff --git a/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.ViewportHandler.cs b/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.ViewportHandler.cs
index 7fcbe432c..ffe792964 100644
--- a/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.ViewportHandler.cs
+++ b/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.ViewportHandler.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using Dalamud.Interface.ImGuiBackend.Helpers;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -36,11 +36,11 @@ internal unsafe partial class Dx11Renderer
this.renderer = renderer;
var pio = ImGui.GetPlatformIO();
- pio.Renderer_CreateWindow = Marshal.GetFunctionPointerForDelegate(this.cwd = this.OnCreateWindow);
- pio.Renderer_DestroyWindow = (nint)(delegate* unmanaged)&OnDestroyWindow;
- pio.Renderer_SetWindowSize = (nint)(delegate* unmanaged)&OnSetWindowSize;
- pio.Renderer_RenderWindow = (nint)(delegate* unmanaged)&OnRenderWindow;
- pio.Renderer_SwapBuffers = (nint)(delegate* unmanaged)&OnSwapBuffers;
+ pio.RendererCreateWindow = Marshal.GetFunctionPointerForDelegate(this.cwd = this.OnCreateWindow).ToPointer();
+ pio.RendererDestroyWindow = (delegate* unmanaged)&OnDestroyWindow;
+ pio.RendererSetWindowSize = (delegate* unmanaged)&OnSetWindowSize;
+ pio.RendererRenderWindow = (delegate* unmanaged)&OnRenderWindow;
+ pio.RendererSwapBuffers = (delegate* unmanaged)&OnSwapBuffers;
}
~ViewportHandler() => ReleaseUnmanagedResources();
@@ -54,20 +54,20 @@ internal unsafe partial class Dx11Renderer
private static void ReleaseUnmanagedResources()
{
var pio = ImGui.GetPlatformIO();
- pio.Renderer_CreateWindow = nint.Zero;
- pio.Renderer_DestroyWindow = nint.Zero;
- pio.Renderer_SetWindowSize = nint.Zero;
- pio.Renderer_RenderWindow = nint.Zero;
- pio.Renderer_SwapBuffers = nint.Zero;
+ pio.RendererCreateWindow = null;
+ pio.RendererDestroyWindow = null;
+ pio.RendererSetWindowSize = null;
+ pio.RendererRenderWindow = null;
+ pio.RendererSwapBuffers = null;
}
[UnmanagedCallersOnly]
private static void OnDestroyWindow(ImGuiViewportPtr viewport)
{
- if (viewport.RendererUserData == nint.Zero)
+ if (viewport.RendererUserData == null)
return;
ViewportData.Attach(viewport.RendererUserData).Dispose();
- viewport.RendererUserData = nint.Zero;
+ viewport.RendererUserData = null;
}
[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*).
// Some backend will leave PlatformHandleRaw NULL, in which case we assume PlatformHandle will contain the HWND.
var hWnd = viewport.PlatformHandleRaw;
- if (hWnd == 0)
+ if (hWnd == null)
hWnd = viewport.PlatformHandle;
try
{
@@ -135,12 +135,12 @@ internal unsafe partial class Dx11Renderer
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;
- public static ViewportData Attach(nint handle) =>
- (ViewportData)GCHandle.FromIntPtr(handle).Target ?? throw new InvalidOperationException();
+ public static ViewportData Attach(void* handle) =>
+ (ViewportData)GCHandle.FromIntPtr(new IntPtr(handle)).Target ?? throw new InvalidOperationException();
public static ViewportData Create(
Dx11Renderer renderer,
@@ -220,7 +220,7 @@ internal unsafe partial class Dx11Renderer
dcVisual.Get()->SetContent((IUnknown*)swapChain1.Get()).ThrowOnError();
dcTarget.Get()->SetRoot(dcVisual).ThrowOnError();
renderer.dcompDevice.Get()->Commit().ThrowOnError();
-
+
using var swapChain = default(ComPtr);
swapChain1.As(&swapChain).ThrowOnError();
return Create(renderer, swapChain, dcVisual, dcTarget);
@@ -272,7 +272,7 @@ internal unsafe partial class Dx11Renderer
return Create(renderer, swapChain, null, null);
}
-
+
public void Dispose()
{
if (!this.selfGcHandle.IsAllocated)
diff --git a/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.cs b/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.cs
index 685389058..34bda8b12 100644
--- a/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.cs
+++ b/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.cs
@@ -15,7 +15,7 @@ using Dalamud.Interface.Textures.TextureWraps.Internal;
using Dalamud.Interface.Utility;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -67,7 +67,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
public Dx11Renderer(IDXGISwapChain* swapChain, ID3D11Device* device, ID3D11DeviceContext* context)
{
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.");
try
{
@@ -81,7 +81,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
io.BackendFlags |= ImGuiBackendFlags.RendererHasVtxOffset | ImGuiBackendFlags.RendererHasViewports;
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))
{
@@ -102,7 +102,8 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
}
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
{
@@ -205,7 +206,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
this.device.Get()->CreateTexture2D(&texDesc, &subrdata, texture.GetAddressOf()));
}
}
-
+
texture.Get()->SetDebugName($"Texture:{debugName}:SRV");
using var srvTemp = default(ComPtr);
@@ -243,7 +244,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
if (!drawData.Valid || drawData.CmdListsCount == 0)
return;
- var cmdLists = new Span(drawData.NativePtr->CmdLists, drawData.NativePtr->CmdListsCount);
+ var cmdLists = new Span(drawData.Handle->CmdLists, drawData.Handle->CmdListsCount);
// Create and grow vertex/index buffers if needed
if (this.vertexBufferSize < drawData.TotalVtxCount)
@@ -298,8 +299,8 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
var targetIndices = new Span(indexData.pData, this.indexBufferSize);
foreach (ref var cmdList in cmdLists)
{
- var vertices = new ImVectorWrapper(&cmdList.NativePtr->VtxBuffer);
- var indices = new ImVectorWrapper(&cmdList.NativePtr->IdxBuffer);
+ var vertices = new ImVectorWrapper(cmdList.Handle->VtxBuffer.ToUntyped());
+ var indices = new ImVectorWrapper(cmdList.Handle->IdxBuffer.ToUntyped());
vertices.DataSpan.CopyTo(targetVertices);
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);
foreach (ref var cmdList in cmdLists)
{
- var cmds = new ImVectorWrapper(&cmdList.NativePtr->CmdBuffer);
+ var cmds = new ImVectorWrapper(cmdList.Handle->CmdBuffer.ToUntyped());
foreach (ref var cmd in cmds.DataSpan)
{
var clipV4 = cmd.ClipRect - clipOff;
@@ -358,10 +359,10 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
this.context.Get()->RSSetScissorRects(1, &clipRect);
- if (cmd.UserCallback == nint.Zero)
+ if (cmd.UserCallback != null)
{
// 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()->PSSetSamplers(0, 1, this.sampler.GetAddressOf());
this.context.Get()->PSSetShaderResources(0, 1, &srv);
@@ -397,13 +398,16 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
textureIndex < textureCount;
textureIndex++)
{
+ int width = 0, height = 0, bytespp = 0;
+ byte* fontPixels = null;
+
// Build texture atlas
io.Fonts.GetTexDataAsRGBA32(
textureIndex,
- out byte* fontPixels,
- out var width,
- out var height,
- out var bytespp);
+ &fontPixels,
+ ref width,
+ ref height,
+ ref bytespp);
var tex = this.CreateTexture2D(
new(fontPixels, width * height * bytespp),
@@ -539,7 +543,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
fixed (ID3D11SamplerState** ppSampler = &this.sampler.GetPinnableReference())
this.device.Get()->CreateSamplerState(&samplerDesc, ppSampler).ThrowOnError();
}
-
+
// Create the constant buffer
if (this.vertexConstantBuffer.IsEmpty())
{
@@ -630,14 +634,15 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
this.releaseUnmanagedResourceCalled = true;
this.mainViewport.Dispose();
- ImGui.GetPlatformIO().Viewports[0].RendererUserData = nint.Zero;
+ var vp = ImGui.GetPlatformIO().Viewports[0];
+ vp.RendererUserData = null;
ImGui.DestroyPlatformWindows();
this.viewportHandler.Dispose();
var io = ImGui.GetIO();
- if (io.NativePtr->BackendRendererName == (void*)this.renderNamePtr)
- io.NativePtr->BackendRendererName = null;
+ if (io.Handle->BackendRendererName == (void*)this.renderNamePtr)
+ io.Handle->BackendRendererName = null;
if (this.renderNamePtr != 0)
Marshal.FreeHGlobal(this.renderNamePtr);
@@ -645,7 +650,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
fontResourceView.Dispose();
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.context.Reset();
diff --git a/Dalamud/Interface/ImGuiBackend/Renderers/IImGuiRenderer.cs b/Dalamud/Interface/ImGuiBackend/Renderers/IImGuiRenderer.cs
index dc9229dc6..83149c960 100644
--- a/Dalamud/Interface/ImGuiBackend/Renderers/IImGuiRenderer.cs
+++ b/Dalamud/Interface/ImGuiBackend/Renderers/IImGuiRenderer.cs
@@ -3,7 +3,7 @@
using Dalamud.Interface.Textures;
using Dalamud.Interface.Textures.TextureWraps;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiBackend.Renderers;
diff --git a/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs b/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs
index e4747b1e6..d9b681f3b 100644
--- a/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs
+++ b/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs
@@ -5,7 +5,7 @@ using System.Numerics;
using Dalamud.Interface.Utility;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiFileDialog;
@@ -397,7 +397,7 @@ public partial class FileDialog
ImGuiListClipperPtr clipper;
unsafe
{
- clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
+ clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
}
lock (this.filesLock)
diff --git a/Dalamud/Interface/ImGuiFileDialog/FileDialog.cs b/Dalamud/Interface/ImGuiFileDialog/FileDialog.cs
index 1d31642d3..3d8246ffd 100644
--- a/Dalamud/Interface/ImGuiFileDialog/FileDialog.cs
+++ b/Dalamud/Interface/ImGuiFileDialog/FileDialog.cs
@@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiFileDialog;
diff --git a/Dalamud/Interface/ImGuiFileDialog/FileDialogManager.cs b/Dalamud/Interface/ImGuiFileDialog/FileDialogManager.cs
index ae9c8ef38..cd4bbb4ef 100644
--- a/Dalamud/Interface/ImGuiFileDialog/FileDialogManager.cs
+++ b/Dalamud/Interface/ImGuiFileDialog/FileDialogManager.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiFileDialog;
diff --git a/Dalamud/Interface/ImGuiFontChooserDialog/SingleFontChooserDialog.cs b/Dalamud/Interface/ImGuiFontChooserDialog/SingleFontChooserDialog.cs
index f03518ada..4aa57eceb 100644
--- a/Dalamud/Interface/ImGuiFontChooserDialog/SingleFontChooserDialog.cs
+++ b/Dalamud/Interface/ImGuiFontChooserDialog/SingleFontChooserDialog.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using Dalamud.Bindings.ImGui;
using Dalamud.Configuration.Internal;
using Dalamud.Interface.Colors;
using Dalamud.Interface.FontIdentifier;
@@ -12,9 +13,6 @@ using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Interface.ManagedFontAtlas.Internals;
using Dalamud.Interface.Utility;
using Dalamud.Utility;
-
-using ImGuiNET;
-
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -89,7 +87,7 @@ public sealed class SingleFontChooserDialog : IDisposable
private bool popupSizeChanged;
private Vector2 popupPosition = new(float.NaN);
private Vector2 popupSize = new(float.NaN);
-
+
/// Initializes a new instance of the class.
/// The relevant instance of UiBuilder.
/// Whether the fonts in the atlas is global scaled.
@@ -274,7 +272,7 @@ public sealed class SingleFontChooserDialog : IDisposable
return new Vector2(40, 30) * ImGui.GetTextLineHeight();
}
- ///
+ ///
public void Dispose()
{
this.fontHandle?.Dispose();
@@ -432,7 +430,7 @@ public sealed class SingleFontChooserDialog : IDisposable
this.firstDrawAfterRefresh = false;
}
- private static float GetDistanceFromMonitor(Vector2 point, ImGuiPlatformMonitorPtr monitor)
+ private static float GetDistanceFromMonitor(Vector2 point, ImGuiPlatformMonitor monitor)
{
var lt = monitor.MainPos;
var rb = monitor.MainPos + monitor.MainSize;
@@ -565,7 +563,7 @@ public sealed class SingleFontChooserDialog : IDisposable
fixed (byte* buf = this.fontPreviewText)
fixed (byte* label = "##fontPreviewText"u8)
{
- ImGuiNative.igInputTextMultiline(
+ ImGui.InputTextMultiline(
label,
buf,
(uint)this.fontPreviewText.Length,
@@ -691,7 +689,7 @@ public sealed class SingleFontChooserDialog : IDisposable
if (ImGui.BeginChild("##familyList", ImGui.GetContentRegionAvail()))
{
- var clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
+ var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
var lineHeight = ImGui.GetTextLineHeightWithSpacing();
if ((changed || this.firstDrawAfterRefresh) && this.selectedFamilyIndex != -1)
@@ -858,7 +856,7 @@ public sealed class SingleFontChooserDialog : IDisposable
if (ImGui.BeginChild("##fontList"))
{
- var clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
+ var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
var lineHeight = ImGui.GetTextLineHeightWithSpacing();
if ((changed || this.firstDrawAfterRefresh) && this.selectedFontIndex != -1)
@@ -962,7 +960,7 @@ public sealed class SingleFontChooserDialog : IDisposable
if (ImGui.BeginChild("##fontSizeList"))
{
- var clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
+ var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
var lineHeight = ImGui.GetTextLineHeightWithSpacing();
if (changed && this.selectedFontIndex != -1)
@@ -1149,7 +1147,7 @@ public sealed class SingleFontChooserDialog : IDisposable
return 0;
});
-
+
if (stylePushed)
ImGui.PopStyleColor();
diff --git a/Dalamud/Interface/ImGuiNotification/Internal/ActiveNotification.ImGui.cs b/Dalamud/Interface/ImGuiNotification/Internal/ActiveNotification.ImGui.cs
index c672dd3b3..97750bb5e 100644
--- a/Dalamud/Interface/ImGuiNotification/Internal/ActiveNotification.ImGui.cs
+++ b/Dalamud/Interface/ImGuiNotification/Internal/ActiveNotification.ImGui.cs
@@ -5,7 +5,7 @@ using Dalamud.Interface.Internal;
using Dalamud.Interface.Utility;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiNotification.Internal;
@@ -88,7 +88,11 @@ internal sealed partial class ActiveNotification
if (!isTakingKeyboardInput && !isHovered && isFocused)
{
- ImGui.SetWindowFocus(null);
+ unsafe
+ {
+ ImGui.SetWindowFocus((byte*)null);
+ }
+
isFocused = false;
}
@@ -529,9 +533,9 @@ internal sealed partial class ActiveNotification
verts[vertPtr++] = lastOff;
unsafe
{
- var dlist = ImGui.GetWindowDrawList().NativePtr;
+ var dlist = ImGui.GetWindowDrawList().Handle;
fixed (Vector2* pvert = verts)
- ImGuiNative.ImDrawList_AddConvexPolyFilled(dlist, pvert, vertPtr, color);
+ dlist->AddConvexPolyFilled(pvert, vertPtr, color);
}
}
diff --git a/Dalamud/Interface/ImGuiNotification/Internal/NotificationManager.cs b/Dalamud/Interface/ImGuiNotification/Internal/NotificationManager.cs
index 4157d1356..dd88d92f6 100644
--- a/Dalamud/Interface/ImGuiNotification/Internal/NotificationManager.cs
+++ b/Dalamud/Interface/ImGuiNotification/Internal/NotificationManager.cs
@@ -11,7 +11,7 @@ using Dalamud.IoC.Internal;
using Dalamud.Plugin.Internal.Types;
using Dalamud.Plugin.Services;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiNotification.Internal;
diff --git a/Dalamud/Interface/ImGuiNotification/NotificationUtilities.cs b/Dalamud/Interface/ImGuiNotification/NotificationUtilities.cs
index b31321d8b..8b0b2e25c 100644
--- a/Dalamud/Interface/ImGuiNotification/NotificationUtilities.cs
+++ b/Dalamud/Interface/ImGuiNotification/NotificationUtilities.cs
@@ -13,7 +13,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Plugin.Internal.Types;
using Dalamud.Storage.Assets;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ImGuiNotification;
@@ -56,7 +56,7 @@ public static class NotificationUtilities
using (fontHandle.Push())
{
var font = ImGui.GetFont();
- var glyphPtr = (ImGuiHelpers.ImFontGlyphReal*)font.FindGlyphNoFallback(c).NativePtr;
+ var glyphPtr = (ImGuiHelpers.ImFontGlyphReal*)font.FindGlyphNoFallback(c);
if (glyphPtr is null)
return false;
diff --git a/Dalamud/Interface/ImGuiSeStringRenderer/Internal/SeStringRenderer.cs b/Dalamud/Interface/ImGuiSeStringRenderer/Internal/SeStringRenderer.cs
index 9221c2dc5..7c18e59d1 100644
--- a/Dalamud/Interface/ImGuiSeStringRenderer/Internal/SeStringRenderer.cs
+++ b/Dalamud/Interface/ImGuiSeStringRenderer/Internal/SeStringRenderer.cs
@@ -15,7 +15,7 @@ using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.System.String;
using FFXIVClientStructs.FFXIV.Client.UI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Excel.Sheets;
using Lumina.Text;
@@ -58,7 +58,7 @@ internal unsafe class SeStringRenderer : IInternalDisposableService
private readonly SeStringColorStackSet colorStackSet;
/// Splits a draw list so that different layers of a single glyph can be drawn out of order.
- private ImDrawListSplitter* splitter = ImGuiNative.ImDrawListSplitter_ImDrawListSplitter();
+ private ImDrawListSplitter* splitter = ImGui.ImDrawListSplitter();
[ServiceManager.ServiceConstructor]
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));
// 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 };
state.SplitDrawList();
// Handle cases where ImGui.AlignTextToFramePadding has been called.
- var pCurrentWindow = *(nint*)(ImGui.GetCurrentContext() + ImGuiContextCurrentWindowOffset);
- var pWindowDc = pCurrentWindow + ImGuiWindowDcOffset;
- var currLineTextBaseOffset = *(float*)(pWindowDc + ImGuiWindowTempDataCurrLineTextBaseOffset);
+ var context = ImGui.GetCurrentContext();
+ var currLineTextBaseOffset = 0f;
+ /*
+ if (!context.IsNull)
+ {
+ var currentWindow = context.CurrentWindow;
+ if (!currentWindow.IsNull)
+ {
+ currLineTextBaseOffset = currentWindow.DC.CurrLineTextBaseOffset;
+ }
+ }
+ */
+
var itemSize = size;
if (currLineTextBaseOffset != 0f)
{
@@ -280,7 +290,7 @@ internal unsafe class SeStringRenderer : IInternalDisposableService
{
if (this.splitter is not null)
{
- ImGuiNative.ImDrawListSplitter_destroy(this.splitter);
+ this.splitter->Destroy();
this.splitter = null;
}
}
@@ -295,7 +305,7 @@ internal unsafe class SeStringRenderer : IInternalDisposableService
var link = -1;
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)
continue;
@@ -487,7 +497,7 @@ internal unsafe class SeStringRenderer : IInternalDisposableService
if (gfdTextureSrv != 0)
{
state.Draw(
- gfdTextureSrv,
+ new ImTextureID(gfdTextureSrv),
offset + new Vector2(x, MathF.Round((state.LineHeight - size.Y) / 2)),
size,
useHq ? gfdEntry.HqUv0 : gfdEntry.Uv0,
diff --git a/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawParams.cs b/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawParams.cs
index e03f60a32..62842b1ba 100644
--- a/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawParams.cs
+++ b/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawParams.cs
@@ -1,6 +1,6 @@
using System.Numerics;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Text.Payloads;
@@ -105,8 +105,8 @@ public record struct SeStringDrawParams
/// Gets the effective font.
internal readonly unsafe ImFont* EffectiveFont =>
- (this.Font ?? ImGui.GetFont()) is var f && f.NativePtr is not null
- ? f.NativePtr
+ (this.Font ?? ImGui.GetFont()) is var f && f.Handle is not null
+ ? f.Handle
: throw new ArgumentException("Specified font is empty.");
/// Gets the effective line height in pixels.
diff --git a/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawState.cs b/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawState.cs
index 5f95ac1b9..421837c4d 100644
--- a/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawState.cs
+++ b/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawState.cs
@@ -8,7 +8,7 @@ using Dalamud.Interface.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Text.Payloads;
using Lumina.Text.ReadOnly;
@@ -150,7 +150,7 @@ public unsafe ref struct SeStringDrawState
/// Channel to switch to.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly void SetCurrentChannel(SeStringDrawChannel channelIndex) =>
- ImGuiNative.ImDrawListSplitter_SetCurrentChannel(this.splitter, this.drawList, (int)channelIndex);
+ this.splitter->SetCurrentChannel(this.drawList, (int)channelIndex);
/// Draws a single texture.
/// ImGui texture ID to draw from.
@@ -160,7 +160,7 @@ public unsafe ref struct SeStringDrawState
/// Right bottom corner of the glyph w.r.t. its glyph origin in the source texture.
/// Color of the glyph in RGBA.
public readonly void Draw(
- nint igTextureId,
+ ImTextureID igTextureId,
Vector2 offset,
Vector2 size,
Vector2 uv0,
@@ -193,7 +193,7 @@ public unsafe ref struct SeStringDrawState
/// top and bottom pixels to apply faux italicization by and
/// respectively.
public readonly void Draw(
- nint igTextureId,
+ ImTextureID igTextureId,
Vector2 offset,
Vector2 xy0,
Vector2 xy1,
@@ -305,7 +305,7 @@ public unsafe ref struct SeStringDrawState
internal readonly ref ImGuiHelpers.ImFontGlyphReal FindGlyph(Rune rune)
{
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;
return ref *(ImGuiHelpers.ImFontGlyphReal*)p;
}
@@ -340,8 +340,7 @@ public unsafe ref struct SeStringDrawState
return 0;
return MathF.Round(
- ImGuiNative.ImFont_GetDistanceAdjustmentForPair(
- this.Font,
+ this.Font->GetDistanceAdjustmentForPair(
(ushort)left.Value,
(ushort)right.Value) * this.FontSizeScale);
}
@@ -398,9 +397,9 @@ public unsafe ref struct SeStringDrawState
/// Splits the draw list.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal readonly void SplitDrawList() =>
- ImGuiNative.ImDrawListSplitter_Split(this.splitter, this.drawList, ChannelCount);
+ this.splitter->Split(this.drawList, ChannelCount);
/// Merges the draw list.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal readonly void MergeDrawList() => ImGuiNative.ImDrawListSplitter_Merge(this.splitter, this.drawList);
+ internal readonly void MergeDrawList() => this.splitter->Merge(this.drawList);
}
diff --git a/Dalamud/Interface/Internal/DalamudCommands.cs b/Dalamud/Interface/Internal/DalamudCommands.cs
index 636f71bfa..d32b842e1 100644
--- a/Dalamud/Interface/Internal/DalamudCommands.cs
+++ b/Dalamud/Interface/Internal/DalamudCommands.cs
@@ -140,12 +140,6 @@ internal class DalamudCommands : IServiceType
"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)
{
HelpMessage = Loc.Localize(
@@ -300,29 +294,6 @@ internal class DalamudCommands : IServiceType
Service.Get().ToggleLogWindow();
}
- private void OnDebugImInfoCommand(string command, string arguments)
- {
- var io = Service.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)
{
var chatGui = Service.Get();
diff --git a/Dalamud/Interface/Internal/DalamudIme.cs b/Dalamud/Interface/Internal/DalamudIme.cs
index a1c4a0a95..1fe8988b5 100644
--- a/Dalamud/Interface/Internal/DalamudIme.cs
+++ b/Dalamud/Interface/Internal/DalamudIme.cs
@@ -19,7 +19,7 @@ using Dalamud.Interface.GameFonts;
using Dalamud.Interface.ManagedFontAtlas.Internals;
using Dalamud.Interface.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
#if IMEDEBUG
using Serilog;
@@ -136,7 +136,8 @@ internal sealed unsafe class DalamudIme : IInternalDisposableService
this.interfaceManager = imws.Manager;
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.wndProcHookManager.PreWndProc += this.WndProcHookManagerOnPreWndProc;
}
@@ -278,7 +279,10 @@ internal sealed unsafe class DalamudIme : IInternalDisposableService
private void ReleaseUnmanagedResources()
{
if (ImGuiHelpers.IsImGuiInitialized)
- ImGui.GetIO().SetPlatformImeDataFn = nint.Zero;
+ {
+ var io = ImGui.GetIO();
+ io.SetPlatformImeDataFn = null;
+ }
}
private void WndProcHookManagerOnPreWndProc(WndProcEventArgs args)
@@ -477,7 +481,7 @@ internal sealed unsafe class DalamudIme : IInternalDisposableService
if (!string.IsNullOrEmpty(ImmGetCompositionString(hImc, GCS.GCS_COMPSTR)))
{
ImmNotifyIME(hImc, NI.NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
-
+
// Disable further handling of mouse button down event, or something would lock up the cursor.
args.SuppressWithValue(1);
}
@@ -670,7 +674,7 @@ internal sealed unsafe class DalamudIme : IInternalDisposableService
return;
var viewport = ime.associatedViewport;
- if (viewport.NativePtr is null)
+ if (viewport.Handle is null)
return;
var drawCand = ime.candidateStrings.Count != 0;
diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs
index 5d21e954a..6fff5e851 100644
--- a/Dalamud/Interface/Internal/DalamudInterface.cs
+++ b/Dalamud/Interface/Internal/DalamudInterface.cs
@@ -40,9 +40,9 @@ using FFXIVClientStructs.FFXIV.Client.System.Framework;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
+using Dalamud.Bindings.ImPlot;
-using ImPlotNET;
using PInvoke;
using Serilog.Events;
@@ -580,7 +580,10 @@ internal class DalamudInterface : IInternalDisposableService
var io = ImGui.GetIO();
if (!io.WantCaptureMouse && (User32.GetKeyState((int)User32.VirtualKey.VK_LBUTTON) & 0x8000) != 0)
{
- ImGui.SetWindowFocus(null);
+ unsafe
+ {
+ ImGui.SetWindowFocus((byte*)null);
+ }
}
}
catch (Exception ex)
@@ -661,7 +664,7 @@ internal class DalamudInterface : IInternalDisposableService
}
}
- private void DrawDevMenu()
+ private unsafe void DrawDevMenu()
{
if (this.isImGuiDrawDevMenu)
{
@@ -702,7 +705,7 @@ internal class DalamudInterface : IInternalDisposableService
}
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.QueueSave();
@@ -715,7 +718,7 @@ internal class DalamudInterface : IInternalDisposableService
}
var antiDebug = Service.Get();
- if (ImGui.MenuItem("Disable Debugging Protections", null, antiDebug.IsEnabled))
+ if (ImGui.MenuItem("Disable Debugging Protections", (byte*)null, antiDebug.IsEnabled))
{
var newEnabled = !antiDebug.IsEnabled;
if (newEnabled)
@@ -854,7 +857,7 @@ internal class DalamudInterface : IInternalDisposableService
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.QueueSave();
@@ -896,7 +899,7 @@ internal class DalamudInterface : IInternalDisposableService
}
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.QueueSave();
@@ -906,7 +909,7 @@ internal class DalamudInterface : IInternalDisposableService
if (ImGui.MenuItem("Clear focus"))
{
- ImGui.SetWindowFocus(null);
+ ImGui.SetWindowFocus((byte*)null);
}
if (ImGui.MenuItem("Clear stacks"))
@@ -947,7 +950,7 @@ internal class DalamudInterface : IInternalDisposableService
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;
}
@@ -1018,12 +1021,12 @@ internal class DalamudInterface : IInternalDisposableService
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;
}
- if (ImGui.MenuItem("Load blacklisted plugins", null, pluginManager.LoadBannedPlugins))
+ if (ImGui.MenuItem("Load blacklisted plugins", (byte*)null, pluginManager.LoadBannedPlugins))
{
pluginManager.LoadBannedPlugins = !pluginManager.LoadBannedPlugins;
}
diff --git a/Dalamud/Interface/Internal/DesignSystem/DalamudComponents.Buttons.cs b/Dalamud/Interface/Internal/DesignSystem/DalamudComponents.Buttons.cs
index d525af484..1eb18e428 100644
--- a/Dalamud/Interface/Internal/DesignSystem/DalamudComponents.Buttons.cs
+++ b/Dalamud/Interface/Internal/DesignSystem/DalamudComponents.Buttons.cs
@@ -4,7 +4,7 @@ using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.DesignSystem;
@@ -45,7 +45,7 @@ internal static partial class DalamudComponents
return Button(text);
}
}
-
+
private static bool Button(string text)
{
using (ImRaii.PushStyle(ImGuiStyleVar.FramePadding, ButtonPadding))
diff --git a/Dalamud/Interface/Internal/DesignSystem/DalamudComponents.PluginPicker.cs b/Dalamud/Interface/Internal/DesignSystem/DalamudComponents.PluginPicker.cs
index 3d31bbda6..0ff7b525c 100644
--- a/Dalamud/Interface/Internal/DesignSystem/DalamudComponents.PluginPicker.cs
+++ b/Dalamud/Interface/Internal/DesignSystem/DalamudComponents.PluginPicker.cs
@@ -9,7 +9,7 @@ using Dalamud.Plugin.Internal;
using Dalamud.Plugin.Internal.Types;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.DesignSystem;
diff --git a/Dalamud/Interface/Internal/ImGuiClipboardFunctionProvider.cs b/Dalamud/Interface/Internal/ImGuiClipboardFunctionProvider.cs
index 9fa21a31b..651b8dcca 100644
--- a/Dalamud/Interface/Internal/ImGuiClipboardFunctionProvider.cs
+++ b/Dalamud/Interface/Internal/ImGuiClipboardFunctionProvider.cs
@@ -8,7 +8,7 @@ using Dalamud.Game.Gui.Toast;
using Dalamud.Interface.Utility;
using Dalamud.Logging.Internal;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using TerraFX.Interop.Windows;
@@ -38,13 +38,13 @@ namespace Dalamud.Interface.Internal;
internal sealed unsafe class ImGuiClipboardFunctionProvider : IInternalDisposableService
{
private static readonly ModuleLog Log = new(nameof(ImGuiClipboardFunctionProvider));
- private readonly nint clipboardUserDataOriginal;
- private readonly nint setTextOriginal;
- private readonly nint getTextOriginal;
+ private readonly void* clipboardUserDataOriginal;
+ private readonly void* setTextOriginal;
+ private readonly void* getTextOriginal;
[ServiceManager.ServiceDependency]
private readonly ToastGui toastGui = Service.Get();
-
+
private ImVectorWrapper clipboardData;
private GCHandle clipboardUserData;
@@ -58,9 +58,9 @@ internal sealed unsafe class ImGuiClipboardFunctionProvider : IInternalDisposabl
this.clipboardUserDataOriginal = io.ClipboardUserData;
this.setTextOriginal = io.SetClipboardTextFn;
this.getTextOriginal = io.GetClipboardTextFn;
- io.ClipboardUserData = GCHandle.ToIntPtr(this.clipboardUserData = GCHandle.Alloc(this));
- io.SetClipboardTextFn = (nint)(delegate* unmanaged)&StaticSetClipboardTextImpl;
- io.GetClipboardTextFn = (nint)(delegate* unmanaged)&StaticGetClipboardTextImpl;
+ io.ClipboardUserData = GCHandle.ToIntPtr(this.clipboardUserData = GCHandle.Alloc(this)).ToPointer();
+ io.SetClipboardTextFn = (delegate* unmanaged)&StaticSetClipboardTextImpl;
+ io.GetClipboardTextFn = (delegate* unmanaged)&StaticGetClipboardTextImpl;
this.clipboardData = new(0);
return;
@@ -118,7 +118,7 @@ internal sealed unsafe class ImGuiClipboardFunctionProvider : IInternalDisposabl
var hMem = GlobalAlloc(GMEM.GMEM_MOVEABLE, (nuint)((str.Length + 1) * 2));
if (hMem == 0)
throw new OutOfMemoryException();
-
+
var ptr = (char*)GlobalLock(hMem);
if (ptr == null)
{
@@ -150,7 +150,7 @@ internal sealed unsafe class ImGuiClipboardFunctionProvider : IInternalDisposabl
private byte* GetClipboardTextImpl()
{
this.clipboardData.Clear();
-
+
var formats = stackalloc uint[] { CF.CF_UNICODETEXT, CF.CF_TEXT };
if (GetPriorityClipboardFormat(formats, 2) < 1 || !this.OpenClipboardOrShowError())
{
diff --git a/Dalamud/Interface/Internal/InterfaceManager.cs b/Dalamud/Interface/Internal/InterfaceManager.cs
index 5aeaf925f..140189c6a 100644
--- a/Dalamud/Interface/Internal/InterfaceManager.cs
+++ b/Dalamud/Interface/Internal/InterfaceManager.cs
@@ -37,7 +37,7 @@ using Dalamud.Utility.Timing;
using FFXIVClientStructs.FFXIV.Client.Graphics.Environment;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using JetBrains.Annotations;
@@ -826,7 +826,7 @@ internal partial class InterfaceManager : IInternalDisposableService
() =>
{
// 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.
this.defaultFontResourceLock?.Dispose();
diff --git a/Dalamud/Interface/Internal/UiDebug.cs b/Dalamud/Interface/Internal/UiDebug.cs
index 9dfff75ec..fa45c505e 100644
--- a/Dalamud/Interface/Internal/UiDebug.cs
+++ b/Dalamud/Interface/Internal/UiDebug.cs
@@ -10,7 +10,7 @@ using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.System.String;
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Text.ReadOnly;
@@ -213,7 +213,7 @@ internal unsafe class UiDebug
ImGui.SameLine();
Service.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();
if (ImGui.Button($"Encode##{(ulong)textNode:X}"))
@@ -301,7 +301,7 @@ internal unsafe class UiDebug
if (ImGui.TreeNode($"Texture##{(ulong)kernelTexture->D3D11ShaderResourceView:X}"))
{
ImGui.Image(
- new IntPtr(kernelTexture->D3D11ShaderResourceView),
+ new ImTextureID(kernelTexture->D3D11ShaderResourceView),
new Vector2(kernelTexture->ActualWidth, kernelTexture->ActualHeight));
ImGui.TreePop();
}
@@ -312,7 +312,7 @@ internal unsafe class UiDebug
$"Texture##{(ulong)textureInfo->AtkTexture.KernelTexture->D3D11ShaderResourceView:X}"))
{
ImGui.Image(
- new IntPtr(textureInfo->AtkTexture.KernelTexture->D3D11ShaderResourceView),
+ new ImTextureID(textureInfo->AtkTexture.KernelTexture->D3D11ShaderResourceView),
new Vector2(
textureInfo->AtkTexture.KernelTexture->ActualWidth,
textureInfo->AtkTexture.KernelTexture->ActualHeight));
diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.AtkValues.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.AtkValues.cs
index c3f6133dd..d19633227 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.AtkValues.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.AtkValues.cs
@@ -5,7 +5,7 @@ using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs
index 9d6575a55..2d753611d 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs
@@ -5,7 +5,7 @@ using System.Numerics;
using Dalamud.Interface.Components;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.FontAwesomeIcon;
using static Dalamud.Interface.Internal.UiDebug2.ElementSelector;
diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/Events.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/Events.cs
index c98cc933f..0dd7a9a57 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Browsing/Events.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/Events.cs
@@ -4,10 +4,10 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
-using static ImGuiNET.ImGuiTableColumnFlags;
-using static ImGuiNET.ImGuiTableFlags;
+using static Dalamud.Bindings.ImGui.ImGuiTableColumnFlags;
+using static Dalamud.Bindings.ImGui.ImGuiTableFlags;
namespace Dalamud.Interface.Internal.UiDebug2.Browsing;
diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Component.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Component.cs
index 4a1989441..003071baa 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Component.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Component.cs
@@ -1,7 +1,7 @@
using System.Runtime.InteropServices;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;
using static Dalamud.Utility.Util;
diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Editor.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Editor.cs
index 1f5abd0bf..188045de7 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Editor.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Editor.cs
@@ -6,16 +6,16 @@ using Dalamud.Interface.Internal.UiDebug2.Utility;
using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.ColorHelpers;
using static Dalamud.Interface.FontAwesomeIcon;
using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;
using static Dalamud.Interface.Utility.ImGuiHelpers;
-using static ImGuiNET.ImGuiColorEditFlags;
-using static ImGuiNET.ImGuiInputTextFlags;
-using static ImGuiNET.ImGuiTableColumnFlags;
-using static ImGuiNET.ImGuiTableFlags;
+using static Dalamud.Bindings.ImGui.ImGuiColorEditFlags;
+using static Dalamud.Bindings.ImGui.ImGuiInputTextFlags;
+using static Dalamud.Bindings.ImGui.ImGuiTableColumnFlags;
+using static Dalamud.Bindings.ImGui.ImGuiTableFlags;
namespace Dalamud.Interface.Internal.UiDebug2.Browsing;
@@ -266,7 +266,7 @@ internal unsafe partial class NineGridNodeTree
ImGui.Text("Ninegrid Offsets:");
ImGui.TableNextColumn();
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->RightOffset = (short)Math.Max(0, lr.Y);
@@ -278,7 +278,7 @@ internal unsafe partial class NineGridNodeTree
ImGui.TableNextColumn();
ImGui.TableNextColumn();
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->BottomOffset = (short)Math.Max(0, tb.Y);
diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs
index 8d93b3e76..77768a6f5 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs
@@ -5,15 +5,15 @@ using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.ColorHelpers;
using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;
using static Dalamud.Utility.Util;
using static FFXIVClientStructs.FFXIV.Component.GUI.TextureType;
-using static ImGuiNET.ImGuiTableColumnFlags;
-using static ImGuiNET.ImGuiTableFlags;
-using static ImGuiNET.ImGuiTreeNodeFlags;
+using static Dalamud.Bindings.ImGui.ImGuiTableColumnFlags;
+using static Dalamud.Bindings.ImGui.ImGuiTableFlags;
+using static Dalamud.Bindings.ImGui.ImGuiTreeNodeFlags;
namespace Dalamud.Interface.Internal.UiDebug2.Browsing;
diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.NineGrid.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.NineGrid.cs
index 48825becb..cca1c08a6 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.NineGrid.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.NineGrid.cs
@@ -1,7 +1,7 @@
using Dalamud.Interface.Internal.UiDebug2.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.ColorHelpers;
using static Dalamud.Utility.Util;
diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Res.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Res.cs
index 6c12d3b4c..cfd06d726 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Res.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Res.cs
@@ -2,13 +2,14 @@ using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Components;
using Dalamud.Interface.Internal.UiDebug2.Utility;
using Dalamud.Interface.Utility.Raii;
-
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.FontAwesomeIcon;
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 FFXIVClientStructs.FFXIV.Component.GUI.NodeFlags;
-using static ImGuiNET.ImGuiCol;
-using static ImGuiNET.ImGuiTreeNodeFlags;
-
namespace Dalamud.Interface.Internal.UiDebug2.Browsing;
///
diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Text.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Text.cs
index 02bd5feca..36bc78eed 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Text.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Text.cs
@@ -9,7 +9,7 @@ using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.System.String;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.ColorHelpers;
using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;
diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.KeyGroupColumn.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.KeyGroupColumn.cs
index 2ba416b4f..ab256baaa 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.KeyGroupColumn.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.KeyGroupColumn.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.UiDebug2.Browsing;
diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.cs
index 57e5eff99..196b7571e 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.cs
@@ -7,15 +7,15 @@ using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.Graphics;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.ColorHelpers;
using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;
using static Dalamud.Utility.Util;
using static FFXIVClientStructs.FFXIV.Component.GUI.NodeType;
-using static ImGuiNET.ImGuiTableColumnFlags;
-using static ImGuiNET.ImGuiTableFlags;
-using static ImGuiNET.ImGuiTreeNodeFlags;
+using static Dalamud.Bindings.ImGui.ImGuiTableColumnFlags;
+using static Dalamud.Bindings.ImGui.ImGuiTableFlags;
+using static Dalamud.Bindings.ImGui.ImGuiTreeNodeFlags;
// ReSharper disable SuggestBaseTypeForParameter
namespace Dalamud.Interface.Internal.UiDebug2.Browsing;
diff --git a/Dalamud/Interface/Internal/UiDebug2/ElementSelector.cs b/Dalamud/Interface/Internal/UiDebug2/ElementSelector.cs
index 65537e210..ac03ffe8e 100644
--- a/Dalamud/Interface/Internal/UiDebug2/ElementSelector.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/ElementSelector.cs
@@ -9,7 +9,7 @@ using Dalamud.Interface.Internal.UiDebug2.Utility;
using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
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.Utility.ImGuiHelpers;
using static FFXIVClientStructs.FFXIV.Component.GUI.NodeFlags;
-using static ImGuiNET.ImGuiCol;
-using static ImGuiNET.ImGuiWindowFlags;
+using static Dalamud.Bindings.ImGui.ImGuiCol;
+using static Dalamud.Bindings.ImGui.ImGuiWindowFlags;
// ReSharper disable StructLacksIEquatable.Global
#pragma warning disable CS0659
diff --git a/Dalamud/Interface/Internal/UiDebug2/Popout.Addon.cs b/Dalamud/Interface/Internal/UiDebug2/Popout.Addon.cs
index 76112945e..31fb26f7c 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Popout.Addon.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Popout.Addon.cs
@@ -3,7 +3,7 @@ using System.Numerics;
using Dalamud.Interface.Internal.UiDebug2.Browsing;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Interface.Windowing;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.UiDebug2;
diff --git a/Dalamud/Interface/Internal/UiDebug2/Popout.Node.cs b/Dalamud/Interface/Internal/UiDebug2/Popout.Node.cs
index fe8bc87ea..57217ea1f 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Popout.Node.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Popout.Node.cs
@@ -4,7 +4,7 @@ using Dalamud.Interface.Internal.UiDebug2.Browsing;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Interface.Windowing;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.Internal.UiDebug2.UiDebug2;
diff --git a/Dalamud/Interface/Internal/UiDebug2/UiDebug2.Sidebar.cs b/Dalamud/Interface/Internal/UiDebug2/UiDebug2.Sidebar.cs
index 50967453d..f7a392bb4 100644
--- a/Dalamud/Interface/Internal/UiDebug2/UiDebug2.Sidebar.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/UiDebug2.Sidebar.cs
@@ -6,7 +6,7 @@ using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using static System.StringComparison;
using static Dalamud.Interface.FontAwesomeIcon;
diff --git a/Dalamud/Interface/Internal/UiDebug2/UiDebug2.cs b/Dalamud/Interface/Internal/UiDebug2/UiDebug2.cs
index 74727f2a5..cd92a7f59 100644
--- a/Dalamud/Interface/Internal/UiDebug2/UiDebug2.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/UiDebug2.cs
@@ -9,9 +9,9 @@ using Dalamud.Plugin.Services;
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;
diff --git a/Dalamud/Interface/Internal/UiDebug2/Utility/Gui.cs b/Dalamud/Interface/Internal/UiDebug2/Utility/Gui.cs
index cc4f1b698..7987d9a40 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Utility/Gui.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Utility/Gui.cs
@@ -4,10 +4,10 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.Graphics;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using static Dalamud.Interface.ColorHelpers;
-using static ImGuiNET.ImGuiCol;
+using static Dalamud.Bindings.ImGui.ImGuiCol;
namespace Dalamud.Interface.Internal.UiDebug2.Utility;
diff --git a/Dalamud/Interface/Internal/UiDebug2/Utility/NodeBounds.cs b/Dalamud/Interface/Internal/UiDebug2/Utility/NodeBounds.cs
index 3d28cb836..55dabf539 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Utility/NodeBounds.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Utility/NodeBounds.cs
@@ -4,7 +4,7 @@ using System.Numerics;
using Dalamud.Interface.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using static System.MathF;
using static Dalamud.Interface.ColorHelpers;
diff --git a/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs b/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs
index 055cb9f49..a8dd6bd37 100644
--- a/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs
@@ -11,7 +11,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing;
using Dalamud.Networking.Http;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Newtonsoft.Json;
namespace Dalamud.Interface.Internal.Windows;
diff --git a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs
index d42dc3669..9e5f37884 100644
--- a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs
@@ -25,7 +25,7 @@ using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.UI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows;
@@ -35,7 +35,7 @@ namespace Dalamud.Interface.Internal.Windows;
internal sealed class ChangelogWindow : Window, IDisposable
{
private const string WarrantsChangelogForMajorMinor = "10.0.";
-
+
private const string ChangeLog =
@"• 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
@@ -43,7 +43,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
• 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;
@@ -54,40 +54,40 @@ internal sealed class ChangelogWindow : Window, IDisposable
private readonly Lazy bannerFont;
private readonly Lazy apiBumpExplainerTexture;
private readonly Lazy logoTexture;
-
+
private readonly InOutCubic windowFade = new(TimeSpan.FromSeconds(2.5f))
{
Point1 = Vector2.Zero,
Point2 = new Vector2(2f),
};
-
+
private readonly InOutCubic bodyFade = new(TimeSpan.FromSeconds(0.8f))
{
Point1 = Vector2.Zero,
Point2 = Vector2.One,
};
-
+
private readonly InOutCubic titleFade = new(TimeSpan.FromSeconds(0.5f))
{
Point1 = Vector2.Zero,
Point2 = Vector2.One,
};
-
+
private readonly InOutCubic fadeOut = new(TimeSpan.FromSeconds(0.5f))
{
Point1 = Vector2.One,
Point2 = Vector2.Zero,
};
-
+
private State state = State.WindowFadeIn;
-
+
private bool needFadeRestart = false;
-
+
private bool isFadingOutForStateChange = false;
private State? stateAfterFadeOut;
-
+
private AutoUpdateBehavior? chosenAutoUpdateBehavior;
-
+
private Dictionary currentFtueLevels = new();
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)
{
this.gameGui = gameGui;
-
+
this.tsmWindow = tsmWindow;
this.Namespace = "DalamudChangelogWindow";
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 (WarrantsChangelog())
_ = this.bannerFont.Value;
-
+
framework.Update += this.FrameworkOnUpdate;
this.scopedFinalizer.Add(() => framework.Update -= this.FrameworkOnUpdate);
}
@@ -138,7 +138,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
AskAutoUpdate,
Links,
}
-
+
///
/// Check if a changelog should be shown.
///
@@ -163,7 +163,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
this.isFadingOutForStateChange = false;
this.stateAfterFadeOut = null;
-
+
this.state = State.WindowFadeIn;
this.windowFade.Reset();
this.bodyFade.Reset();
@@ -172,9 +172,9 @@ internal sealed class ChangelogWindow : Window, IDisposable
this.needFadeRestart = true;
this.chosenAutoUpdateBehavior = null;
-
+
this.currentFtueLevels = Service.Get().SeenFtueLevels;
-
+
base.OnOpen();
}
@@ -182,17 +182,17 @@ internal sealed class ChangelogWindow : Window, IDisposable
public override void OnClose()
{
base.OnClose();
-
+
this.tsmWindow.AllowDrawing = true;
Service.Get().SetCreditsDarkeningAnimation(false);
var configuration = Service.Get();
-
+
if (this.chosenAutoUpdateBehavior.HasValue)
{
configuration.AutoUpdateBehavior = this.chosenAutoUpdateBehavior.Value;
}
-
+
configuration.SeenFtueLevels = this.currentFtueLevels;
configuration.QueueSave();
}
@@ -203,7 +203,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0);
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, Vector2.Zero);
ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 10f);
-
+
base.PreDraw();
if (this.needFadeRestart)
@@ -212,15 +212,15 @@ internal sealed class ChangelogWindow : Window, IDisposable
this.titleFade.Restart();
this.needFadeRestart = false;
}
-
+
this.windowFade.Update();
this.titleFade.Update();
this.fadeOut.Update();
ImGui.SetNextWindowBgAlpha(Math.Clamp(this.windowFade.EasedPoint.X, 0, 0.9f));
-
+
this.Size = new Vector2(900, 400);
this.SizeCondition = ImGuiCond.Always;
-
+
// Center the window on the main viewport
var viewportPos = ImGuiHelpers.MainViewport.Pos;
var viewportSize = ImGuiHelpers.MainViewport.Size;
@@ -233,9 +233,9 @@ internal sealed class ChangelogWindow : Window, IDisposable
public override void PostDraw()
{
ImGui.PopStyleVar(3);
-
+
this.ResetMovieTimer();
-
+
base.PostDraw();
}
@@ -248,13 +248,13 @@ internal sealed class ChangelogWindow : Window, IDisposable
configuration.LastChangelogMajorMinor = WarrantsChangelogForMajorMinor;
configuration.QueueSave();
}
-
+
var windowSize = ImGui.GetWindowSize();
-
+
var dummySize = 10 * ImGuiHelpers.GlobalScale;
ImGui.Dummy(new Vector2(dummySize));
ImGui.SameLine();
-
+
var logoContainerSize = new Vector2(windowSize.X * 0.2f - dummySize, windowSize.Y);
using (var child = ImRaii.Child("###logoContainer", logoContainerSize, false))
{
@@ -262,23 +262,23 @@ internal sealed class ChangelogWindow : Window, IDisposable
return;
var logoSize = new Vector2(logoContainerSize.X);
-
+
// Center the logo in the container
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)))
ImGui.Image(this.logoTexture.Value.ImGuiHandle, logoSize);
}
-
+
ImGui.SameLine();
ImGui.Dummy(new Vector2(dummySize));
ImGui.SameLine();
-
+
using (var child = ImRaii.Child("###textContainer", new Vector2((windowSize.X * 0.8f) - dummySize * 4, windowSize.Y), false))
{
if (!child)
return;
-
+
ImGuiHelpers.ScaledDummy(20);
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:
ImGuiHelpers.CenteredText("New And Improved");
break;
-
+
case State.ExplainerApiBump:
ImGuiHelpers.CenteredText("Plugin Updates");
break;
-
+
case State.AskAutoUpdate:
ImGuiHelpers.CenteredText("Auto-Updates");
break;
-
+
case State.Links:
ImGuiHelpers.CenteredText("Enjoy!");
break;
}
}
-
+
ImGuiHelpers.ScaledDummy(8);
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.titleFade.Restart();
-
+
this.isFadingOutForStateChange = false;
this.stateAfterFadeOut = null;
}
-
+
this.bodyFade.Update();
var bodyFadeVal = this.isFadingOutForStateChange ? this.fadeOut.EasedPoint.X : this.bodyFade.EasedPoint.X;
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, Math.Clamp(bodyFadeVal, 0, 1f)))
@@ -334,10 +334,10 @@ internal sealed class ChangelogWindow : Window, IDisposable
{
this.isFadingOutForStateChange = true;
this.stateAfterFadeOut = nextState;
-
+
this.fadeOut.Restart();
}
-
+
bool DrawNextButton(State nextState)
{
// 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;
ImGui.SetCursorPosY(windowSize.Y - buttonHeight - (20 * ImGuiHelpers.GlobalScale));
ImGuiHelpers.CenterCursorFor((int)buttonWidth);
-
+
if (ImGui.Button(buttonText, new Vector2(buttonWidth, buttonHeight)) && !this.isFadingOutForStateChange)
{
GoToNextState(nextState);
@@ -355,7 +355,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
return false;
}
-
+
switch (this.state)
{
case State.WindowFadeIn:
@@ -366,10 +366,10 @@ internal sealed class ChangelogWindow : Window, IDisposable
ImGuiHelpers.ScaledDummy(5);
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.");
-
+
DrawNextButton(State.ExplainerApiBump);
break;
-
+
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("This is normal and required for major game updates.");
@@ -378,14 +378,14 @@ internal sealed class ChangelogWindow : Window, IDisposable
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("If some plugins are displayed with a red cross in the 'Installed Plugins' tab, they may not yet be available.");
-
+
ImGuiHelpers.ScaledDummy(15);
ImGuiHelpers.CenterCursorFor(this.apiBumpExplainerTexture.Value.Width);
ImGui.Image(
this.apiBumpExplainerTexture.Value.ImGuiHandle,
this.apiBumpExplainerTexture.Value.Size);
-
+
if (!this.currentFtueLevels.TryGetValue(FtueLevels.AutoUpdate.Name, out var autoUpdateLevel) || autoUpdateLevel < FtueLevels.AutoUpdate.AutoUpdateInitial)
{
if (DrawNextButton(State.AskAutoUpdate))
@@ -397,23 +397,23 @@ internal sealed class ChangelogWindow : Window, IDisposable
{
DrawNextButton(State.Links);
}
-
+
break;
-
+
case State.AskAutoUpdate:
ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudWhite, Loc.Localize("DalamudSettingsAutoUpdateHint",
"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."));
ImGuiHelpers.ScaledDummy(2);
-
+
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 also opt into updates for specific plugins by right-clicking them and selecting \"Always auto-update\"."));
ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsAutoUpdateDisclaimer2",
"Dalamud will only notify you about updates while you are idle."));
-
+
ImGuiHelpers.ScaledDummy(15);
-
+
bool DrawCenteredButton(string text, float height)
{
var buttonHeight = height * ImGuiHelpers.GlobalScale;
@@ -427,97 +427,97 @@ internal sealed class ChangelogWindow : Window, IDisposable
using (ImRaii.PushColor(ImGuiCol.Button, ImGuiColors.DPSRed))
{
if (DrawCenteredButton("Enable auto-updates", 30))
- {
+ {
this.chosenAutoUpdateBehavior = AutoUpdateBehavior.UpdateMainRepo;
GoToNextState(State.Links);
}
}
-
+
ImGuiHelpers.ScaledDummy(2);
-
+
using (ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, 1))
using (var buttonColor = ImRaii.PushColor(ImGuiCol.Button, Vector4.Zero))
{
buttonColor.Push(ImGuiCol.Border, ImGuiColors.DalamudGrey3);
if (DrawCenteredButton("Disable auto-updates", 25))
- {
+ {
this.chosenAutoUpdateBehavior = AutoUpdateBehavior.OnlyNotify;
GoToNextState(State.Links);
}
}
-
+
break;
-
+
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("Enjoy your time with the game and Dalamud!");
-
+
ImGuiHelpers.ScaledDummy(45);
-
+
bool CenteredIconButton(FontAwesomeIcon icon, string text)
{
var buttonWidth = ImGuiComponents.GetIconButtonWithTextWidth(icon, text);
ImGuiHelpers.CenterCursorFor((int)buttonWidth);
return ImGuiComponents.IconButtonWithText(icon, text);
}
-
+
if (CenteredIconButton(FontAwesomeIcon.Download, "Open Plugin Installer"))
{
Service.Get().OpenPluginInstaller();
this.IsOpen = false;
Dismiss();
}
-
+
ImGuiHelpers.ScaledDummy(5);
-
+
ImGuiHelpers.CenterCursorFor(
(int)(ImGuiComponents.GetIconButtonWithTextWidth(FontAwesomeIcon.Globe, "See the FAQ") +
ImGuiComponents.GetIconButtonWithTextWidth(FontAwesomeIcon.LaughBeam, "Join our Discord server") +
- (5 * ImGuiHelpers.GlobalScale) +
+ (5 * ImGuiHelpers.GlobalScale) +
(ImGui.GetStyle().ItemSpacing.X * 4)));
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Globe, "See the FAQ"))
{
Util.OpenLink("https://goatcorp.github.io/faq/");
}
-
+
ImGui.SameLine();
ImGuiHelpers.ScaledDummy(5);
ImGui.SameLine();
-
+
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.LaughBeam, "Join our Discord server"))
{
Util.OpenLink("https://discord.gg/3NMcUV5");
}
-
+
ImGuiHelpers.ScaledDummy(5);
-
+
if (CenteredIconButton(FontAwesomeIcon.Heart, "Support what we care about"))
{
Util.OpenLink("https://goatcorp.github.io/faq/support");
}
-
+
var buttonHeight = 30 * ImGuiHelpers.GlobalScale;
var buttonText = "Close";
var buttonWidth = ImGui.CalcTextSize(buttonText).X + 40 * ImGuiHelpers.GlobalScale;
ImGui.SetCursorPosY(windowSize.Y - buttonHeight - (20 * ImGuiHelpers.GlobalScale));
ImGuiHelpers.CenterCursorFor((int)buttonWidth);
-
+
if (ImGui.Button(buttonText, new Vector2(buttonWidth, buttonHeight)))
{
this.IsOpen = false;
Dismiss();
}
-
+
break;
}
}
-
+
// Draw close button in the top right corner
ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 100f);
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.Text, ImGuiColors.DalamudWhite.WithAlpha(btnAlpha));
-
+
var childSize = ImGui.GetWindowSize();
var closeButtonSize = 15 * 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();
}
-
+
private void FrameworkOnUpdate(IFramework unused)
{
if (!WarrantsChangelog())
@@ -555,7 +555,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
if (this.openedThroughEligibility)
return;
-
+
var isEligible = this.gameGui.GetAddonByName("_TitleMenu", 1) != IntPtr.Zero;
var charaSelect = this.gameGui.GetAddonByName("CharaSelect", 1);
@@ -572,14 +572,14 @@ internal sealed class ChangelogWindow : Window, IDisposable
{
this.isEligibleSince = null;
}
-
+
if (this.isEligibleSince != null && DateTime.Now - this.isEligibleSince > TitleScreenWaitTime)
{
this.IsOpen = true;
this.openedThroughEligibility = true;
}
}
-
+
private unsafe void ResetMovieTimer()
{
var uiModule = UIModule.Instance();
diff --git a/Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs b/Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs
index 3d2b585ac..93e62d15d 100644
--- a/Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs
@@ -5,7 +5,7 @@ using System.Reflection;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Windowing;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows;
diff --git a/Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs b/Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs
index c0d2e4c61..1d9cb863a 100644
--- a/Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs
@@ -7,7 +7,7 @@ using Dalamud.Interface.Colors;
using Dalamud.Interface.Components;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows;
diff --git a/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs b/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs
index f7ce5d145..1baa6f7fc 100644
--- a/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs
@@ -22,7 +22,7 @@ using Dalamud.Plugin.Internal;
using Dalamud.Plugin.Services;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
using Serilog.Events;
@@ -41,9 +41,9 @@ internal class ConsoleWindow : Window, IDisposable
// Fields below should be touched only from the main thread.
private readonly RollingList logText;
private readonly RollingList filteredLogEntries;
-
+
private readonly List pluginFilters = new();
-
+
private readonly DalamudConfiguration configuration;
private int newRolledLines;
@@ -87,14 +87,14 @@ internal class ConsoleWindow : Window, IDisposable
: base("Dalamud Console", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse)
{
this.configuration = configuration;
-
+
this.autoScroll = configuration.LogAutoScroll;
this.autoOpen = configuration.LogOpenAtStartup;
Service.GetAsync().ContinueWith(r => r.Result.Update += this.FrameworkOnUpdate);
-
+
var cm = Service.Get();
- cm.AddCommand("clear", "Clear the console log", () =>
+ cm.AddCommand("clear", "Clear the console log", () =>
{
this.QueueClear();
return true;
@@ -116,7 +116,7 @@ internal class ConsoleWindow : Window, IDisposable
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);
if (!breakInputLines)
- inputWidth = (inputWidth - ImGui.GetStyle().ItemSpacing.X) / 2;
+ inputWidth = (inputWidth - ImGui.GetStyle().ItemSpacing.X) / 2;
}
else
{
@@ -799,15 +799,15 @@ internal class ConsoleWindow : Window, IDisposable
{
if (string.IsNullOrEmpty(this.commandText))
return;
-
+
this.historyPos = -1;
-
+
if (this.commandText != this.configuration.LogCommandHistory.LastOrDefault())
this.configuration.LogCommandHistory.Add(this.commandText);
-
+
if (this.configuration.LogCommandHistory.Count > HistorySize)
this.configuration.LogCommandHistory.RemoveAt(0);
-
+
this.configuration.QueueSave();
this.lastCmdSuccess = Service.Get().ProcessCommand(this.commandText);
@@ -832,7 +832,7 @@ internal class ConsoleWindow : Window, IDisposable
this.completionZipText = null;
this.completionTabIdx = 0;
break;
-
+
case ImGuiInputTextFlags.CallbackCompletion:
var textBytes = new byte[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
if (words.Length > 1)
return 0;
-
+
var wordToComplete = words[0];
if (wordToComplete.IsNullOrWhitespace())
return 0;
-
+
if (this.completionZipText is not null)
wordToComplete = this.completionZipText;
@@ -878,7 +878,7 @@ internal class ConsoleWindow : Window, IDisposable
toComplete = candidates.ElementAt(this.completionTabIdx);
this.completionTabIdx = (this.completionTabIdx + 1) % candidates.Count();
}
-
+
if (toComplete != null)
{
ptr.DeleteChars(0, ptr.BufTextLen);
@@ -1103,7 +1103,7 @@ internal class ConsoleWindow : Window, IDisposable
charOffsets[charOffsetsIndex++] = line.Length;
var screenPos = ImGui.GetCursorScreenPos();
- var drawList = ImGui.GetWindowDrawList().NativePtr;
+ var drawList = ImGui.GetWindowDrawList().Handle;
var font = ImGui.GetFont();
var size = ImGui.GetFontSize();
var scale = size / font.FontSize;
diff --git a/Dalamud/Interface/Internal/Windows/Data/DataWindow.cs b/Dalamud/Interface/Internal/Windows/Data/DataWindow.cs
index 7326f6745..0984b2a79 100644
--- a/Dalamud/Interface/Internal/Windows/Data/DataWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/DataWindow.cs
@@ -8,7 +8,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
namespace Dalamud.Interface.Internal.Windows.Data;
diff --git a/Dalamud/Interface/Internal/Windows/Data/DataWindowWidgetExtensions.cs b/Dalamud/Interface/Internal/Windows/Data/DataWindowWidgetExtensions.cs
index 24adb8bc5..a2c519fca 100644
--- a/Dalamud/Interface/Internal/Windows/Data/DataWindowWidgetExtensions.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/DataWindowWidgetExtensions.cs
@@ -3,7 +3,7 @@ using System.Numerics;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Interface.ImGuiNotification.Internal;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data;
@@ -50,7 +50,7 @@ internal static class DataWindowWidgetExtensions
{
ImGui.SetClipboardText(s);
Service.Get().AddNotification(
- $"Copied {ImGui.TableGetColumnName()} to clipboard.",
+ $"Copied {ImGui.TableGetColumnNameS()} to clipboard.",
widget.DisplayName,
NotificationType.Success);
}
diff --git a/Dalamud/Interface/Internal/Windows/Data/GameInventoryTestWidget.cs b/Dalamud/Interface/Internal/Windows/Data/GameInventoryTestWidget.cs
index 5cede00cf..dad98684c 100644
--- a/Dalamud/Interface/Internal/Windows/Data/GameInventoryTestWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/GameInventoryTestWidget.cs
@@ -8,7 +8,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Logging.Internal;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog.Events;
@@ -46,7 +46,7 @@ internal class GameInventoryTestWidget : IDataWindowWidget
ImGuiColors.DalamudRed,
"Enable LogLevel=Information display to see the logs.");
}
-
+
using var table = ImRaii.Table(this.DisplayName, 3, ImGuiTableFlags.SizingFixedFit);
if (!table.Success)
return;
diff --git a/Dalamud/Interface/Internal/Windows/Data/WidgetUtil.cs b/Dalamud/Interface/Internal/Windows/Data/WidgetUtil.cs
index 209970e24..3d99c5d7c 100644
--- a/Dalamud/Interface/Internal/Windows/Data/WidgetUtil.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/WidgetUtil.cs
@@ -1,6 +1,6 @@
using Dalamud.Interface.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data;
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonLifecycleWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonLifecycleWidget.cs
index 53066765e..8bf968dc8 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonLifecycleWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonLifecycleWidget.cs
@@ -5,7 +5,7 @@ using Dalamud.Game.Addon.Lifecycle;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -19,11 +19,11 @@ public class AddonLifecycleWidget : IDataWindowWidget
///
public string DisplayName { get; init; } = "Addon Lifecycle";
-
+
///
[MemberNotNullWhen(true, "AddonLifecycle")]
public bool Ready { get; set; }
-
+
private AddonLifecycle? AddonLifecycle { get; set; }
///
@@ -38,7 +38,7 @@ public class AddonLifecycleWidget : IDataWindowWidget
this.Ready = true;
});
}
-
+
///
public void Draw()
{
@@ -62,11 +62,11 @@ public class AddonLifecycleWidget : IDataWindowWidget
ImGui.Unindent();
}
}
-
+
private void DrawEventListeners()
{
if (!this.Ready) return;
-
+
foreach (var eventType in Enum.GetValues())
{
if (ImGui.CollapsingHeader(eventType.ToString()))
@@ -78,7 +78,7 @@ public class AddonLifecycleWidget : IDataWindowWidget
{
ImGui.Text("No Listeners Registered for Event");
}
-
+
if (ImGui.BeginTable("AddonLifecycleListenersTable", 2))
{
ImGui.TableSetupColumn("##AddonName", ImGuiTableColumnFlags.WidthFixed, 100.0f * ImGuiHelpers.GlobalScale);
@@ -92,10 +92,10 @@ public class AddonLifecycleWidget : IDataWindowWidget
ImGui.TableNextColumn();
ImGui.Text($"{listener.FunctionDelegate.Method.DeclaringType?.FullName ?? "Unknown Declaring Type"}::{listener.FunctionDelegate.Method.Name}");
}
-
+
ImGui.EndTable();
}
-
+
ImGui.Unindent();
}
}
@@ -111,7 +111,7 @@ public class AddonLifecycleWidget : IDataWindowWidget
{
ImGui.Text("No ReceiveEvent Hooks are Registered");
}
-
+
foreach (var receiveEventListener in this.AddonLifecycle.ReceiveEventListeners)
{
if (ImGui.CollapsingHeader(string.Join(", ", receiveEventListener.AddonNames)))
@@ -135,7 +135,7 @@ public class AddonLifecycleWidget : IDataWindowWidget
var text = receiveEventListener.Hook.IsEnabled ? "Enabled" : "Disabled";
ImGui.TextColored(color, text);
}
-
+
ImGui.Columns(1);
}
}
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs
index 18bcd9334..38ca26b7c 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs
@@ -1,7 +1,7 @@
using Dalamud.Game.Gui;
using Dalamud.Memory;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -15,7 +15,7 @@ internal unsafe class AddonWidget : IDataWindowWidget
private nint findAgentInterfacePtr;
///
- public string DisplayName { get; init; } = "Addon";
+ public string DisplayName { get; init; } = "Addon";
///
public string[]? CommandShortcuts { get; init; }
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddressesWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddressesWidget.cs
index c7ed526e1..183cb50e3 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddressesWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddressesWidget.cs
@@ -3,7 +3,7 @@
using Dalamud.Game;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -19,7 +19,7 @@ internal class AddressesWidget : IDataWindowWidget
public string[]? CommandShortcuts { get; init; } = { "address" };
///
- public string DisplayName { get; init; } = "Addresses";
+ public string DisplayName { get; init; } = "Addresses";
///
public bool Ready { get; set; }
@@ -29,7 +29,7 @@ internal class AddressesWidget : IDataWindowWidget
{
this.Ready = true;
}
-
+
///
public void Draw()
{
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/AetherytesWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/AetherytesWidget.cs
index 9a3b231e5..0e45f8ab6 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/AetherytesWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/AetherytesWidget.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.ClientState.Aetherytes;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -14,9 +14,9 @@ internal class AetherytesWidget : IDataWindowWidget
///
public string[]? CommandShortcuts { get; init; } = { "aetherytes" };
-
+
///
- public string DisplayName { get; init; } = "Aetherytes";
+ public string DisplayName { get; init; } = "Aetherytes";
///
public void Load()
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/AtkArrayDataBrowserWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/AtkArrayDataBrowserWidget.cs
index c3499570c..1a030ad54 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/AtkArrayDataBrowserWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/AtkArrayDataBrowserWidget.cs
@@ -6,7 +6,7 @@ using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Text.ReadOnly;
@@ -36,7 +36,7 @@ internal unsafe class AtkArrayDataBrowserWidget : IDataWindowWidget
///
public string[]? CommandShortcuts { get; init; } = { "atkarray" };
-
+
///
public string DisplayName { get; init; } = "Atk Array Data";
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/BuddyListWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/BuddyListWidget.cs
index 961d3c3c0..0298f879a 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/BuddyListWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/BuddyListWidget.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.ClientState.Buddy;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -16,9 +16,9 @@ internal class BuddyListWidget : IDataWindowWidget
///
public string[]? CommandShortcuts { get; init; } = { "buddy", "buddylist" };
-
+
///
- public string DisplayName { get; init; } = "Buddy List";
+ public string DisplayName { get; init; } = "Buddy List";
///
public void Load()
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/CommandWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/CommandWidget.cs
index 07695c02a..254bfc10c 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/CommandWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/CommandWidget.cs
@@ -3,7 +3,7 @@
using Dalamud.Game.Command;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -14,9 +14,9 @@ internal class CommandWidget : IDataWindowWidget
{
///
public string[]? CommandShortcuts { get; init; } = { "command" };
-
+
///
- public string DisplayName { get; init; } = "Command";
+ public string DisplayName { get; init; } = "Command";
///
public bool Ready { get; set; }
@@ -44,7 +44,7 @@ internal class CommandWidget : IDataWindowWidget
ImGui.TableSetupColumn("HelpMessage", ImGuiTableColumnFlags.NoSort);
ImGui.TableSetupColumn("In Help?", ImGuiTableColumnFlags.NoSort);
ImGui.TableHeadersRow();
-
+
var sortSpecs = ImGui.TableGetSortSpecs();
var commands = commandManager.Commands.ToArray();
@@ -65,16 +65,16 @@ internal class CommandWidget : IDataWindowWidget
foreach (var command in commands)
{
ImGui.TableNextRow();
-
+
ImGui.TableSetColumnIndex(0);
ImGui.Text(command.Key);
-
+
ImGui.TableNextColumn();
ImGui.Text(commandManager.GetHandlerAssemblyName(command.Key, command.Value));
-
+
ImGui.TableNextColumn();
ImGui.TextWrapped(command.Value.HelpMessage);
-
+
ImGui.TableNextColumn();
ImGui.Text(command.Value.ShowInHelp ? "Yes" : "No");
}
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/ConditionWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/ConditionWidget.cs
index 355a73a71..f32db563d 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/ConditionWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/ConditionWidget.cs
@@ -1,7 +1,7 @@
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -15,9 +15,9 @@ internal class ConditionWidget : IDataWindowWidget
///
public string[]? CommandShortcuts { get; init; } = { "condition" };
-
+
///
- public string DisplayName { get; init; } = "Condition";
+ public string DisplayName { get; init; } = "Condition";
///
public void Load()
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs
index b1bd0f05c..ca697642f 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs
@@ -11,7 +11,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Plugin.Ipc.Internal;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Newtonsoft.Json;
@@ -124,13 +124,13 @@ internal class DataShareWidget : IDataWindowWidget
if (ImGui.Button("Copy"))
{
fixed (byte* pData = data)
- ImGuiNative.igSetClipboardText(pData);
+ ImGui.SetClipboardText(pData);
}
fixed (byte* pLabel = "text"u8)
fixed (byte* pData = data)
{
- ImGuiNative.igInputTextMultiline(
+ ImGui.InputTextMultiline(
pLabel,
pData,
(uint)data.Length,
@@ -148,7 +148,7 @@ internal class DataShareWidget : IDataWindowWidget
{
if (mi is null)
return "-";
-
+
var sb = new StringBuilder();
sb.Append(ReprType(mi.DeclaringType))
.Append("::")
@@ -245,7 +245,7 @@ internal class DataShareWidget : IDataWindowWidget
{
ImGui.SetClipboardText(tooltip?.Invoke() ?? s);
Service.Get().AddNotification(
- $"Copied {ImGui.TableGetColumnName()} to clipboard.",
+ $"Copied {ImGui.TableGetColumnNameS()} to clipboard.",
this.DisplayName,
NotificationType.Success);
}
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/DtrBarWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/DtrBarWidget.cs
index 8b7a692d4..a7965eb8f 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/DtrBarWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/DtrBarWidget.cs
@@ -5,7 +5,7 @@ using Dalamud.Configuration.Internal;
using Dalamud.Game;
using Dalamud.Game.Gui.Dtr;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/FateTableWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/FateTableWidget.cs
index 34b04dae0..9e715f9bf 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/FateTableWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/FateTableWidget.cs
@@ -3,7 +3,7 @@ using Dalamud.Interface.Textures.Internal;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -14,9 +14,9 @@ internal class FateTableWidget : IDataWindowWidget
{
///
public string[]? CommandShortcuts { get; init; } = { "fate", "fatetable" };
-
+
///
- public string DisplayName { get; init; } = "Fate Table";
+ public string DisplayName { get; init; } = "Fate Table";
///
public bool Ready { get; set; }
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/FlyTextWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/FlyTextWidget.cs
index 40275645f..da1dc071a 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/FlyTextWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/FlyTextWidget.cs
@@ -2,7 +2,7 @@
using Dalamud.Game.Gui.FlyText;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -20,12 +20,12 @@ internal class FlyTextWidget : IDataWindowWidget
private int flyIcon;
private int flyDmgIcon;
private Vector4 flyColor = new(1, 0, 0, 1);
-
+
///
public string[]? CommandShortcuts { get; init; } = { "flytext" };
-
+
///
- public string DisplayName { get; init; } = "Fly Text";
+ public string DisplayName { get; init; } = "Fly Text";
///
public bool Ready { get; set; }
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/FontAwesomeTestWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/FontAwesomeTestWidget.cs
index a6d76f44f..fd25e3025 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/FontAwesomeTestWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/FontAwesomeTestWidget.cs
@@ -3,7 +3,7 @@ using System.Linq;
using System.Numerics;
using Dalamud.Interface.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -19,12 +19,12 @@ internal class FontAwesomeTestWidget : IDataWindowWidget
private string iconSearchInput = string.Empty;
private bool iconSearchChanged = true;
private bool useFixedWidth = false;
-
+
///
public string[]? CommandShortcuts { get; init; } = { "fa", "fatest", "fontawesome" };
-
+
///
- public string DisplayName { get; init; } = "Font Awesome Test";
+ public string DisplayName { get; init; } = "Font Awesome Test";
///
public bool Ready { get; set; }
@@ -81,7 +81,7 @@ internal class FontAwesomeTestWidget : IDataWindowWidget
{
this.iconSearchChanged = true;
}
-
+
ImGui.Checkbox("Use fixed width font", ref this.useFixedWidth);
ImGuiHelpers.ScaledDummy(10f);
@@ -96,7 +96,7 @@ internal class FontAwesomeTestWidget : IDataWindowWidget
ImGui.PopFont();
ImGuiHelpers.ScaledDummy(2f);
}
-
+
ImGui.PopStyleVar();
}
}
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/GamePrebakedFontsTestWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/GamePrebakedFontsTestWidget.cs
index 469ef3dc3..8a6ec135e 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/GamePrebakedFontsTestWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/GamePrebakedFontsTestWidget.cs
@@ -2,9 +2,11 @@
using System.Collections.Immutable;
using System.Linq;
using System.Numerics;
+using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
+using Dalamud.Bindings.ImGui;
using Dalamud.Game;
using Dalamud.Interface.FontIdentifier;
using Dalamud.Interface.GameFonts;
@@ -13,9 +15,6 @@ using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Interface.ManagedFontAtlas.Internals;
using Dalamud.Interface.Utility;
using Dalamud.Utility;
-
-using ImGuiNET;
-
using Serilog;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -66,10 +65,10 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
this.ClearAtlas();
fixed (byte* labelPtr = "Global Scale for Atlas"u8)
{
- var v = (byte)(this.atlasScaleMode ? 1 : 0);
- if (ImGuiNative.igCheckbox(labelPtr, &v) != 0)
+ var v = this.atlasScaleMode;
+ if (ImGui.Checkbox(labelPtr, ref v))
{
- this.atlasScaleMode = v != 0;
+ this.atlasScaleMode = v;
this.ClearAtlas();
}
}
@@ -77,40 +76,40 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
ImGui.SameLine();
fixed (byte* labelPtr = "Word Wrap"u8)
{
- var v = (byte)(this.useWordWrap ? 1 : 0);
- if (ImGuiNative.igCheckbox(labelPtr, &v) != 0)
- this.useWordWrap = v != 0;
+ var v = this.useWordWrap;
+ if (ImGui.Checkbox(labelPtr, &v))
+ this.useWordWrap = v;
}
-
+
ImGui.SameLine();
fixed (byte* labelPtr = "Italic"u8)
{
- var v = (byte)(this.useItalic ? 1 : 0);
- if (ImGuiNative.igCheckbox(labelPtr, &v) != 0)
+ var v = this.useItalic;
+ if (ImGui.Checkbox(labelPtr, &v))
{
- this.useItalic = v != 0;
+ this.useItalic = v;
this.ClearAtlas();
}
}
-
+
ImGui.SameLine();
fixed (byte* labelPtr = "Bold"u8)
{
- var v = (byte)(this.useBold ? 1 : 0);
- if (ImGuiNative.igCheckbox(labelPtr, &v) != 0)
+ var v = this.useBold;
+ if (ImGui.Checkbox(labelPtr, &v))
{
- this.useBold = v != 0;
+ this.useBold = v;
this.ClearAtlas();
}
}
-
+
ImGui.SameLine();
fixed (byte* labelPtr = "Minimum Range"u8)
{
- var v = (byte)(this.useMinimumBuild ? 1 : 0);
- if (ImGuiNative.igCheckbox(labelPtr, &v) != 0)
+ var v = this.useMinimumBuild;
+ if (ImGui.Checkbox(labelPtr, &v))
{
- this.useMinimumBuild = v != 0;
+ this.useMinimumBuild = v;
this.ClearAtlas();
}
}
@@ -211,17 +210,17 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
fixed (byte* labelPtr = "Test Input"u8)
{
if (!this.atlasScaleMode)
- ImGuiNative.igSetWindowFontScale(1 / ImGuiHelpers.GlobalScale);
+ ImGui.SetWindowFontScale(1 / ImGuiHelpers.GlobalScale);
using (this.fontDialogHandle.Push())
{
- if (ImGuiNative.igInputTextMultiline(
+ if (ImGui.InputTextMultiline(
labelPtr,
this.testStringBuffer.Data,
(uint)this.testStringBuffer.Capacity,
new(ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeight() * 3),
0,
null,
- null) != 0)
+ null))
{
var len = this.testStringBuffer.StorageSpan.IndexOf((byte)0);
if (len + 4 >= this.testStringBuffer.Capacity)
@@ -238,7 +237,7 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
}
if (!this.atlasScaleMode)
- ImGuiNative.igSetWindowFontScale(1);
+ ImGui.SetWindowFontScale(1);
}
this.fontHandles ??=
@@ -285,7 +284,7 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
{
ImGui.TextUnformatted($"{gfs.SizePt}pt");
ImGui.SameLine(offsetX);
- ImGuiNative.igPushTextWrapPos(this.useWordWrap ? 0f : -1f);
+ ImGui.PushTextWrapPos(this.useWordWrap ? 0f : -1f);
try
{
if (handle.Value.LoadException is { } exc)
@@ -295,23 +294,23 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
else if (!handle.Value.Available)
{
fixed (byte* labelPtr = "Loading..."u8)
- ImGuiNative.igTextUnformatted(labelPtr, labelPtr + 8 + ((Environment.TickCount / 200) % 3));
+ ImGui.TextUnformatted(labelPtr, labelPtr + 8 + ((Environment.TickCount / 200) % 3));
}
else
{
if (!this.atlasScaleMode)
- ImGuiNative.igSetWindowFontScale(1 / ImGuiHelpers.GlobalScale);
+ ImGui.SetWindowFontScale(1 / ImGuiHelpers.GlobalScale);
if (counter++ % 2 == 0)
{
using var pushPop = handle.Value.Push();
- ImGuiNative.igTextUnformatted(
+ ImGui.TextUnformatted(
this.testStringBuffer.Data,
this.testStringBuffer.Data + this.testStringBuffer.Length);
}
else
{
handle.Value.Push();
- ImGuiNative.igTextUnformatted(
+ ImGui.TextUnformatted(
this.testStringBuffer.Data,
this.testStringBuffer.Data + this.testStringBuffer.Length);
handle.Value.Pop();
@@ -320,8 +319,8 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
}
finally
{
- ImGuiNative.igSetWindowFontScale(1);
- ImGuiNative.igPopTextWrapPos();
+ ImGui.SetWindowFontScale(1);
+ ImGui.PopTextWrapPos();
}
}
}
@@ -385,7 +384,7 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
var dim = default(Vector2);
var test = "Test string"u8;
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}");
}
}
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/GamepadWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/GamepadWidget.cs
index 610fa90cc..ccd9788c7 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/GamepadWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/GamepadWidget.cs
@@ -1,7 +1,7 @@
using Dalamud.Game.ClientState.GamePad;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/GaugeWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/GaugeWidget.cs
index f30585406..1dfb1a66b 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/GaugeWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/GaugeWidget.cs
@@ -2,7 +2,7 @@ using Dalamud.Game.ClientState;
using Dalamud.Game.ClientState.JobGauge;
using Dalamud.Game.ClientState.JobGauge.Types;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -13,9 +13,9 @@ internal class GaugeWidget : IDataWindowWidget
{
///
public string[]? CommandShortcuts { get; init; } = { "gauge", "jobgauge", "job" };
-
+
///
- public string DisplayName { get; init; } = "Job Gauge";
+ public string DisplayName { get; init; } = "Job Gauge";
///
public bool Ready { get; set; }
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/HookWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/HookWidget.cs
index b24587d6c..59cdfe1ab 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/HookWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/HookWidget.cs
@@ -1,7 +1,10 @@
using System.Runtime.InteropServices;
+using Windows.Win32.Foundation;
+using Windows.Win32.UI.WindowsAndMessaging;
+
using Dalamud.Hooking;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using PInvoke;
using Serilog;
@@ -14,19 +17,19 @@ internal class HookWidget : IDataWindowWidget
{
private Hook? messageBoxMinHook;
private bool hookUseMinHook;
-
+
private delegate int MessageBoxWDelegate(
IntPtr hWnd,
[MarshalAs(UnmanagedType.LPWStr)] string text,
[MarshalAs(UnmanagedType.LPWStr)] string caption,
- NativeFunctions.MessageBoxType type);
-
+ MESSAGEBOX_STYLE type);
+
///
- public string DisplayName { get; init; } = "Hook";
+ public string DisplayName { get; init; } = "Hook";
///
public string[]? CommandShortcuts { get; init; } = { "hook" };
-
+
///
public bool Ready { get; set; }
@@ -53,7 +56,7 @@ internal class HookWidget : IDataWindowWidget
this.messageBoxMinHook?.Disable();
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"))
{
@@ -62,7 +65,7 @@ internal class HookWidget : IDataWindowWidget
}
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)
ImGui.Text("Enabled: " + this.messageBoxMinHook?.IsEnabled);
@@ -72,12 +75,12 @@ internal class HookWidget : IDataWindowWidget
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);
- 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)
{
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs
index 3f510b088..d07117472 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs
@@ -8,7 +8,7 @@ using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Internal;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs
index 08d29398b..1dcf393f1 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs
@@ -11,7 +11,7 @@ using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Windowing;
using Dalamud.Storage.Assets;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -457,7 +457,7 @@ internal class ImGuiWidget : IDataWindowWidget
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;
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/InventoryWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/InventoryWidget.cs
index f8aa4e500..dd54d4cdf 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/InventoryWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/InventoryWidget.cs
@@ -13,7 +13,7 @@ using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.Game;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Excel.Sheets;
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/KeyStateWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/KeyStateWidget.cs
index ce56052b1..bf4c87306 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/KeyStateWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/KeyStateWidget.cs
@@ -1,7 +1,7 @@
using Dalamud.Game.ClientState.Keys;
using Dalamud.Interface.Colors;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -12,9 +12,9 @@ internal class KeyStateWidget : IDataWindowWidget
{
///
public string[]? CommandShortcuts { get; init; } = { "keystate" };
-
+
///
- public string DisplayName { get; init; } = "KeyState";
+ public string DisplayName { get; init; } = "KeyState";
///
public bool Ready { get; set; }
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/MarketBoardWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/MarketBoardWidget.cs
index b209e2d9e..a5b7056d1 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/MarketBoardWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/MarketBoardWidget.cs
@@ -5,7 +5,9 @@ using Dalamud.Game.MarketBoard;
using Dalamud.Game.Network.Structures;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
+
+using ImGuiTable = Dalamud.Interface.Utility.ImGuiTable;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/NetworkMonitorWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/NetworkMonitorWidget.cs
index 69a440713..e6bd630ce 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/NetworkMonitorWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/NetworkMonitorWidget.cs
@@ -8,7 +8,9 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Memory;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
+
+using ImGuiTable = Dalamud.Interface.Utility.ImGuiTable;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -42,9 +44,9 @@ internal class NetworkMonitorWidget : IDataWindowWidget
///
public string[]? CommandShortcuts { get; init; } = { "network", "netmon", "networkmonitor" };
-
+
///
- public string DisplayName { get; init; } = "Network Monitor";
+ public string DisplayName { get; init; } = "Network Monitor";
///
public bool Ready { get; set; }
@@ -59,7 +61,7 @@ internal class NetworkMonitorWidget : IDataWindowWidget
this.packets.Clear();
this.Ready = true;
}
-
+
///
public void Draw()
{
@@ -203,7 +205,7 @@ internal class NetworkMonitorWidget : IDataWindowWidget
/// The filter should find opCodes by number (decimal and hex) and name, if existing.
private string OpCodeToString(ushort opCode)
=> $"{opCode}\0{opCode:X}";
-
+
#pragma warning disable SA1313
private readonly record struct NetworkPacketData(ushort OpCode, NetworkMessageDirection Direction, uint SourceActorId, uint TargetActorId)
#pragma warning restore SA1313
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/NounProcessorWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/NounProcessorWidget.cs
index bc0bd0ac9..8c5e11d1c 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/NounProcessorWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/NounProcessorWidget.cs
@@ -8,7 +8,7 @@ using Dalamud.Game.Text.Noun;
using Dalamud.Game.Text.Noun.Enums;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Data;
using Lumina.Excel;
using Lumina.Excel.Sheets;
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/ObjectTableWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/ObjectTableWidget.cs
index 761dc49a8..3fd67b057 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/ObjectTableWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/ObjectTableWidget.cs
@@ -4,7 +4,7 @@ using Dalamud.Game.ClientState;
using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.Gui;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -19,24 +19,24 @@ internal class ObjectTableWidget : IDataWindowWidget
///
public string[]? CommandShortcuts { get; init; } = { "ot", "objecttable" };
-
+
///
- public string DisplayName { get; init; } = "Object Table";
+ public string DisplayName { get; init; } = "Object Table";
///
public bool Ready { get; set; }
-
+
///
public void Load()
{
this.Ready = true;
}
-
+
///
public void Draw()
{
ImGui.Checkbox("Resolve GameData", ref this.resolveGameData);
-
+
var chatGui = Service.Get();
var clientState = Service.Get();
var gameGui = Service.Get();
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/PartyListWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/PartyListWidget.cs
index 6e4cbcb16..0f505746d 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/PartyListWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/PartyListWidget.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.ClientState.Party;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -13,9 +13,9 @@ internal class PartyListWidget : IDataWindowWidget
///
public string[]? CommandShortcuts { get; init; } = { "partylist", "party" };
-
+
///
- public string DisplayName { get; init; } = "Party List";
+ public string DisplayName { get; init; } = "Party List";
///
public bool Ready { get; set; }
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/PluginIpcWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/PluginIpcWidget.cs
index d67dfc103..029fce1e0 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/PluginIpcWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/PluginIpcWidget.cs
@@ -4,7 +4,7 @@ using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Plugin.Ipc;
using Dalamud.Plugin.Ipc.Internal;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -17,18 +17,18 @@ internal class PluginIpcWidget : IDataWindowWidget
// IPC
private ICallGateProvider? ipcPub;
private ICallGateSubscriber? ipcSub;
-
+
// IPC
private ICallGateProvider? ipcPubGo;
private ICallGateSubscriber? ipcSubGo;
-
+
private string callGateResponse = string.Empty;
-
+
///
public string[]? CommandShortcuts { get; init; } = { "ipc" };
-
+
///
- public string DisplayName { get; init; } = "Plugin IPC";
+ public string DisplayName { get; init; } = "Plugin IPC";
///
public bool Ready { get; set; }
@@ -108,17 +108,17 @@ internal class PluginIpcWidget : IDataWindowWidget
{
this.callGateResponse = this.ipcSub.InvokeFunc("button2");
}
-
+
if (ImGui.Button("Action GO"))
{
this.ipcSubGo.InvokeAction(Service.Get().LocalPlayer);
}
-
+
if (ImGui.Button("Func GO"))
{
this.callGateResponse = this.ipcSubGo.InvokeFunc(Service.Get().LocalPlayer);
}
-
+
if (!this.callGateResponse.IsNullOrEmpty())
ImGui.Text($"Response: {this.callGateResponse}");
}
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeFontTestWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeFontTestWidget.cs
index 35a2a616e..a3e1cbb11 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeFontTestWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeFontTestWidget.cs
@@ -1,7 +1,7 @@
using System.Linq;
using Dalamud.Game.Text;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -12,9 +12,9 @@ internal class SeFontTestWidget : IDataWindowWidget
{
///
public string[]? CommandShortcuts { get; init; } = { "sefont", "sefonttest" };
-
+
///
- public string DisplayName { get; init; } = "SeFont Test";
+ public string DisplayName { get; init; } = "SeFont Test";
///
public bool Ready { get; set; }
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringCreatorWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringCreatorWidget.cs
index 92e57ddac..4fca97ea4 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringCreatorWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringCreatorWidget.cs
@@ -19,7 +19,7 @@ using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
using FFXIVClientStructs.FFXIV.Component.Text;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Data;
using Lumina.Data.Files.Excel;
@@ -225,7 +225,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
if (ImGui.IsItemHovered())
{
- ImGui.SetMouseCursor(ImGuiMouseCursor.ResizeEW);
+ ImGui.SetMouseCursor(ImGuiMouseCursor.ResizeEw);
if (ImGui.IsMouseDoubleClicked(ImGuiMouseButton.Left))
{
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringRendererTestWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringRendererTestWidget.cs
index 323c9ce62..8a000e55b 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringRendererTestWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringRendererTestWidget.cs
@@ -13,7 +13,7 @@ using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Excel.Sheets;
using Lumina.Text;
@@ -193,7 +193,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
var addon = Service.GetNullable()?.GetExcelSheet() ??
throw new InvalidOperationException("Addon sheet not loaded.");
- var clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
+ var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
clipper.Begin(addon.Count);
while (clipper.Step())
{
@@ -266,14 +266,14 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
fixed (byte* labelPtr = "Test Input"u8)
{
- if (ImGuiNative.igInputTextMultiline(
+ if (ImGui.InputTextMultiline(
labelPtr,
this.testStringBuffer.Data,
(uint)this.testStringBuffer.Capacity,
new(ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeight() * 3),
0,
null,
- null) != 0)
+ null))
{
var len = this.testStringBuffer.StorageSpan.IndexOf((byte)0);
if (len + 4 >= this.testStringBuffer.Capacity)
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs
index d1e6bc58a..61053ddb9 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs
@@ -8,7 +8,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.IoC.Internal;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -26,9 +26,9 @@ internal class ServicesWidget : IDataWindowWidget
///
public string[]? CommandShortcuts { get; init; } = { "services" };
-
+
///
- public string DisplayName { get; init; } = "Service Container";
+ public string DisplayName { get; init; } = "Service Container";
///
public bool Ready { get; set; }
@@ -48,7 +48,7 @@ internal class ServicesWidget : IDataWindowWidget
{
if (ImGui.Button("Clear selection"))
this.selectedNodes.Clear();
-
+
ImGui.SameLine();
switch (this.includeUnloadDependencies)
{
@@ -90,12 +90,12 @@ internal class ServicesWidget : IDataWindowWidget
var dl = ImGui.GetWindowDrawList();
var mouse = ImGui.GetMousePos();
var maxRowWidth = 0f;
-
+
// 1. Layout
for (var level = 0; level < this.dependencyNodes.Count; level++)
{
var levelNodes = this.dependencyNodes[level];
-
+
var rowWidth = 0f;
foreach (var node in levelNodes)
rowWidth += node.DisplayedNameSize.X + cellPad.X + margin.X;
@@ -139,7 +139,7 @@ internal class ServicesWidget : IDataWindowWidget
{
var rect = this.nodeRects[node];
var point1 = new Vector2((rect.X + rect.Z) / 2, rect.Y);
-
+
foreach (var parent in node.InvalidParents)
{
rect = this.nodeRects[parent];
@@ -149,7 +149,7 @@ internal class ServicesWidget : IDataWindowWidget
dl.AddLine(point1, point2, lineInvalidColor, 2f * ImGuiHelpers.GlobalScale);
}
-
+
foreach (var parent in node.Parents)
{
rect = this.nodeRects[parent];
@@ -170,7 +170,7 @@ internal class ServicesWidget : IDataWindowWidget
}
}
}
-
+
// 3. Draw boxes
foreach (var levelNodes in this.dependencyNodes)
{
@@ -231,7 +231,7 @@ internal class ServicesWidget : IDataWindowWidget
}
}
}
-
+
ImGui.SetCursorPos(default);
ImGui.Dummy(new(maxRowWidth, this.dependencyNodes.Count * rowHeight));
ImGui.EndChild();
@@ -301,7 +301,7 @@ internal class ServicesWidget : IDataWindowWidget
public string DisplayedName { get; }
public string TypeSuffix { get; }
-
+
public uint TypeSuffixColor { get; }
public Vector2 DisplayedNameSize =>
@@ -319,7 +319,7 @@ internal class ServicesWidget : IDataWindowWidget
public IEnumerable Relatives =>
this.parents.Concat(this.children).Concat(this.invalidParents);
-
+
public int Level { get; private set; }
public static List CreateTree(bool includeUnloadDependencies)
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/StartInfoWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/StartInfoWidget.cs
index 4dee316c5..7fb2cc2bf 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/StartInfoWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/StartInfoWidget.cs
@@ -1,4 +1,4 @@
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Newtonsoft.Json;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -10,9 +10,9 @@ internal class StartInfoWidget : IDataWindowWidget
{
///
public string[]? CommandShortcuts { get; init; } = { "startinfo" };
-
+
///
- public string DisplayName { get; init; } = "Start Info";
+ public string DisplayName { get; init; } = "Start Info";
///
public bool Ready { get; set; }
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/TargetWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/TargetWidget.cs
index 68e00799d..bcea447f1 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/TargetWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/TargetWidget.cs
@@ -2,7 +2,7 @@
using Dalamud.Game.ClientState.Objects;
using Dalamud.Interface.Utility;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -12,12 +12,12 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
internal class TargetWidget : IDataWindowWidget
{
private bool resolveGameData;
-
+
///
public string[]? CommandShortcuts { get; init; } = { "target" };
-
+
///
- public string DisplayName { get; init; } = "Target";
+ public string DisplayName { get; init; } = "Target";
///
public bool Ready { get; set; }
@@ -32,7 +32,7 @@ internal class TargetWidget : IDataWindowWidget
public void Draw()
{
ImGui.Checkbox("Resolve GameData", ref this.resolveGameData);
-
+
var clientState = Service.Get();
var targetMgr = Service.Get();
@@ -67,10 +67,10 @@ internal class TargetWidget : IDataWindowWidget
if (targetMgr.SoftTarget != null)
Util.PrintGameObject(targetMgr.SoftTarget, "SoftTarget", this.resolveGameData);
-
+
if (targetMgr.GPoseTarget != null)
Util.PrintGameObject(targetMgr.GPoseTarget, "GPoseTarget", this.resolveGameData);
-
+
if (targetMgr.MouseOverNameplateTarget != null)
Util.PrintGameObject(targetMgr.MouseOverNameplateTarget, "MouseOverNameplateTarget", this.resolveGameData);
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/TaskSchedulerWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/TaskSchedulerWidget.cs
index f4086fe5a..f53f58495 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/TaskSchedulerWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/TaskSchedulerWidget.cs
@@ -17,7 +17,7 @@ using Dalamud.Interface.Utility.Raii;
using Dalamud.Logging.Internal;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -28,18 +28,18 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
internal class TaskSchedulerWidget : IDataWindowWidget
{
private readonly FileDialogManager fileDialogManager = new();
- private readonly byte[] urlBytes = new byte[2048];
- private readonly byte[] localPathBytes = new byte[2048];
+ private string url = "https://geo.mirror.pkgbuild.com/iso/2024.01.01/archlinux-2024.01.01-x86_64.iso";
+ private string localPath = string.Empty;
private Task? downloadTask = null;
private (long Downloaded, long Total, float Percentage) downloadState;
private CancellationTokenSource taskSchedulerCancelSource = new();
-
+
///
public string[]? CommandShortcuts { get; init; } = { "tasksched", "taskscheduler" };
-
+
///
- public string DisplayName { get; init; } = "Task Scheduler";
+ public string DisplayName { get; init; } = "Task Scheduler";
///
public bool Ready { get; set; }
@@ -48,9 +48,6 @@ internal class TaskSchedulerWidget : IDataWindowWidget
public void Load()
{
this.Ready = true;
- Encoding.UTF8.GetBytes(
- "https://geo.mirror.pkgbuild.com/iso/2024.01.01/archlinux-2024.01.01-x86_64.iso",
- this.urlBytes);
}
///
@@ -247,13 +244,13 @@ internal class TaskSchedulerWidget : IDataWindowWidget
if (ImGui.CollapsingHeader("Download"))
{
- ImGui.InputText("URL", this.urlBytes, (uint)this.urlBytes.Length);
- ImGui.InputText("Local Path", this.localPathBytes, (uint)this.localPathBytes.Length);
+ ImGui.InputText("URL", ref this.url, (uint)this.url.Length);
+ ImGui.InputText("Local Path", ref this.localPath, (uint)this.localPath.Length);
ImGui.SameLine();
-
+
if (ImGuiComponents.IconButton("##localpathpicker", FontAwesomeIcon.File))
{
- var defaultFileName = Encoding.UTF8.GetString(this.urlBytes).Split('\0', 2)[0].Split('/').Last();
+ var defaultFileName = this.url.Split('\0', 2)[0].Split('/').Last();
this.fileDialogManager.SaveFileDialog(
"Choose a local path",
"*",
@@ -263,8 +260,7 @@ internal class TaskSchedulerWidget : IDataWindowWidget
{
if (accept)
{
- this.localPathBytes.AsSpan().Clear();
- Encoding.UTF8.GetBytes(newPath, this.localPathBytes.AsSpan());
+ this.localPath = newPath;
}
});
}
@@ -272,7 +268,7 @@ internal class TaskSchedulerWidget : IDataWindowWidget
ImGui.TextUnformatted($"{this.downloadState.Downloaded:##,###}/{this.downloadState.Total:##,###} ({this.downloadState.Percentage:0.00}%)");
using var disabled =
- ImRaii.Disabled(this.downloadTask?.IsCompleted is false || this.localPathBytes[0] == 0);
+ ImRaii.Disabled(this.downloadTask?.IsCompleted is false || this.localPath[0] == 0);
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted("Download");
ImGui.SameLine();
@@ -281,8 +277,6 @@ internal class TaskSchedulerWidget : IDataWindowWidget
var downloadUsingFramework = ImGui.Button("using Framework.Update");
if (downloadUsingGlobalScheduler || downloadUsingFramework)
{
- var url = Encoding.UTF8.GetString(this.urlBytes).Split('\0', 2)[0];
- var localPath = Encoding.UTF8.GetString(this.localPathBytes).Split('\0', 2)[0];
var ct = this.taskSchedulerCancelSource.Token;
this.downloadState = default;
var factory = downloadUsingGlobalScheduler
@@ -294,9 +288,9 @@ internal class TaskSchedulerWidget : IDataWindowWidget
{
try
{
- await using var to = File.Create(localPath);
+ await using var to = File.Create(this.localPath);
using var client = new HttpClient();
- using var conn = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, ct);
+ using var conn = await client.GetAsync(this.url, HttpCompletionOption.ResponseHeadersRead, ct);
this.downloadState.Total = conn.Content.Headers.ContentLength ?? -1L;
await using var from = conn.Content.ReadAsStream(ct);
var buffer = new byte[8192];
@@ -339,31 +333,31 @@ internal class TaskSchedulerWidget : IDataWindowWidget
{
var token = this.taskSchedulerCancelSource.Token;
Task.Run(
- () =>
+ () =>
{
for (var i = 0; i < 100; i++)
{
token.ThrowIfCancellationRequested();
Task.Run(
- () =>
+ () =>
{
for (var j = 0; j < 100; j++)
{
token.ThrowIfCancellationRequested();
Task.Run(
- () =>
+ () =>
{
for (var k = 0; k < 100; k++)
{
token.ThrowIfCancellationRequested();
Task.Run(
- () =>
+ () =>
{
for (var l = 0; l < 100; l++)
{
token.ThrowIfCancellationRequested();
Task.Run(
- async () =>
+ async () =>
{
for (var m = 0; m < 100; m++)
{
@@ -380,7 +374,7 @@ internal class TaskSchedulerWidget : IDataWindowWidget
}
});
}
-
+
ImGui.SameLine();
ImGuiHelpers.ScaledDummy(20);
@@ -456,7 +450,7 @@ internal class TaskSchedulerWidget : IDataWindowWidget
this.fileDialogManager.Draw();
}
-
+
private async Task TestTaskInTaskDelay(CancellationToken token)
{
await Task.Delay(5000, token);
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs
index 07b2d01ff..e23324544 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs
@@ -17,7 +17,7 @@ using Dalamud.Plugin.Services;
using Dalamud.Storage.Assets;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using TerraFX.Interop.DirectX;
@@ -288,7 +288,7 @@ internal class TexWidget : IDataWindowWidget
{
if (t.GetTexture(this.textureManager) is { } source)
{
- var psrv = (ID3D11ShaderResourceView*)source.ImGuiHandle;
+ var psrv = (ID3D11ShaderResourceView*)source.ImGuiHandle.Handle;
var rcsrv = psrv->AddRef() - 1;
psrv->Release();
@@ -404,13 +404,13 @@ internal class TexWidget : IDataWindowWidget
ImGui.TableHeadersRow();
var sortSpecs = ImGui.TableGetSortSpecs();
- if (sortSpecs.NativePtr is not null && (sortSpecs.SpecsDirty || shouldSortAgain))
+ if (sortSpecs.Handle is not null && (sortSpecs.SpecsDirty || shouldSortAgain))
{
allBlames.Sort(
static (a, b) =>
{
var sortSpecs = ImGui.TableGetSortSpecs();
- var specs = new Span(sortSpecs.NativePtr->Specs, sortSpecs.SpecsCount);
+ var specs = new Span(sortSpecs.Handle->Specs, sortSpecs.SpecsCount);
Span sorted = stackalloc bool[(int)DrawBlameTableColumnUserId.ColumnCount];
foreach (ref var spec in specs)
{
@@ -442,7 +442,7 @@ internal class TexWidget : IDataWindowWidget
sortSpecs.SpecsDirty = false;
}
- var clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
+ var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
clipper.Begin(allBlames.Count);
while (clipper.Step())
@@ -531,7 +531,7 @@ internal class TexWidget : IDataWindowWidget
(ImGui.GetStyle().ItemSpacing.X * 1 * numIcons));
ImGui.TableHeadersRow();
- var clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
+ var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
clipper.Begin(textures.Count);
using (var enu = textures.GetEnumerator())
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/ToastWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/ToastWidget.cs
index e101fbd0b..6917eb178 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/ToastWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/ToastWidget.cs
@@ -3,7 +3,7 @@
using Dalamud.Game.Gui.Toast;
using Dalamud.Interface.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@@ -19,12 +19,12 @@ internal class ToastWidget : IDataWindowWidget
private bool questToastSound;
private int questToastIconId;
private bool questToastCheckmark;
-
+
///
public string[]? CommandShortcuts { get; init; } = { "toast" };
-
+
///
- public string DisplayName { get; init; } = "Toast";
+ public string DisplayName { get; init; } = "Toast";
///
public bool Ready { get; set; }
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/UIColorWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/UIColorWidget.cs
index 45f1ad715..673303aac 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/UIColorWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/UIColorWidget.cs
@@ -7,7 +7,7 @@ using Dalamud.Interface.ImGuiNotification;
using Dalamud.Interface.ImGuiNotification.Internal;
using Dalamud.Interface.ImGuiSeStringRenderer.Internal;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Excel.Sheets;
@@ -66,7 +66,7 @@ internal class UiColorWidget : IDataWindowWidget
ImGui.TableSetupColumn("Clear Blue", ImGuiTableColumnFlags.WidthFixed, colorw);
ImGui.TableHeadersRow();
- var clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
+ var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
clipper.Begin(colors.Count, ImGui.GetFrameHeightWithSpacing());
while (clipper.Step())
{
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/UldWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/UldWidget.cs
index ec39e38f1..4af7f9eec 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/UldWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/UldWidget.cs
@@ -13,7 +13,7 @@ using Dalamud.Interface.Textures.Internal;
using Dalamud.Interface.Utility;
using Dalamud.Memory;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Data.Files;
using Lumina.Data.Parsing.Uld;
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/VfsWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/VfsWidget.cs
index 019d743bc..eb18a8bcf 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/VfsWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/VfsWidget.cs
@@ -3,7 +3,7 @@ using System.IO;
using Dalamud.Configuration.Internal;
using Dalamud.Storage;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
diff --git a/Dalamud/Interface/Internal/Windows/GamepadModeNotifierWindow.cs b/Dalamud/Interface/Internal/Windows/GamepadModeNotifierWindow.cs
index ff5af1556..12e676671 100644
--- a/Dalamud/Interface/Internal/Windows/GamepadModeNotifierWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/GamepadModeNotifierWindow.cs
@@ -3,7 +3,7 @@ using System.Numerics;
using CheapLoc;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows;
diff --git a/Dalamud/Interface/Internal/Windows/HitchSettingsWindow.cs b/Dalamud/Interface/Internal/Windows/HitchSettingsWindow.cs
index 1f633934f..9297ba28b 100644
--- a/Dalamud/Interface/Internal/Windows/HitchSettingsWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/HitchSettingsWindow.cs
@@ -1,7 +1,7 @@
using Dalamud.Configuration.Internal;
using Dalamud.Interface.Windowing;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows;
@@ -22,7 +22,7 @@ public class HitchSettingsWindow : Window
this.ShowCloseButton = true;
this.RespectCloseHotkey = true;
}
-
+
///
public override void Draw()
{
@@ -41,14 +41,14 @@ public class HitchSettingsWindow : Window
config.FrameworkUpdateHitch = frameworkUpdateHitch;
config.QueueSave();
}
-
+
var gameNetworkUpHitch = (float)config.GameNetworkUpHitch;
if (ImGui.SliderFloat("GameNetworkUpHitch", ref gameNetworkUpHitch, MinHitch, MaxHitch))
{
config.GameNetworkUpHitch = gameNetworkUpHitch;
config.QueueSave();
}
-
+
var gameNetworkDownHitch = (float)config.GameNetworkDownHitch;
if (ImGui.SliderFloat("GameNetworkDownHitch", ref gameNetworkDownHitch, MinHitch, MaxHitch))
{
diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs
index dfd37431c..33ba4fa12 100644
--- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs
@@ -34,7 +34,7 @@ using Dalamud.Plugin.Internal.Types.Manifest;
using Dalamud.Support;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.PluginInstaller;
diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs
index ddb89d38c..2031fde40 100644
--- a/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs
@@ -14,7 +14,7 @@ using Dalamud.Interface.Utility.Raii;
using Dalamud.Plugin.Internal;
using Dalamud.Plugin.Internal.Profiles;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
namespace Dalamud.Interface.Internal.Windows.PluginInstaller;
@@ -56,11 +56,11 @@ internal class ProfileManagerWidget
this.DrawChoice();
return;
}
-
+
var tutorialTitle = Locs.TutorialTitle + "###collectionsTutorWindow";
var tutorialId = ImGui.GetID(tutorialTitle);
this.DrawTutorial(tutorialTitle);
-
+
switch (this.mode)
{
case Mode.Overview:
@@ -120,22 +120,22 @@ internal class ProfileManagerWidget
ImGuiHelpers.SafeTextWrapped(Locs.TutorialParagraphFour);
ImGuiHelpers.ScaledDummy(5);
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommands);
-
+
ImGui.Bullet();
ImGui.SameLine();
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsEnable);
-
+
ImGui.Bullet();
ImGui.SameLine();
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsDisable);
-
+
ImGui.Bullet();
ImGui.SameLine();
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsToggle);
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsEnd);
ImGuiHelpers.ScaledDummy(5);
-
+
var buttonWidth = 120f;
ImGui.SetCursorPosX((ImGui.GetWindowWidth() - buttonWidth) / 2);
if (ImGui.Button("OK", new Vector2(buttonWidth, 40)))
@@ -174,7 +174,7 @@ internal class ProfileManagerWidget
{
try
{
- profman.ImportProfile(ImGui.GetClipboardText());
+ profman.ImportProfile(ImGui.GetClipboardTextS());
Service.Get().AddNotification(Locs.NotificationImportSuccess, type: NotificationType.Success);
}
catch (Exception ex)
@@ -186,14 +186,14 @@ internal class ProfileManagerWidget
if (ImGui.IsItemHovered())
ImGui.SetTooltip(Locs.ImportProfileHint);
-
+
ImGui.SameLine();
ImGuiHelpers.ScaledDummy(5);
ImGui.SameLine();
-
+
if (ImGuiComponents.IconButton(FontAwesomeIcon.Question))
ImGui.OpenPopup(tutorialId);
-
+
if (ImGui.IsItemHovered())
ImGui.SetTooltip(Locs.TutorialHint);
@@ -425,7 +425,7 @@ internal class ProfileManagerWidget
ImGui.Image(pic.DevPluginIcon.ImGuiHandle, new Vector2(pluginLineHeight));
ImGui.PopStyleVar();
}
-
+
ImGui.SameLine();
var text = $"{pmPlugin.Name}{(pmPlugin.IsDev ? " (dev plugin" : string.Empty)}";
@@ -448,12 +448,12 @@ internal class ProfileManagerWidget
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (pluginLineHeight / 2) - (textHeight.Y / 2));
ImGui.TextUnformatted(text);
-
+
var firstAvailableInstalled = pm.InstalledPlugins.FirstOrDefault(x => x.InternalName == profileEntry.InternalName);
var installable =
pm.AvailablePlugins.FirstOrDefault(
x => x.InternalName == profileEntry.InternalName && !x.SourceRepo.IsThirdParty);
-
+
if (firstAvailableInstalled != null)
{
ImGui.Text($"Match to plugin '{firstAvailableInstalled.Name}'?");
@@ -488,7 +488,7 @@ internal class ProfileManagerWidget
if (ImGui.IsItemHovered())
ImGui.SetTooltip(Locs.InstallPlugin);
}
-
+
ImGui.SetCursorPos(before);
}
@@ -608,13 +608,13 @@ internal class ProfileManagerWidget
public static string TutorialTitle =>
Loc.Localize("ProfileManagerTutorial", "About Collections");
-
+
public static string TutorialParagraphOne =>
Loc.Localize("ProfileManagerTutorialParagraphOne", "Collections are shareable lists of plugins that can be enabled or disabled in the plugin installer or via chat commands.\nWhen a plugin is part of a collection, it will be enabled if the collection is enabled. If a plugin is part of multiple collections, it will be enabled if one or more collections it is a part of are enabled.");
-
+
public static string TutorialParagraphTwo =>
Loc.Localize("ProfileManagerTutorialParagraphTwo", "You can add plugins to collections by clicking the plus button when editing a collection on this screen, or by using the button with the toolbox icon on the \"Installed Plugins\" screen.");
-
+
public static string TutorialParagraphThree =>
Loc.Localize("ProfileManagerTutorialParagraphThree", "If a collection's \"Start on boot\" checkbox is ticked, the collection and the plugins within will be enabled every time the game starts up, even if it has been manually disabled in a prior session.");
@@ -623,25 +623,25 @@ internal class ProfileManagerWidget
public static string TutorialCommands =>
Loc.Localize("ProfileManagerTutorialCommands", "You can use the following commands in chat or in macros to manage active collections:");
-
+
public static string TutorialCommandsEnable =>
Loc.Localize("ProfileManagerTutorialCommandsEnable", "{0} \"Collection Name\" - Enable a collection").Format(PluginManagementCommandHandler.CommandEnableProfile);
public static string TutorialCommandsDisable =>
Loc.Localize("ProfileManagerTutorialCommandsDisable", "{0} \"Collection Name\" - Disable a collection").Format(PluginManagementCommandHandler.CommandDisableProfile);
-
+
public static string TutorialCommandsToggle =>
Loc.Localize("ProfileManagerTutorialCommandsToggle", "{0} \"Collection Name\" - Toggle a collection's state").Format(PluginManagementCommandHandler.CommandToggleProfile);
-
+
public static string TutorialCommandsEnd =>
Loc.Localize("ProfileManagerTutorialCommandsEnd", "If you run multiple of these commands, they will be executed in order.");
public static string Choice1 =>
Loc.Localize("ProfileManagerChoice1", "Plugin collections are a new feature that allow you to group plugins into collections which can be toggled and shared.");
-
+
public static string Choice2 =>
Loc.Localize("ProfileManagerChoice2", "They are experimental and may still contain bugs. Do you want to enable them now?");
-
+
public static string ChoiceConfirmation =>
Loc.Localize("ProfileManagerChoiceConfirmation", "Yes, enable Plugin Collections");
diff --git a/Dalamud/Interface/Internal/Windows/PluginStatWindow.cs b/Dalamud/Interface/Internal/Windows/PluginStatWindow.cs
index eeafa98e7..554559910 100644
--- a/Dalamud/Interface/Internal/Windows/PluginStatWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/PluginStatWindow.cs
@@ -12,7 +12,7 @@ using Dalamud.Interface.Windowing;
using Dalamud.Plugin.Internal;
using Dalamud.Plugin.Internal.Types;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
namespace Dalamud.Interface.Internal.Windows;
diff --git a/Dalamud/Interface/Internal/Windows/ProfilerWindow.cs b/Dalamud/Interface/Internal/Windows/ProfilerWindow.cs
index 28dcdb117..036858c75 100644
--- a/Dalamud/Interface/Internal/Windows/ProfilerWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/ProfilerWindow.cs
@@ -8,7 +8,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing;
using Dalamud.Utility.Numerics;
using Dalamud.Utility.Timing;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows;
@@ -192,7 +192,7 @@ public class ProfilerWindow : Window
var eventsXPos = new List();
const float eventsXPosFudge = 5f;
-
+
foreach (var timingEvent in Timings.Events)
{
var startX = (timingEvent.StartTime - this.min) / (this.max - this.min) * width;
@@ -217,7 +217,7 @@ public class ProfilerWindow : Window
{
textPos.X = pos.X + (uint)startX - textSize.X - padding;
}
-
+
var numClashes = eventsXPos.Count(x => Math.Abs(x - textPos.X) < textSize.X + eventsXPosFudge);
if (numClashes > 0)
{
@@ -228,7 +228,7 @@ public class ProfilerWindow : Window
textPos,
ImGui.GetColorU32(ImGuiColors.DalamudWhite),
timingEvent.Name);
-
+
eventsXPos.Add(textPos.X);
}
}
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/SelfTestWindow.cs b/Dalamud/Interface/Internal/Windows/SelfTest/SelfTestWindow.cs
index b6f08edf6..a678f8d4f 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/SelfTestWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/SelfTestWindow.cs
@@ -9,7 +9,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Interface.Windowing;
using Dalamud.Logging.Internal;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Excel.Sheets;
namespace Dalamud.Interface.Internal.Windows.SelfTest;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ActorTableSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ActorTableSelfTestStep.cs
index f246cb940..2c1a7faab 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ActorTableSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ActorTableSelfTestStep.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.ClientState.Objects;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/AddonLifecycleSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/AddonLifecycleSelfTestStep.cs
index 458edfaff..230bf90e2 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/AddonLifecycleSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/AddonLifecycleSelfTestStep.cs
@@ -3,7 +3,7 @@
using Dalamud.Game.Addon.Lifecycle;
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/AetheryteListSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/AetheryteListSelfTestStep.cs
index 207f718ff..4ae43729e 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/AetheryteListSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/AetheryteListSelfTestStep.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.ClientState.Aetherytes;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ChatSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ChatSelfTestStep.cs
index 8ab1809ad..0b7dbaa67 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ChatSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ChatSelfTestStep.cs
@@ -2,7 +2,7 @@ using Dalamud.Game.Gui;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ConditionSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ConditionSelfTestStep.cs
index 2d49fbdcd..ddd079559 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ConditionSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ConditionSelfTestStep.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.ClientState.Conditions;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ContextMenuSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ContextMenuSelfTestStep.cs
index 0e2f61aba..92004b9f0 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ContextMenuSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ContextMenuSelfTestStep.cs
@@ -7,7 +7,7 @@ using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.Gui.ContextMenu;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Excel;
using Lumina.Excel.Sheets;
using Serilog;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/DutyStateSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/DutyStateSelfTestStep.cs
index 4c33347fc..44a448fbb 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/DutyStateSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/DutyStateSelfTestStep.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.DutyState;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/EnterTerritorySelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/EnterTerritorySelfTestStep.cs
index 04c8eda5e..f81be3150 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/EnterTerritorySelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/EnterTerritorySelfTestStep.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.ClientState;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/FateTableSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/FateTableSelfTestStep.cs
index 982633dcb..edaa2febe 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/FateTableSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/FateTableSelfTestStep.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.ClientState.Fates;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/GameConfigSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/GameConfigSelfTestStep.cs
index 440ec9f5d..3a4c5e2ac 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/GameConfigSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/GameConfigSelfTestStep.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.Config;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/HoverSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/HoverSelfTestStep.cs
index 85b5d3784..7c6a7951b 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/HoverSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/HoverSelfTestStep.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.Gui;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ItemPayloadSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ItemPayloadSelfTestStep.cs
index 0988413b0..9e02742fe 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ItemPayloadSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ItemPayloadSelfTestStep.cs
@@ -2,7 +2,7 @@
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/KeyStateSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/KeyStateSelfTestStep.cs
index 667f3adc4..e80aece76 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/KeyStateSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/KeyStateSelfTestStep.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.ClientState.Keys;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/LoginEventSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/LoginEventSelfTestStep.cs
index 9540c636a..876722d8c 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/LoginEventSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/LoginEventSelfTestStep.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.ClientState;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/LogoutEventSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/LogoutEventSelfTestStep.cs
index 13bcfcf35..b15fcb42c 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/LogoutEventSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/LogoutEventSelfTestStep.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.ClientState;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/MarketBoardSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/MarketBoardSelfTestStep.cs
index 4a6dd185f..ec5b57fb9 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/MarketBoardSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/MarketBoardSelfTestStep.cs
@@ -3,7 +3,7 @@ using System.Linq;
using Dalamud.Game.MarketBoard;
using Dalamud.Game.Network.Structures;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/NamePlateSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/NamePlateSelfTestStep.cs
index e7ce8e42a..440819b67 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/NamePlateSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/NamePlateSelfTestStep.cs
@@ -4,7 +4,7 @@ using Dalamud.Game.Gui.NamePlate;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/NounProcessorSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/NounProcessorSelfTestStep.cs
index 7319eec7b..7a95f66ba 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/NounProcessorSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/NounProcessorSelfTestStep.cs
@@ -2,7 +2,7 @@ using Dalamud.Game;
using Dalamud.Game.Text.Noun;
using Dalamud.Game.Text.Noun.Enums;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using LSheets = Lumina.Excel.Sheets;
@@ -212,7 +212,7 @@ internal class NounProcessorSelfTestStep : ISelfTestStep
for (var i = 0; i < this.tests.Length; i++)
{
var e = this.tests[i];
-
+
var nounParams = new NounParams()
{
SheetName = e.SheetName,
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/PartyFinderSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/PartyFinderSelfTestStep.cs
index 475412e70..e8746c8b2 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/PartyFinderSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/PartyFinderSelfTestStep.cs
@@ -1,7 +1,7 @@
using Dalamud.Game.Gui.PartyFinder;
using Dalamud.Game.Gui.PartyFinder.Types;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/SeStringEvaluatorSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/SeStringEvaluatorSelfTestStep.cs
index 423a56172..329c96990 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/SeStringEvaluatorSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/SeStringEvaluatorSelfTestStep.cs
@@ -1,7 +1,7 @@
using Dalamud.Game.ClientState;
using Dalamud.Game.Text.Evaluator;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Text.ReadOnly;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/SheetRedirectResolverSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/SheetRedirectResolverSelfTestStep.cs
index 6ab08cd91..cb9782d5e 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/SheetRedirectResolverSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/SheetRedirectResolverSelfTestStep.cs
@@ -6,7 +6,7 @@ using Dalamud.Game.Text.Evaluator.Internal;
using FFXIVClientStructs.FFXIV.Client.System.String;
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/TargetSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/TargetSelfTestStep.cs
index b56b08ed5..ae074c4f3 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/TargetSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/TargetSelfTestStep.cs
@@ -2,7 +2,7 @@ using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.ClientState.Objects.Types;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ToastSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ToastSelfTestStep.cs
index cd34fa30b..19b13f4a5 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ToastSelfTestStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/ToastSelfTestStep.cs
@@ -1,6 +1,6 @@
using Dalamud.Game.Gui.Toast;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
diff --git a/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs b/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs
index c678dff10..2548ef2ce 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs
@@ -12,7 +12,7 @@ using Dalamud.Interface.Utility.Raii;
using Dalamud.Interface.Windowing;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Settings;
@@ -42,7 +42,7 @@ internal class SettingsWindow : Window
};
this.SizeCondition = ImGuiCond.FirstUseEver;
-
+
this.tabs =
[
new SettingsTabGeneral(),
@@ -143,7 +143,7 @@ internal class SettingsWindow : Window
flags |= ImGuiTabItemFlags.SetSelected;
this.setActiveTab = null;
}
-
+
using var tab = ImRaii.TabItem(settingsTab.Title, flags);
if (tab)
{
diff --git a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs
index 428be05c2..55ea3638c 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs
@@ -15,7 +15,7 @@ using Dalamud.Plugin.Internal;
using Dalamud.Storage.Assets;
using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.Game.UI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
diff --git a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAutoUpdate.cs b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAutoUpdate.cs
index 9356131ad..66e3aa2ed 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAutoUpdate.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAutoUpdate.cs
@@ -14,7 +14,7 @@ using Dalamud.Plugin.Internal;
using Dalamud.Plugin.Internal.AutoUpdate;
using Dalamud.Plugin.Internal.Types;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
diff --git a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabDtr.cs b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabDtr.cs
index d1040b5b2..5a7ad82ab 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabDtr.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabDtr.cs
@@ -10,7 +10,7 @@ using Dalamud.Interface.Colors;
using Dalamud.Interface.Components;
using Dalamud.Interface.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
diff --git a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabLook.cs b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabLook.cs
index 7f75dbf29..6db8cb6d1 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabLook.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabLook.cs
@@ -16,7 +16,7 @@ using Dalamud.Interface.Internal.Windows.Settings.Widgets;
using Dalamud.Interface.ManagedFontAtlas.Internals;
using Dalamud.Interface.Utility;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
@@ -182,7 +182,7 @@ public class SettingsTabLook : SettingsTab
var buttonSize =
GlobalUiScalePresets
- .Select(x => ImGui.CalcTextSize(x.Item1, 0, x.Item1.IndexOf('#')))
+ .Select(x => ImGui.CalcTextSize(x.Item1, true))
.Aggregate(Vector2.Zero, Vector2.Max)
+ (ImGui.GetStyle().FramePadding * 2);
foreach (var (buttonLabel, scale) in GlobalUiScalePresets)
@@ -204,7 +204,7 @@ public class SettingsTabLook : SettingsTab
var len = Encoding.UTF8.GetByteCount(buildingFonts);
var p = stackalloc byte[len];
Encoding.UTF8.GetBytes(buildingFonts, new(p, len));
- ImGuiNative.igTextUnformatted(p, (p + len + ((Environment.TickCount / 200) % 3)) - 2);
+ ImGui.TextUnformatted(p, (p + len + ((Environment.TickCount / 200) % 3)) - 2);
}
}
diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/ButtonSettingsEntry.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/ButtonSettingsEntry.cs
index 6bce2a451..a7f546390 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/ButtonSettingsEntry.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/ButtonSettingsEntry.cs
@@ -2,7 +2,7 @@
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/DevPluginsSettingsEntry.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/DevPluginsSettingsEntry.cs
index 4c5dc8b83..4b8e50890 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/DevPluginsSettingsEntry.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/DevPluginsSettingsEntry.cs
@@ -15,7 +15,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Plugin.Internal;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/EnumSettingsEntry{T}.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/EnumSettingsEntry{T}.cs
index f40654542..a6fedc4c0 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/EnumSettingsEntry{T}.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/EnumSettingsEntry{T}.cs
@@ -8,7 +8,7 @@ using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/GapSettingsEntry.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/GapSettingsEntry.cs
index 1db3c4756..58e4984e4 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/GapSettingsEntry.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/GapSettingsEntry.cs
@@ -1,7 +1,7 @@
using System.Diagnostics.CodeAnalysis;
using Dalamud.Interface.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs
index cb79000d2..816a34f0a 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs
@@ -7,7 +7,7 @@ using Dalamud.Configuration.Internal;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/SettingsEntry{T}.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/SettingsEntry{T}.cs
index cffe0a5da..751e262ef 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/SettingsEntry{T}.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/SettingsEntry{T}.cs
@@ -8,7 +8,7 @@ using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/ThirdRepoSettingsEntry.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/ThirdRepoSettingsEntry.cs
index 1d6aab1bd..d63718fa3 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/ThirdRepoSettingsEntry.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/ThirdRepoSettingsEntry.cs
@@ -13,7 +13,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Plugin.Internal;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
@@ -30,7 +30,7 @@ public class ThirdRepoSettingsEntry : SettingsEntry
{
this.timeSinceOpened = DateTime.Now;
}
-
+
public override void OnClose()
{
this.thirdRepoList =
@@ -59,7 +59,7 @@ public class ThirdRepoSettingsEntry : SettingsEntry
public override void Draw()
{
var config = Service.Get();
-
+
using var id = ImRaii.PushId("thirdRepo");
ImGui.TextUnformatted(Loc.Localize("DalamudSettingsCustomRepo", "Custom Plugin Repositories"));
if (this.thirdRepoListChanged)
@@ -70,14 +70,14 @@ public class ThirdRepoSettingsEntry : SettingsEntry
ImGui.TextUnformatted(Loc.Localize("DalamudSettingsChanged", "(Changed)"));
}
}
-
+
ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingCustomRepoHint", "Add custom plugin repositories."));
-
+
ImGuiHelpers.ScaledDummy(2);
config.ThirdRepoSpeedbumpDismissed ??= config.ThirdRepoList.Any(x => x.IsEnabled);
var disclaimerDismissed = config.ThirdRepoSpeedbumpDismissed.Value;
-
+
ImGui.PushFont(InterfaceManager.IconFont);
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudOrange);
ImGuiHelpers.SafeTextWrapped(FontAwesomeIcon.ExclamationTriangle.ToIconString());
@@ -100,7 +100,7 @@ public class ThirdRepoSettingsEntry : SettingsEntry
ImGuiHelpers.SafeTextWrapped(Loc.Localize("DalamudSettingCustomRepoWarning3", "Please make absolutely sure that you only install plugins from developers you trust."));
ImGui.PopStyleColor();
-
+
if (!disclaimerDismissed)
{
const int speedbumpTime = 15;
@@ -121,7 +121,7 @@ public class ThirdRepoSettingsEntry : SettingsEntry
}
}
}
-
+
ImGuiHelpers.ScaledDummy(2);
using var disabled = ImRaii.Disabled(!disclaimerDismissed);
diff --git a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs
index ceb009139..ae01dab36 100644
--- a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs
@@ -11,7 +11,7 @@ using Dalamud.Interface.Style;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
@@ -112,7 +112,7 @@ public class StyleEditorWindow : Window
if (isBuiltinStyle)
ImGui.BeginDisabled();
-
+
if (ImGuiComponents.IconButton(FontAwesomeIcon.Trash) && this.currentSel != 0)
{
this.currentSel--;
@@ -157,7 +157,7 @@ public class StyleEditorWindow : Window
if (ImGui.IsItemHovered())
ImGui.SetTooltip(Loc.Localize("StyleEditorCopy", "Copy style to clipboard for sharing"));
-
+
if (isBuiltinStyle)
ImGui.EndDisabled();
@@ -167,7 +167,7 @@ public class StyleEditorWindow : Window
{
this.SaveStyle();
- var styleJson = ImGui.GetClipboardText();
+ var styleJson = ImGui.GetClipboardTextS();
try
{
@@ -288,7 +288,7 @@ public class StyleEditorWindow : Window
foreach (var imGuiCol in Enum.GetValues())
{
- if (imGuiCol == ImGuiCol.COUNT)
+ if (imGuiCol == ImGuiCol.Count)
continue;
ImGui.PushID(imGuiCol.ToString());
diff --git a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs
index cbb6998ac..2b0284b68 100644
--- a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs
@@ -24,7 +24,7 @@ using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Text.ReadOnly;
diff --git a/Dalamud/Interface/ManagedFontAtlas/FontAtlasBuildStep.cs b/Dalamud/Interface/ManagedFontAtlas/FontAtlasBuildStep.cs
index dcfcc32e3..652b677b7 100644
--- a/Dalamud/Interface/ManagedFontAtlas/FontAtlasBuildStep.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/FontAtlasBuildStep.cs
@@ -1,5 +1,3 @@
-using ImGuiNET;
-
namespace Dalamud.Interface.ManagedFontAtlas;
///
diff --git a/Dalamud/Interface/ManagedFontAtlas/FontAtlasBuildToolkitUtilities.cs b/Dalamud/Interface/ManagedFontAtlas/FontAtlasBuildToolkitUtilities.cs
index 3b8bfd965..2e497b6cd 100644
--- a/Dalamud/Interface/ManagedFontAtlas/FontAtlasBuildToolkitUtilities.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/FontAtlasBuildToolkitUtilities.cs
@@ -2,10 +2,9 @@ using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text.Unicode;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Utility;
-using ImGuiNET;
-
namespace Dalamud.Interface.ManagedFontAtlas;
///
@@ -42,7 +41,7 @@ public static class FontAtlasBuildToolkitUtilities
default(FluentGlyphRangeBuilder).With(range);
///
- /// Compiles given s into an array of containing ImGui glyph ranges.
+ /// Compiles given s into an array of containing ImGui glyph ranges.
///
/// The chars.
/// Add fallback codepoints to the range.
@@ -56,7 +55,7 @@ public static class FontAtlasBuildToolkitUtilities
enumerable.BeginGlyphRange().Build(addFallbackCodepoints, addEllipsisCodepoints);
///
- /// Compiles given s into an array of containing ImGui glyph ranges.
+ /// Compiles given s into an array of containing ImGui glyph ranges.
///
/// The chars.
/// Add fallback codepoints to the range.
@@ -70,7 +69,7 @@ public static class FontAtlasBuildToolkitUtilities
span.BeginGlyphRange().Build(addFallbackCodepoints, addEllipsisCodepoints);
///
- /// Compiles given string into an array of containing ImGui glyph ranges.
+ /// Compiles given string into an array of containing ImGui glyph ranges.
///
/// The string.
/// Add fallback codepoints to the range.
@@ -93,10 +92,11 @@ public static class FontAtlasBuildToolkitUtilities
/// The relevant config pointer, or empty config pointer if not found.
public static unsafe ImFontConfigPtr FindConfigPtr(this IFontAtlasBuildToolkit toolkit, ImFontPtr fontPtr)
{
- foreach (ref var c in toolkit.NewImAtlas.ConfigDataWrapped().DataSpan)
+ for (var i = 0; i < toolkit.NewImAtlas.ConfigData.Size; i++)
{
- if (c.DstFont == fontPtr.NativePtr)
- return new((nint)Unsafe.AsPointer(ref c));
+ var c = toolkit.NewImAtlas.ConfigData[i];
+ if (c.DstFont == fontPtr.Handle)
+ return new((ImFontConfig*)Unsafe.AsPointer(ref c));
}
return default;
diff --git a/Dalamud/Interface/ManagedFontAtlas/FontScaleMode.cs b/Dalamud/Interface/ManagedFontAtlas/FontScaleMode.cs
index b30d5c26c..47751e12d 100644
--- a/Dalamud/Interface/ManagedFontAtlas/FontScaleMode.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/FontScaleMode.cs
@@ -1,7 +1,6 @@
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Utility;
-using ImGuiNET;
-
namespace Dalamud.Interface.ManagedFontAtlas;
///
@@ -15,14 +14,14 @@ public enum FontScaleMode
/// Note that bitmap fonts and game fonts will always look blurry if they're not in their original sizes.
///
Default,
-
+
///
/// Do nothing with the font. Dalamud will load the font with the size that is exactly as specified.
/// On drawing, the font will look blurry due to stretching.
/// Intended for use with custom scale handling.
///
SkipHandling,
-
+
///
/// Stretch the glyphs of the loaded font by the inverse of the global scale.
/// On drawing, the font will always render exactly as the requested size without blurring, as long as
diff --git a/Dalamud/Interface/ManagedFontAtlas/IFontAtlas.cs b/Dalamud/Interface/ManagedFontAtlas/IFontAtlas.cs
index d622fbbb2..8047df0d6 100644
--- a/Dalamud/Interface/ManagedFontAtlas/IFontAtlas.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/IFontAtlas.cs
@@ -1,10 +1,9 @@
using System.Threading.Tasks;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.GameFonts;
using Dalamud.Interface.Utility;
-using ImGuiNET;
-
namespace Dalamud.Interface.ManagedFontAtlas;
///
@@ -39,7 +38,7 @@ public interface IFontAtlas : IDisposable
string Name { get; }
///
- /// Gets a value how the atlas should be rebuilt when the relevant Dalamud Configuration changes.
+ /// Gets a value how the atlas should be rebuilt when the relevant Dalamud Configuration changes.
///
FontAtlasAutoRebuildMode AutoRebuildMode { get; }
@@ -153,7 +152,7 @@ public interface IFontAtlas : IDisposable
void BuildFontsImmediately();
///
- /// Rebuilds fonts asynchronously, on any thread.
+ /// Rebuilds fonts asynchronously, on any thread.
///
/// The task.
/// If is .
diff --git a/Dalamud/Interface/ManagedFontAtlas/IFontAtlasBuildToolkit.cs b/Dalamud/Interface/ManagedFontAtlas/IFontAtlasBuildToolkit.cs
index ae996a39c..6dbd45c01 100644
--- a/Dalamud/Interface/ManagedFontAtlas/IFontAtlasBuildToolkit.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/IFontAtlasBuildToolkit.cs
@@ -1,9 +1,8 @@
using System.Runtime.InteropServices;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Utility;
-using ImGuiNET;
-
namespace Dalamud.Interface.ManagedFontAtlas;
///
diff --git a/Dalamud/Interface/ManagedFontAtlas/IFontAtlasBuildToolkitPostBuild.cs b/Dalamud/Interface/ManagedFontAtlas/IFontAtlasBuildToolkitPostBuild.cs
index c09285fce..32a096909 100644
--- a/Dalamud/Interface/ManagedFontAtlas/IFontAtlasBuildToolkitPostBuild.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/IFontAtlasBuildToolkitPostBuild.cs
@@ -1,8 +1,6 @@
-using Dalamud.Interface.Internal;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Textures.TextureWraps;
-using ImGuiNET;
-
namespace Dalamud.Interface.ManagedFontAtlas;
///
diff --git a/Dalamud/Interface/ManagedFontAtlas/IFontAtlasBuildToolkitPreBuild.cs b/Dalamud/Interface/ManagedFontAtlas/IFontAtlasBuildToolkitPreBuild.cs
index babe17fdd..ed6f14156 100644
--- a/Dalamud/Interface/ManagedFontAtlas/IFontAtlasBuildToolkitPreBuild.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/IFontAtlasBuildToolkitPreBuild.cs
@@ -2,12 +2,10 @@
using System.IO;
using System.Runtime.InteropServices;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.FontIdentifier;
using Dalamud.Interface.GameFonts;
using Dalamud.Interface.Utility;
-using Dalamud.Utility;
-
-using ImGuiNET;
using TerraFX.Interop.DirectX;
@@ -211,7 +209,7 @@ public interface IFontAtlasBuildToolkitPreBuild : IFontAtlasBuildToolkit
///
/// The font style, in range from 0 to 2. 0 is normal.
///
- /// May do nothing at all if is unsupported by Dalamud font handler.
+ /// May do nothing at all if is unsupported by Dalamud font handler.
/// See
/// Microsoft
/// Learn for the fonts.
diff --git a/Dalamud/Interface/ManagedFontAtlas/IFontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/IFontHandle.cs
index 803f6b82c..82d3e0999 100644
--- a/Dalamud/Interface/ManagedFontAtlas/IFontHandle.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/IFontHandle.cs
@@ -1,7 +1,5 @@
using System.Threading.Tasks;
-using ImGuiNET;
-
namespace Dalamud.Interface.ManagedFontAtlas;
///
@@ -58,7 +56,7 @@ public interface IFontHandle : IDisposable
/// A disposable object that will pop the font on dispose.
/// If called outside of the main thread.
///
- /// This function uses , and may do extra things.
+ /// This function uses , and may do extra things.
/// Use or to undo this operation.
/// Do not use .
///
@@ -77,7 +75,7 @@ public interface IFontHandle : IDisposable
/// Push a font between two choices.
///
/// using ((someCondition ? myFontHandle : dalamudPluginInterface.UiBuilder.MonoFontHandle).Push())
- /// ImGui.TextUnformatted("Test 3");
+ /// ImGui.TextUnformatted("Test 3");
///
///
IDisposable Push();
diff --git a/Dalamud/Interface/ManagedFontAtlas/ILockedImFont.cs b/Dalamud/Interface/ManagedFontAtlas/ILockedImFont.cs
index a4cc3afa7..b59f15485 100644
--- a/Dalamud/Interface/ManagedFontAtlas/ILockedImFont.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/ILockedImFont.cs
@@ -1,4 +1,4 @@
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ManagedFontAtlas;
diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs
index 52939385b..2f9c9fa7c 100644
--- a/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs
@@ -5,7 +5,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Logging.Internal;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ManagedFontAtlas.Internals;
@@ -177,7 +177,7 @@ internal sealed class DelegateFontHandle : FontHandle
{
for (var i = fontCountPrevious; !found && i < fontsVector.Length; i++)
{
- if (fontsVector[i].NativePtr == toolkitPreBuild.Font.NativePtr)
+ if (fontsVector[i].Handle == toolkitPreBuild.Font.Handle)
found = true;
}
}
@@ -223,7 +223,7 @@ internal sealed class DelegateFontHandle : FontHandle
{
unsafe
{
- if (fontsVector[i].NativePtr == fontsVector[j].NativePtr)
+ if (fontsVector[i].Handle == fontsVector[j].Handle)
throw new InvalidOperationException("An already added font has been added again.");
}
}
@@ -247,7 +247,7 @@ internal sealed class DelegateFontHandle : FontHandle
{
var distinct =
fontsVector
- .DistinctBy(x => (nint)x.NativePtr) // Remove duplicates
+ .DistinctBy(x => (nint)x.Handle) // Remove duplicates
.Where(x => x.ValidateUnsafe() is null) // Remove invalid entries without freeing them
.ToArray();
@@ -259,7 +259,7 @@ internal sealed class DelegateFontHandle : FontHandle
}
}
- ///
+ ///
public void OnPreBuildCleanup(IFontAtlasBuildToolkitPreBuild toolkitPreBuild)
{
// irrelevant
diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs
index 955b10892..8f77b8084 100644
--- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs
@@ -15,7 +15,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Storage.Assets;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using SharpDX.DXGI;
@@ -155,7 +155,7 @@ internal sealed partial class FontAtlasFactory
Log.Verbose(
"[{name}] 0x{atlas:X}: {funcname}(0x{dataPointer:X}, 0x{dataSize:X}, ...) from {tag}",
this.data.Owner?.Name ?? "(error)",
- (nint)this.NewImAtlas.NativePtr,
+ (nint)this.NewImAtlas.Handle,
nameof(this.AddFontFromImGuiHeapAllocatedMemory),
(nint)dataPointer,
dataSize,
@@ -169,7 +169,7 @@ internal sealed partial class FontAtlasFactory
var raw = fontConfig.Raw with
{
FontData = dataPointer,
- FontDataOwnedByAtlas = 1,
+ FontDataOwnedByAtlas = true,
FontDataSize = dataSize,
};
@@ -181,7 +181,7 @@ internal sealed partial class FontAtlasFactory
TrueTypeUtils.CheckImGuiCompatibleOrThrow(raw);
- font = this.NewImAtlas.AddFont(&raw);
+ font = this.NewImAtlas.AddFont(raw);
var dataHash = default(HashCode);
dataHash.AddBytes(new(dataPointer, dataSize));
@@ -222,7 +222,7 @@ internal sealed partial class FontAtlasFactory
{
// Note that for both RemoveAt calls, corresponding destructors will be called.
- var configIndex = this.data.ConfigData.FindIndex(x => x.DstFont == font.NativePtr);
+ var configIndex = this.data.ConfigData.FindIndex(x => x.DstFont == font.Handle);
if (configIndex >= 0)
this.data.ConfigData.RemoveAt(configIndex);
@@ -233,7 +233,7 @@ internal sealed partial class FontAtlasFactory
// ImFontConfig has no destructor, and does not free the data.
if (freeOnException)
- ImGuiNative.igMemFree(dataPointer);
+ ImGui.MemFree(dataPointer);
throw;
}
@@ -279,7 +279,7 @@ internal sealed partial class FontAtlasFactory
}
catch
{
- ImGuiNative.igMemFree(memory);
+ ImGui.MemFree(memory);
throw;
}
}
@@ -304,7 +304,7 @@ internal sealed partial class FontAtlasFactory
}
catch
{
- ImGuiNative.igMemFree(memory);
+ ImGui.MemFree(memory);
throw;
}
}
@@ -653,7 +653,7 @@ internal sealed partial class FontAtlasFactory
foreach (var c in FallbackCodepoints)
{
var g = font.FindGlyphNoFallback(c);
- if (g.NativePtr == null)
+ if (g == null)
continue;
font.UpdateFallbackChar(c);
@@ -663,7 +663,7 @@ internal sealed partial class FontAtlasFactory
foreach (var c in EllipsisCodepoints)
{
var g = font.FindGlyphNoFallback(c);
- if (g.NativePtr == null)
+ if (g == null)
continue;
font.EllipsisChar = c;
@@ -699,8 +699,8 @@ internal sealed partial class FontAtlasFactory
{
ref var texture = ref textureSpan[i];
var name =
- $"{nameof(FontAtlasBuiltData)}[{this.data.Owner?.Name ?? "-"}][0x{(long)this.data.Atlas.NativePtr:X}][{i}]";
- if (texture.TexID != 0)
+ $"{nameof(FontAtlasBuiltData)}[{this.data.Owner?.Name ?? "-"}][0x{(long)this.data.Atlas.Handle:X}][{i}]";
+ if (!texture.TexID.IsNull)
{
// Nothing to do
}
@@ -769,9 +769,9 @@ internal sealed partial class FontAtlasFactory
}
if (texture.TexPixelsRGBA32 is not null)
- ImGuiNative.igMemFree(texture.TexPixelsRGBA32);
+ ImGui.MemFree(texture.TexPixelsRGBA32);
if (texture.TexPixelsAlpha8 is not null)
- ImGuiNative.igMemFree(texture.TexPixelsAlpha8);
+ ImGui.MemFree(texture.TexPixelsAlpha8);
texture.TexPixelsRGBA32 = null;
texture.TexPixelsAlpha8 = null;
}
@@ -795,8 +795,8 @@ internal sealed partial class FontAtlasFactory
var targetFound = false;
foreach (var f in this.Fonts)
{
- sourceFound |= f.NativePtr == source.NativePtr;
- targetFound |= f.NativePtr == target.NativePtr;
+ sourceFound |= f.Handle == source.Handle;
+ targetFound |= f.Handle == target.Handle;
}
if (sourceFound && targetFound)
@@ -817,8 +817,8 @@ internal sealed partial class FontAtlasFactory
public unsafe void BuildLookupTable(ImFontPtr font)
{
// Need to clear previous Fallback pointers before BuildLookupTable, or it may crash
- font.NativePtr->FallbackGlyph = null;
- font.NativePtr->FallbackHotData = null;
+ font.Handle->FallbackGlyph = null;
+ font.Handle->FallbackHotData = null;
font.BuildLookupTable();
// Need to fix our custom ImGui, so that imgui_widgets.cpp:3656 stops thinking
@@ -826,7 +826,7 @@ internal sealed partial class FontAtlasFactory
// Otherwise, having a fallback character in ImGui.InputText gets strange.
var indexedHotData = font.IndexedHotDataWrapped();
var indexLookup = font.IndexLookupWrapped();
- ref var fallbackHotData = ref *(ImGuiHelpers.ImFontGlyphHotDataReal*)font.NativePtr->FallbackHotData;
+ ref var fallbackHotData = ref *(ImGuiHelpers.ImFontGlyphHotDataReal*)font.Handle->FallbackHotData;
for (var codepoint = 0; codepoint < indexedHotData.Length; codepoint++)
{
if (indexLookup[codepoint] == ushort.MaxValue)
diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs
index 853556239..5fe94287f 100644
--- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs
@@ -8,6 +8,7 @@ using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.GameFonts;
using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility;
@@ -15,8 +16,6 @@ using Dalamud.Logging.Internal;
using Dalamud.Plugin.Internal.Types;
using Dalamud.Utility;
-using ImGuiNET;
-
using JetBrains.Annotations;
namespace Dalamud.Interface.ManagedFontAtlas.Internals;
@@ -73,12 +72,12 @@ internal sealed partial class FontAtlasFactory
var wrapsCopy = this.wraps = new();
this.Garbage.Add(() => wrapsCopy.Clear());
- var atlasPtr = ImGuiNative.ImFontAtlas_ImFontAtlas();
+ var atlasPtr = ImGui.ImFontAtlas();
this.Atlas = atlasPtr;
- if (this.Atlas.NativePtr is null)
+ if (this.Atlas.Handle is null)
throw new OutOfMemoryException($"Failed to allocate a new {nameof(ImFontAtlas)}.");
- this.Garbage.Add(() => ImGuiNative.ImFontAtlas_destroy(atlasPtr));
+ this.Garbage.Add(() => this.Atlas.Destroy());
this.IsBuildInProgress = true;
Interlocked.Increment(ref numActiveInstances);
@@ -188,7 +187,7 @@ internal sealed partial class FontAtlasFactory
case IRefCountable.RefCountResult.FinalRelease:
#if VeryVerboseLog
- Log.Verbose("[{name}] 0x{ptr:X}: Disposing", this.Owner?.Name ?? ">", (nint)this.Atlas.NativePtr);
+ Log.Verbose("[{name}] 0x{ptr:X}: Disposing", this.Owner?.Name ?? ">", (nint)this.Atlas.Handle);
#endif
if (this.IsBuildInProgress)
@@ -199,7 +198,7 @@ internal sealed partial class FontAtlasFactory
"[{name}] 0x{ptr:X}: Trying to dispose while build is in progress; disposing later.\n" +
"Stack:\n{trace}",
this.Owner?.Name ?? ">",
- (nint)this.Atlas.NativePtr,
+ (nint)this.Atlas.Handle,
new StackTrace());
}
@@ -371,7 +370,7 @@ internal sealed partial class FontAtlasFactory
public Task BuildTask => this.buildTask;
///
- public bool HasBuiltAtlas => !(this.builtData?.Atlas.IsNull() ?? true);
+ public bool HasBuiltAtlas => !(this.builtData?.Atlas.IsNull ?? true);
///
public bool IsGlobalScaled { get; }
@@ -568,7 +567,7 @@ internal sealed partial class FontAtlasFactory
}
var res = await this.RebuildFontsPrivate(true, scale);
- if (res.Atlas.IsNull())
+ if (res.Atlas.IsNull)
return res;
this.PromoteBuiltData(rebuildIndex, res, nameof(this.BuildFontsAsync));
@@ -663,10 +662,10 @@ internal sealed partial class FontAtlasFactory
{
res = new(this, scale);
foreach (var fhm in this.fontHandleManagers)
- res.InitialAddSubstance(fhm.NewSubstance(res));
+ res.InitialAddSubstance(fhm.NewSubstance(res));
unsafe
{
- atlasPtr = (nint)res.Atlas.NativePtr;
+ atlasPtr = (nint)res.Atlas.Handle;
}
Log.Verbose(
@@ -698,10 +697,10 @@ internal sealed partial class FontAtlasFactory
res = new(this, scale);
foreach (var fhm in this.fontHandleManagers)
- res.InitialAddSubstance(fhm.NewSubstance(res));
+ res.InitialAddSubstance(fhm.NewSubstance(res));
unsafe
{
- atlasPtr = (nint)res.Atlas.NativePtr;
+ atlasPtr = (nint)res.Atlas.Handle;
}
toolkit = res.CreateToolkit(this.factory, isAsync);
diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.cs
index 84d59b234..5a326a9b1 100644
--- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.cs
@@ -18,7 +18,7 @@ using Dalamud.Plugin.Internal.Types;
using Dalamud.Storage.Assets;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Data.Files;
diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs
index b84a857da..aadea6aea 100644
--- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs
@@ -10,7 +10,7 @@ using Dalamud.Plugin.Internal;
using Dalamud.Plugin.Internal.Types;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs
index 636bee2e2..61aab9e75 100644
--- a/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs
@@ -12,7 +12,7 @@ using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Lumina.Data.Files;
@@ -381,7 +381,10 @@ internal class GamePrebakedFontHandle : FontHandle
var pixels8Array = new byte*[toolkitPostBuild.NewImAtlas.Textures.Size];
var widths = new int[toolkitPostBuild.NewImAtlas.Textures.Size];
for (var i = 0; i < pixels8Array.Length; i++)
- toolkitPostBuild.NewImAtlas.GetTexDataAsAlpha8(i, out pixels8Array[i], out widths[i], out _);
+ {
+ var width = 0;
+ toolkitPostBuild.NewImAtlas.GetTexDataAsAlpha8(i, ref pixels8Array[i], ref widths[i], ref width);
+ }
foreach (var (style, plan) in this.fonts)
{
@@ -429,7 +432,7 @@ internal class GamePrebakedFontHandle : FontHandle
var fas = style.Scale(atlasScale).FamilyAndSize;
using var handle = this.handleManager.GameFontTextureProvider.CreateFdtFileView(fas, out var fdt);
ref var fdtFontHeader = ref fdt.FontHeader;
- var fontPtr = font.NativePtr;
+ var fontPtr = font.Handle;
var scale = style.SizePt / fdtFontHeader.Size;
fontPtr->Ascent = fdtFontHeader.Ascent * scale;
@@ -513,7 +516,7 @@ internal class GamePrebakedFontHandle : FontHandle
var ranges = this.Ranges[this.FullRangeFont];
foreach (var (font, extraRange) in this.Ranges)
{
- if (font.NativePtr != this.FullRangeFont.NativePtr)
+ if (font.Handle != this.FullRangeFont.Handle)
ranges.Or(extraRange);
}
@@ -562,7 +565,7 @@ internal class GamePrebakedFontHandle : FontHandle
public unsafe void PostProcessFullRangeFont(float atlasScale)
{
var round = 1 / atlasScale;
- var pfrf = this.FullRangeFont.NativePtr;
+ var pfrf = this.FullRangeFont.Handle;
ref var frf = ref *pfrf;
frf.FontSize = MathF.Round(frf.FontSize / round) * round;
@@ -589,19 +592,18 @@ internal class GamePrebakedFontHandle : FontHandle
continue;
if (!fullRange[leftInt] || !fullRange[rightInt])
continue;
- ImGuiNative.ImFont_AddKerningPair(
- pfrf,
+ pfrf->AddKerningPair(
(ushort)leftInt,
(ushort)rightInt,
MathF.Round((k.RightOffset * scale) / round) * round);
}
pfrf->FallbackGlyph = null;
- ImGuiNative.ImFont_BuildLookupTable(pfrf);
+ pfrf->BuildLookupTable();
foreach (var fallbackCharCandidate in FontAtlasFactory.FallbackCodepoints)
{
- var glyph = ImGuiNative.ImFont_FindGlyphNoFallback(pfrf, fallbackCharCandidate);
+ var glyph = pfrf->FindGlyphNoFallback(fallbackCharCandidate);
if ((nint)glyph == IntPtr.Zero)
continue;
frf.FallbackChar = fallbackCharCandidate;
@@ -619,7 +621,7 @@ internal class GamePrebakedFontHandle : FontHandle
foreach (var (font, rangeBits) in this.Ranges)
{
- if (font.NativePtr == this.FullRangeFont.NativePtr)
+ if (font.Handle == this.FullRangeFont.Handle)
continue;
var fontScaleMode = toolkitPostBuild.GetFontScaleMode(font);
@@ -641,7 +643,7 @@ internal class GamePrebakedFontHandle : FontHandle
glyphIndex = (ushort)glyphs.Length;
glyphs.Add(default);
}
-
+
ref var g = ref glyphs[glyphIndex];
g = sourceGlyph;
if (fontScaleMode == FontScaleMode.SkipHandling)
@@ -681,16 +683,16 @@ internal class GamePrebakedFontHandle : FontHandle
}
}
- font.NativePtr->FallbackGlyph = null;
+ font.Handle->FallbackGlyph = null;
font.BuildLookupTable();
foreach (var fallbackCharCandidate in FontAtlasFactory.FallbackCodepoints)
{
- var glyph = font.FindGlyphNoFallback(fallbackCharCandidate).NativePtr;
- if ((nint)glyph == IntPtr.Zero)
+ var glyph = font.FindGlyphNoFallback(fallbackCharCandidate);
+ if (glyph == null)
continue;
- ref var frf = ref *font.NativePtr;
+ ref var frf = ref *font.Handle;
frf.FallbackChar = fallbackCharCandidate;
frf.FallbackGlyph = glyph;
frf.FallbackHotData =
@@ -804,10 +806,9 @@ internal class GamePrebakedFontHandle : FontHandle
else
{
ref var rc = ref *(ImGuiHelpers.ImFontAtlasCustomRectReal*)toolkitPostBuild.NewImAtlas
- .GetCustomRectByIndex(rectId)
- .NativePtr;
+ .GetCustomRectByIndex(rectId);
var widthAdjustment = this.BaseStyle.CalculateBaseWidthAdjustment(fdtFontHeader, fdtGlyph);
-
+
// Glyph is scaled at this point; undo that.
ref var glyph = ref glyphs[lookups[rc.GlyphId]];
glyph.X0 = this.BaseAttr.HorizontalOffset;
@@ -822,7 +823,7 @@ internal class GamePrebakedFontHandle : FontHandle
this.gftp.GetTexFile(this.BaseAttr.TexPathFormat, fdtGlyph.TextureFileIndex);
var sourceBuffer = texFiles[fdtGlyph.TextureFileIndex].ImageData;
var sourceBufferDelta = fdtGlyph.TextureChannelByteIndex;
-
+
for (var y = 0; y < fdtGlyph.BoundingHeight; y++)
{
var sourcePixelIndex =
@@ -830,11 +831,11 @@ internal class GamePrebakedFontHandle : FontHandle
sourcePixelIndex *= 4;
sourcePixelIndex += sourceBufferDelta;
var blend1 = horzBlend[fdtGlyph.CurrentOffsetY + y];
-
+
var targetOffset = ((rc.Y + y) * width) + rc.X;
for (var x = 0; x < rc.Width; x++)
pixels8[targetOffset + x] = 0;
-
+
targetOffset += horzShift[fdtGlyph.CurrentOffsetY + y];
if (blend1 == 0)
{
diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/IFontHandleSubstance.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/IFontHandleSubstance.cs
index ef4150e33..75d06bd7e 100644
--- a/Dalamud/Interface/ManagedFontAtlas/Internals/IFontHandleSubstance.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/Internals/IFontHandleSubstance.cs
@@ -1,9 +1,8 @@
using System.Collections.Generic;
+using Dalamud.Bindings.ImGui;
using Dalamud.Utility;
-using ImGuiNET;
-
namespace Dalamud.Interface.ManagedFontAtlas.Internals;
///
@@ -45,7 +44,7 @@ internal interface IFontHandleSubstance : IDisposable
///
/// The toolkit.
void OnPreBuild(IFontAtlasBuildToolkitPreBuild toolkitPreBuild);
-
+
///
/// Called between and calls.
/// Any further modification to will result in undefined behavior.
diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/LockedImFont.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/LockedImFont.cs
index bd50502c8..b7f5ad12b 100644
--- a/Dalamud/Interface/ManagedFontAtlas/Internals/LockedImFont.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/Internals/LockedImFont.cs
@@ -1,7 +1,6 @@
+using Dalamud.Bindings.ImGui;
using Dalamud.Utility;
-using ImGuiNET;
-
namespace Dalamud.Interface.ManagedFontAtlas.Internals;
///
diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/SimplePushedFont.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/SimplePushedFont.cs
index 0c96025ac..0d6ad5c7c 100644
--- a/Dalamud/Interface/ManagedFontAtlas/Internals/SimplePushedFont.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/Internals/SimplePushedFont.cs
@@ -1,10 +1,9 @@
using System.Collections.Generic;
using System.Diagnostics;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Utility;
-using ImGuiNET;
-
using Microsoft.Extensions.ObjectPool;
using Serilog;
@@ -32,10 +31,10 @@ internal sealed class SimplePushedFont : IDisposable
public static SimplePushedFont Rent(List stack, ImFontPtr fontPtr)
{
var rented = Pool.Get();
- Debug.Assert(rented.font.IsNull(), "Rented object must not have its font set");
+ Debug.Assert(rented.font.IsNull, "Rented object must not have its font set");
rented.stack = stack;
- if (fontPtr.IsNotNullAndLoaded())
+ if (!fontPtr.IsNull && fontPtr.IsLoaded())
{
rented.font = fontPtr;
ImGui.PushFont(fontPtr);
@@ -54,9 +53,9 @@ internal sealed class SimplePushedFont : IDisposable
this.stack.RemoveAt(this.stack.Count - 1);
- if (!this.font.IsNull())
+ if (!this.font.IsNull)
{
- if (ImGui.GetFont().NativePtr == this.font.NativePtr)
+ if (ImGui.GetFont().Handle == this.font.Handle)
{
ImGui.PopFont();
}
diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/TrueType.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/TrueType.cs
index 1d437d56d..3c566e756 100644
--- a/Dalamud/Interface/ManagedFontAtlas/Internals/TrueType.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/Internals/TrueType.cs
@@ -2,10 +2,9 @@ using System.Buffers.Binary;
using System.Collections.Generic;
using System.Linq;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Utility;
-using ImGuiNET;
-
namespace Dalamud.Interface.ManagedFontAtlas.Internals;
///
@@ -18,7 +17,7 @@ internal static partial class TrueTypeUtils
/// and throws an appropriate exception if it is the case.
///
/// The font config.
- public static unsafe void CheckImGuiCompatibleOrThrow(in ImFontConfig fontConfig)
+ public static unsafe void CheckImGuiCompatibleOrThrow(in ImFontConfigPtr fontConfig)
{
var ranges = fontConfig.GlyphRanges;
var sfnt = AsSfntFile(fontConfig);
@@ -35,7 +34,7 @@ internal static partial class TrueTypeUtils
/// The font config.
/// The enumerable of pair adjustments. Distance values need to be multiplied by font size in pixels.
public static IEnumerable<(char Left, char Right, float Distance)> ExtractHorizontalPairAdjustments(
- ImFontConfig fontConfig)
+ ImFontConfigPtr fontConfig)
{
float multiplier;
Dictionary glyphToCodepoints;
@@ -107,7 +106,7 @@ internal static partial class TrueTypeUtils
}
}
- private static unsafe SfntFile AsSfntFile(in ImFontConfig fontConfig)
+ private static unsafe SfntFile AsSfntFile(in ImFontConfigPtr fontConfig)
{
var memory = new PointerSpan((byte*)fontConfig.FontData, fontConfig.FontDataSize);
if (memory.Length < 4)
diff --git a/Dalamud/Interface/ManagedFontAtlas/SafeFontConfig.cs b/Dalamud/Interface/ManagedFontAtlas/SafeFontConfig.cs
index caa686856..484c3540b 100644
--- a/Dalamud/Interface/ManagedFontAtlas/SafeFontConfig.cs
+++ b/Dalamud/Interface/ManagedFontAtlas/SafeFontConfig.cs
@@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Text;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.ManagedFontAtlas;
@@ -14,13 +14,14 @@ public struct SafeFontConfig
///
/// The raw config.
///
- public ImFontConfig Raw;
+ public ImFontConfigPtr Raw;
///
/// Initializes a new instance of the struct.
///
- public SafeFontConfig()
+ public unsafe SafeFontConfig()
{
+ this.Raw.Handle = ImGui.ImFontConfig();
this.OversampleH = 1;
this.OversampleV = 1;
this.PixelSnapH = true;
@@ -28,7 +29,7 @@ public struct SafeFontConfig
this.RasterizerMultiply = 1f;
this.RasterizerGamma = 1.7f;
this.EllipsisChar = unchecked((char)-1);
- this.Raw.FontDataOwnedByAtlas = 1;
+ this.Raw.FontDataOwnedByAtlas = true;
}
///
@@ -39,9 +40,9 @@ public struct SafeFontConfig
public unsafe SafeFontConfig(ImFontConfigPtr config)
: this()
{
- if (config.NativePtr is not null)
+ if (config.Handle is not null)
{
- this.Raw = *config.NativePtr;
+ this.Raw = config.Handle;
this.Raw.GlyphRanges = null;
}
}
@@ -107,8 +108,8 @@ public struct SafeFontConfig
///
public bool PixelSnapH
{
- get => this.Raw.PixelSnapH != 0;
- set => this.Raw.PixelSnapH = value ? (byte)1 : (byte)0;
+ get => this.Raw.PixelSnapH;
+ set => this.Raw.PixelSnapH = value;
}
///
@@ -237,11 +238,11 @@ public struct SafeFontConfig
///
public unsafe ImFontPtr MergeFont
{
- get => this.Raw.DstFont is not null ? this.Raw.DstFont : default;
+ get => this.Raw.DstFont.Handle != null ? this.Raw.DstFont : default;
set
{
- this.Raw.MergeMode = value.NativePtr is null ? (byte)0 : (byte)1;
- this.Raw.DstFont = value.NativePtr is null ? default : value.NativePtr;
+ this.Raw.MergeMode = value.Handle != null;
+ this.Raw.DstFont = value.Handle == null ? ImFontPtr.Null : value.Handle;
}
}
diff --git a/Dalamud/Interface/Style/StyleModel.cs b/Dalamud/Interface/Style/StyleModel.cs
index 643fe463d..0dad9a47e 100644
--- a/Dalamud/Interface/Style/StyleModel.cs
+++ b/Dalamud/Interface/Style/StyleModel.cs
@@ -5,7 +5,7 @@ using System.Numerics;
using Dalamud.Configuration.Internal;
using Dalamud.Interface.Colors;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Newtonsoft.Json;
using Serilog;
diff --git a/Dalamud/Interface/Style/StyleModelV1.cs b/Dalamud/Interface/Style/StyleModelV1.cs
index 43341126e..4fc413f5d 100644
--- a/Dalamud/Interface/Style/StyleModelV1.cs
+++ b/Dalamud/Interface/Style/StyleModelV1.cs
@@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.Numerics;
using Dalamud.Interface.Colors;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Newtonsoft.Json;
namespace Dalamud.Interface.Style;
@@ -400,7 +400,7 @@ public class StyleModelV1 : StyleModel
foreach (var imGuiCol in Enum.GetValues())
{
- if (imGuiCol == ImGuiCol.COUNT)
+ if (imGuiCol == ImGuiCol.Count)
{
continue;
}
@@ -472,7 +472,7 @@ public class StyleModelV1 : StyleModel
foreach (var imGuiCol in Enum.GetValues())
{
- if (imGuiCol == ImGuiCol.COUNT)
+ if (imGuiCol == ImGuiCol.Count)
{
continue;
}
@@ -512,7 +512,7 @@ public class StyleModelV1 : StyleModel
foreach (var imGuiCol in Enum.GetValues())
{
- if (imGuiCol == ImGuiCol.COUNT)
+ if (imGuiCol == ImGuiCol.Count)
{
continue;
}
diff --git a/Dalamud/Interface/Textures/ImGuiViewportTextureArgs.cs b/Dalamud/Interface/Textures/ImGuiViewportTextureArgs.cs
index c48d8c73e..c5274daaa 100644
--- a/Dalamud/Interface/Textures/ImGuiViewportTextureArgs.cs
+++ b/Dalamud/Interface/Textures/ImGuiViewportTextureArgs.cs
@@ -4,7 +4,7 @@ using System.Text;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures.TextureWraps;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using TerraFX.Interop.DirectX;
diff --git a/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs b/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs
index ffdc17d58..ada5affc4 100644
--- a/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs
+++ b/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs
@@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Plugin.Internal.Types;
@@ -252,7 +253,7 @@ internal sealed partial class TextureManager
0);
///
- public IntPtr ImGuiHandle
+ public ImTextureID ImGuiHandle
{
get
{
@@ -261,7 +262,7 @@ internal sealed partial class TextureManager
this.srvDebugPreviewExpiryTick = Environment.TickCount64 + 1000;
if (!this.srvDebugPreview.IsEmpty())
- return (nint)this.srvDebugPreview.Get();
+ return new ImTextureID(this.srvDebugPreview.Get());
var srvDesc = new D3D11_SHADER_RESOURCE_VIEW_DESC(
this.tex2D,
D3D_SRV_DIMENSION.D3D11_SRV_DIMENSION_TEXTURE2D);
@@ -275,7 +276,7 @@ internal sealed partial class TextureManager
return Service.Get().Empty4X4.ImGuiHandle;
srv.Swap(ref this.srvDebugPreview);
- return (nint)this.srvDebugPreview.Get();
+ return new ImTextureID(this.srvDebugPreview.Get());
}
}
diff --git a/Dalamud/Interface/Textures/Internal/TextureManager.Drawer.cs b/Dalamud/Interface/Textures/Internal/TextureManager.Drawer.cs
index d1b017197..27cf68b32 100644
--- a/Dalamud/Interface/Textures/Internal/TextureManager.Drawer.cs
+++ b/Dalamud/Interface/Textures/Internal/TextureManager.Drawer.cs
@@ -5,7 +5,7 @@ using System.Numerics;
using Dalamud.Storage.Assets;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -214,10 +214,10 @@ internal sealed partial class TextureManager
{
var data = stackalloc ImDrawVert[]
{
- new() { col = uint.MaxValue, pos = new(-1, 1), uv = new(0, 0) },
- new() { col = uint.MaxValue, pos = new(-1, -1), uv = new(0, 1) },
- new() { col = uint.MaxValue, pos = new(1, 1), uv = new(1, 0) },
- new() { col = uint.MaxValue, pos = new(1, -1), uv = new(1, 1) },
+ new() { Col = uint.MaxValue, Pos = new(-1, 1), Uv = new(0, 0) },
+ new() { Col = uint.MaxValue, Pos = new(-1, -1), Uv = new(0, 1) },
+ new() { Col = uint.MaxValue, Pos = new(1, 1), Uv = new(1, 0) },
+ new() { Col = uint.MaxValue, Pos = new(1, -1), Uv = new(1, 1) },
};
var desc = new D3D11_BUFFER_DESC(
(uint)(sizeof(ImDrawVert) * 4),
@@ -295,10 +295,10 @@ internal sealed partial class TextureManager
return;
_ = new Span(mapped.pData, 4)
{
- [0] = new() { col = uint.MaxValue, pos = new(-1, 1), uv = uv0 },
- [1] = new() { col = uint.MaxValue, pos = new(-1, -1), uv = new(uv0.X, uv1.Y) },
- [2] = new() { col = uint.MaxValue, pos = new(1, 1), uv = new(uv1.X, uv0.Y) },
- [3] = new() { col = uint.MaxValue, pos = new(1, -1), uv = uv1 },
+ [0] = new() { Col = uint.MaxValue, Pos = new(-1, 1), Uv = uv0 },
+ [1] = new() { Col = uint.MaxValue, Pos = new(-1, -1), Uv = new(uv0.X, uv1.Y) },
+ [2] = new() { Col = uint.MaxValue, Pos = new(1, 1), Uv = new(uv1.X, uv0.Y) },
+ [3] = new() { Col = uint.MaxValue, Pos = new(1, -1), Uv = uv1 },
};
ctx->Unmap((ID3D11Resource*)buffer, 0u);
}
@@ -382,7 +382,7 @@ internal sealed partial class TextureManager
ctx->PSSetShader(this.pixelShader, null, 0);
var simp = this.sampler.Get();
ctx->PSSetSamplers(0, 1, &simp);
- var ppn = (ID3D11ShaderResourceView*)Service.Get().White4X4.ImGuiHandle;
+ var ppn = (ID3D11ShaderResourceView*)Service.Get().White4X4.ImGuiHandle.Handle;
ctx->PSSetShaderResources(0, 1, &ppn);
ctx->GSSetShader(null, null, 0);
diff --git a/Dalamud/Interface/Textures/Internal/TextureManager.FromExistingTexture.cs b/Dalamud/Interface/Textures/Internal/TextureManager.FromExistingTexture.cs
index 829b8d0c5..24358ab1d 100644
--- a/Dalamud/Interface/Textures/Internal/TextureManager.FromExistingTexture.cs
+++ b/Dalamud/Interface/Textures/Internal/TextureManager.FromExistingTexture.cs
@@ -320,7 +320,7 @@ internal sealed partial class TextureManager
{
this.wrapToClose = leaveWrapOpen ? null : wrap;
- using var unk = new ComPtr((IUnknown*)wrap.ImGuiHandle);
+ using var unk = new ComPtr((IUnknown*)wrap.ImGuiHandle.Handle);
using var srvTemp = default(ComPtr);
unk.As(&srvTemp).ThrowOnError();
diff --git a/Dalamud/Interface/Textures/TextureWraps/ForwardingTextureWrap.cs b/Dalamud/Interface/Textures/TextureWraps/ForwardingTextureWrap.cs
index 7d6ff8580..8dcbc8cad 100644
--- a/Dalamud/Interface/Textures/TextureWraps/ForwardingTextureWrap.cs
+++ b/Dalamud/Interface/Textures/TextureWraps/ForwardingTextureWrap.cs
@@ -2,6 +2,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using System.Runtime.CompilerServices;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures.TextureWraps.Internal;
@@ -13,7 +14,7 @@ namespace Dalamud.Interface.Textures.TextureWraps;
public abstract class ForwardingTextureWrap : IDalamudTextureWrap
{
///
- public IntPtr ImGuiHandle
+ public ImTextureID ImGuiHandle
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this.GetWrap().ImGuiHandle;
@@ -55,7 +56,7 @@ public abstract class ForwardingTextureWrap : IDalamudTextureWrap
public virtual unsafe IDalamudTextureWrap CreateWrapSharingLowLevelResource()
{
// Dalamud specific: IDalamudTextureWrap always points to an ID3D11ShaderResourceView.
- var handle = (IUnknown*)this.ImGuiHandle;
+ var handle = (IUnknown*)this.ImGuiHandle.Handle;
return new UnknownTextureWrap(handle, this.Width, this.Height, true);
}
diff --git a/Dalamud/Interface/Textures/TextureWraps/IDalamudTextureWrap.cs b/Dalamud/Interface/Textures/TextureWraps/IDalamudTextureWrap.cs
index 88f2dd718..d57851de0 100644
--- a/Dalamud/Interface/Textures/TextureWraps/IDalamudTextureWrap.cs
+++ b/Dalamud/Interface/Textures/TextureWraps/IDalamudTextureWrap.cs
@@ -1,5 +1,6 @@
using System.Numerics;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Textures.TextureWraps.Internal;
using TerraFX.Interop.Windows;
@@ -15,7 +16,7 @@ namespace Dalamud.Interface.Textures.TextureWraps;
public interface IDalamudTextureWrap : IDisposable
{
/// Gets a texture handle suitable for direct use with ImGui functions.
- IntPtr ImGuiHandle { get; }
+ ImTextureID ImGuiHandle { get; }
/// Gets the width of the texture.
int Width { get; }
@@ -45,7 +46,7 @@ public interface IDalamudTextureWrap : IDisposable
unsafe IDalamudTextureWrap CreateWrapSharingLowLevelResource()
{
// Dalamud specific: IDalamudTextureWrap always points to an ID3D11ShaderResourceView.
- var handle = (IUnknown*)this.ImGuiHandle;
+ var handle = (IUnknown*)this.ImGuiHandle.Handle;
return new UnknownTextureWrap(handle, this.Width, this.Height, true);
}
}
diff --git a/Dalamud/Interface/Textures/TextureWraps/Internal/UnknownTextureWrap.cs b/Dalamud/Interface/Textures/TextureWraps/Internal/UnknownTextureWrap.cs
index ec23d7d03..69117bb29 100644
--- a/Dalamud/Interface/Textures/TextureWraps/Internal/UnknownTextureWrap.cs
+++ b/Dalamud/Interface/Textures/TextureWraps/Internal/UnknownTextureWrap.cs
@@ -1,5 +1,6 @@
using System.Threading;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures.Internal;
using Dalamud.Utility;
@@ -33,10 +34,10 @@ internal sealed unsafe class UnknownTextureWrap : IDalamudTextureWrap, IDeferred
~UnknownTextureWrap() => this.Dispose(false);
///
- public nint ImGuiHandle =>
+ public ImTextureID ImGuiHandle =>
this.imGuiHandle == nint.Zero
? throw new ObjectDisposedException(nameof(UnknownTextureWrap))
- : this.imGuiHandle;
+ : new ImTextureID(this.imGuiHandle);
///
public int Width { get; }
diff --git a/Dalamud/Interface/Textures/TextureWraps/Internal/ViewportTextureWrap.cs b/Dalamud/Interface/Textures/TextureWraps/Internal/ViewportTextureWrap.cs
index 6e21bc0e8..998668f45 100644
--- a/Dalamud/Interface/Textures/TextureWraps/Internal/ViewportTextureWrap.cs
+++ b/Dalamud/Interface/Textures/TextureWraps/Internal/ViewportTextureWrap.cs
@@ -9,7 +9,7 @@ using Dalamud.Plugin.Internal.Types;
using Dalamud.Storage.Assets;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -53,12 +53,12 @@ internal sealed class ViewportTextureWrap : IDalamudTextureWrap, IDeferredDispos
~ViewportTextureWrap() => this.Dispose(false);
///
- public unsafe nint ImGuiHandle
+ public unsafe ImTextureID ImGuiHandle
{
get
{
var t = (nint)this.srv.Get();
- return t == nint.Zero ? Service.Get().Empty4X4.ImGuiHandle : t;
+ return t == nint.Zero ? Service.Get().Empty4X4.ImGuiHandle : ImTextureID.Null;
}
}
diff --git a/Dalamud/Interface/UiBuilder.cs b/Dalamud/Interface/UiBuilder.cs
index 801253003..6bc4d9a37 100644
--- a/Dalamud/Interface/UiBuilder.cs
+++ b/Dalamud/Interface/UiBuilder.cs
@@ -14,7 +14,7 @@ using Dalamud.Interface.ManagedFontAtlas.Internals;
using Dalamud.Plugin.Internal.Types;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
diff --git a/Dalamud/Interface/Utility/ImGuiClip.cs b/Dalamud/Interface/Utility/ImGuiClip.cs
index c9321fe4c..261f235b4 100644
--- a/Dalamud/Interface/Utility/ImGuiClip.cs
+++ b/Dalamud/Interface/Utility/ImGuiClip.cs
@@ -3,7 +3,7 @@ using System.Linq;
using System.Numerics;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility;
@@ -37,7 +37,7 @@ public static class ImGuiClip
ImGuiListClipperPtr clipper;
unsafe
{
- clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
+ clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
}
clipper.Begin(data.Count, lineHeight);
@@ -72,11 +72,11 @@ public static class ImGuiClip
ImGuiListClipperPtr clipper;
unsafe
{
- clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
+ clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
}
-
+
var maxRows = (int)MathF.Ceiling((float)data.Count / itemsPerLine);
-
+
clipper.Begin(maxRows, lineHeight);
while (clipper.Step())
{
@@ -91,7 +91,7 @@ public static class ImGuiClip
var itemsForRow = data
.Skip(actualRow * itemsPerLine)
.Take(itemsPerLine);
-
+
var currentIndex = 0;
foreach (var item in itemsForRow)
{
@@ -99,7 +99,7 @@ public static class ImGuiClip
{
ImGui.SameLine();
}
-
+
draw(item);
}
}
@@ -116,7 +116,7 @@ public static class ImGuiClip
ImGuiListClipperPtr clipper;
unsafe
{
- clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
+ clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
}
clipper.Begin(data.Count, lineHeight);
diff --git a/Dalamud/Interface/Utility/ImGuiExtensions.cs b/Dalamud/Interface/Utility/ImGuiExtensions.cs
index 21a0d3747..8aad48fab 100644
--- a/Dalamud/Interface/Utility/ImGuiExtensions.cs
+++ b/Dalamud/Interface/Utility/ImGuiExtensions.cs
@@ -1,7 +1,7 @@
using System.Numerics;
using System.Text;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility;
@@ -20,7 +20,7 @@ public static class ImGuiExtensions
/// Size of the text, if known.
/// Alignment.
/// Clip rect to use.
- public static void AddTextClippedEx(this ImDrawListPtr drawListPtr, Vector2 posMin, Vector2 posMax, string text, Vector2? textSizeIfKnown, Vector2 align, Vector4? clipRect)
+ public static unsafe void AddTextClippedEx(this ImDrawListPtr drawListPtr, Vector2 posMin, Vector2 posMax, string text, Vector2? textSizeIfKnown, Vector2 align, Vector4? clipRect)
{
var pos = posMin;
var textSize = textSizeIfKnown ?? ImGui.CalcTextSize(text, false, 0);
@@ -66,7 +66,7 @@ public static class ImGuiExtensions
// TODO: This should go into ImDrawList.Manual.cs in ImGui.NET...
public static unsafe void AddText(this ImDrawListPtr drawListPtr, ImFontPtr font, float fontSize, Vector2 pos, uint col, string textBegin, ref Vector4 cpuFineClipRect)
{
- var nativeFont = font.NativePtr;
+ var nativeFont = font.Handle;
var textBeginByteCount = Encoding.UTF8.GetByteCount(textBegin);
var nativeTextBegin = stackalloc byte[textBeginByteCount + 1];
@@ -81,7 +81,7 @@ public static class ImGuiExtensions
fixed (Vector4* nativeCpuFineClipRect = &cpuFineClipRect)
{
- ImGuiNative.ImDrawList_AddText_FontPtr(drawListPtr.NativePtr, nativeFont, fontSize, pos, col, nativeTextBegin, nativeTextEnd, wrapWidth, nativeCpuFineClipRect);
+ drawListPtr.AddText(nativeFont, fontSize, pos, col, nativeTextBegin, nativeTextEnd, wrapWidth, nativeCpuFineClipRect);
}
}
}
diff --git a/Dalamud/Interface/Utility/ImGuiHelpers.cs b/Dalamud/Interface/Utility/ImGuiHelpers.cs
index 37237438e..18a15a5e0 100644
--- a/Dalamud/Interface/Utility/ImGuiHelpers.cs
+++ b/Dalamud/Interface/Utility/ImGuiHelpers.cs
@@ -3,10 +3,12 @@ using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Numerics;
using System.Reactive.Disposables;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Unicode;
+using Dalamud.Bindings.ImGui;
using Dalamud.Configuration.Internal;
using Dalamud.Game.ClientState.Keys;
using Dalamud.Game.Text.SeStringHandling.Payloads;
@@ -17,8 +19,6 @@ using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Interface.ManagedFontAtlas.Internals;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
-
using VirtualKey = Dalamud.Game.ClientState.Keys.VirtualKey;
namespace Dalamud.Interface.Utility;
@@ -43,7 +43,7 @@ public static partial class ImGuiHelpers
/// This does not necessarily mean you can call drawing functions.
///
public static unsafe bool IsImGuiInitialized =>
- ImGui.GetCurrentContext() != nint.Zero && ImGui.GetIO().NativePtr is not null;
+ ImGui.GetCurrentContext().Handle is not null && ImGui.GetIO().Handle is not null;
///
/// Gets the global Dalamud scale; even available before drawing is ready.
@@ -145,12 +145,13 @@ public static partial class ImGuiHelpers
///
/// The total number of swatches to use.
/// Default color palette.
- public static List DefaultColorPalette(int swatchCount = 32)
+ public static unsafe List DefaultColorPalette(int swatchCount = 32)
{
var colorPalette = new List();
for (var i = 0; i < swatchCount; i++)
{
- ImGui.ColorConvertHSVtoRGB(i / 31.0f, 0.7f, 0.8f, out var r, out var g, out var b);
+ float r = 0f, g = 0f, b = 0f;
+ ImGui.ColorConvertHSVtoRGB(i / 31.0f, 0.7f, 0.8f, ref r, ref g, ref b);
colorPalette.Add(new Vector4(r, g, b, 1.0f));
}
@@ -262,7 +263,7 @@ public static partial class ImGuiHelpers
{
Func rounder = round > 0 ? x => MathF.Round(x / round) * round : x => x;
- var font = fontPtr.NativePtr;
+ var font = fontPtr.Handle;
font->FontSize = rounder(font->FontSize * scale);
font->Ascent = rounder(font->Ascent * scale);
font->Descent = font->FontSize - font->Ascent;
@@ -355,7 +356,7 @@ public static partial class ImGuiHelpers
if (glyph->Codepoint < rangeLow || glyph->Codepoint > rangeHigh)
continue;
- var prevGlyphPtr = (ImFontGlyphReal*)target.FindGlyphNoFallback((ushort)glyph->Codepoint).NativePtr;
+ var prevGlyphPtr = (ImFontGlyphReal*)target.FindGlyphNoFallback((ushort)glyph->Codepoint);
if ((IntPtr)prevGlyphPtr == IntPtr.Zero)
{
addedCodepoints.Add(glyph->Codepoint);
@@ -397,9 +398,9 @@ public static partial class ImGuiHelpers
var kernPairs = source.KerningPairs;
for (int j = 0, k = kernPairs.Size; j < k; j++)
{
- if (!addedCodepoints.Contains(kernPairs[j].Left))
+ if (!addedCodepoints.Contains((int)kernPairs[j].Left))
continue;
- if (!addedCodepoints.Contains(kernPairs[j].Right))
+ if (!addedCodepoints.Contains((int)kernPairs[j].Right))
continue;
target.AddKerningPair(kernPairs[j].Left, kernPairs[j].Right, kernPairs[j].AdvanceXAdjustment);
changed = true;
@@ -414,7 +415,7 @@ public static partial class ImGuiHelpers
// On our secondary calls of BuildLookupTable, FallbackGlyph is set to some value that is not null,
// making ImGui attempt to treat whatever was there as a ' '.
// This may cause random glyphs to be sized randomly, if not an access violation exception.
- target.NativePtr->FallbackGlyph = null;
+ target.Handle->FallbackGlyph = null;
target.BuildLookupTable();
}
@@ -486,11 +487,11 @@ public static partial class ImGuiHelpers
length,
$"{nameof(length)} cannot be a negative number.");
default:
- var memory = ImGuiNative.igMemAlloc((uint)length);
+ var memory = ImGui.MemAlloc((uint)length);
if (memory is null)
{
throw new OutOfMemoryException(
- $"Failed to allocate {length} bytes using {nameof(ImGuiNative.igMemAlloc)}");
+ $"Failed to allocate {length} bytes using {nameof(ImGui.MemAlloc)}");
}
return memory;
@@ -504,12 +505,12 @@ public static partial class ImGuiHelpers
/// Disposable you can call.
public static unsafe IDisposable NewFontGlyphRangeBuilderPtrScoped(out ImFontGlyphRangesBuilderPtr builder)
{
- builder = new(ImGuiNative.ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder());
- var ptr = builder.NativePtr;
+ builder = new(ImGui.ImFontGlyphRangesBuilder());
+ var ptr = builder.Handle;
return Disposable.Create(() =>
{
if (ptr != null)
- ImGuiNative.ImFontGlyphRangesBuilder_destroy(ptr);
+ new ImFontGlyphRangesBuilderPtr(ptr).Destroy();
ptr = null;
});
}
@@ -534,8 +535,9 @@ public static partial class ImGuiHelpers
builder.AddChar('.');
}
- builder.BuildRanges(out var vec);
- return new ReadOnlySpan((void*)vec.Data, vec.Size).ToArray();
+ ImVector outRanges = default;
+ builder.BuildRanges(&outRanges);
+ return new ReadOnlySpan((void*)outRanges.Data, outRanges.Size).ToArray();
}
///
@@ -566,21 +568,21 @@ public static partial class ImGuiHelpers
///
/// The pointer.
/// Whether it is empty.
- public static unsafe bool IsNull(this ImFontPtr ptr) => ptr.NativePtr == null;
+ public static unsafe bool IsNull(this ImFontPtr ptr) => ptr.Handle == null;
///
/// Determines whether is empty.
///
/// The pointer.
/// Whether it is empty.
- public static unsafe bool IsNotNullAndLoaded(this ImFontPtr ptr) => ptr.NativePtr != null && ptr.IsLoaded();
+ public static unsafe bool IsNotNullAndLoaded(this ImFontPtr ptr) => ptr.Handle != null && ptr.IsLoaded();
///
/// Determines whether is empty.
///
/// The pointer.
/// Whether it is empty.
- public static unsafe bool IsNull(this ImFontAtlasPtr ptr) => ptr.NativePtr == null;
+ public static unsafe bool IsNull(this ImFontAtlasPtr ptr) => ptr.Handle == null;
///
/// If is default, then returns .
@@ -589,18 +591,18 @@ public static partial class ImGuiHelpers
/// The other.
/// if it is not default; otherwise, .
public static unsafe ImFontPtr OrElse(this ImFontPtr self, ImFontPtr other) =>
- self.NativePtr is null ? other : self;
+ self.Handle is null ? other : self;
///
/// Mark 4K page as used, after adding a codepoint to a font.
///
/// The font.
/// The codepoint.
- internal static unsafe void Mark4KPageUsedAfterGlyphAdd(this ImFontPtr font, ushort codepoint)
+ internal static void Mark4KPageUsedAfterGlyphAdd(this ImFontPtr font, ushort codepoint)
{
// Mark 4K page as used
var pageIndex = unchecked((ushort)(codepoint / 4096));
- font.NativePtr->Used4kPagesMap[pageIndex >> 3] |= unchecked((byte)(1 << (pageIndex & 7)));
+ font.Used4kPagesMap[pageIndex >> 3] |= unchecked((byte)(1 << (pageIndex & 7)));
}
///
@@ -611,14 +613,14 @@ public static partial class ImGuiHelpers
internal static unsafe void SetTextFromCallback(ImGuiInputTextCallbackData* data, string s)
{
if (data->BufTextLen != 0)
- ImGuiNative.ImGuiInputTextCallbackData_DeleteChars(data, 0, data->BufTextLen);
+ data->DeleteChars(0, data->BufTextLen);
var len = Encoding.UTF8.GetByteCount(s);
var buf = len < 1024 ? stackalloc byte[len] : new byte[len];
Encoding.UTF8.GetBytes(s, buf);
fixed (byte* pBuf = buf)
- ImGuiNative.ImGuiInputTextCallbackData_InsertChars(data, 0, pBuf, pBuf + len);
- ImGuiNative.ImGuiInputTextCallbackData_SelectAll(data);
+ data->InsertChars(0, pBuf, pBuf + len);
+ data->SelectAll();
}
///
@@ -631,10 +633,10 @@ public static partial class ImGuiHelpers
if (!IsImGuiInitialized)
return -1;
- var viewports = new ImVectorWrapper(&ImGui.GetPlatformIO().NativePtr->Viewports);
+ var viewports = new ImVectorWrapper((ImVector*)Unsafe.AsPointer(ref ImGui.GetPlatformIO().Handle->Viewports));
for (var i = 0; i < viewports.LengthUnsafe; i++)
{
- if (viewports.DataUnsafe[i].PlatformHandle == hwnd)
+ if (viewports.DataUnsafe[i].PlatformHandle == hwnd.ToPointer())
return i;
}
@@ -656,27 +658,28 @@ public static partial class ImGuiHelpers
{
try
{
- var font = fontPtr.NativePtr;
+ var font = fontPtr.Handle;
if (font is null)
throw new NullReferenceException("The font is null.");
_ = Marshal.ReadIntPtr((nint)font);
- if (font->IndexedHotData.Data != 0)
- _ = Marshal.ReadIntPtr(font->IndexedHotData.Data);
- if (font->FrequentKerningPairs.Data != 0)
- _ = Marshal.ReadIntPtr(font->FrequentKerningPairs.Data);
- if (font->IndexLookup.Data != 0)
- _ = Marshal.ReadIntPtr(font->IndexLookup.Data);
- if (font->Glyphs.Data != 0)
- _ = Marshal.ReadIntPtr(font->Glyphs.Data);
- if (font->KerningPairs.Data != 0)
- _ = Marshal.ReadIntPtr(font->KerningPairs.Data);
+ if (font->IndexedHotData.Data != null)
+ _ = *font->IndexedHotData.Front;
+ if (font->FrequentKerningPairs.Data != null)
+ _ = font->FrequentKerningPairs.Data;
+ if (font->IndexLookup.Data != null)
+ _ = *font->IndexLookup.Data;
+ if (font->Glyphs.Data != null)
+ _ = *font->Glyphs.Data;
+ if (font->KerningPairs.Data != null)
+ _ = *font->KerningPairs.Data;
if (font->ConfigDataCount == 0 && font->ConfigData is not null)
throw new InvalidOperationException("ConfigDataCount == 0 but ConfigData is not null?");
if (font->ConfigDataCount != 0 && font->ConfigData is null)
throw new InvalidOperationException("ConfigDataCount != 0 but ConfigData is null?");
if (font->ConfigData is not null)
_ = Marshal.ReadIntPtr((nint)font->ConfigData);
+ /*
if (font->FallbackGlyph is not null
&& ((nint)font->FallbackGlyph < font->Glyphs.Data || (nint)font->FallbackGlyph >= font->Glyphs.Data))
throw new InvalidOperationException("FallbackGlyph is not in range of Glyphs.Data");
@@ -684,6 +687,7 @@ public static partial class ImGuiHelpers
&& ((nint)font->FallbackHotData < font->IndexedHotData.Data
|| (nint)font->FallbackHotData >= font->IndexedHotData.Data))
throw new InvalidOperationException("FallbackGlyph is not in range of Glyphs.Data");
+ */
if (font->ContainerAtlas is not null)
_ = Marshal.ReadIntPtr((nint)font->ContainerAtlas);
}
@@ -703,7 +707,7 @@ public static partial class ImGuiHelpers
internal static unsafe void UpdateFallbackChar(this ImFontPtr font, char c)
{
font.FallbackChar = c;
- font.NativePtr->FallbackHotData =
+ font.Handle->FallbackHotData =
(ImFontGlyphHotData*)((ImFontGlyphHotDataReal*)font.IndexedHotData.Data + font.FallbackChar);
}
diff --git a/Dalamud/Interface/Utility/ImGuiId.cs b/Dalamud/Interface/Utility/ImGuiId.cs
index 0231f3749..a5739afa9 100644
--- a/Dalamud/Interface/Utility/ImGuiId.cs
+++ b/Dalamud/Interface/Utility/ImGuiId.cs
@@ -1,6 +1,6 @@
using System.Runtime.CompilerServices;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility;
@@ -158,15 +158,15 @@ public readonly ref struct ImGuiId
switch (this.IdType)
{
case Type.Numeric:
- ImGuiNative.igPushID_Ptr((void*)this.Numeric);
+ ImGui.PushID((void*)this.Numeric);
return true;
case Type.U16:
fixed (void* p = this.U16)
- ImGuiNative.igPushID_StrStr((byte*)p, (byte*)p + (this.U16.Length * 2));
+ ImGui.PushID((byte*)p, (byte*)p + (this.U16.Length * 2));
return true;
case Type.U8:
fixed (void* p = this.U8)
- ImGuiNative.igPushID_StrStr((byte*)p, (byte*)p + this.U8.Length);
+ ImGui.PushID((byte*)p, (byte*)p + this.U8.Length);
return true;
case Type.None:
default:
diff --git a/Dalamud/Interface/Utility/ImGuiTable.cs b/Dalamud/Interface/Utility/ImGuiTable.cs
index c74bc0a2f..40040a9b5 100644
--- a/Dalamud/Interface/Utility/ImGuiTable.cs
+++ b/Dalamud/Interface/Utility/ImGuiTable.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility;
diff --git a/Dalamud/Interface/Utility/ImVectorWrapper.cs b/Dalamud/Interface/Utility/ImVectorWrapper.cs
index f350a6436..66e7fa070 100644
--- a/Dalamud/Interface/Utility/ImVectorWrapper.cs
+++ b/Dalamud/Interface/Utility/ImVectorWrapper.cs
@@ -3,8 +3,9 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Numerics;
+using System.Runtime.CompilerServices;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using JetBrains.Annotations;
@@ -58,7 +59,7 @@ public unsafe struct ImVectorWrapper : IList, IList, IReadOnlyList, IDi
$"{nameof(initialCapacity)} cannot be a negative number.");
}
- this.vector = (ImVector*)ImGuiNative.igMemAlloc((uint)sizeof(ImVector));
+ this.vector = (ImVector*)ImGui.MemAlloc((uint)sizeof(ImVector));
if (this.vector is null)
throw new OutOfMemoryException();
*this.vector = default;
@@ -71,7 +72,7 @@ public unsafe struct ImVectorWrapper : IList, IList, IReadOnlyList, IDi
}
catch
{
- ImGuiNative.igMemFree(this.vector);
+ ImGui.MemFree(this.vector);
this.vector = null;
this.HasOwnership = false;
this.destroyer = null;
@@ -200,8 +201,8 @@ public unsafe struct ImVectorWrapper : IList, IList, IReadOnlyList, IDi
{
this.Clear();
this.SetCapacity(0);
- Debug.Assert(this.vector->Data == 0, "SetCapacity(0) did not free the data");
- ImGuiNative.igMemFree(this.vector);
+ Debug.Assert(this.vector->Data == null, "SetCapacity(0) did not free the data");
+ ImGui.MemFree(this.vector);
}
this.vector = null;
@@ -492,7 +493,7 @@ public unsafe struct ImVectorWrapper : IList, IList, IReadOnlyList, IDi
{
if (capacity == 0 && this.DataUnsafe is not null)
{
- ImGuiNative.igMemFree(this.DataUnsafe);
+ ImGui.MemFree(this.DataUnsafe);
this.DataUnsafe = null;
}
@@ -504,7 +505,7 @@ public unsafe struct ImVectorWrapper : IList, IList, IReadOnlyList, IDi
var newAlloc = (T*)(capacity == 0
? null
- : ImGuiNative.igMemAlloc(checked((uint)(capacity * sizeof(T)))));
+ : ImGui.MemAlloc(checked((uint)(capacity * sizeof(T)))));
if (newAlloc is null && capacity > 0)
throw new OutOfMemoryException();
@@ -515,7 +516,7 @@ public unsafe struct ImVectorWrapper : IList, IList, IReadOnlyList, IDi
oldSpan[..this.LengthUnsafe].CopyTo(newSpan);
if (oldAlloc != null)
- ImGuiNative.igMemFree(oldAlloc);
+ ImGui.MemFree(oldAlloc);
this.DataUnsafe = newAlloc;
this.CapacityUnsafe = capacity;
@@ -685,9 +686,9 @@ public static class ImVectorWrapper
/// The owner object.
/// The wrapped vector.
public static unsafe ImVectorWrapper ConfigDataWrapped(this ImFontAtlasPtr obj) =>
- obj.NativePtr is null
+ obj.Handle is null
? throw new NullReferenceException()
- : new(&obj.NativePtr->ConfigData, ImGuiNative.ImFontConfig_destroy);
+ : new((ImVector*)Unsafe.AsPointer(ref obj.ConfigData), x => x->Destroy());
///
/// Wraps into a .
@@ -696,9 +697,9 @@ public static class ImVectorWrapper
/// The owner object.
/// The wrapped vector.
public static unsafe ImVectorWrapper FontsWrapped(this ImFontAtlasPtr obj) =>
- obj.NativePtr is null
+ obj.Handle is null
? throw new NullReferenceException()
- : new(&obj.NativePtr->Fonts, x => ImGuiNative.ImFont_destroy(x->NativePtr));
+ : new((ImVector*)Unsafe.AsPointer(ref obj.Fonts), x => x->Destroy());
///
/// Wraps into a .
@@ -707,9 +708,9 @@ public static class ImVectorWrapper
/// The owner object.
/// The wrapped vector.
public static unsafe ImVectorWrapper TexturesWrapped(this ImFontAtlasPtr obj) =>
- obj.NativePtr is null
+ obj.Handle is null
? throw new NullReferenceException()
- : new(&obj.NativePtr->Textures);
+ : new((ImVector*)Unsafe.AsPointer(ref obj.Textures));
///
/// Wraps into a .
@@ -718,9 +719,9 @@ public static class ImVectorWrapper
/// The owner object.
/// The wrapped vector.
public static unsafe ImVectorWrapper GlyphsWrapped(this ImFontPtr obj) =>
- obj.NativePtr is null
+ obj.Handle is null
? throw new NullReferenceException()
- : new(&obj.NativePtr->Glyphs);
+ : new((ImVector*)Unsafe.AsPointer(ref obj.Glyphs));
///
/// Wraps into a .
@@ -729,9 +730,9 @@ public static class ImVectorWrapper
/// The owner object.
/// The wrapped vector.
public static unsafe ImVectorWrapper IndexedHotDataWrapped(this ImFontPtr obj)
- => obj.NativePtr is null
+ => obj.Handle is null
? throw new NullReferenceException()
- : new(&obj.NativePtr->IndexedHotData);
+ : new((ImVector*)Unsafe.AsPointer(ref obj.IndexedHotData));
///
/// Wraps into a .
@@ -740,7 +741,7 @@ public static class ImVectorWrapper
/// The owner object.
/// The wrapped vector.
public static unsafe ImVectorWrapper IndexLookupWrapped(this ImFontPtr obj) =>
- obj.NativePtr is null
+ obj.Handle is null
? throw new NullReferenceException()
- : new(&obj.NativePtr->IndexLookup);
+ : new((ImVector*)Unsafe.AsPointer(ref obj.IndexLookup));
}
diff --git a/Dalamud/Interface/Utility/Internal/DevTextureSaveMenu.cs b/Dalamud/Interface/Utility/Internal/DevTextureSaveMenu.cs
index a6584f9aa..2c4bb3799 100644
--- a/Dalamud/Interface/Utility/Internal/DevTextureSaveMenu.cs
+++ b/Dalamud/Interface/Utility/Internal/DevTextureSaveMenu.cs
@@ -11,7 +11,7 @@ using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures.Internal;
using Dalamud.Interface.Textures.TextureWraps;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
diff --git a/Dalamud/Interface/Utility/Raii/Color.cs b/Dalamud/Interface/Utility/Raii/Color.cs
index 3cf93b65c..98a09d4f8 100644
--- a/Dalamud/Interface/Utility/Raii/Color.cs
+++ b/Dalamud/Interface/Utility/Raii/Color.cs
@@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Numerics;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility.Raii;
diff --git a/Dalamud/Interface/Utility/Raii/EndObjects.cs b/Dalamud/Interface/Utility/Raii/EndObjects.cs
index 261c071c3..df0339a17 100644
--- a/Dalamud/Interface/Utility/Raii/EndObjects.cs
+++ b/Dalamud/Interface/Utility/Raii/EndObjects.cs
@@ -1,7 +1,7 @@
using System.Numerics;
using System.Text;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility.Raii;
@@ -129,7 +129,7 @@ public static partial class ImRaii
=> new EndConditionally(ImGui.EndTabItem, ImGui.BeginTabItem(label));
public static unsafe IEndObject TabItem(byte* label, ImGuiTabItemFlags flags)
- => new EndConditionally(ImGuiNative.igEndTabItem, ImGuiNative.igBeginTabItem(label, null, flags) != 0);
+ => new EndConditionally(ImGui.EndTabItem, ImGui.BeginTabItem(label, null, flags));
public static unsafe IEndObject TabItem(string label, ImGuiTabItemFlags flags)
{
@@ -155,9 +155,9 @@ public static partial class ImRaii
nativeLabelStackBytes[nativeLabelOffset] = 0;
- var ret = ImGuiNative.igBeginTabItem(nativeLabelStackBytes, null, flags);
+ var ret = ImGui.BeginTabItem(nativeLabelStackBytes, null, flags);
- return new EndConditionally(ImGuiNative.igEndTabItem, ret != 0);
+ return new EndConditionally(ImGui.EndTabItem, true);
}
public static IEndObject TabItem(string label, ref bool open)
diff --git a/Dalamud/Interface/Utility/Raii/Font.cs b/Dalamud/Interface/Utility/Raii/Font.cs
index 2d11bb071..1b5e8cc58 100644
--- a/Dalamud/Interface/Utility/Raii/Font.cs
+++ b/Dalamud/Interface/Utility/Raii/Font.cs
@@ -1,4 +1,4 @@
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility.Raii;
diff --git a/Dalamud/Interface/Utility/Raii/Id.cs b/Dalamud/Interface/Utility/Raii/Id.cs
index 51c6438c4..e3ab0bfcd 100644
--- a/Dalamud/Interface/Utility/Raii/Id.cs
+++ b/Dalamud/Interface/Utility/Raii/Id.cs
@@ -1,4 +1,4 @@
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility.Raii;
@@ -41,11 +41,11 @@ public static partial class ImRaii
return this;
}
- public Id Push(IntPtr id, bool condition = true)
+ public unsafe Id Push(IntPtr id, bool condition = true)
{
if (condition)
{
- ImGui.PushID(id);
+ ImGui.PushID(id.ToPointer());
++this.count;
}
diff --git a/Dalamud/Interface/Utility/Raii/Indent.cs b/Dalamud/Interface/Utility/Raii/Indent.cs
index 3c8f0f1da..5057cebf1 100644
--- a/Dalamud/Interface/Utility/Raii/Indent.cs
+++ b/Dalamud/Interface/Utility/Raii/Indent.cs
@@ -1,4 +1,4 @@
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility.Raii;
diff --git a/Dalamud/Interface/Utility/Raii/Plot.cs b/Dalamud/Interface/Utility/Raii/Plot.cs
index fdf8ddf5a..a811282ea 100644
--- a/Dalamud/Interface/Utility/Raii/Plot.cs
+++ b/Dalamud/Interface/Utility/Raii/Plot.cs
@@ -2,9 +2,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Numerics;
-using ImGuiNET;
-
-using ImPlotNET;
+using Dalamud.Bindings.ImGui;
+using Dalamud.Bindings.ImPlot;
namespace Dalamud.Interface.Utility.Raii;
@@ -13,26 +12,26 @@ public static partial class ImRaii
{
#region EndObjects
- public static IEndObject Plot(string title_id, Vector2 size, ImPlotFlags flags)
- => new EndConditionally(ImPlot.EndPlot, ImPlot.BeginPlot(title_id, size, flags));
+ public static IEndObject Plot(string titleId, Vector2 size, ImPlotFlags flags)
+ => new EndConditionally(ImPlot.EndPlot, ImPlot.BeginPlot(titleId, size, flags));
- public static IEndObject AlignedPlots(string group_id, bool vertical = true)
- => new EndConditionally(ImPlot.EndAlignedPlots, ImPlot.BeginAlignedPlots(group_id, vertical));
+ public static IEndObject AlignedPlots(string groupId, bool vertical = true)
+ => new EndConditionally(ImPlot.EndAlignedPlots, ImPlot.BeginAlignedPlots(groupId, vertical));
- public static IEndObject LegendPopup(string label_id, ImGuiMouseButton mouse_button = ImGuiMouseButton.Right)
- => new EndConditionally(ImPlot.EndLegendPopup, ImPlot.BeginLegendPopup(label_id, mouse_button));
+ public static IEndObject LegendPopup(string labelId, ImGuiMouseButton mouseButton = ImGuiMouseButton.Right)
+ => new EndConditionally(ImPlot.EndLegendPopup, ImPlot.BeginLegendPopup(labelId, mouseButton));
- public static IEndObject Subplots(string title_id, int rows, int cols, Vector2 size, ImPlotSubplotFlags flags = ImPlotSubplotFlags.None)
- => new EndConditionally(ImPlot.EndSubplots, ImPlot.BeginSubplots(title_id, rows, cols, size, flags));
+ public static IEndObject Subplots(string titleId, int rows, int cols, Vector2 size, ImPlotSubplotFlags flags = ImPlotSubplotFlags.None)
+ => new EndConditionally(ImPlot.EndSubplots, ImPlot.BeginSubplots(titleId, rows, cols, size, flags));
- public static IEndObject Subplots(string title_id, int rows, int cols, Vector2 size, ImPlotSubplotFlags flags, ref float row_ratios, ref float col_ratios)
- => new EndConditionally(ImPlot.EndSubplots, ImPlot.BeginSubplots(title_id, rows, cols, size, flags, ref row_ratios, ref col_ratios));
+ public static IEndObject Subplots(string titleId, int rows, int cols, Vector2 size, ImPlotSubplotFlags flags, ref float rowRatios, ref float colRatios)
+ => new EndConditionally(ImPlot.EndSubplots, ImPlot.BeginSubplots(titleId, rows, cols, size, flags, ref rowRatios, ref colRatios));
public static IEndObject DragDropSourceAxis(ImAxis axis, ImGuiDragDropFlags flags = ImGuiDragDropFlags.None)
=> new EndConditionally(ImPlot.EndDragDropSource, ImPlot.BeginDragDropSourceAxis(axis, flags));
-
- public static IEndObject DragDropSourceItem(string label_id, ImGuiDragDropFlags flags = ImGuiDragDropFlags.None)
- => new EndConditionally(ImPlot.EndDragDropSource, ImPlot.BeginDragDropSourceItem(label_id, flags));
+
+ public static IEndObject DragDropSourceItem(string labelId, ImGuiDragDropFlags flags = ImGuiDragDropFlags.None)
+ => new EndConditionally(ImPlot.EndDragDropSource, ImPlot.BeginDragDropSourceItem(labelId, flags));
public static IEndObject DragDropSourcePlot(ImGuiDragDropFlags flags = ImGuiDragDropFlags.None)
=> new EndConditionally(ImPlot.EndDragDropSource, ImPlot.BeginDragDropSourcePlot(flags));
@@ -94,9 +93,9 @@ public static partial class ImRaii
ImPlotStyleVar.FillAlpha => type != typeof(float),
ImPlotStyleVar.ErrorBarSize => type != typeof(float),
ImPlotStyleVar.ErrorBarWeight => type != typeof(float),
- ImPlotStyleVar.DigitalBitHeight => type != typeof(float),
- ImPlotStyleVar.DigitalBitGap => type != typeof(float),
- ImPlotStyleVar.PlotBorderSize => type != typeof(float),
+ // ImPlotStyleVar.DigitalBitHeight => type != typeof(float),
+ // ImPlotStyleVar.DigitalBitGap => type != typeof(float),
+ // ImPlotStyleVar.PlotBorderSize => type != typeof(float),
ImPlotStyleVar.MinorAlpha => type != typeof(float),
ImPlotStyleVar.MajorTickLen => type != typeof(Vector2),
ImPlotStyleVar.MinorTickLen => type != typeof(Vector2),
@@ -104,7 +103,7 @@ public static partial class ImRaii
ImPlotStyleVar.MinorTickSize => type != typeof(Vector2),
ImPlotStyleVar.MajorGridSize => type != typeof(Vector2),
ImPlotStyleVar.MinorGridSize => type != typeof(Vector2),
- ImPlotStyleVar.PlotPadding => type != typeof(Vector2),
+ // ImPlotStyleVar.PlotPadding => type != typeof(Vector2),
ImPlotStyleVar.LabelPadding => type != typeof(Vector2),
ImPlotStyleVar.LegendPadding => type != typeof(Vector2),
ImPlotStyleVar.LegendInnerPadding => type != typeof(Vector2),
@@ -112,8 +111,8 @@ public static partial class ImRaii
ImPlotStyleVar.MousePosPadding => type != typeof(Vector2),
ImPlotStyleVar.AnnotationPadding => type != typeof(Vector2),
ImPlotStyleVar.FitPadding => type != typeof(Vector2),
- ImPlotStyleVar.PlotDefaultSize => type != typeof(Vector2),
- ImPlotStyleVar.PlotMinSize => type != typeof(Vector2),
+ // ImPlotStyleVar.PlotDefaultSize => type != typeof(Vector2),
+ // ImPlotStyleVar.PlotMinSize => type != typeof(Vector2),
_ => throw new ArgumentOutOfRangeException(nameof(idx), idx, null),
};
@@ -133,9 +132,9 @@ public static partial class ImRaii
ImPlotStyleVar.FillAlpha => new Vector2(style.FillAlpha, float.NaN),
ImPlotStyleVar.ErrorBarSize => new Vector2(style.ErrorBarSize, float.NaN),
ImPlotStyleVar.ErrorBarWeight => new Vector2(style.ErrorBarWeight, float.NaN),
- ImPlotStyleVar.DigitalBitHeight => new Vector2(style.DigitalBitHeight, float.NaN),
- ImPlotStyleVar.DigitalBitGap => new Vector2(style.DigitalBitGap, float.NaN),
- ImPlotStyleVar.PlotBorderSize => new Vector2(style.PlotBorderSize, float.NaN),
+ // ImPlotStyleVar.DigitalBitHeight => new Vector2(style.DigitalBitHeight, float.NaN),
+ // ImPlotStyleVar.DigitalBitGap => new Vector2(style.DigitalBitGap, float.NaN),
+ // ImPlotStyleVar.PlotBorderSize => new Vector2(style.PlotBorderSize, float.NaN),
ImPlotStyleVar.MinorAlpha => new Vector2(style.MinorAlpha, float.NaN),
ImPlotStyleVar.MajorTickLen => style.MajorTickLen,
ImPlotStyleVar.MinorTickLen => style.MinorTickLen,
@@ -143,7 +142,7 @@ public static partial class ImRaii
ImPlotStyleVar.MinorTickSize => style.MinorTickSize,
ImPlotStyleVar.MajorGridSize => style.MajorGridSize,
ImPlotStyleVar.MinorGridSize => style.MinorGridSize,
- ImPlotStyleVar.PlotPadding => style.PlotPadding,
+ // ImPlotStyleVar.PlotPadding => style.PlotPadding,
ImPlotStyleVar.LabelPadding => style.LabelPadding,
ImPlotStyleVar.LegendPadding => style.LegendPadding,
ImPlotStyleVar.LegendInnerPadding => style.LegendInnerPadding,
@@ -151,8 +150,8 @@ public static partial class ImRaii
ImPlotStyleVar.MousePosPadding => style.MousePosPadding,
ImPlotStyleVar.AnnotationPadding => style.AnnotationPadding,
ImPlotStyleVar.FitPadding => style.FitPadding,
- ImPlotStyleVar.PlotDefaultSize => style.PlotDefaultSize,
- ImPlotStyleVar.PlotMinSize => style.PlotMinSize,
+ // ImPlotStyleVar.PlotDefaultSize => style.PlotDefaultSize,
+ // ImPlotStyleVar.PlotMinSize => style.PlotMinSize,
_ => throw new ArgumentOutOfRangeException(nameof(idx), idx, null),
};
}
diff --git a/Dalamud/Interface/Utility/Raii/Style.cs b/Dalamud/Interface/Utility/Raii/Style.cs
index 6a8db074b..bfd04ea3c 100644
--- a/Dalamud/Interface/Utility/Raii/Style.cs
+++ b/Dalamud/Interface/Utility/Raii/Style.cs
@@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Numerics;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility.Raii;
diff --git a/Dalamud/Interface/Utility/Table/Column.cs b/Dalamud/Interface/Utility/Table/Column.cs
index 412ba87dc..0f6633b46 100644
--- a/Dalamud/Interface/Utility/Table/Column.cs
+++ b/Dalamud/Interface/Utility/Table/Column.cs
@@ -1,4 +1,4 @@
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility.Table;
diff --git a/Dalamud/Interface/Utility/Table/ColumnFlags.cs b/Dalamud/Interface/Utility/Table/ColumnFlags.cs
index 24670adfc..cc22e17c9 100644
--- a/Dalamud/Interface/Utility/Table/ColumnFlags.cs
+++ b/Dalamud/Interface/Utility/Table/ColumnFlags.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility.Table;
diff --git a/Dalamud/Interface/Utility/Table/ColumnSelect.cs b/Dalamud/Interface/Utility/Table/ColumnSelect.cs
index fb463700c..fd796be60 100644
--- a/Dalamud/Interface/Utility/Table/ColumnSelect.cs
+++ b/Dalamud/Interface/Utility/Table/ColumnSelect.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
namespace Dalamud.Interface.Utility.Table;
diff --git a/Dalamud/Interface/Utility/Table/ColumnString.cs b/Dalamud/Interface/Utility/Table/ColumnString.cs
index 3f9d2df91..587e3beaf 100644
--- a/Dalamud/Interface/Utility/Table/ColumnString.cs
+++ b/Dalamud/Interface/Utility/Table/ColumnString.cs
@@ -1,7 +1,7 @@
using System.Text.RegularExpressions;
using Dalamud.Interface.Utility.Raii;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility.Table;
diff --git a/Dalamud/Interface/Utility/Table/Table.cs b/Dalamud/Interface/Utility/Table/Table.cs
index 86653e834..5b8e867e7 100644
--- a/Dalamud/Interface/Utility/Table/Table.cs
+++ b/Dalamud/Interface/Utility/Table/Table.cs
@@ -4,7 +4,7 @@ using System.Numerics;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Utility;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Interface.Utility.Table;
diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs
index b3a505c1d..e0dfd01a1 100644
--- a/Dalamud/Interface/Windowing/Window.cs
+++ b/Dalamud/Interface/Windowing/Window.cs
@@ -17,7 +17,7 @@ using Dalamud.Logging.Internal;
using FFXIVClientStructs.FFXIV.Client.UI;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using PInvoke;
@@ -379,7 +379,11 @@ public abstract class Window
if (this.CanShowCloseButton ? ImGui.Begin(this.WindowName, ref this.internalIsOpen, flags) : ImGui.Begin(this.WindowName, flags))
{
- ImGuiNativeAdditions.igCustom_WindowSetInheritNoInputs(this.internalIsClickthrough);
+ var context = ImGui.GetCurrentContext();
+ if (!context.IsNull)
+ {
+ //ImGuiNativeAdditions.igCustom_WindowSetInheritNoInputs(this.internalIsClickthrough);
+ }
// Not supported yet on non-main viewports
if ((this.internalIsPinned || this.internalIsClickthrough || this.internalAlpha.HasValue) &&
@@ -491,6 +495,7 @@ public abstract class Window
var titleBarRect = Vector4.Zero;
unsafe
{
+ /*
var window = ImGuiNativeAdditions.igGetCurrentWindow();
ImGuiNativeAdditions.ImGuiWindow_TitleBarRect(&titleBarRect, window);
@@ -515,6 +520,7 @@ public abstract class Window
? this.TitleBarButtons.Append(additionsButton)
: this.TitleBarButtons);
}
+ */
}
if (wasFocused)
diff --git a/Dalamud/Interface/Windowing/WindowSystem.cs b/Dalamud/Interface/Windowing/WindowSystem.cs
index f79eea025..ca602b001 100644
--- a/Dalamud/Interface/Windowing/WindowSystem.cs
+++ b/Dalamud/Interface/Windowing/WindowSystem.cs
@@ -4,7 +4,7 @@ using System.Linq;
using Dalamud.Configuration.Internal;
using Dalamud.Interface.Windowing.Persistence;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
using Serilog;
namespace Dalamud.Interface.Windowing;
diff --git a/Dalamud/Memory/MemoryHelper.cs b/Dalamud/Memory/MemoryHelper.cs
index 212feb128..a5497898f 100644
--- a/Dalamud/Memory/MemoryHelper.cs
+++ b/Dalamud/Memory/MemoryHelper.cs
@@ -3,6 +3,8 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
+using Windows.Win32.System.Memory;
+
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Memory.Exceptions;
using Dalamud.Utility;
@@ -743,16 +745,16 @@ public static unsafe class MemoryHelper
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static nint Allocate(int length)
{
- var address = VirtualAlloc(
- nint.Zero,
+ var address = Windows.Win32.PInvoke.VirtualAlloc(
+ null,
(nuint)length,
- AllocationType.Commit | AllocationType.Reserve,
- MemoryProtection.ExecuteReadWrite);
+ VIRTUAL_ALLOCATION_TYPE.MEM_COMMIT | VIRTUAL_ALLOCATION_TYPE.MEM_RESERVE,
+ PAGE_PROTECTION_FLAGS.PAGE_EXECUTE_READWRITE);
- if (address == nint.Zero)
+ if (address == null)
throw new MemoryAllocationException($"Unable to allocate {length} bytes.");
- return address;
+ return new IntPtr(address);
}
///
@@ -773,7 +775,7 @@ public static unsafe class MemoryHelper
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool Free(nint memoryAddress)
{
- return VirtualFree(memoryAddress, nuint.Zero, AllocationType.Release);
+ return Windows.Win32.PInvoke.VirtualFree(memoryAddress.ToPointer(), nuint.Zero, VIRTUAL_FREE_TYPE.MEM_RELEASE);
}
///
@@ -785,7 +787,11 @@ public static unsafe class MemoryHelper
/// The old page permissions.
public static MemoryProtection ChangePermission(nint memoryAddress, int length, MemoryProtection newPermissions)
{
- var result = VirtualProtect(memoryAddress, (nuint)length, newPermissions, out var oldPermissions);
+ var result = Windows.Win32.PInvoke.VirtualProtect(
+ memoryAddress.ToPointer(),
+ (nuint)length,
+ (PAGE_PROTECTION_FLAGS)newPermissions,
+ out var oldPermissions);
if (!result)
throw new MemoryPermissionException($"Unable to change permissions at {Util.DescribeAddress(memoryAddress)} of length {length} and permission {newPermissions} (result={result})");
@@ -794,7 +800,7 @@ public static unsafe class MemoryHelper
if (last > 0)
throw new MemoryPermissionException($"Unable to change permissions at {Util.DescribeAddress(memoryAddress)} of length {length} and permission {newPermissions} (error={last})");
- return oldPermissions;
+ return (MemoryProtection)oldPermissions;
}
///
diff --git a/Dalamud/NativeFunctions.cs b/Dalamud/NativeFunctions.cs
index 32ab99372..ef415137d 100644
--- a/Dalamud/NativeFunctions.cs
+++ b/Dalamud/NativeFunctions.cs
@@ -133,194 +133,6 @@ internal static partial class NativeFunctions
Wait = 32514,
}
- ///
- /// MB_* from winuser.
- ///
- [Flags]
- public enum MessageBoxType : uint
- {
- ///
- /// The default value for any of the various subtypes.
- ///
- DefaultValue = 0x0,
-
- // To indicate the buttons displayed in the message box, specify one of the following values.
-
- ///
- /// The message box contains three push buttons: Abort, Retry, and Ignore.
- ///
- AbortRetryIgnore = 0x2,
-
- ///
- /// The message box contains three push buttons: Cancel, Try Again, Continue. Use this message box type instead
- /// of MB_ABORTRETRYIGNORE.
- ///
- CancelTryContinue = 0x6,
-
- ///
- /// Adds a Help button to the message box. When the user clicks the Help button or presses F1, the system sends
- /// a WM_HELP message to the owner.
- ///
- Help = 0x4000,
-
- ///
- /// The message box contains one push button: OK. This is the default.
- ///
- Ok = DefaultValue,
-
- ///
- /// The message box contains two push buttons: OK and Cancel.
- ///
- OkCancel = 0x1,
-
- ///
- /// The message box contains two push buttons: Retry and Cancel.
- ///
- RetryCancel = 0x5,
-
- ///
- /// The message box contains two push buttons: Yes and No.
- ///
- YesNo = 0x4,
-
- ///
- /// The message box contains three push buttons: Yes, No, and Cancel.
- ///
- YesNoCancel = 0x3,
-
- // To display an icon in the message box, specify one of the following values.
-
- ///
- /// An exclamation-point icon appears in the message box.
- ///
- IconExclamation = 0x30,
-
- ///
- /// An exclamation-point icon appears in the message box.
- ///
- IconWarning = IconExclamation,
-
- ///
- /// An icon consisting of a lowercase letter i in a circle appears in the message box.
- ///
- IconInformation = 0x40,
-
- ///
- /// An icon consisting of a lowercase letter i in a circle appears in the message box.
- ///
- IconAsterisk = IconInformation,
-
- ///
- /// A question-mark icon appears in the message box.
- /// The question-mark message icon is no longer recommended because it does not clearly represent a specific type
- /// of message and because the phrasing of a message as a question could apply to any message type. In addition,
- /// users can confuse the message symbol question mark with Help information. Therefore, do not use this question
- /// mark message symbol in your message boxes. The system continues to support its inclusion only for backward
- /// compatibility.
- ///
- IconQuestion = 0x20,
-
- ///
- /// A stop-sign icon appears in the message box.
- ///
- IconStop = 0x10,
-
- ///
- /// A stop-sign icon appears in the message box.
- ///
- IconError = IconStop,
-
- ///
- /// A stop-sign icon appears in the message box.
- ///
- IconHand = IconStop,
-
- // To indicate the default button, specify one of the following values.
-
- ///
- /// The first button is the default button.
- /// MB_DEFBUTTON1 is the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.
- ///
- DefButton1 = DefaultValue,
-
- ///
- /// The second button is the default button.
- ///
- DefButton2 = 0x100,
-
- ///
- /// The third button is the default button.
- ///
- DefButton3 = 0x200,
-
- ///
- /// The fourth button is the default button.
- ///
- DefButton4 = 0x300,
-
- // To indicate the modality of the dialog box, specify one of the following values.
-
- ///
- /// The user must respond to the message box before continuing work in the window identified by the hWnd parameter.
- /// However, the user can move to the windows of other threads and work in those windows. Depending on the hierarchy
- /// of windows in the application, the user may be able to move to other windows within the thread. All child windows
- /// of the parent of the message box are automatically disabled, but pop-up windows are not. MB_APPLMODAL is the
- /// default if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
- ///
- ApplModal = DefaultValue,
-
- ///
- /// Same as MB_APPLMODAL except that the message box has the WS_EX_TOPMOST style.
- /// Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate
- /// attention (for example, running out of memory). This flag has no effect on the user's ability to interact with
- /// windows other than those associated with hWnd.
- ///
- SystemModal = 0x1000,
-
- ///
- /// Same as MB_APPLMODAL except that all the top-level windows belonging to the current thread are disabled if the
- /// hWnd parameter is NULL. Use this flag when the calling application or library does not have a window handle
- /// available but still needs to prevent input to other windows in the calling thread without suspending other threads.
- ///
- TaskModal = 0x2000,
-
- // To specify other options, use one or more of the following values.
-
- ///
- /// Same as desktop of the interactive window station. For more information, see Window Stations. If the current
- /// input desktop is not the default desktop, MessageBox does not return until the user switches to the default
- /// desktop.
- ///
- DefaultDesktopOnly = 0x20000,
-
- ///
- /// The text is right-justified.
- ///
- Right = 0x80000,
-
- ///
- /// Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems.
- ///
- RtlReading = 0x100000,
-
- ///
- /// The message box becomes the foreground window. Internally, the system calls the SetForegroundWindow function
- /// for the message box.
- ///
- SetForeground = 0x10000,
-
- ///
- /// The message box is created with the WS_EX_TOPMOST window style.
- ///
- Topmost = 0x40000,
-
- ///
- /// The caller is a service notifying the user of an event. The function displays a message box on the current active
- /// desktop, even if there is no user logged on to the computer.
- ///
- ServiceNotification = 0x200000,
- }
-
///
/// GWL_* from winuser.
///
@@ -735,38 +547,9 @@ internal static partial class NativeFunctions
///
/// The return value is the identifier of the thread that created the window.
///
- [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+ [DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int GetWindowThreadProcessId(IntPtr handle, out int processId);
- ///
- /// Displays a modal dialog box that contains a system icon, a set of buttons, and a brief application-specific message,
- /// such as status or error information. The message box returns an integer value that indicates which button the user
- /// clicked.
- ///
- ///
- /// A handle to the owner window of the message box to be created. If this parameter is NULL, the message box has no
- /// owner window.
- ///
- ///
- /// The message to be displayed. If the string consists of more than one line, you can separate the lines using a carriage
- /// return and/or linefeed character between each line.
- ///
- ///
- /// The dialog box title. If this parameter is NULL, the default title is Error.
- ///
- /// The contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups
- /// of flags.
- ///
- ///
- /// If a message box has a Cancel button, the function returns the IDCANCEL value if either the ESC key is pressed or
- /// the Cancel button is selected. If the message box has no Cancel button, pressing ESC will no effect - unless an
- /// MB_OK button is present. If an MB_OK button is displayed and the user presses ESC, the return value will be IDOK.
- /// If the function fails, the return value is zero.To get extended error information, call GetLastError. If the function
- /// succeeds, the return value is one of the ID* enum values.
- ///
- [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
- public static extern int MessageBoxW(IntPtr hWnd, string text, string caption, MessageBoxType type);
-
///
/// Changes an attribute of the specified window. The function also sets a value at the specified offset in the extra window memory.
///
@@ -789,7 +572,7 @@ internal static partial class NativeFunctions
/// the last error information by calling SetLastError with 0, then call SetWindowLongPtr.Function failure will be indicated by
/// a return value of zero and a GetLastError result that is nonzero.
///
- [DllImport("user32.dll", SetLastError = true)]
+ [DllImport("user32.dll")]
public static extern IntPtr SetWindowLongPtrW(IntPtr hWnd, WindowLongType nIndex, IntPtr dwNewLong);
///
@@ -835,7 +618,7 @@ internal static partial class NativeFunctions
SPI_GETCLIENTAREAANIMATION = 0x1042,
#pragma warning restore SA1602
}
-
+
///
/// Retrieves or sets the value of one of the system-wide parameters. This function can also update the user profile while setting a parameter.
///
@@ -844,7 +627,7 @@ internal static partial class NativeFunctions
/// A parameter whose usage and format depends on the system parameter being queried or set. If not otherwise indicated, you must specify zero for this parameter.
/// If a system parameter is being set, specifies whether the user profile is to be updated, and if so, whether the WM_SETTINGCHANGE message is to be broadcast to all top-level windows to notify them of the change.
/// If the function succeeds, the return value is a nonzero value.
- [DllImport("user32.dll", SetLastError = true)]
+ [DllImport("user32.dll")]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, ref int pvParam, uint fWinIni);
}
@@ -1156,117 +939,6 @@ internal static partial class NativeFunctions
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1629:Documentation text should end with a period", Justification = "Stupid rule")]
internal static partial class NativeFunctions
{
- ///
- /// MEM_* from memoryapi.
- ///
- [Flags]
- public enum AllocationType
- {
- ///
- /// To coalesce two adjacent placeholders, specify MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS. When you coalesce
- /// placeholders, lpAddress and dwSize must exactly match those of the placeholder.
- ///
- CoalescePlaceholders = 0x1,
-
- ///
- /// Frees an allocation back to a placeholder (after you've replaced a placeholder with a private allocation using
- /// VirtualAlloc2 or Virtual2AllocFromApp). To split a placeholder into two placeholders, specify
- /// MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER.
- ///
- PreservePlaceholder = 0x2,
-
- ///
- /// Allocates memory charges (from the overall size of memory and the paging files on disk) for the specified reserved
- /// memory pages. The function also guarantees that when the caller later initially accesses the memory, the contents
- /// will be zero. Actual physical pages are not allocated unless/until the virtual addresses are actually accessed.
- /// To reserve and commit pages in one step, call VirtualAllocEx with MEM_COMMIT | MEM_RESERVE. Attempting to commit
- /// a specific address range by specifying MEM_COMMIT without MEM_RESERVE and a non-NULL lpAddress fails unless the
- /// entire range has already been reserved. The resulting error code is ERROR_INVALID_ADDRESS. An attempt to commit
- /// a page that is already committed does not cause the function to fail. This means that you can commit pages without
- /// first determining the current commitment state of each page. If lpAddress specifies an address within an enclave,
- /// flAllocationType must be MEM_COMMIT.
- ///
- Commit = 0x1000,
-
- ///
- /// Reserves a range of the process's virtual address space without allocating any actual physical storage in memory
- /// or in the paging file on disk. You commit reserved pages by calling VirtualAllocEx again with MEM_COMMIT. To
- /// reserve and commit pages in one step, call VirtualAllocEx with MEM_COMMIT | MEM_RESERVE. Other memory allocation
- /// functions, such as malloc and LocalAlloc, cannot use reserved memory until it has been released.
- ///
- Reserve = 0x2000,
-
- ///
- /// Decommits the specified region of committed pages. After the operation, the pages are in the reserved state.
- /// The function does not fail if you attempt to decommit an uncommitted page. This means that you can decommit
- /// a range of pages without first determining the current commitment state. The MEM_DECOMMIT value is not supported
- /// when the lpAddress parameter provides the base address for an enclave.
- ///
- Decommit = 0x4000,
-
- ///
- /// Releases the specified region of pages, or placeholder (for a placeholder, the address space is released and
- /// available for other allocations). After this operation, the pages are in the free state. If you specify this
- /// value, dwSize must be 0 (zero), and lpAddress must point to the base address returned by the VirtualAlloc function
- /// when the region is reserved. The function fails if either of these conditions is not met. If any pages in the
- /// region are committed currently, the function first decommits, and then releases them. The function does not
- /// fail if you attempt to release pages that are in different states, some reserved and some committed. This means
- /// that you can release a range of pages without first determining the current commitment state.
- ///
- Release = 0x8000,
-
- ///
- /// Indicates that data in the memory range specified by lpAddress and dwSize is no longer of interest. The pages
- /// should not be read from or written to the paging file. However, the memory block will be used again later, so
- /// it should not be decommitted. This value cannot be used with any other value. Using this value does not guarantee
- /// that the range operated on with MEM_RESET will contain zeros. If you want the range to contain zeros, decommit
- /// the memory and then recommit it. When you use MEM_RESET, the VirtualAllocEx function ignores the value of fProtect.
- /// However, you must still set fProtect to a valid protection value, such as PAGE_NOACCESS. VirtualAllocEx returns
- /// an error if you use MEM_RESET and the range of memory is mapped to a file. A shared view is only acceptable
- /// if it is mapped to a paging file.
- ///
- Reset = 0x80000,
-
- ///
- /// MEM_RESET_UNDO should only be called on an address range to which MEM_RESET was successfully applied earlier.
- /// It indicates that the data in the specified memory range specified by lpAddress and dwSize is of interest to
- /// the caller and attempts to reverse the effects of MEM_RESET. If the function succeeds, that means all data in
- /// the specified address range is intact. If the function fails, at least some of the data in the address range
- /// has been replaced with zeroes. This value cannot be used with any other value. If MEM_RESET_UNDO is called on
- /// an address range which was not MEM_RESET earlier, the behavior is undefined. When you specify MEM_RESET, the
- /// VirtualAllocEx function ignores the value of flProtect. However, you must still set flProtect to a valid
- /// protection value, such as PAGE_NOACCESS.
- ///
- ResetUndo = 0x1000000,
-
- ///
- /// Reserves an address range that can be used to map Address Windowing Extensions (AWE) pages. This value must
- /// be used with MEM_RESERVE and no other values.
- ///
- Physical = 0x400000,
-
- ///
- /// Allocates memory at the highest possible address. This can be slower than regular allocations, especially when
- /// there are many allocations.
- ///
- TopDown = 0x100000,
-
- ///
- /// Causes the system to track pages that are written to in the allocated region. If you specify this value, you
- /// must also specify MEM_RESERVE. To retrieve the addresses of the pages that have been written to since the region
- /// was allocated or the write-tracking state was reset, call the GetWriteWatch function. To reset the write-tracking
- /// state, call GetWriteWatch or ResetWriteWatch. The write-tracking feature remains enabled for the memory region
- /// until the region is freed.
- ///
- WriteWatch = 0x200000,
-
- ///
- /// Allocates memory using large page support. The size and alignment must be a multiple of the large-page minimum.
- /// To obtain this value, use the GetLargePageMinimum function. If you specify this value, you must also specify
- /// MEM_RESERVE and MEM_COMMIT.
- ///
- LargePages = 0x20000000,
- }
///
/// SEM_* from errhandlingapi.
@@ -1428,18 +1100,18 @@ internal static partial class NativeFunctions
/// created with this option cannot be locked.
///
NoSerialize = 0x00000001,
-
+
///
/// The system raises an exception to indicate failure (for example, an out-of-memory condition) for calls to
/// HeapAlloc and HeapReAlloc instead of returning NULL.
///
GenerateExceptions = 0x00000004,
-
+
///
/// The allocated memory will be initialized to zero. Otherwise, the memory is not initialized to zero.
///
ZeroMemory = 0x00000008,
-
+
///
/// All memory blocks that are allocated from this heap allow code execution, if the hardware enforces data
/// execution prevention. Use this flag heap in applications that run code from the heap. If
@@ -1475,7 +1147,7 @@ internal static partial class NativeFunctions
/// If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended
/// error information, call the GetLastError function.
///
- [DllImport("kernel32.dll", SetLastError = true)]
+ [DllImport("kernel32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FreeLibrary(IntPtr hModule);
@@ -1507,7 +1179,7 @@ internal static partial class NativeFunctions
/// code is ERROR_SUCCESS. If the function fails, the return value is 0 (zero). To get extended error information, call
/// GetLastError.
///
- [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
[PreserveSig]
public static extern uint GetModuleFileNameW(
[In] IntPtr hModule,
@@ -1532,7 +1204,7 @@ internal static partial class NativeFunctions
/// If the function succeeds, the return value is a handle to the specified module. If the function fails, the return
/// value is NULL.To get extended error information, call GetLastError.
///
- [DllImport("kernel32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [DllImport("kernel32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
public static extern IntPtr GetModuleHandleW(string lpModuleName);
///
@@ -1551,7 +1223,7 @@ internal static partial class NativeFunctions
/// If the function succeeds, the return value is the address of the exported function or variable. If the function
/// fails, the return value is NULL.To get extended error information, call GetLastError.
///
- [DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
+ [DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true)]
[SuppressMessage("Globalization", "CA2101:Specify marshaling for P/Invoke string arguments", Justification = "Ansi only")]
public static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
@@ -1576,7 +1248,7 @@ internal static partial class NativeFunctions
/// If the function succeeds, the return value is a handle to the module. If the function fails, the return value is
/// NULL.To get extended error information, call GetLastError.
///
- [DllImport("kernel32", SetLastError = true, CharSet = CharSet.Unicode)]
+ [DllImport("kernel32", CharSet = CharSet.Unicode)]
public static extern IntPtr LoadLibraryW([MarshalAs(UnmanagedType.LPWStr)] string lpFileName);
///
@@ -1607,7 +1279,7 @@ internal static partial class NativeFunctions
/// extended error information, call GetLastError. The function fails if the requested read operation crosses into an
/// area of the process that is inaccessible.
///
- [DllImport("kernel32.dll", SetLastError = true)]
+ [DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(
IntPtr hProcess,
IntPtr lpBaseAddress,
@@ -1643,7 +1315,7 @@ internal static partial class NativeFunctions
/// extended error information, call GetLastError. The function fails if the requested read operation crosses into an
/// area of the process that is inaccessible.
///
- [DllImport("kernel32.dll", SetLastError = true)]
+ [DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(
IntPtr hProcess,
IntPtr lpBaseAddress,
@@ -1662,7 +1334,7 @@ internal static partial class NativeFunctions
///
/// The return value is the previous state of the error-mode bit flags.
///
- [DllImport("kernel32.dll", SetLastError = true)]
+ [DllImport("kernel32.dll")]
public static extern ErrorModes SetErrorMode(ErrorModes uMode);
///
@@ -1701,7 +1373,7 @@ internal static partial class NativeFunctions
///
/// This value determines the initial amount of memory that is committed for the heap.
/// The value is rounded up to a multiple of the system page size. The value must be smaller than dwMaximumSize.
- ///
+ ///
/// If this parameter is 0, the function commits one page. To determine the size of a page on the host computer,
/// use the GetSystemInfo function.
///
@@ -1710,12 +1382,12 @@ internal static partial class NativeFunctions
/// system page size and then reserves a block of that size in the process's virtual address space for the heap.
/// If allocation requests made by the HeapAlloc or HeapReAlloc functions exceed the size specified by
/// dwInitialSize, the system commits additional pages of memory for the heap, up to the heap's maximum size.
- ///
+ ///
/// If dwMaximumSize is not zero, the heap size is fixed and cannot grow beyond the maximum size. Also, the largest
/// memory block that can be allocated from the heap is slightly less than 512 KB for a 32-bit process and slightly
/// less than 1,024 KB for a 64-bit process. Requests to allocate larger blocks fail, even if the maximum size of
/// the heap is large enough to contain the block.
- ///
+ ///
/// If dwMaximumSize is 0, the heap can grow in size. The heap's size is limited only by the available memory.
/// Requests to allocate memory blocks larger than the limit for a fixed-size heap do not automatically fail;
/// instead, the system calls the VirtualAlloc function to obtain the memory that is needed for large blocks.
@@ -1723,12 +1395,12 @@ internal static partial class NativeFunctions
///
///
/// If the function succeeds, the return value is a handle to the newly created heap.
- ///
+ ///
/// If the function fails, the return value is NULL. To get extended error information, call GetLastError.
///
- [DllImport("kernel32.dll", SetLastError = true)]
+ [DllImport("kernel32.dll")]
public static extern nint HeapCreate(HeapOptions flOptions, nuint dwInitialSize, nuint dwMaximumSize);
-
+
///
/// Allocates a block of memory from a heap. The allocated memory is not movable.
///
@@ -1756,131 +1428,6 @@ internal static partial class NativeFunctions
///
[DllImport("kernel32.dll", SetLastError=false)]
public static extern nint HeapAlloc(nint hHeap, HeapOptions dwFlags, nuint dwBytes);
-
- ///
- /// See https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc.
- /// Reserves, commits, or changes the state of a region of pages in the virtual address space of the calling process.
- /// Memory allocated by this function is automatically initialized to zero. To allocate memory in the address space
- /// of another process, use the VirtualAllocEx function.
- ///
- ///
- /// The starting address of the region to allocate. If the memory is being reserved, the specified address is rounded
- /// down to the nearest multiple of the allocation granularity. If the memory is already reserved and is being committed,
- /// the address is rounded down to the next page boundary. To determine the size of a page and the allocation granularity
- /// on the host computer, use the GetSystemInfo function. If this parameter is NULL, the system determines where to
- /// allocate the region. If this address is within an enclave that you have not initialized by calling InitializeEnclave,
- /// VirtualAlloc allocates a page of zeros for the enclave at that address. The page must be previously uncommitted,
- /// and will not be measured with the EEXTEND instruction of the Intel Software Guard Extensions programming model.
- /// If the address in within an enclave that you initialized, then the allocation operation fails with the
- /// ERROR_INVALID_ADDRESS error.
- ///
- ///
- /// The size of the region, in bytes. If the lpAddress parameter is NULL, this value is rounded up to the next page
- /// boundary. Otherwise, the allocated pages include all pages containing one or more bytes in the range from lpAddress
- /// to lpAddress+dwSize. This means that a 2-byte range straddling a page boundary causes both pages to be included
- /// in the allocated region.
- ///
- ///
- /// The type of memory allocation. This parameter must contain one of the MEM_* enum values.
- ///
- ///
- /// The memory protection for the region of pages to be allocated. If the pages are being committed, you can specify
- /// any one of the memory protection constants.
- ///
- ///
- /// If the function succeeds, the return value is the base address of the allocated region of pages. If the function
- /// fails, the return value is NULL.To get extended error information, call GetLastError.
- ///
- [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
- public static extern IntPtr VirtualAlloc(
- IntPtr lpAddress,
- UIntPtr dwSize,
- AllocationType flAllocationType,
- MemoryProtection flProtect);
-
- ///
- [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
- public static extern IntPtr VirtualAlloc(
- IntPtr lpAddress,
- UIntPtr dwSize,
- AllocationType flAllocationType,
- Memory.MemoryProtection flProtect);
-
- ///
- /// See https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualfree.
- /// Releases, decommits, or releases and decommits a region of pages within the virtual address space of the calling
- /// process.
- /// process.
- ///
- ///
- /// A pointer to the base address of the region of pages to be freed. If the dwFreeType parameter is MEM_RELEASE, this
- /// parameter must be the base address returned by the VirtualAlloc function when the region of pages is reserved.
- ///
- ///
- /// The size of the region of memory to be freed, in bytes. If the dwFreeType parameter is MEM_RELEASE, this parameter
- /// must be 0 (zero). The function frees the entire region that is reserved in the initial allocation call to VirtualAlloc.
- /// If the dwFreeType parameter is MEM_DECOMMIT, the function decommits all memory pages that contain one or more bytes
- /// in the range from the lpAddress parameter to (lpAddress+dwSize). This means, for example, that a 2-byte region of
- /// memory that straddles a page boundary causes both pages to be decommitted.If lpAddress is the base address returned
- /// by VirtualAlloc and dwSize is 0 (zero), the function decommits the entire region that is allocated by VirtualAlloc.
- /// After that, the entire region is in the reserved state.
- ///
- ///
- /// The type of free operation. This parameter must be one of the MEM_* enum values.
- ///
- ///
- /// If the function succeeds, the return value is a nonzero value. If the function fails, the return value is 0 (zero).
- /// To get extended error information, call GetLastError.
- ///
- [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
- public static extern bool VirtualFree(
- IntPtr lpAddress,
- UIntPtr dwSize,
- AllocationType dwFreeType);
-
- ///
- /// See https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualprotect.
- /// Changes the protection on a region of committed pages in the virtual address space of the calling process.
- ///
- ///
- /// The address of the starting page of the region of pages whose access protection attributes are to be changed. All
- /// pages in the specified region must be within the same reserved region allocated when calling the VirtualAlloc or
- /// VirtualAllocEx function using MEM_RESERVE. The pages cannot span adjacent reserved regions that were allocated by
- /// separate calls to VirtualAlloc or VirtualAllocEx using MEM_RESERVE.
- ///
- ///
- /// The size of the region whose access protection attributes are to be changed, in bytes. The region of affected pages
- /// includes all pages containing one or more bytes in the range from the lpAddress parameter to (lpAddress+dwSize).
- /// This means that a 2-byte range straddling a page boundary causes the protection attributes of both pages to be changed.
- ///
- ///
- /// The memory protection option. This parameter can be one of the memory protection constants. For mapped views, this
- /// value must be compatible with the access protection specified when the view was mapped (see MapViewOfFile,
- /// MapViewOfFileEx, and MapViewOfFileExNuma).
- ///
- ///
- /// A pointer to a variable that receives the previous access protection value of the first page in the specified region
- /// of pages. If this parameter is NULL or does not point to a valid variable, the function fails.
- ///
- ///
- /// If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.
- /// To get extended error information, call GetLastError.
- ///
- [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
- public static extern bool VirtualProtect(
- IntPtr lpAddress,
- UIntPtr dwSize,
- MemoryProtection flNewProtection,
- out MemoryProtection lpflOldProtect);
-
- ///
- [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
- public static extern bool VirtualProtect(
- IntPtr lpAddress,
- UIntPtr dwSize,
- Memory.MemoryProtection flNewProtection,
- out Memory.MemoryProtection lpflOldProtect);
-
///
/// Writes data to an area of memory in a specified process. The entire area to be written to must be accessible or
/// the operation fails.
@@ -1909,7 +1456,7 @@ internal static partial class NativeFunctions
/// extended error information, call GetLastError.The function fails if the requested write operation crosses into an
/// area of the process that is inaccessible.
///
- [DllImport("kernel32.dll", SetLastError = true)]
+ [DllImport("kernel32.dll")]
public static extern bool WriteProcessMemory(
IntPtr hProcess,
IntPtr lpBaseAddress,
@@ -1988,7 +1535,7 @@ internal static partial class NativeFunctions
/// If this value is , enumerates the loaded modules for the process and effectively calls the SymLoadModule64 function for each module.
///
/// Whether or not the function succeeded.
- [DllImport("dbghelp.dll", SetLastError = true, CharSet = CharSet.Auto)]
+ [DllImport("dbghelp.dll", CharSet = CharSet.Auto)]
public static extern bool SymInitialize(IntPtr hProcess, string userSearchPath, bool fInvadeProcess);
///
@@ -1996,7 +1543,7 @@ internal static partial class NativeFunctions
///
/// A handle to the process that was originally passed to the function.
/// Whether or not the function succeeded.
- [DllImport("dbghelp.dll", SetLastError = true, CharSet = CharSet.Auto)]
+ [DllImport("dbghelp.dll", CharSet = CharSet.Auto)]
public static extern bool SymCleanup(IntPtr hProcess);
///
@@ -2043,7 +1590,7 @@ internal static partial class NativeFunctions
/// Name of class.
/// Name of window.
/// Found window, or null.
- [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
+ [DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindowEx(
IntPtr parentHandle,
IntPtr childAfter,
diff --git a/Dalamud/NativeMethods.json b/Dalamud/NativeMethods.json
new file mode 100644
index 000000000..6001e3abc
--- /dev/null
+++ b/Dalamud/NativeMethods.json
@@ -0,0 +1,5 @@
+{
+ "$schema": "https://aka.ms/CsWin32.schema.json",
+ "allowMarshaling": false,
+ "public": true
+}
diff --git a/Dalamud/NativeMethods.txt b/Dalamud/NativeMethods.txt
index d9d05e472..d0d8e3dc0 100644
--- a/Dalamud/NativeMethods.txt
+++ b/Dalamud/NativeMethods.txt
@@ -21,3 +21,15 @@ GlobalAlloc
GlobalLock
GlobalUnlock
GLOBAL_ALLOC_FLAGS
+
+MEM_ALLOCATION_TYPE
+VirtualAlloc
+VirtualProtect
+VirtualFree
+
+ReadProcessMemory
+WriteProcessMemory
+
+GetCurrentProcess
+
+MessageBoxW
diff --git a/Dalamud/Plugin/Internal/AutoUpdate/AutoUpdateManager.cs b/Dalamud/Plugin/Internal/AutoUpdate/AutoUpdateManager.cs
index ce135b947..d19af5efa 100644
--- a/Dalamud/Plugin/Internal/AutoUpdate/AutoUpdateManager.cs
+++ b/Dalamud/Plugin/Internal/AutoUpdate/AutoUpdateManager.cs
@@ -24,7 +24,7 @@ using Dalamud.Logging.Internal;
using Dalamud.Plugin.Internal.Types;
using Dalamud.Plugin.Services;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Plugin.Internal.AutoUpdate;
diff --git a/Dalamud/Plugin/Services/IGamepadState.cs b/Dalamud/Plugin/Services/IGamepadState.cs
index c349923f3..e7d57df0b 100644
--- a/Dalamud/Plugin/Services/IGamepadState.cs
+++ b/Dalamud/Plugin/Services/IGamepadState.cs
@@ -1,7 +1,7 @@
using System.Numerics;
using Dalamud.Game.ClientState.GamePad;
-using ImGuiNET;
+using Dalamud.Bindings.ImGui;
namespace Dalamud.Plugin.Services;
@@ -16,12 +16,12 @@ public interface IGamepadState
/// Gets the pointer to the current instance of the GamepadInput struct.
///
public nint GamepadInputAddress { get; }
-
+
///
/// Gets the left analogue sticks tilt vector.
///
public Vector2 LeftStick { get; }
-
+
///
/// Gets the right analogue sticks tilt vector.
///
diff --git a/Dalamud/SafeMemory.cs b/Dalamud/SafeMemory.cs
index 3365ff118..61f3cf82b 100644
--- a/Dalamud/SafeMemory.cs
+++ b/Dalamud/SafeMemory.cs
@@ -12,11 +12,11 @@ namespace Dalamud;
///
public static class SafeMemory
{
- private static readonly IntPtr Handle;
+ private static readonly SafeHandle Handle;
static SafeMemory()
{
- Handle = Imports.GetCurrentProcess();
+ Handle = Windows.Win32.PInvoke.GetCurrentProcess_SafeHandle();
}
///
@@ -26,10 +26,24 @@ public static class SafeMemory
/// The amount of bytes to read.
/// The result buffer.
/// Whether or not the read succeeded.
- public static bool ReadBytes(IntPtr address, int count, out byte[] buffer)
+ public static unsafe bool ReadBytes(IntPtr address, int count, out byte[] buffer)
{
buffer = new byte[count <= 0 ? 0 : count];
- return Imports.ReadProcessMemory(Handle, address, buffer, buffer.Length, out _);
+ fixed (byte* p = buffer)
+ {
+ UIntPtr bytesRead;
+ if (!Windows.Win32.PInvoke.ReadProcessMemory(
+ Handle,
+ address.ToPointer(),
+ p,
+ new UIntPtr((uint)count),
+ &bytesRead))
+ {
+ return false;
+ }
+ }
+
+ return true;
}
///
@@ -38,9 +52,26 @@ public static class SafeMemory
/// The address to write to.
/// The buffer to write.
/// Whether or not the write succeeded.
- public static bool WriteBytes(IntPtr address, byte[] buffer)
+ public static unsafe bool WriteBytes(IntPtr address, byte[] buffer)
{
- return Imports.WriteProcessMemory(Handle, address, buffer, buffer.Length, out _);
+ if (buffer.Length == 0)
+ return true;
+
+ UIntPtr bytesWritten;
+ fixed (byte* p = buffer)
+ {
+ if (!Windows.Win32.PInvoke.WriteProcessMemory(
+ Handle,
+ address.ToPointer(),
+ p,
+ new UIntPtr((uint)buffer.Length),
+ &bytesWritten))
+ {
+ return false;
+ }
+ }
+
+ return true;
}
///
@@ -240,18 +271,6 @@ public static class SafeMemory
}
}
- private static class Imports
- {
- [DllImport("kernel32", SetLastError = true)]
- public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out] byte[] lpBuffer, int nSize, out int lpNumberOfBytesRead);
-
- [DllImport("kernel32", SetLastError = true)]
- public static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, int nSize, out int lpNumberOfBytesWritten);
-
- [DllImport("kernel32", SetLastError = false)]
- public static extern IntPtr GetCurrentProcess();
- }
-
private sealed class LocalMemory : IDisposable
{
private readonly int size;
diff --git a/Dalamud/Utility/DiagnosticUtil.cs b/Dalamud/Utility/DiagnosticUtil.cs
index 9c9718c4e..155d5cda7 100644
--- a/Dalamud/Utility/DiagnosticUtil.cs
+++ b/Dalamud/Utility/DiagnosticUtil.cs
@@ -1,6 +1,8 @@
using System.Diagnostics;
using System.Linq;
+using Dalamud.Bindings.ImGui;
+
namespace Dalamud.Utility;
///
@@ -10,7 +12,6 @@ public static class DiagnosticUtil
{
private static readonly string[] IgnoredNamespaces = [
nameof(System),
- nameof(ImGuiNET.ImGuiNative)
];
///
diff --git a/Dalamud/Utility/TypeExtensions.cs b/Dalamud/Utility/TypeExtensions.cs
new file mode 100644
index 000000000..10ae049d4
--- /dev/null
+++ b/Dalamud/Utility/TypeExtensions.cs
@@ -0,0 +1,165 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Text.RegularExpressions;
+
+using InteropGenerator.Runtime;
+using InteropGenerator.Runtime.Attributes;
+// ReSharper disable LoopCanBeConvertedToQuery
+// Linq can be a performance hit in most cases
+namespace Dalamud.Utility;
+
+public static partial class TypeExtensions {
+ private static readonly BindingFlags BindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
+
+ [GeneratedRegex(@"^`[1-9]\+Node", RegexOptions.Compiled)]
+ public static partial Regex StdNodeRegex();
+
+ public static bool IsFixedBuffer(this Type type) {
+ return type.Name.EndsWith("e__FixedBuffer");
+ }
+
+ public static bool IsStruct(this Type type) {
+ return type != typeof(decimal) && type is { IsValueType: true, IsPrimitive: false, IsEnum: false };
+ }
+
+ public static bool IsBaseType(this Type type) {
+ while (true) {
+ if (type.IsPointer) {
+ type = type.GetElementType()!;
+ continue;
+ }
+ return type == typeof(void) || type == typeof(bool) || type == typeof(char) ||
+ type == typeof(sbyte) || type == typeof(byte) || type == typeof(short) ||
+ type == typeof(ushort) || type == typeof(int) || type == typeof(uint) ||
+ type == typeof(long) || type == typeof(ulong) || type == typeof(float) ||
+ type == typeof(double) || type == typeof(decimal) || type == typeof(nint) ||
+ type == typeof(nuint) || type == typeof(Half) || type == typeof(CStringPointer);
+ }
+ }
+
+ public static Type[] GetInheritsTypes(this Type type) {
+ const string inheritsAttribute = "InheritsAttribute`1";
+ Type[] inheritances = [];
+ foreach (var attr in type.GetCustomAttributes()) {
+ if (attr.GetType().Name.Contains(inheritsAttribute)) {
+ inheritances = [.. inheritances, attr.GetType().GetGenericArguments()[0]];
+ }
+ }
+ return inheritances;
+ }
+
+ public static bool IsInheritance(this Type type, FieldInfo field) {
+ var inheritances = type.GetInheritsTypes();
+ if (inheritances.Length == 0) return false;
+ foreach (var inheritance in inheritances) {
+ if (inheritance.IsFieldInType(field)) return true;
+ if (IsInheritance(inheritance, field)) return true;
+ }
+ return false;
+ }
+
+ public static bool IsFieldInType(this Type type, FieldInfo field) {
+ var nameStrings = field.Name.Split('_');
+ var index = Array.IndexOf(nameStrings, type.Name);
+ if (index <= 0) return type.GetFields(BindingFlags).Any(f => f.Name == field.Name && f.FieldType == field.FieldType);
+ var name = string.Join("_", nameStrings[(index + 1)..]);
+ return type.GetFields(BindingFlags).Any(f => f.Name == name && f.FieldType == field.FieldType) || type.GetFields(BindingFlags).Any(f => f.Name == field.Name && f.FieldType == field.FieldType);
+ }
+
+ public static bool IsDirectBase(this FieldInfo field) {
+ var bases = field.DeclaringType?.GetInheritsTypes() ?? [];
+ return bases.Any(b => field.FieldType == b && field.Name == (b.Name == field.DeclaringType?.Name ? b.Name + "Base" : b.Name));
+ }
+
+ public static int SizeOf(this Type type) {
+ return type switch {
+ _ when type == typeof(sbyte) || type == typeof(byte) || type == typeof(bool) => 1,
+ _ when type == typeof(char) || type == typeof(short) || type == typeof(ushort) || type == typeof(Half) => 2,
+ _ when type == typeof(int) || type == typeof(uint) || type == typeof(float) => 4,
+ _ when type == typeof(long) || type == typeof(ulong) || type == typeof(double) || type.IsPointer || type.IsFunctionPointer || type.IsUnmanagedFunctionPointer || type == typeof(CStringPointer) => 8,
+ _ when type.Name.StartsWith("FixedSizeArray") => type.GetGenericArguments()[0].SizeOf() * int.Parse(type.Name[14..type.Name.IndexOf('`')]),
+ _ when type.GetCustomAttribute() is { Length: var length } => type.GetGenericArguments()[0].SizeOf() * length,
+ _ when type.IsStruct() && !type.IsGenericType && (type.StructLayoutAttribute?.Value ?? LayoutKind.Sequential) != LayoutKind.Sequential => type.StructLayoutAttribute?.Size ?? (int?)typeof(Unsafe).GetMethod("SizeOf")?.MakeGenericMethod(type).Invoke(null, null) ?? 0,
+ _ when type.IsEnum => Enum.GetUnderlyingType(type).SizeOf(),
+ _ when type.IsGenericType => Marshal.SizeOf(Activator.CreateInstance(type)!),
+ _ => GetSizeOf(type)
+ };
+ }
+
+ private static int GetSizeOf(this Type type) {
+ try {
+ return Marshal.SizeOf(Activator.CreateInstance(type)!);
+ } catch {
+ return 0;
+ }
+ }
+
+ public static string GetNamespace(this Type type) {
+ var ns = type.Namespace!;
+ var offset = ns.IndexOf('.', ns.IndexOf('.') + 1) + 1;
+ return offset == 0 ? "" : ns[offset..];
+ }
+
+ public static string GetFullname(this Type type) {
+ return type.Namespace + "." + type.Name;
+ }
+
+ public static Type GetPointerType(this Type type) {
+ while (type.IsPointer()) {
+ if (type.IsPointer) type = type.GetElementType()!;
+ else if (type.IsFunctionPointer) type = type.GetFunctionPointerReturnType();
+ else if (type.IsUnmanagedFunctionPointer) type = type.GetFunctionPointerReturnType();
+ }
+ return type;
+ }
+
+ public static bool IsPointer(this Type type) {
+ return type.IsPointer || type.IsFunctionPointer || type.IsUnmanagedFunctionPointer;
+ }
+
+ public static int PackSize(this Type type) {
+ if (type.GetCustomAttribute() != null) return 1; // FixedSizeArrayAttribute is always packed to 1 as the generated struct gets generated with Pack = 1
+ if (!type.IsStruct()) return type.SizeOf();
+ var pack = type.StructLayoutAttribute?.Pack ?? 8;
+ if (pack == 0) pack = 8;
+ var fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
+ return fields.Max(t => Math.Min(pack, t.FieldType.PackSize()));
+ }
+}
+
+public static class FieldInfoExtensions {
+ public static int GetFieldOffset(this FieldInfo info) {
+ var attrs = info.GetCustomAttributes(typeof(FieldOffsetAttribute), false);
+ return attrs.Length != 0 ? attrs.Cast().Single().Value : GetFieldOffsetSequential(info);
+ }
+
+ public static int GetFieldOffsetSequential(this FieldInfo info) {
+ if (info.DeclaringType is not { } declaring)
+ throw new Exception($"Unable to access declaring type of field {info.Name}");
+ var pack = declaring.StructLayoutAttribute?.Pack ?? 0; // Default to 0 if no pack is specified
+ var fields = declaring.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
+ var offset = 0;
+ foreach (var field in fields) {
+ if (pack != 0) {
+ var actualPack = Math.Min(pack, field.FieldType.PackSize());
+ offset = (offset + actualPack - 1) / actualPack * actualPack;
+ }
+ if (field == info) {
+ return offset;
+ }
+ offset += field.FieldType.SizeOf();
+ }
+ throw new Exception("Field not found");
+ }
+}
+public static class Extensions {
+ public static void WriteFile(this FileInfo file, string content) {
+ using var stream = file.CreateText();
+ stream.Write(content);
+ }
+}
diff --git a/Dalamud/Utility/Util.cs b/Dalamud/Utility/Util.cs
index 966fa1e11..e893cc8b9 100644
--- a/Dalamud/Utility/Util.cs
+++ b/Dalamud/Utility/Util.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
@@ -20,16 +19,18 @@ using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Support;
-using ImGuiNET;
using Lumina.Excel.Sheets;
using Serilog;
using TerraFX.Interop.Windows;
-using Windows.Win32.Storage.FileSystem;
using Windows.Win32.System.Memory;
using Windows.Win32.System.Ole;
+using Windows.Win32.UI.WindowsAndMessaging;
+
+using Dalamud.Bindings.ImGui;
using static TerraFX.Interop.Windows.Windows;
+using HWND = Windows.Win32.Foundation.HWND;
using Win32_PInvoke = Windows.Win32.PInvoke;
namespace Dalamud.Utility;
@@ -402,9 +403,9 @@ public static class Util
/// Specify whether to exit immediately.
public static void Fatal(string message, string caption, bool exit = true)
{
- var flags = NativeFunctions.MessageBoxType.Ok | NativeFunctions.MessageBoxType.IconError |
- NativeFunctions.MessageBoxType.Topmost;
- _ = NativeFunctions.MessageBoxW(Process.GetCurrentProcess().MainWindowHandle, message, caption, flags);
+ var flags = MESSAGEBOX_STYLE.MB_OK | MESSAGEBOX_STYLE.MB_ICONERROR |
+ MESSAGEBOX_STYLE.MB_TOPMOST;
+ _ = Windows.Win32.PInvoke.MessageBox(new HWND(Process.GetCurrentProcess().MainWindowHandle), message, caption, flags);
if (exit)
{
diff --git a/external/cimgui/cimgui.vcxproj b/external/cimgui/cimgui.vcxproj
index 55e737595..cdb2fa7ab 100644
--- a/external/cimgui/cimgui.vcxproj
+++ b/external/cimgui/cimgui.vcxproj
@@ -21,6 +21,8 @@
+
+
17.0
diff --git a/generate_imgui_bindings.ps1 b/generate_imgui_bindings.ps1
new file mode 100644
index 000000000..782657023
--- /dev/null
+++ b/generate_imgui_bindings.ps1
@@ -0,0 +1,73 @@
+# Store initial directory
+$initialDirectory = Get-Location
+
+# CD to the directory of this script
+Set-Location -Path $PSScriptRoot
+
+# Copy cimgui files from the cimgui repository to Hexa.NET.ImGui
+Copy-Item -Path "lib/cimgui/cimgui.h" -Destination "lib/Hexa.NET.ImGui/Generator/cimgui" -Force
+Copy-Item -Path "lib/cimgui/generator/output/definitions.json" -Destination "lib/Hexa.NET.ImGui/Generator/cimgui" -Force
+
+# Copy cimplot.h and cimguizmo.h
+Copy-Item -Path "lib/cimplot/cimplot.h" -Destination "lib/Hexa.NET.ImGui/Generator/cimplot" -Force
+Copy-Item -Path "lib/cimplot/generator/output/definitions.json" -Destination "lib/Hexa.NET.ImGui/Generator/cimplot" -Force
+
+Copy-Item -Path "lib/cimguizmo/cimguizmo.h" -Destination "lib/Hexa.NET.ImGui/Generator/cimguizmo" -Force
+Copy-Item -Path "lib/cimguizmo/generator/output/definitions.json" -Destination "lib/Hexa.NET.ImGui/Generator/cimguizmo" -Force
+
+
+# Find the first `#ifdef CIMGUI_DEFINE_ENUMS_AND_STRUCTS` in cimgui.h and insert `#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS` before it
+function InsertDefine {
+ param (
+ [string]$filePath
+ )
+
+ $lines = Get-Content $filePath
+ $inserted = $false
+
+ foreach ($line in $lines) {
+ if ($line -match "#ifdef CIMGUI_DEFINE_ENUMS_AND_STRUCTS") {
+ $index = [Array]::IndexOf($lines, $line)
+ if ($index -gt 0 -and $lines[$index - 1] -ne "#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS") {
+ $lines = $lines[0..($index - 1)] + "#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS" + "`r`n" + $lines[$index..($lines.Length - 1)]
+ $inserted = $true
+ }
+ break
+ }
+ }
+
+ if (-not $inserted) {
+ Write-Host "CIMGUI_DEFINE_ENUMS_AND_STRUCTS not found in $filePath. Exiting."
+ exit 1
+ }
+
+ # Write the modified lines back to the file
+ Set-Content -Path $filePath -Value $lines
+}
+
+# Insert the define line into all relevant header files
+InsertDefine -filePath "lib/Hexa.NET.ImGui/Generator/cimgui/cimgui.h"
+InsertDefine -filePath "lib/Hexa.NET.ImGui/Generator/cimplot/cimplot.h"
+InsertDefine -filePath "lib/Hexa.NET.ImGui/Generator/cimguizmo/cimguizmo.h"
+
+# Copy modified cimgui.h to cimplot and cimguizmo directories
+Copy-Item -Path "lib/Hexa.NET.ImGui/Generator/cimgui/cimgui.h" -Destination "lib/Hexa.NET.ImGui/Generator/cimplot/cimgui.h" -Force
+Copy-Item -Path "lib/Hexa.NET.ImGui/Generator/cimgui/cimgui.h" -Destination "lib/Hexa.NET.ImGui/Generator/cimguizmo/cimgui.h" -Force
+
+
+Set-Location -Path "lib/Hexa.NET.ImGui"
+#dotnet workload restore
+#dotnet restore
+
+# CD to generator directory
+Set-Location -Path "Generator"
+
+# Build generator
+dotnet build
+
+# Run generator
+Set-Location -Path "bin/Debug/net9.0"
+.\Generator.exe
+
+# Restore initial directory
+Set-Location -Path $initialDirectory
\ No newline at end of file
diff --git a/imgui/Dalamud.ImGui/Dalamud.ImGui.csproj b/imgui/Dalamud.ImGui/Dalamud.ImGui.csproj
new file mode 100644
index 000000000..9b1084ef0
--- /dev/null
+++ b/imgui/Dalamud.ImGui/Dalamud.ImGui.csproj
@@ -0,0 +1,15 @@
+
+
+
+ enable
+ enable
+ true
+
+ true
+
+
+
+
+
+
+
diff --git a/imgui/Dalamud.ImGui/ImGui.cs b/imgui/Dalamud.ImGui/ImGui.cs
new file mode 100644
index 000000000..460535cb1
--- /dev/null
+++ b/imgui/Dalamud.ImGui/ImGui.cs
@@ -0,0 +1,37 @@
+#nullable disable
+
+using System.Reflection;
+
+namespace Dalamud.Bindings.ImGui
+{
+ using HexaGen.Runtime;
+ using System.Diagnostics;
+
+ public static class ImGuiConfig
+ {
+ public static bool AotStaticLink;
+ }
+
+ public static unsafe partial class ImGui
+ {
+ static ImGui()
+ {
+ if (ImGuiConfig.AotStaticLink)
+ {
+ InitApi(new NativeLibraryContext(Process.GetCurrentProcess().MainModule!.BaseAddress));
+ }
+ else
+ {
+ //InitApi(new NativeLibraryContext(LibraryLoader.LoadLibrary(GetLibraryName, null)));
+ InitApi(new NativeLibraryContext(Path.Combine(Path.GetDirectoryName(Assembly.GetCallingAssembly().Location)!, GetLibraryName() + ".dll")));
+ }
+ }
+
+ public static string GetLibraryName()
+ {
+ return "cimgui";
+ }
+
+ public const nint ImDrawCallbackResetRenderState = -8;
+ }
+}
diff --git a/imgui/Dalamud.ImGui/ImGuiP.cs b/imgui/Dalamud.ImGui/ImGuiP.cs
new file mode 100644
index 000000000..57a243397
--- /dev/null
+++ b/imgui/Dalamud.ImGui/ImGuiP.cs
@@ -0,0 +1,16 @@
+#nullable disable
+
+namespace Dalamud.Bindings.ImGui
+{
+ using HexaGen.Runtime;
+
+ public static unsafe partial class ImGuiP
+ {
+ internal static FunctionTable funcTable;
+
+ static ImGuiP()
+ {
+ funcTable = ImGui.funcTable;
+ }
+ }
+}
diff --git a/imgui/Dalamud.ImGui/ImTextureID.cs b/imgui/Dalamud.ImGui/ImTextureID.cs
new file mode 100644
index 000000000..53643ab9f
--- /dev/null
+++ b/imgui/Dalamud.ImGui/ImTextureID.cs
@@ -0,0 +1,48 @@
+// ------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// ------------------------------------------------------------------------------
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using HexaGen.Runtime;
+using System.Numerics;
+
+namespace Dalamud.Bindings.ImGui
+{
+ ///
+ /// To be documented.
+ ///
+ #if NET5_0_OR_GREATER
+ [DebuggerDisplay("{DebuggerDisplay,nq}")]
+ #endif
+ public readonly unsafe partial struct ImTextureID : IEquatable
+ {
+ public ImTextureID(ulong handle) { Handle = handle; }
+ public ImTextureID(nint handle) { Handle = (ulong)handle; }
+ public ImTextureID(void* handle) { Handle = (ulong)handle; }
+ public ulong Handle { get; }
+ public bool IsNull => Handle == 0;
+ public static ImTextureID Null => new ImTextureID(0);
+ public static implicit operator ImTextureID(ulong handle) => new ImTextureID(handle);
+ public static bool operator ==(ImTextureID left, ImTextureID right) => left.Handle == right.Handle;
+ public static bool operator !=(ImTextureID left, ImTextureID right) => left.Handle != right.Handle;
+ public static bool operator ==(ImTextureID left, nint right) => left.Handle == (ulong)right;
+ public static bool operator !=(ImTextureID left, nint right) => left.Handle != (ulong)right;
+ public static bool operator ==(ImTextureID left, ulong right) => left.Handle == right;
+ public static bool operator !=(ImTextureID left, ulong right) => left.Handle != right;
+ public bool Equals(ImTextureID other) => Handle == other.Handle;
+ ///
+ public override bool Equals(object obj) => obj is ImTextureID handle && Equals(handle);
+ ///
+ public override int GetHashCode() => Handle.GetHashCode();
+ #if NET5_0_OR_GREATER
+ private string DebuggerDisplay => string.Format("ImTextureID [0x{0}]", Handle.ToString("X"));
+ #endif
+ }
+}
diff --git a/imgui/Dalamud.ImGui/ImVector.cs b/imgui/Dalamud.ImGui/ImVector.cs
new file mode 100644
index 000000000..7772871e8
--- /dev/null
+++ b/imgui/Dalamud.ImGui/ImVector.cs
@@ -0,0 +1,238 @@
+using System.Runtime.CompilerServices;
+
+namespace Dalamud.Bindings.ImGui
+{
+ public unsafe struct ImVector
+ {
+ public readonly int Size;
+ public readonly int Capacity;
+ public readonly void* Data;
+
+ public ImVector(int size, int capacity, void* data)
+ {
+ Size = size;
+ Capacity = capacity;
+ Data = data;
+ }
+
+ public ref T Ref(int index)
+ {
+ return ref Unsafe.AsRef((byte*)Data + index * Unsafe.SizeOf());
+ }
+
+ public IntPtr Address(int index)
+ {
+ return (IntPtr)((byte*)Data + index * Unsafe.SizeOf());
+ }
+ }
+
+ ///
+ /// A structure representing a dynamic array for unmanaged types.
+ ///
+ /// The type of elements in the vector, must be unmanaged.
+ public unsafe struct ImVector where T : unmanaged
+ {
+ ///
+ /// Initializes a new instance of the struct with the specified size, capacity, and data pointer.
+ ///
+ /// The initial size of the vector.
+ /// The initial capacity of the vector.
+ /// Pointer to the initial data.
+ public ImVector(int size, int capacity, T* data)
+ {
+ this.size = size;
+ this.capacity = capacity;
+ this.data = data;
+ }
+
+ private int size;
+ private int capacity;
+ private unsafe T* data;
+
+
+ ///
+ /// Gets or sets the element at the specified index.
+ ///
+ /// The zero-based index of the element to get or set.
+ /// The element at the specified index.
+ /// Thrown when the index is out of range.
+ public T this[int index]
+ {
+ get
+ {
+ if (index < 0 || index >= size)
+ {
+ throw new IndexOutOfRangeException();
+ }
+ return data[index];
+ }
+ set
+ {
+ if (index < 0 || index >= size)
+ {
+ throw new IndexOutOfRangeException();
+ }
+ data[index] = value;
+ }
+ }
+
+ ///
+ /// Gets a pointer to the first element of the vector.
+ ///
+ public readonly T* Data => data;
+
+ ///
+ /// Gets a pointer to the first element of the vector.
+ ///
+ public readonly T* Front => data;
+
+ ///
+ /// Gets a pointer to the last element of the vector.
+ ///
+ public readonly T* Back => size > 0 ? data + size - 1 : null;
+
+ ///
+ /// Gets or sets the capacity of the vector.
+ ///
+ public int Capacity
+ {
+ readonly get => capacity;
+ set
+ {
+ if (capacity == value)
+ {
+ return;
+ }
+
+ if (data == null)
+ {
+ data = (T*)ImGui.MemAlloc((nuint)(value * sizeof(T)));
+ }
+ else
+ {
+ int newSize = Math.Min(size, value);
+ T* newData = (T*)ImGui.MemAlloc((nuint)(value * sizeof(T)));
+ Buffer.MemoryCopy(data, newData, (nuint)(value * sizeof(T)), (nuint)(newSize * sizeof(T)));
+ ImGui.MemFree(data);
+ data = newData;
+ size = newSize;
+ }
+
+ capacity = value;
+
+ // Clear the rest of the data
+ for (int i = size; i < capacity; i++)
+ {
+ data[i] = default;
+ }
+ }
+ }
+
+ ///
+ /// Gets the number of elements in the vector.
+ ///
+ public readonly int Size => size;
+
+ ///
+ /// Grows the capacity of the vector to at least the specified value.
+ ///
+ /// The new capacity.
+ public void Grow(int newCapacity)
+ {
+ if (newCapacity > capacity)
+ {
+ Capacity = newCapacity * 2;
+ }
+ }
+
+ ///
+ /// Ensures that the vector has at least the specified capacity.
+ ///
+ /// The minimum capacity required.
+ public void EnsureCapacity(int size)
+ {
+ if (size > capacity)
+ {
+ Grow(size);
+ }
+ }
+
+ ///
+ /// Resizes the vector to the specified size.
+ ///
+ /// The new size of the vector.
+ public void Resize(int newSize)
+ {
+ EnsureCapacity(newSize);
+ size = newSize;
+ }
+
+ ///
+ /// Clears all elements from the vector.
+ ///
+ public void Clear()
+ {
+ size = 0;
+ }
+
+ ///
+ /// Adds an element to the end of the vector.
+ ///
+ /// The value to add.
+ public void PushBack(T value)
+ {
+ EnsureCapacity(size + 1);
+ data[size++] = value;
+ }
+
+ ///
+ /// Removes the last element from the vector.
+ ///
+ public void PopBack()
+ {
+ if (size > 0)
+ {
+ size--;
+ }
+ }
+
+ ///
+ /// Frees the memory allocated for the vector.
+ ///
+ public void Free()
+ {
+ if (data != null)
+ {
+ ImGui.MemFree(data);
+ data = null;
+ size = 0;
+ capacity = 0;
+ }
+ }
+
+ public ref T Ref(int index)
+ {
+ return ref Unsafe.AsRef((byte*)Data + index * Unsafe.SizeOf());
+ }
+
+ public ref TCast Ref(int index)
+ {
+ return ref Unsafe.AsRef((byte*)Data + index * Unsafe.SizeOf());
+ }
+
+ public void* Address(int index)
+ {
+ return (byte*)Data + index * Unsafe.SizeOf();
+ }
+
+ public void* Address(int index)
+ {
+ return (byte*)Data + index * Unsafe.SizeOf();
+ }
+
+ public ImVector* ToUntyped()
+ {
+ return (ImVector*)Unsafe.AsPointer(ref this);
+ }
+ }
+}
diff --git a/imgui/Dalamud.ImGui/Internals/Functions/Functions.000.cs b/imgui/Dalamud.ImGui/Internals/Functions/Functions.000.cs
new file mode 100644
index 000000000..5f58cec41
--- /dev/null
+++ b/imgui/Dalamud.ImGui/Internals/Functions/Functions.000.cs
@@ -0,0 +1,5047 @@
+// ------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// ------------------------------------------------------------------------------
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using HexaGen.Runtime;
+using System.Numerics;
+
+namespace Dalamud.Bindings.ImGui
+{
+ public unsafe partial class ImGuiP
+ {
+ ///
+ /// To be documented.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ internal static uint ImHashDataNative(void* data, ulong dataSize, uint seed)
+ {
+ #if NET5_0_OR_GREATER
+ return ((delegate* unmanaged[Cdecl])funcTable[691])(data, dataSize, seed);
+ #else
+ return (uint)((delegate* unmanaged[Cdecl])funcTable[691])((nint)data, dataSize, seed);
+ #endif
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashData(void* data, ulong dataSize, uint seed)
+ {
+ uint ret = ImHashDataNative(data, dataSize, seed);
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashData(void* data, ulong dataSize)
+ {
+ uint ret = ImHashDataNative(data, dataSize, (uint)(0));
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashData(void* data, nuint dataSize, uint seed)
+ {
+ uint ret = ImHashDataNative(data, dataSize, seed);
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashData(void* data, nuint dataSize)
+ {
+ uint ret = ImHashDataNative(data, dataSize, (uint)(0));
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ internal static uint ImHashStrNative(byte* data, ulong dataSize, uint seed)
+ {
+ #if NET5_0_OR_GREATER
+ return ((delegate* unmanaged[Cdecl])funcTable[692])(data, dataSize, seed);
+ #else
+ return (uint)((delegate* unmanaged[Cdecl])funcTable[692])((nint)data, dataSize, seed);
+ #endif
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(byte* data, ulong dataSize, uint seed)
+ {
+ uint ret = ImHashStrNative(data, dataSize, seed);
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(byte* data, ulong dataSize)
+ {
+ uint ret = ImHashStrNative(data, dataSize, (uint)(0));
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(byte* data)
+ {
+ uint ret = ImHashStrNative(data, (ulong)(0), (uint)(0));
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(byte* data, uint seed)
+ {
+ uint ret = ImHashStrNative(data, (ulong)(0), seed);
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(ref byte data, ulong dataSize, uint seed)
+ {
+ fixed (byte* pdata = &data)
+ {
+ uint ret = ImHashStrNative((byte*)pdata, dataSize, seed);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(ref byte data, ulong dataSize)
+ {
+ fixed (byte* pdata = &data)
+ {
+ uint ret = ImHashStrNative((byte*)pdata, dataSize, (uint)(0));
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(ref byte data)
+ {
+ fixed (byte* pdata = &data)
+ {
+ uint ret = ImHashStrNative((byte*)pdata, (ulong)(0), (uint)(0));
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(ref byte data, uint seed)
+ {
+ fixed (byte* pdata = &data)
+ {
+ uint ret = ImHashStrNative((byte*)pdata, (ulong)(0), seed);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(ReadOnlySpan data, ulong dataSize, uint seed)
+ {
+ fixed (byte* pdata = data)
+ {
+ uint ret = ImHashStrNative((byte*)pdata, dataSize, seed);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(ReadOnlySpan data, ulong dataSize)
+ {
+ fixed (byte* pdata = data)
+ {
+ uint ret = ImHashStrNative((byte*)pdata, dataSize, (uint)(0));
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(ReadOnlySpan data)
+ {
+ fixed (byte* pdata = data)
+ {
+ uint ret = ImHashStrNative((byte*)pdata, (ulong)(0), (uint)(0));
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(ReadOnlySpan data, uint seed)
+ {
+ fixed (byte* pdata = data)
+ {
+ uint ret = ImHashStrNative((byte*)pdata, (ulong)(0), seed);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(string data, ulong dataSize, uint seed)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (data != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(data);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(data, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ uint ret = ImHashStrNative(pStr0, dataSize, seed);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(string data, ulong dataSize)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (data != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(data);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(data, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ uint ret = ImHashStrNative(pStr0, dataSize, (uint)(0));
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(string data)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (data != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(data);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(data, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ uint ret = ImHashStrNative(pStr0, (ulong)(0), (uint)(0));
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(string data, uint seed)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (data != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(data);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(data, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ uint ret = ImHashStrNative(pStr0, (ulong)(0), seed);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(byte* data, nuint dataSize, uint seed)
+ {
+ uint ret = ImHashStrNative(data, dataSize, seed);
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(byte* data, nuint dataSize)
+ {
+ uint ret = ImHashStrNative(data, dataSize, (uint)(0));
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(ref byte data, nuint dataSize, uint seed)
+ {
+ fixed (byte* pdata = &data)
+ {
+ uint ret = ImHashStrNative((byte*)pdata, dataSize, seed);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(ref byte data, nuint dataSize)
+ {
+ fixed (byte* pdata = &data)
+ {
+ uint ret = ImHashStrNative((byte*)pdata, dataSize, (uint)(0));
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(ReadOnlySpan data, nuint dataSize, uint seed)
+ {
+ fixed (byte* pdata = data)
+ {
+ uint ret = ImHashStrNative((byte*)pdata, dataSize, seed);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(ReadOnlySpan data, nuint dataSize)
+ {
+ fixed (byte* pdata = data)
+ {
+ uint ret = ImHashStrNative((byte*)pdata, dataSize, (uint)(0));
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(string data, nuint dataSize, uint seed)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (data != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(data);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(data, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ uint ret = ImHashStrNative(pStr0, dataSize, seed);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImHashStr(string data, nuint dataSize)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (data != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(data);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(data, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ uint ret = ImHashStrNative(pStr0, dataSize, (uint)(0));
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ internal static void ImQsortNative(void* baseValue, ulong count, ulong sizeOfElement, delegate*, int> compareFunc)
+ {
+ #if NET5_0_OR_GREATER
+ ((delegate* unmanaged[Cdecl], int>, void>)funcTable[693])(baseValue, count, sizeOfElement, compareFunc);
+ #else
+ ((delegate* unmanaged[Cdecl])funcTable[693])((nint)baseValue, count, sizeOfElement, (nint)compareFunc);
+ #endif
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static void ImQsort(void* baseValue, ulong count, ulong sizeOfElement, delegate*, int> compareFunc)
+ {
+ ImQsortNative(baseValue, count, sizeOfElement, compareFunc);
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static void ImQsort(void* baseValue, nuint count, ulong sizeOfElement, delegate*, int> compareFunc)
+ {
+ ImQsortNative(baseValue, count, sizeOfElement, compareFunc);
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static void ImQsort(void* baseValue, ulong count, nuint sizeOfElement, delegate*, int> compareFunc)
+ {
+ ImQsortNative(baseValue, count, sizeOfElement, compareFunc);
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static void ImQsort(void* baseValue, nuint count, nuint sizeOfElement, delegate*, int> compareFunc)
+ {
+ ImQsortNative(baseValue, count, sizeOfElement, compareFunc);
+ }
+
+ ///
+ /// To be documented.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ internal static uint ImAlphaBlendColorsNative(uint colA, uint colB)
+ {
+ #if NET5_0_OR_GREATER
+ return ((delegate* unmanaged[Cdecl])funcTable[694])(colA, colB);
+ #else
+ return (uint)((delegate* unmanaged[Cdecl])funcTable[694])(colA, colB);
+ #endif
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static uint ImAlphaBlendColors(uint colA, uint colB)
+ {
+ uint ret = ImAlphaBlendColorsNative(colA, colB);
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ internal static byte ImIsPowerOfTwoNative(int v)
+ {
+ #if NET5_0_OR_GREATER
+ return ((delegate* unmanaged[Cdecl])funcTable[695])(v);
+ #else
+ return (byte)((delegate* unmanaged[Cdecl])funcTable[695])(v);
+ #endif
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static bool ImIsPowerOfTwo(int v)
+ {
+ byte ret = ImIsPowerOfTwoNative(v);
+ return ret != 0;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ internal static byte ImIsPowerOfTwoNative(ulong v)
+ {
+ #if NET5_0_OR_GREATER
+ return ((delegate* unmanaged[Cdecl])funcTable[696])(v);
+ #else
+ return (byte)((delegate* unmanaged[Cdecl])funcTable[696])(v);
+ #endif
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static bool ImIsPowerOfTwo(ulong v)
+ {
+ byte ret = ImIsPowerOfTwoNative(v);
+ return ret != 0;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ internal static int ImUpperPowerOfTwoNative(int v)
+ {
+ #if NET5_0_OR_GREATER
+ return ((delegate* unmanaged[Cdecl])funcTable[697])(v);
+ #else
+ return (int)((delegate* unmanaged[Cdecl])funcTable[697])(v);
+ #endif
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImUpperPowerOfTwo(int v)
+ {
+ int ret = ImUpperPowerOfTwoNative(v);
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ internal static int ImStricmpNative(byte* str1, byte* str2)
+ {
+ #if NET5_0_OR_GREATER
+ return ((delegate* unmanaged[Cdecl])funcTable[698])(str1, str2);
+ #else
+ return (int)((delegate* unmanaged[Cdecl])funcTable[698])((nint)str1, (nint)str2);
+ #endif
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(byte* str1, byte* str2)
+ {
+ int ret = ImStricmpNative(str1, str2);
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(ref byte str1, byte* str2)
+ {
+ fixed (byte* pstr1 = &str1)
+ {
+ int ret = ImStricmpNative((byte*)pstr1, str2);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(ReadOnlySpan str1, byte* str2)
+ {
+ fixed (byte* pstr1 = str1)
+ {
+ int ret = ImStricmpNative((byte*)pstr1, str2);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(string str1, byte* str2)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str1 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str1);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str1, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ int ret = ImStricmpNative(pStr0, str2);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(byte* str1, ref byte str2)
+ {
+ fixed (byte* pstr2 = &str2)
+ {
+ int ret = ImStricmpNative(str1, (byte*)pstr2);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(byte* str1, ReadOnlySpan str2)
+ {
+ fixed (byte* pstr2 = str2)
+ {
+ int ret = ImStricmpNative(str1, (byte*)pstr2);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(byte* str1, string str2)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str2 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str2);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str2, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ int ret = ImStricmpNative(str1, pStr0);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(ref byte str1, ref byte str2)
+ {
+ fixed (byte* pstr1 = &str1)
+ {
+ fixed (byte* pstr2 = &str2)
+ {
+ int ret = ImStricmpNative((byte*)pstr1, (byte*)pstr2);
+ return ret;
+ }
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(ReadOnlySpan str1, ReadOnlySpan str2)
+ {
+ fixed (byte* pstr1 = str1)
+ {
+ fixed (byte* pstr2 = str2)
+ {
+ int ret = ImStricmpNative((byte*)pstr1, (byte*)pstr2);
+ return ret;
+ }
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(string str1, string str2)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str1 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str1);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str1, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ byte* pStr1 = null;
+ int pStrSize1 = 0;
+ if (str2 != null)
+ {
+ pStrSize1 = Utils.GetByteCountUTF8(str2);
+ if (pStrSize1 >= Utils.MaxStackallocSize)
+ {
+ pStr1 = Utils.Alloc(pStrSize1 + 1);
+ }
+ else
+ {
+ byte* pStrStack1 = stackalloc byte[pStrSize1 + 1];
+ pStr1 = pStrStack1;
+ }
+ int pStrOffset1 = Utils.EncodeStringUTF8(str2, pStr1, pStrSize1);
+ pStr1[pStrOffset1] = 0;
+ }
+ int ret = ImStricmpNative(pStr0, pStr1);
+ if (pStrSize1 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr1);
+ }
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(ref byte str1, ReadOnlySpan str2)
+ {
+ fixed (byte* pstr1 = &str1)
+ {
+ fixed (byte* pstr2 = str2)
+ {
+ int ret = ImStricmpNative((byte*)pstr1, (byte*)pstr2);
+ return ret;
+ }
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(ref byte str1, string str2)
+ {
+ fixed (byte* pstr1 = &str1)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str2 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str2);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str2, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ int ret = ImStricmpNative((byte*)pstr1, pStr0);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(ReadOnlySpan str1, ref byte str2)
+ {
+ fixed (byte* pstr1 = str1)
+ {
+ fixed (byte* pstr2 = &str2)
+ {
+ int ret = ImStricmpNative((byte*)pstr1, (byte*)pstr2);
+ return ret;
+ }
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(ReadOnlySpan str1, string str2)
+ {
+ fixed (byte* pstr1 = str1)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str2 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str2);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str2, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ int ret = ImStricmpNative((byte*)pstr1, pStr0);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(string str1, ref byte str2)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str1 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str1);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str1, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ fixed (byte* pstr2 = &str2)
+ {
+ int ret = ImStricmpNative(pStr0, (byte*)pstr2);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStricmp(string str1, ReadOnlySpan str2)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str1 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str1);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str1, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ fixed (byte* pstr2 = str2)
+ {
+ int ret = ImStricmpNative(pStr0, (byte*)pstr2);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ internal static int ImStrnicmpNative(byte* str1, byte* str2, ulong count)
+ {
+ #if NET5_0_OR_GREATER
+ return ((delegate* unmanaged[Cdecl])funcTable[699])(str1, str2, count);
+ #else
+ return (int)((delegate* unmanaged[Cdecl])funcTable[699])((nint)str1, (nint)str2, count);
+ #endif
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(byte* str1, byte* str2, ulong count)
+ {
+ int ret = ImStrnicmpNative(str1, str2, count);
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ref byte str1, byte* str2, ulong count)
+ {
+ fixed (byte* pstr1 = &str1)
+ {
+ int ret = ImStrnicmpNative((byte*)pstr1, str2, count);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ReadOnlySpan str1, byte* str2, ulong count)
+ {
+ fixed (byte* pstr1 = str1)
+ {
+ int ret = ImStrnicmpNative((byte*)pstr1, str2, count);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(string str1, byte* str2, ulong count)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str1 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str1);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str1, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ int ret = ImStrnicmpNative(pStr0, str2, count);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(byte* str1, ref byte str2, ulong count)
+ {
+ fixed (byte* pstr2 = &str2)
+ {
+ int ret = ImStrnicmpNative(str1, (byte*)pstr2, count);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(byte* str1, ReadOnlySpan str2, ulong count)
+ {
+ fixed (byte* pstr2 = str2)
+ {
+ int ret = ImStrnicmpNative(str1, (byte*)pstr2, count);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(byte* str1, string str2, ulong count)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str2 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str2);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str2, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ int ret = ImStrnicmpNative(str1, pStr0, count);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ref byte str1, ref byte str2, ulong count)
+ {
+ fixed (byte* pstr1 = &str1)
+ {
+ fixed (byte* pstr2 = &str2)
+ {
+ int ret = ImStrnicmpNative((byte*)pstr1, (byte*)pstr2, count);
+ return ret;
+ }
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ReadOnlySpan str1, ReadOnlySpan str2, ulong count)
+ {
+ fixed (byte* pstr1 = str1)
+ {
+ fixed (byte* pstr2 = str2)
+ {
+ int ret = ImStrnicmpNative((byte*)pstr1, (byte*)pstr2, count);
+ return ret;
+ }
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(string str1, string str2, ulong count)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str1 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str1);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str1, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ byte* pStr1 = null;
+ int pStrSize1 = 0;
+ if (str2 != null)
+ {
+ pStrSize1 = Utils.GetByteCountUTF8(str2);
+ if (pStrSize1 >= Utils.MaxStackallocSize)
+ {
+ pStr1 = Utils.Alloc(pStrSize1 + 1);
+ }
+ else
+ {
+ byte* pStrStack1 = stackalloc byte[pStrSize1 + 1];
+ pStr1 = pStrStack1;
+ }
+ int pStrOffset1 = Utils.EncodeStringUTF8(str2, pStr1, pStrSize1);
+ pStr1[pStrOffset1] = 0;
+ }
+ int ret = ImStrnicmpNative(pStr0, pStr1, count);
+ if (pStrSize1 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr1);
+ }
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ref byte str1, ReadOnlySpan str2, ulong count)
+ {
+ fixed (byte* pstr1 = &str1)
+ {
+ fixed (byte* pstr2 = str2)
+ {
+ int ret = ImStrnicmpNative((byte*)pstr1, (byte*)pstr2, count);
+ return ret;
+ }
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ref byte str1, string str2, ulong count)
+ {
+ fixed (byte* pstr1 = &str1)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str2 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str2);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str2, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ int ret = ImStrnicmpNative((byte*)pstr1, pStr0, count);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ReadOnlySpan str1, ref byte str2, ulong count)
+ {
+ fixed (byte* pstr1 = str1)
+ {
+ fixed (byte* pstr2 = &str2)
+ {
+ int ret = ImStrnicmpNative((byte*)pstr1, (byte*)pstr2, count);
+ return ret;
+ }
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ReadOnlySpan str1, string str2, ulong count)
+ {
+ fixed (byte* pstr1 = str1)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str2 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str2);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str2, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ int ret = ImStrnicmpNative((byte*)pstr1, pStr0, count);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(string str1, ref byte str2, ulong count)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str1 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str1);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str1, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ fixed (byte* pstr2 = &str2)
+ {
+ int ret = ImStrnicmpNative(pStr0, (byte*)pstr2, count);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(string str1, ReadOnlySpan str2, ulong count)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str1 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str1);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str1, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ fixed (byte* pstr2 = str2)
+ {
+ int ret = ImStrnicmpNative(pStr0, (byte*)pstr2, count);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(byte* str1, byte* str2, nuint count)
+ {
+ int ret = ImStrnicmpNative(str1, str2, count);
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ref byte str1, byte* str2, nuint count)
+ {
+ fixed (byte* pstr1 = &str1)
+ {
+ int ret = ImStrnicmpNative((byte*)pstr1, str2, count);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ReadOnlySpan str1, byte* str2, nuint count)
+ {
+ fixed (byte* pstr1 = str1)
+ {
+ int ret = ImStrnicmpNative((byte*)pstr1, str2, count);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(string str1, byte* str2, nuint count)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str1 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str1);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str1, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ int ret = ImStrnicmpNative(pStr0, str2, count);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(byte* str1, ref byte str2, nuint count)
+ {
+ fixed (byte* pstr2 = &str2)
+ {
+ int ret = ImStrnicmpNative(str1, (byte*)pstr2, count);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(byte* str1, ReadOnlySpan str2, nuint count)
+ {
+ fixed (byte* pstr2 = str2)
+ {
+ int ret = ImStrnicmpNative(str1, (byte*)pstr2, count);
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(byte* str1, string str2, nuint count)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str2 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str2);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str2, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ int ret = ImStrnicmpNative(str1, pStr0, count);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ref byte str1, ref byte str2, nuint count)
+ {
+ fixed (byte* pstr1 = &str1)
+ {
+ fixed (byte* pstr2 = &str2)
+ {
+ int ret = ImStrnicmpNative((byte*)pstr1, (byte*)pstr2, count);
+ return ret;
+ }
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ReadOnlySpan str1, ReadOnlySpan str2, nuint count)
+ {
+ fixed (byte* pstr1 = str1)
+ {
+ fixed (byte* pstr2 = str2)
+ {
+ int ret = ImStrnicmpNative((byte*)pstr1, (byte*)pstr2, count);
+ return ret;
+ }
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(string str1, string str2, nuint count)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str1 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str1);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str1, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ byte* pStr1 = null;
+ int pStrSize1 = 0;
+ if (str2 != null)
+ {
+ pStrSize1 = Utils.GetByteCountUTF8(str2);
+ if (pStrSize1 >= Utils.MaxStackallocSize)
+ {
+ pStr1 = Utils.Alloc(pStrSize1 + 1);
+ }
+ else
+ {
+ byte* pStrStack1 = stackalloc byte[pStrSize1 + 1];
+ pStr1 = pStrStack1;
+ }
+ int pStrOffset1 = Utils.EncodeStringUTF8(str2, pStr1, pStrSize1);
+ pStr1[pStrOffset1] = 0;
+ }
+ int ret = ImStrnicmpNative(pStr0, pStr1, count);
+ if (pStrSize1 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr1);
+ }
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ref byte str1, ReadOnlySpan str2, nuint count)
+ {
+ fixed (byte* pstr1 = &str1)
+ {
+ fixed (byte* pstr2 = str2)
+ {
+ int ret = ImStrnicmpNative((byte*)pstr1, (byte*)pstr2, count);
+ return ret;
+ }
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ref byte str1, string str2, nuint count)
+ {
+ fixed (byte* pstr1 = &str1)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str2 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str2);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str2, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ int ret = ImStrnicmpNative((byte*)pstr1, pStr0, count);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ReadOnlySpan str1, ref byte str2, nuint count)
+ {
+ fixed (byte* pstr1 = str1)
+ {
+ fixed (byte* pstr2 = &str2)
+ {
+ int ret = ImStrnicmpNative((byte*)pstr1, (byte*)pstr2, count);
+ return ret;
+ }
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(ReadOnlySpan str1, string str2, nuint count)
+ {
+ fixed (byte* pstr1 = str1)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str2 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str2);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str2, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ int ret = ImStrnicmpNative((byte*)pstr1, pStr0, count);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(string str1, ref byte str2, nuint count)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str1 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str1);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str1, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ fixed (byte* pstr2 = &str2)
+ {
+ int ret = ImStrnicmpNative(pStr0, (byte*)pstr2, count);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+ }
+
+ ///
+ /// To be documented.
+ ///
+ public static int ImStrnicmp(string str1, ReadOnlySpan str2, nuint count)
+ {
+ byte* pStr0 = null;
+ int pStrSize0 = 0;
+ if (str1 != null)
+ {
+ pStrSize0 = Utils.GetByteCountUTF8(str1);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ pStr0 = Utils.Alloc(pStrSize0 + 1);
+ }
+ else
+ {
+ byte* pStrStack0 = stackalloc byte[pStrSize0 + 1];
+ pStr0 = pStrStack0;
+ }
+ int pStrOffset0 = Utils.EncodeStringUTF8(str1, pStr0, pStrSize0);
+ pStr0[pStrOffset0] = 0;
+ }
+ fixed (byte* pstr2 = str2)
+ {
+ int ret = ImStrnicmpNative(pStr0, (byte*)pstr2, count);
+ if (pStrSize0 >= Utils.MaxStackallocSize)
+ {
+ Utils.Free(pStr0);
+ }
+ return ret;
+ }
+ }
+
+ ///