Skip to content

Commit 73f8f21

Browse files
committed
feat(gta-core-five): increase blip map legend limit
1 parent 746f079 commit 73f8f21

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include "StdInc.h"
2+
#include "CrossBuildRuntime.h"
3+
#include <Hooking.h>
4+
#include <jitasm.h>
5+
6+
constexpr int kMaxBlipLegend = 256;
7+
8+
static HookFunction hookFunction([]()
9+
{
10+
if (!xbr::IsGameBuildOrGreater<2372>()) return;
11+
12+
static struct : jitasm::Frontend
13+
{
14+
intptr_t toJae, toNext;
15+
16+
void Init(intptr_t jTarget, intptr_t nTarget)
17+
{
18+
toJae = jTarget;
19+
toNext = nTarget;
20+
}
21+
22+
void InternalMain() override
23+
{
24+
cmp(r8w, kMaxBlipLegend);
25+
jae("maxBlipReached");
26+
mov(rax, toNext);
27+
jmp(rax);
28+
L("maxBlipReached");
29+
mov(rax, toJae);
30+
jmp(rax);
31+
}
32+
} stub;
33+
34+
const char* pattern = xbr::IsGameBuildOrGreater<3407>()
35+
? "66 44 3B C0 73 ? 44 8B 74 24 30 EB"
36+
: "66 41 83 F8 ? 73 ? 44 8B 74 24 30 EB";
37+
38+
const int jaeOffset = xbr::IsGameBuildOrGreater<3407>() ? 4 : 5;
39+
40+
auto location = hook::get_pattern<char>(pattern);
41+
auto jae = location + jaeOffset;
42+
const int8_t disp = *(int8_t*)(jae + 1);
43+
const intptr_t toJae = (intptr_t)(jae + 2 + disp);
44+
const intptr_t toNext = (intptr_t)(jae + 2);
45+
46+
stub.Init(toJae, toNext);
47+
48+
hook::nop(location, jaeOffset + 2);
49+
hook::jump(location, stub.GetCode());
50+
});

0 commit comments

Comments
 (0)