mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	applets: implement RequestExit
This commit is contained in:
		@@ -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");
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -174,4 +174,9 @@ void Cabinet::Cancel() {
 | 
			
		||||
    broker.SignalStateChanged();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Result Cabinet::RequestExit() {
 | 
			
		||||
    this->Cancel();
 | 
			
		||||
    R_SUCCEED();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace Service::AM::Applets
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -262,4 +262,9 @@ void Controller::ConfigurationComplete() {
 | 
			
		||||
    broker.SignalStateChanged();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Result Controller::RequestExit() {
 | 
			
		||||
    this->ConfigurationComplete();
 | 
			
		||||
    R_SUCCEED();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace Service::AM::Applets
 | 
			
		||||
 
 | 
			
		||||
@@ -129,6 +129,7 @@ public:
 | 
			
		||||
    Result GetStatus() const override;
 | 
			
		||||
    void ExecuteInteractive() override;
 | 
			
		||||
    void Execute() override;
 | 
			
		||||
    Result RequestExit() override;
 | 
			
		||||
 | 
			
		||||
    void ConfigurationComplete();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -209,4 +209,9 @@ void Error::DisplayCompleted() {
 | 
			
		||||
    broker.SignalStateChanged();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Result Error::RequestExit() {
 | 
			
		||||
    this->DisplayCompleted();
 | 
			
		||||
    R_SUCCEED();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace Service::AM::Applets
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,7 @@ public:
 | 
			
		||||
    Result GetStatus() const override;
 | 
			
		||||
    void ExecuteInteractive() override;
 | 
			
		||||
    void Execute() override;
 | 
			
		||||
    Result RequestExit() override;
 | 
			
		||||
 | 
			
		||||
    void DisplayCompleted();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,7 @@ public:
 | 
			
		||||
    Result GetStatus() const override;
 | 
			
		||||
    void ExecuteInteractive() override;
 | 
			
		||||
    void Execute() override;
 | 
			
		||||
    Result RequestExit() override;
 | 
			
		||||
 | 
			
		||||
    void MiiEditOutput(MiiEditResult result, s32 index);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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.
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,7 @@ public:
 | 
			
		||||
    Result GetStatus() const override;
 | 
			
		||||
    void ExecuteInteractive() override;
 | 
			
		||||
    void Execute() override;
 | 
			
		||||
    Result RequestExit() override;
 | 
			
		||||
 | 
			
		||||
    void ExtractOfflineRomFS();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user