yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

applets: Port current applets to take frontend in constructor

As opposed to using Core::System::GetInstance()
This commit is contained in:
Zach Hilman 2019-03-11 19:35:01 -04:00
parent f7540157e4
commit d273bec68f
6 changed files with 16 additions and 14 deletions

View File

@ -15,7 +15,9 @@ namespace Service::AM::Applets {
constexpr ResultCode ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1};
ProfileSelect::ProfileSelect() = default;
ProfileSelect::ProfileSelect(const Core::Frontend::ProfileSelectApplet& frontend)
: frontend(frontend) {}
ProfileSelect::~ProfileSelect() = default;
void ProfileSelect::Initialize() {
@ -51,8 +53,6 @@ void ProfileSelect::Execute() {
return;
}
const auto& frontend{Core::System::GetInstance().GetProfileSelector()};
frontend.SelectProfile([this](std::optional<Account::UUID> uuid) { SelectionComplete(uuid); });
}

View File

@ -7,6 +7,7 @@
#include <vector>
#include "common/common_funcs.h"
#include "core/frontend/applets/software_keyboard.h"
#include "core/hle/service/acc/profile_manager.h"
#include "core/hle/service/am/applets/applets.h"
@ -28,7 +29,7 @@ static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has inco
class ProfileSelect final : public Applet {
public:
ProfileSelect();
ProfileSelect(const Core::Frontend::ProfileSelectApplet& frontend);
~ProfileSelect() override;
void Initialize() override;
@ -41,6 +42,8 @@ public:
void SelectionComplete(std::optional<Account::UUID> uuid);
private:
const Core::Frontend::ProfileSelectApplet& frontend;
UserSelectionConfig config;
bool complete = false;
ResultCode status = RESULT_SUCCESS;

View File

@ -39,7 +39,8 @@ static Core::Frontend::SoftwareKeyboardParameters ConvertToFrontendParameters(
return params;
}
SoftwareKeyboard::SoftwareKeyboard() = default;
SoftwareKeyboard::SoftwareKeyboard(const Core::Frontend::SoftwareKeyboardApplet& frontend)
: frontend(frontend) {}
SoftwareKeyboard::~SoftwareKeyboard() = default;
@ -90,8 +91,6 @@ void SoftwareKeyboard::ExecuteInteractive() {
if (status == INTERACTIVE_STATUS_OK) {
complete = true;
} else {
const auto& frontend{Core::System::GetInstance().GetSoftwareKeyboard()};
std::array<char16_t, SWKBD_OUTPUT_INTERACTIVE_BUFFER_SIZE / 2 - 2> string;
std::memcpy(string.data(), data.data() + 4, string.size() * 2);
frontend.SendTextCheckDialog(
@ -106,8 +105,6 @@ void SoftwareKeyboard::Execute() {
return;
}
const auto& frontend{Core::System::GetInstance().GetSoftwareKeyboard()};
const auto parameters = ConvertToFrontendParameters(config, initial_text);
frontend.RequestText([this](std::optional<std::u16string> text) { WriteText(text); },

View File

@ -55,7 +55,7 @@ static_assert(sizeof(KeyboardConfig) == 0x3E0, "KeyboardConfig has incorrect siz
class SoftwareKeyboard final : public Applet {
public:
SoftwareKeyboard();
SoftwareKeyboard(const Core::Frontend::SoftwareKeyboardApplet& frontend);
~SoftwareKeyboard() override;
void Initialize() override;
@ -68,6 +68,8 @@ public:
void WriteText(std::optional<std::u16string> text);
private:
const Core::Frontend::SoftwareKeyboardApplet& frontend;
KeyboardConfig config;
std::u16string initial_text;
bool complete = false;

View File

@ -95,7 +95,7 @@ static FileSys::VirtualFile GetManualRomFS() {
return nullptr;
}
WebBrowser::WebBrowser() = default;
WebBrowser::WebBrowser(const Core::Frontend::WebBrowserApplet& frontend) : frontend(frontend) {}
WebBrowser::~WebBrowser() = default;
@ -152,8 +152,6 @@ void WebBrowser::Execute() {
return;
}
auto& frontend{Core::System::GetInstance().GetWebBrowser()};
frontend.OpenPage(filename, [this] { UnpackRomFS(); }, [this] { Finalize(); });
}

View File

@ -12,7 +12,7 @@ namespace Service::AM::Applets {
class WebBrowser final : public Applet {
public:
WebBrowser();
WebBrowser(const Core::Frontend::WebBrowserApplet& frontend);
~WebBrowser() override;
void Initialize() override;
@ -32,6 +32,8 @@ public:
void Finalize();
private:
const Core::Frontend::WebBrowserApplet& frontend;
bool complete = false;
bool unpacked = false;
ResultCode status = RESULT_SUCCESS;