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"},
{1, &ILibraryAppletAccessor::IsCompleted, "IsCompleted"},
{10, &ILibraryAppletAccessor::Start, "Start"},
{20, nullptr, "RequestExit"},
{20, &ILibraryAppletAccessor::RequestExit, "RequestExit"},
{25, nullptr, "Terminate"},
{30, &ILibraryAppletAccessor::GetResult, "GetResult"},
{50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"},
@ -1010,6 +1010,15 @@ private:
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) {
LOG_DEBUG(Service_AM, "called");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,6 +31,7 @@ public:
Result GetStatus() const override;
void ExecuteInteractive() override;
void Execute() override;
Result RequestExit() override;
/**
* 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();
}
Result WebBrowser::RequestExit() {
this->WebBrowserExit(WebExitReason::ExitRequested);
R_SUCCEED();
}
bool WebBrowser::InputTLVExistsInMap(WebArgInputTLVType input_tlv_type) const {
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;
void ExecuteInteractive() override;
void Execute() override;
Result RequestExit() override;
void ExtractOfflineRomFS();

View File

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