Skip to content

Commit

Permalink
close the black hole under LibertyCity (#610)
Browse files Browse the repository at this point in the history
* 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 <thirteenag@gmail.com>
  • Loading branch information
d3g0n-byte and ThirteenAG committed Sep 14, 2024
1 parent 362dbce commit 9478586
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions source/fixes.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -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<float>(pVertex, 0.0f, true);
injector::WriteMemory<float>(pVertex + 2, 0.0f, true);
}
}
else
{
injector::WriteMemory<float>(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<float*>(4);
PatchVertices(*addr);
}
else
{
pattern = hook::pattern("C7 46 ? ? ? ? ? C7 46 ? ? ? ? ? 5E 59 C3");
if (!pattern.empty())
{
auto addr = pattern.get_first<float*>(3);
PatchVertices(*addr);
}
}
}
};
}
} Fixes;

0 comments on commit 9478586

Please sign in to comment.