diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs
index 6b55429b2..02a3c6542 100644
--- a/Dalamud/Dalamud.cs
+++ b/Dalamud/Dalamud.cs
@@ -84,7 +84,7 @@ namespace Dalamud {
this.WinSock2 = new WinSockHandlers();
- this.InterfaceManager = new InterfaceManager(this, this.sigScanner);
+ this.InterfaceManager = new InterfaceManager(this.sigScanner);
//this.InterfaceManager.Start();
try {
diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj
index f447ac7ac..79fe912dd 100644
--- a/Dalamud/Dalamud.csproj
+++ b/Dalamud/Dalamud.csproj
@@ -34,16 +34,8 @@
E:\Sapphire\recorder\FFXIV.Recorder\/bin\Dalamud.xml
-
-
-
- %(Filename)%(Extension)
- Always
- false
-
-
diff --git a/Dalamud/Interface/InterfaceManager.cs b/Dalamud/Interface/InterfaceManager.cs
index 50d0cf362..dfb589636 100644
--- a/Dalamud/Interface/InterfaceManager.cs
+++ b/Dalamud/Interface/InterfaceManager.cs
@@ -1,9 +1,7 @@
+//#define RENDERDOC_HACKS
+
using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
using Dalamud.Game;
using Dalamud.Game.Internal.DXGI;
using Dalamud.Hooking;
@@ -15,6 +13,20 @@ namespace Dalamud.Interface
{
public class InterfaceManager : IDisposable
{
+#if RENDERDOC_HACKS
+ [DllImport("user32.dll", SetLastError = true)]
+ static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
+
+ [DllImport("RDocHelper.dll")]
+ static extern IntPtr GetWrappedDevice(IntPtr window);
+
+ [DllImport("RDocHelper.dll")]
+ static extern void StartCapture(IntPtr device, IntPtr window);
+
+ [DllImport("RDocHelper.dll")]
+ static extern uint EndCapture();
+#endif
+
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
private delegate IntPtr PresentDelegate(IntPtr swapChain, uint syncInterval, uint presentFlags);
@@ -23,14 +35,10 @@ namespace Dalamud.Interface
private SwapChainAddressResolver Address { get; }
- //private Task _task;
- private RawDX11Scene _scene;
- private Dalamud _dalamud;
+ private RawDX11Scene scene;
- public InterfaceManager(Dalamud dalamud, SigScanner scanner)
+ public InterfaceManager(SigScanner scanner)
{
- this._dalamud = dalamud;
-
Address = new SwapChainAddressResolver();
Address.Setup(scanner);
@@ -56,53 +64,35 @@ namespace Dalamud.Interface
public void Dispose()
{
- this._scene.Dispose();
+ this.scene.Dispose();
+ // this will almost certainly crash or otherwise break
+ // we might be able to mitigate it by properly cleaning up in the detour first
+ // and essentially blocking until that completes... but I'm skeptical that would work either
this.presentHook.Dispose();
-
- //_task?.Wait();
- //_task = null;
}
- //public void Start()
- //{
- // if (_task == null || _task.IsCompleted || _task.IsFaulted || _task.IsCanceled)
- // {
- // _task = new Task(Display);
- // _task.Start();
- // }
- //}
-
- //private void Display()
- //{
- // using (var scene = SimpleImGuiScene.CreateOverlay(RendererFactory.RendererBackend.DirectX11))
- // {
- // // this basically pauses background rendering to reduce cpu load by the scene when it isn't actively in focus
- // // the impact is generally pretty minor, but it's probably best to enable when we can
- // // If we have any windows that we want to update dynamically even when the game is the focus
- // // and not the overlay, this should be disabled.
- // // It is dynamic, so we could disable it only when dynamic windows are open etc
- // scene.PauseWhenUnfocused = true;
-
- // scene.OnBuildUI += DrawUI;
- // scene.Run();
- // }
- //}
-
- //private void DrawUI()
- //{
- // ImGui.ShowDemoWindow();
- //}
-
private IntPtr PresentDetour(IntPtr swapChain, uint syncInterval, uint presentFlags)
{
- if (_scene == null)
+ if (this.scene == null)
{
- _scene = new RawDX11Scene(swapChain);
+#if RENDERDOC_HACKS
+ var hWnd = FindWindow(null, "FINAL FANTASY XIV");
+ var device = GetWrappedDevice(hWnd);
+ this.scene = new RawDX11Scene(device, swapChain);
+#else
+ this.scene = new RawDX11Scene(swapChain);
+#endif
+ this.scene.OnBuildUI += DrawUI;
}
- _scene.Render();
+ this.scene.Render();
return this.presentHook.Original(swapChain, syncInterval, presentFlags);
}
+
+ private void DrawUI()
+ {
+ ImGui.ShowDemoWindow();
+ }
}
}
diff --git a/Dalamud/Resources/d3d11.dll b/Dalamud/Resources/d3d11.dll
deleted file mode 100644
index bbeb568c3..000000000
Binary files a/Dalamud/Resources/d3d11.dll and /dev/null differ
diff --git a/lib/ImGuiScene b/lib/ImGuiScene
index 82b3509a4..adda57dfb 160000
--- a/lib/ImGuiScene
+++ b/lib/ImGuiScene
@@ -1 +1 @@
-Subproject commit 82b3509a40d5311afbd0ecf0e9494ccf43c554ff
+Subproject commit adda57dfb1812b31c44581dd250d335f7d8286cc