From 859610e4f7944047c11f53aef26e694e3794ebb4 Mon Sep 17 00:00:00 2001 From: Nikhil Narayana Date: Mon, 30 May 2022 00:43:46 -0700 Subject: [PATCH] pull in project-slippi/Ishiiruka/commit/3a3267c2872c7a1dc198f3508a048d6c4c046bcf --- Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp index 98422bb98f..cb0bd7fdb9 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp @@ -2315,10 +2315,15 @@ void CEXISlippi::prepareOnlineMatchState() areAllSameTeam = false; } - // Randomize assignments to randomize teams when all same color - std::vector teamAssignments = {0, 0, 1, 1}; - generator.seed(rngOffset); - std::shuffle(teamAssignments.begin(), teamAssignments.end(), generator); + // Choose random team assignments + // Previously there was a bug here where the shuffle was not consistent across platforms given + // the same seed, this would cause desyncs during cross platform play (different teams). Got + // around this by no longer using the shuffle function... + std::vector> teamAssignmentPermutations = { + {0, 0, 1, 1}, {1, 1, 0, 0}, {0, 1, 1, 0}, {1, 0, 0, 1}, {0, 1, 0, 1}, {1, 0, 1, 0}, + }; + auto teamAssignments = + teamAssignmentPermutations[rngOffset % teamAssignmentPermutations.size()]; // Overwrite player character choices for (auto& s : orderedSelections)