summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar liamwhite2023-03-29 09:11:34 -0400
committerGravatar GitHub2023-03-29 09:11:34 -0400
commit8bdc51b620f0778f53d76ad9368da97a9213d631 (patch)
tree2a71c944643cda0ab019c22d1d46d58552f002ff /src/core
parentMerge pull request #10003 from german77/disconnect (diff)
parentqt: implement RequestExit for applets (diff)
downloadyuzu-8bdc51b620f0778f53d76ad9368da97a9213d631.tar.gz
yuzu-8bdc51b620f0778f53d76ad9368da97a9213d631.tar.xz
yuzu-8bdc51b620f0778f53d76ad9368da97a9213d631.zip
Merge pull request #9505 from liamwhite/request-exit
applets: implement RequestExit
Diffstat (limited to 'src/core')
-rw-r--r--src/core/frontend/applets/applet.h14
-rw-r--r--src/core/frontend/applets/cabinet.cpp2
-rw-r--r--src/core/frontend/applets/cabinet.h4
-rw-r--r--src/core/frontend/applets/controller.cpp2
-rw-r--r--src/core/frontend/applets/controller.h4
-rw-r--r--src/core/frontend/applets/error.cpp2
-rw-r--r--src/core/frontend/applets/error.h4
-rw-r--r--src/core/frontend/applets/general_frontend.cpp4
-rw-r--r--src/core/frontend/applets/general_frontend.h8
-rw-r--r--src/core/frontend/applets/mii_edit.cpp2
-rw-r--r--src/core/frontend/applets/mii_edit.h5
-rw-r--r--src/core/frontend/applets/profile_select.cpp2
-rw-r--r--src/core/frontend/applets/profile_select.h5
-rw-r--r--src/core/frontend/applets/software_keyboard.cpp2
-rw-r--r--src/core/frontend/applets/software_keyboard.h5
-rw-r--r--src/core/frontend/applets/web_browser.cpp2
-rw-r--r--src/core/frontend/applets/web_browser.h5
-rw-r--r--src/core/hle/service/am/am.cpp11
-rw-r--r--src/core/hle/service/am/applets/applet_cabinet.cpp5
-rw-r--r--src/core/hle/service/am/applets/applet_cabinet.h1
-rw-r--r--src/core/hle/service/am/applets/applet_controller.cpp5
-rw-r--r--src/core/hle/service/am/applets/applet_controller.h1
-rw-r--r--src/core/hle/service/am/applets/applet_error.cpp5
-rw-r--r--src/core/hle/service/am/applets/applet_error.h1
-rw-r--r--src/core/hle/service/am/applets/applet_general_backend.cpp15
-rw-r--r--src/core/hle/service/am/applets/applet_general_backend.h3
-rw-r--r--src/core/hle/service/am/applets/applet_mii_edit.cpp5
-rw-r--r--src/core/hle/service/am/applets/applet_mii_edit.h1
-rw-r--r--src/core/hle/service/am/applets/applet_profile_select.cpp5
-rw-r--r--src/core/hle/service/am/applets/applet_profile_select.h1
-rw-r--r--src/core/hle/service/am/applets/applet_software_keyboard.cpp5
-rw-r--r--src/core/hle/service/am/applets/applet_software_keyboard.h1
-rw-r--r--src/core/hle/service/am/applets/applet_web_browser.cpp5
-rw-r--r--src/core/hle/service/am/applets/applet_web_browser.h1
-rw-r--r--src/core/hle/service/am/applets/applets.h1
35 files changed, 134 insertions, 10 deletions
diff --git a/src/core/frontend/applets/applet.h b/src/core/frontend/applets/applet.h
new file mode 100644
index 000000000..77fffe306
--- /dev/null
+++ b/src/core/frontend/applets/applet.h
@@ -0,0 +1,14 @@
1// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6namespace Core::Frontend {
7
8class Applet {
9public:
10 virtual ~Applet() = default;
11 virtual void Close() const = 0;
12};
13
14} // namespace Core::Frontend
diff --git a/src/core/frontend/applets/cabinet.cpp b/src/core/frontend/applets/cabinet.cpp
index 26c7fefe3..2d501eeae 100644
--- a/src/core/frontend/applets/cabinet.cpp
+++ b/src/core/frontend/applets/cabinet.cpp
@@ -10,6 +10,8 @@ namespace Core::Frontend {
10 10
11CabinetApplet::~CabinetApplet() = default; 11CabinetApplet::~CabinetApplet() = default;
12 12
13void DefaultCabinetApplet::Close() const {}
14
13void DefaultCabinetApplet::ShowCabinetApplet( 15void DefaultCabinetApplet::ShowCabinetApplet(
14 const CabinetCallback& callback, const CabinetParameters& parameters, 16 const CabinetCallback& callback, const CabinetParameters& parameters,
15 std::shared_ptr<Service::NFP::NfpDevice> nfp_device) const { 17 std::shared_ptr<Service::NFP::NfpDevice> nfp_device) const {
diff --git a/src/core/frontend/applets/cabinet.h b/src/core/frontend/applets/cabinet.h
index c28a235c1..74dc5a4f6 100644
--- a/src/core/frontend/applets/cabinet.h
+++ b/src/core/frontend/applets/cabinet.h
@@ -4,6 +4,7 @@
4#pragma once 4#pragma once
5 5
6#include <functional> 6#include <functional>
7#include "core/frontend/applets/applet.h"
7#include "core/hle/service/nfp/nfp_types.h" 8#include "core/hle/service/nfp/nfp_types.h"
8 9
9namespace Service::NFP { 10namespace Service::NFP {
@@ -20,7 +21,7 @@ struct CabinetParameters {
20 21
21using CabinetCallback = std::function<void(bool, const std::string&)>; 22using CabinetCallback = std::function<void(bool, const std::string&)>;
22 23
23class CabinetApplet { 24class CabinetApplet : public Applet {
24public: 25public:
25 virtual ~CabinetApplet(); 26 virtual ~CabinetApplet();
26 virtual void ShowCabinetApplet(const CabinetCallback& callback, 27 virtual void ShowCabinetApplet(const CabinetCallback& callback,
@@ -30,6 +31,7 @@ public:
30 31
31class DefaultCabinetApplet final : public CabinetApplet { 32class DefaultCabinetApplet final : public CabinetApplet {
32public: 33public:
34 void Close() const override;
33 void ShowCabinetApplet(const CabinetCallback& callback, const CabinetParameters& parameters, 35 void ShowCabinetApplet(const CabinetCallback& callback, const CabinetParameters& parameters,
34 std::shared_ptr<Service::NFP::NfpDevice> nfp_device) const override; 36 std::shared_ptr<Service::NFP::NfpDevice> nfp_device) const override;
35}; 37};
diff --git a/src/core/frontend/applets/controller.cpp b/src/core/frontend/applets/controller.cpp
index 52919484e..8e586e938 100644
--- a/src/core/frontend/applets/controller.cpp
+++ b/src/core/frontend/applets/controller.cpp
@@ -16,6 +16,8 @@ DefaultControllerApplet::DefaultControllerApplet(HID::HIDCore& hid_core_) : hid_
16 16
17DefaultControllerApplet::~DefaultControllerApplet() = default; 17DefaultControllerApplet::~DefaultControllerApplet() = default;
18 18
19void DefaultControllerApplet::Close() const {}
20
19void DefaultControllerApplet::ReconfigureControllers(ReconfigureCallback callback, 21void DefaultControllerApplet::ReconfigureControllers(ReconfigureCallback callback,
20 const ControllerParameters& parameters) const { 22 const ControllerParameters& parameters) const {
21 LOG_INFO(Service_HID, "called, deducing the best configuration based on the given parameters!"); 23 LOG_INFO(Service_HID, "called, deducing the best configuration based on the given parameters!");
diff --git a/src/core/frontend/applets/controller.h b/src/core/frontend/applets/controller.h
index adb2feefd..5c488387d 100644
--- a/src/core/frontend/applets/controller.h
+++ b/src/core/frontend/applets/controller.h
@@ -7,6 +7,7 @@
7#include <vector> 7#include <vector>
8 8
9#include "common/common_types.h" 9#include "common/common_types.h"
10#include "core/frontend/applets/applet.h"
10 11
11namespace Core::HID { 12namespace Core::HID {
12class HIDCore; 13class HIDCore;
@@ -34,7 +35,7 @@ struct ControllerParameters {
34 bool allow_gamecube_controller{}; 35 bool allow_gamecube_controller{};
35}; 36};
36 37
37class ControllerApplet { 38class ControllerApplet : public Applet {
38public: 39public:
39 using ReconfigureCallback = std::function<void()>; 40 using ReconfigureCallback = std::function<void()>;
40 41
@@ -49,6 +50,7 @@ public:
49 explicit DefaultControllerApplet(HID::HIDCore& hid_core_); 50 explicit DefaultControllerApplet(HID::HIDCore& hid_core_);
50 ~DefaultControllerApplet() override; 51 ~DefaultControllerApplet() override;
51 52
53 void Close() const override;
52 void ReconfigureControllers(ReconfigureCallback callback, 54 void ReconfigureControllers(ReconfigureCallback callback,
53 const ControllerParameters& parameters) const override; 55 const ControllerParameters& parameters) const override;
54 56
diff --git a/src/core/frontend/applets/error.cpp b/src/core/frontend/applets/error.cpp
index 69c2b2b4d..2e6f7a3d9 100644
--- a/src/core/frontend/applets/error.cpp
+++ b/src/core/frontend/applets/error.cpp
@@ -8,6 +8,8 @@ namespace Core::Frontend {
8 8
9ErrorApplet::~ErrorApplet() = default; 9ErrorApplet::~ErrorApplet() = default;
10 10
11void DefaultErrorApplet::Close() const {}
12
11void DefaultErrorApplet::ShowError(Result error, FinishedCallback finished) const { 13void DefaultErrorApplet::ShowError(Result error, FinishedCallback finished) const {
12 LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})", 14 LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})",
13 error.module.Value(), error.description.Value(), error.raw); 15 error.module.Value(), error.description.Value(), error.raw);
diff --git a/src/core/frontend/applets/error.h b/src/core/frontend/applets/error.h
index 884f2f653..3a12196ce 100644
--- a/src/core/frontend/applets/error.h
+++ b/src/core/frontend/applets/error.h
@@ -6,11 +6,12 @@
6#include <chrono> 6#include <chrono>
7#include <functional> 7#include <functional>
8 8
9#include "core/frontend/applets/applet.h"
9#include "core/hle/result.h" 10#include "core/hle/result.h"
10 11
11namespace Core::Frontend { 12namespace Core::Frontend {
12 13
13class ErrorApplet { 14class ErrorApplet : public Applet {
14public: 15public:
15 using FinishedCallback = std::function<void()>; 16 using FinishedCallback = std::function<void()>;
16 17
@@ -28,6 +29,7 @@ public:
28 29
29class DefaultErrorApplet final : public ErrorApplet { 30class DefaultErrorApplet final : public ErrorApplet {
30public: 31public:
32 void Close() const override;
31 void ShowError(Result error, FinishedCallback finished) const override; 33 void ShowError(Result error, FinishedCallback finished) const override;
32 void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, 34 void ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
33 FinishedCallback finished) const override; 35 FinishedCallback finished) const override;
diff --git a/src/core/frontend/applets/general_frontend.cpp b/src/core/frontend/applets/general_frontend.cpp
index 29a00fb6f..b4b213a31 100644
--- a/src/core/frontend/applets/general_frontend.cpp
+++ b/src/core/frontend/applets/general_frontend.cpp
@@ -10,6 +10,8 @@ ParentalControlsApplet::~ParentalControlsApplet() = default;
10 10
11DefaultParentalControlsApplet::~DefaultParentalControlsApplet() = default; 11DefaultParentalControlsApplet::~DefaultParentalControlsApplet() = default;
12 12
13void DefaultParentalControlsApplet::Close() const {}
14
13void DefaultParentalControlsApplet::VerifyPIN(std::function<void(bool)> finished, 15void DefaultParentalControlsApplet::VerifyPIN(std::function<void(bool)> finished,
14 bool suspend_future_verification_temporarily) { 16 bool suspend_future_verification_temporarily) {
15 LOG_INFO(Service_AM, 17 LOG_INFO(Service_AM,
@@ -39,6 +41,8 @@ PhotoViewerApplet::~PhotoViewerApplet() = default;
39 41
40DefaultPhotoViewerApplet::~DefaultPhotoViewerApplet() = default; 42DefaultPhotoViewerApplet::~DefaultPhotoViewerApplet() = default;
41 43
44void DefaultPhotoViewerApplet::Close() const {}
45
42void DefaultPhotoViewerApplet::ShowPhotosForApplication(u64 title_id, 46void DefaultPhotoViewerApplet::ShowPhotosForApplication(u64 title_id,
43 std::function<void()> finished) const { 47 std::function<void()> finished) const {
44 LOG_INFO(Service_AM, 48 LOG_INFO(Service_AM,
diff --git a/src/core/frontend/applets/general_frontend.h b/src/core/frontend/applets/general_frontend.h
index cbec8b4ad..319838ac7 100644
--- a/src/core/frontend/applets/general_frontend.h
+++ b/src/core/frontend/applets/general_frontend.h
@@ -6,9 +6,11 @@
6#include <functional> 6#include <functional>
7#include "common/common_types.h" 7#include "common/common_types.h"
8 8
9#include "core/frontend/applets/applet.h"
10
9namespace Core::Frontend { 11namespace Core::Frontend {
10 12
11class ParentalControlsApplet { 13class ParentalControlsApplet : public Applet {
12public: 14public:
13 virtual ~ParentalControlsApplet(); 15 virtual ~ParentalControlsApplet();
14 16
@@ -33,6 +35,7 @@ class DefaultParentalControlsApplet final : public ParentalControlsApplet {
33public: 35public:
34 ~DefaultParentalControlsApplet() override; 36 ~DefaultParentalControlsApplet() override;
35 37
38 void Close() const override;
36 void VerifyPIN(std::function<void(bool)> finished, 39 void VerifyPIN(std::function<void(bool)> finished,
37 bool suspend_future_verification_temporarily) override; 40 bool suspend_future_verification_temporarily) override;
38 void VerifyPINForSettings(std::function<void(bool)> finished) override; 41 void VerifyPINForSettings(std::function<void(bool)> finished) override;
@@ -40,7 +43,7 @@ public:
40 void ChangePIN(std::function<void()> finished) override; 43 void ChangePIN(std::function<void()> finished) override;
41}; 44};
42 45
43class PhotoViewerApplet { 46class PhotoViewerApplet : public Applet {
44public: 47public:
45 virtual ~PhotoViewerApplet(); 48 virtual ~PhotoViewerApplet();
46 49
@@ -52,6 +55,7 @@ class DefaultPhotoViewerApplet final : public PhotoViewerApplet {
52public: 55public:
53 ~DefaultPhotoViewerApplet() override; 56 ~DefaultPhotoViewerApplet() override;
54 57
58 void Close() const override;
55 void ShowPhotosForApplication(u64 title_id, std::function<void()> finished) const override; 59 void ShowPhotosForApplication(u64 title_id, std::function<void()> finished) const override;
56 void ShowAllPhotos(std::function<void()> finished) const override; 60 void ShowAllPhotos(std::function<void()> finished) const override;
57}; 61};
diff --git a/src/core/frontend/applets/mii_edit.cpp b/src/core/frontend/applets/mii_edit.cpp
index bc8c57067..2988c3e72 100644
--- a/src/core/frontend/applets/mii_edit.cpp
+++ b/src/core/frontend/applets/mii_edit.cpp
@@ -8,6 +8,8 @@ namespace Core::Frontend {
8 8
9MiiEditApplet::~MiiEditApplet() = default; 9MiiEditApplet::~MiiEditApplet() = default;
10 10
11void DefaultMiiEditApplet::Close() const {}
12
11void DefaultMiiEditApplet::ShowMiiEdit(const MiiEditCallback& callback) const { 13void DefaultMiiEditApplet::ShowMiiEdit(const MiiEditCallback& callback) const {
12 LOG_WARNING(Service_AM, "(STUBBED) called"); 14 LOG_WARNING(Service_AM, "(STUBBED) called");
13 15
diff --git a/src/core/frontend/applets/mii_edit.h b/src/core/frontend/applets/mii_edit.h
index d828f06ec..9d86ee658 100644
--- a/src/core/frontend/applets/mii_edit.h
+++ b/src/core/frontend/applets/mii_edit.h
@@ -5,9 +5,11 @@
5 5
6#include <functional> 6#include <functional>
7 7
8#include "core/frontend/applets/applet.h"
9
8namespace Core::Frontend { 10namespace Core::Frontend {
9 11
10class MiiEditApplet { 12class MiiEditApplet : public Applet {
11public: 13public:
12 using MiiEditCallback = std::function<void()>; 14 using MiiEditCallback = std::function<void()>;
13 15
@@ -18,6 +20,7 @@ public:
18 20
19class DefaultMiiEditApplet final : public MiiEditApplet { 21class DefaultMiiEditApplet final : public MiiEditApplet {
20public: 22public:
23 void Close() const override;
21 void ShowMiiEdit(const MiiEditCallback& callback) const override; 24 void ShowMiiEdit(const MiiEditCallback& callback) const override;
22}; 25};
23 26
diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cpp
index da4cfbf87..910d20c0d 100644
--- a/src/core/frontend/applets/profile_select.cpp
+++ b/src/core/frontend/applets/profile_select.cpp
@@ -9,6 +9,8 @@ namespace Core::Frontend {
9 9
10ProfileSelectApplet::~ProfileSelectApplet() = default; 10ProfileSelectApplet::~ProfileSelectApplet() = default;
11 11
12void DefaultProfileSelectApplet::Close() const {}
13
12void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback) const { 14void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback) const {
13 Service::Account::ProfileManager manager; 15 Service::Account::ProfileManager manager;
14 callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{})); 16 callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{}));
diff --git a/src/core/frontend/applets/profile_select.h b/src/core/frontend/applets/profile_select.h
index 138429533..76e963535 100644
--- a/src/core/frontend/applets/profile_select.h
+++ b/src/core/frontend/applets/profile_select.h
@@ -7,9 +7,11 @@
7#include <optional> 7#include <optional>
8#include "common/uuid.h" 8#include "common/uuid.h"
9 9
10#include "core/frontend/applets/applet.h"
11
10namespace Core::Frontend { 12namespace Core::Frontend {
11 13
12class ProfileSelectApplet { 14class ProfileSelectApplet : public Applet {
13public: 15public:
14 using SelectProfileCallback = std::function<void(std::optional<Common::UUID>)>; 16 using SelectProfileCallback = std::function<void(std::optional<Common::UUID>)>;
15 17
@@ -20,6 +22,7 @@ public:
20 22
21class DefaultProfileSelectApplet final : public ProfileSelectApplet { 23class DefaultProfileSelectApplet final : public ProfileSelectApplet {
22public: 24public:
25 void Close() const override;
23 void SelectProfile(SelectProfileCallback callback) const override; 26 void SelectProfile(SelectProfileCallback callback) const override;
24}; 27};
25 28
diff --git a/src/core/frontend/applets/software_keyboard.cpp b/src/core/frontend/applets/software_keyboard.cpp
index a3720f4d7..7655d215b 100644
--- a/src/core/frontend/applets/software_keyboard.cpp
+++ b/src/core/frontend/applets/software_keyboard.cpp
@@ -13,6 +13,8 @@ SoftwareKeyboardApplet::~SoftwareKeyboardApplet() = default;
13 13
14DefaultSoftwareKeyboardApplet::~DefaultSoftwareKeyboardApplet() = default; 14DefaultSoftwareKeyboardApplet::~DefaultSoftwareKeyboardApplet() = default;
15 15
16void DefaultSoftwareKeyboardApplet::Close() const {}
17
16void DefaultSoftwareKeyboardApplet::InitializeKeyboard( 18void DefaultSoftwareKeyboardApplet::InitializeKeyboard(
17 bool is_inline, KeyboardInitializeParameters initialize_parameters, 19 bool is_inline, KeyboardInitializeParameters initialize_parameters,
18 SubmitNormalCallback submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) { 20 SubmitNormalCallback submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) {
diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h
index 8aef103d3..8ed96da24 100644
--- a/src/core/frontend/applets/software_keyboard.h
+++ b/src/core/frontend/applets/software_keyboard.h
@@ -7,6 +7,7 @@
7 7
8#include "common/common_types.h" 8#include "common/common_types.h"
9 9
10#include "core/frontend/applets/applet.h"
10#include "core/hle/service/am/applets/applet_software_keyboard_types.h" 11#include "core/hle/service/am/applets/applet_software_keyboard_types.h"
11 12
12namespace Core::Frontend { 13namespace Core::Frontend {
@@ -52,7 +53,7 @@ struct InlineTextParameters {
52 s32 cursor_position; 53 s32 cursor_position;
53}; 54};
54 55
55class SoftwareKeyboardApplet { 56class SoftwareKeyboardApplet : public Applet {
56public: 57public:
57 using SubmitInlineCallback = 58 using SubmitInlineCallback =
58 std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>; 59 std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>;
@@ -84,6 +85,8 @@ class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet {
84public: 85public:
85 ~DefaultSoftwareKeyboardApplet() override; 86 ~DefaultSoftwareKeyboardApplet() override;
86 87
88 void Close() const override;
89
87 void InitializeKeyboard(bool is_inline, KeyboardInitializeParameters initialize_parameters, 90 void InitializeKeyboard(bool is_inline, KeyboardInitializeParameters initialize_parameters,
88 SubmitNormalCallback submit_normal_callback_, 91 SubmitNormalCallback submit_normal_callback_,
89 SubmitInlineCallback submit_inline_callback_) override; 92 SubmitInlineCallback submit_inline_callback_) override;
diff --git a/src/core/frontend/applets/web_browser.cpp b/src/core/frontend/applets/web_browser.cpp
index b09cb7102..6e703ef06 100644
--- a/src/core/frontend/applets/web_browser.cpp
+++ b/src/core/frontend/applets/web_browser.cpp
@@ -10,6 +10,8 @@ WebBrowserApplet::~WebBrowserApplet() = default;
10 10
11DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; 11DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default;
12 12
13void DefaultWebBrowserApplet::Close() const {}
14
13void DefaultWebBrowserApplet::OpenLocalWebPage(const std::string& local_url, 15void DefaultWebBrowserApplet::OpenLocalWebPage(const std::string& local_url,
14 ExtractROMFSCallback extract_romfs_callback, 16 ExtractROMFSCallback extract_romfs_callback,
15 OpenWebPageCallback callback) const { 17 OpenWebPageCallback callback) const {
diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h
index 4f72284ad..178bbdd3f 100644
--- a/src/core/frontend/applets/web_browser.h
+++ b/src/core/frontend/applets/web_browser.h
@@ -5,11 +5,12 @@
5 5
6#include <functional> 6#include <functional>
7 7
8#include "core/frontend/applets/applet.h"
8#include "core/hle/service/am/applets/applet_web_browser_types.h" 9#include "core/hle/service/am/applets/applet_web_browser_types.h"
9 10
10namespace Core::Frontend { 11namespace Core::Frontend {
11 12
12class WebBrowserApplet { 13class WebBrowserApplet : public Applet {
13public: 14public:
14 using ExtractROMFSCallback = std::function<void()>; 15 using ExtractROMFSCallback = std::function<void()>;
15 using OpenWebPageCallback = 16 using OpenWebPageCallback =
@@ -29,6 +30,8 @@ class DefaultWebBrowserApplet final : public WebBrowserApplet {
29public: 30public:
30 ~DefaultWebBrowserApplet() override; 31 ~DefaultWebBrowserApplet() override;
31 32
33 void Close() const override;
34
32 void OpenLocalWebPage(const std::string& local_url, ExtractROMFSCallback extract_romfs_callback, 35 void OpenLocalWebPage(const std::string& local_url, ExtractROMFSCallback extract_romfs_callback,
33 OpenWebPageCallback callback) const override; 36 OpenWebPageCallback callback) const override;
34 37
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 8ab179cc8..a17c46121 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -945,7 +945,7 @@ public:
945 {0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"}, 945 {0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"},
946 {1, &ILibraryAppletAccessor::IsCompleted, "IsCompleted"}, 946 {1, &ILibraryAppletAccessor::IsCompleted, "IsCompleted"},
947 {10, &ILibraryAppletAccessor::Start, "Start"}, 947 {10, &ILibraryAppletAccessor::Start, "Start"},
948 {20, nullptr, "RequestExit"}, 948 {20, &ILibraryAppletAccessor::RequestExit, "RequestExit"},
949 {25, nullptr, "Terminate"}, 949 {25, nullptr, "Terminate"},
950 {30, &ILibraryAppletAccessor::GetResult, "GetResult"}, 950 {30, &ILibraryAppletAccessor::GetResult, "GetResult"},
951 {50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"}, 951 {50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"},
@@ -1010,6 +1010,15 @@ private:
1010 rb.Push(ResultSuccess); 1010 rb.Push(ResultSuccess);
1011 } 1011 }
1012 1012
1013 void RequestExit(HLERequestContext& ctx) {
1014 LOG_DEBUG(Service_AM, "called");
1015
1016 ASSERT(applet != nullptr);
1017
1018 IPC::ResponseBuilder rb{ctx, 2};
1019 rb.Push(applet->RequestExit());
1020 }
1021
1013 void PushInData(HLERequestContext& ctx) { 1022 void PushInData(HLERequestContext& ctx) {
1014 LOG_DEBUG(Service_AM, "called"); 1023 LOG_DEBUG(Service_AM, "called");
1015 1024
diff --git a/src/core/hle/service/am/applets/applet_cabinet.cpp b/src/core/hle/service/am/applets/applet_cabinet.cpp
index 162687b29..93c9f2a55 100644
--- a/src/core/hle/service/am/applets/applet_cabinet.cpp
+++ b/src/core/hle/service/am/applets/applet_cabinet.cpp
@@ -174,4 +174,9 @@ void Cabinet::Cancel() {
174 broker.SignalStateChanged(); 174 broker.SignalStateChanged();
175} 175}
176 176
177Result Cabinet::RequestExit() {
178 frontend.Close();
179 R_SUCCEED();
180}
181
177} // namespace Service::AM::Applets 182} // namespace Service::AM::Applets
diff --git a/src/core/hle/service/am/applets/applet_cabinet.h b/src/core/hle/service/am/applets/applet_cabinet.h
index 84197a807..edd295a27 100644
--- a/src/core/hle/service/am/applets/applet_cabinet.h
+++ b/src/core/hle/service/am/applets/applet_cabinet.h
@@ -89,6 +89,7 @@ public:
89 void Execute() override; 89 void Execute() override;
90 void DisplayCompleted(bool apply_changes, std::string_view amiibo_name); 90 void DisplayCompleted(bool apply_changes, std::string_view amiibo_name);
91 void Cancel(); 91 void Cancel();
92 Result RequestExit() override;
92 93
93private: 94private:
94 const Core::Frontend::CabinetApplet& frontend; 95 const Core::Frontend::CabinetApplet& frontend;
diff --git a/src/core/hle/service/am/applets/applet_controller.cpp b/src/core/hle/service/am/applets/applet_controller.cpp
index 58484519b..2d1d115d7 100644
--- a/src/core/hle/service/am/applets/applet_controller.cpp
+++ b/src/core/hle/service/am/applets/applet_controller.cpp
@@ -262,4 +262,9 @@ void Controller::ConfigurationComplete() {
262 broker.SignalStateChanged(); 262 broker.SignalStateChanged();
263} 263}
264 264
265Result Controller::RequestExit() {
266 frontend.Close();
267 R_SUCCEED();
268}
269
265} // namespace Service::AM::Applets 270} // namespace Service::AM::Applets
diff --git a/src/core/hle/service/am/applets/applet_controller.h b/src/core/hle/service/am/applets/applet_controller.h
index 1f9adec65..1fbabee11 100644
--- a/src/core/hle/service/am/applets/applet_controller.h
+++ b/src/core/hle/service/am/applets/applet_controller.h
@@ -129,6 +129,7 @@ public:
129 Result GetStatus() const override; 129 Result GetStatus() const override;
130 void ExecuteInteractive() override; 130 void ExecuteInteractive() override;
131 void Execute() override; 131 void Execute() override;
132 Result RequestExit() override;
132 133
133 void ConfigurationComplete(); 134 void ConfigurationComplete();
134 135
diff --git a/src/core/hle/service/am/applets/applet_error.cpp b/src/core/hle/service/am/applets/applet_error.cpp
index b013896b4..b46ea840c 100644
--- a/src/core/hle/service/am/applets/applet_error.cpp
+++ b/src/core/hle/service/am/applets/applet_error.cpp
@@ -209,4 +209,9 @@ void Error::DisplayCompleted() {
209 broker.SignalStateChanged(); 209 broker.SignalStateChanged();
210} 210}
211 211
212Result Error::RequestExit() {
213 frontend.Close();
214 R_SUCCEED();
215}
216
212} // namespace Service::AM::Applets 217} // namespace Service::AM::Applets
diff --git a/src/core/hle/service/am/applets/applet_error.h b/src/core/hle/service/am/applets/applet_error.h
index d78d6f1d1..d822a32bb 100644
--- a/src/core/hle/service/am/applets/applet_error.h
+++ b/src/core/hle/service/am/applets/applet_error.h
@@ -34,6 +34,7 @@ public:
34 Result GetStatus() const override; 34 Result GetStatus() const override;
35 void ExecuteInteractive() override; 35 void ExecuteInteractive() override;
36 void Execute() override; 36 void Execute() override;
37 Result RequestExit() override;
37 38
38 void DisplayCompleted(); 39 void DisplayCompleted();
39 40
diff --git a/src/core/hle/service/am/applets/applet_general_backend.cpp b/src/core/hle/service/am/applets/applet_general_backend.cpp
index 1eefa85e3..8b352020e 100644
--- a/src/core/hle/service/am/applets/applet_general_backend.cpp
+++ b/src/core/hle/service/am/applets/applet_general_backend.cpp
@@ -150,6 +150,11 @@ void Auth::AuthFinished(bool is_successful) {
150 broker.SignalStateChanged(); 150 broker.SignalStateChanged();
151} 151}
152 152
153Result Auth::RequestExit() {
154 frontend.Close();
155 R_SUCCEED();
156}
157
153PhotoViewer::PhotoViewer(Core::System& system_, LibraryAppletMode applet_mode_, 158PhotoViewer::PhotoViewer(Core::System& system_, LibraryAppletMode applet_mode_,
154 const Core::Frontend::PhotoViewerApplet& frontend_) 159 const Core::Frontend::PhotoViewerApplet& frontend_)
155 : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} 160 : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {}
@@ -202,6 +207,11 @@ void PhotoViewer::ViewFinished() {
202 broker.SignalStateChanged(); 207 broker.SignalStateChanged();
203} 208}
204 209
210Result PhotoViewer::RequestExit() {
211 frontend.Close();
212 R_SUCCEED();
213}
214
205StubApplet::StubApplet(Core::System& system_, AppletId id_, LibraryAppletMode applet_mode_) 215StubApplet::StubApplet(Core::System& system_, AppletId id_, LibraryAppletMode applet_mode_)
206 : Applet{system_, applet_mode_}, id{id_}, system{system_} {} 216 : Applet{system_, applet_mode_}, id{id_}, system{system_} {}
207 217
@@ -250,4 +260,9 @@ void StubApplet::Execute() {
250 broker.SignalStateChanged(); 260 broker.SignalStateChanged();
251} 261}
252 262
263Result StubApplet::RequestExit() {
264 // Nothing to do.
265 R_SUCCEED();
266}
267
253} // namespace Service::AM::Applets 268} // namespace Service::AM::Applets
diff --git a/src/core/hle/service/am/applets/applet_general_backend.h b/src/core/hle/service/am/applets/applet_general_backend.h
index a9f2535a2..34ecaebb9 100644
--- a/src/core/hle/service/am/applets/applet_general_backend.h
+++ b/src/core/hle/service/am/applets/applet_general_backend.h
@@ -28,6 +28,7 @@ public:
28 Result GetStatus() const override; 28 Result GetStatus() const override;
29 void ExecuteInteractive() override; 29 void ExecuteInteractive() override;
30 void Execute() override; 30 void Execute() override;
31 Result RequestExit() override;
31 32
32 void AuthFinished(bool is_successful = true); 33 void AuthFinished(bool is_successful = true);
33 34
@@ -59,6 +60,7 @@ public:
59 Result GetStatus() const override; 60 Result GetStatus() const override;
60 void ExecuteInteractive() override; 61 void ExecuteInteractive() override;
61 void Execute() override; 62 void Execute() override;
63 Result RequestExit() override;
62 64
63 void ViewFinished(); 65 void ViewFinished();
64 66
@@ -80,6 +82,7 @@ public:
80 Result GetStatus() const override; 82 Result GetStatus() const override;
81 void ExecuteInteractive() override; 83 void ExecuteInteractive() override;
82 void Execute() override; 84 void Execute() override;
85 Result RequestExit() override;
83 86
84private: 87private:
85 AppletId id; 88 AppletId id;
diff --git a/src/core/hle/service/am/applets/applet_mii_edit.cpp b/src/core/hle/service/am/applets/applet_mii_edit.cpp
index ae80ef506..d1f652c09 100644
--- a/src/core/hle/service/am/applets/applet_mii_edit.cpp
+++ b/src/core/hle/service/am/applets/applet_mii_edit.cpp
@@ -135,4 +135,9 @@ void MiiEdit::MiiEditOutputForCharInfoEditing(MiiEditResult result,
135 broker.SignalStateChanged(); 135 broker.SignalStateChanged();
136} 136}
137 137
138Result MiiEdit::RequestExit() {
139 frontend.Close();
140 R_SUCCEED();
141}
142
138} // namespace Service::AM::Applets 143} // namespace Service::AM::Applets
diff --git a/src/core/hle/service/am/applets/applet_mii_edit.h b/src/core/hle/service/am/applets/applet_mii_edit.h
index d18dd3cf5..3f46fae1b 100644
--- a/src/core/hle/service/am/applets/applet_mii_edit.h
+++ b/src/core/hle/service/am/applets/applet_mii_edit.h
@@ -25,6 +25,7 @@ public:
25 Result GetStatus() const override; 25 Result GetStatus() const override;
26 void ExecuteInteractive() override; 26 void ExecuteInteractive() override;
27 void Execute() override; 27 void Execute() override;
28 Result RequestExit() override;
28 29
29 void MiiEditOutput(MiiEditResult result, s32 index); 30 void MiiEditOutput(MiiEditResult result, s32 index);
30 31
diff --git a/src/core/hle/service/am/applets/applet_profile_select.cpp b/src/core/hle/service/am/applets/applet_profile_select.cpp
index 1d69f5447..07abc2563 100644
--- a/src/core/hle/service/am/applets/applet_profile_select.cpp
+++ b/src/core/hle/service/am/applets/applet_profile_select.cpp
@@ -73,4 +73,9 @@ void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) {
73 broker.SignalStateChanged(); 73 broker.SignalStateChanged();
74} 74}
75 75
76Result ProfileSelect::RequestExit() {
77 frontend.Close();
78 R_SUCCEED();
79}
80
76} // namespace Service::AM::Applets 81} // namespace Service::AM::Applets
diff --git a/src/core/hle/service/am/applets/applet_profile_select.h b/src/core/hle/service/am/applets/applet_profile_select.h
index b77f1d205..85705c216 100644
--- a/src/core/hle/service/am/applets/applet_profile_select.h
+++ b/src/core/hle/service/am/applets/applet_profile_select.h
@@ -42,6 +42,7 @@ public:
42 Result GetStatus() const override; 42 Result GetStatus() const override;
43 void ExecuteInteractive() override; 43 void ExecuteInteractive() override;
44 void Execute() override; 44 void Execute() override;
45 Result RequestExit() override;
45 46
46 void SelectionComplete(std::optional<Common::UUID> uuid); 47 void SelectionComplete(std::optional<Common::UUID> uuid);
47 48
diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.cpp b/src/core/hle/service/am/applets/applet_software_keyboard.cpp
index c18236045..4145bb84f 100644
--- a/src/core/hle/service/am/applets/applet_software_keyboard.cpp
+++ b/src/core/hle/service/am/applets/applet_software_keyboard.cpp
@@ -770,6 +770,11 @@ void SoftwareKeyboard::ExitKeyboard() {
770 broker.SignalStateChanged(); 770 broker.SignalStateChanged();
771} 771}
772 772
773Result SoftwareKeyboard::RequestExit() {
774 frontend.Close();
775 R_SUCCEED();
776}
777
773// Inline Software Keyboard Requests 778// Inline Software Keyboard Requests
774 779
775void SoftwareKeyboard::RequestFinalize(const std::vector<u8>& request_data) { 780void SoftwareKeyboard::RequestFinalize(const std::vector<u8>& request_data) {
diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.h b/src/core/hle/service/am/applets/applet_software_keyboard.h
index b01b31c98..2e919811b 100644
--- a/src/core/hle/service/am/applets/applet_software_keyboard.h
+++ b/src/core/hle/service/am/applets/applet_software_keyboard.h
@@ -31,6 +31,7 @@ public:
31 Result GetStatus() const override; 31 Result GetStatus() const override;
32 void ExecuteInteractive() override; 32 void ExecuteInteractive() override;
33 void Execute() override; 33 void Execute() override;
34 Result RequestExit() override;
34 35
35 /** 36 /**
36 * Submits the input text to the application. 37 * Submits the input text to the application.
diff --git a/src/core/hle/service/am/applets/applet_web_browser.cpp b/src/core/hle/service/am/applets/applet_web_browser.cpp
index f061bae80..2accf7898 100644
--- a/src/core/hle/service/am/applets/applet_web_browser.cpp
+++ b/src/core/hle/service/am/applets/applet_web_browser.cpp
@@ -363,6 +363,11 @@ void WebBrowser::WebBrowserExit(WebExitReason exit_reason, std::string last_url)
363 broker.SignalStateChanged(); 363 broker.SignalStateChanged();
364} 364}
365 365
366Result WebBrowser::RequestExit() {
367 frontend.Close();
368 R_SUCCEED();
369}
370
366bool WebBrowser::InputTLVExistsInMap(WebArgInputTLVType input_tlv_type) const { 371bool WebBrowser::InputTLVExistsInMap(WebArgInputTLVType input_tlv_type) const {
367 return web_arg_input_tlv_map.find(input_tlv_type) != web_arg_input_tlv_map.end(); 372 return web_arg_input_tlv_map.find(input_tlv_type) != web_arg_input_tlv_map.end();
368} 373}
diff --git a/src/core/hle/service/am/applets/applet_web_browser.h b/src/core/hle/service/am/applets/applet_web_browser.h
index fd727fac8..99fe18659 100644
--- a/src/core/hle/service/am/applets/applet_web_browser.h
+++ b/src/core/hle/service/am/applets/applet_web_browser.h
@@ -35,6 +35,7 @@ public:
35 Result GetStatus() const override; 35 Result GetStatus() const override;
36 void ExecuteInteractive() override; 36 void ExecuteInteractive() override;
37 void Execute() override; 37 void Execute() override;
38 Result RequestExit() override;
38 39
39 void ExtractOfflineRomFS(); 40 void ExtractOfflineRomFS();
40 41
diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h
index a22eb62a8..12f374199 100644
--- a/src/core/hle/service/am/applets/applets.h
+++ b/src/core/hle/service/am/applets/applets.h
@@ -142,6 +142,7 @@ public:
142 virtual Result GetStatus() const = 0; 142 virtual Result GetStatus() const = 0;
143 virtual void ExecuteInteractive() = 0; 143 virtual void ExecuteInteractive() = 0;
144 virtual void Execute() = 0; 144 virtual void Execute() = 0;
145 virtual Result RequestExit() = 0;
145 146
146 AppletDataBroker& GetBroker() { 147 AppletDataBroker& GetBroker() {
147 return broker; 148 return broker;