diff --git a/src/citra_qt/configuration/configure_dialog.cpp b/src/citra_qt/configuration/configure_dialog.cpp
index e1fc5abac3..653f2a3875 100644
--- a/src/citra_qt/configuration/configure_dialog.cpp
+++ b/src/citra_qt/configuration/configure_dialog.cpp
@@ -10,10 +10,11 @@
#include "core/settings.h"
#include "ui_configure.h"
-ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry)
+ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, bool enable_web_config)
: QDialog(parent), registry(registry), ui(new Ui::ConfigureDialog) {
ui->setupUi(this);
ui->hotkeysTab->Populate(registry);
+ ui->webTab->SetWebServiceConfigEnabled(enable_web_config);
this->PopulateSelectionList();
connect(ui->uiTab, &ConfigureUi::languageChanged, this, &ConfigureDialog::onLanguageChanged);
diff --git a/src/citra_qt/configuration/configure_dialog.h b/src/citra_qt/configuration/configure_dialog.h
index 91234ca0b5..6fab7cff16 100644
--- a/src/citra_qt/configuration/configure_dialog.h
+++ b/src/citra_qt/configuration/configure_dialog.h
@@ -17,7 +17,8 @@ class ConfigureDialog : public QDialog {
Q_OBJECT
public:
- explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry);
+ explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry,
+ bool enable_web_config = true);
~ConfigureDialog() override;
void applyConfiguration();
diff --git a/src/citra_qt/configuration/configure_web.cpp b/src/citra_qt/configuration/configure_web.cpp
index 56f876524a..e8a0cc21f5 100644
--- a/src/citra_qt/configuration/configure_web.cpp
+++ b/src/citra_qt/configuration/configure_web.cpp
@@ -118,3 +118,8 @@ void ConfigureWeb::OnLoginVerified() {
void ConfigureWeb::retranslateUi() {
ui->retranslateUi(this);
}
+
+void ConfigureWeb::SetWebServiceConfigEnabled(bool enabled) {
+ ui->label_disable_info->setVisible(!enabled);
+ ui->groupBoxWebConfig->setEnabled(enabled);
+}
diff --git a/src/citra_qt/configuration/configure_web.h b/src/citra_qt/configuration/configure_web.h
index d52bab7a05..2e0ab2e9bc 100644
--- a/src/citra_qt/configuration/configure_web.h
+++ b/src/citra_qt/configuration/configure_web.h
@@ -22,6 +22,7 @@ public:
void applyConfiguration();
void retranslateUi();
void setConfiguration();
+ void SetWebServiceConfigEnabled(bool enabled);
private:
void RefreshTelemetryID();
diff --git a/src/citra_qt/configuration/configure_web.ui b/src/citra_qt/configuration/configure_web.ui
index a8aeda9ada..ab35591574 100644
--- a/src/citra_qt/configuration/configure_web.ui
+++ b/src/citra_qt/configuration/configure_web.ui
@@ -118,6 +118,16 @@
+ -
+
+
+ Web Service configuration can only be changed when a public room isn't being hosted.
+
+
+ true
+
+
+
-
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index bcff0b9fce..3c2a9f5f52 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -1335,7 +1335,8 @@ void GMainWindow::OnCheats() {
}
void GMainWindow::OnConfigure() {
- ConfigureDialog configureDialog(this, hotkey_registry);
+ ConfigureDialog configureDialog(this, hotkey_registry,
+ !multiplayer_state->IsHostingPublicRoom());
connect(&configureDialog, &ConfigureDialog::languageChanged, this,
&GMainWindow::OnLanguageChanged);
auto old_theme = UISettings::values.theme;
@@ -1350,6 +1351,8 @@ void GMainWindow::OnConfigure() {
UpdateUITheme();
if (UISettings::values.enable_discord_presence != old_discord_presence)
SetDiscordEnabled(UISettings::values.enable_discord_presence);
+ if (!multiplayer_state->IsHostingPublicRoom())
+ multiplayer_state->UpdateCredentials();
emit UpdateThemedIcons();
SyncMenuUISettings();
game_list->RefreshGameDirectory();
diff --git a/src/citra_qt/multiplayer/state.cpp b/src/citra_qt/multiplayer/state.cpp
index 809bcddcac..c122a5c83c 100644
--- a/src/citra_qt/multiplayer/state.cpp
+++ b/src/citra_qt/multiplayer/state.cpp
@@ -278,3 +278,11 @@ void MultiplayerState::OnDirectConnectToRoom() {
}
BringWidgetToFront(direct_connect);
}
+
+bool MultiplayerState::IsHostingPublicRoom() const {
+ return announce_multiplayer_session->IsRunning();
+}
+
+void MultiplayerState::UpdateCredentials() {
+ announce_multiplayer_session->UpdateCredentials();
+}
diff --git a/src/citra_qt/multiplayer/state.h b/src/citra_qt/multiplayer/state.h
index 8061d18cfd..78a5530dd8 100644
--- a/src/citra_qt/multiplayer/state.h
+++ b/src/citra_qt/multiplayer/state.h
@@ -38,6 +38,14 @@ public:
void retranslateUi();
+ /**
+ * Whether a public room is being hosted or not.
+ * When this is true, Web Services configuration should be disabled.
+ */
+ bool IsHostingPublicRoom() const;
+
+ void UpdateCredentials();
+
public slots:
void OnNetworkStateChanged(const Network::RoomMember::State& state);
void OnNetworkError(const Network::RoomMember::Error& error);
diff --git a/src/core/announce_multiplayer_session.cpp b/src/core/announce_multiplayer_session.cpp
index 90293ec920..d46c8db566 100644
--- a/src/core/announce_multiplayer_session.cpp
+++ b/src/core/announce_multiplayer_session.cpp
@@ -146,4 +146,18 @@ AnnounceMultiplayerRoom::RoomList AnnounceMultiplayerSession::GetRoomList() {
return backend->GetRoomList();
}
+bool AnnounceMultiplayerSession::IsRunning() const {
+ return announce_multiplayer_thread != nullptr;
+}
+
+void AnnounceMultiplayerSession::UpdateCredentials() {
+ ASSERT_MSG(!IsRunning(), "Credentials can only be updated when session is not running");
+
+#ifdef ENABLE_WEB_SERVICE
+ backend = std::make_unique(Settings::values.web_api_url,
+ Settings::values.citra_username,
+ Settings::values.citra_token);
+#endif
+}
+
} // namespace Core
diff --git a/src/core/announce_multiplayer_session.h b/src/core/announce_multiplayer_session.h
index 07e09a448f..5647972d0d 100644
--- a/src/core/announce_multiplayer_session.h
+++ b/src/core/announce_multiplayer_session.h
@@ -67,6 +67,17 @@ public:
*/
AnnounceMultiplayerRoom::RoomList GetRoomList();
+ /**
+ * Whether the announce session is still running
+ */
+ bool IsRunning() const;
+
+ /**
+ * Recreates the backend, updating the credentials.
+ * This can only be used when the announce session is not running.
+ */
+ void UpdateCredentials();
+
private:
Common::Event shutdown_event;
std::mutex callback_mutex;