diff options
Diffstat (limited to 'src')
29 files changed, 719 insertions, 629 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 1d4e92edb..a6f442316 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -122,8 +122,8 @@ add_library(core STATIC | |||
| 122 | frontend/applets/error.h | 122 | frontend/applets/error.h |
| 123 | frontend/applets/general_frontend.cpp | 123 | frontend/applets/general_frontend.cpp |
| 124 | frontend/applets/general_frontend.h | 124 | frontend/applets/general_frontend.h |
| 125 | frontend/applets/mii.cpp | 125 | frontend/applets/mii_edit.cpp |
| 126 | frontend/applets/mii.h | 126 | frontend/applets/mii_edit.h |
| 127 | frontend/applets/profile_select.cpp | 127 | frontend/applets/profile_select.cpp |
| 128 | frontend/applets/profile_select.h | 128 | frontend/applets/profile_select.h |
| 129 | frontend/applets/software_keyboard.cpp | 129 | frontend/applets/software_keyboard.cpp |
| @@ -306,8 +306,9 @@ add_library(core STATIC | |||
| 306 | hle/service/am/applets/applet_error.h | 306 | hle/service/am/applets/applet_error.h |
| 307 | hle/service/am/applets/applet_general_backend.cpp | 307 | hle/service/am/applets/applet_general_backend.cpp |
| 308 | hle/service/am/applets/applet_general_backend.h | 308 | hle/service/am/applets/applet_general_backend.h |
| 309 | hle/service/am/applets/applet_mii.cpp | 309 | hle/service/am/applets/applet_mii_edit.cpp |
| 310 | hle/service/am/applets/applet_mii.h | 310 | hle/service/am/applets/applet_mii_edit.h |
| 311 | hle/service/am/applets/applet_mii_edit_types.h | ||
| 311 | hle/service/am/applets/applet_profile_select.cpp | 312 | hle/service/am/applets/applet_profile_select.cpp |
| 312 | hle/service/am/applets/applet_profile_select.h | 313 | hle/service/am/applets/applet_profile_select.h |
| 313 | hle/service/am/applets/applet_software_keyboard.cpp | 314 | hle/service/am/applets/applet_software_keyboard.cpp |
diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp index c1c843b8f..286976623 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp | |||
| @@ -148,8 +148,8 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable* | |||
| 148 | config.wall_clock_cntpct = uses_wall_clock; | 148 | config.wall_clock_cntpct = uses_wall_clock; |
| 149 | 149 | ||
| 150 | // Code cache size | 150 | // Code cache size |
| 151 | config.code_cache_size = 128_MiB; | 151 | config.code_cache_size = 512_MiB; |
| 152 | config.far_code_offset = 100_MiB; | 152 | config.far_code_offset = 400_MiB; |
| 153 | 153 | ||
| 154 | // Safe optimizations | 154 | // Safe optimizations |
| 155 | if (Settings::values.cpu_debug_mode) { | 155 | if (Settings::values.cpu_debug_mode) { |
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index aa74fce4d..d96226c41 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp | |||
| @@ -208,8 +208,8 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable* | |||
| 208 | config.wall_clock_cntpct = uses_wall_clock; | 208 | config.wall_clock_cntpct = uses_wall_clock; |
| 209 | 209 | ||
| 210 | // Code cache size | 210 | // Code cache size |
| 211 | config.code_cache_size = 128_MiB; | 211 | config.code_cache_size = 512_MiB; |
| 212 | config.far_code_offset = 100_MiB; | 212 | config.far_code_offset = 400_MiB; |
| 213 | 213 | ||
| 214 | // Safe optimizations | 214 | // Safe optimizations |
| 215 | if (Settings::values.cpu_debug_mode) { | 215 | if (Settings::values.cpu_debug_mode) { |
diff --git a/src/core/frontend/applets/mii.cpp b/src/core/frontend/applets/mii.cpp deleted file mode 100644 index 1c05ff412..000000000 --- a/src/core/frontend/applets/mii.cpp +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | // Copyright 2022 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/logging/log.h" | ||
| 6 | #include "core/frontend/applets/mii.h" | ||
| 7 | |||
| 8 | namespace Core::Frontend { | ||
| 9 | |||
| 10 | MiiApplet::~MiiApplet() = default; | ||
| 11 | |||
| 12 | void DefaultMiiApplet::ShowMii( | ||
| 13 | const MiiParameters& parameters, | ||
| 14 | const std::function<void(const Core::Frontend::MiiParameters& parameters)> callback) const { | ||
| 15 | LOG_INFO(Service_HID, "(STUBBED) called"); | ||
| 16 | callback(parameters); | ||
| 17 | } | ||
| 18 | |||
| 19 | } // namespace Core::Frontend | ||
diff --git a/src/core/frontend/applets/mii.h b/src/core/frontend/applets/mii.h deleted file mode 100644 index 11ba8a359..000000000 --- a/src/core/frontend/applets/mii.h +++ /dev/null | |||
| @@ -1,34 +0,0 @@ | |||
| 1 | // Copyright 2022 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <functional> | ||
| 8 | |||
| 9 | #include "core/hle/service/mii/mii_manager.h" | ||
| 10 | |||
| 11 | namespace Core::Frontend { | ||
| 12 | |||
| 13 | struct MiiParameters { | ||
| 14 | bool is_editable; | ||
| 15 | Service::Mii::MiiInfo mii_data{}; | ||
| 16 | }; | ||
| 17 | |||
| 18 | class MiiApplet { | ||
| 19 | public: | ||
| 20 | virtual ~MiiApplet(); | ||
| 21 | |||
| 22 | virtual void ShowMii(const MiiParameters& parameters, | ||
| 23 | const std::function<void(const Core::Frontend::MiiParameters& parameters)> | ||
| 24 | callback) const = 0; | ||
| 25 | }; | ||
| 26 | |||
| 27 | class DefaultMiiApplet final : public MiiApplet { | ||
| 28 | public: | ||
| 29 | void ShowMii(const MiiParameters& parameters, | ||
| 30 | const std::function<void(const Core::Frontend::MiiParameters& parameters)> | ||
| 31 | callback) const override; | ||
| 32 | }; | ||
| 33 | |||
| 34 | } // namespace Core::Frontend | ||
diff --git a/src/core/frontend/applets/mii_edit.cpp b/src/core/frontend/applets/mii_edit.cpp new file mode 100644 index 000000000..fadb5fb15 --- /dev/null +++ b/src/core/frontend/applets/mii_edit.cpp | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | // Copyright 2022 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/logging/log.h" | ||
| 6 | #include "core/frontend/applets/mii_edit.h" | ||
| 7 | |||
| 8 | namespace Core::Frontend { | ||
| 9 | |||
| 10 | MiiEditApplet::~MiiEditApplet() = default; | ||
| 11 | |||
| 12 | void DefaultMiiEditApplet::ShowMiiEdit(const std::function<void()>& callback) const { | ||
| 13 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 14 | |||
| 15 | callback(); | ||
| 16 | } | ||
| 17 | |||
| 18 | } // namespace Core::Frontend | ||
diff --git a/src/core/frontend/applets/mii_edit.h b/src/core/frontend/applets/mii_edit.h new file mode 100644 index 000000000..cca0e931d --- /dev/null +++ b/src/core/frontend/applets/mii_edit.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | // Copyright 2022 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <functional> | ||
| 8 | |||
| 9 | namespace Core::Frontend { | ||
| 10 | |||
| 11 | class MiiEditApplet { | ||
| 12 | public: | ||
| 13 | virtual ~MiiEditApplet(); | ||
| 14 | |||
| 15 | virtual void ShowMiiEdit(const std::function<void()>& callback) const = 0; | ||
| 16 | }; | ||
| 17 | |||
| 18 | class DefaultMiiEditApplet final : public MiiEditApplet { | ||
| 19 | public: | ||
| 20 | void ShowMiiEdit(const std::function<void()>& callback) const override; | ||
| 21 | }; | ||
| 22 | |||
| 23 | } // namespace Core::Frontend | ||
diff --git a/src/core/hle/service/am/applets/applet_mii.cpp b/src/core/hle/service/am/applets/applet_mii.cpp deleted file mode 100644 index facede97e..000000000 --- a/src/core/hle/service/am/applets/applet_mii.cpp +++ /dev/null | |||
| @@ -1,100 +0,0 @@ | |||
| 1 | // Copyright 2022 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/assert.h" | ||
| 6 | #include "common/logging/log.h" | ||
| 7 | #include "core/core.h" | ||
| 8 | #include "core/frontend/applets/mii.h" | ||
| 9 | #include "core/hle/service/am/am.h" | ||
| 10 | #include "core/hle/service/am/applets/applet_mii.h" | ||
| 11 | |||
| 12 | namespace Service::AM::Applets { | ||
| 13 | |||
| 14 | Mii::Mii(Core::System& system_, LibraryAppletMode applet_mode_, | ||
| 15 | const Core::Frontend::MiiApplet& frontend_) | ||
| 16 | : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} | ||
| 17 | |||
| 18 | Mii::~Mii() = default; | ||
| 19 | |||
| 20 | void Mii::Initialize() { | ||
| 21 | is_complete = false; | ||
| 22 | |||
| 23 | const auto storage = broker.PopNormalDataToApplet(); | ||
| 24 | ASSERT(storage != nullptr); | ||
| 25 | |||
| 26 | const auto data = storage->GetData(); | ||
| 27 | ASSERT(data.size() == sizeof(MiiAppletInput)); | ||
| 28 | |||
| 29 | std::memcpy(&input_data, data.data(), sizeof(MiiAppletInput)); | ||
| 30 | } | ||
| 31 | |||
| 32 | bool Mii::TransactionComplete() const { | ||
| 33 | return is_complete; | ||
| 34 | } | ||
| 35 | |||
| 36 | ResultCode Mii::GetStatus() const { | ||
| 37 | return ResultSuccess; | ||
| 38 | } | ||
| 39 | |||
| 40 | void Mii::ExecuteInteractive() { | ||
| 41 | UNREACHABLE_MSG("Unexpected interactive applet data!"); | ||
| 42 | } | ||
| 43 | |||
| 44 | void Mii::Execute() { | ||
| 45 | if (is_complete) { | ||
| 46 | return; | ||
| 47 | } | ||
| 48 | |||
| 49 | const auto callback = [this](const Core::Frontend::MiiParameters& parameters) { | ||
| 50 | DisplayCompleted(parameters); | ||
| 51 | }; | ||
| 52 | |||
| 53 | switch (input_data.applet_mode) { | ||
| 54 | case MiiAppletMode::ShowMiiEdit: { | ||
| 55 | Service::Mii::MiiManager manager; | ||
| 56 | Core::Frontend::MiiParameters params{ | ||
| 57 | .is_editable = false, | ||
| 58 | .mii_data = input_data.mii_char_info.mii_data, | ||
| 59 | }; | ||
| 60 | frontend.ShowMii(params, callback); | ||
| 61 | break; | ||
| 62 | } | ||
| 63 | case MiiAppletMode::EditMii: { | ||
| 64 | Service::Mii::MiiManager manager; | ||
| 65 | Core::Frontend::MiiParameters params{ | ||
| 66 | .is_editable = true, | ||
| 67 | .mii_data = input_data.mii_char_info.mii_data, | ||
| 68 | }; | ||
| 69 | frontend.ShowMii(params, callback); | ||
| 70 | break; | ||
| 71 | } | ||
| 72 | case MiiAppletMode::CreateMii: { | ||
| 73 | Service::Mii::MiiManager manager; | ||
| 74 | Core::Frontend::MiiParameters params{ | ||
| 75 | .is_editable = true, | ||
| 76 | .mii_data = manager.BuildDefault(0), | ||
| 77 | }; | ||
| 78 | frontend.ShowMii(params, callback); | ||
| 79 | break; | ||
| 80 | } | ||
| 81 | default: | ||
| 82 | UNIMPLEMENTED_MSG("Unimplemented LibAppletMiiEdit mode={:02X}!", input_data.applet_mode); | ||
| 83 | } | ||
| 84 | } | ||
| 85 | |||
| 86 | void Mii::DisplayCompleted(const Core::Frontend::MiiParameters& parameters) { | ||
| 87 | is_complete = true; | ||
| 88 | |||
| 89 | std::vector<u8> reply(sizeof(AppletOutputForCharInfoEditing)); | ||
| 90 | output_data = { | ||
| 91 | .result = ResultSuccess, | ||
| 92 | .mii_data = parameters.mii_data, | ||
| 93 | }; | ||
| 94 | |||
| 95 | std::memcpy(reply.data(), &output_data, sizeof(AppletOutputForCharInfoEditing)); | ||
| 96 | broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(reply))); | ||
| 97 | broker.SignalStateChanged(); | ||
| 98 | } | ||
| 99 | |||
| 100 | } // namespace Service::AM::Applets | ||
diff --git a/src/core/hle/service/am/applets/applet_mii.h b/src/core/hle/service/am/applets/applet_mii.h deleted file mode 100644 index 42326bfc2..000000000 --- a/src/core/hle/service/am/applets/applet_mii.h +++ /dev/null | |||
| @@ -1,90 +0,0 @@ | |||
| 1 | // Copyright 2022 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <array> | ||
| 8 | |||
| 9 | #include "core/hle/result.h" | ||
| 10 | #include "core/hle/service/am/applets/applets.h" | ||
| 11 | #include "core/hle/service/mii/mii_manager.h" | ||
| 12 | |||
| 13 | namespace Core { | ||
| 14 | class System; | ||
| 15 | } | ||
| 16 | |||
| 17 | namespace Service::AM::Applets { | ||
| 18 | |||
| 19 | // This is nn::mii::AppletMode | ||
| 20 | enum class MiiAppletMode : u32 { | ||
| 21 | ShowMiiEdit = 0, | ||
| 22 | AppendMii = 1, | ||
| 23 | AppendMiiImage = 2, | ||
| 24 | UpdateMiiImage = 3, | ||
| 25 | CreateMii = 4, | ||
| 26 | EditMii = 5, | ||
| 27 | }; | ||
| 28 | |||
| 29 | struct MiiCharInfo { | ||
| 30 | Service::Mii::MiiInfo mii_data{}; | ||
| 31 | INSERT_PADDING_BYTES(0x28); | ||
| 32 | }; | ||
| 33 | static_assert(sizeof(MiiCharInfo) == 0x80, "MiiCharInfo has incorrect size."); | ||
| 34 | |||
| 35 | // This is nn::mii::AppletInput | ||
| 36 | struct MiiAppletInput { | ||
| 37 | s32 version{}; | ||
| 38 | MiiAppletMode applet_mode{}; | ||
| 39 | u32 special_mii_key_code{}; | ||
| 40 | union { | ||
| 41 | std::array<Common::UUID, 8> valid_uuid; | ||
| 42 | MiiCharInfo mii_char_info; | ||
| 43 | }; | ||
| 44 | Common::UUID used_uuid; | ||
| 45 | INSERT_PADDING_BYTES(0x64); | ||
| 46 | }; | ||
| 47 | static_assert(sizeof(MiiAppletInput) == 0x100, "MiiAppletInput has incorrect size."); | ||
| 48 | |||
| 49 | // This is nn::mii::AppletOutput | ||
| 50 | struct MiiAppletOutput { | ||
| 51 | ResultCode result{ResultSuccess}; | ||
| 52 | s32 index{}; | ||
| 53 | INSERT_PADDING_BYTES(0x18); | ||
| 54 | }; | ||
| 55 | static_assert(sizeof(MiiAppletOutput) == 0x20, "MiiAppletOutput has incorrect size."); | ||
| 56 | |||
| 57 | // This is nn::mii::AppletOutputForCharInfoEditing | ||
| 58 | struct AppletOutputForCharInfoEditing { | ||
| 59 | ResultCode result{ResultSuccess}; | ||
| 60 | Service::Mii::MiiInfo mii_data{}; | ||
| 61 | INSERT_PADDING_BYTES(0x24); | ||
| 62 | }; | ||
| 63 | static_assert(sizeof(AppletOutputForCharInfoEditing) == 0x80, | ||
| 64 | "AppletOutputForCharInfoEditing has incorrect size."); | ||
| 65 | |||
| 66 | class Mii final : public Applet { | ||
| 67 | public: | ||
| 68 | explicit Mii(Core::System& system_, LibraryAppletMode applet_mode_, | ||
| 69 | const Core::Frontend::MiiApplet& frontend_); | ||
| 70 | ~Mii() override; | ||
| 71 | |||
| 72 | void Initialize() override; | ||
| 73 | |||
| 74 | bool TransactionComplete() const override; | ||
| 75 | ResultCode GetStatus() const override; | ||
| 76 | void ExecuteInteractive() override; | ||
| 77 | void Execute() override; | ||
| 78 | |||
| 79 | void DisplayCompleted(const Core::Frontend::MiiParameters& parameters); | ||
| 80 | |||
| 81 | private: | ||
| 82 | const Core::Frontend::MiiApplet& frontend; | ||
| 83 | MiiAppletInput input_data{}; | ||
| 84 | AppletOutputForCharInfoEditing output_data{}; | ||
| 85 | |||
| 86 | bool is_complete = false; | ||
| 87 | Core::System& system; | ||
| 88 | }; | ||
| 89 | |||
| 90 | } // namespace Service::AM::Applets | ||
diff --git a/src/core/hle/service/am/applets/applet_mii_edit.cpp b/src/core/hle/service/am/applets/applet_mii_edit.cpp new file mode 100644 index 000000000..8fbde1be4 --- /dev/null +++ b/src/core/hle/service/am/applets/applet_mii_edit.cpp | |||
| @@ -0,0 +1,139 @@ | |||
| 1 | // Copyright 2022 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/assert.h" | ||
| 6 | #include "common/logging/log.h" | ||
| 7 | #include "core/core.h" | ||
| 8 | #include "core/frontend/applets/mii_edit.h" | ||
| 9 | #include "core/hle/service/am/am.h" | ||
| 10 | #include "core/hle/service/am/applets/applet_mii_edit.h" | ||
| 11 | #include "core/hle/service/mii/mii_manager.h" | ||
| 12 | |||
| 13 | namespace Service::AM::Applets { | ||
| 14 | |||
| 15 | MiiEdit::MiiEdit(Core::System& system_, LibraryAppletMode applet_mode_, | ||
| 16 | const Core::Frontend::MiiEditApplet& frontend_) | ||
| 17 | : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} | ||
| 18 | |||
| 19 | MiiEdit::~MiiEdit() = default; | ||
| 20 | |||
| 21 | void MiiEdit::Initialize() { | ||
| 22 | // Note: MiiEdit is not initialized with common arguments. | ||
| 23 | // Instead, it is initialized by an AppletInput storage with size 0x100 bytes. | ||
| 24 | // Do NOT call Applet::Initialize() here. | ||
| 25 | |||
| 26 | const auto storage = broker.PopNormalDataToApplet(); | ||
| 27 | ASSERT(storage != nullptr); | ||
| 28 | |||
| 29 | const auto applet_input_data = storage->GetData(); | ||
| 30 | ASSERT(applet_input_data.size() >= sizeof(MiiEditAppletInputCommon)); | ||
| 31 | |||
| 32 | std::memcpy(&applet_input_common, applet_input_data.data(), sizeof(MiiEditAppletInputCommon)); | ||
| 33 | |||
| 34 | LOG_INFO(Service_AM, | ||
| 35 | "Initializing MiiEdit Applet with MiiEditAppletVersion={} and MiiEditAppletMode={}", | ||
| 36 | applet_input_common.version, applet_input_common.applet_mode); | ||
| 37 | |||
| 38 | switch (applet_input_common.version) { | ||
| 39 | case MiiEditAppletVersion::Version3: | ||
| 40 | ASSERT(applet_input_data.size() == | ||
| 41 | sizeof(MiiEditAppletInputCommon) + sizeof(MiiEditAppletInputV3)); | ||
| 42 | std::memcpy(&applet_input_v3, applet_input_data.data() + sizeof(MiiEditAppletInputCommon), | ||
| 43 | sizeof(MiiEditAppletInputV3)); | ||
| 44 | break; | ||
| 45 | case MiiEditAppletVersion::Version4: | ||
| 46 | ASSERT(applet_input_data.size() == | ||
| 47 | sizeof(MiiEditAppletInputCommon) + sizeof(MiiEditAppletInputV4)); | ||
| 48 | std::memcpy(&applet_input_v4, applet_input_data.data() + sizeof(MiiEditAppletInputCommon), | ||
| 49 | sizeof(MiiEditAppletInputV4)); | ||
| 50 | break; | ||
| 51 | default: | ||
| 52 | UNIMPLEMENTED_MSG("Unknown MiiEditAppletVersion={} with size={}", | ||
| 53 | applet_input_common.version, applet_input_data.size()); | ||
| 54 | ASSERT(applet_input_data.size() >= | ||
| 55 | sizeof(MiiEditAppletInputCommon) + sizeof(MiiEditAppletInputV4)); | ||
| 56 | std::memcpy(&applet_input_v4, applet_input_data.data() + sizeof(MiiEditAppletInputCommon), | ||
| 57 | sizeof(MiiEditAppletInputV4)); | ||
| 58 | break; | ||
| 59 | } | ||
| 60 | } | ||
| 61 | |||
| 62 | bool MiiEdit::TransactionComplete() const { | ||
| 63 | return is_complete; | ||
| 64 | } | ||
| 65 | |||
| 66 | ResultCode MiiEdit::GetStatus() const { | ||
| 67 | return ResultSuccess; | ||
| 68 | } | ||
| 69 | |||
| 70 | void MiiEdit::ExecuteInteractive() { | ||
| 71 | UNREACHABLE_MSG("Attempted to call interactive execution on non-interactive applet."); | ||
| 72 | } | ||
| 73 | |||
| 74 | void MiiEdit::Execute() { | ||
| 75 | if (is_complete) { | ||
| 76 | return; | ||
| 77 | } | ||
| 78 | |||
| 79 | // This is a default stub for each of the MiiEdit applet modes. | ||
| 80 | switch (applet_input_common.applet_mode) { | ||
| 81 | case MiiEditAppletMode::ShowMiiEdit: | ||
| 82 | case MiiEditAppletMode::AppendMii: | ||
| 83 | case MiiEditAppletMode::AppendMiiImage: | ||
| 84 | case MiiEditAppletMode::UpdateMiiImage: | ||
| 85 | MiiEditOutput(MiiEditResult::Success, 0); | ||
| 86 | break; | ||
| 87 | case MiiEditAppletMode::CreateMii: | ||
| 88 | case MiiEditAppletMode::EditMii: { | ||
| 89 | Service::Mii::MiiManager mii_manager; | ||
| 90 | |||
| 91 | const MiiEditCharInfo char_info{ | ||
| 92 | .mii_info{applet_input_common.applet_mode == MiiEditAppletMode::EditMii | ||
| 93 | ? applet_input_v4.char_info.mii_info | ||
| 94 | : mii_manager.BuildDefault(0)}, | ||
| 95 | }; | ||
| 96 | |||
| 97 | MiiEditOutputForCharInfoEditing(MiiEditResult::Success, char_info); | ||
| 98 | break; | ||
| 99 | } | ||
| 100 | default: | ||
| 101 | UNIMPLEMENTED_MSG("Unknown MiiEditAppletMode={}", applet_input_common.applet_mode); | ||
| 102 | |||
| 103 | MiiEditOutput(MiiEditResult::Success, 0); | ||
| 104 | break; | ||
| 105 | } | ||
| 106 | } | ||
| 107 | |||
| 108 | void MiiEdit::MiiEditOutput(MiiEditResult result, s32 index) { | ||
| 109 | const MiiEditAppletOutput applet_output{ | ||
| 110 | .result{result}, | ||
| 111 | .index{index}, | ||
| 112 | }; | ||
| 113 | |||
| 114 | std::vector<u8> out_data(sizeof(MiiEditAppletOutput)); | ||
| 115 | std::memcpy(out_data.data(), &applet_output, sizeof(MiiEditAppletOutput)); | ||
| 116 | |||
| 117 | is_complete = true; | ||
| 118 | |||
| 119 | broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(out_data))); | ||
| 120 | broker.SignalStateChanged(); | ||
| 121 | } | ||
| 122 | |||
| 123 | void MiiEdit::MiiEditOutputForCharInfoEditing(MiiEditResult result, | ||
| 124 | const MiiEditCharInfo& char_info) { | ||
| 125 | const MiiEditAppletOutputForCharInfoEditing applet_output{ | ||
| 126 | .result{result}, | ||
| 127 | .char_info{char_info}, | ||
| 128 | }; | ||
| 129 | |||
| 130 | std::vector<u8> out_data(sizeof(MiiEditAppletOutputForCharInfoEditing)); | ||
| 131 | std::memcpy(out_data.data(), &applet_output, sizeof(MiiEditAppletOutputForCharInfoEditing)); | ||
| 132 | |||
| 133 | is_complete = true; | ||
| 134 | |||
| 135 | broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(out_data))); | ||
| 136 | broker.SignalStateChanged(); | ||
| 137 | } | ||
| 138 | |||
| 139 | } // namespace Service::AM::Applets | ||
diff --git a/src/core/hle/service/am/applets/applet_mii_edit.h b/src/core/hle/service/am/applets/applet_mii_edit.h new file mode 100644 index 000000000..e9ca0e2af --- /dev/null +++ b/src/core/hle/service/am/applets/applet_mii_edit.h | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | // Copyright 2022 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "core/hle/result.h" | ||
| 8 | #include "core/hle/service/am/applets/applet_mii_edit_types.h" | ||
| 9 | #include "core/hle/service/am/applets/applets.h" | ||
| 10 | |||
| 11 | namespace Core { | ||
| 12 | class System; | ||
| 13 | } // namespace Core | ||
| 14 | |||
| 15 | namespace Service::AM::Applets { | ||
| 16 | |||
| 17 | class MiiEdit final : public Applet { | ||
| 18 | public: | ||
| 19 | explicit MiiEdit(Core::System& system_, LibraryAppletMode applet_mode_, | ||
| 20 | const Core::Frontend::MiiEditApplet& frontend_); | ||
| 21 | ~MiiEdit() override; | ||
| 22 | |||
| 23 | void Initialize() override; | ||
| 24 | |||
| 25 | bool TransactionComplete() const override; | ||
| 26 | ResultCode GetStatus() const override; | ||
| 27 | void ExecuteInteractive() override; | ||
| 28 | void Execute() override; | ||
| 29 | |||
| 30 | void MiiEditOutput(MiiEditResult result, s32 index); | ||
| 31 | |||
| 32 | void MiiEditOutputForCharInfoEditing(MiiEditResult result, const MiiEditCharInfo& char_info); | ||
| 33 | |||
| 34 | private: | ||
| 35 | const Core::Frontend::MiiEditApplet& frontend; | ||
| 36 | Core::System& system; | ||
| 37 | |||
| 38 | MiiEditAppletInputCommon applet_input_common{}; | ||
| 39 | MiiEditAppletInputV3 applet_input_v3{}; | ||
| 40 | MiiEditAppletInputV4 applet_input_v4{}; | ||
| 41 | |||
| 42 | bool is_complete{false}; | ||
| 43 | }; | ||
| 44 | |||
| 45 | } // namespace Service::AM::Applets | ||
diff --git a/src/core/hle/service/am/applets/applet_mii_edit_types.h b/src/core/hle/service/am/applets/applet_mii_edit_types.h new file mode 100644 index 000000000..70dea0007 --- /dev/null +++ b/src/core/hle/service/am/applets/applet_mii_edit_types.h | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | // Copyright 2022 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <array> | ||
| 8 | |||
| 9 | #include "common/common_funcs.h" | ||
| 10 | #include "common/common_types.h" | ||
| 11 | #include "core/hle/service/mii/types.h" | ||
| 12 | |||
| 13 | namespace Service::AM::Applets { | ||
| 14 | |||
| 15 | enum class MiiEditAppletVersion : s32 { | ||
| 16 | Version3 = 0x3, // 1.0.0 - 10.1.1 | ||
| 17 | Version4 = 0x4, // 10.2.0+ | ||
| 18 | }; | ||
| 19 | |||
| 20 | // This is nn::mii::AppletMode | ||
| 21 | enum class MiiEditAppletMode : u32 { | ||
| 22 | ShowMiiEdit = 0, | ||
| 23 | AppendMii = 1, | ||
| 24 | AppendMiiImage = 2, | ||
| 25 | UpdateMiiImage = 3, | ||
| 26 | CreateMii = 4, | ||
| 27 | EditMii = 5, | ||
| 28 | }; | ||
| 29 | |||
| 30 | enum class MiiEditResult : u32 { | ||
| 31 | Success, | ||
| 32 | Cancel, | ||
| 33 | }; | ||
| 34 | |||
| 35 | struct MiiEditCharInfo { | ||
| 36 | Service::Mii::MiiInfo mii_info{}; | ||
| 37 | }; | ||
| 38 | static_assert(sizeof(MiiEditCharInfo) == 0x58, "MiiEditCharInfo has incorrect size."); | ||
| 39 | |||
| 40 | struct MiiEditAppletInputCommon { | ||
| 41 | MiiEditAppletVersion version{}; | ||
| 42 | MiiEditAppletMode applet_mode{}; | ||
| 43 | }; | ||
| 44 | static_assert(sizeof(MiiEditAppletInputCommon) == 0x8, | ||
| 45 | "MiiEditAppletInputCommon has incorrect size."); | ||
| 46 | |||
| 47 | struct MiiEditAppletInputV3 { | ||
| 48 | u32 special_mii_key_code{}; | ||
| 49 | std::array<Common::UUID, 8> valid_uuids{}; | ||
| 50 | Common::UUID used_uuid{}; | ||
| 51 | INSERT_PADDING_BYTES(0x64); | ||
| 52 | }; | ||
| 53 | static_assert(sizeof(MiiEditAppletInputV3) == 0x100 - sizeof(MiiEditAppletInputCommon), | ||
| 54 | "MiiEditAppletInputV3 has incorrect size."); | ||
| 55 | |||
| 56 | struct MiiEditAppletInputV4 { | ||
| 57 | u32 special_mii_key_code{}; | ||
| 58 | MiiEditCharInfo char_info{}; | ||
| 59 | INSERT_PADDING_BYTES(0x28); | ||
| 60 | Common::UUID used_uuid{}; | ||
| 61 | INSERT_PADDING_BYTES(0x64); | ||
| 62 | }; | ||
| 63 | static_assert(sizeof(MiiEditAppletInputV4) == 0x100 - sizeof(MiiEditAppletInputCommon), | ||
| 64 | "MiiEditAppletInputV4 has incorrect size."); | ||
| 65 | |||
| 66 | // This is nn::mii::AppletOutput | ||
| 67 | struct MiiEditAppletOutput { | ||
| 68 | MiiEditResult result{}; | ||
| 69 | s32 index{}; | ||
| 70 | INSERT_PADDING_BYTES(0x18); | ||
| 71 | }; | ||
| 72 | static_assert(sizeof(MiiEditAppletOutput) == 0x20, "MiiEditAppletOutput has incorrect size."); | ||
| 73 | |||
| 74 | // This is nn::mii::AppletOutputForCharInfoEditing | ||
| 75 | struct MiiEditAppletOutputForCharInfoEditing { | ||
| 76 | MiiEditResult result{}; | ||
| 77 | MiiEditCharInfo char_info{}; | ||
| 78 | INSERT_PADDING_BYTES(0x24); | ||
| 79 | }; | ||
| 80 | static_assert(sizeof(MiiEditAppletOutputForCharInfoEditing) == 0x80, | ||
| 81 | "MiiEditAppletOutputForCharInfoEditing has incorrect size."); | ||
| 82 | |||
| 83 | } // namespace Service::AM::Applets | ||
diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/applets/applets.cpp index 79e62679d..1f4c9786a 100644 --- a/src/core/hle/service/am/applets/applets.cpp +++ b/src/core/hle/service/am/applets/applets.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "core/frontend/applets/controller.h" | 9 | #include "core/frontend/applets/controller.h" |
| 10 | #include "core/frontend/applets/error.h" | 10 | #include "core/frontend/applets/error.h" |
| 11 | #include "core/frontend/applets/general_frontend.h" | 11 | #include "core/frontend/applets/general_frontend.h" |
| 12 | #include "core/frontend/applets/mii.h" | 12 | #include "core/frontend/applets/mii_edit.h" |
| 13 | #include "core/frontend/applets/profile_select.h" | 13 | #include "core/frontend/applets/profile_select.h" |
| 14 | #include "core/frontend/applets/software_keyboard.h" | 14 | #include "core/frontend/applets/software_keyboard.h" |
| 15 | #include "core/frontend/applets/web_browser.h" | 15 | #include "core/frontend/applets/web_browser.h" |
| @@ -20,7 +20,7 @@ | |||
| 20 | #include "core/hle/service/am/applets/applet_controller.h" | 20 | #include "core/hle/service/am/applets/applet_controller.h" |
| 21 | #include "core/hle/service/am/applets/applet_error.h" | 21 | #include "core/hle/service/am/applets/applet_error.h" |
| 22 | #include "core/hle/service/am/applets/applet_general_backend.h" | 22 | #include "core/hle/service/am/applets/applet_general_backend.h" |
| 23 | #include "core/hle/service/am/applets/applet_mii.h" | 23 | #include "core/hle/service/am/applets/applet_mii_edit.h" |
| 24 | #include "core/hle/service/am/applets/applet_profile_select.h" | 24 | #include "core/hle/service/am/applets/applet_profile_select.h" |
| 25 | #include "core/hle/service/am/applets/applet_software_keyboard.h" | 25 | #include "core/hle/service/am/applets/applet_software_keyboard.h" |
| 26 | #include "core/hle/service/am/applets/applet_web_browser.h" | 26 | #include "core/hle/service/am/applets/applet_web_browser.h" |
| @@ -173,12 +173,12 @@ void Applet::Initialize() { | |||
| 173 | AppletFrontendSet::AppletFrontendSet() = default; | 173 | AppletFrontendSet::AppletFrontendSet() = default; |
| 174 | 174 | ||
| 175 | AppletFrontendSet::AppletFrontendSet(ControllerApplet controller_applet, ErrorApplet error_applet, | 175 | AppletFrontendSet::AppletFrontendSet(ControllerApplet controller_applet, ErrorApplet error_applet, |
| 176 | MiiEdit mii_edit_, | ||
| 176 | ParentalControlsApplet parental_controls_applet, | 177 | ParentalControlsApplet parental_controls_applet, |
| 177 | MiiApplet mii_applet, PhotoViewer photo_viewer_, | 178 | PhotoViewer photo_viewer_, ProfileSelect profile_select_, |
| 178 | ProfileSelect profile_select_, | ||
| 179 | SoftwareKeyboard software_keyboard_, WebBrowser web_browser_) | 179 | SoftwareKeyboard software_keyboard_, WebBrowser web_browser_) |
| 180 | : controller{std::move(controller_applet)}, error{std::move(error_applet)}, | 180 | : controller{std::move(controller_applet)}, error{std::move(error_applet)}, |
| 181 | parental_controls{std::move(parental_controls_applet)}, mii{std::move(mii_applet)}, | 181 | mii_edit{std::move(mii_edit_)}, parental_controls{std::move(parental_controls_applet)}, |
| 182 | photo_viewer{std::move(photo_viewer_)}, profile_select{std::move(profile_select_)}, | 182 | photo_viewer{std::move(photo_viewer_)}, profile_select{std::move(profile_select_)}, |
| 183 | software_keyboard{std::move(software_keyboard_)}, web_browser{std::move(web_browser_)} {} | 183 | software_keyboard{std::move(software_keyboard_)}, web_browser{std::move(web_browser_)} {} |
| 184 | 184 | ||
| @@ -205,12 +205,12 @@ void AppletManager::SetAppletFrontendSet(AppletFrontendSet set) { | |||
| 205 | frontend.error = std::move(set.error); | 205 | frontend.error = std::move(set.error); |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | if (set.parental_controls != nullptr) { | 208 | if (set.mii_edit != nullptr) { |
| 209 | frontend.parental_controls = std::move(set.parental_controls); | 209 | frontend.mii_edit = std::move(set.mii_edit); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | if (set.mii != nullptr) { | 212 | if (set.parental_controls != nullptr) { |
| 213 | frontend.mii = std::move(set.mii); | 213 | frontend.parental_controls = std::move(set.parental_controls); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | if (set.photo_viewer != nullptr) { | 216 | if (set.photo_viewer != nullptr) { |
| @@ -245,15 +245,15 @@ void AppletManager::SetDefaultAppletsIfMissing() { | |||
| 245 | frontend.error = std::make_unique<Core::Frontend::DefaultErrorApplet>(); | 245 | frontend.error = std::make_unique<Core::Frontend::DefaultErrorApplet>(); |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | if (frontend.mii_edit == nullptr) { | ||
| 249 | frontend.mii_edit = std::make_unique<Core::Frontend::DefaultMiiEditApplet>(); | ||
| 250 | } | ||
| 251 | |||
| 248 | if (frontend.parental_controls == nullptr) { | 252 | if (frontend.parental_controls == nullptr) { |
| 249 | frontend.parental_controls = | 253 | frontend.parental_controls = |
| 250 | std::make_unique<Core::Frontend::DefaultParentalControlsApplet>(); | 254 | std::make_unique<Core::Frontend::DefaultParentalControlsApplet>(); |
| 251 | } | 255 | } |
| 252 | 256 | ||
| 253 | if (frontend.mii == nullptr) { | ||
| 254 | frontend.mii = std::make_unique<Core::Frontend::DefaultMiiApplet>(); | ||
| 255 | } | ||
| 256 | |||
| 257 | if (frontend.photo_viewer == nullptr) { | 257 | if (frontend.photo_viewer == nullptr) { |
| 258 | frontend.photo_viewer = std::make_unique<Core::Frontend::DefaultPhotoViewerApplet>(); | 258 | frontend.photo_viewer = std::make_unique<Core::Frontend::DefaultPhotoViewerApplet>(); |
| 259 | } | 259 | } |
| @@ -289,7 +289,7 @@ std::shared_ptr<Applet> AppletManager::GetApplet(AppletId id, LibraryAppletMode | |||
| 289 | case AppletId::SoftwareKeyboard: | 289 | case AppletId::SoftwareKeyboard: |
| 290 | return std::make_shared<SoftwareKeyboard>(system, mode, *frontend.software_keyboard); | 290 | return std::make_shared<SoftwareKeyboard>(system, mode, *frontend.software_keyboard); |
| 291 | case AppletId::MiiEdit: | 291 | case AppletId::MiiEdit: |
| 292 | return std::make_shared<Mii>(system, mode, *frontend.mii); | 292 | return std::make_shared<MiiEdit>(system, mode, *frontend.mii_edit); |
| 293 | case AppletId::Web: | 293 | case AppletId::Web: |
| 294 | case AppletId::Shop: | 294 | case AppletId::Shop: |
| 295 | case AppletId::OfflineWeb: | 295 | case AppletId::OfflineWeb: |
diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h index 0c44aec79..50a7bdceb 100644 --- a/src/core/hle/service/am/applets/applets.h +++ b/src/core/hle/service/am/applets/applets.h | |||
| @@ -20,8 +20,8 @@ namespace Core::Frontend { | |||
| 20 | class ControllerApplet; | 20 | class ControllerApplet; |
| 21 | class ECommerceApplet; | 21 | class ECommerceApplet; |
| 22 | class ErrorApplet; | 22 | class ErrorApplet; |
| 23 | class MiiEditApplet; | ||
| 23 | class ParentalControlsApplet; | 24 | class ParentalControlsApplet; |
| 24 | class MiiApplet; | ||
| 25 | class PhotoViewerApplet; | 25 | class PhotoViewerApplet; |
| 26 | class ProfileSelectApplet; | 26 | class ProfileSelectApplet; |
| 27 | class SoftwareKeyboardApplet; | 27 | class SoftwareKeyboardApplet; |
| @@ -179,8 +179,8 @@ protected: | |||
| 179 | struct AppletFrontendSet { | 179 | struct AppletFrontendSet { |
| 180 | using ControllerApplet = std::unique_ptr<Core::Frontend::ControllerApplet>; | 180 | using ControllerApplet = std::unique_ptr<Core::Frontend::ControllerApplet>; |
| 181 | using ErrorApplet = std::unique_ptr<Core::Frontend::ErrorApplet>; | 181 | using ErrorApplet = std::unique_ptr<Core::Frontend::ErrorApplet>; |
| 182 | using MiiEdit = std::unique_ptr<Core::Frontend::MiiEditApplet>; | ||
| 182 | using ParentalControlsApplet = std::unique_ptr<Core::Frontend::ParentalControlsApplet>; | 183 | using ParentalControlsApplet = std::unique_ptr<Core::Frontend::ParentalControlsApplet>; |
| 183 | using MiiApplet = std::unique_ptr<Core::Frontend::MiiApplet>; | ||
| 184 | using PhotoViewer = std::unique_ptr<Core::Frontend::PhotoViewerApplet>; | 184 | using PhotoViewer = std::unique_ptr<Core::Frontend::PhotoViewerApplet>; |
| 185 | using ProfileSelect = std::unique_ptr<Core::Frontend::ProfileSelectApplet>; | 185 | using ProfileSelect = std::unique_ptr<Core::Frontend::ProfileSelectApplet>; |
| 186 | using SoftwareKeyboard = std::unique_ptr<Core::Frontend::SoftwareKeyboardApplet>; | 186 | using SoftwareKeyboard = std::unique_ptr<Core::Frontend::SoftwareKeyboardApplet>; |
| @@ -188,7 +188,7 @@ struct AppletFrontendSet { | |||
| 188 | 188 | ||
| 189 | AppletFrontendSet(); | 189 | AppletFrontendSet(); |
| 190 | AppletFrontendSet(ControllerApplet controller_applet, ErrorApplet error_applet, | 190 | AppletFrontendSet(ControllerApplet controller_applet, ErrorApplet error_applet, |
| 191 | ParentalControlsApplet parental_controls_applet, MiiApplet mii_applet, | 191 | MiiEdit mii_edit_, ParentalControlsApplet parental_controls_applet, |
| 192 | PhotoViewer photo_viewer_, ProfileSelect profile_select_, | 192 | PhotoViewer photo_viewer_, ProfileSelect profile_select_, |
| 193 | SoftwareKeyboard software_keyboard_, WebBrowser web_browser_); | 193 | SoftwareKeyboard software_keyboard_, WebBrowser web_browser_); |
| 194 | ~AppletFrontendSet(); | 194 | ~AppletFrontendSet(); |
| @@ -201,8 +201,8 @@ struct AppletFrontendSet { | |||
| 201 | 201 | ||
| 202 | ControllerApplet controller; | 202 | ControllerApplet controller; |
| 203 | ErrorApplet error; | 203 | ErrorApplet error; |
| 204 | MiiEdit mii_edit; | ||
| 204 | ParentalControlsApplet parental_controls; | 205 | ParentalControlsApplet parental_controls; |
| 205 | MiiApplet mii; | ||
| 206 | PhotoViewer photo_viewer; | 206 | PhotoViewer photo_viewer; |
| 207 | ProfileSelect profile_select; | 207 | ProfileSelect profile_select; |
| 208 | SoftwareKeyboard software_keyboard; | 208 | SoftwareKeyboard software_keyboard; |
diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp index 0a57c3cde..188231615 100644 --- a/src/core/hle/service/mii/mii_manager.cpp +++ b/src/core/hle/service/mii/mii_manager.cpp | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // Copyright 2020 yuzu emulator team | 1 | // Copyright 2020 yuzu Emulator Project |
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| @@ -12,7 +12,6 @@ | |||
| 12 | #include "core/hle/service/acc/profile_manager.h" | 12 | #include "core/hle/service/acc/profile_manager.h" |
| 13 | #include "core/hle/service/mii/mii_manager.h" | 13 | #include "core/hle/service/mii/mii_manager.h" |
| 14 | #include "core/hle/service/mii/raw_data.h" | 14 | #include "core/hle/service/mii/raw_data.h" |
| 15 | #include "core/hle/service/mii/types.h" | ||
| 16 | 15 | ||
| 17 | namespace Service::Mii { | 16 | namespace Service::Mii { |
| 18 | 17 | ||
diff --git a/src/core/hle/service/mii/mii_manager.h b/src/core/hle/service/mii/mii_manager.h index 6999d15b1..5d134c425 100644 --- a/src/core/hle/service/mii/mii_manager.h +++ b/src/core/hle/service/mii/mii_manager.h | |||
| @@ -1,315 +1,16 @@ | |||
| 1 | // Copyright 2020 yuzu emulator team | 1 | // Copyright 2020 yuzu Emulator Project |
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | ||
| 8 | #include <vector> | 7 | #include <vector> |
| 9 | #include "common/bit_field.h" | 8 | |
| 10 | #include "common/common_funcs.h" | ||
| 11 | #include "common/uuid.h" | ||
| 12 | #include "core/hle/result.h" | 9 | #include "core/hle/result.h" |
| 13 | #include "core/hle/service/mii/types.h" | 10 | #include "core/hle/service/mii/types.h" |
| 14 | 11 | ||
| 15 | namespace Service::Mii { | 12 | namespace Service::Mii { |
| 16 | 13 | ||
| 17 | enum class Source : u32 { | ||
| 18 | Database = 0, | ||
| 19 | Default = 1, | ||
| 20 | Account = 2, | ||
| 21 | Friend = 3, | ||
| 22 | }; | ||
| 23 | |||
| 24 | enum class SourceFlag : u32 { | ||
| 25 | None = 0, | ||
| 26 | Database = 1 << 0, | ||
| 27 | Default = 1 << 1, | ||
| 28 | }; | ||
| 29 | DECLARE_ENUM_FLAG_OPERATORS(SourceFlag); | ||
| 30 | |||
| 31 | struct MiiInfo { | ||
| 32 | Common::UUID uuid; | ||
| 33 | std::array<char16_t, 11> name; | ||
| 34 | u8 font_region; | ||
| 35 | u8 favorite_color; | ||
| 36 | u8 gender; | ||
| 37 | u8 height; | ||
| 38 | u8 build; | ||
| 39 | u8 type; | ||
| 40 | u8 region_move; | ||
| 41 | u8 faceline_type; | ||
| 42 | u8 faceline_color; | ||
| 43 | u8 faceline_wrinkle; | ||
| 44 | u8 faceline_make; | ||
| 45 | u8 hair_type; | ||
| 46 | u8 hair_color; | ||
| 47 | u8 hair_flip; | ||
| 48 | u8 eye_type; | ||
| 49 | u8 eye_color; | ||
| 50 | u8 eye_scale; | ||
| 51 | u8 eye_aspect; | ||
| 52 | u8 eye_rotate; | ||
| 53 | u8 eye_x; | ||
| 54 | u8 eye_y; | ||
| 55 | u8 eyebrow_type; | ||
| 56 | u8 eyebrow_color; | ||
| 57 | u8 eyebrow_scale; | ||
| 58 | u8 eyebrow_aspect; | ||
| 59 | u8 eyebrow_rotate; | ||
| 60 | u8 eyebrow_x; | ||
| 61 | u8 eyebrow_y; | ||
| 62 | u8 nose_type; | ||
| 63 | u8 nose_scale; | ||
| 64 | u8 nose_y; | ||
| 65 | u8 mouth_type; | ||
| 66 | u8 mouth_color; | ||
| 67 | u8 mouth_scale; | ||
| 68 | u8 mouth_aspect; | ||
| 69 | u8 mouth_y; | ||
| 70 | u8 beard_color; | ||
| 71 | u8 beard_type; | ||
| 72 | u8 mustache_type; | ||
| 73 | u8 mustache_scale; | ||
| 74 | u8 mustache_y; | ||
| 75 | u8 glasses_type; | ||
| 76 | u8 glasses_color; | ||
| 77 | u8 glasses_scale; | ||
| 78 | u8 glasses_y; | ||
| 79 | u8 mole_type; | ||
| 80 | u8 mole_scale; | ||
| 81 | u8 mole_x; | ||
| 82 | u8 mole_y; | ||
| 83 | u8 padding; | ||
| 84 | |||
| 85 | std::u16string Name() const; | ||
| 86 | }; | ||
| 87 | static_assert(sizeof(MiiInfo) == 0x58, "MiiInfo has incorrect size."); | ||
| 88 | static_assert(std::has_unique_object_representations_v<MiiInfo>, | ||
| 89 | "All bits of MiiInfo must contribute to its value."); | ||
| 90 | |||
| 91 | #pragma pack(push, 4) | ||
| 92 | |||
| 93 | struct MiiInfoElement { | ||
| 94 | MiiInfoElement(const MiiInfo& info_, Source source_) : info{info_}, source{source_} {} | ||
| 95 | |||
| 96 | MiiInfo info{}; | ||
| 97 | Source source{}; | ||
| 98 | }; | ||
| 99 | static_assert(sizeof(MiiInfoElement) == 0x5c, "MiiInfoElement has incorrect size."); | ||
| 100 | |||
| 101 | struct MiiStoreBitFields { | ||
| 102 | union { | ||
| 103 | u32 word_0{}; | ||
| 104 | |||
| 105 | BitField<0, 8, u32> hair_type; | ||
| 106 | BitField<8, 7, u32> height; | ||
| 107 | BitField<15, 1, u32> mole_type; | ||
| 108 | BitField<16, 7, u32> build; | ||
| 109 | BitField<23, 1, HairFlip> hair_flip; | ||
| 110 | BitField<24, 7, u32> hair_color; | ||
| 111 | BitField<31, 1, u32> type; | ||
| 112 | }; | ||
| 113 | |||
| 114 | union { | ||
| 115 | u32 word_1{}; | ||
| 116 | |||
| 117 | BitField<0, 7, u32> eye_color; | ||
| 118 | BitField<7, 1, Gender> gender; | ||
| 119 | BitField<8, 7, u32> eyebrow_color; | ||
| 120 | BitField<16, 7, u32> mouth_color; | ||
| 121 | BitField<24, 7, u32> beard_color; | ||
| 122 | }; | ||
| 123 | |||
| 124 | union { | ||
| 125 | u32 word_2{}; | ||
| 126 | |||
| 127 | BitField<0, 7, u32> glasses_color; | ||
| 128 | BitField<8, 6, u32> eye_type; | ||
| 129 | BitField<14, 2, u32> region_move; | ||
| 130 | BitField<16, 6, u32> mouth_type; | ||
| 131 | BitField<22, 2, FontRegion> font_region; | ||
| 132 | BitField<24, 5, u32> eye_y; | ||
| 133 | BitField<29, 3, u32> glasses_scale; | ||
| 134 | }; | ||
| 135 | |||
| 136 | union { | ||
| 137 | u32 word_3{}; | ||
| 138 | |||
| 139 | BitField<0, 5, u32> eyebrow_type; | ||
| 140 | BitField<5, 3, MustacheType> mustache_type; | ||
| 141 | BitField<8, 5, u32> nose_type; | ||
| 142 | BitField<13, 3, BeardType> beard_type; | ||
| 143 | BitField<16, 5, u32> nose_y; | ||
| 144 | BitField<21, 3, u32> mouth_aspect; | ||
| 145 | BitField<24, 5, u32> mouth_y; | ||
| 146 | BitField<29, 3, u32> eyebrow_aspect; | ||
| 147 | }; | ||
| 148 | |||
| 149 | union { | ||
| 150 | u32 word_4{}; | ||
| 151 | |||
| 152 | BitField<0, 5, u32> mustache_y; | ||
| 153 | BitField<5, 3, u32> eye_rotate; | ||
| 154 | BitField<8, 5, u32> glasses_y; | ||
| 155 | BitField<13, 3, u32> eye_aspect; | ||
| 156 | BitField<16, 5, u32> mole_x; | ||
| 157 | BitField<21, 3, u32> eye_scale; | ||
| 158 | BitField<24, 5, u32> mole_y; | ||
| 159 | }; | ||
| 160 | |||
| 161 | union { | ||
| 162 | u32 word_5{}; | ||
| 163 | |||
| 164 | BitField<0, 5, u32> glasses_type; | ||
| 165 | BitField<8, 4, u32> favorite_color; | ||
| 166 | BitField<12, 4, u32> faceline_type; | ||
| 167 | BitField<16, 4, u32> faceline_color; | ||
| 168 | BitField<20, 4, u32> faceline_wrinkle; | ||
| 169 | BitField<24, 4, u32> faceline_makeup; | ||
| 170 | BitField<28, 4, u32> eye_x; | ||
| 171 | }; | ||
| 172 | |||
| 173 | union { | ||
| 174 | u32 word_6{}; | ||
| 175 | |||
| 176 | BitField<0, 4, u32> eyebrow_scale; | ||
| 177 | BitField<4, 4, u32> eyebrow_rotate; | ||
| 178 | BitField<8, 4, u32> eyebrow_x; | ||
| 179 | BitField<12, 4, u32> eyebrow_y; | ||
| 180 | BitField<16, 4, u32> nose_scale; | ||
| 181 | BitField<20, 4, u32> mouth_scale; | ||
| 182 | BitField<24, 4, u32> mustache_scale; | ||
| 183 | BitField<28, 4, u32> mole_scale; | ||
| 184 | }; | ||
| 185 | }; | ||
| 186 | static_assert(sizeof(MiiStoreBitFields) == 0x1c, "MiiStoreBitFields has incorrect size."); | ||
| 187 | static_assert(std::is_trivially_copyable_v<MiiStoreBitFields>, | ||
| 188 | "MiiStoreBitFields is not trivially copyable."); | ||
| 189 | |||
| 190 | struct MiiStoreData { | ||
| 191 | using Name = std::array<char16_t, 10>; | ||
| 192 | |||
| 193 | MiiStoreData(); | ||
| 194 | MiiStoreData(const Name& name, const MiiStoreBitFields& bit_fields, | ||
| 195 | const Common::UUID& user_id); | ||
| 196 | |||
| 197 | // This corresponds to the above structure MiiStoreBitFields. I did it like this because the | ||
| 198 | // BitField<> type makes this (and any thing that contains it) not trivially copyable, which is | ||
| 199 | // not suitable for our uses. | ||
| 200 | struct { | ||
| 201 | std::array<u8, 0x1C> data{}; | ||
| 202 | static_assert(sizeof(MiiStoreBitFields) == sizeof(data), "data field has incorrect size."); | ||
| 203 | |||
| 204 | Name name{}; | ||
| 205 | Common::UUID uuid{}; | ||
| 206 | } data; | ||
| 207 | |||
| 208 | u16 data_crc{}; | ||
| 209 | u16 device_crc{}; | ||
| 210 | }; | ||
| 211 | static_assert(sizeof(MiiStoreData) == 0x44, "MiiStoreData has incorrect size."); | ||
| 212 | |||
| 213 | struct MiiStoreDataElement { | ||
| 214 | MiiStoreData data{}; | ||
| 215 | Source source{}; | ||
| 216 | }; | ||
| 217 | static_assert(sizeof(MiiStoreDataElement) == 0x48, "MiiStoreDataElement has incorrect size."); | ||
| 218 | |||
| 219 | struct MiiDatabase { | ||
| 220 | u32 magic{}; // 'NFDB' | ||
| 221 | std::array<MiiStoreData, 0x64> miis{}; | ||
| 222 | INSERT_PADDING_BYTES(1); | ||
| 223 | u8 count{}; | ||
| 224 | u16 crc{}; | ||
| 225 | }; | ||
| 226 | static_assert(sizeof(MiiDatabase) == 0x1A98, "MiiDatabase has incorrect size."); | ||
| 227 | |||
| 228 | struct RandomMiiValues { | ||
| 229 | std::array<u8, 0xbc> values{}; | ||
| 230 | }; | ||
| 231 | static_assert(sizeof(RandomMiiValues) == 0xbc, "RandomMiiValues has incorrect size."); | ||
| 232 | |||
| 233 | struct RandomMiiData4 { | ||
| 234 | Gender gender{}; | ||
| 235 | Age age{}; | ||
| 236 | Race race{}; | ||
| 237 | u32 values_count{}; | ||
| 238 | std::array<u32, 47> values{}; | ||
| 239 | }; | ||
| 240 | static_assert(sizeof(RandomMiiData4) == 0xcc, "RandomMiiData4 has incorrect size."); | ||
| 241 | |||
| 242 | struct RandomMiiData3 { | ||
| 243 | u32 arg_1; | ||
| 244 | u32 arg_2; | ||
| 245 | u32 values_count; | ||
| 246 | std::array<u32, 47> values{}; | ||
| 247 | }; | ||
| 248 | static_assert(sizeof(RandomMiiData3) == 0xc8, "RandomMiiData3 has incorrect size."); | ||
| 249 | |||
| 250 | struct RandomMiiData2 { | ||
| 251 | u32 arg_1; | ||
| 252 | u32 values_count; | ||
| 253 | std::array<u32, 47> values{}; | ||
| 254 | }; | ||
| 255 | static_assert(sizeof(RandomMiiData2) == 0xc4, "RandomMiiData2 has incorrect size."); | ||
| 256 | |||
| 257 | struct DefaultMii { | ||
| 258 | u32 face_type{}; | ||
| 259 | u32 face_color{}; | ||
| 260 | u32 face_wrinkle{}; | ||
| 261 | u32 face_makeup{}; | ||
| 262 | u32 hair_type{}; | ||
| 263 | u32 hair_color{}; | ||
| 264 | u32 hair_flip{}; | ||
| 265 | u32 eye_type{}; | ||
| 266 | u32 eye_color{}; | ||
| 267 | u32 eye_scale{}; | ||
| 268 | u32 eye_aspect{}; | ||
| 269 | u32 eye_rotate{}; | ||
| 270 | u32 eye_x{}; | ||
| 271 | u32 eye_y{}; | ||
| 272 | u32 eyebrow_type{}; | ||
| 273 | u32 eyebrow_color{}; | ||
| 274 | u32 eyebrow_scale{}; | ||
| 275 | u32 eyebrow_aspect{}; | ||
| 276 | u32 eyebrow_rotate{}; | ||
| 277 | u32 eyebrow_x{}; | ||
| 278 | u32 eyebrow_y{}; | ||
| 279 | u32 nose_type{}; | ||
| 280 | u32 nose_scale{}; | ||
| 281 | u32 nose_y{}; | ||
| 282 | u32 mouth_type{}; | ||
| 283 | u32 mouth_color{}; | ||
| 284 | u32 mouth_scale{}; | ||
| 285 | u32 mouth_aspect{}; | ||
| 286 | u32 mouth_y{}; | ||
| 287 | u32 mustache_type{}; | ||
| 288 | u32 beard_type{}; | ||
| 289 | u32 beard_color{}; | ||
| 290 | u32 mustache_scale{}; | ||
| 291 | u32 mustache_y{}; | ||
| 292 | u32 glasses_type{}; | ||
| 293 | u32 glasses_color{}; | ||
| 294 | u32 glasses_scale{}; | ||
| 295 | u32 glasses_y{}; | ||
| 296 | u32 mole_type{}; | ||
| 297 | u32 mole_scale{}; | ||
| 298 | u32 mole_x{}; | ||
| 299 | u32 mole_y{}; | ||
| 300 | u32 height{}; | ||
| 301 | u32 weight{}; | ||
| 302 | Gender gender{}; | ||
| 303 | u32 favorite_color{}; | ||
| 304 | u32 region{}; | ||
| 305 | FontRegion font_region{}; | ||
| 306 | u32 type{}; | ||
| 307 | INSERT_PADDING_WORDS(5); | ||
| 308 | }; | ||
| 309 | static_assert(sizeof(DefaultMii) == 0xd8, "MiiStoreData has incorrect size."); | ||
| 310 | |||
| 311 | #pragma pack(pop) | ||
| 312 | |||
| 313 | // The Mii manager is responsible for loading and storing the Miis to the database in NAND along | 14 | // The Mii manager is responsible for loading and storing the Miis to the database in NAND along |
| 314 | // with providing an easy interface for HLE emulation of the mii service. | 15 | // with providing an easy interface for HLE emulation of the mii service. |
| 315 | class MiiManager { | 16 | class MiiManager { |
diff --git a/src/core/hle/service/mii/raw_data.h b/src/core/hle/service/mii/raw_data.h index bd90c2162..2e39c0d4f 100644 --- a/src/core/hle/service/mii/raw_data.h +++ b/src/core/hle/service/mii/raw_data.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | 8 | ||
| 9 | #include "core/hle/service/mii/mii_manager.h" | 9 | #include "core/hle/service/mii/types.h" |
| 10 | 10 | ||
| 11 | namespace Service::Mii::RawData { | 11 | namespace Service::Mii::RawData { |
| 12 | 12 | ||
diff --git a/src/core/hle/service/mii/types.h b/src/core/hle/service/mii/types.h index d65a1055e..5580b8c6a 100644 --- a/src/core/hle/service/mii/types.h +++ b/src/core/hle/service/mii/types.h | |||
| @@ -1,11 +1,16 @@ | |||
| 1 | // Copyright 2020 yuzu emulator team | 1 | // Copyright 2020 yuzu Emulator Project |
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | ||
| 8 | #include <type_traits> | ||
| 9 | |||
| 10 | #include "common/bit_field.h" | ||
| 7 | #include "common/common_funcs.h" | 11 | #include "common/common_funcs.h" |
| 8 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "common/uuid.h" | ||
| 9 | 14 | ||
| 10 | namespace Service::Mii { | 15 | namespace Service::Mii { |
| 11 | 16 | ||
| @@ -25,7 +30,11 @@ enum class BeardType : u32 { | |||
| 25 | Beard5, | 30 | Beard5, |
| 26 | }; | 31 | }; |
| 27 | 32 | ||
| 28 | enum class BeardAndMustacheFlag : u32 { Beard = 1, Mustache, All = Beard | Mustache }; | 33 | enum class BeardAndMustacheFlag : u32 { |
| 34 | Beard = 1, | ||
| 35 | Mustache, | ||
| 36 | All = Beard | Mustache, | ||
| 37 | }; | ||
| 29 | DECLARE_ENUM_FLAG_OPERATORS(BeardAndMustacheFlag); | 38 | DECLARE_ENUM_FLAG_OPERATORS(BeardAndMustacheFlag); |
| 30 | 39 | ||
| 31 | enum class FontRegion : u32 { | 40 | enum class FontRegion : u32 { |
| @@ -64,4 +73,298 @@ enum class Race : u32 { | |||
| 64 | All, | 73 | All, |
| 65 | }; | 74 | }; |
| 66 | 75 | ||
| 76 | enum class Source : u32 { | ||
| 77 | Database = 0, | ||
| 78 | Default = 1, | ||
| 79 | Account = 2, | ||
| 80 | Friend = 3, | ||
| 81 | }; | ||
| 82 | |||
| 83 | enum class SourceFlag : u32 { | ||
| 84 | None = 0, | ||
| 85 | Database = 1 << 0, | ||
| 86 | Default = 1 << 1, | ||
| 87 | }; | ||
| 88 | DECLARE_ENUM_FLAG_OPERATORS(SourceFlag); | ||
| 89 | |||
| 90 | struct MiiInfo { | ||
| 91 | Common::UUID uuid; | ||
| 92 | std::array<char16_t, 11> name; | ||
| 93 | u8 font_region; | ||
| 94 | u8 favorite_color; | ||
| 95 | u8 gender; | ||
| 96 | u8 height; | ||
| 97 | u8 build; | ||
| 98 | u8 type; | ||
| 99 | u8 region_move; | ||
| 100 | u8 faceline_type; | ||
| 101 | u8 faceline_color; | ||
| 102 | u8 faceline_wrinkle; | ||
| 103 | u8 faceline_make; | ||
| 104 | u8 hair_type; | ||
| 105 | u8 hair_color; | ||
| 106 | u8 hair_flip; | ||
| 107 | u8 eye_type; | ||
| 108 | u8 eye_color; | ||
| 109 | u8 eye_scale; | ||
| 110 | u8 eye_aspect; | ||
| 111 | u8 eye_rotate; | ||
| 112 | u8 eye_x; | ||
| 113 | u8 eye_y; | ||
| 114 | u8 eyebrow_type; | ||
| 115 | u8 eyebrow_color; | ||
| 116 | u8 eyebrow_scale; | ||
| 117 | u8 eyebrow_aspect; | ||
| 118 | u8 eyebrow_rotate; | ||
| 119 | u8 eyebrow_x; | ||
| 120 | u8 eyebrow_y; | ||
| 121 | u8 nose_type; | ||
| 122 | u8 nose_scale; | ||
| 123 | u8 nose_y; | ||
| 124 | u8 mouth_type; | ||
| 125 | u8 mouth_color; | ||
| 126 | u8 mouth_scale; | ||
| 127 | u8 mouth_aspect; | ||
| 128 | u8 mouth_y; | ||
| 129 | u8 beard_color; | ||
| 130 | u8 beard_type; | ||
| 131 | u8 mustache_type; | ||
| 132 | u8 mustache_scale; | ||
| 133 | u8 mustache_y; | ||
| 134 | u8 glasses_type; | ||
| 135 | u8 glasses_color; | ||
| 136 | u8 glasses_scale; | ||
| 137 | u8 glasses_y; | ||
| 138 | u8 mole_type; | ||
| 139 | u8 mole_scale; | ||
| 140 | u8 mole_x; | ||
| 141 | u8 mole_y; | ||
| 142 | u8 padding; | ||
| 143 | }; | ||
| 144 | static_assert(sizeof(MiiInfo) == 0x58, "MiiInfo has incorrect size."); | ||
| 145 | static_assert(std::has_unique_object_representations_v<MiiInfo>, | ||
| 146 | "All bits of MiiInfo must contribute to its value."); | ||
| 147 | |||
| 148 | #pragma pack(push, 4) | ||
| 149 | |||
| 150 | struct MiiInfoElement { | ||
| 151 | MiiInfoElement(const MiiInfo& info_, Source source_) : info{info_}, source{source_} {} | ||
| 152 | |||
| 153 | MiiInfo info{}; | ||
| 154 | Source source{}; | ||
| 155 | }; | ||
| 156 | static_assert(sizeof(MiiInfoElement) == 0x5c, "MiiInfoElement has incorrect size."); | ||
| 157 | |||
| 158 | struct MiiStoreBitFields { | ||
| 159 | union { | ||
| 160 | u32 word_0{}; | ||
| 161 | |||
| 162 | BitField<0, 8, u32> hair_type; | ||
| 163 | BitField<8, 7, u32> height; | ||
| 164 | BitField<15, 1, u32> mole_type; | ||
| 165 | BitField<16, 7, u32> build; | ||
| 166 | BitField<23, 1, HairFlip> hair_flip; | ||
| 167 | BitField<24, 7, u32> hair_color; | ||
| 168 | BitField<31, 1, u32> type; | ||
| 169 | }; | ||
| 170 | |||
| 171 | union { | ||
| 172 | u32 word_1{}; | ||
| 173 | |||
| 174 | BitField<0, 7, u32> eye_color; | ||
| 175 | BitField<7, 1, Gender> gender; | ||
| 176 | BitField<8, 7, u32> eyebrow_color; | ||
| 177 | BitField<16, 7, u32> mouth_color; | ||
| 178 | BitField<24, 7, u32> beard_color; | ||
| 179 | }; | ||
| 180 | |||
| 181 | union { | ||
| 182 | u32 word_2{}; | ||
| 183 | |||
| 184 | BitField<0, 7, u32> glasses_color; | ||
| 185 | BitField<8, 6, u32> eye_type; | ||
| 186 | BitField<14, 2, u32> region_move; | ||
| 187 | BitField<16, 6, u32> mouth_type; | ||
| 188 | BitField<22, 2, FontRegion> font_region; | ||
| 189 | BitField<24, 5, u32> eye_y; | ||
| 190 | BitField<29, 3, u32> glasses_scale; | ||
| 191 | }; | ||
| 192 | |||
| 193 | union { | ||
| 194 | u32 word_3{}; | ||
| 195 | |||
| 196 | BitField<0, 5, u32> eyebrow_type; | ||
| 197 | BitField<5, 3, MustacheType> mustache_type; | ||
| 198 | BitField<8, 5, u32> nose_type; | ||
| 199 | BitField<13, 3, BeardType> beard_type; | ||
| 200 | BitField<16, 5, u32> nose_y; | ||
| 201 | BitField<21, 3, u32> mouth_aspect; | ||
| 202 | BitField<24, 5, u32> mouth_y; | ||
| 203 | BitField<29, 3, u32> eyebrow_aspect; | ||
| 204 | }; | ||
| 205 | |||
| 206 | union { | ||
| 207 | u32 word_4{}; | ||
| 208 | |||
| 209 | BitField<0, 5, u32> mustache_y; | ||
| 210 | BitField<5, 3, u32> eye_rotate; | ||
| 211 | BitField<8, 5, u32> glasses_y; | ||
| 212 | BitField<13, 3, u32> eye_aspect; | ||
| 213 | BitField<16, 5, u32> mole_x; | ||
| 214 | BitField<21, 3, u32> eye_scale; | ||
| 215 | BitField<24, 5, u32> mole_y; | ||
| 216 | }; | ||
| 217 | |||
| 218 | union { | ||
| 219 | u32 word_5{}; | ||
| 220 | |||
| 221 | BitField<0, 5, u32> glasses_type; | ||
| 222 | BitField<8, 4, u32> favorite_color; | ||
| 223 | BitField<12, 4, u32> faceline_type; | ||
| 224 | BitField<16, 4, u32> faceline_color; | ||
| 225 | BitField<20, 4, u32> faceline_wrinkle; | ||
| 226 | BitField<24, 4, u32> faceline_makeup; | ||
| 227 | BitField<28, 4, u32> eye_x; | ||
| 228 | }; | ||
| 229 | |||
| 230 | union { | ||
| 231 | u32 word_6{}; | ||
| 232 | |||
| 233 | BitField<0, 4, u32> eyebrow_scale; | ||
| 234 | BitField<4, 4, u32> eyebrow_rotate; | ||
| 235 | BitField<8, 4, u32> eyebrow_x; | ||
| 236 | BitField<12, 4, u32> eyebrow_y; | ||
| 237 | BitField<16, 4, u32> nose_scale; | ||
| 238 | BitField<20, 4, u32> mouth_scale; | ||
| 239 | BitField<24, 4, u32> mustache_scale; | ||
| 240 | BitField<28, 4, u32> mole_scale; | ||
| 241 | }; | ||
| 242 | }; | ||
| 243 | static_assert(sizeof(MiiStoreBitFields) == 0x1c, "MiiStoreBitFields has incorrect size."); | ||
| 244 | static_assert(std::is_trivially_copyable_v<MiiStoreBitFields>, | ||
| 245 | "MiiStoreBitFields is not trivially copyable."); | ||
| 246 | |||
| 247 | struct MiiStoreData { | ||
| 248 | using Name = std::array<char16_t, 10>; | ||
| 249 | |||
| 250 | MiiStoreData(); | ||
| 251 | MiiStoreData(const Name& name, const MiiStoreBitFields& bit_fields, | ||
| 252 | const Common::UUID& user_id); | ||
| 253 | |||
| 254 | // This corresponds to the above structure MiiStoreBitFields. I did it like this because the | ||
| 255 | // BitField<> type makes this (and any thing that contains it) not trivially copyable, which is | ||
| 256 | // not suitable for our uses. | ||
| 257 | struct { | ||
| 258 | std::array<u8, 0x1C> data{}; | ||
| 259 | static_assert(sizeof(MiiStoreBitFields) == sizeof(data), "data field has incorrect size."); | ||
| 260 | |||
| 261 | Name name{}; | ||
| 262 | Common::UUID uuid{}; | ||
| 263 | } data; | ||
| 264 | |||
| 265 | u16 data_crc{}; | ||
| 266 | u16 device_crc{}; | ||
| 267 | }; | ||
| 268 | static_assert(sizeof(MiiStoreData) == 0x44, "MiiStoreData has incorrect size."); | ||
| 269 | |||
| 270 | struct MiiStoreDataElement { | ||
| 271 | MiiStoreData data{}; | ||
| 272 | Source source{}; | ||
| 273 | }; | ||
| 274 | static_assert(sizeof(MiiStoreDataElement) == 0x48, "MiiStoreDataElement has incorrect size."); | ||
| 275 | |||
| 276 | struct MiiDatabase { | ||
| 277 | u32 magic{}; // 'NFDB' | ||
| 278 | std::array<MiiStoreData, 0x64> miis{}; | ||
| 279 | INSERT_PADDING_BYTES(1); | ||
| 280 | u8 count{}; | ||
| 281 | u16 crc{}; | ||
| 282 | }; | ||
| 283 | static_assert(sizeof(MiiDatabase) == 0x1A98, "MiiDatabase has incorrect size."); | ||
| 284 | |||
| 285 | struct RandomMiiValues { | ||
| 286 | std::array<u8, 0xbc> values{}; | ||
| 287 | }; | ||
| 288 | static_assert(sizeof(RandomMiiValues) == 0xbc, "RandomMiiValues has incorrect size."); | ||
| 289 | |||
| 290 | struct RandomMiiData4 { | ||
| 291 | Gender gender{}; | ||
| 292 | Age age{}; | ||
| 293 | Race race{}; | ||
| 294 | u32 values_count{}; | ||
| 295 | std::array<u32, 47> values{}; | ||
| 296 | }; | ||
| 297 | static_assert(sizeof(RandomMiiData4) == 0xcc, "RandomMiiData4 has incorrect size."); | ||
| 298 | |||
| 299 | struct RandomMiiData3 { | ||
| 300 | u32 arg_1; | ||
| 301 | u32 arg_2; | ||
| 302 | u32 values_count; | ||
| 303 | std::array<u32, 47> values{}; | ||
| 304 | }; | ||
| 305 | static_assert(sizeof(RandomMiiData3) == 0xc8, "RandomMiiData3 has incorrect size."); | ||
| 306 | |||
| 307 | struct RandomMiiData2 { | ||
| 308 | u32 arg_1; | ||
| 309 | u32 values_count; | ||
| 310 | std::array<u32, 47> values{}; | ||
| 311 | }; | ||
| 312 | static_assert(sizeof(RandomMiiData2) == 0xc4, "RandomMiiData2 has incorrect size."); | ||
| 313 | |||
| 314 | struct DefaultMii { | ||
| 315 | u32 face_type{}; | ||
| 316 | u32 face_color{}; | ||
| 317 | u32 face_wrinkle{}; | ||
| 318 | u32 face_makeup{}; | ||
| 319 | u32 hair_type{}; | ||
| 320 | u32 hair_color{}; | ||
| 321 | u32 hair_flip{}; | ||
| 322 | u32 eye_type{}; | ||
| 323 | u32 eye_color{}; | ||
| 324 | u32 eye_scale{}; | ||
| 325 | u32 eye_aspect{}; | ||
| 326 | u32 eye_rotate{}; | ||
| 327 | u32 eye_x{}; | ||
| 328 | u32 eye_y{}; | ||
| 329 | u32 eyebrow_type{}; | ||
| 330 | u32 eyebrow_color{}; | ||
| 331 | u32 eyebrow_scale{}; | ||
| 332 | u32 eyebrow_aspect{}; | ||
| 333 | u32 eyebrow_rotate{}; | ||
| 334 | u32 eyebrow_x{}; | ||
| 335 | u32 eyebrow_y{}; | ||
| 336 | u32 nose_type{}; | ||
| 337 | u32 nose_scale{}; | ||
| 338 | u32 nose_y{}; | ||
| 339 | u32 mouth_type{}; | ||
| 340 | u32 mouth_color{}; | ||
| 341 | u32 mouth_scale{}; | ||
| 342 | u32 mouth_aspect{}; | ||
| 343 | u32 mouth_y{}; | ||
| 344 | u32 mustache_type{}; | ||
| 345 | u32 beard_type{}; | ||
| 346 | u32 beard_color{}; | ||
| 347 | u32 mustache_scale{}; | ||
| 348 | u32 mustache_y{}; | ||
| 349 | u32 glasses_type{}; | ||
| 350 | u32 glasses_color{}; | ||
| 351 | u32 glasses_scale{}; | ||
| 352 | u32 glasses_y{}; | ||
| 353 | u32 mole_type{}; | ||
| 354 | u32 mole_scale{}; | ||
| 355 | u32 mole_x{}; | ||
| 356 | u32 mole_y{}; | ||
| 357 | u32 height{}; | ||
| 358 | u32 weight{}; | ||
| 359 | Gender gender{}; | ||
| 360 | u32 favorite_color{}; | ||
| 361 | u32 region{}; | ||
| 362 | FontRegion font_region{}; | ||
| 363 | u32 type{}; | ||
| 364 | INSERT_PADDING_WORDS(5); | ||
| 365 | }; | ||
| 366 | static_assert(sizeof(DefaultMii) == 0xd8, "MiiStoreData has incorrect size."); | ||
| 367 | |||
| 368 | #pragma pack(pop) | ||
| 369 | |||
| 67 | } // namespace Service::Mii | 370 | } // namespace Service::Mii |
diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index 513107715..dab99b675 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include "core/hid/hid_types.h" | 12 | #include "core/hid/hid_types.h" |
| 13 | #include "core/hle/ipc_helpers.h" | 13 | #include "core/hle/ipc_helpers.h" |
| 14 | #include "core/hle/kernel/k_event.h" | 14 | #include "core/hle/kernel/k_event.h" |
| 15 | #include "core/hle/service/mii/mii_manager.h" | ||
| 15 | #include "core/hle/service/nfp/nfp.h" | 16 | #include "core/hle/service/nfp/nfp.h" |
| 16 | #include "core/hle/service/nfp/nfp_user.h" | 17 | #include "core/hle/service/nfp/nfp_user.h" |
| 17 | 18 | ||
diff --git a/src/core/hle/service/nfp/nfp.h b/src/core/hle/service/nfp/nfp.h index 022f13b29..ab652f635 100644 --- a/src/core/hle/service/nfp/nfp.h +++ b/src/core/hle/service/nfp/nfp.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #include "common/common_funcs.h" | 10 | #include "common/common_funcs.h" |
| 11 | #include "core/hle/service/kernel_helpers.h" | 11 | #include "core/hle/service/kernel_helpers.h" |
| 12 | #include "core/hle/service/mii/mii_manager.h" | 12 | #include "core/hle/service/mii/types.h" |
| 13 | #include "core/hle/service/service.h" | 13 | #include "core/hle/service/service.h" |
| 14 | 14 | ||
| 15 | namespace Kernel { | 15 | namespace Kernel { |
diff --git a/src/video_core/buffer_cache/buffer_base.h b/src/video_core/buffer_cache/buffer_base.h index be2113f5a..10975884b 100644 --- a/src/video_core/buffer_cache/buffer_base.h +++ b/src/video_core/buffer_cache/buffer_base.h | |||
| @@ -212,7 +212,7 @@ public: | |||
| 212 | void FlushCachedWrites() noexcept { | 212 | void FlushCachedWrites() noexcept { |
| 213 | flags &= ~BufferFlagBits::CachedWrites; | 213 | flags &= ~BufferFlagBits::CachedWrites; |
| 214 | const u64 num_words = NumWords(); | 214 | const u64 num_words = NumWords(); |
| 215 | const u64* const cached_words = Array<Type::CachedCPU>(); | 215 | u64* const cached_words = Array<Type::CachedCPU>(); |
| 216 | u64* const untracked_words = Array<Type::Untracked>(); | 216 | u64* const untracked_words = Array<Type::Untracked>(); |
| 217 | u64* const cpu_words = Array<Type::CPU>(); | 217 | u64* const cpu_words = Array<Type::CPU>(); |
| 218 | for (u64 word_index = 0; word_index < num_words; ++word_index) { | 218 | for (u64 word_index = 0; word_index < num_words; ++word_index) { |
| @@ -220,6 +220,7 @@ public: | |||
| 220 | NotifyRasterizer<false>(word_index, untracked_words[word_index], cached_bits); | 220 | NotifyRasterizer<false>(word_index, untracked_words[word_index], cached_bits); |
| 221 | untracked_words[word_index] |= cached_bits; | 221 | untracked_words[word_index] |= cached_bits; |
| 222 | cpu_words[word_index] |= cached_bits; | 222 | cpu_words[word_index] |= cached_bits; |
| 223 | cached_words[word_index] = 0; | ||
| 223 | } | 224 | } |
| 224 | } | 225 | } |
| 225 | 226 | ||
diff --git a/src/yuzu/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp index 398d8f0b6..116ef54db 100644 --- a/src/yuzu/applets/qt_web_browser.cpp +++ b/src/yuzu/applets/qt_web_browser.cpp | |||
| @@ -11,6 +11,9 @@ | |||
| 11 | #include <QWebEngineScriptCollection> | 11 | #include <QWebEngineScriptCollection> |
| 12 | #include <QWebEngineSettings> | 12 | #include <QWebEngineSettings> |
| 13 | #include <QWebEngineUrlScheme> | 13 | #include <QWebEngineUrlScheme> |
| 14 | |||
| 15 | #include "core/hid/input_interpreter.h" | ||
| 16 | #include "yuzu/applets/qt_web_browser_scripts.h" | ||
| 14 | #endif | 17 | #endif |
| 15 | 18 | ||
| 16 | #include "common/fs/path_util.h" | 19 | #include "common/fs/path_util.h" |
diff --git a/src/yuzu/applets/qt_web_browser.h b/src/yuzu/applets/qt_web_browser.h index 79a08f509..a47059412 100644 --- a/src/yuzu/applets/qt_web_browser.h +++ b/src/yuzu/applets/qt_web_browser.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <atomic> | 7 | #include <atomic> |
| 8 | #include <thread> | ||
| 8 | 9 | ||
| 9 | #include <QObject> | 10 | #include <QObject> |
| 10 | 11 | ||
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 4b943c6ba..d2e735f48 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -775,6 +775,7 @@ void Config::ReadUIValues() { | |||
| 775 | ReadBasicSetting(UISettings::values.pause_when_in_background); | 775 | ReadBasicSetting(UISettings::values.pause_when_in_background); |
| 776 | ReadBasicSetting(UISettings::values.mute_when_in_background); | 776 | ReadBasicSetting(UISettings::values.mute_when_in_background); |
| 777 | ReadBasicSetting(UISettings::values.hide_mouse); | 777 | ReadBasicSetting(UISettings::values.hide_mouse); |
| 778 | ReadBasicSetting(UISettings::values.disable_web_applet); | ||
| 778 | 779 | ||
| 779 | qt_config->endGroup(); | 780 | qt_config->endGroup(); |
| 780 | } | 781 | } |
| @@ -1308,6 +1309,7 @@ void Config::SaveUIValues() { | |||
| 1308 | WriteBasicSetting(UISettings::values.pause_when_in_background); | 1309 | WriteBasicSetting(UISettings::values.pause_when_in_background); |
| 1309 | WriteBasicSetting(UISettings::values.mute_when_in_background); | 1310 | WriteBasicSetting(UISettings::values.mute_when_in_background); |
| 1310 | WriteBasicSetting(UISettings::values.hide_mouse); | 1311 | WriteBasicSetting(UISettings::values.hide_mouse); |
| 1312 | WriteBasicSetting(UISettings::values.disable_web_applet); | ||
| 1311 | 1313 | ||
| 1312 | qt_config->endGroup(); | 1314 | qt_config->endGroup(); |
| 1313 | } | 1315 | } |
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp index c1cf4050c..bd50f7a68 100644 --- a/src/yuzu/configuration/configure_debug.cpp +++ b/src/yuzu/configuration/configure_debug.cpp | |||
| @@ -59,6 +59,13 @@ void ConfigureDebug::SetConfiguration() { | |||
| 59 | ui->disable_loop_safety_checks->setChecked( | 59 | ui->disable_loop_safety_checks->setChecked( |
| 60 | Settings::values.disable_shader_loop_safety_checks.GetValue()); | 60 | Settings::values.disable_shader_loop_safety_checks.GetValue()); |
| 61 | ui->extended_logging->setChecked(Settings::values.extended_logging.GetValue()); | 61 | ui->extended_logging->setChecked(Settings::values.extended_logging.GetValue()); |
| 62 | |||
| 63 | #ifdef YUZU_USE_QT_WEB_ENGINE | ||
| 64 | ui->disable_web_applet->setChecked(UISettings::values.disable_web_applet.GetValue()); | ||
| 65 | #else | ||
| 66 | ui->disable_web_applet->setEnabled(false); | ||
| 67 | ui->disable_web_applet->setText(QString::fromUtf8("Web applet not compiled")); | ||
| 68 | #endif | ||
| 62 | } | 69 | } |
| 63 | 70 | ||
| 64 | void ConfigureDebug::ApplyConfiguration() { | 71 | void ConfigureDebug::ApplyConfiguration() { |
| @@ -80,6 +87,7 @@ void ConfigureDebug::ApplyConfiguration() { | |||
| 80 | ui->disable_loop_safety_checks->isChecked(); | 87 | ui->disable_loop_safety_checks->isChecked(); |
| 81 | Settings::values.disable_macro_jit = ui->disable_macro_jit->isChecked(); | 88 | Settings::values.disable_macro_jit = ui->disable_macro_jit->isChecked(); |
| 82 | Settings::values.extended_logging = ui->extended_logging->isChecked(); | 89 | Settings::values.extended_logging = ui->extended_logging->isChecked(); |
| 90 | UISettings::values.disable_web_applet = ui->disable_web_applet->isChecked(); | ||
| 83 | Debugger::ToggleConsole(); | 91 | Debugger::ToggleConsole(); |
| 84 | Common::Log::Filter filter; | 92 | Common::Log::Filter filter; |
| 85 | filter.ParseFilterString(Settings::values.log_filter.GetValue()); | 93 | filter.ParseFilterString(Settings::values.log_filter.GetValue()); |
diff --git a/src/yuzu/configuration/configure_debug.ui b/src/yuzu/configuration/configure_debug.ui index 4dd870855..edb525e82 100644 --- a/src/yuzu/configuration/configure_debug.ui +++ b/src/yuzu/configuration/configure_debug.ui | |||
| @@ -8,49 +8,49 @@ | |||
| 8 | <property name="title"> | 8 | <property name="title"> |
| 9 | <string>Logging</string> | 9 | <string>Logging</string> |
| 10 | </property> | 10 | </property> |
| 11 | <layout class="QGridLayout" name="gridLayout_1"> | 11 | <layout class="QGridLayout" name="gridLayout_1"> |
| 12 | <item row="0" column="0" colspan="2"> | 12 | <item row="0" column="0" colspan="2"> |
| 13 | <layout class="QHBoxLayout" name="horizontalLayout_1"> | 13 | <layout class="QHBoxLayout" name="horizontalLayout_1"> |
| 14 | <item> | 14 | <item> |
| 15 | <widget class="QLabel" name="label_1"> | 15 | <widget class="QLabel" name="label_1"> |
| 16 | <property name="text"> | ||
| 17 | <string>Global Log Filter</string> | ||
| 18 | </property> | ||
| 19 | </widget> | ||
| 20 | </item> | ||
| 21 | <item> | ||
| 22 | <widget class="QLineEdit" name="log_filter_edit"/> | ||
| 23 | </item> | ||
| 24 | </layout> | ||
| 25 | </item> | ||
| 26 | <item row="1" column="0"> | ||
| 27 | <widget class="QCheckBox" name="toggle_console"> | ||
| 28 | <property name="text"> | ||
| 29 | <string>Show Log in Console</string> | ||
| 30 | </property> | ||
| 31 | </widget> | ||
| 32 | </item> | ||
| 33 | <item row="1" column="1"> | ||
| 34 | <widget class="QPushButton" name="open_log_button"> | ||
| 35 | <property name="text"> | ||
| 36 | <string>Open Log Location</string> | ||
| 37 | </property> | ||
| 38 | </widget> | ||
| 39 | </item> | ||
| 40 | <item row="2" column="0"> | ||
| 41 | <widget class="QCheckBox" name="extended_logging"> | ||
| 42 | <property name="enabled"> | ||
| 43 | <bool>true</bool> | ||
| 44 | </property> | ||
| 45 | <property name="toolTip"> | ||
| 46 | <string>When checked, the max size of the log increases from 100 MB to 1 GB</string> | ||
| 47 | </property> | ||
| 48 | <property name="text"> | 16 | <property name="text"> |
| 49 | <string>Enable Extended Logging**</string> | 17 | <string>Global Log Filter</string> |
| 50 | </property> | 18 | </property> |
| 51 | </widget> | 19 | </widget> |
| 52 | </item> | 20 | </item> |
| 53 | </layout> | 21 | <item> |
| 22 | <widget class="QLineEdit" name="log_filter_edit"/> | ||
| 23 | </item> | ||
| 24 | </layout> | ||
| 25 | </item> | ||
| 26 | <item row="1" column="0"> | ||
| 27 | <widget class="QCheckBox" name="toggle_console"> | ||
| 28 | <property name="text"> | ||
| 29 | <string>Show Log in Console</string> | ||
| 30 | </property> | ||
| 31 | </widget> | ||
| 32 | </item> | ||
| 33 | <item row="1" column="1"> | ||
| 34 | <widget class="QPushButton" name="open_log_button"> | ||
| 35 | <property name="text"> | ||
| 36 | <string>Open Log Location</string> | ||
| 37 | </property> | ||
| 38 | </widget> | ||
| 39 | </item> | ||
| 40 | <item row="2" column="0"> | ||
| 41 | <widget class="QCheckBox" name="extended_logging"> | ||
| 42 | <property name="enabled"> | ||
| 43 | <bool>true</bool> | ||
| 44 | </property> | ||
| 45 | <property name="toolTip"> | ||
| 46 | <string>When checked, the max size of the log increases from 100 MB to 1 GB</string> | ||
| 47 | </property> | ||
| 48 | <property name="text"> | ||
| 49 | <string>Enable Extended Logging**</string> | ||
| 50 | </property> | ||
| 51 | </widget> | ||
| 52 | </item> | ||
| 53 | </layout> | ||
| 54 | </widget> | 54 | </widget> |
| 55 | </item> | 55 | </item> |
| 56 | <item> | 56 | <item> |
| @@ -183,7 +183,7 @@ | |||
| 183 | <string>Advanced</string> | 183 | <string>Advanced</string> |
| 184 | </property> | 184 | </property> |
| 185 | <layout class="QGridLayout" name="gridLayout_4"> | 185 | <layout class="QGridLayout" name="gridLayout_4"> |
| 186 | <item> row="0" column="0"> | 186 | <item row="0" column="0"> |
| 187 | <widget class="QCheckBox" name="quest_flag"> | 187 | <widget class="QCheckBox" name="quest_flag"> |
| 188 | <property name="text"> | 188 | <property name="text"> |
| 189 | <string>Kiosk (Quest) Mode</string> | 189 | <string>Kiosk (Quest) Mode</string> |
| @@ -218,6 +218,13 @@ | |||
| 218 | </property> | 218 | </property> |
| 219 | </widget> | 219 | </widget> |
| 220 | </item> | 220 | </item> |
| 221 | <item row="2" column="1"> | ||
| 222 | <widget class="QCheckBox" name="disable_web_applet"> | ||
| 223 | <property name="text"> | ||
| 224 | <string>Disable Web Applet**</string> | ||
| 225 | </property> | ||
| 226 | </widget> | ||
| 227 | </item> | ||
| 221 | </layout> | 228 | </layout> |
| 222 | </widget> | 229 | </widget> |
| 223 | </item> | 230 | </item> |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index ecd2f9f24..3b7058a2b 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | #include "core/file_sys/vfs_real.h" | 24 | #include "core/file_sys/vfs_real.h" |
| 25 | #include "core/frontend/applets/controller.h" | 25 | #include "core/frontend/applets/controller.h" |
| 26 | #include "core/frontend/applets/general_frontend.h" | 26 | #include "core/frontend/applets/general_frontend.h" |
| 27 | #include "core/frontend/applets/mii.h" | 27 | #include "core/frontend/applets/mii_edit.h" |
| 28 | #include "core/frontend/applets/software_keyboard.h" | 28 | #include "core/frontend/applets/software_keyboard.h" |
| 29 | #include "core/hid/emulated_controller.h" | 29 | #include "core/hid/emulated_controller.h" |
| 30 | #include "core/hid/hid_core.h" | 30 | #include "core/hid/hid_core.h" |
| @@ -582,7 +582,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url, | |||
| 582 | #ifdef YUZU_USE_QT_WEB_ENGINE | 582 | #ifdef YUZU_USE_QT_WEB_ENGINE |
| 583 | 583 | ||
| 584 | // Raw input breaks with the web applet, Disable web applets if enabled | 584 | // Raw input breaks with the web applet, Disable web applets if enabled |
| 585 | if (disable_web_applet || Settings::values.enable_raw_input) { | 585 | if (UISettings::values.disable_web_applet || Settings::values.enable_raw_input) { |
| 586 | emit WebBrowserClosed(Service::AM::Applets::WebExitReason::WindowClosed, | 586 | emit WebBrowserClosed(Service::AM::Applets::WebExitReason::WindowClosed, |
| 587 | "http://localhost/"); | 587 | "http://localhost/"); |
| 588 | return; | 588 | return; |
| @@ -647,12 +647,12 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url, | |||
| 647 | connect(exit_action, &QAction::triggered, this, [this, &web_browser_view] { | 647 | connect(exit_action, &QAction::triggered, this, [this, &web_browser_view] { |
| 648 | const auto result = QMessageBox::warning( | 648 | const auto result = QMessageBox::warning( |
| 649 | this, tr("Disable Web Applet"), | 649 | this, tr("Disable Web Applet"), |
| 650 | tr("Disabling the web applet will cause it to not be shown again for the rest of the " | 650 | tr("Disabling the web applet can lead to undefined behavior and should only be used " |
| 651 | "emulated session. This can lead to undefined behavior and should only be used with " | 651 | "with Super Mario 3D All-Stars. Are you sure you want to disable the web " |
| 652 | "Super Mario 3D All-Stars. Are you sure you want to disable the web applet?"), | 652 | "applet?\n(This can be re-enabled in the Debug settings.)"), |
| 653 | QMessageBox::Yes | QMessageBox::No); | 653 | QMessageBox::Yes | QMessageBox::No); |
| 654 | if (result == QMessageBox::Yes) { | 654 | if (result == QMessageBox::Yes) { |
| 655 | disable_web_applet = true; | 655 | UISettings::values.disable_web_applet = true; |
| 656 | web_browser_view.SetFinished(true); | 656 | web_browser_view.SetFinished(true); |
| 657 | } | 657 | } |
| 658 | }); | 658 | }); |
| @@ -1280,8 +1280,8 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p | |||
| 1280 | system->SetAppletFrontendSet({ | 1280 | system->SetAppletFrontendSet({ |
| 1281 | std::make_unique<QtControllerSelector>(*this), // Controller Selector | 1281 | std::make_unique<QtControllerSelector>(*this), // Controller Selector |
| 1282 | std::make_unique<QtErrorDisplay>(*this), // Error Display | 1282 | std::make_unique<QtErrorDisplay>(*this), // Error Display |
| 1283 | nullptr, // Mii Editor | ||
| 1283 | nullptr, // Parental Controls | 1284 | nullptr, // Parental Controls |
| 1284 | nullptr, // Mii editor | ||
| 1285 | nullptr, // Photo Viewer | 1285 | nullptr, // Photo Viewer |
| 1286 | std::make_unique<QtProfileSelector>(*this), // Profile Selector | 1286 | std::make_unique<QtProfileSelector>(*this), // Profile Selector |
| 1287 | std::make_unique<QtSoftwareKeyboard>(*this), // Software Keyboard | 1287 | std::make_unique<QtSoftwareKeyboard>(*this), // Software Keyboard |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 7659c8000..ab95a7518 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -398,9 +398,6 @@ private: | |||
| 398 | // Last game booted, used for multi-process apps | 398 | // Last game booted, used for multi-process apps |
| 399 | QString last_filename_booted; | 399 | QString last_filename_booted; |
| 400 | 400 | ||
| 401 | // Disables the web applet for the rest of the emulated session | ||
| 402 | bool disable_web_applet{}; | ||
| 403 | |||
| 404 | // Applets | 401 | // Applets |
| 405 | QtSoftwareKeyboardDialog* software_keyboard = nullptr; | 402 | QtSoftwareKeyboardDialog* software_keyboard = nullptr; |
| 406 | 403 | ||
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 06e8b46da..cc5aee382 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h | |||
| @@ -114,6 +114,7 @@ struct Values { | |||
| 114 | 114 | ||
| 115 | bool configuration_applied; | 115 | bool configuration_applied; |
| 116 | bool reset_to_defaults; | 116 | bool reset_to_defaults; |
| 117 | Settings::BasicSetting<bool> disable_web_applet{true, "disable_web_applet"}; | ||
| 117 | }; | 118 | }; |
| 118 | 119 | ||
| 119 | extern Values values; | 120 | extern Values values; |