VERY experimental Nintendo Switch 2 emulator
C++
profile_select: Port Service::Account::UUID to Common::UUID
Zach Hilmanad5e497bff27
diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cppindex fbf5f2a9e5..4df3574d26 100644--- a/src/core/frontend/applets/profile_select.cpp+++ b/src/core/frontend/applets/profile_select.cpp@@ -3,6 +3,7 @@// Refer to the license.txt file included.#include "core/frontend/applets/profile_select.h"+#include "core/hle/service/acc/profile_manager.h"#include "core/settings.h"namespace Core::Frontend {@@ -10,9 +11,9 @@ namespace Core::Frontend {ProfileSelectApplet::~ProfileSelectApplet() = default;void DefaultProfileSelectApplet::SelectProfile(- std::function<void(std::optional<Service::Account::UUID>)> callback) const {+ std::function<void(std::optional<Common::UUID>)> callback) const {Service::Account::ProfileManager manager;- callback(manager.GetUser(Settings::values.current_user).value_or(Service::Account::UUID{}));+ callback(manager.GetUser(Settings::values.current_user).value_or(Common::UUID{}));LOG_INFO(Service_ACC, "called, selecting current user instead of prompting...");}diff --git a/src/core/frontend/applets/profile_select.h b/src/core/frontend/applets/profile_select.hindex fc8f7ae947..3506b98850 100644--- a/src/core/frontend/applets/profile_select.h+++ b/src/core/frontend/applets/profile_select.h@@ -6,7 +6,7 @@#include <functional>#include <optional>-#include "core/hle/service/acc/profile_manager.h"+#include "common/uuid.h"namespace Core::Frontend {@@ -14,14 +14,12 @@ class ProfileSelectApplet {public:virtual ~ProfileSelectApplet();- virtual void SelectProfile(- std::function<void(std::optional<Service::Account::UUID>)> callback) const = 0;+ virtual void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback) const = 0;};class DefaultProfileSelectApplet final : public ProfileSelectApplet {public:- void SelectProfile(- std::function<void(std::optional<Service::Account::UUID>)> callback) const override;+ void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback) const override;};} // namespace Core::Frontenddiff --git a/src/core/hle/service/am/applets/profile_select.cpp b/src/core/hle/service/am/applets/profile_select.cppindex d113bd2eb8..3c184859db 100644--- a/src/core/hle/service/am/applets/profile_select.cpp+++ b/src/core/hle/service/am/applets/profile_select.cpp@@ -56,16 +56,16 @@ void ProfileSelect::Execute() {frontend.SelectProfile([this](std::optional<Account::UUID> uuid) { SelectionComplete(uuid); });}-void ProfileSelect::SelectionComplete(std::optional<Account::UUID> uuid) {+void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) {UserSelectionOutput output{};- if (uuid.has_value() && uuid->uuid != Account::INVALID_UUID) {+ if (uuid.has_value() && uuid->uuid != Common::INVALID_UUID) {output.result = 0;output.uuid_selected = uuid->uuid;} else {status = ERR_USER_CANCELLED_SELECTION;output.result = ERR_USER_CANCELLED_SELECTION.raw;- output.uuid_selected = Account::INVALID_UUID;+ output.uuid_selected = Common::INVALID_UUID;}final_data = std::vector<u8>(sizeof(UserSelectionOutput));diff --git a/src/core/hle/service/am/applets/profile_select.h b/src/core/hle/service/am/applets/profile_select.hindex a2ac6cf50a..f99630158a 100644--- a/src/core/hle/service/am/applets/profile_select.h+++ b/src/core/hle/service/am/applets/profile_select.h@@ -7,7 +7,7 @@#include <vector>#include "common/common_funcs.h"-#include "core/hle/service/acc/profile_manager.h"+#include "common/uuid.h"#include "core/hle/service/am/applets/applets.h"namespace Service::AM::Applets {@@ -38,7 +38,7 @@ public:void ExecuteInteractive() override;void Execute() override;- void SelectionComplete(std::optional<Account::UUID> uuid);+ void SelectionComplete(std::optional<Common::UUID> uuid);private:const Core::Frontend::ProfileSelectApplet& frontend;diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cppindex 04fc2180b9..a526e4440f 100644--- a/src/core/hle/service/mii/mii_manager.cpp+++ b/src/core/hle/service/mii/mii_manager.cpp@@ -174,7 +174,7 @@ MiiStoreData ConvertInfoToStoreData(const MiiInfo& info) {} // namespace-std::ostream& operator<<(std::ostream& os,Source source) {+std::ostream& operator<<(std::ostream& os, Source source) {os << SOURCE_NAMES.at(static_cast<std::size_t>(source));return os;}diff --git a/src/yuzu/applets/profile_select.cpp b/src/yuzu/applets/profile_select.cppindex 743b24d767..812b0142f7 100644--- a/src/yuzu/applets/profile_select.cpp+++ b/src/yuzu/applets/profile_select.cpp@@ -27,20 +27,20 @@ constexpr std::array<u8, 107> backup_jpeg{0x01, 0x01, 0x00, 0x00, 0x3f, 0x00, 0xd2, 0xcf, 0x20, 0xff, 0xd9,};-QString FormatUserEntryText(const QString& username, Service::Account::UUID uuid) {+QString FormatUserEntryText(const QString& username, Common::UUID uuid) {return QtProfileSelectionDialog::tr("%1\n%2", "%1 is the profile username, %2 is the formatted UUID (e.g. ""00112233-4455-6677-8899-AABBCCDDEEFF))").arg(username, QString::fromStdString(uuid.FormatSwitch()));}-QString GetImagePath(Service::Account::UUID uuid) {+QString GetImagePath(Common::UUID uuid) {const auto path = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +"/system/save/8000000000000010/su/avators/" + uuid.FormatSwitch() + ".jpg";return QString::fromStdString(path);}-QPixmap GetIcon(Service::Account::UUID uuid) {+QPixmap GetIcon(Common::UUID uuid) {QPixmap icon{GetImagePath(uuid)};if (!icon) {@@ -154,12 +154,12 @@ QtProfileSelector::QtProfileSelector(GMainWindow& parent) {QtProfileSelector::~QtProfileSelector() = default;void QtProfileSelector::SelectProfile(- std::function<void(std::optional<Service::Account::UUID>)> callback) const {+ std::function<void(std::optional<Common::UUID>)> callback) const {this->callback = std::move(callback);emit MainWindowSelectProfile();}-void QtProfileSelector::MainWindowFinishedSelection(std::optional<Service::Account::UUID> uuid) {+void QtProfileSelector::MainWindowFinishedSelection(std::optional<Common::UUID> uuid) {// Acquire the HLE mutexstd::lock_guard lock{HLE::g_hle_lock};callback(uuid);diff --git a/src/yuzu/applets/profile_select.h b/src/yuzu/applets/profile_select.hindex 1c2922e549..c5b90a78e6 100644--- a/src/yuzu/applets/profile_select.h+++ b/src/yuzu/applets/profile_select.h@@ -9,6 +9,7 @@#include <QList>#include <QTreeView>#include "core/frontend/applets/profile_select.h"+#include "core/hle/service/acc/profile_manager.h"class GMainWindow;class QDialogButtonBox;@@ -60,14 +61,13 @@ public:explicit QtProfileSelector(GMainWindow& parent);~QtProfileSelector() override;- void SelectProfile(- std::function<void(std::optional<Service::Account::UUID>)> callback) const override;+ void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback) const override;signals:void MainWindowSelectProfile() const;private:- void MainWindowFinishedSelection(std::optional<Service::Account::UUID> uuid);+ void MainWindowFinishedSelection(std::optional<Common::UUID> uuid);- mutable std::function<void(std::optional<Service::Account::UUID>)> callback;+ mutable std::function<void(std::optional<Common::UUID>)> callback;};diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cppindex 41663e39a4..10f8ba0418 100644--- a/src/yuzu/configuration/configure_profile_manager.cpp+++ b/src/yuzu/configuration/configure_profile_manager.cpp@@ -33,14 +33,13 @@ constexpr std::array<u8, 107> backup_jpeg{0x01, 0x01, 0x00, 0x00, 0x3f, 0x00, 0xd2, 0xcf, 0x20, 0xff, 0xd9,};-QString GetImagePath(Service::Account::UUID uuid) {+QString GetImagePath(Common::UUID uuid) {const auto path = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +"/system/save/8000000000000010/su/avators/" + uuid.FormatSwitch() + ".jpg";return QString::fromStdString(path);}-QString GetAccountUsername(const Service::Account::ProfileManager& manager,- Service::Account::UUID uuid) {+QString GetAccountUsername(const Service::Account::ProfileManager& manager, Common::UUID uuid) {Service::Account::ProfileBase profile;if (!manager.GetProfileBase(uuid, profile)) {return {};@@ -51,14 +50,14 @@ QString GetAccountUsername(const Service::Account::ProfileManager& manager,return QString::fromStdString(text);}-QString FormatUserEntryText(const QString& username, Service::Account::UUID uuid) {+QString FormatUserEntryText(const QString& username, Common::UUID uuid) {return ConfigureProfileManager::tr("%1\n%2","%1 is the profile username, %2 is the formatted UUID (e.g. ""00112233-4455-6677-8899-AABBCCDDEEFF))").arg(username, QString::fromStdString(uuid.FormatSwitch()));}-QPixmap GetIcon(Service::Account::UUID uuid) {+QPixmap GetIcon(Common::UUID uuid) {QPixmap icon{GetImagePath(uuid)};if (!icon) {@@ -190,7 +189,7 @@ void ConfigureProfileManager::AddUser() {return;}- const auto uuid = Service::Account::UUID::Generate();+ const auto uuid = Common::UUID::Generate();profile_manager->CreateNewUser(uuid, username.toStdString());item_model->appendRow(new QStandardItem{GetIcon(uuid), FormatUserEntryText(username, uuid)});diff --git a/src/yuzu/main.h b/src/yuzu/main.hindex fb2a193cb8..c4566ed2cd 100644--- a/src/yuzu/main.h+++ b/src/yuzu/main.h@@ -104,7 +104,7 @@ signals:void ErrorDisplayFinished();- void ProfileSelectorFinishedSelection(std::optional<Service::Account::UUID> uuid);+ void ProfileSelectorFinishedSelection(std::optional<Common::UUID> uuid);void SoftwareKeyboardFinishedText(std::optional<std::u16string> text);void SoftwareKeyboardFinishedCheckDialog();