diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp
index 5a69a2d30..dcbe18122 100644
--- a/src/citra_qt/configuration/config.cpp
+++ b/src/citra_qt/configuration/config.cpp
@@ -330,6 +330,21 @@ void Config::ReadValues() {
UISettings::values.max_player = ReadSetting("max_player", 8).toUInt();
UISettings::values.game_id = ReadSetting("game_id", 0).toULongLong();
UISettings::values.room_description = ReadSetting("room_description", "").toString();
+ // Read ban list back
+ size = qt_config->beginReadArray("username_ban_list");
+ UISettings::values.ban_list.first.resize(size);
+ for (int i = 0; i < size; ++i) {
+ qt_config->setArrayIndex(i);
+ UISettings::values.ban_list.first[i] = ReadSetting("username").toString().toStdString();
+ }
+ qt_config->endArray();
+ size = qt_config->beginReadArray("ip_ban_list");
+ UISettings::values.ban_list.second.resize(size);
+ for (int i = 0; i < size; ++i) {
+ qt_config->setArrayIndex(i);
+ UISettings::values.ban_list.second[i] = ReadSetting("ip").toString().toStdString();
+ }
+ qt_config->endArray();
qt_config->endGroup();
qt_config->endGroup();
@@ -535,6 +550,19 @@ void Config::SaveValues() {
WriteSetting("max_player", UISettings::values.max_player, 8);
WriteSetting("game_id", UISettings::values.game_id, 0);
WriteSetting("room_description", UISettings::values.room_description, "");
+ // Write ban list
+ qt_config->beginWriteArray("username_ban_list");
+ for (std::size_t i = 0; i < UISettings::values.ban_list.first.size(); ++i) {
+ qt_config->setArrayIndex(i);
+ WriteSetting("username", QString::fromStdString(UISettings::values.ban_list.first[i]));
+ }
+ qt_config->endArray();
+ qt_config->beginWriteArray("ip_ban_list");
+ for (std::size_t i = 0; i < UISettings::values.ban_list.second.size(); ++i) {
+ qt_config->setArrayIndex(i);
+ WriteSetting("ip", QString::fromStdString(UISettings::values.ban_list.second[i]));
+ }
+ qt_config->endArray();
qt_config->endGroup();
qt_config->endGroup();
diff --git a/src/citra_qt/multiplayer/host_room.cpp b/src/citra_qt/multiplayer/host_room.cpp
index 27ab37f46..d5f093e48 100644
--- a/src/citra_qt/multiplayer/host_room.cpp
+++ b/src/citra_qt/multiplayer/host_room.cpp
@@ -127,11 +127,16 @@ void HostRoomWindow::Host() {
auto port = ui->port->isModified() ? ui->port->text().toInt() : Network::DefaultRoomPort;
auto password = ui->password->text().toStdString();
const bool is_public = ui->host_type->currentIndex() == 0;
+ Network::Room::BanList ban_list{};
+ if (ui->load_ban_list->isChecked()) {
+ ban_list = UISettings::values.ban_list;
+ }
if (auto room = Network::GetRoom().lock()) {
bool created = room->Create(ui->room_name->text().toStdString(),
ui->room_description->toPlainText().toStdString(), "", port,
- password, ui->max_player->value(), game_name.toStdString(),
- game_id, CreateVerifyBackend(is_public));
+ password, ui->max_player->value(),
+ Settings::values.citra_username, game_name.toStdString(),
+ game_id, CreateVerifyBackend(is_public), ban_list);
if (!created) {
NetworkMessage::ShowError(NetworkMessage::COULD_NOT_CREATE_ROOM);
LOG_ERROR(Network, "Could not create room!");
diff --git a/src/citra_qt/multiplayer/host_room.ui b/src/citra_qt/multiplayer/host_room.ui
index 5084ef7f4..d54cf49c6 100644
--- a/src/citra_qt/multiplayer/host_room.ui
+++ b/src/citra_qt/multiplayer/host_room.ui
@@ -145,6 +145,20 @@
+ -
+
+
-
+
+
+ Load Previous Ban List
+
+
+ true
+
+
+
+
+
-
diff --git a/src/citra_qt/multiplayer/state.cpp b/src/citra_qt/multiplayer/state.cpp
index 996af55b3..2970c0691 100644
--- a/src/citra_qt/multiplayer/state.cpp
+++ b/src/citra_qt/multiplayer/state.cpp
@@ -13,6 +13,7 @@
#include "citra_qt/multiplayer/lobby.h"
#include "citra_qt/multiplayer/message.h"
#include "citra_qt/multiplayer/state.h"
+#include "citra_qt/ui_settings.h"
#include "citra_qt/util/clickable_label.h"
#include "common/announce_multiplayer_room.h"
#include "common/logging/log.h"
@@ -213,6 +214,10 @@ bool MultiplayerState::OnCloseRoom() {
if (room->GetState() != Network::Room::State::Open) {
return true;
}
+ // Save ban list
+ if (auto room = Network::GetRoom().lock()) {
+ UISettings::values.ban_list = std::move(room->GetBanList());
+ }
room->Destroy();
announce_multiplayer_session->Stop();
LOG_DEBUG(Frontend, "Closed the room (as a server)");
diff --git a/src/citra_qt/ui_settings.h b/src/citra_qt/ui_settings.h
index b26d69364..d623b14da 100644
--- a/src/citra_qt/ui_settings.h
+++ b/src/citra_qt/ui_settings.h
@@ -5,6 +5,8 @@
#pragma once
#include
+#include
+#include
#include
#include
#include
@@ -110,6 +112,7 @@ struct Values {
uint host_type;
qulonglong game_id;
QString room_description;
+ std::pair, std::vector> ban_list;
// logging
bool show_console;