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

applets: Make the applet mode a protected property of Applet

This commit is contained in:
Morph 2021-04-17 08:50:49 -04:00
parent 9ad77ba6d3
commit ba2c917842
14 changed files with 20 additions and 22 deletions

View File

@ -128,7 +128,8 @@ std::shared_ptr<Kernel::KReadableEvent> AppletDataBroker::GetStateChangedEvent()
return state_changed_event->GetReadableEvent(); return state_changed_event->GetReadableEvent();
} }
Applet::Applet(Kernel::KernelCore& kernel_) : broker{kernel_} {} Applet::Applet(Kernel::KernelCore& kernel_, LibraryAppletMode applet_mode_)
: broker{kernel_}, applet_mode{applet_mode_} {}
Applet::~Applet() = default; Applet::~Applet() = default;

View File

@ -127,7 +127,7 @@ private:
class Applet { class Applet {
public: public:
explicit Applet(Kernel::KernelCore& kernel_); explicit Applet(Kernel::KernelCore& kernel_, LibraryAppletMode applet_mode_);
virtual ~Applet(); virtual ~Applet();
virtual void Initialize(); virtual void Initialize();
@ -137,10 +137,6 @@ public:
virtual void ExecuteInteractive() = 0; virtual void ExecuteInteractive() = 0;
virtual void Execute() = 0; virtual void Execute() = 0;
bool IsInitialized() const {
return initialized;
}
AppletDataBroker& GetBroker() { AppletDataBroker& GetBroker() {
return broker; return broker;
} }
@ -149,6 +145,14 @@ public:
return broker; return broker;
} }
LibraryAppletMode GetLibraryAppletMode() const {
return applet_mode;
}
bool IsInitialized() const {
return initialized;
}
protected: protected:
struct CommonArguments { struct CommonArguments {
u32_le arguments_version; u32_le arguments_version;
@ -162,6 +166,7 @@ protected:
CommonArguments common_args{}; CommonArguments common_args{};
AppletDataBroker broker; AppletDataBroker broker;
LibraryAppletMode applet_mode;
bool initialized = false; bool initialized = false;
}; };

View File

@ -47,7 +47,7 @@ static Core::Frontend::ControllerParameters ConvertToFrontendParameters(
Controller::Controller(Core::System& system_, LibraryAppletMode applet_mode_, Controller::Controller(Core::System& system_, LibraryAppletMode applet_mode_,
const Core::Frontend::ControllerApplet& frontend_) const Core::Frontend::ControllerApplet& frontend_)
: Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {} : Applet{system_.Kernel(), applet_mode_}, frontend{frontend_}, system{system_} {}
Controller::~Controller() = default; Controller::~Controller() = default;

View File

@ -120,7 +120,6 @@ public:
void ConfigurationComplete(); void ConfigurationComplete();
private: private:
LibraryAppletMode applet_mode;
const Core::Frontend::ControllerApplet& frontend; const Core::Frontend::ControllerApplet& frontend;
Core::System& system; Core::System& system;

View File

@ -88,7 +88,7 @@ ResultCode Decode64BitError(u64 error) {
Error::Error(Core::System& system_, LibraryAppletMode applet_mode_, Error::Error(Core::System& system_, LibraryAppletMode applet_mode_,
const Core::Frontend::ErrorApplet& frontend_) const Core::Frontend::ErrorApplet& frontend_)
: Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {} : Applet{system_.Kernel(), applet_mode_}, frontend{frontend_}, system{system_} {}
Error::~Error() = default; Error::~Error() = default;

View File

@ -41,7 +41,6 @@ public:
private: private:
union ErrorArguments; union ErrorArguments;
LibraryAppletMode applet_mode;
const Core::Frontend::ErrorApplet& frontend; const Core::Frontend::ErrorApplet& frontend;
ResultCode error_code = RESULT_SUCCESS; ResultCode error_code = RESULT_SUCCESS;
ErrorAppletMode mode = ErrorAppletMode::ShowError; ErrorAppletMode mode = ErrorAppletMode::ShowError;

View File

@ -39,7 +39,7 @@ static void LogCurrentStorage(AppletDataBroker& broker, std::string_view prefix)
Auth::Auth(Core::System& system_, LibraryAppletMode applet_mode_, Auth::Auth(Core::System& system_, LibraryAppletMode applet_mode_,
Core::Frontend::ParentalControlsApplet& frontend_) Core::Frontend::ParentalControlsApplet& frontend_)
: Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {} : Applet{system_.Kernel(), applet_mode_}, frontend{frontend_}, system{system_} {}
Auth::~Auth() = default; Auth::~Auth() = default;
@ -155,7 +155,7 @@ void Auth::AuthFinished(bool is_successful) {
PhotoViewer::PhotoViewer(Core::System& system_, LibraryAppletMode applet_mode_, PhotoViewer::PhotoViewer(Core::System& system_, LibraryAppletMode applet_mode_,
const Core::Frontend::PhotoViewerApplet& frontend_) const Core::Frontend::PhotoViewerApplet& frontend_)
: Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {} : Applet{system_.Kernel(), applet_mode_}, frontend{frontend_}, system{system_} {}
PhotoViewer::~PhotoViewer() = default; PhotoViewer::~PhotoViewer() = default;
@ -205,7 +205,7 @@ void PhotoViewer::ViewFinished() {
} }
StubApplet::StubApplet(Core::System& system_, AppletId id_, LibraryAppletMode applet_mode_) StubApplet::StubApplet(Core::System& system_, AppletId id_, LibraryAppletMode applet_mode_)
: Applet{system_.Kernel()}, id{id_}, applet_mode{applet_mode_}, system{system_} {} : Applet{system_.Kernel(), applet_mode_}, id{id_}, system{system_} {}
StubApplet::~StubApplet() = default; StubApplet::~StubApplet() = default;

View File

@ -33,7 +33,6 @@ public:
void AuthFinished(bool is_successful = true); void AuthFinished(bool is_successful = true);
private: private:
LibraryAppletMode applet_mode;
Core::Frontend::ParentalControlsApplet& frontend; Core::Frontend::ParentalControlsApplet& frontend;
Core::System& system; Core::System& system;
bool complete = false; bool complete = false;
@ -65,7 +64,6 @@ public:
void ViewFinished(); void ViewFinished();
private: private:
LibraryAppletMode applet_mode;
const Core::Frontend::PhotoViewerApplet& frontend; const Core::Frontend::PhotoViewerApplet& frontend;
bool complete = false; bool complete = false;
PhotoViewerAppletMode mode = PhotoViewerAppletMode::CurrentApp; PhotoViewerAppletMode mode = PhotoViewerAppletMode::CurrentApp;
@ -86,7 +84,6 @@ public:
private: private:
AppletId id; AppletId id;
LibraryAppletMode applet_mode;
Core::System& system; Core::System& system;
}; };

