diff options
| author | 2019-03-11 19:35:01 -0400 | |
|---|---|---|
| committer | 2019-04-17 11:35:24 -0400 | |
| commit | d273bec68fd867f047944ab9d28ac5c5c6617571 (patch) | |
| tree | 92efbacd5d67fa1ed73afcdff18d8a22fce3b8d0 /src/core/hle | |
| parent | web_browser: Make OpenPage const (diff) | |
| download | yuzu-d273bec68fd867f047944ab9d28ac5c5c6617571.tar.gz yuzu-d273bec68fd867f047944ab9d28ac5c5c6617571.tar.xz yuzu-d273bec68fd867f047944ab9d28ac5c5c6617571.zip | |
applets: Port current applets to take frontend in constructor
As opposed to using Core::System::GetInstance()
Diffstat (limited to 'src/core/hle')
6 files changed, 16 insertions, 14 deletions
diff --git a/src/core/hle/service/am/applets/profile_select.cpp b/src/core/hle/service/am/applets/profile_select.cpp index 14e2a1fee..d113bd2eb 100644 --- a/src/core/hle/service/am/applets/profile_select.cpp +++ b/src/core/hle/service/am/applets/profile_select.cpp | |||
| @@ -15,7 +15,9 @@ namespace Service::AM::Applets { | |||
| 15 | 15 | ||
| 16 | constexpr ResultCode ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1}; | 16 | constexpr ResultCode ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1}; |
| 17 | 17 | ||
| 18 | ProfileSelect::ProfileSelect() = default; | 18 | ProfileSelect::ProfileSelect(const Core::Frontend::ProfileSelectApplet& frontend) |
| 19 | : frontend(frontend) {} | ||
| 20 | |||
| 19 | ProfileSelect::~ProfileSelect() = default; | 21 | ProfileSelect::~ProfileSelect() = default; |
| 20 | 22 | ||
| 21 | void ProfileSelect::Initialize() { | 23 | void ProfileSelect::Initialize() { |
| @@ -51,8 +53,6 @@ void ProfileSelect::Execute() { | |||
| 51 | return; | 53 | return; |
| 52 | } | 54 | } |
| 53 | 55 | ||
| 54 | const auto& frontend{Core::System::GetInstance().GetProfileSelector()}; | ||
| 55 | |||
| 56 | frontend.SelectProfile([this](std::optional<Account::UUID> uuid) { SelectionComplete(uuid); }); | 56 | frontend.SelectProfile([this](std::optional<Account::UUID> uuid) { SelectionComplete(uuid); }); |
| 57 | } | 57 | } |
| 58 | 58 | ||
diff --git a/src/core/hle/service/am/applets/profile_select.h b/src/core/hle/service/am/applets/profile_select.h index 787485f22..cb281dd52 100644 --- a/src/core/hle/service/am/applets/profile_select.h +++ b/src/core/hle/service/am/applets/profile_select.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <vector> | 7 | #include <vector> |
| 8 | 8 | ||
| 9 | #include "common/common_funcs.h" | 9 | #include "common/common_funcs.h" |
| 10 | #include "core/frontend/applets/software_keyboard.h" | ||
| 10 | #include "core/hle/service/acc/profile_manager.h" | 11 | #include "core/hle/service/acc/profile_manager.h" |
| 11 | #include "core/hle/service/am/applets/applets.h" | 12 | #include "core/hle/service/am/applets/applets.h" |
| 12 | 13 | ||
| @@ -28,7 +29,7 @@ static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has inco | |||
| 28 | 29 | ||
| 29 | class ProfileSelect final : public Applet { | 30 | class ProfileSelect final : public Applet { |
| 30 | public: | 31 | public: |
| 31 | ProfileSelect(); | 32 | ProfileSelect(const Core::Frontend::ProfileSelectApplet& frontend); |
| 32 | ~ProfileSelect() override; | 33 | ~ProfileSelect() override; |
| 33 | 34 | ||
| 34 | void Initialize() override; | 35 | void Initialize() override; |
| @@ -41,6 +42,8 @@ public: | |||
| 41 | void SelectionComplete(std::optional<Account::UUID> uuid); | 42 | void SelectionComplete(std::optional<Account::UUID> uuid); |
| 42 | 43 | ||
| 43 | private: | 44 | private: |
| 45 | const Core::Frontend::ProfileSelectApplet& frontend; | ||
| 46 | |||
| 44 | UserSelectionConfig config; | 47 | UserSelectionConfig config; |
| 45 | bool complete = false; | 48 | bool complete = false; |
| 46 | ResultCode status = RESULT_SUCCESS; | 49 | ResultCode status = RESULT_SUCCESS; |
diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/software_keyboard.cpp index 8c5bd6059..e197990f7 100644 --- a/src/core/hle/service/am/applets/software_keyboard.cpp +++ b/src/core/hle/service/am/applets/software_keyboard.cpp | |||
| @@ -39,7 +39,8 @@ static Core::Frontend::SoftwareKeyboardParameters ConvertToFrontendParameters( | |||
| 39 | return params; | 39 | return params; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | SoftwareKeyboard::SoftwareKeyboard() = default; | 42 | SoftwareKeyboard::SoftwareKeyboard(const Core::Frontend::SoftwareKeyboardApplet& frontend) |
| 43 | : frontend(frontend) {} | ||
| 43 | 44 | ||
| 44 | SoftwareKeyboard::~SoftwareKeyboard() = default; | 45 | SoftwareKeyboard::~SoftwareKeyboard() = default; |
| 45 | 46 | ||
| @@ -90,8 +91,6 @@ void SoftwareKeyboard::ExecuteInteractive() { | |||
| 90 | if (status == INTERACTIVE_STATUS_OK) { | 91 | if (status == INTERACTIVE_STATUS_OK) { |
| 91 | complete = true; | 92 | complete = true; |
| 92 | } else { | 93 | } else { |
| 93 | const auto& frontend{Core::System::GetInstance().GetSoftwareKeyboard()}; | ||
| 94 | |||
| 95 | std::array<char16_t, SWKBD_OUTPUT_INTERACTIVE_BUFFER_SIZE / 2 - 2> string; | 94 | std::array<char16_t, SWKBD_OUTPUT_INTERACTIVE_BUFFER_SIZE / 2 - 2> string; |
| 96 | std::memcpy(string.data(), data.data() + 4, string.size() * 2); | 95 | std::memcpy(string.data(), data.data() + 4, string.size() * 2); |
| 97 | frontend.SendTextCheckDialog( | 96 | frontend.SendTextCheckDialog( |
| @@ -106,8 +105,6 @@ void SoftwareKeyboard::Execute() { | |||
| 106 | return; | 105 | return; |
| 107 | } | 106 | } |
| 108 | 107 | ||
| 109 | const auto& frontend{Core::System::GetInstance().GetSoftwareKeyboard()}; | ||
| 110 | |||
| 111 | const auto parameters = ConvertToFrontendParameters(config, initial_text); | 108 | const auto parameters = ConvertToFrontendParameters(config, initial_text); |
| 112 | 109 | ||
| 113 | frontend.RequestText([this](std::optional<std::u16string> text) { WriteText(text); }, | 110 | frontend.RequestText([this](std::optional<std::u16string> text) { WriteText(text); }, |
diff --git a/src/core/hle/service/am/applets/software_keyboard.h b/src/core/hle/service/am/applets/software_keyboard.h index b93a30d28..e97e1cd5b 100644 --- a/src/core/hle/service/am/applets/software_keyboard.h +++ b/src/core/hle/service/am/applets/software_keyboard.h | |||
| @@ -55,7 +55,7 @@ static_assert(sizeof(KeyboardConfig) == 0x3E0, "KeyboardConfig has incorrect siz | |||
| 55 | 55 | ||
| 56 | class SoftwareKeyboard final : public Applet { | 56 | class SoftwareKeyboard final : public Applet { |
| 57 | public: | 57 | public: |
| 58 | SoftwareKeyboard(); | 58 | SoftwareKeyboard(const Core::Frontend::SoftwareKeyboardApplet& frontend); |
| 59 | ~SoftwareKeyboard() override; | 59 | ~SoftwareKeyboard() override; |
| 60 | 60 | ||
| 61 | void Initialize() override; | 61 | void Initialize() override; |
| @@ -68,6 +68,8 @@ public: | |||
| 68 | void WriteText(std::optional<std::u16string> text); | 68 | void WriteText(std::optional<std::u16string> text); |
| 69 | 69 | ||
| 70 | private: | 70 | private: |
| 71 | const Core::Frontend::SoftwareKeyboardApplet& frontend; | ||
| 72 | |||
| 71 | KeyboardConfig config; | 73 | KeyboardConfig config; |
| 72 | std::u16string initial_text; | 74 | std::u16string initial_text; |
| 73 | bool complete = false; | 75 | bool complete = false; |
diff --git a/src/core/hle/service/am/applets/web_browser.cpp b/src/core/hle/service/am/applets/web_browser.cpp index 7e17df98a..a66e23fce 100644 --- a/src/core/hle/service/am/applets/web_browser.cpp +++ b/src/core/hle/service/am/applets/web_browser.cpp | |||
| @@ -95,7 +95,7 @@ static FileSys::VirtualFile GetManualRomFS() { | |||
| 95 | return nullptr; | 95 | return nullptr; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | WebBrowser::WebBrowser() = default; | 98 | WebBrowser::WebBrowser(const Core::Frontend::WebBrowserApplet& frontend) : frontend(frontend) {} |
| 99 | 99 | ||
| 100 | WebBrowser::~WebBrowser() = default; | 100 | WebBrowser::~WebBrowser() = default; |
| 101 | 101 | ||
| @@ -152,8 +152,6 @@ void WebBrowser::Execute() { | |||
| 152 | return; | 152 | return; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | auto& frontend{Core::System::GetInstance().GetWebBrowser()}; | ||
| 156 | |||
| 157 | frontend.OpenPage(filename, [this] { UnpackRomFS(); }, [this] { Finalize(); }); | 155 | frontend.OpenPage(filename, [this] { UnpackRomFS(); }, [this] { Finalize(); }); |
| 158 | } | 156 | } |
| 159 | 157 | ||
diff --git a/src/core/hle/service/am/applets/web_browser.h b/src/core/hle/service/am/applets/web_browser.h index b9e228fac..894bdb35a 100644 --- a/src/core/hle/service/am/applets/web_browser.h +++ b/src/core/hle/service/am/applets/web_browser.h | |||
| @@ -12,7 +12,7 @@ namespace Service::AM::Applets { | |||
| 12 | 12 | ||
| 13 | class WebBrowser final : public Applet { | 13 | class WebBrowser final : public Applet { |
| 14 | public: | 14 | public: |
| 15 | WebBrowser(); | 15 | WebBrowser(const Core::Frontend::WebBrowserApplet& frontend); |
| 16 | ~WebBrowser() override; | 16 | ~WebBrowser() override; |
| 17 | 17 | ||
| 18 | void Initialize() override; | 18 | void Initialize() override; |
| @@ -32,6 +32,8 @@ public: | |||
| 32 | void Finalize(); | 32 | void Finalize(); |
| 33 | 33 | ||
| 34 | private: | 34 | private: |
| 35 | const Core::Frontend::WebBrowserApplet& frontend; | ||
| 36 | |||
| 35 | bool complete = false; | 37 | bool complete = false; |
| 36 | bool unpacked = false; | 38 | bool unpacked = false; |
| 37 | ResultCode status = RESULT_SUCCESS; | 39 | ResultCode status = RESULT_SUCCESS; |