Address review comments

This commit is contained in:
FearlessTobi 2022-08-28 19:31:16 +02:00
parent 6791301d9a
commit 65718e2876
11 changed files with 26 additions and 27 deletions

View File

@ -145,26 +145,19 @@ struct NetworkId {
static_assert(sizeof(NetworkId) == 0x20, "NetworkId is an invalid size");
struct Ssid {
u8 length;
std::array<char, SsidLengthMax + 1> raw;
u8 length{};
std::array<char, SsidLengthMax + 1> raw{};
Ssid() {
length = 0;
std::memset(raw.data(), 0, raw.size());
}
Ssid() = default;
Ssid(std::string data) {
explicit Ssid(std::string_view data) {
length = static_cast<u8>(std::min(data.size(), SsidLengthMax));
std::memcpy(raw.data(), data.data(), length);
data.copy(raw.data(), length);
raw[length] = 0;
}
std::string GetStringValue() const {
return std::string(raw.data(), length);
}
bool operator==(const Ssid& b) const {
return (length == b.length) && (std::memcmp(raw.data(), b.raw.data(), length) == 0);
return std::string(raw.data());
}
};
static_assert(sizeof(Ssid) == 0x22, "Ssid is an invalid size");

View File

@ -76,12 +76,7 @@ static constexpr char BanListMagic[] = "YuzuRoom-BanList-1";
static constexpr char token_delimiter{':'};
static void PadToken(std::string& token) {
const auto remainder = token.size() % 3;
if (remainder == 0) {
return;
}
for (size_t i = 0; i < (3 - remainder); i++) {
while (token.size() % 4 != 0) {
token.push_back('=');
}
}

View File

@ -154,9 +154,7 @@ public:
}
const QString version = data(GameVersionRole).toString();
QString version_string;
if (version.isEmpty()) {
version_string = QString{};
} else {
if (!version.isEmpty()) {
version_string = QStringLiteral("(%1)").arg(version);
}
return QStringLiteral("%1\n %2 %3")

View File

@ -8,6 +8,7 @@
#include <QString>
#include <QtConcurrent/QtConcurrentRun>
#include "common/settings.h"
#include "core/core.h"
#include "core/internal_network/network_interface.h"
#include "network/network.h"
#include "ui_direct_connect.h"

View File

@ -6,13 +6,16 @@
#include <memory>
#include <QDialog>
#include <QFutureWatcher>
#include "core/core.h"
#include "yuzu/multiplayer/validation.h"
namespace Ui {
class DirectConnect;
}
namespace Core {
class System;
}
class DirectConnectWindow : public QDialog {
Q_OBJECT

View File

@ -12,6 +12,7 @@
#include <QtConcurrent/QtConcurrentRun>
#include "common/logging/log.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/internal_network/network_interface.h"
#include "network/announce_multiplayer_session.h"
#include "ui_host_room.h"

View File

@ -8,7 +8,6 @@
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <QVariant>
#include "core/core.h"
#include "network/network.h"
#include "yuzu/multiplayer/chat_room.h"
#include "yuzu/multiplayer/validation.h"
@ -18,8 +17,9 @@ class HostRoom;
}
namespace Core {
class System;
class AnnounceMultiplayerSession;
}
} // namespace Core
class ConnectionError;
class ComboBoxProxyModel;

View File

@ -6,6 +6,7 @@
#include <QtConcurrent/QtConcurrentRun>
#include "common/logging/log.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/internal_network/network_interface.h"
#include "network/network.h"
#include "ui_lobby.h"

View File

@ -9,7 +9,6 @@
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include "common/announce_multiplayer_room.h"
#include "core/core.h"
#include "network/announce_multiplayer_session.h"
#include "network/network.h"
#include "yuzu/multiplayer/validation.h"
@ -21,6 +20,10 @@ class Lobby;
class LobbyModel;
class LobbyFilterProxyModel;
namespace Core {
class System;
}
/**
* Listing of all public games pulled from services. The lobby should be simple enough for users to
* find the game they want to play, and join it.

View File

@ -8,6 +8,7 @@
#include <QStandardItemModel>
#include "common/announce_multiplayer_room.h"
#include "common/logging/log.h"
#include "core/core.h"
#include "yuzu/game_list.h"
#include "yuzu/multiplayer/client_room.h"
#include "yuzu/multiplayer/direct_connect.h"

View File

@ -4,7 +4,6 @@
#pragma once
#include <QWidget>
#include "core/core.h"
#include "network/announce_multiplayer_session.h"
#include "network/network.h"
@ -15,6 +14,10 @@ class ClientRoomWindow;
class DirectConnectWindow;
class ClickableLabel;
namespace Core {
class System;
}
class MultiplayerState : public QWidget {
Q_OBJECT;