summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFearlessTobi <thm.frey@gmail.com>2022-07-25 17:08:20 +0200
committerFearlessTobi <thm.frey@gmail.com>2022-07-25 21:59:31 +0200
commit6a2dcc8b3d4ed0940e33d60fee701bcdb063eb6b (patch)
treeb70962e3698930c5b06d777bd912caa89a912391
parentyuzu_cmd: Fix compilation (diff)
downloadyuzu-6a2dcc8b3d4ed0940e33d60fee701bcdb063eb6b.tar
yuzu-6a2dcc8b3d4ed0940e33d60fee701bcdb063eb6b.tar.gz
yuzu-6a2dcc8b3d4ed0940e33d60fee701bcdb063eb6b.tar.bz2
yuzu-6a2dcc8b3d4ed0940e33d60fee701bcdb063eb6b.tar.lz
yuzu-6a2dcc8b3d4ed0940e33d60fee701bcdb063eb6b.tar.xz
yuzu-6a2dcc8b3d4ed0940e33d60fee701bcdb063eb6b.tar.zst
yuzu-6a2dcc8b3d4ed0940e33d60fee701bcdb063eb6b.zip
Diffstat (limited to '')
-rw-r--r--src/common/announce_multiplayer_room.h2
-rw-r--r--src/network/network.cpp28
-rw-r--r--src/network/network.h4
-rw-r--r--src/network/room.cpp16
-rw-r--r--src/network/room_member.cpp6
-rw-r--r--src/network/verify_user.cpp2
-rw-r--r--src/network/verify_user.h6
-rw-r--r--src/web_service/announce_room_json.cpp4
-rw-r--r--src/web_service/verify_user_jwt.cpp4
-rw-r--r--src/web_service/verify_user_jwt.h2
-rw-r--r--src/yuzu/multiplayer/host_room.cpp2
-rw-r--r--src/yuzu/multiplayer/lobby.cpp8
-rw-r--r--src/yuzu/multiplayer/lobby_p.h4
-rw-r--r--src/yuzu/multiplayer/state.cpp12
14 files changed, 53 insertions, 47 deletions
diff --git a/src/common/announce_multiplayer_room.h b/src/common/announce_multiplayer_room.h
index a9e2f89b7..11a80aa8e 100644
--- a/src/common/announce_multiplayer_room.h
+++ b/src/common/announce_multiplayer_room.h
@@ -43,7 +43,7 @@ struct Room {
RoomInformation information;
std::string id;
- std::string verify_UID; ///< UID used for verification
+ std::string verify_uid; ///< UID used for verification
std::string ip;
u32 net_version;
bool has_password;
diff --git a/src/network/network.cpp b/src/network/network.cpp
index e1401a403..36b70c36f 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -10,8 +10,8 @@
namespace Network {
RoomNetwork::RoomNetwork() {
- g_room = std::make_shared<Room>();
- g_room_member = std::make_shared<RoomMember>();
+ m_room = std::make_shared<Room>();
+ m_room_member = std::make_shared<RoomMember>();
}
bool RoomNetwork::Init() {
@@ -19,30 +19,30 @@ bool RoomNetwork::Init() {
LOG_ERROR(Network, "Error initalizing ENet");
return false;
}
- g_room = std::make_shared<Room>();
- g_room_member = std::make_shared<RoomMember>();
+ m_room = std::make_shared<Room>();
+ m_room_member = std::make_shared<RoomMember>();
LOG_DEBUG(Network, "initialized OK");
return true;
}
std::weak_ptr<Room> RoomNetwork::GetRoom() {
- return g_room;
+ return m_room;
}
std::weak_ptr<RoomMember> RoomNetwork::GetRoomMember() {
- return g_room_member;
+ return m_room_member;
}
void RoomNetwork::Shutdown() {
- if (g_room_member) {
- if (g_room_member->IsConnected())
- g_room_member->Leave();
- g_room_member.reset();
+ if (m_room_member) {
+ if (m_room_member->IsConnected())
+ m_room_member->Leave();
+ m_room_member.reset();
}
- if (g_room) {
- if (g_room->GetState() == Room::State::Open)
- g_room->Destroy();
- g_room.reset();
+ if (m_room) {
+ if (m_room->GetState() == Room::State::Open)
+ m_room->Destroy();
+ m_room.reset();
}
enet_deinitialize();
LOG_DEBUG(Network, "shutdown OK");
diff --git a/src/network/network.h b/src/network/network.h
index 74eb42bf5..a38f04029 100644
--- a/src/network/network.h
+++ b/src/network/network.h
@@ -27,8 +27,8 @@ public:
void Shutdown();
private:
- std::shared_ptr<RoomMember> g_room_member; ///< RoomMember (Client) for network games
- std::shared_ptr<Room> g_room; ///< Room (Server) for network games
+ std::shared_ptr<RoomMember> m_room_member; ///< RoomMember (Client) for network games
+ std::shared_ptr<Room> m_room; ///< Room (Server) for network games
};
} // namespace Network
diff --git a/src/network/room.cpp b/src/network/room.cpp
index 22491b299..b22c5fb89 100644
--- a/src/network/room.cpp
+++ b/src/network/room.cpp
@@ -29,8 +29,8 @@ public:
std::atomic<State> state{State::Closed}; ///< Current state of the room.
RoomInformation room_information; ///< Information about this room.
- std::string verify_UID; ///< A GUID which may be used for verfication.
- mutable std::mutex verify_UID_mutex; ///< Mutex for verify_UID
+ std::string verify_uid; ///< A GUID which may be used for verfication.
+ mutable std::mutex verify_uid_mutex; ///< Mutex for verify_uid
std::string password; ///< The password required to connect to this room.
@@ -369,8 +369,8 @@ void Room::RoomImpl::HandleJoinRequest(const ENetEvent* event) {
std::string uid;
{
- std::lock_guard lock(verify_UID_mutex);
- uid = verify_UID;
+ std::lock_guard lock(verify_uid_mutex);
+ uid = verify_uid;
}
member.user_data = verify_backend->LoadUserData(uid, token);
@@ -1056,8 +1056,8 @@ const RoomInformation& Room::GetRoomInformation() const {
}
std::string Room::GetVerifyUID() const {
- std::lock_guard lock(room_impl->verify_UID_mutex);
- return room_impl->verify_UID;
+ std::lock_guard lock(room_impl->verify_uid_mutex);
+ return room_impl->verify_uid;
}
Room::BanList Room::GetBanList() const {
@@ -1086,8 +1086,8 @@ bool Room::HasPassword() const {
}
void Room::SetVerifyUID(const std::string& uid) {
- std::lock_guard lock(room_impl->verify_UID_mutex);
- room_impl->verify_UID = uid;
+ std::lock_guard lock(room_impl->verify_uid_mutex);
+ room_impl->verify_uid = uid;
}
void Room::Destroy() {
diff --git a/src/network/room_member.cpp b/src/network/room_member.cpp
index 11a2e276e..d8cb32721 100644
--- a/src/network/room_member.cpp
+++ b/src/network/room_member.cpp
@@ -416,8 +416,9 @@ void RoomMember::RoomMemberImpl::Disconnect() {
room_information.member_slots = 0;
room_information.name.clear();
- if (!server)
+ if (!server) {
return;
+ }
enet_peer_disconnect(server, 0);
ENetEvent event;
@@ -483,8 +484,9 @@ template <typename T>
void RoomMember::RoomMemberImpl::Invoke(const T& data) {
std::lock_guard lock(callback_mutex);
CallbackSet<T> callback_set = callbacks.Get<T>();
- for (auto const& callback : callback_set)
+ for (auto const& callback : callback_set) {
(*callback)(data);
+ }
}
template <typename T>
diff --git a/src/network/verify_user.cpp b/src/network/verify_user.cpp
index d9d98e495..51094e9bc 100644
--- a/src/network/verify_user.cpp
+++ b/src/network/verify_user.cpp
@@ -10,7 +10,7 @@ Backend::~Backend() = default;
NullBackend::~NullBackend() = default;
-UserData NullBackend::LoadUserData([[maybe_unused]] const std::string& verify_UID,
+UserData NullBackend::LoadUserData([[maybe_unused]] const std::string& verify_uid,
[[maybe_unused]] const std::string& token) {
return {};
}
diff --git a/src/network/verify_user.h b/src/network/verify_user.h
index 5c3852d4a..ddae67e99 100644
--- a/src/network/verify_user.h
+++ b/src/network/verify_user.h
@@ -25,11 +25,11 @@ public:
/**
* Verifies the given token and loads the information into a UserData struct.
- * @param verify_UID A GUID that may be used for verification.
+ * @param verify_uid A GUID that may be used for verification.
* @param token A token that contains user data and verification data. The format and content is
* decided by backends.
*/
- virtual UserData LoadUserData(const std::string& verify_UID, const std::string& token) = 0;
+ virtual UserData LoadUserData(const std::string& verify_uid, const std::string& token) = 0;
};
/**
@@ -40,7 +40,7 @@ class NullBackend final : public Backend {
public:
~NullBackend();
- UserData LoadUserData(const std::string& verify_UID, const std::string& token) override;
+ UserData LoadUserData(const std::string& verify_uid, const std::string& token) override;
};
} // namespace Network::VerifyUser
diff --git a/src/web_service/announce_room_json.cpp b/src/web_service/announce_room_json.cpp
index 082bebaa9..0aae8e215 100644
--- a/src/web_service/announce_room_json.cpp
+++ b/src/web_service/announce_room_json.cpp
@@ -54,7 +54,7 @@ static void to_json(nlohmann::json& json, const Room& room) {
}
static void from_json(const nlohmann::json& json, Room& room) {
- room.verify_UID = json.at("externalGuid").get<std::string>();
+ room.verify_uid = json.at("externalGuid").get<std::string>();
room.ip = json.at("address").get<std::string>();
room.information.name = json.at("name").get<std::string>();
try {
@@ -116,7 +116,7 @@ WebService::WebResult RoomJson::Register() {
auto reply_json = nlohmann::json::parse(result.returned_data);
room = reply_json.get<AnnounceMultiplayerRoom::Room>();
room_id = reply_json.at("id").get<std::string>();
- return WebService::WebResult{WebService::WebResult::Code::Success, "", room.verify_UID};
+ return WebService::WebResult{WebService::WebResult::Code::Success, "", room.verify_uid};
}
void RoomJson::ClearPlayers() {
diff --git a/src/web_service/verify_user_jwt.cpp b/src/web_service/verify_user_jwt.cpp
index 3133dcbe2..2f294d378 100644
--- a/src/web_service/verify_user_jwt.cpp
+++ b/src/web_service/verify_user_jwt.cpp
@@ -35,9 +35,9 @@ std::string GetPublicKey(const std::string& host) {
VerifyUserJWT::VerifyUserJWT(const std::string& host) : pub_key(GetPublicKey(host)) {}
-Network::VerifyUser::UserData VerifyUserJWT::LoadUserData(const std::string& verify_UID,
+Network::VerifyUser::UserData VerifyUserJWT::LoadUserData(const std::string& verify_uid,
const std::string& token) {
- const std::string audience = fmt::format("external-{}", verify_UID);
+ const std::string audience = fmt::format("external-{}", verify_uid);
using namespace jwt::params;
std::error_code error;
auto decoded =
diff --git a/src/web_service/verify_user_jwt.h b/src/web_service/verify_user_jwt.h
index 6db74c208..ec3cc2904 100644
--- a/src/web_service/verify_user_jwt.h
+++ b/src/web_service/verify_user_jwt.h
@@ -17,7 +17,7 @@ public:
VerifyUserJWT(const std::string& host);
~VerifyUserJWT() = default;
- Network::VerifyUser::UserData LoadUserData(const std::string& verify_UID,
+ Network::VerifyUser::UserData LoadUserData(const std::string& verify_uid,
const std::string& token) override;
private:
diff --git a/src/yuzu/multiplayer/host_room.cpp b/src/yuzu/multiplayer/host_room.cpp
index a48077544..f59c6a28d 100644
--- a/src/yuzu/multiplayer/host_room.cpp
+++ b/src/yuzu/multiplayer/host_room.cpp
@@ -163,7 +163,7 @@ void HostRoomWindow::Host() {
// Start the announce session if they chose Public
if (is_public) {
if (auto session = announce_multiplayer_session.lock()) {
- // Register the room first to ensure verify_UID is present when we connect
+ // Register the room first to ensure verify_uid is present when we connect
WebService::WebResult result = session->Register();
if (result.result_code != WebService::WebResult::Code::Success) {
QMessageBox::warning(
diff --git a/src/yuzu/multiplayer/lobby.cpp b/src/yuzu/multiplayer/lobby.cpp
index 0c6648ab5..6daef9712 100644
--- a/src/yuzu/multiplayer/lobby.cpp
+++ b/src/yuzu/multiplayer/lobby.cpp
@@ -149,11 +149,11 @@ void Lobby::OnJoinRoom(const QModelIndex& source) {
const std::string ip =
proxy->data(connection_index, LobbyItemHost::HostIPRole).toString().toStdString();
int port = proxy->data(connection_index, LobbyItemHost::HostPortRole).toInt();
- const std::string verify_UID =
+ const std::string verify_uid =
proxy->data(connection_index, LobbyItemHost::HostVerifyUIDRole).toString().toStdString();
// attempt to connect in a different thread
- QFuture<void> f = QtConcurrent::run([nickname, ip, port, password, verify_UID, this] {
+ QFuture<void> f = QtConcurrent::run([nickname, ip, port, password, verify_uid, this] {
std::string token;
#ifdef ENABLE_WEB_SERVICE
if (!Settings::values.yuzu_username.GetValue().empty() &&
@@ -161,7 +161,7 @@ void Lobby::OnJoinRoom(const QModelIndex& source) {
WebService::Client client(Settings::values.web_api_url.GetValue(),
Settings::values.yuzu_username.GetValue(),
Settings::values.yuzu_token.GetValue());
- token = client.GetExternalJWT(verify_UID).returned_data;
+ token = client.GetExternalJWT(verify_uid).returned_data;
if (token.empty()) {
LOG_ERROR(WebService, "Could not get external JWT, verification may fail");
} else {
@@ -239,7 +239,7 @@ void Lobby::OnRefreshLobby() {
smdh_icon),
new LobbyItemHost(QString::fromStdString(room.information.host_username),
QString::fromStdString(room.ip), room.information.port,
- QString::fromStdString(room.verify_UID)),
+ QString::fromStdString(room.verify_uid)),
new LobbyItemMemberList(members, room.information.member_slots),
});
model->appendRow(row);
diff --git a/src/yuzu/multiplayer/lobby_p.h b/src/yuzu/multiplayer/lobby_p.h
index afb8b99dc..bb2de4af3 100644
--- a/src/yuzu/multiplayer/lobby_p.h
+++ b/src/yuzu/multiplayer/lobby_p.h
@@ -123,11 +123,11 @@ public:
static const int HostVerifyUIDRole = Qt::UserRole + 4;
LobbyItemHost() = default;
- explicit LobbyItemHost(QString username, QString ip, u16 port, QString verify_UID) {
+ explicit LobbyItemHost(QString username, QString ip, u16 port, QString verify_uid) {
setData(username, HostUsernameRole);
setData(ip, HostIPRole);
setData(port, HostPortRole);
- setData(verify_UID, HostVerifyUIDRole);
+ setData(verify_uid, HostVerifyUIDRole);
}
QVariant data(int role) const override {
diff --git a/src/yuzu/multiplayer/state.cpp b/src/yuzu/multiplayer/state.cpp
index de25225dd..661a32b3e 100644
--- a/src/yuzu/multiplayer/state.cpp
+++ b/src/yuzu/multiplayer/state.cpp
@@ -98,14 +98,18 @@ void MultiplayerState::retranslateUi() {
status_text->setText(tr("Not Connected"));
}
- if (lobby)
+ if (lobby) {
lobby->RetranslateUi();
- if (host_room)
+ }
+ if (host_room) {
host_room->RetranslateUi();
- if (client_room)
+ }
+ if (client_room) {
client_room->RetranslateUi();
- if (direct_connect)
+ }
+ if (direct_connect) {
direct_connect->RetranslateUi();
+ }
}
void MultiplayerState::OnNetworkStateChanged(const Network::RoomMember::State& state) {