fix: fix multiplayer player data mix between different players bug
Fixes a Win64 multiplayer issue where player data (`players/*.dat`) could be mismatched because identity was effectively tied to connection-order `smallId` XUIDs. Introduces a deterministic username-derived persistent XUID and integrates it into the existing XUID-based save pipeline. - Added `Windows64_NameXuid` for deterministic `name -> persistent xuid` resolution - On Win64 login (`PlayerList`), set `ServerPlayer::xuid` from username-based resolver - Aligned local player `xuid` assignment (`Minecraft`) for create/init/respawn paths to use the same resolver - Added Win64 local-self guard in `ClientConnection::handleAddPlayer` using name match to avoid duplicate local remote-player creation - Kept `IQNet::GetPlayerByXuid` compatibility fallback behavior, while extending lookup to also resolve username-based XUIDs - Moved implementation to `Minecraft.Client/Windows64/Windows64_NameXuid.h`; kept legacy `Win64NameXuid.h` as compatibility include Rename migration is intentionally out of scope (same-name identity only).
This commit is contained in:
@@ -762,6 +762,18 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef _WINDOWS64
|
||||
// Win64 player-data XUIDs are resolved from player name, so also guard against creating
|
||||
// a duplicate remote player for a local slot by checking the username directly.
|
||||
for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if (minecraft->localplayers[idx] != NULL && minecraft->localplayers[idx]->name == packet->name)
|
||||
{
|
||||
app.DebugPrintf("AddPlayerPacket received for local player name %ls\n", packet->name.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*#ifdef _WINDOWS64
|
||||
// On Windows64 all XUIDs are INVALID_XUID so the XUID check above never fires.
|
||||
// packet->m_playerIndex is the server-assigned sequential index (set via LoginPacket),
|
||||
@@ -3957,4 +3969,4 @@ ClientConnection::DeferredEntityLinkPacket::DeferredEntityLinkPacket(shared_ptr<
|
||||
{
|
||||
m_recievedTick = GetTickCount();
|
||||
m_packet = packet;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user