From cc960391348728dd629699e408a0280023d049b3 Mon Sep 17 00:00:00 2001 From: Collecting Date: Thu, 11 Dec 2025 04:21:19 +0000 Subject: [PATCH] fix: Remove Duplicate Games Appearing When Creating Room Evilperson1337 from Discord showcased a bug to where if you had a game stored within multiple folders in the game list, when you'd create a room the game would appear twice. The fix was to add an std::set which will keep track of games Title ID's. The way it functions is simple, "Did I see this Title ID before? Yes or no?" and, as mentioned, will ensure there are no duplicate games being shown, ensuring one version of the game is present for selection. Signed-off-by: Collecting --- src/citron/multiplayer/host_room.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/citron/multiplayer/host_room.cpp b/src/citron/multiplayer/host_room.cpp index fb0d9df22..29f7e2896 100644 --- a/src/citron/multiplayer/host_room.cpp +++ b/src/citron/multiplayer/host_room.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include +#include #include #include #include @@ -83,10 +84,20 @@ HostRoomWindow::~HostRoomWindow() = default; void HostRoomWindow::UpdateGameList(QStandardItemModel* list) { game_list->clear(); + std::set seen_program_ids; + for (int i = 0; i < list->rowCount(); i++) { auto parent = list->item(i, 0); for (int j = 0; j < parent->rowCount(); j++) { - game_list->appendRow(parent->child(j)->clone()); + auto child_item = parent->child(j); + u64 program_id = + child_item->data(GameListItemPath::ProgramIdRole).toULongLong(); + + // Only add the game if we haven't seen its program ID before + if (seen_program_ids.count(program_id) == 0) { + game_list->appendRow(child_item->clone()); + seen_program_ids.insert(program_id); + } } } }