View File

@ -17,7 +17,7 @@ constexpr ResultCode ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1};
ProfileSelect::ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_, ProfileSelect::ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_,
const Core::Frontend::ProfileSelectApplet& frontend_) const Core::Frontend::ProfileSelectApplet& frontend_)
: Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {} : Applet{system_.Kernel(), applet_mode_}, frontend{frontend_}, system{system_} {}
ProfileSelect::~ProfileSelect() = default; ProfileSelect::~ProfileSelect() = default;

View File

@ -47,7 +47,6 @@ public:
void SelectionComplete(std::optional<Common::UUID> uuid); void SelectionComplete(std::optional<Common::UUID> uuid);
private: private:
LibraryAppletMode applet_mode;
const Core::Frontend::ProfileSelectApplet& frontend; const Core::Frontend::ProfileSelectApplet& frontend;
UserSelectionConfig config; UserSelectionConfig config;

View File

@ -44,7 +44,7 @@ void SetReplyBase(std::vector<u8>& reply, SwkbdState state, SwkbdReplyType reply
SoftwareKeyboard::SoftwareKeyboard(Core::System& system_, LibraryAppletMode applet_mode_, SoftwareKeyboard::SoftwareKeyboard(Core::System& system_, LibraryAppletMode applet_mode_,
Core::Frontend::SoftwareKeyboardApplet& frontend_) Core::Frontend::SoftwareKeyboardApplet& frontend_)
: Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {} : Applet{system_.Kernel(), applet_mode_}, frontend{frontend_}, system{system_} {}
SoftwareKeyboard::~SoftwareKeyboard() = default; SoftwareKeyboard::~SoftwareKeyboard() = default;

View File

@ -136,7 +136,6 @@ private:
void ReplyChangedStringUtf8V2(); void ReplyChangedStringUtf8V2();
void ReplyMovedCursorUtf8V2(); void ReplyMovedCursorUtf8V2();
LibraryAppletMode applet_mode;
Core::Frontend::SoftwareKeyboardApplet& frontend; Core::Frontend::SoftwareKeyboardApplet& frontend;
Core::System& system; Core::System& system;

View File

@ -210,7 +210,7 @@ void ExtractSharedFonts(Core::System& system) {
WebBrowser::WebBrowser(Core::System& system_, LibraryAppletMode applet_mode_, WebBrowser::WebBrowser(Core::System& system_, LibraryAppletMode applet_mode_,
const Core::Frontend::WebBrowserApplet& frontend_) const Core::Frontend::WebBrowserApplet& frontend_)
: Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend(frontend_), system{system_} {} : Applet{system_.Kernel(), applet_mode_}, frontend(frontend_), system{system_} {}
WebBrowser::~WebBrowser() = default; WebBrowser::~WebBrowser() = default;

View File

@ -64,7 +64,6 @@ private:
void ExecuteWifi(); void ExecuteWifi();
void ExecuteLobby(); void ExecuteLobby();
LibraryAppletMode applet_mode;
const Core::Frontend::WebBrowserApplet& frontend; const Core::Frontend::WebBrowserApplet& frontend;
bool complete{false}; bool complete{false};