From d2d517c43228b3fc14702945701a79728a0b5ce8 Mon Sep 17 00:00:00 2001 From: Jade Macho Date: Mon, 7 Jul 2025 23:50:08 +0200 Subject: [PATCH] game: Fix incorrect rounding behavior (thanks, C# defaults) --- CustomResolution2782/GameSizeState.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CustomResolution2782/GameSizeState.cs b/CustomResolution2782/GameSizeState.cs index 3218682..2288d6d 100644 --- a/CustomResolution2782/GameSizeState.cs +++ b/CustomResolution2782/GameSizeState.cs @@ -275,7 +275,7 @@ RR {dev->RequestRender} 0x{(long) dev->ImmediateContext->IfNonZeroSkipPostTickPr GetScaledWidthHeight(dev->Width, dev->Height, scale, out var widthS, out var heightS); // Check if the backing RTs are the expected size. - var tex = rtm->GameplayTextureUnk1; + var tex = rtm->GameplayTextureUnk3; if (tex->AllocatedWidth != widthS || tex->AllocatedHeight != heightS) { if (!unloading) @@ -300,7 +300,7 @@ RR {dev->RequestRender} 0x{(long) dev->ImmediateContext->IfNonZeroSkipPostTickPr (rtm->Resolution_Width != widthS || rtm->Resolution_Height != heightS)) { // Can also be forced via dev->RequestResolutionChange, but while cleaner on paper, it trips up ReShade. - Service.PluginLog.Debug("_forceUpdateRTM -> 1"); + Service.PluginLog.Debug($"_forceUpdateRTM -> 1 - expected {widthS} x {heightS}, got {rtm->Resolution_Width} x {rtm->Resolution_Height}"); _forceUpdateRTM = ForceUpdateRTMState._1_FakeInv; } @@ -338,7 +338,7 @@ RR {dev->RequestRender} 0x{(long) dev->ImmediateContext->IfNonZeroSkipPostTickPr private static void GetScaledWidthHeight(uint width, uint height, float scale, out uint widthS, out uint heightS) { - heightS = (uint) MathF.Round(height * scale); + heightS = (uint) MathF.Round(height * scale, MidpointRounding.AwayFromZero); widthS = (width * heightS) / height; }