summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/am/am.cpp12
-rw-r--r--src/core/hle/service/am/am.h6
-rw-r--r--src/core/hle/service/am/applet_ae.cpp26
-rw-r--r--src/core/hle/service/am/applet_ae.h3
-rw-r--r--src/core/hle/service/am/applet_oe.cpp14
-rw-r--r--src/core/hle/service/am/applet_oe.h3
-rw-r--r--src/core/hle/service/am/applets/applets.cpp21
-rw-r--r--src/core/hle/service/am/applets/applets.h2
-rw-r--r--src/core/hle/service/am/applets/web_browser.cpp7
-rw-r--r--src/core/hle/service/am/applets/web_browser.h4
-rw-r--r--src/core/hle/service/service.cpp2
11 files changed, 59 insertions, 41 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 4a7bf4acb..33cebb48b 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -887,7 +887,9 @@ void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) {
887 rb.Push(RESULT_SUCCESS); 887 rb.Push(RESULT_SUCCESS);
888} 888}
889 889
890ILibraryAppletCreator::ILibraryAppletCreator() : ServiceFramework("ILibraryAppletCreator") { 890ILibraryAppletCreator::ILibraryAppletCreator(u64 current_process_title_id)
891 : ServiceFramework("ILibraryAppletCreator"),
892 current_process_title_id(current_process_title_id) {
891 static const FunctionInfo functions[] = { 893 static const FunctionInfo functions[] = {
892 {0, &ILibraryAppletCreator::CreateLibraryApplet, "CreateLibraryApplet"}, 894 {0, &ILibraryAppletCreator::CreateLibraryApplet, "CreateLibraryApplet"},
893 {1, nullptr, "TerminateAllLibraryApplets"}, 895 {1, nullptr, "TerminateAllLibraryApplets"},
@@ -910,7 +912,7 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx)
910 static_cast<u32>(applet_id), applet_mode); 912 static_cast<u32>(applet_id), applet_mode);
911 913
912 const auto& applet_manager{Core::System::GetInstance().GetAppletManager()}; 914 const auto& applet_manager{Core::System::GetInstance().GetAppletManager()};
913 const auto applet = applet_manager.GetApplet(applet_id); 915 const auto applet = applet_manager.GetApplet(applet_id, current_process_title_id);
914 916
915 if (applet == nullptr) { 917 if (applet == nullptr) {
916 LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", static_cast<u32>(applet_id)); 918 LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", static_cast<u32>(applet_id));
@@ -1234,13 +1236,13 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) {
1234} 1236}
1235 1237
1236void InstallInterfaces(SM::ServiceManager& service_manager, 1238void InstallInterfaces(SM::ServiceManager& service_manager,
1237 std::shared_ptr<NVFlinger::NVFlinger> nvflinger) { 1239 std::shared_ptr<NVFlinger::NVFlinger> nvflinger, Core::System& system) {
1238 auto message_queue = std::make_shared<AppletMessageQueue>(); 1240 auto message_queue = std::make_shared<AppletMessageQueue>();
1239 message_queue->PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged); // Needed on 1241 message_queue->PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged); // Needed on
1240 // game boot 1242 // game boot
1241 1243
1242 std::make_shared<AppletAE>(nvflinger, message_queue)->InstallAsService(service_manager); 1244 std::make_shared<AppletAE>(nvflinger, message_queue, system)->InstallAsService(service_manager);
1243 std::make_shared<AppletOE>(nvflinger, message_queue)->InstallAsService(service_manager); 1245 std::make_shared<AppletOE>(nvflinger, message_queue, system)->InstallAsService(service_manager);
1244 std::make_shared<IdleSys>()->InstallAsService(service_manager); 1246 std::make_shared<IdleSys>()->InstallAsService(service_manager);
1245 std::make_shared<OMM>()->InstallAsService(service_manager); 1247 std::make_shared<OMM>()->InstallAsService(service_manager);
1246 std::make_shared<SPSM>()->InstallAsService(service_manager); 1248 std::make_shared<SPSM>()->InstallAsService(service_manager);
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index 1fa069e56..4ea609d23 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -201,13 +201,15 @@ private:
201 201
202class ILibraryAppletCreator final : public ServiceFramework<ILibraryAppletCreator> { 202class ILibraryAppletCreator final : public ServiceFramework<ILibraryAppletCreator> {
203public: 203public:
204 ILibraryAppletCreator(); 204 ILibraryAppletCreator(u64 current_process_title_id);
205 ~ILibraryAppletCreator() override; 205 ~ILibraryAppletCreator() override;
206 206
207private: 207private:
208 void CreateLibraryApplet(Kernel::HLERequestContext& ctx); 208 void CreateLibraryApplet(Kernel::HLERequestContext& ctx);
209 void CreateStorage(Kernel::HLERequestContext& ctx); 209 void CreateStorage(Kernel::HLERequestContext& ctx);
210 void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx); 210 void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx);
211
212 u64 current_process_title_id;
211}; 213};
212 214
213class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> { 215class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> {
@@ -264,7 +266,7 @@ public:
264 266
265/// Registers all AM services with the specified service manager. 267/// Registers all AM services with the specified service manager.
266void InstallInterfaces(SM::ServiceManager& service_manager, 268void InstallInterfaces(SM::ServiceManager& service_manager,
267 std::shared_ptr<NVFlinger::NVFlinger> nvflinger); 269 std::shared_ptr<NVFlinger::NVFlinger> nvflinger, Core::System& system);
268 270
269} // namespace AM 271} // namespace AM
270} // namespace Service 272} // namespace Service
diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp
index 488add8e7..fe5beb8f9 100644
--- a/src/core/hle/service/am/applet_ae.cpp
+++ b/src/core/hle/service/am/applet_ae.cpp
@@ -4,6 +4,7 @@
4 4
5#include "common/logging/log.h" 5#include "common/logging/log.h"
6#include "core/hle/ipc_helpers.h" 6#include "core/hle/ipc_helpers.h"
7#include "core/hle/kernel/process.h"
7#include "core/hle/service/am/am.h" 8#include "core/hle/service/am/am.h"
8#include "core/hle/service/am/applet_ae.h" 9#include "core/hle/service/am/applet_ae.h"
9#include "core/hle/service/nvflinger/nvflinger.h" 10#include "core/hle/service/nvflinger/nvflinger.h"
@@ -13,9 +14,10 @@ namespace Service::AM {
13class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> { 14class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> {
14public: 15public:
15 explicit ILibraryAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger, 16 explicit ILibraryAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger,
16 std::shared_ptr<AppletMessageQueue> msg_queue) 17 std::shared_ptr<AppletMessageQueue> msg_queue,
18 Core::System& system)
17 : ServiceFramework("ILibraryAppletProxy"), nvflinger(std::move(nvflinger)), 19 : ServiceFramework("ILibraryAppletProxy"), nvflinger(std::move(nvflinger)),
18 msg_queue(std::move(msg_queue)) { 20 msg_queue(std::move(msg_queue)), system(system) {
19 // clang-format off 21 // clang-format off
20 static const FunctionInfo functions[] = { 22 static const FunctionInfo functions[] = {
21 {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, 23 {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
@@ -96,7 +98,7 @@ private:
96 98
97 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 99 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
98 rb.Push(RESULT_SUCCESS); 100 rb.Push(RESULT_SUCCESS);
99 rb.PushIpcInterface<ILibraryAppletCreator>(); 101 rb.PushIpcInterface<ILibraryAppletCreator>(system.CurrentProcess()->GetTitleID());
100 } 102 }
101 103
102 void GetApplicationFunctions(Kernel::HLERequestContext& ctx) { 104 void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
@@ -109,14 +111,15 @@ private:
109 111
110 std::shared_ptr<NVFlinger::NVFlinger> nvflinger; 112 std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
111 std::shared_ptr<AppletMessageQueue> msg_queue; 113 std::shared_ptr<AppletMessageQueue> msg_queue;
114 Core::System& system;
112}; 115};
113 116
114class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> { 117class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> {
115public: 118public:
116 explicit ISystemAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger, 119 explicit ISystemAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger,
117 std::shared_ptr<AppletMessageQueue> msg_queue) 120 std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system)
118 : ServiceFramework("ISystemAppletProxy"), nvflinger(std::move(nvflinger)), 121 : ServiceFramework("ISystemAppletProxy"), nvflinger(std::move(nvflinger)),
119 msg_queue(std::move(msg_queue)) { 122 msg_queue(std::move(msg_queue)), system(system) {
120 // clang-format off 123 // clang-format off
121 static const FunctionInfo functions[] = { 124 static const FunctionInfo functions[] = {
122 {0, &ISystemAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, 125 {0, &ISystemAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
@@ -191,7 +194,7 @@ private:
191 194
192 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 195 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
193 rb.Push(RESULT_SUCCESS); 196 rb.Push(RESULT_SUCCESS);
194 rb.PushIpcInterface<ILibraryAppletCreator>(); 197 rb.PushIpcInterface<ILibraryAppletCreator>(system.CurrentProcess()->GetTitleID());
195 } 198 }
196 199
197 void GetHomeMenuFunctions(Kernel::HLERequestContext& ctx) { 200 void GetHomeMenuFunctions(Kernel::HLERequestContext& ctx) {
@@ -219,6 +222,7 @@ private:
219 } 222 }
220 std::shared_ptr<NVFlinger::NVFlinger> nvflinger; 223 std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
221 std::shared_ptr<AppletMessageQueue> msg_queue; 224 std::shared_ptr<AppletMessageQueue> msg_queue;
225 Core::System& system;
222}; 226};
223 227
224void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) { 228void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) {
@@ -226,7 +230,7 @@ void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) {
226 230
227 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 231 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
228 rb.Push(RESULT_SUCCESS); 232 rb.Push(RESULT_SUCCESS);
229 rb.PushIpcInterface<ISystemAppletProxy>(nvflinger, msg_queue); 233 rb.PushIpcInterface<ISystemAppletProxy>(nvflinger, msg_queue, system);
230} 234}
231 235
232void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) { 236void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) {
@@ -234,7 +238,7 @@ void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) {
234 238
235 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 239 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
236 rb.Push(RESULT_SUCCESS); 240 rb.Push(RESULT_SUCCESS);
237 rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue); 241 rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system);
238} 242}
239 243
240void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) { 244void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) {
@@ -242,13 +246,13 @@ void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) {
242 246
243 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 247 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
244 rb.Push(RESULT_SUCCESS); 248 rb.Push(RESULT_SUCCESS);
245 rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue); 249 rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system);
246} 250}
247 251
248AppletAE::AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger, 252AppletAE::AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger,
249 std::shared_ptr<AppletMessageQueue> msg_queue) 253 std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system)
250 : ServiceFramework("appletAE"), nvflinger(std::move(nvflinger)), 254 : ServiceFramework("appletAE"), nvflinger(std::move(nvflinger)),
251 msg_queue(std::move(msg_queue)) { 255 msg_queue(std::move(msg_queue)), system(system) {
252 // clang-format off 256 // clang-format off
253 static const FunctionInfo functions[] = { 257 static const FunctionInfo functions[] = {
254 {100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"}, 258 {100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"},
diff --git a/src/core/hle/service/am/applet_ae.h b/src/core/hle/service/am/applet_ae.h
index 902db2665..9e006cd9d 100644
--- a/src/core/hle/service/am/applet_ae.h
+++ b/src/core/hle/service/am/applet_ae.h
@@ -18,7 +18,7 @@ namespace AM {
18class AppletAE final : public ServiceFramework<AppletAE> { 18class AppletAE final : public ServiceFramework<AppletAE> {
19public: 19public:
20 explicit AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger, 20 explicit AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger,
21 std::shared_ptr<AppletMessageQueue> msg_queue); 21 std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system);
22 ~AppletAE() override; 22 ~AppletAE() override;
23 23
24 const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const; 24 const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const;
@@ -30,6 +30,7 @@ private:
30 30
31 std::shared_ptr<NVFlinger::NVFlinger> nvflinger; 31 std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
32 std::shared_ptr<AppletMessageQueue> msg_queue; 32 std::shared_ptr<AppletMessageQueue> msg_queue;
33 Core::System& system;
33}; 34};
34 35
35} // namespace AM 36} // namespace AM
diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp
index d3a0a1568..6e255fe95 100644
--- a/src/core/hle/service/am/applet_oe.cpp
+++ b/src/core/hle/service/am/applet_oe.cpp
@@ -4,6 +4,7 @@
4 4
5#include "common/logging/log.h" 5#include "common/logging/log.h"
6#include "core/hle/ipc_helpers.h" 6#include "core/hle/ipc_helpers.h"
7#include "core/hle/kernel/process.h"
7#include "core/hle/service/am/am.h" 8#include "core/hle/service/am/am.h"
8#include "core/hle/service/am/applet_oe.h" 9#include "core/hle/service/am/applet_oe.h"
9#include "core/hle/service/nvflinger/nvflinger.h" 10#include "core/hle/service/nvflinger/nvflinger.h"
@@ -13,9 +14,9 @@ namespace Service::AM {
13class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { 14class IApplicationProxy final : public ServiceFramework<IApplicationProxy> {
14public: 15public:
15 explicit IApplicationProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger, 16 explicit IApplicationProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger,
16 std::shared_ptr<AppletMessageQueue> msg_queue) 17 std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system)
17 : ServiceFramework("IApplicationProxy"), nvflinger(std::move(nvflinger)), 18 : ServiceFramework("IApplicationProxy"), nvflinger(std::move(nvflinger)),
18 msg_queue(std::move(msg_queue)) { 19 msg_queue(std::move(msg_queue)), system(system) {
19 // clang-format off 20 // clang-format off
20 static const FunctionInfo functions[] = { 21 static const FunctionInfo functions[] = {
21 {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"}, 22 {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"},
@@ -87,7 +88,7 @@ private:
87 88
88 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 89 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
89 rb.Push(RESULT_SUCCESS); 90 rb.Push(RESULT_SUCCESS);
90 rb.PushIpcInterface<ILibraryAppletCreator>(); 91 rb.PushIpcInterface<ILibraryAppletCreator>(system.CurrentProcess()->GetTitleID());
91 } 92 }
92 93
93 void GetApplicationFunctions(Kernel::HLERequestContext& ctx) { 94 void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
@@ -100,6 +101,7 @@ private:
100 101
101 std::shared_ptr<NVFlinger::NVFlinger> nvflinger; 102 std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
102 std::shared_ptr<AppletMessageQueue> msg_queue; 103 std::shared_ptr<AppletMessageQueue> msg_queue;
104 Core::System& system;
103}; 105};
104 106
105void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) { 107void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) {
@@ -107,13 +109,13 @@ void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) {
107 109
108 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 110 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
109 rb.Push(RESULT_SUCCESS); 111 rb.Push(RESULT_SUCCESS);
110 rb.PushIpcInterface<IApplicationProxy>(nvflinger, msg_queue); 112 rb.PushIpcInterface<IApplicationProxy>(nvflinger, msg_queue, system);
111} 113}
112 114
113AppletOE::AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger, 115AppletOE::AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger,
114 std::shared_ptr<AppletMessageQueue> msg_queue) 116 std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system)
115 : ServiceFramework("appletOE"), nvflinger(std::move(nvflinger)), 117 : ServiceFramework("appletOE"), nvflinger(std::move(nvflinger)),
116 msg_queue(std::move(msg_queue)) { 118 msg_queue(std::move(msg_queue)), system(system) {
117 static const FunctionInfo functions[] = { 119 static const FunctionInfo functions[] = {
118 {0, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"}, 120 {0, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"},
119 }; 121 };
diff --git a/src/core/hle/service/am/applet_oe.h b/src/core/hle/service/am/applet_oe.h
index bbd0108ef..22c05419d 100644
--- a/src/core/hle/service/am/applet_oe.h
+++ b/src/core/hle/service/am/applet_oe.h
@@ -18,7 +18,7 @@ namespace AM {
18class AppletOE final : public ServiceFramework<AppletOE> { 18class AppletOE final : public ServiceFramework<AppletOE> {
19public: 19public:
20 explicit AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger, 20 explicit AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger,
21 std::shared_ptr<AppletMessageQueue> msg_queue); 21 std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system);
22 ~AppletOE() override; 22 ~AppletOE() override;
23 23
24 const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const; 24 const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const;
@@ -28,6 +28,7 @@ private:
28 28
29 std::shared_ptr<NVFlinger::NVFlinger> nvflinger; 29 std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
30 std::shared_ptr<AppletMessageQueue> msg_queue; 30 std::shared_ptr<AppletMessageQueue> msg_queue;
31 Core::System& system;
31}; 32};
32 33
33} // namespace AM 34} // namespace AM
diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/applets/applets.cpp
index 553206177..6bdba2468 100644
--- a/src/core/hle/service/am/applets/applets.cpp
+++ b/src/core/hle/service/am/applets/applets.cpp
@@ -139,12 +139,14 @@ void Applet::Initialize() {
139 139
140AppletFrontendSet::AppletFrontendSet() = default; 140AppletFrontendSet::AppletFrontendSet() = default;
141 141
142AppletFrontendSet::AppletFrontendSet(ErrorApplet error, PhotoViewer photo_viewer, 142AppletFrontendSet::AppletFrontendSet(ParentalControlsApplet parental_controls, ErrorApplet error,
143 ProfileSelect profile_select, 143 PhotoViewer photo_viewer, ProfileSelect profile_select,
144 SoftwareKeyboard software_keyboard, WebBrowser web_browser) 144 SoftwareKeyboard software_keyboard, WebBrowser web_browser,
145 : error{std::move(error)}, photo_viewer{std::move(photo_viewer)}, profile_select{std::move( 145 ECommerceApplet e_commerce)
146 profile_select)}, 146 : parental_controls{std::move(parental_controls)}, error{std::move(error)},
147 software_keyboard{std::move(software_keyboard)}, web_browser{std::move(web_browser)} {} 147 photo_viewer{std::move(photo_viewer)}, profile_select{std::move(profile_select)},
148 software_keyboard{std::move(software_keyboard)}, web_browser{std::move(web_browser)},
149 e_commerce{std::move(e_commerce)} {}
148 150
149AppletFrontendSet::~AppletFrontendSet() = default; 151AppletFrontendSet::~AppletFrontendSet() = default;
150 152
@@ -214,7 +216,7 @@ void AppletManager::ClearAll() {
214 frontend = {}; 216 frontend = {};
215} 217}
216 218
217std::shared_ptr<Applet> AppletManager::GetApplet(AppletId id) const { 219std::shared_ptr<Applet> AppletManager::GetApplet(AppletId id, u64 current_process_title_id) const {
218 switch (id) { 220 switch (id) {
219 case AppletId::Auth: 221 case AppletId::Auth:
220 return std::make_shared<Auth>(*frontend.parental_controls); 222 return std::make_shared<Auth>(*frontend.parental_controls);
@@ -227,9 +229,10 @@ std::shared_ptr<Applet> AppletManager::GetApplet(AppletId id) const {
227 case AppletId::PhotoViewer: 229 case AppletId::PhotoViewer:
228 return std::make_shared<PhotoViewer>(*frontend.photo_viewer); 230 return std::make_shared<PhotoViewer>(*frontend.photo_viewer);
229 case AppletId::LibAppletShop: 231 case AppletId::LibAppletShop:
230 return std::make_shared<WebBrowser>(*frontend.web_browser, frontend.e_commerce.get()); 232 return std::make_shared<WebBrowser>(*frontend.web_browser, current_process_title_id,
233 frontend.e_commerce.get());
231 case AppletId::LibAppletOff: 234 case AppletId::LibAppletOff:
232 return std::make_shared<WebBrowser>(*frontend.web_browser); 235 return std::make_shared<WebBrowser>(*frontend.web_browser, current_process_title_id);
233 default: 236 default:
234 UNIMPLEMENTED_MSG( 237 UNIMPLEMENTED_MSG(
235 "No backend implementation exists for applet_id={:02X}! Falling back to stub applet.", 238 "No backend implementation exists for applet_id={:02X}! Falling back to stub applet.",
diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h
index ef3791865..adc973dad 100644
--- a/src/core/hle/service/am/applets/applets.h
+++ b/src/core/hle/service/am/applets/applets.h
@@ -187,7 +187,7 @@ public:
187 void SetDefaultAppletsIfMissing(); 187 void SetDefaultAppletsIfMissing();
188 void ClearAll(); 188 void ClearAll();
189 189
190 std::shared_ptr<Applet> GetApplet(AppletId id) const; 190 std::shared_ptr<Applet> GetApplet(AppletId id, u64 current_process_title_id) const;
191 191
192private: 192private:
193 AppletFrontendSet frontend; 193 AppletFrontendSet frontend;
diff --git a/src/core/hle/service/am/applets/web_browser.cpp b/src/core/hle/service/am/applets/web_browser.cpp
index 3aa8f2468..2762e0653 100644
--- a/src/core/hle/service/am/applets/web_browser.cpp
+++ b/src/core/hle/service/am/applets/web_browser.cpp
@@ -207,9 +207,10 @@ FileSys::VirtualFile GetApplicationRomFS(u64 title_id, FileSys::ContentRecordTyp
207 207
208} // Anonymous namespace 208} // Anonymous namespace
209 209
210WebBrowser::WebBrowser(Core::Frontend::WebBrowserApplet& frontend, 210WebBrowser::WebBrowser(Core::Frontend::WebBrowserApplet& frontend, u64 current_process_title_id,
211 Core::Frontend::ECommerceApplet* frontend_e_commerce) 211 Core::Frontend::ECommerceApplet* frontend_e_commerce)
212 : frontend(frontend), frontend_e_commerce(frontend_e_commerce) {} 212 : frontend(frontend), frontend_e_commerce(frontend_e_commerce),
213 current_process_title_id(current_process_title_id) {}
213 214
214WebBrowser::~WebBrowser() = default; 215WebBrowser::~WebBrowser() = default;
215 216
@@ -469,7 +470,7 @@ void WebBrowser::InitializeOffline() {
469 } 470 }
470 471
471 if (title_id == 0) { 472 if (title_id == 0) {
472 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); 473 title_id = current_process_title_id;
473 } 474 }
474 475
475 offline_romfs = GetApplicationRomFS(title_id, type); 476 offline_romfs = GetApplicationRomFS(title_id, type);
diff --git a/src/core/hle/service/am/applets/web_browser.h b/src/core/hle/service/am/applets/web_browser.h
index 9667dcf6f..870f57b64 100644
--- a/src/core/hle/service/am/applets/web_browser.h
+++ b/src/core/hle/service/am/applets/web_browser.h
@@ -17,7 +17,7 @@ enum class WebArgTLVType : u16;
17 17
18class WebBrowser final : public Applet { 18class WebBrowser final : public Applet {
19public: 19public:
20 WebBrowser(Core::Frontend::WebBrowserApplet& frontend, 20 WebBrowser(Core::Frontend::WebBrowserApplet& frontend, u64 current_process_title_id,
21 Core::Frontend::ECommerceApplet* frontend_e_commerce = nullptr); 21 Core::Frontend::ECommerceApplet* frontend_e_commerce = nullptr);
22 22
23 ~WebBrowser() override; 23 ~WebBrowser() override;
@@ -59,6 +59,8 @@ private:
59 bool unpacked = false; 59 bool unpacked = false;
60 ResultCode status = RESULT_SUCCESS; 60 ResultCode status = RESULT_SUCCESS;
61 61
62 u64 current_process_title_id;
63
62 ShimKind kind; 64 ShimKind kind;
63 std::map<WebArgTLVType, std::vector<u8>> args; 65 std::map<WebArgTLVType, std::vector<u8>> args;
64 66
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index b2954eb34..dfffcb510 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -204,7 +204,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system,
204 SM::ServiceManager::InstallInterfaces(sm); 204 SM::ServiceManager::InstallInterfaces(sm);
205 205
206 Account::InstallInterfaces(system); 206 Account::InstallInterfaces(system);
207 AM::InstallInterfaces(*sm, nv_flinger); 207 AM::InstallInterfaces(*sm, nv_flinger, system);
208 AOC::InstallInterfaces(*sm); 208 AOC::InstallInterfaces(*sm);
209 APM::InstallInterfaces(*sm); 209 APM::InstallInterfaces(*sm);
210 ARP::InstallInterfaces(*sm); 210 ARP::InstallInterfaces(*sm);