Skip to content

Commit c3eca12

Browse files
committed
fix(net/rdr3): clear player cached info on client drop
1 parent cac18d7 commit c3eca12

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

+11-2
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,15 @@ static hook::cdecl_stub<void(void*)> _pCtor([]()
272272
});
273273

274274
#ifdef IS_RDR3
275-
static hook::cdecl_stub<void(uint8_t)> _initUnkPlayerArray([]()
275+
static hook::cdecl_stub<void(uint8_t)> _addCachedPlayerArrayEntry([]()
276276
{
277277
return hook::get_call(hook::get_pattern("48 8B CB E8 ? ? ? ? 8A 4B 19 48 83 C4", 0x10));
278278
});
279+
280+
static hook::cdecl_stub<void(uint8_t)> _removeCachedPlayerArrayEntry([]()
281+
{
282+
return hook::get_call(hook::get_pattern("40 8A CD E8 ? ? ? ? 48 8B 6C 24 38", 3));
283+
});
279284
#endif
280285

281286
namespace sync
@@ -395,7 +400,7 @@ namespace sync
395400
g_physIdx++;
396401
}
397402

398-
_initUnkPlayerArray(idx);
403+
_addCachedPlayerArrayEntry(idx);
399404
SetupRemotePlayer(clientId, player, idx);
400405
}
401406
#endif
@@ -520,6 +525,10 @@ void HandleClientDrop(const NetLibraryClientInfo& info)
520525
g_playersByNetId[info.netId] = nullptr;
521526
g_netIdsByPlayer[player] = -1;
522527

528+
#ifdef IS_RDR3
529+
_removeCachedPlayerArrayEntry(info.slotId);
530+
#endif
531+
523532
for (int i = 0; i < g_playerListCount; i++)
524533
{
525534
if (g_playerList[i] == player)

0 commit comments

Comments
 (0)