mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-23 00:07:49 +01:00
hacky (re|g)shade workaround
This commit is contained in:
parent
80cb19d4d2
commit
ef1a94adde
2 changed files with 53 additions and 2 deletions
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Dalamud.Game.Internal.DXGI.Definitions;
|
||||
|
|
@ -26,6 +28,11 @@ namespace Dalamud.Game.Internal.DXGI
|
|||
/// <inheritdoc/>
|
||||
public IntPtr ResizeBuffers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether or not ReShade is loaded/used.
|
||||
/// </summary>
|
||||
public bool IsReshade { get; private set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override unsafe void Setup64Bit(SigScanner sig)
|
||||
{
|
||||
|
|
@ -34,6 +41,32 @@ namespace Dalamud.Game.Internal.DXGI
|
|||
var scVtbl = GetVTblAddresses(new IntPtr(kernelDev->SwapChain->DXGISwapChain), Enum.GetValues(typeof(IDXGISwapChainVtbl)).Length);
|
||||
|
||||
this.Present = scVtbl[(int)IDXGISwapChainVtbl.Present];
|
||||
|
||||
var modules = Process.GetCurrentProcess().Modules;
|
||||
foreach (ProcessModule processModule in modules)
|
||||
{
|
||||
if (processModule.FileName != null && processModule.FileName.EndsWith("game\\dxgi.dll"))
|
||||
{
|
||||
// reshade master@4232872 RVA
|
||||
// var p = processModule.BaseAddress + 0x82C7E0; // DXGISwapChain::Present
|
||||
// var p = processModule.BaseAddress + 0x82FAC0; // DXGISwapChain::runtime_present
|
||||
|
||||
var scanner = new SigScanner(processModule);
|
||||
try
|
||||
{
|
||||
var p = scanner.ScanText("F6 C2 01 0F 85 ?? ?? ?? ??");
|
||||
Log.Information($"ReShade DLL: {processModule.FileName} with DXGISwapChain::runtime_present at {p:X}");
|
||||
|
||||
this.Present = p;
|
||||
this.IsReshade = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Could not find reshade DXGISwapChain::runtime_present offset!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.ResizeBuffers = scVtbl[(int)IDXGISwapChainVtbl.ResizeBuffers];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue