diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/frontend/applets/profile_select.cpp | 3 | ||||
| -rw-r--r-- | src/core/frontend/applets/profile_select.h | 16 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/applet_profile_select.cpp | 52 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/applet_profile_select.h | 102 | ||||
| -rw-r--r-- | src/yuzu/applets/qt_profile_select.cpp | 85 | ||||
| -rw-r--r-- | src/yuzu/applets/qt_profile_select.h | 11 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 30 | ||||
| -rw-r--r-- | src/yuzu/main.h | 5 |
8 files changed, 270 insertions, 34 deletions
diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cpp index 910d20c0d..c18f17a36 100644 --- a/src/core/frontend/applets/profile_select.cpp +++ b/src/core/frontend/applets/profile_select.cpp | |||
| @@ -11,7 +11,8 @@ ProfileSelectApplet::~ProfileSelectApplet() = default; | |||
| 11 | 11 | ||
| 12 | void DefaultProfileSelectApplet::Close() const {} | 12 | void DefaultProfileSelectApplet::Close() const {} |
| 13 | 13 | ||
| 14 | void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback) const { | 14 | void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback, |
| 15 | const ProfileSelectParameters& parameters) const { | ||
| 15 | Service::Account::ProfileManager manager; | 16 | Service::Account::ProfileManager manager; |
| 16 | callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{})); | 17 | callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{})); |
| 17 | LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); | 18 | 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.h index 76e963535..92e2737ea 100644 --- a/src/core/frontend/applets/profile_select.h +++ b/src/core/frontend/applets/profile_select.h | |||
| @@ -5,25 +5,35 @@ | |||
| 5 | 5 | ||
| 6 | #include <functional> | 6 | #include <functional> |
| 7 | #include <optional> | 7 | #include <optional> |
| 8 | #include "common/uuid.h" | ||
| 9 | 8 | ||
| 9 | #include "common/uuid.h" | ||
| 10 | #include "core/frontend/applets/applet.h" | 10 | #include "core/frontend/applets/applet.h" |
| 11 | #include "core/hle/service/am/applets/applet_profile_select.h" | ||
| 11 | 12 | ||
| 12 | namespace Core::Frontend { | 13 | namespace Core::Frontend { |
| 13 | 14 | ||
| 15 | struct ProfileSelectParameters { | ||
| 16 | Service::AM::Applets::UiMode mode; | ||
| 17 | std::array<Common::UUID, 8> invalid_uid_list; | ||
| 18 | Service::AM::Applets::UiSettingsDisplayOptions display_options; | ||
| 19 | Service::AM::Applets::UserSelectionPurpose purpose; | ||
| 20 | }; | ||
| 21 | |||
| 14 | class ProfileSelectApplet : public Applet { | 22 | class ProfileSelectApplet : public Applet { |
| 15 | public: | 23 | public: |
| 16 | using SelectProfileCallback = std::function<void(std::optional<Common::UUID>)>; | 24 | using SelectProfileCallback = std::function<void(std::optional<Common::UUID>)>; |
| 17 | 25 | ||
| 18 | virtual ~ProfileSelectApplet(); | 26 | virtual ~ProfileSelectApplet(); |
| 19 | 27 | ||
| 20 | virtual void SelectProfile(SelectProfileCallback callback) const = 0; | 28 | virtual void SelectProfile(SelectProfileCallback callback, |
| 29 | const ProfileSelectParameters& parameters) const = 0; | ||
| 21 | }; | 30 | }; |
| 22 | 31 | ||
| 23 | class DefaultProfileSelectApplet final : public ProfileSelectApplet { | 32 | class DefaultProfileSelectApplet final : public ProfileSelectApplet { |
| 24 | public: | 33 | public: |
| 25 | void Close() const override; | 34 | void Close() const override; |
| 26 | void SelectProfile(SelectProfileCallback callback) const override; | 35 | void SelectProfile(SelectProfileCallback callback, |
| 36 | const ProfileSelectParameters& parameters) const override; | ||
| 27 | }; | 37 | }; |
| 28 | 38 | ||
| 29 | } // namespace Core::Frontend | 39 | } // namespace Core::Frontend |
diff --git a/src/core/hle/service/am/applets/applet_profile_select.cpp b/src/core/hle/service/am/applets/applet_profile_select.cpp index 07abc2563..89cb323e9 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.cpp +++ b/src/core/hle/service/am/applets/applet_profile_select.cpp | |||
| @@ -25,13 +25,29 @@ void ProfileSelect::Initialize() { | |||
| 25 | final_data.clear(); | 25 | final_data.clear(); |
| 26 | 26 | ||
| 27 | Applet::Initialize(); | 27 | Applet::Initialize(); |
| 28 | profile_select_version = ProfileSelectAppletVersion{common_args.library_version}; | ||
| 28 | 29 | ||
| 29 | const auto user_config_storage = broker.PopNormalDataToApplet(); | 30 | const auto user_config_storage = broker.PopNormalDataToApplet(); |
| 30 | ASSERT(user_config_storage != nullptr); | 31 | ASSERT(user_config_storage != nullptr); |
| 31 | const auto& user_config = user_config_storage->GetData(); | 32 | const auto& user_config = user_config_storage->GetData(); |
| 32 | 33 | ||
| 33 | ASSERT(user_config.size() >= sizeof(UserSelectionConfig)); | 34 | LOG_INFO(Service_AM, "Initializing Profile Select Applet with version={}", |
| 34 | std::memcpy(&config, user_config.data(), sizeof(UserSelectionConfig)); | 35 | profile_select_version); |
| 36 | |||
| 37 | switch (profile_select_version) { | ||
| 38 | case ProfileSelectAppletVersion::Version1: | ||
| 39 | ASSERT(user_config.size() == sizeof(UiSettingsV1)); | ||
| 40 | std::memcpy(&config_old, user_config.data(), sizeof(UiSettingsV1)); | ||
| 41 | break; | ||
| 42 | case ProfileSelectAppletVersion::Version2: | ||
| 43 | case ProfileSelectAppletVersion::Version3: | ||
| 44 | ASSERT(user_config.size() == sizeof(UiSettings)); | ||
| 45 | std::memcpy(&config, user_config.data(), sizeof(UiSettings)); | ||
| 46 | break; | ||
| 47 | default: | ||
| 48 | UNIMPLEMENTED_MSG("Unknown profile_select_version = {}", profile_select_version); | ||
| 49 | break; | ||
| 50 | } | ||
| 35 | } | 51 | } |
| 36 | 52 | ||
| 37 | bool ProfileSelect::TransactionComplete() const { | 53 | bool ProfileSelect::TransactionComplete() const { |
| @@ -52,11 +68,37 @@ void ProfileSelect::Execute() { | |||
| 52 | return; | 68 | return; |
| 53 | } | 69 | } |
| 54 | 70 | ||
| 55 | frontend.SelectProfile([this](std::optional<Common::UUID> uuid) { SelectionComplete(uuid); }); | 71 | Core::Frontend::ProfileSelectParameters parameters{}; |
| 72 | |||
| 73 | switch (profile_select_version) { | ||
| 74 | case ProfileSelectAppletVersion::Version1: | ||
| 75 | parameters = { | ||
| 76 | .mode = config_old.mode, | ||
| 77 | .invalid_uid_list = config_old.invalid_uid_list, | ||
| 78 | .display_options = config_old.display_options, | ||
| 79 | .purpose = UserSelectionPurpose::General, | ||
| 80 | }; | ||
| 81 | break; | ||
| 82 | case ProfileSelectAppletVersion::Version2: | ||
| 83 | case ProfileSelectAppletVersion::Version3: | ||
| 84 | parameters = { | ||
| 85 | .mode = config.mode, | ||
| 86 | .invalid_uid_list = config.invalid_uid_list, | ||
| 87 | .display_options = config.display_options, | ||
| 88 | .purpose = config.purpose, | ||
| 89 | }; | ||
| 90 | break; | ||
| 91 | default: | ||
| 92 | UNIMPLEMENTED_MSG("Unknown profile_select_version = {}", profile_select_version); | ||
| 93 | break; | ||
| 94 | } | ||
| 95 | |||
| 96 | frontend.SelectProfile([this](std::optional<Common::UUID> uuid) { SelectionComplete(uuid); }, | ||
| 97 | parameters); | ||
| 56 | } | 98 | } |
| 57 | 99 | ||
| 58 | void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) { | 100 | void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) { |
| 59 | UserSelectionOutput output{}; | 101 | UiReturnArg output{}; |
| 60 | 102 | ||
| 61 | if (uuid.has_value() && uuid->IsValid()) { | 103 | if (uuid.has_value() && uuid->IsValid()) { |
| 62 | output.result = 0; | 104 | output.result = 0; |
| @@ -67,7 +109,7 @@ void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) { | |||
| 67 | output.uuid_selected = Common::InvalidUUID; | 109 | output.uuid_selected = Common::InvalidUUID; |
| 68 | } | 110 | } |
| 69 | 111 | ||
| 70 | final_data = std::vector<u8>(sizeof(UserSelectionOutput)); | 112 | final_data = std::vector<u8>(sizeof(UiReturnArg)); |
| 71 | std::memcpy(final_data.data(), &output, final_data.size()); | 113 | std::memcpy(final_data.data(), &output, final_data.size()); |
| 72 | broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(final_data))); | 114 | broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(final_data))); |
| 73 | broker.SignalStateChanged(); | 115 | broker.SignalStateChanged(); |
diff --git a/src/core/hle/service/am/applets/applet_profile_select.h b/src/core/hle/service/am/applets/applet_profile_select.h index 85705c216..369f9250f 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.h +++ b/src/core/hle/service/am/applets/applet_profile_select.h | |||
| @@ -16,19 +16,100 @@ class System; | |||
| 16 | 16 | ||
| 17 | namespace Service::AM::Applets { | 17 | namespace Service::AM::Applets { |
| 18 | 18 | ||
| 19 | struct UserSelectionConfig { | 19 | enum class ProfileSelectAppletVersion : u32 { |
| 20 | // TODO(DarkLordZach): RE this structure | 20 | Version1 = 0x1, // 1.0.0+ |
| 21 | // It seems to be flags and the like that determine the UI of the applet on the switch... from | 21 | Version2 = 0x10000, // 2.0.0+ |
| 22 | // my research this is safe to ignore for now. | 22 | Version3 = 0x20000, // 6.0.0+ |
| 23 | INSERT_PADDING_BYTES(0xA0); | ||
| 24 | }; | 23 | }; |
| 25 | static_assert(sizeof(UserSelectionConfig) == 0xA0, "UserSelectionConfig has incorrect size."); | ||
| 26 | 24 | ||
| 27 | struct UserSelectionOutput { | 25 | // This is nn::account::UiMode |
| 26 | enum class UiMode { | ||
| 27 | UserSelector, | ||
| 28 | UserCreator, | ||
| 29 | EnsureNetworkServiceAccountAvailable, | ||
| 30 | UserIconEditor, | ||
| 31 | UserNicknameEditor, | ||
| 32 | UserCreatorForStarter, | ||
| 33 | NintendoAccountAuthorizationRequestContext, | ||
| 34 | IntroduceExternalNetworkServiceAccount, | ||
| 35 | IntroduceExternalNetworkServiceAccountForRegistration, | ||
| 36 | NintendoAccountNnidLinker, | ||
| 37 | LicenseRequirementsForNetworkService, | ||
| 38 | LicenseRequirementsForNetworkServiceWithUserContextImpl, | ||
| 39 | UserCreatorForImmediateNaLoginTest, | ||
| 40 | UserQualificationPromoter, | ||
| 41 | }; | ||
| 42 | |||
| 43 | // This is nn::account::UserSelectionPurpose | ||
| 44 | enum class UserSelectionPurpose { | ||
| 45 | General, | ||
| 46 | GameCardRegistration, | ||
| 47 | EShopLaunch, | ||
| 48 | EShopItemShow, | ||
| 49 | PicturePost, | ||
| 50 | NintendoAccountLinkage, | ||
| 51 | SettingsUpdate, | ||
| 52 | SaveDataDeletion, | ||
| 53 | UserMigration, | ||
| 54 | SaveDataTransfer, | ||
| 55 | }; | ||
| 56 | |||
| 57 | // This is nn::account::NintendoAccountStartupDialogType | ||
| 58 | enum class NintendoAccountStartupDialogType { | ||
| 59 | LoginAndCreate, | ||
| 60 | Login, | ||
| 61 | Create, | ||
| 62 | }; | ||
| 63 | |||
| 64 | // This is nn::account::UserSelectionSettingsForSystemService | ||
| 65 | struct UserSelectionSettingsForSystemService { | ||
| 66 | UserSelectionPurpose purpose; | ||
| 67 | bool enable_user_creation; | ||
| 68 | INSERT_PADDING_BYTES(0x3); | ||
| 69 | }; | ||
| 70 | static_assert(sizeof(UserSelectionSettingsForSystemService) == 0x8, | ||
| 71 | "UserSelectionSettingsForSystemService has incorrect size."); | ||
| 72 | |||
| 73 | struct UiSettingsDisplayOptions { | ||
| 74 | bool is_network_service_account_required; | ||
| 75 | bool is_skip_enabled; | ||
| 76 | bool is_system_or_launcher; | ||
| 77 | bool is_registration_permitted; | ||
| 78 | bool show_skip_button; | ||
| 79 | bool aditional_select; | ||
| 80 | bool show_user_selector; | ||
| 81 | bool is_unqualified_user_selectable; | ||
| 82 | }; | ||
| 83 | static_assert(sizeof(UiSettingsDisplayOptions) == 0x8, | ||
| 84 | "UiSettingsDisplayOptions has incorrect size."); | ||
| 85 | |||
| 86 | struct UiSettingsV1 { | ||
| 87 | UiMode mode; | ||
| 88 | INSERT_PADDING_BYTES(0x4); | ||
| 89 | std::array<Common::UUID, 8> invalid_uid_list; | ||
| 90 | u64 application_id; | ||
| 91 | UiSettingsDisplayOptions display_options; | ||
| 92 | }; | ||
| 93 | static_assert(sizeof(UiSettingsV1) == 0x98, "UiSettings has incorrect size."); | ||
| 94 | |||
| 95 | // This is nn::account::UiSettings | ||
| 96 | struct UiSettings { | ||
| 97 | UiMode mode; | ||
| 98 | INSERT_PADDING_BYTES(0x4); | ||
| 99 | std::array<Common::UUID, 8> invalid_uid_list; | ||
| 100 | u64 application_id; | ||
| 101 | UiSettingsDisplayOptions display_options; | ||
| 102 | UserSelectionPurpose purpose; | ||
| 103 | INSERT_PADDING_BYTES(0x4); | ||
| 104 | }; | ||
| 105 | static_assert(sizeof(UiSettings) == 0xA0, "UiSettings has incorrect size."); | ||
| 106 | |||
| 107 | // This is nn::account::UiReturnArg | ||
| 108 | struct UiReturnArg { | ||
| 28 | u64 result; | 109 | u64 result; |
| 29 | Common::UUID uuid_selected; | 110 | Common::UUID uuid_selected; |
| 30 | }; | 111 | }; |
| 31 | static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has incorrect size."); | 112 | static_assert(sizeof(UiReturnArg) == 0x18, "UiReturnArg has incorrect size."); |
| 32 | 113 | ||
| 33 | class ProfileSelect final : public Applet { | 114 | class ProfileSelect final : public Applet { |
| 34 | public: | 115 | public: |
| @@ -49,7 +130,10 @@ public: | |||
| 49 | private: | 130 | private: |
| 50 | const Core::Frontend::ProfileSelectApplet& frontend; | 131 | const Core::Frontend::ProfileSelectApplet& frontend; |
| 51 | 132 | ||
| 52 | UserSelectionConfig config; | 133 | UiSettings config; |
| 134 | UiSettingsV1 config_old; | ||
| 135 | ProfileSelectAppletVersion profile_select_version; | ||
| 136 | |||
| 53 | bool complete = false; | 137 | bool complete = false; |
| 54 | Result status = ResultSuccess; | 138 | Result status = ResultSuccess; |
| 55 | std::vector<u8> final_data; | 139 | std::vector<u8> final_data; |
diff --git a/src/yuzu/applets/qt_profile_select.cpp b/src/yuzu/applets/qt_profile_select.cpp index c0a1d5ab7..2448e46b6 100644 --- a/src/yuzu/applets/qt_profile_select.cpp +++ b/src/yuzu/applets/qt_profile_select.cpp | |||
| @@ -46,11 +46,13 @@ QPixmap GetIcon(Common::UUID uuid) { | |||
| 46 | } | 46 | } |
| 47 | } // Anonymous namespace | 47 | } // Anonymous namespace |
| 48 | 48 | ||
| 49 | QtProfileSelectionDialog::QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, QWidget* parent) | 49 | QtProfileSelectionDialog::QtProfileSelectionDialog( |
| 50 | Core::HID::HIDCore& hid_core, QWidget* parent, | ||
| 51 | const Core::Frontend::ProfileSelectParameters& parameters) | ||
| 50 | : QDialog(parent), profile_manager(std::make_unique<Service::Account::ProfileManager>()) { | 52 | : QDialog(parent), profile_manager(std::make_unique<Service::Account::ProfileManager>()) { |
| 51 | outer_layout = new QVBoxLayout; | 53 | outer_layout = new QVBoxLayout; |
| 52 | 54 | ||
| 53 | instruction_label = new QLabel(tr("Select a user:")); | 55 | instruction_label = new QLabel(); |
| 54 | 56 | ||
| 55 | scroll_area = new QScrollArea; | 57 | scroll_area = new QScrollArea; |
| 56 | 58 | ||
| @@ -120,7 +122,8 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, | |||
| 120 | item_model->appendRow(item); | 122 | item_model->appendRow(item); |
| 121 | 123 | ||
| 122 | setLayout(outer_layout); | 124 | setLayout(outer_layout); |
| 123 | setWindowTitle(tr("Profile Selector")); | 125 | SetWindowTitle(parameters); |
| 126 | SetDialogPurpose(parameters); | ||
| 124 | resize(550, 400); | 127 | resize(550, 400); |
| 125 | } | 128 | } |
| 126 | 129 | ||
| @@ -154,6 +157,76 @@ void QtProfileSelectionDialog::SelectUser(const QModelIndex& index) { | |||
| 154 | user_index = index.row(); | 157 | user_index = index.row(); |
| 155 | } | 158 | } |
| 156 | 159 | ||
| 160 | void QtProfileSelectionDialog::SetWindowTitle( | ||
| 161 | const Core::Frontend::ProfileSelectParameters& parameters) { | ||
| 162 | using Service::AM::Applets::UiMode; | ||
| 163 | switch (parameters.mode) { | ||
| 164 | case UiMode::UserCreator: | ||
| 165 | case UiMode::UserCreatorForStarter: | ||
| 166 | setWindowTitle(tr("Profile Creator")); | ||
| 167 | return; | ||
| 168 | case UiMode::EnsureNetworkServiceAccountAvailable: | ||
| 169 | setWindowTitle(tr("Profile Selector")); | ||
| 170 | return; | ||
| 171 | case UiMode::UserIconEditor: | ||
| 172 | setWindowTitle(tr("Profile Icon Editor")); | ||
| 173 | return; | ||
| 174 | case UiMode::UserNicknameEditor: | ||
| 175 | setWindowTitle(tr("Profile Nickname Editor")); | ||
| 176 | return; | ||
| 177 | case UiMode::NintendoAccountAuthorizationRequestContext: | ||
| 178 | case UiMode::IntroduceExternalNetworkServiceAccount: | ||
| 179 | case UiMode::IntroduceExternalNetworkServiceAccountForRegistration: | ||
| 180 | case UiMode::NintendoAccountNnidLinker: | ||
| 181 | case UiMode::LicenseRequirementsForNetworkService: | ||
| 182 | case UiMode::LicenseRequirementsForNetworkServiceWithUserContextImpl: | ||
| 183 | case UiMode::UserCreatorForImmediateNaLoginTest: | ||
| 184 | case UiMode::UserQualificationPromoter: | ||
| 185 | case UiMode::UserSelector: | ||
| 186 | default: | ||
| 187 | setWindowTitle(tr("Profile Selector")); | ||
| 188 | } | ||
| 189 | } | ||
| 190 | |||
| 191 | void QtProfileSelectionDialog::SetDialogPurpose( | ||
| 192 | const Core::Frontend::ProfileSelectParameters& parameters) { | ||
| 193 | using Service::AM::Applets::UserSelectionPurpose; | ||
| 194 | |||
| 195 | switch (parameters.purpose) { | ||
| 196 | case UserSelectionPurpose::GameCardRegistration: | ||
| 197 | instruction_label->setText(tr("Who will receive the points?")); | ||
| 198 | return; | ||
| 199 | case UserSelectionPurpose::EShopLaunch: | ||
| 200 | instruction_label->setText(tr("Who is using Nintendo eShop?")); | ||
| 201 | return; | ||
| 202 | case UserSelectionPurpose::EShopItemShow: | ||
| 203 | instruction_label->setText(tr("Who is making this purchase?")); | ||
| 204 | return; | ||
| 205 | case UserSelectionPurpose::PicturePost: | ||
| 206 | instruction_label->setText(tr("Who is posting?")); | ||
| 207 | return; | ||
| 208 | case UserSelectionPurpose::NintendoAccountLinkage: | ||
| 209 | instruction_label->setText(tr("Select a user to link to a Nintendo Account.")); | ||
| 210 | return; | ||
| 211 | case UserSelectionPurpose::SettingsUpdate: | ||
| 212 | instruction_label->setText(tr("Change settings for which user?")); | ||
| 213 | return; | ||
| 214 | case UserSelectionPurpose::SaveDataDeletion: | ||
| 215 | instruction_label->setText(tr("Format data for which user?")); | ||
| 216 | return; | ||
| 217 | case UserSelectionPurpose::UserMigration: | ||
| 218 | instruction_label->setText(tr("Which user will be transferred to another console?")); | ||
| 219 | return; | ||
| 220 | case UserSelectionPurpose::SaveDataTransfer: | ||
| 221 | instruction_label->setText(tr("Send save data for which user?")); | ||
| 222 | return; | ||
| 223 | case UserSelectionPurpose::General: | ||
| 224 | default: | ||
| 225 | instruction_label->setText(tr("Select a user:")); | ||
| 226 | return; | ||
| 227 | } | ||
| 228 | } | ||
| 229 | |||
| 157 | QtProfileSelector::QtProfileSelector(GMainWindow& parent) { | 230 | QtProfileSelector::QtProfileSelector(GMainWindow& parent) { |
| 158 | connect(this, &QtProfileSelector::MainWindowSelectProfile, &parent, | 231 | connect(this, &QtProfileSelector::MainWindowSelectProfile, &parent, |
| 159 | &GMainWindow::ProfileSelectorSelectProfile, Qt::QueuedConnection); | 232 | &GMainWindow::ProfileSelectorSelectProfile, Qt::QueuedConnection); |
| @@ -170,9 +243,11 @@ void QtProfileSelector::Close() const { | |||
| 170 | emit MainWindowRequestExit(); | 243 | emit MainWindowRequestExit(); |
| 171 | } | 244 | } |
| 172 | 245 | ||
| 173 | void QtProfileSelector::SelectProfile(SelectProfileCallback callback_) const { | 246 | void QtProfileSelector::SelectProfile( |
| 247 | SelectProfileCallback callback_, | ||
| 248 | const Core::Frontend::ProfileSelectParameters& parameters) const { | ||
| 174 | callback = std::move(callback_); | 249 | callback = std::move(callback_); |
| 175 | emit MainWindowSelectProfile(); | 250 | emit MainWindowSelectProfile(parameters); |
| 176 | } | 251 | } |
| 177 | 252 | ||
| 178 | void QtProfileSelector::MainWindowFinishedSelection(std::optional<Common::UUID> uuid) { | 253 | void QtProfileSelector::MainWindowFinishedSelection(std::optional<Common::UUID> uuid) { |
diff --git a/src/yuzu/applets/qt_profile_select.h b/src/yuzu/applets/qt_profile_select.h index 9f214d071..99056e274 100644 --- a/src/yuzu/applets/qt_profile_select.h +++ b/src/yuzu/applets/qt_profile_select.h | |||
| @@ -28,7 +28,8 @@ class QtProfileSelectionDialog final : public QDialog { | |||
| 28 | Q_OBJECT | 28 | Q_OBJECT |
| 29 | 29 | ||
| 30 | public: | 30 | public: |
| 31 | explicit QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, QWidget* parent); | 31 | explicit QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, QWidget* parent, |
| 32 | const Core::Frontend::ProfileSelectParameters& parameters); | ||
| 32 | ~QtProfileSelectionDialog() override; | 33 | ~QtProfileSelectionDialog() override; |
| 33 | 34 | ||
| 34 | int exec() override; | 35 | int exec() override; |
| @@ -40,6 +41,9 @@ public: | |||
| 40 | private: | 41 | private: |
| 41 | void SelectUser(const QModelIndex& index); | 42 | void SelectUser(const QModelIndex& index); |
| 42 | 43 | ||
| 44 | void SetWindowTitle(const Core::Frontend::ProfileSelectParameters& parameters); | ||
| 45 | void SetDialogPurpose(const Core::Frontend::ProfileSelectParameters& parameters); | ||
| 46 | |||
| 43 | int user_index = 0; | 47 | int user_index = 0; |
| 44 | 48 | ||
| 45 | QVBoxLayout* layout; | 49 | QVBoxLayout* layout; |
| @@ -66,10 +70,11 @@ public: | |||
| 66 | ~QtProfileSelector() override; | 70 | ~QtProfileSelector() override; |
| 67 | 71 | ||
| 68 | void Close() const override; | 72 | void Close() const override; |
| 69 | void SelectProfile(SelectProfileCallback callback_) const override; | 73 | void SelectProfile(SelectProfileCallback callback_, |
| 74 | const Core::Frontend::ProfileSelectParameters& parameters) const override; | ||
| 70 | 75 | ||
| 71 | signals: | 76 | signals: |
| 72 | void MainWindowSelectProfile() const; | 77 | void MainWindowSelectProfile(const Core::Frontend::ProfileSelectParameters& parameters) const; |
| 73 | void MainWindowRequestExit() const; | 78 | void MainWindowRequestExit() const; |
| 74 | 79 | ||
| 75 | private: | 80 | private: |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 0c60a90cb..136935259 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -576,6 +576,10 @@ void GMainWindow::RegisterMetaTypes() { | |||
| 576 | // Controller Applet | 576 | // Controller Applet |
| 577 | qRegisterMetaType<Core::Frontend::ControllerParameters>("Core::Frontend::ControllerParameters"); | 577 | qRegisterMetaType<Core::Frontend::ControllerParameters>("Core::Frontend::ControllerParameters"); |
| 578 | 578 | ||
| 579 | // Profile Select Applet | ||
| 580 | qRegisterMetaType<Core::Frontend::ProfileSelectParameters>( | ||
| 581 | "Core::Frontend::ProfileSelectParameters"); | ||
| 582 | |||
| 579 | // Software Keyboard Applet | 583 | // Software Keyboard Applet |
| 580 | qRegisterMetaType<Core::Frontend::KeyboardInitializeParameters>( | 584 | qRegisterMetaType<Core::Frontend::KeyboardInitializeParameters>( |
| 581 | "Core::Frontend::KeyboardInitializeParameters"); | 585 | "Core::Frontend::KeyboardInitializeParameters"); |
| @@ -651,8 +655,9 @@ void GMainWindow::ControllerSelectorRequestExit() { | |||
| 651 | } | 655 | } |
| 652 | } | 656 | } |
| 653 | 657 | ||
| 654 | void GMainWindow::ProfileSelectorSelectProfile() { | 658 | void GMainWindow::ProfileSelectorSelectProfile( |
| 655 | profile_select_applet = new QtProfileSelectionDialog(system->HIDCore(), this); | 659 | const Core::Frontend::ProfileSelectParameters& parameters) { |
| 660 | profile_select_applet = new QtProfileSelectionDialog(system->HIDCore(), this, parameters); | ||
| 656 | SCOPE_EXIT({ | 661 | SCOPE_EXIT({ |
| 657 | profile_select_applet->deleteLater(); | 662 | profile_select_applet->deleteLater(); |
| 658 | profile_select_applet = nullptr; | 663 | profile_select_applet = nullptr; |
| @@ -1719,8 +1724,9 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p | |||
| 1719 | return true; | 1724 | return true; |
| 1720 | } | 1725 | } |
| 1721 | 1726 | ||
| 1722 | bool GMainWindow::SelectAndSetCurrentUser() { | 1727 | bool GMainWindow::SelectAndSetCurrentUser( |
| 1723 | QtProfileSelectionDialog dialog(system->HIDCore(), this); | 1728 | const Core::Frontend::ProfileSelectParameters& parameters) { |
| 1729 | QtProfileSelectionDialog dialog(system->HIDCore(), this, parameters); | ||
| 1724 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | | 1730 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | |
| 1725 | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); | 1731 | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); |
| 1726 | dialog.setWindowModality(Qt::WindowModal); | 1732 | dialog.setWindowModality(Qt::WindowModal); |
| @@ -1766,7 +1772,13 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t | |||
| 1766 | Settings::LogSettings(); | 1772 | Settings::LogSettings(); |
| 1767 | 1773 | ||
| 1768 | if (UISettings::values.select_user_on_boot) { | 1774 | if (UISettings::values.select_user_on_boot) { |
| 1769 | if (SelectAndSetCurrentUser() == false) { | 1775 | const Core::Frontend::ProfileSelectParameters parameters{ |
| 1776 | .mode = Service::AM::Applets::UiMode::UserSelector, | ||
| 1777 | .invalid_uid_list = {}, | ||
| 1778 | .display_options = {}, | ||
| 1779 | .purpose = Service::AM::Applets::UserSelectionPurpose::General, | ||
| 1780 | }; | ||
| 1781 | if (SelectAndSetCurrentUser(parameters) == false) { | ||
| 1770 | return; | 1782 | return; |
| 1771 | } | 1783 | } |
| 1772 | } | 1784 | } |
| @@ -2058,7 +2070,13 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target | |||
| 2058 | if (has_user_save) { | 2070 | if (has_user_save) { |
| 2059 | // User save data | 2071 | // User save data |
| 2060 | const auto select_profile = [this] { | 2072 | const auto select_profile = [this] { |
| 2061 | QtProfileSelectionDialog dialog(system->HIDCore(), this); | 2073 | const Core::Frontend::ProfileSelectParameters parameters{ |
| 2074 | .mode = Service::AM::Applets::UiMode::UserSelector, | ||
| 2075 | .invalid_uid_list = {}, | ||
| 2076 | .display_options = {}, | ||
| 2077 | .purpose = Service::AM::Applets::UserSelectionPurpose::General, | ||
| 2078 | }; | ||
| 2079 | QtProfileSelectionDialog dialog(system->HIDCore(), this, parameters); | ||
| 2062 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | | 2080 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | |
| 2063 | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); | 2081 | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); |
| 2064 | dialog.setWindowModality(Qt::WindowModal); | 2082 | dialog.setWindowModality(Qt::WindowModal); |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index a99938eaa..2f16e0b1c 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -69,6 +69,7 @@ struct ControllerParameters; | |||
| 69 | struct InlineAppearParameters; | 69 | struct InlineAppearParameters; |
| 70 | struct InlineTextParameters; | 70 | struct InlineTextParameters; |
| 71 | struct KeyboardInitializeParameters; | 71 | struct KeyboardInitializeParameters; |
| 72 | struct ProfileSelectParameters; | ||
| 72 | } // namespace Core::Frontend | 73 | } // namespace Core::Frontend |
| 73 | 74 | ||
| 74 | namespace DiscordRPC { | 75 | namespace DiscordRPC { |
| @@ -203,7 +204,7 @@ public slots: | |||
| 203 | void SoftwareKeyboardExit(); | 204 | void SoftwareKeyboardExit(); |
| 204 | void ErrorDisplayDisplayError(QString error_code, QString error_text); | 205 | void ErrorDisplayDisplayError(QString error_code, QString error_text); |
| 205 | void ErrorDisplayRequestExit(); | 206 | void ErrorDisplayRequestExit(); |
| 206 | void ProfileSelectorSelectProfile(); | 207 | void ProfileSelectorSelectProfile(const Core::Frontend::ProfileSelectParameters& parameters); |
| 207 | void ProfileSelectorRequestExit(); | 208 | void ProfileSelectorRequestExit(); |
| 208 | void WebBrowserOpenWebPage(const std::string& main_url, const std::string& additional_args, | 209 | void WebBrowserOpenWebPage(const std::string& main_url, const std::string& additional_args, |
| 209 | bool is_local); | 210 | bool is_local); |
| @@ -242,7 +243,7 @@ private: | |||
| 242 | void SetDiscordEnabled(bool state); | 243 | void SetDiscordEnabled(bool state); |
| 243 | void LoadAmiibo(const QString& filename); | 244 | void LoadAmiibo(const QString& filename); |
| 244 | 245 | ||
| 245 | bool SelectAndSetCurrentUser(); | 246 | bool SelectAndSetCurrentUser(const Core::Frontend::ProfileSelectParameters& parameters); |
| 246 | 247 | ||
| 247 | /** | 248 | /** |
| 248 | * Stores the filename in the recently loaded files list. | 249 | * Stores the filename in the recently loaded files list. |