applets: implement RequestExit

This commit is contained in:
Liam 2022-12-25 13:41:23 -05:00
parent 09da9da6fb
commit 950db851ea
18 changed files with 71 additions and 1 deletions

View file

@ -945,7 +945,7 @@ public:
{0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"}, {0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"},
{1, &ILibraryAppletAccessor::IsCompleted, "IsCompleted"}, {1, &ILibraryAppletAccessor::IsCompleted, "IsCompleted"},
{10, &ILibraryAppletAccessor::Start, "Start"}, {10, &ILibraryAppletAccessor::Start, "Start"},
{20, nullptr, "RequestExit"}, {20, &ILibraryAppletAccessor::RequestExit, "RequestExit"},
{25, nullptr, "Terminate"}, {25, nullptr, "Terminate"},
{30, &ILibraryAppletAccessor::GetResult, "GetResult"}, {30, &ILibraryAppletAccessor::GetResult, "GetResult"},
{50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"}, {50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"},
@ -1010,6 +1010,15 @@ private:
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
} }
void RequestExit(HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called");
ASSERT(applet != nullptr);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(applet->RequestExit());
}
void PushInData(HLERequestContext& ctx) { void PushInData(HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");

View file

@ -174,4 +174,9 @@ void Cabinet::Cancel() {
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
Result Cabinet::RequestExit() {
this->Cancel();
R_SUCCEED();
}
} // namespace Service::AM::Applets } // namespace Service::AM::Applets

View file

@ -89,6 +89,7 @@ public:
void Execute() override; void Execute() override;
void DisplayCompleted(bool apply_changes, std::string_view amiibo_name); void DisplayCompleted(bool apply_changes, std::string_view amiibo_name);
void Cancel(); void Cancel();
Result RequestExit() override;
private: private:
const Core::Frontend::CabinetApplet& frontend; const Core::Frontend::CabinetApplet& frontend;

View file

@ -262,4 +262,9 @@ void Controller::ConfigurationComplete() {
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
Result Controller::RequestExit() {
this->ConfigurationComplete();
R_SUCCEED();
}
} // namespace Service::AM::Applets } // namespace Service::AM::Applets

View file

@ -129,6 +129,7 @@ public:
Result GetStatus() const override; Result GetStatus() const override;
void ExecuteInteractive() override; void ExecuteInteractive() override;
void Execute() override; void Execute() override;
Result RequestExit() override;
void ConfigurationComplete(); void ConfigurationComplete();

View file

@ -209,4 +209,9 @@ void Error::DisplayCompleted() {
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
Result Error::RequestExit() {
this->DisplayCompleted();
R_SUCCEED();
}
} // namespace Service::AM::Applets } // namespace Service::AM::Applets

View file

@ -34,6 +34,7 @@ public:
Result GetStatus() const override; Result GetStatus() const override;
void ExecuteInteractive() override; void ExecuteInteractive() override;
void Execute() override; void Execute() override;
Result RequestExit() override;
void DisplayCompleted(); void DisplayCompleted();

View file

@ -150,6 +150,11 @@ void Auth::AuthFinished(bool is_successful) {
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
Result Auth::RequestExit() {
this->AuthFinished(false);
R_SUCCEED();
}
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_, applet_mode_}, frontend{frontend_}, system{system_} {} : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {}
@ -202,6 +207,11 @@ void PhotoViewer::ViewFinished() {
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
Result PhotoViewer::RequestExit() {
this->ViewFinished();
R_SUCCEED();
}
StubApplet::StubApplet(Core::System& system_, AppletId id_, LibraryAppletMode applet_mode_) StubApplet::StubApplet(Core::System& system_, AppletId id_, LibraryAppletMode applet_mode_)
: Applet{system_, applet_mode_}, id{id_}, system{system_} {} : Applet{system_, applet_mode_}, id{id_}, system{system_} {}
@ -250,4 +260,9 @@ void StubApplet::Execute() {
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
Result StubApplet::RequestExit() {
// Nothing to do.
R_SUCCEED();
}
} // namespace Service::AM::Applets } // namespace Service::AM::Applets

View file

@ -28,6 +28,7 @@ public:
Result GetStatus() const override; Result GetStatus() const override;
void ExecuteInteractive() override; void ExecuteInteractive() override;
void Execute() override; void Execute() override;
Result RequestExit() override;
void AuthFinished(bool is_successful = true); void AuthFinished(bool is_successful = true);
@ -59,6 +60,7 @@ public:
Result GetStatus() const override; Result GetStatus() const override;
void ExecuteInteractive() override; void ExecuteInteractive() override;
void Execute() override; void Execute() override;
Result RequestExit() override;
void ViewFinished(); void ViewFinished();
@ -80,6 +82,7 @@ public:
Result GetStatus() const override; Result GetStatus() const override;
void ExecuteInteractive() override; void ExecuteInteractive() override;
void Execute() override; void Execute() override;
Result RequestExit() override;
private: private:
AppletId id; AppletId id;

View file

@ -135,4 +135,9 @@ void MiiEdit::MiiEditOutputForCharInfoEditing(MiiEditResult result,
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
Result MiiEdit::RequestExit() {
this->MiiEditOutput(MiiEditResult::Cancel, -1);
R_SUCCEED();
}
} // namespace Service::AM::Applets } // namespace Service::AM::Applets

View file

@ -25,6 +25,7 @@ public:
Result GetStatus() const override; Result GetStatus() const override;
void ExecuteInteractive() override; void ExecuteInteractive() override;
void Execute() override; void Execute() override;
Result RequestExit() override;
void MiiEditOutput(MiiEditResult result, s32 index); void MiiEditOutput(MiiEditResult result, s32 index);

View file

@ -73,4 +73,9 @@ void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) {
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
Result ProfileSelect::RequestExit() {
this->SelectionComplete(std::nullopt);
R_SUCCEED();
}
} // namespace Service::AM::Applets } // namespace Service::AM::Applets

View file

@ -42,6 +42,7 @@ public:
Result GetStatus() const override; Result GetStatus() const override;
void ExecuteInteractive() override; void ExecuteInteractive() override;
void Execute() override; void Execute() override;
Result RequestExit() override;
void SelectionComplete(std::optional<Common::UUID> uuid); void SelectionComplete(std::optional<Common::UUID> uuid);

View file

@ -770,6 +770,11 @@ void SoftwareKeyboard::ExitKeyboard() {
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
Result SoftwareKeyboard::RequestExit() {
this->ExitKeyboard();
R_SUCCEED();
}
// Inline Software Keyboard Requests // Inline Software Keyboard Requests
void SoftwareKeyboard::RequestFinalize(const std::vector<u8>& request_data) { void SoftwareKeyboard::RequestFinalize(const std::vector<u8>& request_data) {

View file

@ -31,6 +31,7 @@ public:
Result GetStatus() const override; Result GetStatus() const override;
void ExecuteInteractive() override; void ExecuteInteractive() override;
void Execute() override; void Execute() override;
Result RequestExit() override;
/** /**
* Submits the input text to the application. * Submits the input text to the application.

View file

@ -363,6 +363,11 @@ void WebBrowser::WebBrowserExit(WebExitReason exit_reason, std::string last_url)
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
Result WebBrowser::RequestExit() {
this->WebBrowserExit(WebExitReason::ExitRequested);
R_SUCCEED();
}
bool WebBrowser::InputTLVExistsInMap(WebArgInputTLVType input_tlv_type) const { bool WebBrowser::InputTLVExistsInMap(WebArgInputTLVType input_tlv_type) const {
return web_arg_input_tlv_map.find(input_tlv_type) != web_arg_input_tlv_map.end(); return web_arg_input_tlv_map.find(input_tlv_type) != web_arg_input_tlv_map.end();
} }

View file

@ -35,6 +35,7 @@ public:
Result GetStatus() const override; Result GetStatus() const override;
void ExecuteInteractive() override; void ExecuteInteractive() override;
void Execute() override; void Execute() override;
Result RequestExit() override;
void ExtractOfflineRomFS(); void ExtractOfflineRomFS();

View file

@ -142,6 +142,7 @@ public:
virtual Result GetStatus() const = 0; virtual Result GetStatus() const = 0;
virtual void ExecuteInteractive() = 0; virtual void ExecuteInteractive() = 0;
virtual void Execute() = 0; virtual void Execute() = 0;
virtual Result RequestExit() = 0;
AppletDataBroker& GetBroker() { AppletDataBroker& GetBroker() {
return broker; return broker;