From 94785860cd53f522aaa1dbb74e95171e0ddf425c Mon Sep 17 00:00:00 2001 From: Yulian Shvab <108334730+d3g0n-byte@users.noreply.github.com> Date: Sat, 14 Sep 2024 07:12:48 +0300 Subject: [PATCH] close the black hole under LibertyCity (#610) * close the black hole under LibertyCity * Update skybox_black_bottom_fix.ixx * Update skybox_black_bottom_fix.ixx * move code to fixes module --------- Co-authored-by: ThirteenAG --- source/fixes.ixx | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/source/fixes.ixx b/source/fixes.ixx index e7888a3c..40b8425f 100644 --- a/source/fixes.ixx +++ b/source/fixes.ixx @@ -434,6 +434,45 @@ public: injector::MakeNOP(pattern.get_first(6), 6, true); } } + + // Skybox Black Bottom Fix + { + auto PatchVertices = [](float* ptr) + { + for (auto i = 0; i < ((6156 / 4) / 3); i++) + { + auto pVertex = (ptr + i * 3); + if (i < 32) + { + if (pVertex[1] < 0.0f) + { + injector::WriteMemory(pVertex, 0.0f, true); + injector::WriteMemory(pVertex + 2, 0.0f, true); + } + } + else + { + injector::WriteMemory(pVertex + 1, (pVertex[1] - 0.16037700f) * 1.78f - 1.0f, true); + } + } + }; + + auto pattern = hook::pattern("C7 44 24 ? ? ? ? ? C7 44 24 ? ? ? ? ? E8 ? ? ? ? 8B 44 24 44"); + if (!pattern.empty()) + { + auto addr = pattern.get_first(4); + PatchVertices(*addr); + } + else + { + pattern = hook::pattern("C7 46 ? ? ? ? ? C7 46 ? ? ? ? ? 5E 59 C3"); + if (!pattern.empty()) + { + auto addr = pattern.get_first(3); + PatchVertices(*addr); + } + } + } }; } } Fixes; \ No newline at end of file