Skip to content

Commit 01592b0

Browse files
committed
tweak(net/five): no police scanner reset when setting net time
Game behavior, originally reported in https://forum.cfx.re/t/4823607. This indeed doesn't make sense in network games.
1 parent 16207f1 commit 01592b0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

code/components/gta-net-five/src/NetHook.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,16 @@ static void fwClipSetManager_StartNetworkSessionHook()
13911391
}
13921392
}
13931393

1394+
static void (*g_origPoliceScanner_Stop)(void*, int);
1395+
1396+
static void PoliceScanner_StopWrap(void* self, int a2)
1397+
{
1398+
if (!isSessionStarted())
1399+
{
1400+
g_origPoliceScanner_Stop(self, a2);
1401+
}
1402+
}
1403+
13941404
static HookFunction hookFunction([] ()
13951405
{
13961406
MH_Initialize();
@@ -1785,6 +1795,13 @@ static HookFunction hookFunction([] ()
17851795
MH_EnableHook(MH_ALL_HOOKS);
17861796
}
17871797

1798+
// don't stop police scanner reports when changing time in a networked game (really?)
1799+
{
1800+
auto location = hook::get_pattern("48 8D 0D ? ? ? ? 33 D2 E8 ? ? ? ? 48 8B 05 ? ? ? ? 48 8B 48 08", 9);
1801+
hook::set_call(&g_origPoliceScanner_Stop, location);
1802+
hook::call(location, PoliceScanner_StopWrap);
1803+
}
1804+
17881805
// default netnoupnp and netnopcp to true
17891806
auto netNoUpnp = hook::get_address<int*>(hook::get_pattern("8A D1 76 02 B2 01 48 39 0D", 9));
17901807
auto netNoPcp = hook::get_address<int*>(hook::get_pattern("8A D1 EB 02 B2 01 48 39 0D", 9));

0 commit comments

Comments
 (0)