Skip to content

Commit 0df9230

Browse files
committed
UIScaling: round to nearest before applying to int, fix "test your slipstream" rival text
1 parent da0790a commit 0df9230

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/hooks_uiscaling.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,10 @@ class UIScaling : public Hook
352352
float spacing = -((Game::screen_scale->y * Game::original_resolution.x) - Game::screen_resolution->x) / 2;
353353
spacing = spacing / Game::screen_scale->x;
354354

355+
// round our spacing value if this is an integer
356+
if constexpr (std::is_integral_v<T>)
357+
spacing = std::round(spacing);
358+
355359
if(left)
356360
*value = T(float(*value) - spacing);
357361
else
@@ -469,6 +473,7 @@ class UIScaling : public Hook
469473
static inline SafetyHookMid C2CDontLoseGF_AdjustPosition_hk1{};
470474
static inline SafetyHookMid C2CDontLoseGF_AdjustPosition_hk2{};
471475
static inline SafetyHookMid C2CDontLoseGF_AdjustPosition_hk3{};
476+
static inline SafetyHookMid C2CTestSlipstream_AdjustPosition_hk{};
472477

473478
static void C2CSpeechBubble_AdjustPositionESP0(safetyhook::Context& ctx)
474479
{
@@ -630,6 +635,9 @@ class UIScaling : public Hook
630635
C2CDontLoseGF_AdjustPosition_hk2 = safetyhook::create_mid((void*)0x4BD414, put_scroll_AdjustPositionRight);
631636
C2CDontLoseGF_AdjustPosition_hk3 = safetyhook::create_mid((void*)0x4BD472, put_scroll_AdjustPositionRight);
632637

638+
// "test your slipstream" rival text
639+
C2CTestSlipstream_AdjustPosition_hk = safetyhook::create_mid((void*)0x4BD32E, put_scroll_AdjustPositionRight);
640+
633641
return true;
634642
}
635643
static UIScaling instance;

0 commit comments

Comments
 (0)