Fix runtime_present for ReShade 5/GShade 4

This commit is contained in:
NotNite 2022-12-20 10:33:36 -05:00
parent d5e5a2df31
commit b41554ea74
No known key found for this signature in database
GPG key ID: BD91A5402CCEB08A

View file

@ -68,9 +68,26 @@ public class SwapChainVtableResolver : BaseAddressResolver, ISwapChainAddressRes
// DXGISwapChain::handle_device_loss => DXGISwapChain::Present => DXGISwapChain::runtime_present
var scanner = new SigScanner(processModule);
var runtimePresentSig = "F6 C2 01 0F 85 ?? ?? ?? ??";
try
{
var p = scanner.ScanText("F6 C2 01 0F 85 ?? ?? ?? ??"); // E8 ?? ?? ?? ?? 45 0F B6 5E ??
var fileInfo = FileVersionInfo.GetVersionInfo(processModule.FileName);
if (fileInfo.FileMajorPart >= 5)
{
// ReShade 5/GShade 4
runtimePresentSig = "E8 ?? ?? ?? ?? 45 0F B6 5E ??";
}
}
catch (Exception ex)
{
Log.Error(ex, "Failed to get reshade version info - falling back to default DXGISwapChain::runtime_present signature");
}
try
{
var p = scanner.ScanText(runtimePresentSig);
Log.Information($"ReShade DLL: {processModule.FileName} with DXGISwapChain::runtime_present at {p:X}");
this.Present = p;