summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/acc/acc.cpp88
-rw-r--r--src/core/hle/service/acc/acc.h5
-rw-r--r--src/core/hle/service/am/am.cpp74
-rw-r--r--src/core/hle/service/am/am.h30
-rw-r--r--src/core/hle/service/am/applet_ae.cpp49
-rw-r--r--src/core/hle/service/am/applet_ae.h5
-rw-r--r--src/core/hle/service/am/applet_oe.cpp24
-rw-r--r--src/core/hle/service/am/applet_oe.h5
-rw-r--r--src/core/hle/service/am/applets/controller.cpp4
-rw-r--r--src/core/hle/service/am/applets/controller.h1
-rw-r--r--src/core/hle/service/am/applets/error.cpp4
-rw-r--r--src/core/hle/service/am/applets/general_backend.cpp24
-rw-r--r--src/core/hle/service/am/applets/general_backend.h3
-rw-r--r--src/core/hle/service/am/applets/profile_select.cpp6
-rw-r--r--src/core/hle/service/am/applets/profile_select.h1
-rw-r--r--src/core/hle/service/am/applets/software_keyboard.cpp14
-rw-r--r--src/core/hle/service/am/applets/software_keyboard.h1
-rw-r--r--src/core/hle/service/am/applets/web_browser.cpp2
-rw-r--r--src/core/hle/service/am/idle.cpp2
-rw-r--r--src/core/hle/service/am/idle.h6
-rw-r--r--src/core/hle/service/am/omm.cpp2
-rw-r--r--src/core/hle/service/am/omm.h6
-rw-r--r--src/core/hle/service/am/spsm.cpp2
-rw-r--r--src/core/hle/service/am/spsm.h6
-rw-r--r--src/core/hle/service/am/tcap.cpp2
-rw-r--r--src/core/hle/service/am/tcap.h6
-rw-r--r--src/core/hle/service/aoc/aoc_u.cpp4
-rw-r--r--src/core/hle/service/aoc/aoc_u.h5
-rw-r--r--src/core/hle/service/apm/apm.cpp9
-rw-r--r--src/core/hle/service/apm/apm.h4
-rw-r--r--src/core/hle/service/apm/interface.cpp15
-rw-r--r--src/core/hle/service/apm/interface.h5
-rw-r--r--src/core/hle/service/audio/audctl.cpp2
-rw-r--r--src/core/hle/service/audio/audctl.h6
-rw-r--r--src/core/hle/service/audio/auddbg.cpp2
-rw-r--r--src/core/hle/service/audio/auddbg.h6
-rw-r--r--src/core/hle/service/audio/audin_a.cpp2
-rw-r--r--src/core/hle/service/audio/audin_a.h6
-rw-r--r--src/core/hle/service/audio/audin_u.cpp6
-rw-r--r--src/core/hle/service/audio/audin_u.h6
-rw-r--r--src/core/hle/service/audio/audio.cpp26
-rw-r--r--src/core/hle/service/audio/audout_a.cpp2
-rw-r--r--src/core/hle/service/audio/audout_a.h6
-rw-r--r--src/core/hle/service/audio/audout_u.cpp12
-rw-r--r--src/core/hle/service/audio/audout_u.h2
-rw-r--r--src/core/hle/service/audio/audrec_a.cpp2
-rw-r--r--src/core/hle/service/audio/audrec_a.h6
-rw-r--r--src/core/hle/service/audio/audrec_u.cpp5
-rw-r--r--src/core/hle/service/audio/audrec_u.h6
-rw-r--r--src/core/hle/service/audio/audren_a.cpp2
-rw-r--r--src/core/hle/service/audio/audren_a.h6
-rw-r--r--src/core/hle/service/audio/audren_u.cpp8
-rw-r--r--src/core/hle/service/audio/audren_u.h1
-rw-r--r--src/core/hle/service/audio/codecctl.cpp5
-rw-r--r--src/core/hle/service/audio/codecctl.h6
-rw-r--r--src/core/hle/service/audio/hwopus.cpp9
-rw-r--r--src/core/hle/service/audio/hwopus.h6
-rw-r--r--src/core/hle/service/bcat/module.cpp40
-rw-r--r--src/core/hle/service/bcat/module.h3
-rw-r--r--src/core/hle/service/bpc/bpc.cpp10
-rw-r--r--src/core/hle/service/bpc/bpc.h6
-rw-r--r--src/core/hle/service/btdrv/btdrv.cpp6
-rw-r--r--src/core/hle/service/btm/btm.cpp22
-rw-r--r--src/core/hle/service/caps/caps.cpp14
-rw-r--r--src/core/hle/service/caps/caps.h6
-rw-r--r--src/core/hle/service/caps/caps_a.cpp5
-rw-r--r--src/core/hle/service/caps/caps_a.h6
-rw-r--r--src/core/hle/service/caps/caps_c.cpp5
-rw-r--r--src/core/hle/service/caps/caps_c.h6
-rw-r--r--src/core/hle/service/caps/caps_sc.cpp2
-rw-r--r--src/core/hle/service/caps/caps_sc.h6
-rw-r--r--src/core/hle/service/caps/caps_ss.cpp2
-rw-r--r--src/core/hle/service/caps/caps_ss.h6
-rw-r--r--src/core/hle/service/caps/caps_su.cpp2
-rw-r--r--src/core/hle/service/caps/caps_su.h6
-rw-r--r--src/core/hle/service/caps/caps_u.cpp6
-rw-r--r--src/core/hle/service/caps/caps_u.h6
-rw-r--r--src/core/hle/service/erpt/erpt.cpp10
-rw-r--r--src/core/hle/service/erpt/erpt.h6
-rw-r--r--src/core/hle/service/es/es.cpp6
-rw-r--r--src/core/hle/service/es/es.h6
-rw-r--r--src/core/hle/service/eupld/eupld.cpp10
-rw-r--r--src/core/hle/service/eupld/eupld.h6
-rw-r--r--src/core/hle/service/fatal/fatal.cpp5
-rw-r--r--src/core/hle/service/fatal/fatal.h4
-rw-r--r--src/core/hle/service/fatal/fatal_p.cpp4
-rw-r--r--src/core/hle/service/fatal/fatal_p.h2
-rw-r--r--src/core/hle/service/fatal/fatal_u.cpp4
-rw-r--r--src/core/hle/service/fatal/fatal_u.h2
-rw-r--r--src/core/hle/service/fgm/fgm.cpp18
-rw-r--r--src/core/hle/service/fgm/fgm.h6
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp8
-rw-r--r--src/core/hle/service/filesystem/fsp_ldr.cpp2
-rw-r--r--src/core/hle/service/filesystem/fsp_ldr.h6
-rw-r--r--src/core/hle/service/filesystem/fsp_pr.cpp2
-rw-r--r--src/core/hle/service/filesystem/fsp_pr.h6
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp57
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.h3
-rw-r--r--src/core/hle/service/friend/friend.cpp13
-rw-r--r--src/core/hle/service/friend/friend.h4
-rw-r--r--src/core/hle/service/friend/interface.cpp4
-rw-r--r--src/core/hle/service/friend/interface.h2
-rw-r--r--src/core/hle/service/glue/arp.cpp13
-rw-r--r--src/core/hle/service/glue/arp.h6
-rw-r--r--src/core/hle/service/glue/bgtc.cpp4
-rw-r--r--src/core/hle/service/glue/bgtc.h8
-rw-r--r--src/core/hle/service/glue/glue.cpp4
-rw-r--r--src/core/hle/service/grc/grc.cpp6
-rw-r--r--src/core/hle/service/grc/grc.h6
-rw-r--r--src/core/hle/service/hid/hid.cpp34
-rw-r--r--src/core/hle/service/hid/hid.h6
-rw-r--r--src/core/hle/service/hid/irs.cpp4
-rw-r--r--src/core/hle/service/hid/irs.h10
-rw-r--r--src/core/hle/service/hid/xcd.cpp2
-rw-r--r--src/core/hle/service/hid/xcd.h6
-rw-r--r--src/core/hle/service/lbl/lbl.cpp6
-rw-r--r--src/core/hle/service/lbl/lbl.h6
-rw-r--r--src/core/hle/service/ldn/ldn.cpp29
-rw-r--r--src/core/hle/service/ldn/ldn.h6
-rw-r--r--src/core/hle/service/ldr/ldr.cpp15
-rw-r--r--src/core/hle/service/ldr/ldr.h4
-rw-r--r--src/core/hle/service/lm/lm.cpp16
-rw-r--r--src/core/hle/service/mig/mig.cpp6
-rw-r--r--src/core/hle/service/mig/mig.h6
-rw-r--r--src/core/hle/service/mii/mii.cpp18
-rw-r--r--src/core/hle/service/mii/mii.h6
-rw-r--r--src/core/hle/service/mm/mm_u.cpp7
-rw-r--r--src/core/hle/service/mm/mm_u.h10
-rw-r--r--src/core/hle/service/ncm/ncm.cpp20
-rw-r--r--src/core/hle/service/ncm/ncm.h6
-rw-r--r--src/core/hle/service/nfc/nfc.cpp34
-rw-r--r--src/core/hle/service/nfc/nfc.h6
-rw-r--r--src/core/hle/service/nfp/nfp.cpp9
-rw-r--r--src/core/hle/service/nfp/nfp.h4
-rw-r--r--src/core/hle/service/nfp/nfp_user.cpp4
-rw-r--r--src/core/hle/service/nfp/nfp_user.h2
-rw-r--r--src/core/hle/service/nifm/nifm.cpp25
-rw-r--r--src/core/hle/service/nifm/nifm.h8
-rw-r--r--src/core/hle/service/nim/nim.cpp34
-rw-r--r--src/core/hle/service/nim/nim.h8
-rw-r--r--src/core/hle/service/npns/npns.cpp10
-rw-r--r--src/core/hle/service/npns/npns.h6
-rw-r--r--src/core/hle/service/ns/ns.cpp45
-rw-r--r--src/core/hle/service/ns/ns.h20
-rw-r--r--src/core/hle/service/ns/pl_u.cpp4
-rw-r--r--src/core/hle/service/ns/pl_u.h3
-rw-r--r--src/core/hle/service/nvdrv/interface.cpp4
-rw-r--r--src/core/hle/service/nvdrv/interface.h4
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp10
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h2
-rw-r--r--src/core/hle/service/nvdrv/nvmemp.cpp2
-rw-r--r--src/core/hle/service/nvdrv/nvmemp.h6
-rw-r--r--src/core/hle/service/olsc/olsc.cpp6
-rw-r--r--src/core/hle/service/olsc/olsc.h6
-rw-r--r--src/core/hle/service/pcie/pcie.cpp8
-rw-r--r--src/core/hle/service/pcie/pcie.h6
-rw-r--r--src/core/hle/service/pctl/module.cpp21
-rw-r--r--src/core/hle/service/pctl/module.h9
-rw-r--r--src/core/hle/service/pctl/pctl.cpp4
-rw-r--r--src/core/hle/service/pctl/pctl.h6
-rw-r--r--src/core/hle/service/pcv/pcv.cpp14
-rw-r--r--src/core/hle/service/pcv/pcv.h6
-rw-r--r--src/core/hle/service/pm/pm.cpp23
-rw-r--r--src/core/hle/service/prepo/prepo.cpp5
-rw-r--r--src/core/hle/service/prepo/prepo.h8
-rw-r--r--src/core/hle/service/psc/psc.cpp14
-rw-r--r--src/core/hle/service/psc/psc.h6
-rw-r--r--src/core/hle/service/ptm/psm.cpp6
-rw-r--r--src/core/hle/service/ptm/psm.h6
-rw-r--r--src/core/hle/service/service.cpp69
-rw-r--r--src/core/hle/service/service.h18
-rw-r--r--src/core/hle/service/set/set.cpp2
-rw-r--r--src/core/hle/service/set/set.h6
-rw-r--r--src/core/hle/service/set/set_cal.cpp2
-rw-r--r--src/core/hle/service/set/set_cal.h6
-rw-r--r--src/core/hle/service/set/set_fd.cpp2
-rw-r--r--src/core/hle/service/set/set_fd.h6
-rw-r--r--src/core/hle/service/set/set_sys.cpp2
-rw-r--r--src/core/hle/service/set/set_sys.h6
-rw-r--r--src/core/hle/service/set/settings.cpp11
-rw-r--r--src/core/hle/service/set/settings.h10
-rw-r--r--src/core/hle/service/sm/controller.cpp2
-rw-r--r--src/core/hle/service/sm/controller.h6
-rw-r--r--src/core/hle/service/sm/sm.cpp14
-rw-r--r--src/core/hle/service/sm/sm.h8
-rw-r--r--src/core/hle/service/sockets/bsd.cpp6
-rw-r--r--src/core/hle/service/sockets/bsd.h4
-rw-r--r--src/core/hle/service/sockets/ethc.cpp4
-rw-r--r--src/core/hle/service/sockets/ethc.h8
-rw-r--r--src/core/hle/service/sockets/nsd.cpp2
-rw-r--r--src/core/hle/service/sockets/nsd.h7
-rw-r--r--src/core/hle/service/sockets/sfdnsres.cpp38
-rw-r--r--src/core/hle/service/sockets/sfdnsres.h6
-rw-r--r--src/core/hle/service/sockets/sockets.cpp12
-rw-r--r--src/core/hle/service/spl/csrng.cpp3
-rw-r--r--src/core/hle/service/spl/csrng.h6
-rw-r--r--src/core/hle/service/spl/module.cpp11
-rw-r--r--src/core/hle/service/spl/module.h9
-rw-r--r--src/core/hle/service/spl/spl.cpp3
-rw-r--r--src/core/hle/service/spl/spl.h6
-rw-r--r--src/core/hle/service/ssl/ssl.cpp14
-rw-r--r--src/core/hle/service/ssl/ssl.h6
-rw-r--r--src/core/hle/service/time/interface.cpp2
-rw-r--r--src/core/hle/service/time/time.cpp18
-rw-r--r--src/core/hle/service/time/time.h4
-rw-r--r--src/core/hle/service/time/time_zone_service.cpp5
-rw-r--r--src/core/hle/service/time/time_zone_service.h7
-rw-r--r--src/core/hle/service/usb/usb.cpp39
-rw-r--r--src/core/hle/service/usb/usb.h6
-rw-r--r--src/core/hle/service/vi/vi.cpp41
-rw-r--r--src/core/hle/service/vi/vi.h11
-rw-r--r--src/core/hle/service/vi/vi_m.cpp5
-rw-r--r--src/core/hle/service/vi/vi_m.h6
-rw-r--r--src/core/hle/service/vi/vi_s.cpp5
-rw-r--r--src/core/hle/service/vi/vi_s.h6
-rw-r--r--src/core/hle/service/vi/vi_u.cpp5
-rw-r--r--src/core/hle/service/vi/vi_u.h6
-rw-r--r--src/core/hle/service/wlan/wlan.cpp22
-rw-r--r--src/core/hle/service/wlan/wlan.h6
-rw-r--r--src/yuzu_tester/service/yuzutest.cpp15
-rw-r--r--src/yuzu_tester/service/yuzutest.h6
-rw-r--r--src/yuzu_tester/yuzu.cpp3
222 files changed, 1221 insertions, 907 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index c2c11dbcb..6981f8ee7 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -47,8 +47,8 @@ static constexpr u32 SanitizeJPEGSize(std::size_t size) {
47 47
48class IManagerForSystemService final : public ServiceFramework<IManagerForSystemService> { 48class IManagerForSystemService final : public ServiceFramework<IManagerForSystemService> {
49public: 49public:
50 explicit IManagerForSystemService(Common::UUID user_id) 50 explicit IManagerForSystemService(Core::System& system_, Common::UUID)
51 : ServiceFramework("IManagerForSystemService") { 51 : ServiceFramework{system_, "IManagerForSystemService"} {
52 // clang-format off 52 // clang-format off
53 static const FunctionInfo functions[] = { 53 static const FunctionInfo functions[] = {
54 {0, nullptr, "CheckAvailability"}, 54 {0, nullptr, "CheckAvailability"},
@@ -83,8 +83,8 @@ public:
83// 3.0.0+ 83// 3.0.0+
84class IFloatingRegistrationRequest final : public ServiceFramework<IFloatingRegistrationRequest> { 84class IFloatingRegistrationRequest final : public ServiceFramework<IFloatingRegistrationRequest> {
85public: 85public:
86 explicit IFloatingRegistrationRequest(Common::UUID user_id) 86 explicit IFloatingRegistrationRequest(Core::System& system_, Common::UUID)
87 : ServiceFramework("IFloatingRegistrationRequest") { 87 : ServiceFramework{system_, "IFloatingRegistrationRequest"} {
88 // clang-format off 88 // clang-format off
89 static const FunctionInfo functions[] = { 89 static const FunctionInfo functions[] = {
90 {0, nullptr, "GetSessionId"}, 90 {0, nullptr, "GetSessionId"},
@@ -108,7 +108,8 @@ public:
108 108
109class IAdministrator final : public ServiceFramework<IAdministrator> { 109class IAdministrator final : public ServiceFramework<IAdministrator> {
110public: 110public:
111 explicit IAdministrator(Common::UUID user_id) : ServiceFramework("IAdministrator") { 111 explicit IAdministrator(Core::System& system_, Common::UUID)
112 : ServiceFramework{system_, "IAdministrator"} {
112 // clang-format off 113 // clang-format off
113 static const FunctionInfo functions[] = { 114 static const FunctionInfo functions[] = {
114 {0, nullptr, "CheckAvailability"}, 115 {0, nullptr, "CheckAvailability"},
@@ -165,8 +166,8 @@ public:
165 166
166class IAuthorizationRequest final : public ServiceFramework<IAuthorizationRequest> { 167class IAuthorizationRequest final : public ServiceFramework<IAuthorizationRequest> {
167public: 168public:
168 explicit IAuthorizationRequest(Common::UUID user_id) 169 explicit IAuthorizationRequest(Core::System& system_, Common::UUID)
169 : ServiceFramework("IAuthorizationRequest") { 170 : ServiceFramework{system_, "IAuthorizationRequest"} {
170 // clang-format off 171 // clang-format off
171 static const FunctionInfo functions[] = { 172 static const FunctionInfo functions[] = {
172 {0, nullptr, "GetSessionId"}, 173 {0, nullptr, "GetSessionId"},
@@ -184,7 +185,8 @@ public:
184 185
185class IOAuthProcedure final : public ServiceFramework<IOAuthProcedure> { 186class IOAuthProcedure final : public ServiceFramework<IOAuthProcedure> {
186public: 187public:
187 explicit IOAuthProcedure(Common::UUID user_id) : ServiceFramework("IOAuthProcedure") { 188 explicit IOAuthProcedure(Core::System& system_, Common::UUID)
189 : ServiceFramework{system_, "IOAuthProcedure"} {
188 // clang-format off 190 // clang-format off
189 static const FunctionInfo functions[] = { 191 static const FunctionInfo functions[] = {
190 {0, nullptr, "PrepareAsync"}, 192 {0, nullptr, "PrepareAsync"},
@@ -202,8 +204,8 @@ public:
202// 3.0.0+ 204// 3.0.0+
203class IOAuthProcedureForExternalNsa final : public ServiceFramework<IOAuthProcedureForExternalNsa> { 205class IOAuthProcedureForExternalNsa final : public ServiceFramework<IOAuthProcedureForExternalNsa> {
204public: 206public:
205 explicit IOAuthProcedureForExternalNsa(Common::UUID user_id) 207 explicit IOAuthProcedureForExternalNsa(Core::System& system_, Common::UUID)
206 : ServiceFramework("IOAuthProcedureForExternalNsa") { 208 : ServiceFramework{system_, "IOAuthProcedureForExternalNsa"} {
207 // clang-format off 209 // clang-format off
208 static const FunctionInfo functions[] = { 210 static const FunctionInfo functions[] = {
209 {0, nullptr, "PrepareAsync"}, 211 {0, nullptr, "PrepareAsync"},
@@ -225,8 +227,8 @@ public:
225class IOAuthProcedureForNintendoAccountLinkage final 227class IOAuthProcedureForNintendoAccountLinkage final
226 : public ServiceFramework<IOAuthProcedureForNintendoAccountLinkage> { 228 : public ServiceFramework<IOAuthProcedureForNintendoAccountLinkage> {
227public: 229public:
228 explicit IOAuthProcedureForNintendoAccountLinkage(Common::UUID user_id) 230 explicit IOAuthProcedureForNintendoAccountLinkage(Core::System& system_, Common::UUID)
229 : ServiceFramework("IOAuthProcedureForNintendoAccountLinkage") { 231 : ServiceFramework{system_, "IOAuthProcedureForNintendoAccountLinkage"} {
230 // clang-format off 232 // clang-format off
231 static const FunctionInfo functions[] = { 233 static const FunctionInfo functions[] = {
232 {0, nullptr, "PrepareAsync"}, 234 {0, nullptr, "PrepareAsync"},
@@ -246,7 +248,8 @@ public:
246 248
247class INotifier final : public ServiceFramework<INotifier> { 249class INotifier final : public ServiceFramework<INotifier> {
248public: 250public:
249 explicit INotifier(Common::UUID user_id) : ServiceFramework("INotifier") { 251 explicit INotifier(Core::System& system_, Common::UUID)
252 : ServiceFramework{system_, "INotifier"} {
250 // clang-format off 253 // clang-format off
251 static const FunctionInfo functions[] = { 254 static const FunctionInfo functions[] = {
252 {0, nullptr, "GetSystemEvent"}, 255 {0, nullptr, "GetSystemEvent"},
@@ -259,9 +262,9 @@ public:
259 262
260class IProfileCommon : public ServiceFramework<IProfileCommon> { 263class IProfileCommon : public ServiceFramework<IProfileCommon> {
261public: 264public:
262 explicit IProfileCommon(const char* name, bool editor_commands, Common::UUID user_id, 265 explicit IProfileCommon(Core::System& system_, const char* name, bool editor_commands,
263 ProfileManager& profile_manager) 266 Common::UUID user_id_, ProfileManager& profile_manager_)
264 : ServiceFramework(name), profile_manager(profile_manager), user_id(user_id) { 267 : ServiceFramework{system_, name}, profile_manager{profile_manager_}, user_id{user_id_} {
265 static const FunctionInfo functions[] = { 268 static const FunctionInfo functions[] = {
266 {0, &IProfileCommon::Get, "Get"}, 269 {0, &IProfileCommon::Get, "Get"},
267 {1, &IProfileCommon::GetBase, "GetBase"}, 270 {1, &IProfileCommon::GetBase, "GetBase"},
@@ -427,19 +430,21 @@ protected:
427 430
428class IProfile final : public IProfileCommon { 431class IProfile final : public IProfileCommon {
429public: 432public:
430 IProfile(Common::UUID user_id, ProfileManager& profile_manager) 433 explicit IProfile(Core::System& system_, Common::UUID user_id_,
431 : IProfileCommon("IProfile", false, user_id, profile_manager) {} 434 ProfileManager& profile_manager_)
435 : IProfileCommon{system_, "IProfile", false, user_id_, profile_manager_} {}
432}; 436};
433 437
434class IProfileEditor final : public IProfileCommon { 438class IProfileEditor final : public IProfileCommon {
435public: 439public:
436 IProfileEditor(Common::UUID user_id, ProfileManager& profile_manager) 440 explicit IProfileEditor(Core::System& system_, Common::UUID user_id_,
437 : IProfileCommon("IProfileEditor", true, user_id, profile_manager) {} 441 ProfileManager& profile_manager_)
442 : IProfileCommon{system_, "IProfileEditor", true, user_id_, profile_manager_} {}
438}; 443};
439 444
440class IAsyncContext final : public ServiceFramework<IAsyncContext> { 445class IAsyncContext final : public ServiceFramework<IAsyncContext> {
441public: 446public:
442 explicit IAsyncContext(Common::UUID user_id) : ServiceFramework("IAsyncContext") { 447 explicit IAsyncContext(Core::System& system_) : ServiceFramework{system_, "IAsyncContext"} {
443 // clang-format off 448 // clang-format off
444 static const FunctionInfo functions[] = { 449 static const FunctionInfo functions[] = {
445 {0, nullptr, "GetSystemEvent"}, 450 {0, nullptr, "GetSystemEvent"},
@@ -455,7 +460,8 @@ public:
455 460
456class ISessionObject final : public ServiceFramework<ISessionObject> { 461class ISessionObject final : public ServiceFramework<ISessionObject> {
457public: 462public:
458 explicit ISessionObject(Common::UUID user_id) : ServiceFramework("ISessionObject") { 463 explicit ISessionObject(Core::System& system_, Common::UUID)
464 : ServiceFramework{system_, "ISessionObject"} {
459 // clang-format off 465 // clang-format off
460 static const FunctionInfo functions[] = { 466 static const FunctionInfo functions[] = {
461 {999, nullptr, "Dummy"}, 467 {999, nullptr, "Dummy"},
@@ -468,7 +474,8 @@ public:
468 474
469class IGuestLoginRequest final : public ServiceFramework<IGuestLoginRequest> { 475class IGuestLoginRequest final : public ServiceFramework<IGuestLoginRequest> {
470public: 476public:
471 explicit IGuestLoginRequest(Common::UUID) : ServiceFramework("IGuestLoginRequest") { 477 explicit IGuestLoginRequest(Core::System& system_, Common::UUID)
478 : ServiceFramework{system_, "IGuestLoginRequest"} {
472 // clang-format off 479 // clang-format off
473 static const FunctionInfo functions[] = { 480 static const FunctionInfo functions[] = {
474 {0, nullptr, "GetSessionId"}, 481 {0, nullptr, "GetSessionId"},
@@ -487,8 +494,8 @@ public:
487 494
488class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { 495class IManagerForApplication final : public ServiceFramework<IManagerForApplication> {
489public: 496public:
490 explicit IManagerForApplication(Common::UUID user_id) 497 explicit IManagerForApplication(Core::System& system_, Common::UUID user_id_)
491 : ServiceFramework("IManagerForApplication"), user_id(user_id) { 498 : ServiceFramework{system_, "IManagerForApplication"}, user_id{user_id_} {
492 // clang-format off 499 // clang-format off
493 static const FunctionInfo functions[] = { 500 static const FunctionInfo functions[] = {
494 {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, 501 {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"},
@@ -534,8 +541,8 @@ private:
534class IAsyncNetworkServiceLicenseKindContext final 541class IAsyncNetworkServiceLicenseKindContext final
535 : public ServiceFramework<IAsyncNetworkServiceLicenseKindContext> { 542 : public ServiceFramework<IAsyncNetworkServiceLicenseKindContext> {
536public: 543public:
537 explicit IAsyncNetworkServiceLicenseKindContext(Common::UUID user_id) 544 explicit IAsyncNetworkServiceLicenseKindContext(Core::System& system_, Common::UUID)
538 : ServiceFramework("IAsyncNetworkServiceLicenseKindContext") { 545 : ServiceFramework{system_, "IAsyncNetworkServiceLicenseKindContext"} {
539 // clang-format off 546 // clang-format off
540 static const FunctionInfo functions[] = { 547 static const FunctionInfo functions[] = {
541 {0, nullptr, "GetSystemEvent"}, 548 {0, nullptr, "GetSystemEvent"},
@@ -554,8 +561,8 @@ public:
554class IOAuthProcedureForUserRegistration final 561class IOAuthProcedureForUserRegistration final
555 : public ServiceFramework<IOAuthProcedureForUserRegistration> { 562 : public ServiceFramework<IOAuthProcedureForUserRegistration> {
556public: 563public:
557 explicit IOAuthProcedureForUserRegistration(Common::UUID user_id) 564 explicit IOAuthProcedureForUserRegistration(Core::System& system_, Common::UUID)
558 : ServiceFramework("IOAuthProcedureForUserRegistration") { 565 : ServiceFramework{system_, "IOAuthProcedureForUserRegistration"} {
559 // clang-format off 566 // clang-format off
560 static const FunctionInfo functions[] = { 567 static const FunctionInfo functions[] = {
561 {0, nullptr, "PrepareAsync"}, 568 {0, nullptr, "PrepareAsync"},
@@ -578,7 +585,7 @@ public:
578 585
579class DAUTH_O final : public ServiceFramework<DAUTH_O> { 586class DAUTH_O final : public ServiceFramework<DAUTH_O> {
580public: 587public:
581 explicit DAUTH_O(Common::UUID) : ServiceFramework("dauth:o") { 588 explicit DAUTH_O(Core::System& system_, Common::UUID) : ServiceFramework{system_, "dauth:o"} {
582 // clang-format off 589 // clang-format off
583 static const FunctionInfo functions[] = { 590 static const FunctionInfo functions[] = {
584 {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, // [5.0.0-5.1.0] GeneratePostData 591 {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, // [5.0.0-5.1.0] GeneratePostData
@@ -597,7 +604,8 @@ public:
597// 6.0.0+ 604// 6.0.0+
598class IAsyncResult final : public ServiceFramework<IAsyncResult> { 605class IAsyncResult final : public ServiceFramework<IAsyncResult> {
599public: 606public:
600 explicit IAsyncResult(Common::UUID user_id) : ServiceFramework("IAsyncResult") { 607 explicit IAsyncResult(Core::System& system_, Common::UUID)
608 : ServiceFramework{system_, "IAsyncResult"} {
601 // clang-format off 609 // clang-format off
602 static const FunctionInfo functions[] = { 610 static const FunctionInfo functions[] = {
603 {0, nullptr, "GetResult"}, 611 {0, nullptr, "GetResult"},
@@ -656,7 +664,7 @@ void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) {
656 664
657 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 665 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
658 rb.Push(RESULT_SUCCESS); 666 rb.Push(RESULT_SUCCESS);
659 rb.PushIpcInterface<IProfile>(user_id, *profile_manager); 667 rb.PushIpcInterface<IProfile>(system, user_id, *profile_manager);
660} 668}
661 669
662void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx) { 670void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx) {
@@ -731,7 +739,7 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo
731 LOG_DEBUG(Service_ACC, "called"); 739 LOG_DEBUG(Service_ACC, "called");
732 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 740 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
733 rb.Push(RESULT_SUCCESS); 741 rb.Push(RESULT_SUCCESS);
734 rb.PushIpcInterface<IManagerForApplication>(profile_manager->GetLastOpenedUser()); 742 rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser());
735} 743}
736 744
737void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { 745void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) {
@@ -769,7 +777,7 @@ void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) {
769 777
770 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 778 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
771 rb.Push(RESULT_SUCCESS); 779 rb.Push(RESULT_SUCCESS);
772 rb.PushIpcInterface<IProfileEditor>(user_id, *profile_manager); 780 rb.PushIpcInterface<IProfileEditor>(system, user_id, *profile_manager);
773} 781}
774 782
775void Module::Interface::ListQualifiedUsers(Kernel::HLERequestContext& ctx) { 783void Module::Interface::ListQualifiedUsers(Kernel::HLERequestContext& ctx) {
@@ -791,7 +799,7 @@ void Module::Interface::LoadOpenContext(Kernel::HLERequestContext& ctx) {
791 // TODO: Find the differences between this and GetBaasAccountManagerForApplication 799 // TODO: Find the differences between this and GetBaasAccountManagerForApplication
792 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 800 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
793 rb.Push(RESULT_SUCCESS); 801 rb.Push(RESULT_SUCCESS);
794 rb.PushIpcInterface<IManagerForApplication>(profile_manager->GetLastOpenedUser()); 802 rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser());
795} 803}
796 804
797void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx) { 805void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx) {
@@ -827,11 +835,11 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex
827 rb.PushRaw<u128>(profile_manager->GetUser(0)->uuid); 835 rb.PushRaw<u128>(profile_manager->GetUser(0)->uuid);
828} 836}
829 837
830Module::Interface::Interface(std::shared_ptr<Module> module, 838Module::Interface::Interface(std::shared_ptr<Module> module_,
831 std::shared_ptr<ProfileManager> profile_manager, Core::System& system, 839 std::shared_ptr<ProfileManager> profile_manager_,
832 const char* name) 840 Core::System& system_, const char* name)
833 : ServiceFramework(name), module(std::move(module)), 841 : ServiceFramework{system_, name}, module{std::move(module_)}, profile_manager{std::move(
834 profile_manager(std::move(profile_manager)), system(system) {} 842 profile_manager_)} {}
835 843
836Module::Interface::~Interface() = default; 844Module::Interface::~Interface() = default;
837 845
diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h
index c611efd89..ab8edc049 100644
--- a/src/core/hle/service/acc/acc.h
+++ b/src/core/hle/service/acc/acc.h
@@ -15,8 +15,8 @@ class Module final {
15public: 15public:
16 class Interface : public ServiceFramework<Interface> { 16 class Interface : public ServiceFramework<Interface> {
17 public: 17 public:
18 explicit Interface(std::shared_ptr<Module> module, 18 explicit Interface(std::shared_ptr<Module> module_,
19 std::shared_ptr<ProfileManager> profile_manager, Core::System& system, 19 std::shared_ptr<ProfileManager> profile_manager_, Core::System& system_,
20 const char* name); 20 const char* name);
21 ~Interface() override; 21 ~Interface() override;
22 22
@@ -60,7 +60,6 @@ public:
60 protected: 60 protected:
61 std::shared_ptr<Module> module; 61 std::shared_ptr<Module> module;
62 std::shared_ptr<ProfileManager> profile_manager; 62 std::shared_ptr<ProfileManager> profile_manager;
63 Core::System& system;
64 }; 63 };
65}; 64};
66 65
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 703a9b234..38d877f6e 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -64,7 +64,7 @@ struct LaunchParameterAccountPreselectedUser {
64static_assert(sizeof(LaunchParameterAccountPreselectedUser) == 0x88); 64static_assert(sizeof(LaunchParameterAccountPreselectedUser) == 0x88);
65 65
66IWindowController::IWindowController(Core::System& system_) 66IWindowController::IWindowController(Core::System& system_)
67 : ServiceFramework("IWindowController"), system{system_} { 67 : ServiceFramework{system_, "IWindowController"} {
68 // clang-format off 68 // clang-format off
69 static const FunctionInfo functions[] = { 69 static const FunctionInfo functions[] = {
70 {0, nullptr, "CreateWindow"}, 70 {0, nullptr, "CreateWindow"},
@@ -99,7 +99,8 @@ void IWindowController::AcquireForegroundRights(Kernel::HLERequestContext& ctx)
99 rb.Push(RESULT_SUCCESS); 99 rb.Push(RESULT_SUCCESS);
100} 100}
101 101
102IAudioController::IAudioController() : ServiceFramework("IAudioController") { 102IAudioController::IAudioController(Core::System& system_)
103 : ServiceFramework{system_, "IAudioController"} {
103 // clang-format off 104 // clang-format off
104 static const FunctionInfo functions[] = { 105 static const FunctionInfo functions[] = {
105 {0, &IAudioController::SetExpectedMasterVolume, "SetExpectedMasterVolume"}, 106 {0, &IAudioController::SetExpectedMasterVolume, "SetExpectedMasterVolume"},
@@ -180,7 +181,8 @@ void IAudioController::SetTransparentAudioRate(Kernel::HLERequestContext& ctx) {
180 rb.Push(RESULT_SUCCESS); 181 rb.Push(RESULT_SUCCESS);
181} 182}
182 183
183IDisplayController::IDisplayController() : ServiceFramework("IDisplayController") { 184IDisplayController::IDisplayController(Core::System& system_)
185 : ServiceFramework{system_, "IDisplayController"} {
184 // clang-format off 186 // clang-format off
185 static const FunctionInfo functions[] = { 187 static const FunctionInfo functions[] = {
186 {0, nullptr, "GetLastForegroundCaptureImage"}, 188 {0, nullptr, "GetLastForegroundCaptureImage"},
@@ -219,7 +221,8 @@ IDisplayController::IDisplayController() : ServiceFramework("IDisplayController"
219 221
220IDisplayController::~IDisplayController() = default; 222IDisplayController::~IDisplayController() = default;
221 223
222IDebugFunctions::IDebugFunctions() : ServiceFramework{"IDebugFunctions"} { 224IDebugFunctions::IDebugFunctions(Core::System& system_)
225 : ServiceFramework{system_, "IDebugFunctions"} {
223 // clang-format off 226 // clang-format off
224 static const FunctionInfo functions[] = { 227 static const FunctionInfo functions[] = {
225 {0, nullptr, "NotifyMessageToHomeMenuForDebug"}, 228 {0, nullptr, "NotifyMessageToHomeMenuForDebug"},
@@ -246,8 +249,8 @@ IDebugFunctions::IDebugFunctions() : ServiceFramework{"IDebugFunctions"} {
246 249
247IDebugFunctions::~IDebugFunctions() = default; 250IDebugFunctions::~IDebugFunctions() = default;
248 251
249ISelfController::ISelfController(Core::System& system, NVFlinger::NVFlinger& nvflinger) 252ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nvflinger_)
250 : ServiceFramework("ISelfController"), system(system), nvflinger(nvflinger) { 253 : ServiceFramework{system_, "ISelfController"}, nvflinger{nvflinger_} {
251 // clang-format off 254 // clang-format off
252 static const FunctionInfo functions[] = { 255 static const FunctionInfo functions[] = {
253 {0, &ISelfController::Exit, "Exit"}, 256 {0, &ISelfController::Exit, "Exit"},
@@ -605,9 +608,9 @@ void AppletMessageQueue::RequestExit() {
605 PushMessage(AppletMessage::ExitRequested); 608 PushMessage(AppletMessage::ExitRequested);
606} 609}
607 610
608ICommonStateGetter::ICommonStateGetter(Core::System& system, 611ICommonStateGetter::ICommonStateGetter(Core::System& system_,
609 std::shared_ptr<AppletMessageQueue> msg_queue) 612 std::shared_ptr<AppletMessageQueue> msg_queue_)
610 : ServiceFramework("ICommonStateGetter"), system(system), msg_queue(std::move(msg_queue)) { 613 : ServiceFramework{system_, "ICommonStateGetter"}, msg_queue{std::move(msg_queue_)} {
611 // clang-format off 614 // clang-format off
612 static const FunctionInfo functions[] = { 615 static const FunctionInfo functions[] = {
613 {0, &ICommonStateGetter::GetEventHandle, "GetEventHandle"}, 616 {0, &ICommonStateGetter::GetEventHandle, "GetEventHandle"},
@@ -795,8 +798,9 @@ private:
795 std::vector<u8> buffer; 798 std::vector<u8> buffer;
796}; 799};
797 800
798IStorage::IStorage(std::vector<u8>&& buffer) 801IStorage::IStorage(Core::System& system_, std::vector<u8>&& buffer)
799 : ServiceFramework("IStorage"), impl{std::make_shared<StorageDataImpl>(std::move(buffer))} { 802 : ServiceFramework{system_, "IStorage"}, impl{std::make_shared<StorageDataImpl>(
803 std::move(buffer))} {
800 Register(); 804 Register();
801} 805}
802 806
@@ -819,7 +823,7 @@ void IStorage::Open(Kernel::HLERequestContext& ctx) {
819 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 823 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
820 824
821 rb.Push(RESULT_SUCCESS); 825 rb.Push(RESULT_SUCCESS);
822 rb.PushIpcInterface<IStorageAccessor>(*this); 826 rb.PushIpcInterface<IStorageAccessor>(system, *this);
823} 827}
824 828
825void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { 829void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) {
@@ -841,8 +845,8 @@ void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
841 845
842class ILibraryAppletAccessor final : public ServiceFramework<ILibraryAppletAccessor> { 846class ILibraryAppletAccessor final : public ServiceFramework<ILibraryAppletAccessor> {
843public: 847public:
844 explicit ILibraryAppletAccessor(std::shared_ptr<Applets::Applet> applet) 848 explicit ILibraryAppletAccessor(Core::System& system_, std::shared_ptr<Applets::Applet> applet_)
845 : ServiceFramework("ILibraryAppletAccessor"), applet(std::move(applet)) { 849 : ServiceFramework{system_, "ILibraryAppletAccessor"}, applet{std::move(applet_)} {
846 // clang-format off 850 // clang-format off
847 static const FunctionInfo functions[] = { 851 static const FunctionInfo functions[] = {
848 {0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"}, 852 {0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"},
@@ -997,8 +1001,8 @@ private:
997 std::shared_ptr<Applets::Applet> applet; 1001 std::shared_ptr<Applets::Applet> applet;
998}; 1002};
999 1003
1000IStorageAccessor::IStorageAccessor(IStorage& storage) 1004IStorageAccessor::IStorageAccessor(Core::System& system_, IStorage& backing_)
1001 : ServiceFramework("IStorageAccessor"), backing(storage) { 1005 : ServiceFramework{system_, "IStorageAccessor"}, backing{backing_} {
1002 // clang-format off 1006 // clang-format off
1003 static const FunctionInfo functions[] = { 1007 static const FunctionInfo functions[] = {
1004 {0, &IStorageAccessor::GetSize, "GetSize"}, 1008 {0, &IStorageAccessor::GetSize, "GetSize"},
@@ -1069,7 +1073,7 @@ void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) {
1069} 1073}
1070 1074
1071ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_) 1075ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_)
1072 : ServiceFramework("ILibraryAppletCreator"), system{system_} { 1076 : ServiceFramework{system_, "ILibraryAppletCreator"} {
1073 static const FunctionInfo functions[] = { 1077 static const FunctionInfo functions[] = {
1074 {0, &ILibraryAppletCreator::CreateLibraryApplet, "CreateLibraryApplet"}, 1078 {0, &ILibraryAppletCreator::CreateLibraryApplet, "CreateLibraryApplet"},
1075 {1, nullptr, "TerminateAllLibraryApplets"}, 1079 {1, nullptr, "TerminateAllLibraryApplets"},
@@ -1105,7 +1109,7 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx)
1105 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 1109 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
1106 1110
1107 rb.Push(RESULT_SUCCESS); 1111 rb.Push(RESULT_SUCCESS);
1108 rb.PushIpcInterface<AM::ILibraryAppletAccessor>(applet); 1112 rb.PushIpcInterface<ILibraryAppletAccessor>(system, applet);
1109} 1113}
1110 1114
1111void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) { 1115void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) {
@@ -1117,7 +1121,7 @@ void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) {
1117 1121
1118 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 1122 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
1119 rb.Push(RESULT_SUCCESS); 1123 rb.Push(RESULT_SUCCESS);
1120 rb.PushIpcInterface<AM::IStorage>(std::move(buffer)); 1124 rb.PushIpcInterface<IStorage>(system, std::move(buffer));
1121} 1125}
1122 1126
1123void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx) { 1127void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx) {
@@ -1144,11 +1148,11 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex
1144 1148
1145 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 1149 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
1146 rb.Push(RESULT_SUCCESS); 1150 rb.Push(RESULT_SUCCESS);
1147 rb.PushIpcInterface<IStorage>(std::move(memory)); 1151 rb.PushIpcInterface<IStorage>(system, std::move(memory));
1148} 1152}
1149 1153
1150IApplicationFunctions::IApplicationFunctions(Core::System& system_) 1154IApplicationFunctions::IApplicationFunctions(Core::System& system_)
1151 : ServiceFramework("IApplicationFunctions"), system{system_} { 1155 : ServiceFramework{system_, "IApplicationFunctions"} {
1152 // clang-format off 1156 // clang-format off
1153 static const FunctionInfo functions[] = { 1157 static const FunctionInfo functions[] = {
1154 {1, &IApplicationFunctions::PopLaunchParameter, "PopLaunchParameter"}, 1158 {1, &IApplicationFunctions::PopLaunchParameter, "PopLaunchParameter"},
@@ -1300,7 +1304,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
1300 if (data.has_value()) { 1304 if (data.has_value()) {
1301 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 1305 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
1302 rb.Push(RESULT_SUCCESS); 1306 rb.Push(RESULT_SUCCESS);
1303 rb.PushIpcInterface<IStorage>(std::move(*data)); 1307 rb.PushIpcInterface<IStorage>(system, std::move(*data));
1304 launch_popped_application_specific = true; 1308 launch_popped_application_specific = true;
1305 return; 1309 return;
1306 } 1310 }
@@ -1323,7 +1327,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
1323 std::vector<u8> buffer(sizeof(LaunchParameterAccountPreselectedUser)); 1327 std::vector<u8> buffer(sizeof(LaunchParameterAccountPreselectedUser));
1324 std::memcpy(buffer.data(), &params, buffer.size()); 1328 std::memcpy(buffer.data(), &params, buffer.size());
1325 1329
1326 rb.PushIpcInterface<IStorage>(std::move(buffer)); 1330 rb.PushIpcInterface<IStorage>(system, std::move(buffer));
1327 launch_popped_account_preselect = true; 1331 launch_popped_account_preselect = true;
1328 return; 1332 return;
1329 } 1333 }
@@ -1621,14 +1625,14 @@ void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger
1621 1625
1622 std::make_shared<AppletAE>(nvflinger, message_queue, system)->InstallAsService(service_manager); 1626 std::make_shared<AppletAE>(nvflinger, message_queue, system)->InstallAsService(service_manager);
1623 std::make_shared<AppletOE>(nvflinger, message_queue, system)->InstallAsService(service_manager); 1627 std::make_shared<AppletOE>(nvflinger, message_queue, system)->InstallAsService(service_manager);
1624 std::make_shared<IdleSys>()->InstallAsService(service_manager); 1628 std::make_shared<IdleSys>(system)->InstallAsService(service_manager);
1625 std::make_shared<OMM>()->InstallAsService(service_manager); 1629 std::make_shared<OMM>(system)->InstallAsService(service_manager);
1626 std::make_shared<SPSM>()->InstallAsService(service_manager); 1630 std::make_shared<SPSM>(system)->InstallAsService(service_manager);
1627 std::make_shared<TCAP>()->InstallAsService(service_manager); 1631 std::make_shared<TCAP>(system)->InstallAsService(service_manager);
1628} 1632}
1629 1633
1630IHomeMenuFunctions::IHomeMenuFunctions(Kernel::KernelCore& kernel) 1634IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_)
1631 : ServiceFramework("IHomeMenuFunctions"), kernel(kernel) { 1635 : ServiceFramework{system_, "IHomeMenuFunctions"} {
1632 // clang-format off 1636 // clang-format off
1633 static const FunctionInfo functions[] = { 1637 static const FunctionInfo functions[] = {
1634 {10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"}, 1638 {10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"},
@@ -1647,7 +1651,7 @@ IHomeMenuFunctions::IHomeMenuFunctions(Kernel::KernelCore& kernel)
1647 RegisterHandlers(functions); 1651 RegisterHandlers(functions);
1648 1652
1649 pop_from_general_channel_event = Kernel::WritableEvent::CreateEventPair( 1653 pop_from_general_channel_event = Kernel::WritableEvent::CreateEventPair(
1650 kernel, "IHomeMenuFunctions:PopFromGeneralChannelEvent"); 1654 system.Kernel(), "IHomeMenuFunctions:PopFromGeneralChannelEvent");
1651} 1655}
1652 1656
1653IHomeMenuFunctions::~IHomeMenuFunctions() = default; 1657IHomeMenuFunctions::~IHomeMenuFunctions() = default;
@@ -1667,7 +1671,8 @@ void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(Kernel::HLERequestContext
1667 rb.PushCopyObjects(pop_from_general_channel_event.readable); 1671 rb.PushCopyObjects(pop_from_general_channel_event.readable);
1668} 1672}
1669 1673
1670IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStateController") { 1674IGlobalStateController::IGlobalStateController(Core::System& system_)
1675 : ServiceFramework{system_, "IGlobalStateController"} {
1671 // clang-format off 1676 // clang-format off
1672 static const FunctionInfo functions[] = { 1677 static const FunctionInfo functions[] = {
1673 {0, nullptr, "RequestToEnterSleep"}, 1678 {0, nullptr, "RequestToEnterSleep"},
@@ -1690,7 +1695,8 @@ IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStat
1690 1695
1691IGlobalStateController::~IGlobalStateController() = default; 1696IGlobalStateController::~IGlobalStateController() = default;
1692 1697
1693IApplicationCreator::IApplicationCreator() : ServiceFramework("IApplicationCreator") { 1698IApplicationCreator::IApplicationCreator(Core::System& system_)
1699 : ServiceFramework{system_, "IApplicationCreator"} {
1694 // clang-format off 1700 // clang-format off
1695 static const FunctionInfo functions[] = { 1701 static const FunctionInfo functions[] = {
1696 {0, nullptr, "CreateApplication"}, 1702 {0, nullptr, "CreateApplication"},
@@ -1705,8 +1711,8 @@ IApplicationCreator::IApplicationCreator() : ServiceFramework("IApplicationCreat
1705 1711
1706IApplicationCreator::~IApplicationCreator() = default; 1712IApplicationCreator::~IApplicationCreator() = default;
1707 1713
1708IProcessWindingController::IProcessWindingController() 1714IProcessWindingController::IProcessWindingController(Core::System& system_)
1709 : ServiceFramework("IProcessWindingController") { 1715 : ServiceFramework{system_, "IProcessWindingController"} {
1710 // clang-format off 1716 // clang-format off
1711 static const FunctionInfo functions[] = { 1717 static const FunctionInfo functions[] = {
1712 {0, nullptr, "GetLaunchReason"}, 1718 {0, nullptr, "GetLaunchReason"},
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index af97c303a..b1da0d081 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -77,13 +77,11 @@ public:
77private: 77private:
78 void GetAppletResourceUserId(Kernel::HLERequestContext& ctx); 78 void GetAppletResourceUserId(Kernel::HLERequestContext& ctx);
79 void AcquireForegroundRights(Kernel::HLERequestContext& ctx); 79 void AcquireForegroundRights(Kernel::HLERequestContext& ctx);
80
81 Core::System& system;
82}; 80};
83 81
84class IAudioController final : public ServiceFramework<IAudioController> { 82class IAudioController final : public ServiceFramework<IAudioController> {
85public: 83public:
86 IAudioController(); 84 explicit IAudioController(Core::System& system_);
87 ~IAudioController() override; 85 ~IAudioController() override;
88 86
89private: 87private:
@@ -109,13 +107,13 @@ private:
109 107
110class IDisplayController final : public ServiceFramework<IDisplayController> { 108class IDisplayController final : public ServiceFramework<IDisplayController> {
111public: 109public:
112 IDisplayController(); 110 explicit IDisplayController(Core::System& system_);
113 ~IDisplayController() override; 111 ~IDisplayController() override;
114}; 112};
115 113
116class IDebugFunctions final : public ServiceFramework<IDebugFunctions> { 114class IDebugFunctions final : public ServiceFramework<IDebugFunctions> {
117public: 115public:
118 IDebugFunctions(); 116 explicit IDebugFunctions(Core::System& system_);
119 ~IDebugFunctions() override; 117 ~IDebugFunctions() override;
120}; 118};
121 119
@@ -154,7 +152,6 @@ private:
154 Disable = 2, 152 Disable = 2,
155 }; 153 };
156 154
157 Core::System& system;
158 NVFlinger::NVFlinger& nvflinger; 155 NVFlinger::NVFlinger& nvflinger;
159 Kernel::EventPair launchable_event; 156 Kernel::EventPair launchable_event;
160 Kernel::EventPair accumulated_suspended_tick_changed_event; 157 Kernel::EventPair accumulated_suspended_tick_changed_event;
@@ -167,8 +164,8 @@ private:
167 164
168class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> { 165class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> {
169public: 166public:
170 explicit ICommonStateGetter(Core::System& system, 167 explicit ICommonStateGetter(Core::System& system_,
171 std::shared_ptr<AppletMessageQueue> msg_queue); 168 std::shared_ptr<AppletMessageQueue> msg_queue_);
172 ~ICommonStateGetter() override; 169 ~ICommonStateGetter() override;
173 170
174private: 171private:
@@ -196,7 +193,6 @@ private:
196 void GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx); 193 void GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx);
197 void SetCpuBoostMode(Kernel::HLERequestContext& ctx); 194 void SetCpuBoostMode(Kernel::HLERequestContext& ctx);
198 195
199 Core::System& system;
200 std::shared_ptr<AppletMessageQueue> msg_queue; 196 std::shared_ptr<AppletMessageQueue> msg_queue;
201 bool vr_mode_state{}; 197 bool vr_mode_state{};
202}; 198};
@@ -211,7 +207,7 @@ public:
211 207
212class IStorage final : public ServiceFramework<IStorage> { 208class IStorage final : public ServiceFramework<IStorage> {
213public: 209public:
214 explicit IStorage(std::vector<u8>&& buffer); 210 explicit IStorage(Core::System& system_, std::vector<u8>&& buffer);
215 ~IStorage() override; 211 ~IStorage() override;
216 212
217 std::vector<u8>& GetData() { 213 std::vector<u8>& GetData() {
@@ -235,7 +231,7 @@ private:
235 231
236class IStorageAccessor final : public ServiceFramework<IStorageAccessor> { 232class IStorageAccessor final : public ServiceFramework<IStorageAccessor> {
237public: 233public:
238 explicit IStorageAccessor(IStorage& backing); 234 explicit IStorageAccessor(Core::System& system_, IStorage& backing_);
239 ~IStorageAccessor() override; 235 ~IStorageAccessor() override;
240 236
241private: 237private:
@@ -255,8 +251,6 @@ private:
255 void CreateLibraryApplet(Kernel::HLERequestContext& ctx); 251 void CreateLibraryApplet(Kernel::HLERequestContext& ctx);
256 void CreateStorage(Kernel::HLERequestContext& ctx); 252 void CreateStorage(Kernel::HLERequestContext& ctx);
257 void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx); 253 void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx);
258
259 Core::System& system;
260}; 254};
261 255
262class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> { 256class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> {
@@ -299,12 +293,11 @@ private:
299 s32 previous_program_index{-1}; 293 s32 previous_program_index{-1};
300 Kernel::EventPair gpu_error_detected_event; 294 Kernel::EventPair gpu_error_detected_event;
301 Kernel::EventPair friend_invitation_storage_channel_event; 295 Kernel::EventPair friend_invitation_storage_channel_event;
302 Core::System& system;
303}; 296};
304 297
305class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> { 298class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> {
306public: 299public:
307 explicit IHomeMenuFunctions(Kernel::KernelCore& kernel); 300 explicit IHomeMenuFunctions(Core::System& system_);
308 ~IHomeMenuFunctions() override; 301 ~IHomeMenuFunctions() override;
309 302
310private: 303private:
@@ -312,24 +305,23 @@ private:
312 void GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx); 305 void GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx);
313 306
314 Kernel::EventPair pop_from_general_channel_event; 307 Kernel::EventPair pop_from_general_channel_event;
315 Kernel::KernelCore& kernel;
316}; 308};
317 309
318class IGlobalStateController final : public ServiceFramework<IGlobalStateController> { 310class IGlobalStateController final : public ServiceFramework<IGlobalStateController> {
319public: 311public:
320 IGlobalStateController(); 312 explicit IGlobalStateController(Core::System& system_);
321 ~IGlobalStateController() override; 313 ~IGlobalStateController() override;
322}; 314};
323 315
324class IApplicationCreator final : public ServiceFramework<IApplicationCreator> { 316class IApplicationCreator final : public ServiceFramework<IApplicationCreator> {
325public: 317public:
326 IApplicationCreator(); 318 explicit IApplicationCreator(Core::System& system_);
327 ~IApplicationCreator() override; 319 ~IApplicationCreator() override;
328}; 320};
329 321
330class IProcessWindingController final : public ServiceFramework<IProcessWindingController> { 322class IProcessWindingController final : public ServiceFramework<IProcessWindingController> {
331public: 323public:
332 IProcessWindingController(); 324 explicit IProcessWindingController(Core::System& system_);
333 ~IProcessWindingController() override; 325 ~IProcessWindingController() override;
334}; 326};
335 327
diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp
index 7de506b70..5421e0da0 100644
--- a/src/core/hle/service/am/applet_ae.cpp
+++ b/src/core/hle/service/am/applet_ae.cpp
@@ -13,11 +13,11 @@ namespace Service::AM {
13 13
14class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> { 14class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> {
15public: 15public:
16 explicit ILibraryAppletProxy(NVFlinger::NVFlinger& nvflinger, 16 explicit ILibraryAppletProxy(NVFlinger::NVFlinger& nvflinger_,
17 std::shared_ptr<AppletMessageQueue> msg_queue, 17 std::shared_ptr<AppletMessageQueue> msg_queue_,
18 Core::System& system) 18 Core::System& system_)
19 : ServiceFramework("ILibraryAppletProxy"), nvflinger(nvflinger), 19 : ServiceFramework{system_, "ILibraryAppletProxy"}, nvflinger{nvflinger_},
20 msg_queue(std::move(msg_queue)), system(system) { 20 msg_queue{std::move(msg_queue_)} {
21 // clang-format off 21 // clang-format off
22 static const FunctionInfo functions[] = { 22 static const FunctionInfo functions[] = {
23 {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, 23 {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
@@ -66,7 +66,7 @@ private:
66 66
67 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 67 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
68 rb.Push(RESULT_SUCCESS); 68 rb.Push(RESULT_SUCCESS);
69 rb.PushIpcInterface<IAudioController>(); 69 rb.PushIpcInterface<IAudioController>(system);
70 } 70 }
71 71
72 void GetDisplayController(Kernel::HLERequestContext& ctx) { 72 void GetDisplayController(Kernel::HLERequestContext& ctx) {
@@ -74,7 +74,7 @@ private:
74 74
75 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 75 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
76 rb.Push(RESULT_SUCCESS); 76 rb.Push(RESULT_SUCCESS);
77 rb.PushIpcInterface<IDisplayController>(); 77 rb.PushIpcInterface<IDisplayController>(system);
78 } 78 }
79 79
80 void GetProcessWindingController(Kernel::HLERequestContext& ctx) { 80 void GetProcessWindingController(Kernel::HLERequestContext& ctx) {
@@ -82,7 +82,7 @@ private:
82 82
83 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 83 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
84 rb.Push(RESULT_SUCCESS); 84 rb.Push(RESULT_SUCCESS);
85 rb.PushIpcInterface<IProcessWindingController>(); 85 rb.PushIpcInterface<IProcessWindingController>(system);
86 } 86 }
87 87
88 void GetDebugFunctions(Kernel::HLERequestContext& ctx) { 88 void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
@@ -90,7 +90,7 @@ private:
90 90
91 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 91 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
92 rb.Push(RESULT_SUCCESS); 92 rb.Push(RESULT_SUCCESS);
93 rb.PushIpcInterface<IDebugFunctions>(); 93 rb.PushIpcInterface<IDebugFunctions>(system);
94 } 94 }
95 95
96 void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { 96 void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
@@ -111,15 +111,15 @@ private:
111 111
112 NVFlinger::NVFlinger& nvflinger; 112 NVFlinger::NVFlinger& nvflinger;
113 std::shared_ptr<AppletMessageQueue> msg_queue; 113 std::shared_ptr<AppletMessageQueue> msg_queue;
114 Core::System& system;
115}; 114};
116 115
117class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> { 116class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> {
118public: 117public:
119 explicit ISystemAppletProxy(NVFlinger::NVFlinger& nvflinger, 118 explicit ISystemAppletProxy(NVFlinger::NVFlinger& nvflinger_,
120 std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system) 119 std::shared_ptr<AppletMessageQueue> msg_queue_,
121 : ServiceFramework("ISystemAppletProxy"), nvflinger(nvflinger), 120 Core::System& system_)
122 msg_queue(std::move(msg_queue)), system(system) { 121 : ServiceFramework{system_, "ISystemAppletProxy"}, nvflinger{nvflinger_},
122 msg_queue{std::move(msg_queue_)} {
123 // clang-format off 123 // clang-format off
124 static const FunctionInfo functions[] = { 124 static const FunctionInfo functions[] = {
125 {0, &ISystemAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, 125 {0, &ISystemAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
@@ -170,7 +170,7 @@ private:
170 170
171 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 171 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
172 rb.Push(RESULT_SUCCESS); 172 rb.Push(RESULT_SUCCESS);
173 rb.PushIpcInterface<IAudioController>(); 173 rb.PushIpcInterface<IAudioController>(system);
174 } 174 }
175 175
176 void GetDisplayController(Kernel::HLERequestContext& ctx) { 176 void GetDisplayController(Kernel::HLERequestContext& ctx) {
@@ -178,7 +178,7 @@ private:
178 178
179 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 179 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
180 rb.Push(RESULT_SUCCESS); 180 rb.Push(RESULT_SUCCESS);
181 rb.PushIpcInterface<IDisplayController>(); 181 rb.PushIpcInterface<IDisplayController>(system);
182 } 182 }
183 183
184 void GetDebugFunctions(Kernel::HLERequestContext& ctx) { 184 void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
@@ -186,7 +186,7 @@ private:
186 186
187 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 187 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
188 rb.Push(RESULT_SUCCESS); 188 rb.Push(RESULT_SUCCESS);
189 rb.PushIpcInterface<IDebugFunctions>(); 189 rb.PushIpcInterface<IDebugFunctions>(system);
190 } 190 }
191 191
192 void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { 192 void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
@@ -202,7 +202,7 @@ private:
202 202
203 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 203 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
204 rb.Push(RESULT_SUCCESS); 204 rb.Push(RESULT_SUCCESS);
205 rb.PushIpcInterface<IHomeMenuFunctions>(system.Kernel()); 205 rb.PushIpcInterface<IHomeMenuFunctions>(system);
206 } 206 }
207 207
208 void GetGlobalStateController(Kernel::HLERequestContext& ctx) { 208 void GetGlobalStateController(Kernel::HLERequestContext& ctx) {
@@ -210,7 +210,7 @@ private:
210 210
211 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 211 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
212 rb.Push(RESULT_SUCCESS); 212 rb.Push(RESULT_SUCCESS);
213 rb.PushIpcInterface<IGlobalStateController>(); 213 rb.PushIpcInterface<IGlobalStateController>(system);
214 } 214 }
215 215
216 void GetApplicationCreator(Kernel::HLERequestContext& ctx) { 216 void GetApplicationCreator(Kernel::HLERequestContext& ctx) {
@@ -218,12 +218,11 @@ private:
218 218
219 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 219 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
220 rb.Push(RESULT_SUCCESS); 220 rb.Push(RESULT_SUCCESS);
221 rb.PushIpcInterface<IApplicationCreator>(); 221 rb.PushIpcInterface<IApplicationCreator>(system);
222 } 222 }
223 223
224 NVFlinger::NVFlinger& nvflinger; 224 NVFlinger::NVFlinger& nvflinger;
225 std::shared_ptr<AppletMessageQueue> msg_queue; 225 std::shared_ptr<AppletMessageQueue> msg_queue;
226 Core::System& system;
227}; 226};
228 227
229void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) { 228void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) {
@@ -250,10 +249,10 @@ void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) {
250 rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system); 249 rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system);
251} 250}
252 251
253AppletAE::AppletAE(NVFlinger::NVFlinger& nvflinger, std::shared_ptr<AppletMessageQueue> msg_queue, 252AppletAE::AppletAE(NVFlinger::NVFlinger& nvflinger_, std::shared_ptr<AppletMessageQueue> msg_queue_,
254 Core::System& system) 253 Core::System& system_)
255 : ServiceFramework("appletAE"), nvflinger(nvflinger), msg_queue(std::move(msg_queue)), 254 : ServiceFramework{system_, "appletAE"}, nvflinger{nvflinger_}, msg_queue{
256 system(system) { 255 std::move(msg_queue_)} {
257 // clang-format off 256 // clang-format off
258 static const FunctionInfo functions[] = { 257 static const FunctionInfo functions[] = {
259 {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 761844a1f..adb207349 100644
--- a/src/core/hle/service/am/applet_ae.h
+++ b/src/core/hle/service/am/applet_ae.h
@@ -23,8 +23,8 @@ class AppletMessageQueue;
23 23
24class AppletAE final : public ServiceFramework<AppletAE> { 24class AppletAE final : public ServiceFramework<AppletAE> {
25public: 25public:
26 explicit AppletAE(NVFlinger::NVFlinger& nvflinger, 26 explicit AppletAE(NVFlinger::NVFlinger& nvflinger_,
27 std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system); 27 std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_);
28 ~AppletAE() override; 28 ~AppletAE() override;
29 29
30 const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const; 30 const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const;
@@ -36,7 +36,6 @@ private:
36 36
37 NVFlinger::NVFlinger& nvflinger; 37 NVFlinger::NVFlinger& nvflinger;
38 std::shared_ptr<AppletMessageQueue> msg_queue; 38 std::shared_ptr<AppletMessageQueue> msg_queue;
39 Core::System& system;
40}; 39};
41 40
42} // namespace AM 41} // namespace AM
diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp
index 7bed86ec4..f9eba8f52 100644
--- a/src/core/hle/service/am/applet_oe.cpp
+++ b/src/core/hle/service/am/applet_oe.cpp
@@ -12,10 +12,11 @@ namespace Service::AM {
12 12
13class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { 13class IApplicationProxy final : public ServiceFramework<IApplicationProxy> {
14public: 14public:
15 explicit IApplicationProxy(NVFlinger::NVFlinger& nvflinger, 15 explicit IApplicationProxy(NVFlinger::NVFlinger& nvflinger_,
16 std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system) 16 std::shared_ptr<AppletMessageQueue> msg_queue_,
17 : ServiceFramework("IApplicationProxy"), nvflinger(nvflinger), 17 Core::System& system_)
18 msg_queue(std::move(msg_queue)), system(system) { 18 : ServiceFramework{system_, "IApplicationProxy"}, nvflinger{nvflinger_},
19 msg_queue{std::move(msg_queue_)} {
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"},
@@ -39,7 +40,7 @@ private:
39 40
40 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 41 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
41 rb.Push(RESULT_SUCCESS); 42 rb.Push(RESULT_SUCCESS);
42 rb.PushIpcInterface<IAudioController>(); 43 rb.PushIpcInterface<IAudioController>(system);
43 } 44 }
44 45
45 void GetDisplayController(Kernel::HLERequestContext& ctx) { 46 void GetDisplayController(Kernel::HLERequestContext& ctx) {
@@ -47,7 +48,7 @@ private:
47 48
48 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 49 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
49 rb.Push(RESULT_SUCCESS); 50 rb.Push(RESULT_SUCCESS);
50 rb.PushIpcInterface<IDisplayController>(); 51 rb.PushIpcInterface<IDisplayController>(system);
51 } 52 }
52 53
53 void GetDebugFunctions(Kernel::HLERequestContext& ctx) { 54 void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
@@ -55,7 +56,7 @@ private:
55 56
56 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 57 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
57 rb.Push(RESULT_SUCCESS); 58 rb.Push(RESULT_SUCCESS);
58 rb.PushIpcInterface<IDebugFunctions>(); 59 rb.PushIpcInterface<IDebugFunctions>(system);
59 } 60 }
60 61
61 void GetWindowController(Kernel::HLERequestContext& ctx) { 62 void GetWindowController(Kernel::HLERequestContext& ctx) {
@@ -100,7 +101,6 @@ private:
100 101
101 NVFlinger::NVFlinger& nvflinger; 102 NVFlinger::NVFlinger& nvflinger;
102 std::shared_ptr<AppletMessageQueue> msg_queue; 103 std::shared_ptr<AppletMessageQueue> msg_queue;
103 Core::System& system;
104}; 104};
105 105
106void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) { 106void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) {
@@ -111,10 +111,10 @@ void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) {
111 rb.PushIpcInterface<IApplicationProxy>(nvflinger, msg_queue, system); 111 rb.PushIpcInterface<IApplicationProxy>(nvflinger, msg_queue, system);
112} 112}
113 113
114AppletOE::AppletOE(NVFlinger::NVFlinger& nvflinger, std::shared_ptr<AppletMessageQueue> msg_queue, 114AppletOE::AppletOE(NVFlinger::NVFlinger& nvflinger_, std::shared_ptr<AppletMessageQueue> msg_queue_,
115 Core::System& system) 115 Core::System& system_)
116 : ServiceFramework("appletOE"), nvflinger(nvflinger), msg_queue(std::move(msg_queue)), 116 : ServiceFramework{system_, "appletOE"}, nvflinger{nvflinger_}, msg_queue{
117 system(system) { 117 std::move(msg_queue_)} {
118 static const FunctionInfo functions[] = { 118 static const FunctionInfo functions[] = {
119 {0, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"}, 119 {0, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"},
120 }; 120 };
diff --git a/src/core/hle/service/am/applet_oe.h b/src/core/hle/service/am/applet_oe.h
index 88906d354..6c1aa255a 100644
--- a/src/core/hle/service/am/applet_oe.h
+++ b/src/core/hle/service/am/applet_oe.h
@@ -23,8 +23,8 @@ class AppletMessageQueue;
23 23
24class AppletOE final : public ServiceFramework<AppletOE> { 24class AppletOE final : public ServiceFramework<AppletOE> {
25public: 25public:
26 explicit AppletOE(NVFlinger::NVFlinger& nvflinger, 26 explicit AppletOE(NVFlinger::NVFlinger& nvflinger_,
27 std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system); 27 std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_);
28 ~AppletOE() override; 28 ~AppletOE() override;
29 29
30 const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const; 30 const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const;
@@ -34,7 +34,6 @@ private:
34 34
35 NVFlinger::NVFlinger& nvflinger; 35 NVFlinger::NVFlinger& nvflinger;
36 std::shared_ptr<AppletMessageQueue> msg_queue; 36 std::shared_ptr<AppletMessageQueue> msg_queue;
37 Core::System& system;
38}; 37};
39 38
40} // namespace AM 39} // namespace AM
diff --git a/src/core/hle/service/am/applets/controller.cpp b/src/core/hle/service/am/applets/controller.cpp
index 3ca63f020..e8ea4248b 100644
--- a/src/core/hle/service/am/applets/controller.cpp
+++ b/src/core/hle/service/am/applets/controller.cpp
@@ -46,7 +46,7 @@ static Core::Frontend::ControllerParameters ConvertToFrontendParameters(
46} 46}
47 47
48Controller::Controller(Core::System& system_, const Core::Frontend::ControllerApplet& frontend_) 48Controller::Controller(Core::System& system_, const Core::Frontend::ControllerApplet& frontend_)
49 : Applet{system_.Kernel()}, frontend(frontend_) {} 49 : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
50 50
51Controller::~Controller() = default; 51Controller::~Controller() = default;
52 52
@@ -245,7 +245,7 @@ void Controller::ConfigurationComplete() {
245 complete = true; 245 complete = true;
246 out_data = std::vector<u8>(sizeof(ControllerSupportResultInfo)); 246 out_data = std::vector<u8>(sizeof(ControllerSupportResultInfo));
247 std::memcpy(out_data.data(), &result_info, out_data.size()); 247 std::memcpy(out_data.data(), &result_info, out_data.size());
248 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(out_data))); 248 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(out_data)));
249 broker.SignalStateChanged(); 249 broker.SignalStateChanged();
250} 250}
251 251
diff --git a/src/core/hle/service/am/applets/controller.h b/src/core/hle/service/am/applets/controller.h
index a7a1f2b65..d4c9da7b1 100644
--- a/src/core/hle/service/am/applets/controller.h
+++ b/src/core/hle/service/am/applets/controller.h
@@ -120,6 +120,7 @@ public:
120 120
121private: 121private:
122 const Core::Frontend::ControllerApplet& frontend; 122 const Core::Frontend::ControllerApplet& frontend;
123 Core::System& system;
123 124
124 ControllerAppletVersion controller_applet_version; 125 ControllerAppletVersion controller_applet_version;
125 ControllerSupportArgPrivate controller_private_arg; 126 ControllerSupportArgPrivate controller_private_arg;
diff --git a/src/core/hle/service/am/applets/error.cpp b/src/core/hle/service/am/applets/error.cpp
index f12fd7f89..dcd4b2a35 100644
--- a/src/core/hle/service/am/applets/error.cpp
+++ b/src/core/hle/service/am/applets/error.cpp
@@ -87,7 +87,7 @@ ResultCode Decode64BitError(u64 error) {
87} // Anonymous namespace 87} // Anonymous namespace
88 88
89Error::Error(Core::System& system_, const Core::Frontend::ErrorApplet& frontend_) 89Error::Error(Core::System& system_, const Core::Frontend::ErrorApplet& frontend_)
90 : Applet{system_.Kernel()}, frontend(frontend_), system{system_} {} 90 : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
91 91
92Error::~Error() = default; 92Error::~Error() = default;
93 93
@@ -186,7 +186,7 @@ void Error::Execute() {
186 186
187void Error::DisplayCompleted() { 187void Error::DisplayCompleted() {
188 complete = true; 188 complete = true;
189 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::vector<u8>{})); 189 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::vector<u8>{}));
190 broker.SignalStateChanged(); 190 broker.SignalStateChanged();
191} 191}
192 192
diff --git a/src/core/hle/service/am/applets/general_backend.cpp b/src/core/hle/service/am/applets/general_backend.cpp
index 104501ac5..bdb6fd464 100644
--- a/src/core/hle/service/am/applets/general_backend.cpp
+++ b/src/core/hle/service/am/applets/general_backend.cpp
@@ -38,7 +38,7 @@ static void LogCurrentStorage(AppletDataBroker& broker, std::string_view prefix)
38} 38}
39 39
40Auth::Auth(Core::System& system_, Core::Frontend::ParentalControlsApplet& frontend_) 40Auth::Auth(Core::System& system_, Core::Frontend::ParentalControlsApplet& frontend_)
41 : Applet{system_.Kernel()}, frontend(frontend_) {} 41 : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
42 42
43Auth::~Auth() = default; 43Auth::~Auth() = default;
44 44
@@ -135,8 +135,8 @@ void Auth::Execute() {
135 } 135 }
136} 136}
137 137
138void Auth::AuthFinished(bool successful) { 138void Auth::AuthFinished(bool is_successful) {
139 this->successful = successful; 139 this->successful = is_successful;
140 140
141 struct Return { 141 struct Return {
142 ResultCode result_code; 142 ResultCode result_code;
@@ -148,12 +148,12 @@ void Auth::AuthFinished(bool successful) {
148 std::vector<u8> out(sizeof(Return)); 148 std::vector<u8> out(sizeof(Return));
149 std::memcpy(out.data(), &return_, sizeof(Return)); 149 std::memcpy(out.data(), &return_, sizeof(Return));
150 150
151 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(out))); 151 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(out)));
152 broker.SignalStateChanged(); 152 broker.SignalStateChanged();
153} 153}
154 154
155PhotoViewer::PhotoViewer(Core::System& system_, const Core::Frontend::PhotoViewerApplet& frontend_) 155PhotoViewer::PhotoViewer(Core::System& system_, const Core::Frontend::PhotoViewerApplet& frontend_)
156 : Applet{system_.Kernel()}, frontend(frontend_), system{system_} {} 156 : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
157 157
158PhotoViewer::~PhotoViewer() = default; 158PhotoViewer::~PhotoViewer() = default;
159 159
@@ -198,12 +198,12 @@ void PhotoViewer::Execute() {
198} 198}
199 199
200void PhotoViewer::ViewFinished() { 200void PhotoViewer::ViewFinished() {
201 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::vector<u8>{})); 201 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::vector<u8>{}));
202 broker.SignalStateChanged(); 202 broker.SignalStateChanged();
203} 203}
204 204
205StubApplet::StubApplet(Core::System& system_, AppletId id_) 205StubApplet::StubApplet(Core::System& system_, AppletId id_)
206 : Applet{system_.Kernel()}, id(id_), system{system_} {} 206 : Applet{system_.Kernel()}, id{id_}, system{system_} {}
207 207
208StubApplet::~StubApplet() = default; 208StubApplet::~StubApplet() = default;
209 209
@@ -234,8 +234,9 @@ void StubApplet::ExecuteInteractive() {
234 LOG_WARNING(Service_AM, "called (STUBBED)"); 234 LOG_WARNING(Service_AM, "called (STUBBED)");
235 LogCurrentStorage(broker, "ExecuteInteractive"); 235 LogCurrentStorage(broker, "ExecuteInteractive");
236 236
237 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::vector<u8>(0x1000))); 237 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::vector<u8>(0x1000)));
238 broker.PushInteractiveDataFromApplet(std::make_shared<IStorage>(std::vector<u8>(0x1000))); 238 broker.PushInteractiveDataFromApplet(
239 std::make_shared<IStorage>(system, std::vector<u8>(0x1000)));
239 broker.SignalStateChanged(); 240 broker.SignalStateChanged();
240} 241}
241 242
@@ -243,8 +244,9 @@ void StubApplet::Execute() {
243 LOG_WARNING(Service_AM, "called (STUBBED)"); 244 LOG_WARNING(Service_AM, "called (STUBBED)");
244 LogCurrentStorage(broker, "Execute"); 245 LogCurrentStorage(broker, "Execute");
245 246
246 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::vector<u8>(0x1000))); 247 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::vector<u8>(0x1000)));
247 broker.PushInteractiveDataFromApplet(std::make_shared<IStorage>(std::vector<u8>(0x1000))); 248 broker.PushInteractiveDataFromApplet(
249 std::make_shared<IStorage>(system, std::vector<u8>(0x1000)));
248 broker.SignalStateChanged(); 250 broker.SignalStateChanged();
249} 251}
250 252
diff --git a/src/core/hle/service/am/applets/general_backend.h b/src/core/hle/service/am/applets/general_backend.h
index cfa2df369..ba76ae3d3 100644
--- a/src/core/hle/service/am/applets/general_backend.h
+++ b/src/core/hle/service/am/applets/general_backend.h
@@ -29,10 +29,11 @@ public:
29 void ExecuteInteractive() override; 29 void ExecuteInteractive() override;
30 void Execute() override; 30 void Execute() override;
31 31
32 void AuthFinished(bool successful = true); 32 void AuthFinished(bool is_successful = true);
33 33
34private: 34private:
35 Core::Frontend::ParentalControlsApplet& frontend; 35 Core::Frontend::ParentalControlsApplet& frontend;
36 Core::System& system;
36 bool complete = false; 37 bool complete = false;
37 bool successful = false; 38 bool successful = false;
38 39
diff --git a/src/core/hle/service/am/applets/profile_select.cpp b/src/core/hle/service/am/applets/profile_select.cpp
index 70cc23552..77fba16c7 100644
--- a/src/core/hle/service/am/applets/profile_select.cpp
+++ b/src/core/hle/service/am/applets/profile_select.cpp
@@ -17,7 +17,7 @@ constexpr ResultCode ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1};
17 17
18ProfileSelect::ProfileSelect(Core::System& system_, 18ProfileSelect::ProfileSelect(Core::System& system_,
19 const Core::Frontend::ProfileSelectApplet& frontend_) 19 const Core::Frontend::ProfileSelectApplet& frontend_)
20 : Applet{system_.Kernel()}, frontend(frontend_) {} 20 : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
21 21
22ProfileSelect::~ProfileSelect() = default; 22ProfileSelect::~ProfileSelect() = default;
23 23
@@ -50,7 +50,7 @@ void ProfileSelect::ExecuteInteractive() {
50 50
51void ProfileSelect::Execute() { 51void ProfileSelect::Execute() {
52 if (complete) { 52 if (complete) {
53 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(final_data))); 53 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(final_data)));
54 return; 54 return;
55 } 55 }
56 56
@@ -71,7 +71,7 @@ void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) {
71 71
72 final_data = std::vector<u8>(sizeof(UserSelectionOutput)); 72 final_data = std::vector<u8>(sizeof(UserSelectionOutput));
73 std::memcpy(final_data.data(), &output, final_data.size()); 73 std::memcpy(final_data.data(), &output, final_data.size());
74 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(final_data))); 74 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(final_data)));
75 broker.SignalStateChanged(); 75 broker.SignalStateChanged();
76} 76}
77 77
diff --git a/src/core/hle/service/am/applets/profile_select.h b/src/core/hle/service/am/applets/profile_select.h
index 16364ead7..648d33a24 100644
--- a/src/core/hle/service/am/applets/profile_select.h
+++ b/src/core/hle/service/am/applets/profile_select.h
@@ -53,6 +53,7 @@ private:
53 bool complete = false; 53 bool complete = false;
54 ResultCode status = RESULT_SUCCESS; 54 ResultCode status = RESULT_SUCCESS;
55 std::vector<u8> final_data; 55 std::vector<u8> final_data;
56 Core::System& system;
56}; 57};
57 58
58} // namespace Service::AM::Applets 59} // namespace Service::AM::Applets
diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/software_keyboard.cpp
index bdeb0737a..3022438b1 100644
--- a/src/core/hle/service/am/applets/software_keyboard.cpp
+++ b/src/core/hle/service/am/applets/software_keyboard.cpp
@@ -53,7 +53,7 @@ static Core::Frontend::SoftwareKeyboardParameters ConvertToFrontendParameters(
53 53
54SoftwareKeyboard::SoftwareKeyboard(Core::System& system_, 54SoftwareKeyboard::SoftwareKeyboard(Core::System& system_,
55 const Core::Frontend::SoftwareKeyboardApplet& frontend_) 55 const Core::Frontend::SoftwareKeyboardApplet& frontend_)
56 : Applet{system_.Kernel()}, frontend(frontend_) {} 56 : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
57 57
58SoftwareKeyboard::~SoftwareKeyboard() = default; 58SoftwareKeyboard::~SoftwareKeyboard() = default;
59 59
@@ -122,7 +122,7 @@ void SoftwareKeyboard::ExecuteInteractive() {
122 122
123 switch (request) { 123 switch (request) {
124 case Request::Calc: { 124 case Request::Calc: {
125 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::vector<u8>{1})); 125 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::vector<u8>{1}));
126 broker.SignalStateChanged(); 126 broker.SignalStateChanged();
127 break; 127 break;
128 } 128 }
@@ -135,7 +135,7 @@ void SoftwareKeyboard::ExecuteInteractive() {
135 135
136void SoftwareKeyboard::Execute() { 136void SoftwareKeyboard::Execute() {
137 if (complete) { 137 if (complete) {
138 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(final_data))); 138 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(final_data)));
139 broker.SignalStateChanged(); 139 broker.SignalStateChanged();
140 return; 140 return;
141 } 141 }
@@ -179,15 +179,17 @@ void SoftwareKeyboard::WriteText(std::optional<std::u16string> text) {
179 final_data = output_main; 179 final_data = output_main;
180 180
181 if (complete) { 181 if (complete) {
182 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(output_main))); 182 broker.PushNormalDataFromApplet(
183 std::make_shared<IStorage>(system, std::move(output_main)));
183 broker.SignalStateChanged(); 184 broker.SignalStateChanged();
184 } else { 185 } else {
185 broker.PushInteractiveDataFromApplet(std::make_shared<IStorage>(std::move(output_sub))); 186 broker.PushInteractiveDataFromApplet(
187 std::make_shared<IStorage>(system, std::move(output_sub)));
186 } 188 }
187 } else { 189 } else {
188 output_main[0] = 1; 190 output_main[0] = 1;
189 complete = true; 191 complete = true;
190 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(output_main))); 192 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(output_main)));
191 broker.SignalStateChanged(); 193 broker.SignalStateChanged();
192 } 194 }
193} 195}
diff --git a/src/core/hle/service/am/applets/software_keyboard.h b/src/core/hle/service/am/applets/software_keyboard.h
index 5a3824b5a..1d260fef8 100644
--- a/src/core/hle/service/am/applets/software_keyboard.h
+++ b/src/core/hle/service/am/applets/software_keyboard.h
@@ -80,6 +80,7 @@ private:
80 bool complete = false; 80 bool complete = false;
81 bool is_inline = false; 81 bool is_inline = false;
82 std::vector<u8> final_data; 82 std::vector<u8> final_data;
83 Core::System& system;
83}; 84};
84 85
85} // namespace Service::AM::Applets 86} // namespace Service::AM::Applets
diff --git a/src/core/hle/service/am/applets/web_browser.cpp b/src/core/hle/service/am/applets/web_browser.cpp
index efe595c4f..c3b6b706a 100644
--- a/src/core/hle/service/am/applets/web_browser.cpp
+++ b/src/core/hle/service/am/applets/web_browser.cpp
@@ -290,7 +290,7 @@ void WebBrowser::Finalize() {
290 std::vector<u8> data(sizeof(WebCommonReturnValue)); 290 std::vector<u8> data(sizeof(WebCommonReturnValue));
291 std::memcpy(data.data(), &out, sizeof(WebCommonReturnValue)); 291 std::memcpy(data.data(), &out, sizeof(WebCommonReturnValue));
292 292
293 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(data))); 293 broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(data)));
294 broker.SignalStateChanged(); 294 broker.SignalStateChanged();
295 295
296 if (!temporary_dir.empty() && Common::FS::IsDirectory(temporary_dir)) { 296 if (!temporary_dir.empty() && Common::FS::IsDirectory(temporary_dir)) {
diff --git a/src/core/hle/service/am/idle.cpp b/src/core/hle/service/am/idle.cpp
index d256d57c8..6196773d5 100644
--- a/src/core/hle/service/am/idle.cpp
+++ b/src/core/hle/service/am/idle.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::AM { 7namespace Service::AM {
8 8
9IdleSys::IdleSys() : ServiceFramework{"idle:sys"} { 9IdleSys::IdleSys(Core::System& system_) : ServiceFramework{system_, "idle:sys"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, nullptr, "GetAutoPowerDownEvent"}, 12 {0, nullptr, "GetAutoPowerDownEvent"},
diff --git a/src/core/hle/service/am/idle.h b/src/core/hle/service/am/idle.h
index c44e856b1..e290c30b1 100644
--- a/src/core/hle/service/am/idle.h
+++ b/src/core/hle/service/am/idle.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::AM { 13namespace Service::AM {
10 14
11class IdleSys final : public ServiceFramework<IdleSys> { 15class IdleSys final : public ServiceFramework<IdleSys> {
12public: 16public:
13 explicit IdleSys(); 17 explicit IdleSys(Core::System& system_);
14 ~IdleSys() override; 18 ~IdleSys() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/am/omm.cpp b/src/core/hle/service/am/omm.cpp
index 37389ccda..55de67e1d 100644
--- a/src/core/hle/service/am/omm.cpp
+++ b/src/core/hle/service/am/omm.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::AM { 7namespace Service::AM {
8 8
9OMM::OMM() : ServiceFramework{"omm"} { 9OMM::OMM(Core::System& system_) : ServiceFramework{system_, "omm"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, nullptr, "GetOperationMode"}, 12 {0, nullptr, "GetOperationMode"},
diff --git a/src/core/hle/service/am/omm.h b/src/core/hle/service/am/omm.h
index 59dc91b72..3766150fe 100644
--- a/src/core/hle/service/am/omm.h
+++ b/src/core/hle/service/am/omm.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::AM { 13namespace Service::AM {
10 14
11class OMM final : public ServiceFramework<OMM> { 15class OMM final : public ServiceFramework<OMM> {
12public: 16public:
13 explicit OMM(); 17 explicit OMM(Core::System& system_);
14 ~OMM() override; 18 ~OMM() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/am/spsm.cpp b/src/core/hle/service/am/spsm.cpp
index f27729ce7..95218d9ee 100644
--- a/src/core/hle/service/am/spsm.cpp
+++ b/src/core/hle/service/am/spsm.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::AM { 7namespace Service::AM {
8 8
9SPSM::SPSM() : ServiceFramework{"spsm"} { 9SPSM::SPSM(Core::System& system_) : ServiceFramework{system_, "spsm"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, nullptr, "GetState"}, 12 {0, nullptr, "GetState"},
diff --git a/src/core/hle/service/am/spsm.h b/src/core/hle/service/am/spsm.h
index 3a0b979fa..04bbf9e68 100644
--- a/src/core/hle/service/am/spsm.h
+++ b/src/core/hle/service/am/spsm.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::AM { 13namespace Service::AM {
10 14
11class SPSM final : public ServiceFramework<SPSM> { 15class SPSM final : public ServiceFramework<SPSM> {
12public: 16public:
13 explicit SPSM(); 17 explicit SPSM(Core::System& system_);
14 ~SPSM() override; 18 ~SPSM() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/am/tcap.cpp b/src/core/hle/service/am/tcap.cpp
index a75cbdda8..4d0971c03 100644
--- a/src/core/hle/service/am/tcap.cpp
+++ b/src/core/hle/service/am/tcap.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::AM { 7namespace Service::AM {
8 8
9TCAP::TCAP() : ServiceFramework{"tcap"} { 9TCAP::TCAP(Core::System& system_) : ServiceFramework{system_, "tcap"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, nullptr, "GetContinuousHighSkinTemperatureEvent"}, 12 {0, nullptr, "GetContinuousHighSkinTemperatureEvent"},
diff --git a/src/core/hle/service/am/tcap.h b/src/core/hle/service/am/tcap.h
index 2021b55d1..e9578f16e 100644
--- a/src/core/hle/service/am/tcap.h
+++ b/src/core/hle/service/am/tcap.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::AM { 13namespace Service::AM {
10 14
11class TCAP final : public ServiceFramework<TCAP> { 15class TCAP final : public ServiceFramework<TCAP> {
12public: 16public:
13 explicit TCAP(); 17 explicit TCAP(Core::System& system_);
14 ~TCAP() override; 18 ~TCAP() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp
index 173b36da4..6abac3f78 100644
--- a/src/core/hle/service/aoc/aoc_u.cpp
+++ b/src/core/hle/service/aoc/aoc_u.cpp
@@ -48,8 +48,8 @@ static std::vector<u64> AccumulateAOCTitleIDs(Core::System& system) {
48 return add_on_content; 48 return add_on_content;
49} 49}
50 50
51AOC_U::AOC_U(Core::System& system) 51AOC_U::AOC_U(Core::System& system_)
52 : ServiceFramework("aoc:u"), add_on_content(AccumulateAOCTitleIDs(system)), system(system) { 52 : ServiceFramework{system_, "aoc:u"}, add_on_content{AccumulateAOCTitleIDs(system)} {
53 // clang-format off 53 // clang-format off
54 static const FunctionInfo functions[] = { 54 static const FunctionInfo functions[] = {
55 {0, nullptr, "CountAddOnContentByApplicationId"}, 55 {0, nullptr, "CountAddOnContentByApplicationId"},
diff --git a/src/core/hle/service/aoc/aoc_u.h b/src/core/hle/service/aoc/aoc_u.h
index 848b2f416..7628f4568 100644
--- a/src/core/hle/service/aoc/aoc_u.h
+++ b/src/core/hle/service/aoc/aoc_u.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Kernel { 13namespace Kernel {
10class WritableEvent; 14class WritableEvent;
11} 15}
@@ -26,7 +30,6 @@ private:
26 30
27 std::vector<u64> add_on_content; 31 std::vector<u64> add_on_content;
28 Kernel::EventPair aoc_change_event; 32 Kernel::EventPair aoc_change_event;
29 Core::System& system;
30}; 33};
31 34
32/// Registers all AOC services with the specified service manager. 35/// Registers all AOC services with the specified service manager.
diff --git a/src/core/hle/service/apm/apm.cpp b/src/core/hle/service/apm/apm.cpp
index e2d8f0027..97d6619dd 100644
--- a/src/core/hle/service/apm/apm.cpp
+++ b/src/core/hle/service/apm/apm.cpp
@@ -14,13 +14,14 @@ Module::~Module() = default;
14 14
15void InstallInterfaces(Core::System& system) { 15void InstallInterfaces(Core::System& system) {
16 auto module_ = std::make_shared<Module>(); 16 auto module_ = std::make_shared<Module>();
17 std::make_shared<APM>(module_, system.GetAPMController(), "apm") 17 std::make_shared<APM>(system, module_, system.GetAPMController(), "apm")
18 ->InstallAsService(system.ServiceManager()); 18 ->InstallAsService(system.ServiceManager());
19 std::make_shared<APM>(module_, system.GetAPMController(), "apm:p") 19 std::make_shared<APM>(system, module_, system.GetAPMController(), "apm:p")
20 ->InstallAsService(system.ServiceManager()); 20 ->InstallAsService(system.ServiceManager());
21 std::make_shared<APM>(module_, system.GetAPMController(), "apm:am") 21 std::make_shared<APM>(system, module_, system.GetAPMController(), "apm:am")
22 ->InstallAsService(system.ServiceManager());
23 std::make_shared<APM_Sys>(system, system.GetAPMController())
22 ->InstallAsService(system.ServiceManager()); 24 ->InstallAsService(system.ServiceManager());
23 std::make_shared<APM_Sys>(system.GetAPMController())->InstallAsService(system.ServiceManager());
24} 25}
25 26
26} // namespace Service::APM 27} // namespace Service::APM
diff --git a/src/core/hle/service/apm/apm.h b/src/core/hle/service/apm/apm.h
index cf4c2bb11..691fe6c16 100644
--- a/src/core/hle/service/apm/apm.h
+++ b/src/core/hle/service/apm/apm.h
@@ -4,7 +4,9 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "core/hle/service/service.h" 7namespace Core {
8class System;
9}
8 10
9namespace Service::APM { 11namespace Service::APM {
10 12
diff --git a/src/core/hle/service/apm/interface.cpp b/src/core/hle/service/apm/interface.cpp
index 06f0f8edd..89442e21e 100644
--- a/src/core/hle/service/apm/interface.cpp
+++ b/src/core/hle/service/apm/interface.cpp
@@ -12,7 +12,8 @@ namespace Service::APM {
12 12
13class ISession final : public ServiceFramework<ISession> { 13class ISession final : public ServiceFramework<ISession> {
14public: 14public:
15 ISession(Controller& controller) : ServiceFramework("ISession"), controller(controller) { 15 explicit ISession(Core::System& system_, Controller& controller_)
16 : ServiceFramework{system_, "ISession"}, controller{controller_} {
16 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
17 {0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"}, 18 {0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"},
18 {1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"}, 19 {1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"},
@@ -50,8 +51,9 @@ private:
50 Controller& controller; 51 Controller& controller;
51}; 52};
52 53
53APM::APM(std::shared_ptr<Module> apm, Controller& controller, const char* name) 54APM::APM(Core::System& system_, std::shared_ptr<Module> apm_, Controller& controller_,
54 : ServiceFramework(name), apm(std::move(apm)), controller(controller) { 55 const char* name)
56 : ServiceFramework{system_, name}, apm(std::move(apm_)), controller{controller_} {
55 static const FunctionInfo functions[] = { 57 static const FunctionInfo functions[] = {
56 {0, &APM::OpenSession, "OpenSession"}, 58 {0, &APM::OpenSession, "OpenSession"},
57 {1, &APM::GetPerformanceMode, "GetPerformanceMode"}, 59 {1, &APM::GetPerformanceMode, "GetPerformanceMode"},
@@ -67,7 +69,7 @@ void APM::OpenSession(Kernel::HLERequestContext& ctx) {
67 69
68 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 70 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
69 rb.Push(RESULT_SUCCESS); 71 rb.Push(RESULT_SUCCESS);
70 rb.PushIpcInterface<ISession>(controller); 72 rb.PushIpcInterface<ISession>(system, controller);
71} 73}
72 74
73void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) { 75void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
@@ -77,7 +79,8 @@ void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
77 rb.PushEnum(controller.GetCurrentPerformanceMode()); 79 rb.PushEnum(controller.GetCurrentPerformanceMode());
78} 80}
79 81
80APM_Sys::APM_Sys(Controller& controller) : ServiceFramework{"apm:sys"}, controller(controller) { 82APM_Sys::APM_Sys(Core::System& system_, Controller& controller_)
83 : ServiceFramework{system_, "apm:sys"}, controller{controller_} {
81 // clang-format off 84 // clang-format off
82 static const FunctionInfo functions[] = { 85 static const FunctionInfo functions[] = {
83 {0, nullptr, "RequestPerformanceMode"}, 86 {0, nullptr, "RequestPerformanceMode"},
@@ -101,7 +104,7 @@ void APM_Sys::GetPerformanceEvent(Kernel::HLERequestContext& ctx) {
101 104
102 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 105 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
103 rb.Push(RESULT_SUCCESS); 106 rb.Push(RESULT_SUCCESS);
104 rb.PushIpcInterface<ISession>(controller); 107 rb.PushIpcInterface<ISession>(system, controller);
105} 108}
106 109
107void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) { 110void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) {
diff --git a/src/core/hle/service/apm/interface.h b/src/core/hle/service/apm/interface.h
index de1b89437..7d57c4978 100644
--- a/src/core/hle/service/apm/interface.h
+++ b/src/core/hle/service/apm/interface.h
@@ -13,7 +13,8 @@ class Module;
13 13
14class APM final : public ServiceFramework<APM> { 14class APM final : public ServiceFramework<APM> {
15public: 15public:
16 explicit APM(std::shared_ptr<Module> apm, Controller& controller, const char* name); 16 explicit APM(Core::System& system_, std::shared_ptr<Module> apm_, Controller& controller_,
17 const char* name);
17 ~APM() override; 18 ~APM() override;
18 19
19private: 20private:
@@ -26,7 +27,7 @@ private:
26 27
27class APM_Sys final : public ServiceFramework<APM_Sys> { 28class APM_Sys final : public ServiceFramework<APM_Sys> {
28public: 29public:
29 explicit APM_Sys(Controller& controller); 30 explicit APM_Sys(Core::System& system_, Controller& controller);
30 ~APM_Sys() override; 31 ~APM_Sys() override;
31 32
32 void SetCpuBoostMode(Kernel::HLERequestContext& ctx); 33 void SetCpuBoostMode(Kernel::HLERequestContext& ctx);
diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp
index 6ddb547fb..84890be72 100644
--- a/src/core/hle/service/audio/audctl.cpp
+++ b/src/core/hle/service/audio/audctl.cpp
@@ -8,7 +8,7 @@
8 8
9namespace Service::Audio { 9namespace Service::Audio {
10 10
11AudCtl::AudCtl() : ServiceFramework{"audctl"} { 11AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} {
12 // clang-format off 12 // clang-format off
13 static const FunctionInfo functions[] = { 13 static const FunctionInfo functions[] = {
14 {0, nullptr, "GetTargetVolume"}, 14 {0, nullptr, "GetTargetVolume"},
diff --git a/src/core/hle/service/audio/audctl.h b/src/core/hle/service/audio/audctl.h
index c7fafc02e..15f6c77a0 100644
--- a/src/core/hle/service/audio/audctl.h
+++ b/src/core/hle/service/audio/audctl.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Audio { 13namespace Service::Audio {
10 14
11class AudCtl final : public ServiceFramework<AudCtl> { 15class AudCtl final : public ServiceFramework<AudCtl> {
12public: 16public:
13 explicit AudCtl(); 17 explicit AudCtl(Core::System& system_);
14 ~AudCtl() override; 18 ~AudCtl() override;
15 19
16private: 20private:
diff --git a/src/core/hle/service/audio/auddbg.cpp b/src/core/hle/service/audio/auddbg.cpp
index 8fff3e4b4..6264e4bda 100644
--- a/src/core/hle/service/audio/auddbg.cpp
+++ b/src/core/hle/service/audio/auddbg.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::Audio { 7namespace Service::Audio {
8 8
9AudDbg::AudDbg(const char* name) : ServiceFramework{name} { 9AudDbg::AudDbg(Core::System& system_, const char* name) : ServiceFramework{system_, name} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, nullptr, "RequestSuspendForDebug"}, 12 {0, nullptr, "RequestSuspendForDebug"},
diff --git a/src/core/hle/service/audio/auddbg.h b/src/core/hle/service/audio/auddbg.h
index 6689f4759..d1653eedd 100644
--- a/src/core/hle/service/audio/auddbg.h
+++ b/src/core/hle/service/audio/auddbg.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Audio { 13namespace Service::Audio {
10 14
11class AudDbg final : public ServiceFramework<AudDbg> { 15class AudDbg final : public ServiceFramework<AudDbg> {
12public: 16public:
13 explicit AudDbg(const char* name); 17 explicit AudDbg(Core::System& system_, const char* name);
14 ~AudDbg() override; 18 ~AudDbg() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/audio/audin_a.cpp b/src/core/hle/service/audio/audin_a.cpp
index ddd12f35e..79c3aa920 100644
--- a/src/core/hle/service/audio/audin_a.cpp
+++ b/src/core/hle/service/audio/audin_a.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::Audio { 7namespace Service::Audio {
8 8
9AudInA::AudInA() : ServiceFramework{"audin:a"} { 9AudInA::AudInA(Core::System& system_) : ServiceFramework{system_, "audin:a"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, nullptr, "RequestSuspendAudioIns"}, 12 {0, nullptr, "RequestSuspendAudioIns"},
diff --git a/src/core/hle/service/audio/audin_a.h b/src/core/hle/service/audio/audin_a.h
index e7623bc29..15120a4b6 100644
--- a/src/core/hle/service/audio/audin_a.h
+++ b/src/core/hle/service/audio/audin_a.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Audio { 13namespace Service::Audio {
10 14
11class AudInA final : public ServiceFramework<AudInA> { 15class AudInA final : public ServiceFramework<AudInA> {
12public: 16public:
13 explicit AudInA(); 17 explicit AudInA(Core::System& system_);
14 ~AudInA() override; 18 ~AudInA() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp
index 3e2299426..26a6deddf 100644
--- a/src/core/hle/service/audio/audin_u.cpp
+++ b/src/core/hle/service/audio/audin_u.cpp
@@ -11,7 +11,7 @@ namespace Service::Audio {
11 11
12class IAudioIn final : public ServiceFramework<IAudioIn> { 12class IAudioIn final : public ServiceFramework<IAudioIn> {
13public: 13public:
14 IAudioIn() : ServiceFramework("IAudioIn") { 14 explicit IAudioIn(Core::System& system_) : ServiceFramework{system_, "IAudioIn"} {
15 // clang-format off 15 // clang-format off
16 static const FunctionInfo functions[] = { 16 static const FunctionInfo functions[] = {
17 {0, nullptr, "GetAudioInState"}, 17 {0, nullptr, "GetAudioInState"},
@@ -36,7 +36,7 @@ public:
36 } 36 }
37}; 37};
38 38
39AudInU::AudInU() : ServiceFramework("audin:u") { 39AudInU::AudInU(Core::System& system_) : ServiceFramework{system_, "audin:u"} {
40 // clang-format off 40 // clang-format off
41 static const FunctionInfo functions[] = { 41 static const FunctionInfo functions[] = {
42 {0, &AudInU::ListAudioIns, "ListAudioIns"}, 42 {0, &AudInU::ListAudioIns, "ListAudioIns"},
@@ -96,7 +96,7 @@ void AudInU::OpenInOutImpl(Kernel::HLERequestContext& ctx) {
96 IPC::ResponseBuilder rb{ctx, 6, 0, 1}; 96 IPC::ResponseBuilder rb{ctx, 6, 0, 1};
97 rb.Push(RESULT_SUCCESS); 97 rb.Push(RESULT_SUCCESS);
98 rb.PushRaw<AudInOutParams>(params); 98 rb.PushRaw<AudInOutParams>(params);
99 rb.PushIpcInterface<IAudioIn>(); 99 rb.PushIpcInterface<IAudioIn>(system);
100} 100}
101 101
102void AudInU::OpenAudioIn(Kernel::HLERequestContext& ctx) { 102void AudInU::OpenAudioIn(Kernel::HLERequestContext& ctx) {
diff --git a/src/core/hle/service/audio/audin_u.h b/src/core/hle/service/audio/audin_u.h
index a599f4a64..0d75ae5ac 100644
--- a/src/core/hle/service/audio/audin_u.h
+++ b/src/core/hle/service/audio/audin_u.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Kernel { 13namespace Kernel {
10class HLERequestContext; 14class HLERequestContext;
11} 15}
@@ -14,7 +18,7 @@ namespace Service::Audio {
14 18
15class AudInU final : public ServiceFramework<AudInU> { 19class AudInU final : public ServiceFramework<AudInU> {
16public: 20public:
17 explicit AudInU(); 21 explicit AudInU(Core::System& system_);
18 ~AudInU() override; 22 ~AudInU() override;
19 23
20private: 24private:
diff --git a/src/core/hle/service/audio/audio.cpp b/src/core/hle/service/audio/audio.cpp
index 1781bec83..b3f24f9bb 100644
--- a/src/core/hle/service/audio/audio.cpp
+++ b/src/core/hle/service/audio/audio.cpp
@@ -20,22 +20,22 @@
20namespace Service::Audio { 20namespace Service::Audio {
21 21
22void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { 22void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
23 std::make_shared<AudCtl>()->InstallAsService(service_manager); 23 std::make_shared<AudCtl>(system)->InstallAsService(service_manager);
24 std::make_shared<AudOutA>()->InstallAsService(service_manager); 24 std::make_shared<AudOutA>(system)->InstallAsService(service_manager);
25 std::make_shared<AudOutU>(system)->InstallAsService(service_manager); 25 std::make_shared<AudOutU>(system)->InstallAsService(service_manager);
26 std::make_shared<AudInA>()->InstallAsService(service_manager); 26 std::make_shared<AudInA>(system)->InstallAsService(service_manager);
27 std::make_shared<AudInU>()->InstallAsService(service_manager); 27 std::make_shared<AudInU>(system)->InstallAsService(service_manager);
28 std::make_shared<AudRecA>()->InstallAsService(service_manager); 28 std::make_shared<AudRecA>(system)->InstallAsService(service_manager);
29 std::make_shared<AudRecU>()->InstallAsService(service_manager); 29 std::make_shared<AudRecU>(system)->InstallAsService(service_manager);
30 std::make_shared<AudRenA>()->InstallAsService(service_manager); 30 std::make_shared<AudRenA>(system)->InstallAsService(service_manager);
31 std::make_shared<AudRenU>(system)->InstallAsService(service_manager); 31 std::make_shared<AudRenU>(system)->InstallAsService(service_manager);
32 std::make_shared<CodecCtl>()->InstallAsService(service_manager); 32 std::make_shared<CodecCtl>(system)->InstallAsService(service_manager);
33 std::make_shared<HwOpus>()->InstallAsService(service_manager); 33 std::make_shared<HwOpus>(system)->InstallAsService(service_manager);
34 34
35 std::make_shared<AudDbg>("audin:d")->InstallAsService(service_manager); 35 std::make_shared<AudDbg>(system, "audin:d")->InstallAsService(service_manager);
36 std::make_shared<AudDbg>("audout:d")->InstallAsService(service_manager); 36 std::make_shared<AudDbg>(system, "audout:d")->InstallAsService(service_manager);
37 std::make_shared<AudDbg>("audrec:d")->InstallAsService(service_manager); 37 std::make_shared<AudDbg>(system, "audrec:d")->InstallAsService(service_manager);
38 std::make_shared<AudDbg>("audren:d")->InstallAsService(service_manager); 38 std::make_shared<AudDbg>(system, "audren:d")->InstallAsService(service_manager);
39} 39}
40 40
41} // namespace Service::Audio 41} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/audout_a.cpp b/src/core/hle/service/audio/audout_a.cpp
index 85febbca3..19825fd5d 100644
--- a/src/core/hle/service/audio/audout_a.cpp
+++ b/src/core/hle/service/audio/audout_a.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::Audio { 7namespace Service::Audio {
8 8
9AudOutA::AudOutA() : ServiceFramework{"audout:a"} { 9AudOutA::AudOutA(Core::System& system_) : ServiceFramework{system_, "audout:a"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, nullptr, "RequestSuspendAudioOuts"}, 12 {0, nullptr, "RequestSuspendAudioOuts"},
diff --git a/src/core/hle/service/audio/audout_a.h b/src/core/hle/service/audio/audout_a.h
index d65b66e8e..2043dfb77 100644
--- a/src/core/hle/service/audio/audout_a.h
+++ b/src/core/hle/service/audio/audout_a.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Audio { 13namespace Service::Audio {
10 14
11class AudOutA final : public ServiceFramework<AudOutA> { 15class AudOutA final : public ServiceFramework<AudOutA> {
12public: 16public:
13 explicit AudOutA(); 17 explicit AudOutA(Core::System& system_);
14 ~AudOutA() override; 18 ~AudOutA() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index 9b4910e53..145f47ee2 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -40,11 +40,11 @@ enum class AudioState : u32 {
40 40
41class IAudioOut final : public ServiceFramework<IAudioOut> { 41class IAudioOut final : public ServiceFramework<IAudioOut> {
42public: 42public:
43 IAudioOut(Core::System& system, AudoutParams audio_params, AudioCore::AudioOut& audio_core, 43 IAudioOut(Core::System& system_, AudoutParams audio_params_, AudioCore::AudioOut& audio_core_,
44 std::string&& device_name, std::string&& unique_name) 44 std::string&& device_name_, std::string&& unique_name)
45 : ServiceFramework("IAudioOut"), audio_core(audio_core), 45 : ServiceFramework{system_, "IAudioOut"}, audio_core{audio_core_},
46 device_name(std::move(device_name)), 46 device_name{std::move(device_name_)}, audio_params{audio_params_}, main_memory{
47 audio_params(audio_params), main_memory{system.Memory()} { 47 system.Memory()} {
48 // clang-format off 48 // clang-format off
49 static const FunctionInfo functions[] = { 49 static const FunctionInfo functions[] = {
50 {0, &IAudioOut::GetAudioOutState, "GetAudioOutState"}, 50 {0, &IAudioOut::GetAudioOutState, "GetAudioOutState"},
@@ -213,7 +213,7 @@ private:
213 Core::Memory::Memory& main_memory; 213 Core::Memory::Memory& main_memory;
214}; 214};
215 215
216AudOutU::AudOutU(Core::System& system_) : ServiceFramework("audout:u"), system{system_} { 216AudOutU::AudOutU(Core::System& system_) : ServiceFramework{system_, "audout:u"} {
217 // clang-format off 217 // clang-format off
218 static const FunctionInfo functions[] = { 218 static const FunctionInfo functions[] = {
219 {0, &AudOutU::ListAudioOutsImpl, "ListAudioOuts"}, 219 {0, &AudOutU::ListAudioOutsImpl, "ListAudioOuts"},
diff --git a/src/core/hle/service/audio/audout_u.h b/src/core/hle/service/audio/audout_u.h
index c9f532ccd..f7ae2f2bf 100644
--- a/src/core/hle/service/audio/audout_u.h
+++ b/src/core/hle/service/audio/audout_u.h
@@ -34,8 +34,6 @@ private:
34 34
35 std::vector<std::shared_ptr<IAudioOut>> audio_out_interfaces; 35 std::vector<std::shared_ptr<IAudioOut>> audio_out_interfaces;
36 std::unique_ptr<AudioCore::AudioOut> audio_core; 36 std::unique_ptr<AudioCore::AudioOut> audio_core;
37
38 Core::System& system;
39}; 37};
40 38
41} // namespace Service::Audio 39} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/audrec_a.cpp b/src/core/hle/service/audio/audrec_a.cpp
index ce1bfb48d..c5ab7cad4 100644
--- a/src/core/hle/service/audio/audrec_a.cpp
+++ b/src/core/hle/service/audio/audrec_a.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::Audio { 7namespace Service::Audio {
8 8
9AudRecA::AudRecA() : ServiceFramework{"audrec:a"} { 9AudRecA::AudRecA(Core::System& system_) : ServiceFramework{system_, "audrec:a"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, nullptr, "RequestSuspendFinalOutputRecorders"}, 12 {0, nullptr, "RequestSuspendFinalOutputRecorders"},
diff --git a/src/core/hle/service/audio/audrec_a.h b/src/core/hle/service/audio/audrec_a.h
index 384d24c69..2cce90b1d 100644
--- a/src/core/hle/service/audio/audrec_a.h
+++ b/src/core/hle/service/audio/audrec_a.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Audio { 13namespace Service::Audio {
10 14
11class AudRecA final : public ServiceFramework<AudRecA> { 15class AudRecA final : public ServiceFramework<AudRecA> {
12public: 16public:
13 explicit AudRecA(); 17 explicit AudRecA(Core::System& system_);
14 ~AudRecA() override; 18 ~AudRecA() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/audio/audrec_u.cpp b/src/core/hle/service/audio/audrec_u.cpp
index 1a5aed9ed..eb5c63c62 100644
--- a/src/core/hle/service/audio/audrec_u.cpp
+++ b/src/core/hle/service/audio/audrec_u.cpp
@@ -8,7 +8,8 @@ namespace Service::Audio {
8 8
9class IFinalOutputRecorder final : public ServiceFramework<IFinalOutputRecorder> { 9class IFinalOutputRecorder final : public ServiceFramework<IFinalOutputRecorder> {
10public: 10public:
11 IFinalOutputRecorder() : ServiceFramework("IFinalOutputRecorder") { 11 explicit IFinalOutputRecorder(Core::System& system_)
12 : ServiceFramework{system_, "IFinalOutputRecorder"} {
12 // clang-format off 13 // clang-format off
13 static const FunctionInfo functions[] = { 14 static const FunctionInfo functions[] = {
14 {0, nullptr, "GetFinalOutputRecorderState"}, 15 {0, nullptr, "GetFinalOutputRecorderState"},
@@ -29,7 +30,7 @@ public:
29 } 30 }
30}; 31};
31 32
32AudRecU::AudRecU() : ServiceFramework("audrec:u") { 33AudRecU::AudRecU(Core::System& system_) : ServiceFramework{system_, "audrec:u"} {
33 static const FunctionInfo functions[] = { 34 static const FunctionInfo functions[] = {
34 {0, nullptr, "OpenFinalOutputRecorder"}, 35 {0, nullptr, "OpenFinalOutputRecorder"},
35 }; 36 };
diff --git a/src/core/hle/service/audio/audrec_u.h b/src/core/hle/service/audio/audrec_u.h
index ca3d638e8..f79d49e5c 100644
--- a/src/core/hle/service/audio/audrec_u.h
+++ b/src/core/hle/service/audio/audrec_u.h
@@ -6,15 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Kernel { 9namespace Core {
10class HLERequestContext; 10class System;
11} 11}
12 12
13namespace Service::Audio { 13namespace Service::Audio {
14 14
15class AudRecU final : public ServiceFramework<AudRecU> { 15class AudRecU final : public ServiceFramework<AudRecU> {
16public: 16public:
17 explicit AudRecU(); 17 explicit AudRecU(Core::System& system_);
18 ~AudRecU() override; 18 ~AudRecU() override;
19}; 19};
20 20
diff --git a/src/core/hle/service/audio/audren_a.cpp b/src/core/hle/service/audio/audren_a.cpp
index edb66d985..5e9f866f0 100644
--- a/src/core/hle/service/audio/audren_a.cpp
+++ b/src/core/hle/service/audio/audren_a.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::Audio { 7namespace Service::Audio {
8 8
9AudRenA::AudRenA() : ServiceFramework{"audren:a"} { 9AudRenA::AudRenA(Core::System& system_) : ServiceFramework{system_, "audren:a"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, nullptr, "RequestSuspendAudioRenderers"}, 12 {0, nullptr, "RequestSuspendAudioRenderers"},
diff --git a/src/core/hle/service/audio/audren_a.h b/src/core/hle/service/audio/audren_a.h
index 81fef0ffe..5d0a626ad 100644
--- a/src/core/hle/service/audio/audren_a.h
+++ b/src/core/hle/service/audio/audren_a.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Audio { 13namespace Service::Audio {
10 14
11class AudRenA final : public ServiceFramework<AudRenA> { 15class AudRenA final : public ServiceFramework<AudRenA> {
12public: 16public:
13 explicit AudRenA(); 17 explicit AudRenA(Core::System& system_);
14 ~AudRenA() override; 18 ~AudRenA() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index a2d3ded7b..6e7b7316c 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -28,7 +28,7 @@ class IAudioRenderer final : public ServiceFramework<IAudioRenderer> {
28public: 28public:
29 explicit IAudioRenderer(Core::System& system, AudioCommon::AudioRendererParameter audren_params, 29 explicit IAudioRenderer(Core::System& system, AudioCommon::AudioRendererParameter audren_params,
30 const std::size_t instance_number) 30 const std::size_t instance_number)
31 : ServiceFramework("IAudioRenderer") { 31 : ServiceFramework{system, "IAudioRenderer"} {
32 // clang-format off 32 // clang-format off
33 static const FunctionInfo functions[] = { 33 static const FunctionInfo functions[] = {
34 {0, &IAudioRenderer::GetSampleRate, "GetSampleRate"}, 34 {0, &IAudioRenderer::GetSampleRate, "GetSampleRate"},
@@ -167,8 +167,8 @@ private:
167 167
168class IAudioDevice final : public ServiceFramework<IAudioDevice> { 168class IAudioDevice final : public ServiceFramework<IAudioDevice> {
169public: 169public:
170 explicit IAudioDevice(Core::System& system, u32_le revision_num) 170 explicit IAudioDevice(Core::System& system_, u32_le revision_num)
171 : ServiceFramework("IAudioDevice"), revision{revision_num} { 171 : ServiceFramework{system_, "IAudioDevice"}, revision{revision_num} {
172 static const FunctionInfo functions[] = { 172 static const FunctionInfo functions[] = {
173 {0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"}, 173 {0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"},
174 {1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"}, 174 {1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"},
@@ -325,7 +325,7 @@ private:
325 325
326}; // namespace Audio 326}; // namespace Audio
327 327
328AudRenU::AudRenU(Core::System& system_) : ServiceFramework("audren:u"), system{system_} { 328AudRenU::AudRenU(Core::System& system_) : ServiceFramework{system_, "audren:u"} {
329 // clang-format off 329 // clang-format off
330 static const FunctionInfo functions[] = { 330 static const FunctionInfo functions[] = {
331 {0, &AudRenU::OpenAudioRenderer, "OpenAudioRenderer"}, 331 {0, &AudRenU::OpenAudioRenderer, "OpenAudioRenderer"},
diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h
index 4e0ccc792..d693dc406 100644
--- a/src/core/hle/service/audio/audren_u.h
+++ b/src/core/hle/service/audio/audren_u.h
@@ -31,7 +31,6 @@ private:
31 void OpenAudioRendererImpl(Kernel::HLERequestContext& ctx); 31 void OpenAudioRendererImpl(Kernel::HLERequestContext& ctx);
32 32
33 std::size_t audren_instance_count = 0; 33 std::size_t audren_instance_count = 0;
34 Core::System& system;
35}; 34};
36 35
37// Describes a particular audio feature that may be supported in a particular revision. 36// Describes a particular audio feature that may be supported in a particular revision.
diff --git a/src/core/hle/service/audio/codecctl.cpp b/src/core/hle/service/audio/codecctl.cpp
index c6864146d..94afec1b6 100644
--- a/src/core/hle/service/audio/codecctl.cpp
+++ b/src/core/hle/service/audio/codecctl.cpp
@@ -2,14 +2,11 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "common/logging/log.h"
6#include "core/hle/ipc_helpers.h"
7#include "core/hle/kernel/hle_ipc.h"
8#include "core/hle/service/audio/codecctl.h" 5#include "core/hle/service/audio/codecctl.h"
9 6
10namespace Service::Audio { 7namespace Service::Audio {
11 8
12CodecCtl::CodecCtl() : ServiceFramework("codecctl") { 9CodecCtl::CodecCtl(Core::System& system_) : ServiceFramework{system_, "codecctl"} {
13 static const FunctionInfo functions[] = { 10 static const FunctionInfo functions[] = {
14 {0, nullptr, "InitializeCodecController"}, 11 {0, nullptr, "InitializeCodecController"},
15 {1, nullptr, "FinalizeCodecController"}, 12 {1, nullptr, "FinalizeCodecController"},
diff --git a/src/core/hle/service/audio/codecctl.h b/src/core/hle/service/audio/codecctl.h
index 2fe75b6e2..58e53259e 100644
--- a/src/core/hle/service/audio/codecctl.h
+++ b/src/core/hle/service/audio/codecctl.h
@@ -6,15 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Kernel { 9namespace Core {
10class HLERequestContext; 10class System;
11} 11}
12 12
13namespace Service::Audio { 13namespace Service::Audio {
14 14
15class CodecCtl final : public ServiceFramework<CodecCtl> { 15class CodecCtl final : public ServiceFramework<CodecCtl> {
16public: 16public:
17 explicit CodecCtl(); 17 explicit CodecCtl(Core::System& system_);
18 ~CodecCtl() override; 18 ~CodecCtl() override;
19}; 19};
20 20
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp
index f1d81602c..ea3414fd2 100644
--- a/src/core/hle/service/audio/hwopus.cpp
+++ b/src/core/hle/service/audio/hwopus.cpp
@@ -160,8 +160,9 @@ private:
160 160
161class IHardwareOpusDecoderManager final : public ServiceFramework<IHardwareOpusDecoderManager> { 161class IHardwareOpusDecoderManager final : public ServiceFramework<IHardwareOpusDecoderManager> {
162public: 162public:
163 explicit IHardwareOpusDecoderManager(OpusDecoderState decoder_state) 163 explicit IHardwareOpusDecoderManager(Core::System& system_, OpusDecoderState decoder_state)
164 : ServiceFramework("IHardwareOpusDecoderManager"), decoder_state{std::move(decoder_state)} { 164 : ServiceFramework{system_, "IHardwareOpusDecoderManager"}, decoder_state{
165 std::move(decoder_state)} {
165 // clang-format off 166 // clang-format off
166 static const FunctionInfo functions[] = { 167 static const FunctionInfo functions[] = {
167 {0, &IHardwareOpusDecoderManager::DecodeInterleavedOld, "DecodeInterleavedOld"}, 168 {0, &IHardwareOpusDecoderManager::DecodeInterleavedOld, "DecodeInterleavedOld"},
@@ -287,10 +288,10 @@ void HwOpus::OpenOpusDecoder(Kernel::HLERequestContext& ctx) {
287 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 288 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
288 rb.Push(RESULT_SUCCESS); 289 rb.Push(RESULT_SUCCESS);
289 rb.PushIpcInterface<IHardwareOpusDecoderManager>( 290 rb.PushIpcInterface<IHardwareOpusDecoderManager>(
290 OpusDecoderState{std::move(decoder), sample_rate, channel_count}); 291 system, OpusDecoderState{std::move(decoder), sample_rate, channel_count});
291} 292}
292 293
293HwOpus::HwOpus() : ServiceFramework("hwopus") { 294HwOpus::HwOpus(Core::System& system_) : ServiceFramework{system_, "hwopus"} {
294 static const FunctionInfo functions[] = { 295 static const FunctionInfo functions[] = {
295 {0, &HwOpus::OpenOpusDecoder, "OpenOpusDecoder"}, 296 {0, &HwOpus::OpenOpusDecoder, "OpenOpusDecoder"},
296 {1, &HwOpus::GetWorkBufferSize, "GetWorkBufferSize"}, 297 {1, &HwOpus::GetWorkBufferSize, "GetWorkBufferSize"},
diff --git a/src/core/hle/service/audio/hwopus.h b/src/core/hle/service/audio/hwopus.h
index 602ede8ba..4f921f18e 100644
--- a/src/core/hle/service/audio/hwopus.h
+++ b/src/core/hle/service/audio/hwopus.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Audio { 13namespace Service::Audio {
10 14
11class HwOpus final : public ServiceFramework<HwOpus> { 15class HwOpus final : public ServiceFramework<HwOpus> {
12public: 16public:
13 explicit HwOpus(); 17 explicit HwOpus(Core::System& system_);
14 ~HwOpus() override; 18 ~HwOpus() override;
15 19
16private: 20private:
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp
index 68deb0600..b8696a395 100644
--- a/src/core/hle/service/bcat/module.cpp
+++ b/src/core/hle/service/bcat/module.cpp
@@ -88,9 +88,11 @@ struct DeliveryCacheDirectoryEntry {
88 88
89class IDeliveryCacheProgressService final : public ServiceFramework<IDeliveryCacheProgressService> { 89class IDeliveryCacheProgressService final : public ServiceFramework<IDeliveryCacheProgressService> {
90public: 90public:
91 IDeliveryCacheProgressService(std::shared_ptr<Kernel::ReadableEvent> event, 91 explicit IDeliveryCacheProgressService(Core::System& system_,
92 const DeliveryCacheProgressImpl& impl) 92 std::shared_ptr<Kernel::ReadableEvent> event_,
93 : ServiceFramework{"IDeliveryCacheProgressService"}, event(std::move(event)), impl(impl) { 93 const DeliveryCacheProgressImpl& impl_)
94 : ServiceFramework{system_, "IDeliveryCacheProgressService"}, event{std::move(event_)},
95 impl{impl_} {
94 // clang-format off 96 // clang-format off
95 static const FunctionInfo functions[] = { 97 static const FunctionInfo functions[] = {
96 {0, &IDeliveryCacheProgressService::GetEvent, "GetEvent"}, 98 {0, &IDeliveryCacheProgressService::GetEvent, "GetEvent"},
@@ -126,7 +128,7 @@ private:
126class IBcatService final : public ServiceFramework<IBcatService> { 128class IBcatService final : public ServiceFramework<IBcatService> {
127public: 129public:
128 explicit IBcatService(Core::System& system_, Backend& backend_) 130 explicit IBcatService(Core::System& system_, Backend& backend_)
129 : ServiceFramework("IBcatService"), system{system_}, backend{backend_}, 131 : ServiceFramework{system_, "IBcatService"}, backend{backend_},
130 progress{{ 132 progress{{
131 ProgressServiceBackend{system_.Kernel(), "Normal"}, 133 ProgressServiceBackend{system_.Kernel(), "Normal"},
132 ProgressServiceBackend{system_.Kernel(), "Directory"}, 134 ProgressServiceBackend{system_.Kernel(), "Directory"},
@@ -171,7 +173,7 @@ private:
171 173
172 std::shared_ptr<IDeliveryCacheProgressService> CreateProgressService(SyncType type) { 174 std::shared_ptr<IDeliveryCacheProgressService> CreateProgressService(SyncType type) {
173 auto& backend{progress.at(static_cast<std::size_t>(type))}; 175 auto& backend{progress.at(static_cast<std::size_t>(type))};
174 return std::make_shared<IDeliveryCacheProgressService>(backend.GetEvent(), 176 return std::make_shared<IDeliveryCacheProgressService>(system, backend.GetEvent(),
175 backend.GetImpl()); 177 backend.GetImpl());
176 } 178 }
177 179
@@ -261,7 +263,6 @@ private:
261 rb.Push(RESULT_SUCCESS); 263 rb.Push(RESULT_SUCCESS);
262 } 264 }
263 265
264 Core::System& system;
265 Backend& backend; 266 Backend& backend;
266 267
267 std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress; 268 std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress;
@@ -277,8 +278,8 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {
277 278
278class IDeliveryCacheFileService final : public ServiceFramework<IDeliveryCacheFileService> { 279class IDeliveryCacheFileService final : public ServiceFramework<IDeliveryCacheFileService> {
279public: 280public:
280 IDeliveryCacheFileService(FileSys::VirtualDir root_) 281 explicit IDeliveryCacheFileService(Core::System& system_, FileSys::VirtualDir root_)
281 : ServiceFramework{"IDeliveryCacheFileService"}, root(std::move(root_)) { 282 : ServiceFramework{system_, "IDeliveryCacheFileService"}, root(std::move(root_)) {
282 // clang-format off 283 // clang-format off
283 static const FunctionInfo functions[] = { 284 static const FunctionInfo functions[] = {
284 {0, &IDeliveryCacheFileService::Open, "Open"}, 285 {0, &IDeliveryCacheFileService::Open, "Open"},
@@ -394,8 +395,8 @@ private:
394class IDeliveryCacheDirectoryService final 395class IDeliveryCacheDirectoryService final
395 : public ServiceFramework<IDeliveryCacheDirectoryService> { 396 : public ServiceFramework<IDeliveryCacheDirectoryService> {
396public: 397public:
397 IDeliveryCacheDirectoryService(FileSys::VirtualDir root_) 398 explicit IDeliveryCacheDirectoryService(Core::System& system_, FileSys::VirtualDir root_)
398 : ServiceFramework{"IDeliveryCacheDirectoryService"}, root(std::move(root_)) { 399 : ServiceFramework{system_, "IDeliveryCacheDirectoryService"}, root(std::move(root_)) {
399 // clang-format off 400 // clang-format off
400 static const FunctionInfo functions[] = { 401 static const FunctionInfo functions[] = {
401 {0, &IDeliveryCacheDirectoryService::Open, "Open"}, 402 {0, &IDeliveryCacheDirectoryService::Open, "Open"},
@@ -492,8 +493,8 @@ private:
492 493
493class IDeliveryCacheStorageService final : public ServiceFramework<IDeliveryCacheStorageService> { 494class IDeliveryCacheStorageService final : public ServiceFramework<IDeliveryCacheStorageService> {
494public: 495public:
495 IDeliveryCacheStorageService(FileSys::VirtualDir root_) 496 explicit IDeliveryCacheStorageService(Core::System& system_, FileSys::VirtualDir root_)
496 : ServiceFramework{"IDeliveryCacheStorageService"}, root(std::move(root_)) { 497 : ServiceFramework{system_, "IDeliveryCacheStorageService"}, root(std::move(root_)) {
497 // clang-format off 498 // clang-format off
498 static const FunctionInfo functions[] = { 499 static const FunctionInfo functions[] = {
499 {0, &IDeliveryCacheStorageService::CreateFileService, "CreateFileService"}, 500 {0, &IDeliveryCacheStorageService::CreateFileService, "CreateFileService"},
@@ -518,7 +519,7 @@ private:
518 519
519 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 520 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
520 rb.Push(RESULT_SUCCESS); 521 rb.Push(RESULT_SUCCESS);
521 rb.PushIpcInterface<IDeliveryCacheFileService>(root); 522 rb.PushIpcInterface<IDeliveryCacheFileService>(system, root);
522 } 523 }
523 524
524 void CreateDirectoryService(Kernel::HLERequestContext& ctx) { 525 void CreateDirectoryService(Kernel::HLERequestContext& ctx) {
@@ -526,7 +527,7 @@ private:
526 527
527 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 528 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
528 rb.Push(RESULT_SUCCESS); 529 rb.Push(RESULT_SUCCESS);
529 rb.PushIpcInterface<IDeliveryCacheDirectoryService>(root); 530 rb.PushIpcInterface<IDeliveryCacheDirectoryService>(system, root);
530 } 531 }
531 532
532 void EnumerateDeliveryCacheDirectory(Kernel::HLERequestContext& ctx) { 533 void EnumerateDeliveryCacheDirectory(Kernel::HLERequestContext& ctx) {
@@ -551,10 +552,10 @@ private:
551void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) { 552void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) {
552 LOG_DEBUG(Service_BCAT, "called"); 553 LOG_DEBUG(Service_BCAT, "called");
553 554
555 const auto title_id = system.CurrentProcess()->GetTitleID();
554 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 556 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
555 rb.Push(RESULT_SUCCESS); 557 rb.Push(RESULT_SUCCESS);
556 rb.PushIpcInterface<IDeliveryCacheStorageService>( 558 rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id));
557 fsc.GetBCATDirectory(system.CurrentProcess()->GetTitleID()));
558} 559}
559 560
560void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( 561void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId(
@@ -566,7 +567,7 @@ void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId(
566 567
567 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 568 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
568 rb.Push(RESULT_SUCCESS); 569 rb.Push(RESULT_SUCCESS);
569 rb.PushIpcInterface<IDeliveryCacheStorageService>(fsc.GetBCATDirectory(title_id)); 570 rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id));
570} 571}
571 572
572std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System& system, 573std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System& system,
@@ -582,10 +583,9 @@ std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System
582 583
583Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_, 584Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_,
584 FileSystem::FileSystemController& fsc_, const char* name) 585 FileSystem::FileSystemController& fsc_, const char* name)
585 : ServiceFramework(name), fsc{fsc_}, module{std::move(module_)}, 586 : ServiceFramework{system_, name}, fsc{fsc_}, module{std::move(module_)},
586 backend{CreateBackendFromSettings(system_, 587 backend{CreateBackendFromSettings(system_,
587 [&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })}, 588 [&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })} {}
588 system{system_} {}
589 589
590Module::Interface::~Interface() = default; 590Module::Interface::~Interface() = default;
591 591
diff --git a/src/core/hle/service/bcat/module.h b/src/core/hle/service/bcat/module.h
index e4ba23ba0..738731c06 100644
--- a/src/core/hle/service/bcat/module.h
+++ b/src/core/hle/service/bcat/module.h
@@ -37,9 +37,6 @@ public:
37 37
38 std::shared_ptr<Module> module; 38 std::shared_ptr<Module> module;
39 std::unique_ptr<Backend> backend; 39 std::unique_ptr<Backend> backend;
40
41 private:
42 Core::System& system;
43 }; 40 };
44}; 41};
45 42
diff --git a/src/core/hle/service/bpc/bpc.cpp b/src/core/hle/service/bpc/bpc.cpp
index fac6b2f9c..e4630320e 100644
--- a/src/core/hle/service/bpc/bpc.cpp
+++ b/src/core/hle/service/bpc/bpc.cpp
@@ -12,7 +12,7 @@ namespace Service::BPC {
12 12
13class BPC final : public ServiceFramework<BPC> { 13class BPC final : public ServiceFramework<BPC> {
14public: 14public:
15 explicit BPC() : ServiceFramework{"bpc"} { 15 explicit BPC(Core::System& system_) : ServiceFramework{system_, "bpc"} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, nullptr, "ShutdownSystem"}, 18 {0, nullptr, "ShutdownSystem"},
@@ -40,7 +40,7 @@ public:
40 40
41class BPC_R final : public ServiceFramework<BPC_R> { 41class BPC_R final : public ServiceFramework<BPC_R> {
42public: 42public:
43 explicit BPC_R() : ServiceFramework{"bpc:r"} { 43 explicit BPC_R(Core::System& system_) : ServiceFramework{system_, "bpc:r"} {
44 // clang-format off 44 // clang-format off
45 static const FunctionInfo functions[] = { 45 static const FunctionInfo functions[] = {
46 {0, nullptr, "GetRtcTime"}, 46 {0, nullptr, "GetRtcTime"},
@@ -55,9 +55,9 @@ public:
55 } 55 }
56}; 56};
57 57
58void InstallInterfaces(SM::ServiceManager& sm) { 58void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
59 std::make_shared<BPC>()->InstallAsService(sm); 59 std::make_shared<BPC>(system)->InstallAsService(sm);
60 std::make_shared<BPC_R>()->InstallAsService(sm); 60 std::make_shared<BPC_R>(system)->InstallAsService(sm);
61} 61}
62 62
63} // namespace Service::BPC 63} // namespace Service::BPC
diff --git a/src/core/hle/service/bpc/bpc.h b/src/core/hle/service/bpc/bpc.h
index eaa37be8d..6ec25aa9b 100644
--- a/src/core/hle/service/bpc/bpc.h
+++ b/src/core/hle/service/bpc/bpc.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::BPC { 15namespace Service::BPC {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::BPC 19} // namespace Service::BPC
diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp
index d4f0dd1ab..2de86f1f1 100644
--- a/src/core/hle/service/btdrv/btdrv.cpp
+++ b/src/core/hle/service/btdrv/btdrv.cpp
@@ -17,7 +17,7 @@ namespace Service::BtDrv {
17 17
18class Bt final : public ServiceFramework<Bt> { 18class Bt final : public ServiceFramework<Bt> {
19public: 19public:
20 explicit Bt(Core::System& system) : ServiceFramework{"bt"} { 20 explicit Bt(Core::System& system_) : ServiceFramework{system_, "bt"} {
21 // clang-format off 21 // clang-format off
22 static const FunctionInfo functions[] = { 22 static const FunctionInfo functions[] = {
23 {0, nullptr, "LeClientReadCharacteristic"}, 23 {0, nullptr, "LeClientReadCharacteristic"},
@@ -52,7 +52,7 @@ private:
52 52
53class BtDrv final : public ServiceFramework<BtDrv> { 53class BtDrv final : public ServiceFramework<BtDrv> {
54public: 54public:
55 explicit BtDrv() : ServiceFramework{"btdrv"} { 55 explicit BtDrv(Core::System& system_) : ServiceFramework{system_, "btdrv"} {
56 // clang-format off 56 // clang-format off
57 static const FunctionInfo functions[] = { 57 static const FunctionInfo functions[] = {
58 {0, nullptr, "InitializeBluetoothDriver"}, 58 {0, nullptr, "InitializeBluetoothDriver"},
@@ -166,7 +166,7 @@ public:
166}; 166};
167 167
168void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) { 168void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
169 std::make_shared<BtDrv>()->InstallAsService(sm); 169 std::make_shared<BtDrv>(system)->InstallAsService(sm);
170 std::make_shared<Bt>(system)->InstallAsService(sm); 170 std::make_shared<Bt>(system)->InstallAsService(sm);
171} 171}
172 172
diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp
index c8f8ddbd5..38b55300e 100644
--- a/src/core/hle/service/btm/btm.cpp
+++ b/src/core/hle/service/btm/btm.cpp
@@ -18,7 +18,7 @@ namespace Service::BTM {
18 18
19class IBtmUserCore final : public ServiceFramework<IBtmUserCore> { 19class IBtmUserCore final : public ServiceFramework<IBtmUserCore> {
20public: 20public:
21 explicit IBtmUserCore(Core::System& system) : ServiceFramework{"IBtmUserCore"} { 21 explicit IBtmUserCore(Core::System& system_) : ServiceFramework{system_, "IBtmUserCore"} {
22 // clang-format off 22 // clang-format off
23 static const FunctionInfo functions[] = { 23 static const FunctionInfo functions[] = {
24 {0, &IBtmUserCore::AcquireBleScanEvent, "AcquireBleScanEvent"}, 24 {0, &IBtmUserCore::AcquireBleScanEvent, "AcquireBleScanEvent"},
@@ -107,7 +107,7 @@ private:
107 107
108class BTM_USR final : public ServiceFramework<BTM_USR> { 108class BTM_USR final : public ServiceFramework<BTM_USR> {
109public: 109public:
110 explicit BTM_USR(Core::System& system) : ServiceFramework{"btm:u"}, system(system) { 110 explicit BTM_USR(Core::System& system_) : ServiceFramework{system_, "btm:u"} {
111 // clang-format off 111 // clang-format off
112 static const FunctionInfo functions[] = { 112 static const FunctionInfo functions[] = {
113 {0, &BTM_USR::GetCore, "GetCore"}, 113 {0, &BTM_USR::GetCore, "GetCore"},
@@ -124,13 +124,11 @@ private:
124 rb.Push(RESULT_SUCCESS); 124 rb.Push(RESULT_SUCCESS);
125 rb.PushIpcInterface<IBtmUserCore>(system); 125 rb.PushIpcInterface<IBtmUserCore>(system);
126 } 126 }
127
128 Core::System& system;
129}; 127};
130 128
131class BTM final : public ServiceFramework<BTM> { 129class BTM final : public ServiceFramework<BTM> {
132public: 130public:
133 explicit BTM() : ServiceFramework{"btm"} { 131 explicit BTM(Core::System& system_) : ServiceFramework{system_, "btm"} {
134 // clang-format off 132 // clang-format off
135 static const FunctionInfo functions[] = { 133 static const FunctionInfo functions[] = {
136 {0, nullptr, "GetState"}, 134 {0, nullptr, "GetState"},
@@ -207,7 +205,7 @@ public:
207 205
208class BTM_DBG final : public ServiceFramework<BTM_DBG> { 206class BTM_DBG final : public ServiceFramework<BTM_DBG> {
209public: 207public:
210 explicit BTM_DBG() : ServiceFramework{"btm:dbg"} { 208 explicit BTM_DBG(Core::System& system_) : ServiceFramework{system_, "btm:dbg"} {
211 // clang-format off 209 // clang-format off
212 static const FunctionInfo functions[] = { 210 static const FunctionInfo functions[] = {
213 {0, nullptr, "AcquireDiscoveryEvent"}, 211 {0, nullptr, "AcquireDiscoveryEvent"},
@@ -232,7 +230,7 @@ public:
232 230
233class IBtmSystemCore final : public ServiceFramework<IBtmSystemCore> { 231class IBtmSystemCore final : public ServiceFramework<IBtmSystemCore> {
234public: 232public:
235 explicit IBtmSystemCore() : ServiceFramework{"IBtmSystemCore"} { 233 explicit IBtmSystemCore(Core::System& system_) : ServiceFramework{system_, "IBtmSystemCore"} {
236 // clang-format off 234 // clang-format off
237 static const FunctionInfo functions[] = { 235 static const FunctionInfo functions[] = {
238 {0, nullptr, "StartGamepadPairing"}, 236 {0, nullptr, "StartGamepadPairing"},
@@ -254,7 +252,7 @@ public:
254 252
255class BTM_SYS final : public ServiceFramework<BTM_SYS> { 253class BTM_SYS final : public ServiceFramework<BTM_SYS> {
256public: 254public:
257 explicit BTM_SYS() : ServiceFramework{"btm:sys"} { 255 explicit BTM_SYS(Core::System& system_) : ServiceFramework{system_, "btm:sys"} {
258 // clang-format off 256 // clang-format off
259 static const FunctionInfo functions[] = { 257 static const FunctionInfo functions[] = {
260 {0, &BTM_SYS::GetCore, "GetCore"}, 258 {0, &BTM_SYS::GetCore, "GetCore"},
@@ -270,14 +268,14 @@ private:
270 268
271 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 269 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
272 rb.Push(RESULT_SUCCESS); 270 rb.Push(RESULT_SUCCESS);
273 rb.PushIpcInterface<IBtmSystemCore>(); 271 rb.PushIpcInterface<IBtmSystemCore>(system);
274 } 272 }
275}; 273};
276 274
277void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) { 275void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
278 std::make_shared<BTM>()->InstallAsService(sm); 276 std::make_shared<BTM>(system)->InstallAsService(sm);
279 std::make_shared<BTM_DBG>()->InstallAsService(sm); 277 std::make_shared<BTM_DBG>(system)->InstallAsService(sm);
280 std::make_shared<BTM_SYS>()->InstallAsService(sm); 278 std::make_shared<BTM_SYS>(system)->InstallAsService(sm);
281 std::make_shared<BTM_USR>(system)->InstallAsService(sm); 279 std::make_shared<BTM_USR>(system)->InstallAsService(sm);
282} 280}
283 281
diff --git a/src/core/hle/service/caps/caps.cpp b/src/core/hle/service/caps/caps.cpp
index ba5749b84..5b7fe8e9b 100644
--- a/src/core/hle/service/caps/caps.cpp
+++ b/src/core/hle/service/caps/caps.cpp
@@ -13,13 +13,13 @@
13 13
14namespace Service::Capture { 14namespace Service::Capture {
15 15
16void InstallInterfaces(SM::ServiceManager& sm) { 16void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
17 std::make_shared<CAPS_A>()->InstallAsService(sm); 17 std::make_shared<CAPS_A>(system)->InstallAsService(sm);
18 std::make_shared<CAPS_C>()->InstallAsService(sm); 18 std::make_shared<CAPS_C>(system)->InstallAsService(sm);
19 std::make_shared<CAPS_U>()->InstallAsService(sm); 19 std::make_shared<CAPS_U>(system)->InstallAsService(sm);
20 std::make_shared<CAPS_SC>()->InstallAsService(sm); 20 std::make_shared<CAPS_SC>(system)->InstallAsService(sm);
21 std::make_shared<CAPS_SS>()->InstallAsService(sm); 21 std::make_shared<CAPS_SS>(system)->InstallAsService(sm);
22 std::make_shared<CAPS_SU>()->InstallAsService(sm); 22 std::make_shared<CAPS_SU>(system)->InstallAsService(sm);
23} 23}
24 24
25} // namespace Service::Capture 25} // namespace Service::Capture
diff --git a/src/core/hle/service/caps/caps.h b/src/core/hle/service/caps/caps.h
index b8c67b6e2..3c4290c88 100644
--- a/src/core/hle/service/caps/caps.h
+++ b/src/core/hle/service/caps/caps.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::SM { 13namespace Service::SM {
10class ServiceManager; 14class ServiceManager;
11} 15}
@@ -87,6 +91,6 @@ static_assert(sizeof(ApplicationAlbumFileEntry) == 0x30,
87 "ApplicationAlbumFileEntry has incorrect size."); 91 "ApplicationAlbumFileEntry has incorrect size.");
88 92
89/// Registers all Capture services with the specified service manager. 93/// Registers all Capture services with the specified service manager.
90void InstallInterfaces(SM::ServiceManager& sm); 94void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
91 95
92} // namespace Service::Capture 96} // namespace Service::Capture
diff --git a/src/core/hle/service/caps/caps_a.cpp b/src/core/hle/service/caps/caps_a.cpp
index a0a3b2ae3..1fe4f0e14 100644
--- a/src/core/hle/service/caps/caps_a.cpp
+++ b/src/core/hle/service/caps/caps_a.cpp
@@ -8,7 +8,8 @@ namespace Service::Capture {
8 8
9class IAlbumAccessorSession final : public ServiceFramework<IAlbumAccessorSession> { 9class IAlbumAccessorSession final : public ServiceFramework<IAlbumAccessorSession> {
10public: 10public:
11 explicit IAlbumAccessorSession() : ServiceFramework{"IAlbumAccessorSession"} { 11 explicit IAlbumAccessorSession(Core::System& system_)
12 : ServiceFramework{system_, "IAlbumAccessorSession"} {
12 // clang-format off 13 // clang-format off
13 static const FunctionInfo functions[] = { 14 static const FunctionInfo functions[] = {
14 {2001, nullptr, "OpenAlbumMovieReadStream"}, 15 {2001, nullptr, "OpenAlbumMovieReadStream"},
@@ -26,7 +27,7 @@ public:
26 } 27 }
27}; 28};
28 29
29CAPS_A::CAPS_A() : ServiceFramework("caps:a") { 30CAPS_A::CAPS_A(Core::System& system_) : ServiceFramework{system_, "caps:a"} {
30 // clang-format off 31 // clang-format off
31 static const FunctionInfo functions[] = { 32 static const FunctionInfo functions[] = {
32 {0, nullptr, "GetAlbumFileCount"}, 33 {0, nullptr, "GetAlbumFileCount"},
diff --git a/src/core/hle/service/caps/caps_a.h b/src/core/hle/service/caps/caps_a.h
index cb93aad5b..389cc6dbe 100644
--- a/src/core/hle/service/caps/caps_a.h
+++ b/src/core/hle/service/caps/caps_a.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Kernel { 13namespace Kernel {
10class HLERequestContext; 14class HLERequestContext;
11} 15}
@@ -14,7 +18,7 @@ namespace Service::Capture {
14 18
15class CAPS_A final : public ServiceFramework<CAPS_A> { 19class CAPS_A final : public ServiceFramework<CAPS_A> {
16public: 20public:
17 explicit CAPS_A(); 21 explicit CAPS_A(Core::System& system_);
18 ~CAPS_A() override; 22 ~CAPS_A() override;
19}; 23};
20 24
diff --git a/src/core/hle/service/caps/caps_c.cpp b/src/core/hle/service/caps/caps_c.cpp
index a0ee116fa..45c1c9d30 100644
--- a/src/core/hle/service/caps/caps_c.cpp
+++ b/src/core/hle/service/caps/caps_c.cpp
@@ -10,7 +10,8 @@ namespace Service::Capture {
10 10
11class IAlbumControlSession final : public ServiceFramework<IAlbumControlSession> { 11class IAlbumControlSession final : public ServiceFramework<IAlbumControlSession> {
12public: 12public:
13 explicit IAlbumControlSession() : ServiceFramework{"IAlbumControlSession"} { 13 explicit IAlbumControlSession(Core::System& system_)
14 : ServiceFramework{system_, "IAlbumControlSession"} {
14 // clang-format off 15 // clang-format off
15 static const FunctionInfo functions[] = { 16 static const FunctionInfo functions[] = {
16 {2001, nullptr, "OpenAlbumMovieReadStream"}, 17 {2001, nullptr, "OpenAlbumMovieReadStream"},
@@ -44,7 +45,7 @@ public:
44 } 45 }
45}; 46};
46 47
47CAPS_C::CAPS_C() : ServiceFramework("caps:c") { 48CAPS_C::CAPS_C(Core::System& system_) : ServiceFramework{system_, "caps:c"} {
48 // clang-format off 49 // clang-format off
49 static const FunctionInfo functions[] = { 50 static const FunctionInfo functions[] = {
50 {1, nullptr, "CaptureRawImage"}, 51 {1, nullptr, "CaptureRawImage"},
diff --git a/src/core/hle/service/caps/caps_c.h b/src/core/hle/service/caps/caps_c.h
index b110301d4..c6d1dfdce 100644
--- a/src/core/hle/service/caps/caps_c.h
+++ b/src/core/hle/service/caps/caps_c.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Kernel { 13namespace Kernel {
10class HLERequestContext; 14class HLERequestContext;
11} 15}
@@ -14,7 +18,7 @@ namespace Service::Capture {
14 18
15class CAPS_C final : public ServiceFramework<CAPS_C> { 19class CAPS_C final : public ServiceFramework<CAPS_C> {
16public: 20public:
17 explicit CAPS_C(); 21 explicit CAPS_C(Core::System& system_);
18 ~CAPS_C() override; 22 ~CAPS_C() override;
19 23
20private: 24private:
diff --git a/src/core/hle/service/caps/caps_sc.cpp b/src/core/hle/service/caps/caps_sc.cpp
index 822ee96c8..d91e18e80 100644
--- a/src/core/hle/service/caps/caps_sc.cpp
+++ b/src/core/hle/service/caps/caps_sc.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::Capture { 7namespace Service::Capture {
8 8
9CAPS_SC::CAPS_SC() : ServiceFramework("caps:sc") { 9CAPS_SC::CAPS_SC(Core::System& system_) : ServiceFramework{system_, "caps:sc"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {1, nullptr, "CaptureRawImage"}, 12 {1, nullptr, "CaptureRawImage"},
diff --git a/src/core/hle/service/caps/caps_sc.h b/src/core/hle/service/caps/caps_sc.h
index ac3e929ca..e79a33ee5 100644
--- a/src/core/hle/service/caps/caps_sc.h
+++ b/src/core/hle/service/caps/caps_sc.h
@@ -6,15 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Kernel { 9namespace Core {
10class HLERequestContext; 10class System;
11} 11}
12 12
13namespace Service::Capture { 13namespace Service::Capture {
14 14
15class CAPS_SC final : public ServiceFramework<CAPS_SC> { 15class CAPS_SC final : public ServiceFramework<CAPS_SC> {
16public: 16public:
17 explicit CAPS_SC(); 17 explicit CAPS_SC(Core::System& system_);
18 ~CAPS_SC() override; 18 ~CAPS_SC() override;
19}; 19};
20 20
diff --git a/src/core/hle/service/caps/caps_ss.cpp b/src/core/hle/service/caps/caps_ss.cpp
index 24dc716e7..2b5314691 100644
--- a/src/core/hle/service/caps/caps_ss.cpp
+++ b/src/core/hle/service/caps/caps_ss.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::Capture { 7namespace Service::Capture {
8 8
9CAPS_SS::CAPS_SS() : ServiceFramework("caps:ss") { 9CAPS_SS::CAPS_SS(Core::System& system_) : ServiceFramework{system_, "caps:ss"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {201, nullptr, "SaveScreenShot"}, 12 {201, nullptr, "SaveScreenShot"},
diff --git a/src/core/hle/service/caps/caps_ss.h b/src/core/hle/service/caps/caps_ss.h
index 450686e4f..1816f7885 100644
--- a/src/core/hle/service/caps/caps_ss.h
+++ b/src/core/hle/service/caps/caps_ss.h
@@ -6,15 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Kernel { 9namespace Core {
10class HLERequestContext; 10class System;
11} 11}
12 12
13namespace Service::Capture { 13namespace Service::Capture {
14 14
15class CAPS_SS final : public ServiceFramework<CAPS_SS> { 15class CAPS_SS final : public ServiceFramework<CAPS_SS> {
16public: 16public:
17 explicit CAPS_SS(); 17 explicit CAPS_SS(Core::System& system_);
18 ~CAPS_SS() override; 18 ~CAPS_SS() override;
19}; 19};
20 20
diff --git a/src/core/hle/service/caps/caps_su.cpp b/src/core/hle/service/caps/caps_su.cpp
index e386470f7..eae39eb7b 100644
--- a/src/core/hle/service/caps/caps_su.cpp
+++ b/src/core/hle/service/caps/caps_su.cpp
@@ -8,7 +8,7 @@
8 8
9namespace Service::Capture { 9namespace Service::Capture {
10 10
11CAPS_SU::CAPS_SU() : ServiceFramework("caps:su") { 11CAPS_SU::CAPS_SU(Core::System& system_) : ServiceFramework{system_, "caps:su"} {
12 // clang-format off 12 // clang-format off
13 static const FunctionInfo functions[] = { 13 static const FunctionInfo functions[] = {
14 {32, &CAPS_SU::SetShimLibraryVersion, "SetShimLibraryVersion"}, 14 {32, &CAPS_SU::SetShimLibraryVersion, "SetShimLibraryVersion"},
diff --git a/src/core/hle/service/caps/caps_su.h b/src/core/hle/service/caps/caps_su.h
index 62c9603a9..b366fdb13 100644
--- a/src/core/hle/service/caps/caps_su.h
+++ b/src/core/hle/service/caps/caps_su.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Kernel { 13namespace Kernel {
10class HLERequestContext; 14class HLERequestContext;
11} 15}
@@ -14,7 +18,7 @@ namespace Service::Capture {
14 18
15class CAPS_SU final : public ServiceFramework<CAPS_SU> { 19class CAPS_SU final : public ServiceFramework<CAPS_SU> {
16public: 20public:
17 explicit CAPS_SU(); 21 explicit CAPS_SU(Core::System& system_);
18 ~CAPS_SU() override; 22 ~CAPS_SU() override;
19 23
20private: 24private:
diff --git a/src/core/hle/service/caps/caps_u.cpp b/src/core/hle/service/caps/caps_u.cpp
index f9479bdb3..842316a2e 100644
--- a/src/core/hle/service/caps/caps_u.cpp
+++ b/src/core/hle/service/caps/caps_u.cpp
@@ -12,8 +12,8 @@ namespace Service::Capture {
12class IAlbumAccessorApplicationSession final 12class IAlbumAccessorApplicationSession final
13 : public ServiceFramework<IAlbumAccessorApplicationSession> { 13 : public ServiceFramework<IAlbumAccessorApplicationSession> {
14public: 14public:
15 explicit IAlbumAccessorApplicationSession() 15 explicit IAlbumAccessorApplicationSession(Core::System& system_)
16 : ServiceFramework{"IAlbumAccessorApplicationSession"} { 16 : ServiceFramework{system_, "IAlbumAccessorApplicationSession"} {
17 // clang-format off 17 // clang-format off
18 static const FunctionInfo functions[] = { 18 static const FunctionInfo functions[] = {
19 {2001, nullptr, "OpenAlbumMovieReadStream"}, 19 {2001, nullptr, "OpenAlbumMovieReadStream"},
@@ -28,7 +28,7 @@ public:
28 } 28 }
29}; 29};
30 30
31CAPS_U::CAPS_U() : ServiceFramework("caps:u") { 31CAPS_U::CAPS_U(Core::System& system_) : ServiceFramework{system_, "caps:u"} {
32 // clang-format off 32 // clang-format off
33 static const FunctionInfo functions[] = { 33 static const FunctionInfo functions[] = {
34 {32, &CAPS_U::SetShimLibraryVersion, "SetShimLibraryVersion"}, 34 {32, &CAPS_U::SetShimLibraryVersion, "SetShimLibraryVersion"},
diff --git a/src/core/hle/service/caps/caps_u.h b/src/core/hle/service/caps/caps_u.h
index 4b80f3156..e7e0d8775 100644
--- a/src/core/hle/service/caps/caps_u.h
+++ b/src/core/hle/service/caps/caps_u.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Kernel { 13namespace Kernel {
10class HLERequestContext; 14class HLERequestContext;
11} 15}
@@ -14,7 +18,7 @@ namespace Service::Capture {
14 18
15class CAPS_U final : public ServiceFramework<CAPS_U> { 19class CAPS_U final : public ServiceFramework<CAPS_U> {
16public: 20public:
17 explicit CAPS_U(); 21 explicit CAPS_U(Core::System& system_);
18 ~CAPS_U() override; 22 ~CAPS_U() override;
19 23
20private: 24private:
diff --git a/src/core/hle/service/erpt/erpt.cpp b/src/core/hle/service/erpt/erpt.cpp
index 4ec8c3093..4924c61c3 100644
--- a/src/core/hle/service/erpt/erpt.cpp
+++ b/src/core/hle/service/erpt/erpt.cpp
@@ -12,7 +12,7 @@ namespace Service::ERPT {
12 12
13class ErrorReportContext final : public ServiceFramework<ErrorReportContext> { 13class ErrorReportContext final : public ServiceFramework<ErrorReportContext> {
14public: 14public:
15 explicit ErrorReportContext() : ServiceFramework{"erpt:c"} { 15 explicit ErrorReportContext(Core::System& system_) : ServiceFramework{system_, "erpt:c"} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, nullptr, "SubmitContext"}, 18 {0, nullptr, "SubmitContext"},
@@ -35,7 +35,7 @@ public:
35 35
36class ErrorReportSession final : public ServiceFramework<ErrorReportSession> { 36class ErrorReportSession final : public ServiceFramework<ErrorReportSession> {
37public: 37public:
38 explicit ErrorReportSession() : ServiceFramework{"erpt:r"} { 38 explicit ErrorReportSession(Core::System& system_) : ServiceFramework{system_, "erpt:r"} {
39 // clang-format off 39 // clang-format off
40 static const FunctionInfo functions[] = { 40 static const FunctionInfo functions[] = {
41 {0, nullptr, "OpenReport"}, 41 {0, nullptr, "OpenReport"},
@@ -48,9 +48,9 @@ public:
48 } 48 }
49}; 49};
50 50
51void InstallInterfaces(SM::ServiceManager& sm) { 51void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
52 std::make_shared<ErrorReportContext>()->InstallAsService(sm); 52 std::make_shared<ErrorReportContext>(system)->InstallAsService(sm);
53 std::make_shared<ErrorReportSession>()->InstallAsService(sm); 53 std::make_shared<ErrorReportSession>(system)->InstallAsService(sm);
54} 54}
55 55
56} // namespace Service::ERPT 56} // namespace Service::ERPT
diff --git a/src/core/hle/service/erpt/erpt.h b/src/core/hle/service/erpt/erpt.h
index de439ab6d..8cd5c081f 100644
--- a/src/core/hle/service/erpt/erpt.h
+++ b/src/core/hle/service/erpt/erpt.h
@@ -4,6 +4,10 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
@@ -11,6 +15,6 @@ class ServiceManager;
11namespace Service::ERPT { 15namespace Service::ERPT {
12 16
13/// Registers all ERPT services with the specified service manager. 17/// Registers all ERPT services with the specified service manager.
14void InstallInterfaces(SM::ServiceManager& sm); 18void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
15 19
16} // namespace Service::ERPT 20} // namespace Service::ERPT
diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp
index c2737a365..26d1e3306 100644
--- a/src/core/hle/service/es/es.cpp
+++ b/src/core/hle/service/es/es.cpp
@@ -14,7 +14,7 @@ constexpr ResultCode ERROR_INVALID_RIGHTS_ID{ErrorModule::ETicket, 3};
14 14
15class ETicket final : public ServiceFramework<ETicket> { 15class ETicket final : public ServiceFramework<ETicket> {
16public: 16public:
17 explicit ETicket() : ServiceFramework{"es"} { 17 explicit ETicket(Core::System& system_) : ServiceFramework{system_, "es"} {
18 // clang-format off 18 // clang-format off
19 static const FunctionInfo functions[] = { 19 static const FunctionInfo functions[] = {
20 {1, &ETicket::ImportTicket, "ImportTicket"}, 20 {1, &ETicket::ImportTicket, "ImportTicket"},
@@ -305,8 +305,8 @@ private:
305 Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); 305 Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance();
306}; 306};
307 307
308void InstallInterfaces(SM::ServiceManager& service_manager) { 308void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
309 std::make_shared<ETicket>()->InstallAsService(service_manager); 309 std::make_shared<ETicket>(system)->InstallAsService(service_manager);
310} 310}
311 311
312} // namespace Service::ES 312} // namespace Service::ES
diff --git a/src/core/hle/service/es/es.h b/src/core/hle/service/es/es.h
index afe70465b..2a7b27d12 100644
--- a/src/core/hle/service/es/es.h
+++ b/src/core/hle/service/es/es.h
@@ -4,6 +4,10 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
@@ -11,6 +15,6 @@ class ServiceManager;
11namespace Service::ES { 15namespace Service::ES {
12 16
13/// Registers all ES services with the specified service manager. 17/// Registers all ES services with the specified service manager.
14void InstallInterfaces(SM::ServiceManager& service_manager); 18void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
15 19
16} // namespace Service::ES 20} // namespace Service::ES
diff --git a/src/core/hle/service/eupld/eupld.cpp b/src/core/hle/service/eupld/eupld.cpp
index 0d6d244f4..2d650b1b7 100644
--- a/src/core/hle/service/eupld/eupld.cpp
+++ b/src/core/hle/service/eupld/eupld.cpp
@@ -12,7 +12,7 @@ namespace Service::EUPLD {
12 12
13class ErrorUploadContext final : public ServiceFramework<ErrorUploadContext> { 13class ErrorUploadContext final : public ServiceFramework<ErrorUploadContext> {
14public: 14public:
15 explicit ErrorUploadContext() : ServiceFramework{"eupld:c"} { 15 explicit ErrorUploadContext(Core::System& system_) : ServiceFramework{system_, "eupld:c"} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, nullptr, "SetUrl"}, 18 {0, nullptr, "SetUrl"},
@@ -29,7 +29,7 @@ public:
29 29
30class ErrorUploadRequest final : public ServiceFramework<ErrorUploadRequest> { 30class ErrorUploadRequest final : public ServiceFramework<ErrorUploadRequest> {
31public: 31public:
32 explicit ErrorUploadRequest() : ServiceFramework{"eupld:r"} { 32 explicit ErrorUploadRequest(Core::System& system_) : ServiceFramework{system_, "eupld:r"} {
33 // clang-format off 33 // clang-format off
34 static const FunctionInfo functions[] = { 34 static const FunctionInfo functions[] = {
35 {0, nullptr, "Initialize"}, 35 {0, nullptr, "Initialize"},
@@ -45,9 +45,9 @@ public:
45 } 45 }
46}; 46};
47 47
48void InstallInterfaces(SM::ServiceManager& sm) { 48void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
49 std::make_shared<ErrorUploadContext>()->InstallAsService(sm); 49 std::make_shared<ErrorUploadContext>(system)->InstallAsService(sm);
50 std::make_shared<ErrorUploadRequest>()->InstallAsService(sm); 50 std::make_shared<ErrorUploadRequest>(system)->InstallAsService(sm);
51} 51}
52 52
53} // namespace Service::EUPLD 53} // namespace Service::EUPLD
diff --git a/src/core/hle/service/eupld/eupld.h b/src/core/hle/service/eupld/eupld.h
index 6eef2c15f..539993a9d 100644
--- a/src/core/hle/service/eupld/eupld.h
+++ b/src/core/hle/service/eupld/eupld.h
@@ -4,6 +4,10 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
@@ -11,6 +15,6 @@ class ServiceManager;
11namespace Service::EUPLD { 15namespace Service::EUPLD {
12 16
13/// Registers all EUPLD services with the specified service manager. 17/// Registers all EUPLD services with the specified service manager.
14void InstallInterfaces(SM::ServiceManager& sm); 18void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
15 19
16} // namespace Service::EUPLD 20} // namespace Service::EUPLD
diff --git a/src/core/hle/service/fatal/fatal.cpp b/src/core/hle/service/fatal/fatal.cpp
index 2546d7595..9b7672a91 100644
--- a/src/core/hle/service/fatal/fatal.cpp
+++ b/src/core/hle/service/fatal/fatal.cpp
@@ -20,8 +20,9 @@
20 20
21namespace Service::Fatal { 21namespace Service::Fatal {
22 22
23Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name) 23Module::Interface::Interface(std::shared_ptr<Module> module_, Core::System& system_,
24 : ServiceFramework(name), module(std::move(module)), system(system) {} 24 const char* name)
25 : ServiceFramework{system_, name}, module{std::move(module_)} {}
25 26
26Module::Interface::~Interface() = default; 27Module::Interface::~Interface() = default;
27 28
diff --git a/src/core/hle/service/fatal/fatal.h b/src/core/hle/service/fatal/fatal.h
index bd9339dfc..2095bf89f 100644
--- a/src/core/hle/service/fatal/fatal.h
+++ b/src/core/hle/service/fatal/fatal.h
@@ -16,7 +16,8 @@ class Module final {
16public: 16public:
17 class Interface : public ServiceFramework<Interface> { 17 class Interface : public ServiceFramework<Interface> {
18 public: 18 public:
19 explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name); 19 explicit Interface(std::shared_ptr<Module> module_, Core::System& system_,
20 const char* name);
20 ~Interface() override; 21 ~Interface() override;
21 22
22 void ThrowFatal(Kernel::HLERequestContext& ctx); 23 void ThrowFatal(Kernel::HLERequestContext& ctx);
@@ -25,7 +26,6 @@ public:
25 26
26 protected: 27 protected:
27 std::shared_ptr<Module> module; 28 std::shared_ptr<Module> module;
28 Core::System& system;
29 }; 29 };
30}; 30};
31 31
diff --git a/src/core/hle/service/fatal/fatal_p.cpp b/src/core/hle/service/fatal/fatal_p.cpp
index 066ccf6b0..8672b85dc 100644
--- a/src/core/hle/service/fatal/fatal_p.cpp
+++ b/src/core/hle/service/fatal/fatal_p.cpp
@@ -6,8 +6,8 @@
6 6
7namespace Service::Fatal { 7namespace Service::Fatal {
8 8
9Fatal_P::Fatal_P(std::shared_ptr<Module> module, Core::System& system) 9Fatal_P::Fatal_P(std::shared_ptr<Module> module_, Core::System& system_)
10 : Module::Interface(std::move(module), system, "fatal:p") {} 10 : Interface(std::move(module_), system_, "fatal:p") {}
11 11
12Fatal_P::~Fatal_P() = default; 12Fatal_P::~Fatal_P() = default;
13 13
diff --git a/src/core/hle/service/fatal/fatal_p.h b/src/core/hle/service/fatal/fatal_p.h
index c6d953cb5..ffa5b7b98 100644
--- a/src/core/hle/service/fatal/fatal_p.h
+++ b/src/core/hle/service/fatal/fatal_p.h
@@ -10,7 +10,7 @@ namespace Service::Fatal {
10 10
11class Fatal_P final : public Module::Interface { 11class Fatal_P final : public Module::Interface {
12public: 12public:
13 explicit Fatal_P(std::shared_ptr<Module> module, Core::System& system); 13 explicit Fatal_P(std::shared_ptr<Module> module_, Core::System& system_);
14 ~Fatal_P() override; 14 ~Fatal_P() override;
15}; 15};
16 16
diff --git a/src/core/hle/service/fatal/fatal_u.cpp b/src/core/hle/service/fatal/fatal_u.cpp
index 8d72ed485..82993938a 100644
--- a/src/core/hle/service/fatal/fatal_u.cpp
+++ b/src/core/hle/service/fatal/fatal_u.cpp
@@ -6,8 +6,8 @@
6 6
7namespace Service::Fatal { 7namespace Service::Fatal {
8 8
9Fatal_U::Fatal_U(std::shared_ptr<Module> module, Core::System& system) 9Fatal_U::Fatal_U(std::shared_ptr<Module> module_, Core::System& system_)
10 : Module::Interface(std::move(module), system, "fatal:u") { 10 : Interface(std::move(module_), system_, "fatal:u") {
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, &Fatal_U::ThrowFatal, "ThrowFatal"}, 12 {0, &Fatal_U::ThrowFatal, "ThrowFatal"},
13 {1, &Fatal_U::ThrowFatalWithPolicy, "ThrowFatalWithPolicy"}, 13 {1, &Fatal_U::ThrowFatalWithPolicy, "ThrowFatalWithPolicy"},
diff --git a/src/core/hle/service/fatal/fatal_u.h b/src/core/hle/service/fatal/fatal_u.h
index 34c5c7f95..0b58c9112 100644
--- a/src/core/hle/service/fatal/fatal_u.h
+++ b/src/core/hle/service/fatal/fatal_u.h
@@ -10,7 +10,7 @@ namespace Service::Fatal {
10 10
11class Fatal_U final : public Module::Interface { 11class Fatal_U final : public Module::Interface {
12public: 12public:
13 explicit Fatal_U(std::shared_ptr<Module> module, Core::System& system); 13 explicit Fatal_U(std::shared_ptr<Module> module_, Core::System& system_);
14 ~Fatal_U() override; 14 ~Fatal_U() override;
15}; 15};
16 16
diff --git a/src/core/hle/service/fgm/fgm.cpp b/src/core/hle/service/fgm/fgm.cpp
index e461274c1..9dc1bc52e 100644
--- a/src/core/hle/service/fgm/fgm.cpp
+++ b/src/core/hle/service/fgm/fgm.cpp
@@ -14,7 +14,7 @@ namespace Service::FGM {
14 14
15class IRequest final : public ServiceFramework<IRequest> { 15class IRequest final : public ServiceFramework<IRequest> {
16public: 16public:
17 explicit IRequest() : ServiceFramework{"IRequest"} { 17 explicit IRequest(Core::System& system_) : ServiceFramework{system_, "IRequest"} {
18 // clang-format off 18 // clang-format off
19 static const FunctionInfo functions[] = { 19 static const FunctionInfo functions[] = {
20 {0, nullptr, "Initialize"}, 20 {0, nullptr, "Initialize"},
@@ -30,7 +30,7 @@ public:
30 30
31class FGM final : public ServiceFramework<FGM> { 31class FGM final : public ServiceFramework<FGM> {
32public: 32public:
33 explicit FGM(const char* name) : ServiceFramework{name} { 33 explicit FGM(Core::System& system_, const char* name) : ServiceFramework{system_, name} {
34 // clang-format off 34 // clang-format off
35 static const FunctionInfo functions[] = { 35 static const FunctionInfo functions[] = {
36 {0, &FGM::Initialize, "Initialize"}, 36 {0, &FGM::Initialize, "Initialize"},
@@ -46,13 +46,13 @@ private:
46 46
47 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 47 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
48 rb.Push(RESULT_SUCCESS); 48 rb.Push(RESULT_SUCCESS);
49 rb.PushIpcInterface<IRequest>(); 49 rb.PushIpcInterface<IRequest>(system);
50 } 50 }
51}; 51};
52 52
53class FGM_DBG final : public ServiceFramework<FGM_DBG> { 53class FGM_DBG final : public ServiceFramework<FGM_DBG> {
54public: 54public:
55 explicit FGM_DBG() : ServiceFramework{"fgm:dbg"} { 55 explicit FGM_DBG(Core::System& system_) : ServiceFramework{system_, "fgm:dbg"} {
56 // clang-format off 56 // clang-format off
57 static const FunctionInfo functions[] = { 57 static const FunctionInfo functions[] = {
58 {0, nullptr, "Initialize"}, 58 {0, nullptr, "Initialize"},
@@ -65,11 +65,11 @@ public:
65 } 65 }
66}; 66};
67 67
68void InstallInterfaces(SM::ServiceManager& sm) { 68void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
69 std::make_shared<FGM>("fgm")->InstallAsService(sm); 69 std::make_shared<FGM>(system, "fgm")->InstallAsService(sm);
70 std::make_shared<FGM>("fgm:0")->InstallAsService(sm); 70 std::make_shared<FGM>(system, "fgm:0")->InstallAsService(sm);
71 std::make_shared<FGM>("fgm:9")->InstallAsService(sm); 71 std::make_shared<FGM>(system, "fgm:9")->InstallAsService(sm);
72 std::make_shared<FGM_DBG>()->InstallAsService(sm); 72 std::make_shared<FGM_DBG>(system)->InstallAsService(sm);
73} 73}
74 74
75} // namespace Service::FGM 75} // namespace Service::FGM
diff --git a/src/core/hle/service/fgm/fgm.h b/src/core/hle/service/fgm/fgm.h
index e59691264..75978f2ed 100644
--- a/src/core/hle/service/fgm/fgm.h
+++ b/src/core/hle/service/fgm/fgm.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::FGM { 15namespace Service::FGM {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::FGM 19} // namespace Service::FGM
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index 2e53cae5b..af97561e4 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -728,11 +728,9 @@ void FileSystemController::CreateFactories(FileSys::VfsFilesystem& vfs, bool ove
728} 728}
729 729
730void InstallInterfaces(Core::System& system) { 730void InstallInterfaces(Core::System& system) {
731 std::make_shared<FSP_LDR>()->InstallAsService(system.ServiceManager()); 731 std::make_shared<FSP_LDR>(system)->InstallAsService(system.ServiceManager());
732 std::make_shared<FSP_PR>()->InstallAsService(system.ServiceManager()); 732 std::make_shared<FSP_PR>(system)->InstallAsService(system.ServiceManager());
733 std::make_shared<FSP_SRV>(system.GetFileSystemController(), system.GetContentProvider(), 733 std::make_shared<FSP_SRV>(system)->InstallAsService(system.ServiceManager());
734 system.GetReporter())
735 ->InstallAsService(system.ServiceManager());
736} 734}
737 735
738} // namespace Service::FileSystem 736} // namespace Service::FileSystem
diff --git a/src/core/hle/service/filesystem/fsp_ldr.cpp b/src/core/hle/service/filesystem/fsp_ldr.cpp
index fb487d5bc..1f6c17ba5 100644
--- a/src/core/hle/service/filesystem/fsp_ldr.cpp
+++ b/src/core/hle/service/filesystem/fsp_ldr.cpp
@@ -7,7 +7,7 @@
7 7
8namespace Service::FileSystem { 8namespace Service::FileSystem {
9 9
10FSP_LDR::FSP_LDR() : ServiceFramework{"fsp:ldr"} { 10FSP_LDR::FSP_LDR(Core::System& system_) : ServiceFramework{system_, "fsp:ldr"} {
11 // clang-format off 11 // clang-format off
12 static const FunctionInfo functions[] = { 12 static const FunctionInfo functions[] = {
13 {0, nullptr, "OpenCodeFileSystem"}, 13 {0, nullptr, "OpenCodeFileSystem"},
diff --git a/src/core/hle/service/filesystem/fsp_ldr.h b/src/core/hle/service/filesystem/fsp_ldr.h
index 8210b7729..d6432a0e1 100644
--- a/src/core/hle/service/filesystem/fsp_ldr.h
+++ b/src/core/hle/service/filesystem/fsp_ldr.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::FileSystem { 13namespace Service::FileSystem {
10 14
11class FSP_LDR final : public ServiceFramework<FSP_LDR> { 15class FSP_LDR final : public ServiceFramework<FSP_LDR> {
12public: 16public:
13 explicit FSP_LDR(); 17 explicit FSP_LDR(Core::System& system_);
14 ~FSP_LDR() override; 18 ~FSP_LDR() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/filesystem/fsp_pr.cpp b/src/core/hle/service/filesystem/fsp_pr.cpp
index 378201610..00e4d1662 100644
--- a/src/core/hle/service/filesystem/fsp_pr.cpp
+++ b/src/core/hle/service/filesystem/fsp_pr.cpp
@@ -7,7 +7,7 @@
7 7
8namespace Service::FileSystem { 8namespace Service::FileSystem {
9 9
10FSP_PR::FSP_PR() : ServiceFramework{"fsp:pr"} { 10FSP_PR::FSP_PR(Core::System& system_) : ServiceFramework{system_, "fsp:pr"} {
11 // clang-format off 11 // clang-format off
12 static const FunctionInfo functions[] = { 12 static const FunctionInfo functions[] = {
13 {0, nullptr, "RegisterProgram"}, 13 {0, nullptr, "RegisterProgram"},
diff --git a/src/core/hle/service/filesystem/fsp_pr.h b/src/core/hle/service/filesystem/fsp_pr.h
index 556ae5ce9..9e622518c 100644
--- a/src/core/hle/service/filesystem/fsp_pr.h
+++ b/src/core/hle/service/filesystem/fsp_pr.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::FileSystem { 13namespace Service::FileSystem {
10 14
11class FSP_PR final : public ServiceFramework<FSP_PR> { 15class FSP_PR final : public ServiceFramework<FSP_PR> {
12public: 16public:
13 explicit FSP_PR(); 17 explicit FSP_PR(Core::System& system_);
14 ~FSP_PR() override; 18 ~FSP_PR() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index 031c6dbf6..b3480494c 100644
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -14,6 +14,7 @@
14#include "common/hex_util.h" 14#include "common/hex_util.h"
15#include "common/logging/log.h" 15#include "common/logging/log.h"
16#include "common/string_util.h" 16#include "common/string_util.h"
17#include "core/core.h"
17#include "core/file_sys/directory.h" 18#include "core/file_sys/directory.h"
18#include "core/file_sys/errors.h" 19#include "core/file_sys/errors.h"
19#include "core/file_sys/mode.h" 20#include "core/file_sys/mode.h"
@@ -56,8 +57,8 @@ enum class FileSystemType : u8 {
56 57
57class IStorage final : public ServiceFramework<IStorage> { 58class IStorage final : public ServiceFramework<IStorage> {
58public: 59public:
59 explicit IStorage(FileSys::VirtualFile backend_) 60 explicit IStorage(Core::System& system_, FileSys::VirtualFile backend_)
60 : ServiceFramework("IStorage"), backend(std::move(backend_)) { 61 : ServiceFramework{system_, "IStorage"}, backend(std::move(backend_)) {
61 static const FunctionInfo functions[] = { 62 static const FunctionInfo functions[] = {
62 {0, &IStorage::Read, "Read"}, 63 {0, &IStorage::Read, "Read"},
63 {1, nullptr, "Write"}, 64 {1, nullptr, "Write"},
@@ -114,8 +115,8 @@ private:
114 115
115class IFile final : public ServiceFramework<IFile> { 116class IFile final : public ServiceFramework<IFile> {
116public: 117public:
117 explicit IFile(FileSys::VirtualFile backend_) 118 explicit IFile(Core::System& system_, FileSys::VirtualFile backend_)
118 : ServiceFramework("IFile"), backend(std::move(backend_)) { 119 : ServiceFramework{system_, "IFile"}, backend(std::move(backend_)) {
119 static const FunctionInfo functions[] = { 120 static const FunctionInfo functions[] = {
120 {0, &IFile::Read, "Read"}, {1, &IFile::Write, "Write"}, 121 {0, &IFile::Read, "Read"}, {1, &IFile::Write, "Write"},
121 {2, &IFile::Flush, "Flush"}, {3, &IFile::SetSize, "SetSize"}, 122 {2, &IFile::Flush, "Flush"}, {3, &IFile::SetSize, "SetSize"},
@@ -246,8 +247,8 @@ static void BuildEntryIndex(std::vector<FileSys::Entry>& entries, const std::vec
246 247
247class IDirectory final : public ServiceFramework<IDirectory> { 248class IDirectory final : public ServiceFramework<IDirectory> {
248public: 249public:
249 explicit IDirectory(FileSys::VirtualDir backend_) 250 explicit IDirectory(Core::System& system_, FileSys::VirtualDir backend_)
250 : ServiceFramework("IDirectory"), backend(std::move(backend_)) { 251 : ServiceFramework{system_, "IDirectory"}, backend(std::move(backend_)) {
251 static const FunctionInfo functions[] = { 252 static const FunctionInfo functions[] = {
252 {0, &IDirectory::Read, "Read"}, 253 {0, &IDirectory::Read, "Read"},
253 {1, &IDirectory::GetEntryCount, "GetEntryCount"}, 254 {1, &IDirectory::GetEntryCount, "GetEntryCount"},
@@ -302,8 +303,9 @@ private:
302 303
303class IFileSystem final : public ServiceFramework<IFileSystem> { 304class IFileSystem final : public ServiceFramework<IFileSystem> {
304public: 305public:
305 explicit IFileSystem(FileSys::VirtualDir backend, SizeGetter size) 306 explicit IFileSystem(Core::System& system_, FileSys::VirtualDir backend_, SizeGetter size_)
306 : ServiceFramework("IFileSystem"), backend(std::move(backend)), size(std::move(size)) { 307 : ServiceFramework{system_, "IFileSystem"}, backend{std::move(backend_)}, size{std::move(
308 size_)} {
307 static const FunctionInfo functions[] = { 309 static const FunctionInfo functions[] = {
308 {0, &IFileSystem::CreateFile, "CreateFile"}, 310 {0, &IFileSystem::CreateFile, "CreateFile"},
309 {1, &IFileSystem::DeleteFile, "DeleteFile"}, 311 {1, &IFileSystem::DeleteFile, "DeleteFile"},
@@ -420,7 +422,7 @@ public:
420 return; 422 return;
421 } 423 }
422 424
423 auto file = std::make_shared<IFile>(result.Unwrap()); 425 auto file = std::make_shared<IFile>(system, result.Unwrap());
424 426
425 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 427 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
426 rb.Push(RESULT_SUCCESS); 428 rb.Push(RESULT_SUCCESS);
@@ -445,7 +447,7 @@ public:
445 return; 447 return;
446 } 448 }
447 449
448 auto directory = std::make_shared<IDirectory>(result.Unwrap()); 450 auto directory = std::make_shared<IDirectory>(system, result.Unwrap());
449 451
450 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 452 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
451 rb.Push(RESULT_SUCCESS); 453 rb.Push(RESULT_SUCCESS);
@@ -500,8 +502,9 @@ private:
500 502
501class ISaveDataInfoReader final : public ServiceFramework<ISaveDataInfoReader> { 503class ISaveDataInfoReader final : public ServiceFramework<ISaveDataInfoReader> {
502public: 504public:
503 explicit ISaveDataInfoReader(FileSys::SaveDataSpaceId space, FileSystemController& fsc) 505 explicit ISaveDataInfoReader(Core::System& system_, FileSys::SaveDataSpaceId space,
504 : ServiceFramework("ISaveDataInfoReader"), fsc(fsc) { 506 FileSystemController& fsc_)
507 : ServiceFramework{system_, "ISaveDataInfoReader"}, fsc{fsc_} {
505 static const FunctionInfo functions[] = { 508 static const FunctionInfo functions[] = {
506 {0, &ISaveDataInfoReader::ReadSaveDataInfo, "ReadSaveDataInfo"}, 509 {0, &ISaveDataInfoReader::ReadSaveDataInfo, "ReadSaveDataInfo"},
507 }; 510 };
@@ -650,10 +653,9 @@ private:
650 u64 next_entry_index = 0; 653 u64 next_entry_index = 0;
651}; 654};
652 655
653FSP_SRV::FSP_SRV(FileSystemController& fsc_, const FileSys::ContentProvider& content_provider_, 656FSP_SRV::FSP_SRV(Core::System& system_)
654 const Core::Reporter& reporter_) 657 : ServiceFramework{system_, "fsp-srv"}, fsc{system.GetFileSystemController()},
655 : ServiceFramework("fsp-srv"), fsc(fsc_), content_provider{content_provider_}, 658 content_provider{system.GetContentProvider()}, reporter{system.GetReporter()} {
656 reporter(reporter_) {
657 // clang-format off 659 // clang-format off
658 static const FunctionInfo functions[] = { 660 static const FunctionInfo functions[] = {
659 {0, nullptr, "OpenFileSystem"}, 661 {0, nullptr, "OpenFileSystem"},
@@ -803,8 +805,9 @@ void FSP_SRV::OpenFileSystemWithPatch(Kernel::HLERequestContext& ctx) {
803void FSP_SRV::OpenSdCardFileSystem(Kernel::HLERequestContext& ctx) { 805void FSP_SRV::OpenSdCardFileSystem(Kernel::HLERequestContext& ctx) {
804 LOG_DEBUG(Service_FS, "called"); 806 LOG_DEBUG(Service_FS, "called");
805 807
806 auto filesystem = std::make_shared<IFileSystem>( 808 auto filesystem =
807 fsc.OpenSDMC().Unwrap(), SizeGetter::FromStorageId(fsc, FileSys::StorageId::SdCard)); 809 std::make_shared<IFileSystem>(system, fsc.OpenSDMC().Unwrap(),
810 SizeGetter::FromStorageId(fsc, FileSys::StorageId::SdCard));
808 811
809 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 812 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
810 rb.Push(RESULT_SUCCESS); 813 rb.Push(RESULT_SUCCESS);
@@ -864,8 +867,8 @@ void FSP_SRV::OpenSaveDataFileSystem(Kernel::HLERequestContext& ctx) {
864 UNREACHABLE(); 867 UNREACHABLE();
865 } 868 }
866 869
867 auto filesystem = 870 auto filesystem = std::make_shared<IFileSystem>(system, std::move(dir.Unwrap()),
868 std::make_shared<IFileSystem>(std::move(dir.Unwrap()), SizeGetter::FromStorageId(fsc, id)); 871 SizeGetter::FromStorageId(fsc, id));
869 872
870 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 873 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
871 rb.Push(RESULT_SUCCESS); 874 rb.Push(RESULT_SUCCESS);
@@ -884,7 +887,8 @@ void FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(Kernel::HLERequestContext&
884 887
885 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 888 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
886 rb.Push(RESULT_SUCCESS); 889 rb.Push(RESULT_SUCCESS);
887 rb.PushIpcInterface<ISaveDataInfoReader>(std::make_shared<ISaveDataInfoReader>(space, fsc)); 890 rb.PushIpcInterface<ISaveDataInfoReader>(
891 std::make_shared<ISaveDataInfoReader>(system, space, fsc));
888} 892}
889 893
890void FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute(Kernel::HLERequestContext& ctx) { 894void FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute(Kernel::HLERequestContext& ctx) {
@@ -933,7 +937,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
933 return; 937 return;
934 } 938 }
935 939
936 auto storage = std::make_shared<IStorage>(std::move(romfs.Unwrap())); 940 auto storage = std::make_shared<IStorage>(system, std::move(romfs.Unwrap()));
937 941
938 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 942 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
939 rb.Push(RESULT_SUCCESS); 943 rb.Push(RESULT_SUCCESS);
@@ -957,7 +961,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) {
957 if (archive != nullptr) { 961 if (archive != nullptr) {
958 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 962 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
959 rb.Push(RESULT_SUCCESS); 963 rb.Push(RESULT_SUCCESS);
960 rb.PushIpcInterface(std::make_shared<IStorage>(archive)); 964 rb.PushIpcInterface(std::make_shared<IStorage>(system, archive));
961 return; 965 return;
962 } 966 }
963 967
@@ -973,7 +977,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) {
973 const FileSys::PatchManager pm{title_id, fsc, content_provider}; 977 const FileSys::PatchManager pm{title_id, fsc, content_provider};
974 978
975 auto storage = std::make_shared<IStorage>( 979 auto storage = std::make_shared<IStorage>(
976 pm.PatchRomFS(std::move(data.Unwrap()), 0, FileSys::ContentRecordType::Data)); 980 system, pm.PatchRomFS(std::move(data.Unwrap()), 0, FileSys::ContentRecordType::Data));
977 981
978 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 982 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
979 rb.Push(RESULT_SUCCESS); 983 rb.Push(RESULT_SUCCESS);
@@ -1035,7 +1039,8 @@ void FSP_SRV::GetAccessLogVersionInfo(Kernel::HLERequestContext& ctx) {
1035 1039
1036class IMultiCommitManager final : public ServiceFramework<IMultiCommitManager> { 1040class IMultiCommitManager final : public ServiceFramework<IMultiCommitManager> {
1037public: 1041public:
1038 explicit IMultiCommitManager() : ServiceFramework("IMultiCommitManager") { 1042 explicit IMultiCommitManager(Core::System& system_)
1043 : ServiceFramework{system_, "IMultiCommitManager"} {
1039 static const FunctionInfo functions[] = { 1044 static const FunctionInfo functions[] = {
1040 {1, &IMultiCommitManager::Add, "Add"}, 1045 {1, &IMultiCommitManager::Add, "Add"},
1041 {2, &IMultiCommitManager::Commit, "Commit"}, 1046 {2, &IMultiCommitManager::Commit, "Commit"},
@@ -1066,7 +1071,7 @@ void FSP_SRV::OpenMultiCommitManager(Kernel::HLERequestContext& ctx) {
1066 1071
1067 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 1072 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
1068 rb.Push(RESULT_SUCCESS); 1073 rb.Push(RESULT_SUCCESS);
1069 rb.PushIpcInterface<IMultiCommitManager>(std::make_shared<IMultiCommitManager>()); 1074 rb.PushIpcInterface<IMultiCommitManager>(std::make_shared<IMultiCommitManager>(system));
1070} 1075}
1071 1076
1072} // namespace Service::FileSystem 1077} // namespace Service::FileSystem
diff --git a/src/core/hle/service/filesystem/fsp_srv.h b/src/core/hle/service/filesystem/fsp_srv.h
index 6c7239e6a..472286d6e 100644
--- a/src/core/hle/service/filesystem/fsp_srv.h
+++ b/src/core/hle/service/filesystem/fsp_srv.h
@@ -33,8 +33,7 @@ enum class LogMode : u32 {
33 33
34class FSP_SRV final : public ServiceFramework<FSP_SRV> { 34class FSP_SRV final : public ServiceFramework<FSP_SRV> {
35public: 35public:
36 explicit FSP_SRV(FileSystemController& fsc_, const FileSys::ContentProvider& content_provider_, 36 explicit FSP_SRV(Core::System& system_);
37 const Core::Reporter& reporter_);
38 ~FSP_SRV() override; 37 ~FSP_SRV() override;
39 38
40private: 39private:
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp
index ebb323da2..40a289594 100644
--- a/src/core/hle/service/friend/friend.cpp
+++ b/src/core/hle/service/friend/friend.cpp
@@ -17,7 +17,7 @@ namespace Service::Friend {
17 17
18class IFriendService final : public ServiceFramework<IFriendService> { 18class IFriendService final : public ServiceFramework<IFriendService> {
19public: 19public:
20 IFriendService() : ServiceFramework("IFriendService") { 20 explicit IFriendService(Core::System& system_) : ServiceFramework{system_, "IFriendService"} {
21 // clang-format off 21 // clang-format off
22 static const FunctionInfo functions[] = { 22 static const FunctionInfo functions[] = {
23 {0, nullptr, "GetCompletionEvent"}, 23 {0, nullptr, "GetCompletionEvent"},
@@ -171,8 +171,8 @@ private:
171 171
172class INotificationService final : public ServiceFramework<INotificationService> { 172class INotificationService final : public ServiceFramework<INotificationService> {
173public: 173public:
174 INotificationService(Common::UUID uuid, Core::System& system) 174 explicit INotificationService(Common::UUID uuid_, Core::System& system_)
175 : ServiceFramework("INotificationService"), uuid(uuid) { 175 : ServiceFramework{system_, "INotificationService"}, uuid{uuid_} {
176 // clang-format off 176 // clang-format off
177 static const FunctionInfo functions[] = { 177 static const FunctionInfo functions[] = {
178 {0, &INotificationService::GetEvent, "GetEvent"}, 178 {0, &INotificationService::GetEvent, "GetEvent"},
@@ -267,7 +267,7 @@ private:
267void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) { 267void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) {
268 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 268 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
269 rb.Push(RESULT_SUCCESS); 269 rb.Push(RESULT_SUCCESS);
270 rb.PushIpcInterface<IFriendService>(); 270 rb.PushIpcInterface<IFriendService>(system);
271 LOG_DEBUG(Service_ACC, "called"); 271 LOG_DEBUG(Service_ACC, "called");
272} 272}
273 273
@@ -282,8 +282,9 @@ void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx
282 rb.PushIpcInterface<INotificationService>(uuid, system); 282 rb.PushIpcInterface<INotificationService>(uuid, system);
283} 283}
284 284
285Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name) 285Module::Interface::Interface(std::shared_ptr<Module> module_, Core::System& system_,
286 : ServiceFramework(name), module(std::move(module)), system(system) {} 286 const char* name)
287 : ServiceFramework{system_, name}, module{std::move(module_)} {}
287 288
288Module::Interface::~Interface() = default; 289Module::Interface::~Interface() = default;
289 290
diff --git a/src/core/hle/service/friend/friend.h b/src/core/hle/service/friend/friend.h
index 24f3fc969..8be3321db 100644
--- a/src/core/hle/service/friend/friend.h
+++ b/src/core/hle/service/friend/friend.h
@@ -16,7 +16,8 @@ class Module final {
16public: 16public:
17 class Interface : public ServiceFramework<Interface> { 17 class Interface : public ServiceFramework<Interface> {
18 public: 18 public:
19 explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name); 19 explicit Interface(std::shared_ptr<Module> module_, Core::System& system_,
20 const char* name);
20 ~Interface() override; 21 ~Interface() override;
21 22
22 void CreateFriendService(Kernel::HLERequestContext& ctx); 23 void CreateFriendService(Kernel::HLERequestContext& ctx);
@@ -24,7 +25,6 @@ public:
24 25
25 protected: 26 protected:
26 std::shared_ptr<Module> module; 27 std::shared_ptr<Module> module;
27 Core::System& system;
28 }; 28 };
29}; 29};
30 30
diff --git a/src/core/hle/service/friend/interface.cpp b/src/core/hle/service/friend/interface.cpp
index 58155f652..7368ccec2 100644
--- a/src/core/hle/service/friend/interface.cpp
+++ b/src/core/hle/service/friend/interface.cpp
@@ -6,8 +6,8 @@
6 6
7namespace Service::Friend { 7namespace Service::Friend {
8 8
9Friend::Friend(std::shared_ptr<Module> module, Core::System& system, const char* name) 9Friend::Friend(std::shared_ptr<Module> module_, Core::System& system_, const char* name)
10 : Interface(std::move(module), system, name) { 10 : Interface(std::move(module_), system_, name) {
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, &Friend::CreateFriendService, "CreateFriendService"}, 12 {0, &Friend::CreateFriendService, "CreateFriendService"},
13 {1, &Friend::CreateNotificationService, "CreateNotificationService"}, 13 {1, &Friend::CreateNotificationService, "CreateNotificationService"},
diff --git a/src/core/hle/service/friend/interface.h b/src/core/hle/service/friend/interface.h
index 465a35770..43d914b32 100644
--- a/src/core/hle/service/friend/interface.h
+++ b/src/core/hle/service/friend/interface.h
@@ -10,7 +10,7 @@ namespace Service::Friend {
10 10
11class Friend final : public Module::Interface { 11class Friend final : public Module::Interface {
12public: 12public:
13 explicit Friend(std::shared_ptr<Module> module, Core::System& system, const char* name); 13 explicit Friend(std::shared_ptr<Module> module_, Core::System& system_, const char* name);
14 ~Friend() override; 14 ~Friend() override;
15}; 15};
16 16
diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp
index c6252ff89..fc77e7286 100644
--- a/src/core/hle/service/glue/arp.cpp
+++ b/src/core/hle/service/glue/arp.cpp
@@ -33,8 +33,8 @@ std::optional<u64> GetTitleIDForProcessID(const Core::System& system, u64 proces
33} 33}
34} // Anonymous namespace 34} // Anonymous namespace
35 35
36ARP_R::ARP_R(const Core::System& system, const ARPManager& manager) 36ARP_R::ARP_R(Core::System& system_, const ARPManager& manager_)
37 : ServiceFramework{"arp:r"}, system(system), manager(manager) { 37 : ServiceFramework{system_, "arp:r"}, manager{manager_} {
38 // clang-format off 38 // clang-format off
39 static const FunctionInfo functions[] = { 39 static const FunctionInfo functions[] = {
40 {0, &ARP_R::GetApplicationLaunchProperty, "GetApplicationLaunchProperty"}, 40 {0, &ARP_R::GetApplicationLaunchProperty, "GetApplicationLaunchProperty"},
@@ -152,8 +152,9 @@ class IRegistrar final : public ServiceFramework<IRegistrar> {
152 152
153public: 153public:
154 explicit IRegistrar( 154 explicit IRegistrar(
155 Core::System& system_,
155 std::function<ResultCode(u64, ApplicationLaunchProperty, std::vector<u8>)> issuer) 156 std::function<ResultCode(u64, ApplicationLaunchProperty, std::vector<u8>)> issuer)
156 : ServiceFramework{"IRegistrar"}, issue_process_id(std::move(issuer)) { 157 : ServiceFramework{system_, "IRegistrar"}, issue_process_id{std::move(issuer)} {
157 // clang-format off 158 // clang-format off
158 static const FunctionInfo functions[] = { 159 static const FunctionInfo functions[] = {
159 {0, &IRegistrar::Issue, "Issue"}, 160 {0, &IRegistrar::Issue, "Issue"},
@@ -237,8 +238,8 @@ private:
237 std::vector<u8> control; 238 std::vector<u8> control;
238}; 239};
239 240
240ARP_W::ARP_W(const Core::System& system, ARPManager& manager) 241ARP_W::ARP_W(Core::System& system_, ARPManager& manager_)
241 : ServiceFramework{"arp:w"}, system(system), manager(manager) { 242 : ServiceFramework{system_, "arp:w"}, manager{manager_} {
242 // clang-format off 243 // clang-format off
243 static const FunctionInfo functions[] = { 244 static const FunctionInfo functions[] = {
244 {0, &ARP_W::AcquireRegistrar, "AcquireRegistrar"}, 245 {0, &ARP_W::AcquireRegistrar, "AcquireRegistrar"},
@@ -255,7 +256,7 @@ void ARP_W::AcquireRegistrar(Kernel::HLERequestContext& ctx) {
255 LOG_DEBUG(Service_ARP, "called"); 256 LOG_DEBUG(Service_ARP, "called");
256 257
257 registrar = std::make_shared<IRegistrar>( 258 registrar = std::make_shared<IRegistrar>(
258 [this](u64 process_id, ApplicationLaunchProperty launch, std::vector<u8> control) { 259 system, [this](u64 process_id, ApplicationLaunchProperty launch, std::vector<u8> control) {
259 const auto res = GetTitleIDForProcessID(system, process_id); 260 const auto res = GetTitleIDForProcessID(system, process_id);
260 if (!res.has_value()) { 261 if (!res.has_value()) {
261 return ERR_NOT_REGISTERED; 262 return ERR_NOT_REGISTERED;
diff --git a/src/core/hle/service/glue/arp.h b/src/core/hle/service/glue/arp.h
index d5f8a7e7a..34b412e26 100644
--- a/src/core/hle/service/glue/arp.h
+++ b/src/core/hle/service/glue/arp.h
@@ -13,7 +13,7 @@ class IRegistrar;
13 13
14class ARP_R final : public ServiceFramework<ARP_R> { 14class ARP_R final : public ServiceFramework<ARP_R> {
15public: 15public:
16 explicit ARP_R(const Core::System& system, const ARPManager& manager); 16 explicit ARP_R(Core::System& system_, const ARPManager& manager_);
17 ~ARP_R() override; 17 ~ARP_R() override;
18 18
19private: 19private:
@@ -22,20 +22,18 @@ private:
22 void GetApplicationControlProperty(Kernel::HLERequestContext& ctx); 22 void GetApplicationControlProperty(Kernel::HLERequestContext& ctx);
23 void GetApplicationControlPropertyWithApplicationId(Kernel::HLERequestContext& ctx); 23 void GetApplicationControlPropertyWithApplicationId(Kernel::HLERequestContext& ctx);
24 24
25 const Core::System& system;
26 const ARPManager& manager; 25 const ARPManager& manager;
27}; 26};
28 27
29class ARP_W final : public ServiceFramework<ARP_W> { 28class ARP_W final : public ServiceFramework<ARP_W> {
30public: 29public:
31 explicit ARP_W(const Core::System& system, ARPManager& manager); 30 explicit ARP_W(Core::System& system_, ARPManager& manager_);
32 ~ARP_W() override; 31 ~ARP_W() override;
33 32
34private: 33private:
35 void AcquireRegistrar(Kernel::HLERequestContext& ctx); 34 void AcquireRegistrar(Kernel::HLERequestContext& ctx);
36 void DeleteProperties(Kernel::HLERequestContext& ctx); 35 void DeleteProperties(Kernel::HLERequestContext& ctx);
37 36
38 const Core::System& system;
39 ARPManager& manager; 37 ARPManager& manager;
40 std::shared_ptr<IRegistrar> registrar; 38 std::shared_ptr<IRegistrar> registrar;
41}; 39};
diff --git a/src/core/hle/service/glue/bgtc.cpp b/src/core/hle/service/glue/bgtc.cpp
index cd89d088f..a478b68e1 100644
--- a/src/core/hle/service/glue/bgtc.cpp
+++ b/src/core/hle/service/glue/bgtc.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::Glue { 7namespace Service::Glue {
8 8
9BGTC_T::BGTC_T() : ServiceFramework{"bgtc:t"} { 9BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {1, nullptr, "NotifyTaskStarting"}, 12 {1, nullptr, "NotifyTaskStarting"},
@@ -31,7 +31,7 @@ BGTC_T::BGTC_T() : ServiceFramework{"bgtc:t"} {
31 31
32BGTC_T::~BGTC_T() = default; 32BGTC_T::~BGTC_T() = default;
33 33
34BGTC_SC::BGTC_SC() : ServiceFramework{"bgtc:sc"} { 34BGTC_SC::BGTC_SC(Core::System& system_) : ServiceFramework{system_, "bgtc:sc"} {
35 // clang-format off 35 // clang-format off
36 static const FunctionInfo functions[] = { 36 static const FunctionInfo functions[] = {
37 {1, nullptr, "GetState"}, 37 {1, nullptr, "GetState"},
diff --git a/src/core/hle/service/glue/bgtc.h b/src/core/hle/service/glue/bgtc.h
index 81844f03e..906116ba6 100644
--- a/src/core/hle/service/glue/bgtc.h
+++ b/src/core/hle/service/glue/bgtc.h
@@ -6,17 +6,21 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Glue { 13namespace Service::Glue {
10 14
11class BGTC_T final : public ServiceFramework<BGTC_T> { 15class BGTC_T final : public ServiceFramework<BGTC_T> {
12public: 16public:
13 BGTC_T(); 17 explicit BGTC_T(Core::System& system_);
14 ~BGTC_T() override; 18 ~BGTC_T() override;
15}; 19};
16 20
17class BGTC_SC final : public ServiceFramework<BGTC_SC> { 21class BGTC_SC final : public ServiceFramework<BGTC_SC> {
18public: 22public:
19 BGTC_SC(); 23 explicit BGTC_SC(Core::System& system_);
20 ~BGTC_SC() override; 24 ~BGTC_SC() override;
21}; 25};
22 26
diff --git a/src/core/hle/service/glue/glue.cpp b/src/core/hle/service/glue/glue.cpp
index c728e815c..4eafbe5fa 100644
--- a/src/core/hle/service/glue/glue.cpp
+++ b/src/core/hle/service/glue/glue.cpp
@@ -18,8 +18,8 @@ void InstallInterfaces(Core::System& system) {
18 ->InstallAsService(system.ServiceManager()); 18 ->InstallAsService(system.ServiceManager());
19 19
20 // BackGround Task Controller 20 // BackGround Task Controller
21 std::make_shared<BGTC_T>()->InstallAsService(system.ServiceManager()); 21 std::make_shared<BGTC_T>(system)->InstallAsService(system.ServiceManager());
22 std::make_shared<BGTC_SC>()->InstallAsService(system.ServiceManager()); 22 std::make_shared<BGTC_SC>(system)->InstallAsService(system.ServiceManager());
23} 23}
24 24
25} // namespace Service::Glue 25} // namespace Service::Glue
diff --git a/src/core/hle/service/grc/grc.cpp b/src/core/hle/service/grc/grc.cpp
index 401e0b208..a502ab47f 100644
--- a/src/core/hle/service/grc/grc.cpp
+++ b/src/core/hle/service/grc/grc.cpp
@@ -12,7 +12,7 @@ namespace Service::GRC {
12 12
13class GRC final : public ServiceFramework<GRC> { 13class GRC final : public ServiceFramework<GRC> {
14public: 14public:
15 explicit GRC() : ServiceFramework{"grc:c"} { 15 explicit GRC(Core::System& system) : ServiceFramework{system, "grc:c"} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {1, nullptr, "OpenContinuousRecorder"}, 18 {1, nullptr, "OpenContinuousRecorder"},
@@ -27,8 +27,8 @@ public:
27 } 27 }
28}; 28};
29 29
30void InstallInterfaces(SM::ServiceManager& sm) { 30void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
31 std::make_shared<GRC>()->InstallAsService(sm); 31 std::make_shared<GRC>(system)->InstallAsService(sm);
32} 32}
33 33
34} // namespace Service::GRC 34} // namespace Service::GRC
diff --git a/src/core/hle/service/grc/grc.h b/src/core/hle/service/grc/grc.h
index e0d29e70d..9069fe756 100644
--- a/src/core/hle/service/grc/grc.h
+++ b/src/core/hle/service/grc/grc.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::GRC { 15namespace Service::GRC {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::GRC 19} // namespace Service::GRC
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 902516b29..80804b483 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -44,8 +44,8 @@ constexpr auto pad_update_ns = std::chrono::nanoseconds{1000 * 1000}; //
44constexpr auto motion_update_ns = std::chrono::nanoseconds{15 * 1000 * 1000}; // (15ms, 66.666Hz) 44constexpr auto motion_update_ns = std::chrono::nanoseconds{15 * 1000 * 1000}; // (15ms, 66.666Hz)
45constexpr std::size_t SHARED_MEMORY_SIZE = 0x40000; 45constexpr std::size_t SHARED_MEMORY_SIZE = 0x40000;
46 46
47IAppletResource::IAppletResource(Core::System& system) 47IAppletResource::IAppletResource(Core::System& system_)
48 : ServiceFramework("IAppletResource"), system(system) { 48 : ServiceFramework{system_, "IAppletResource"} {
49 static const FunctionInfo functions[] = { 49 static const FunctionInfo functions[] = {
50 {0, &IAppletResource::GetSharedMemoryHandle, "GetSharedMemoryHandle"}, 50 {0, &IAppletResource::GetSharedMemoryHandle, "GetSharedMemoryHandle"},
51 }; 51 };
@@ -139,8 +139,10 @@ void IAppletResource::UpdateMotion(std::uintptr_t user_data, std::chrono::nanose
139 139
140class IActiveVibrationDeviceList final : public ServiceFramework<IActiveVibrationDeviceList> { 140class IActiveVibrationDeviceList final : public ServiceFramework<IActiveVibrationDeviceList> {
141public: 141public:
142 explicit IActiveVibrationDeviceList(std::shared_ptr<IAppletResource> applet_resource_) 142 explicit IActiveVibrationDeviceList(Core::System& system_,
143 : ServiceFramework("IActiveVibrationDeviceList"), applet_resource(applet_resource_) { 143 std::shared_ptr<IAppletResource> applet_resource_)
144 : ServiceFramework{system_, "IActiveVibrationDeviceList"},
145 applet_resource(applet_resource_) {
144 // clang-format off 146 // clang-format off
145 static const FunctionInfo functions[] = { 147 static const FunctionInfo functions[] = {
146 {0, &IActiveVibrationDeviceList::InitializeVibrationDevice, "InitializeVibrationDevice"}, 148 {0, &IActiveVibrationDeviceList::InitializeVibrationDevice, "InitializeVibrationDevice"},
@@ -177,7 +179,7 @@ std::shared_ptr<IAppletResource> Hid::GetAppletResource() {
177 return applet_resource; 179 return applet_resource;
178} 180}
179 181
180Hid::Hid(Core::System& system) : ServiceFramework("hid"), system(system) { 182Hid::Hid(Core::System& system_) : ServiceFramework{system_, "hid"} {
181 // clang-format off 183 // clang-format off
182 static const FunctionInfo functions[] = { 184 static const FunctionInfo functions[] = {
183 {0, &Hid::CreateAppletResource, "CreateAppletResource"}, 185 {0, &Hid::CreateAppletResource, "CreateAppletResource"},
@@ -1068,7 +1070,7 @@ void Hid::CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx) {
1068 1070
1069 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 1071 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
1070 rb.Push(RESULT_SUCCESS); 1072 rb.Push(RESULT_SUCCESS);
1071 rb.PushIpcInterface<IActiveVibrationDeviceList>(applet_resource); 1073 rb.PushIpcInterface<IActiveVibrationDeviceList>(system, applet_resource);
1072} 1074}
1073 1075
1074void Hid::PermitVibration(Kernel::HLERequestContext& ctx) { 1076void Hid::PermitVibration(Kernel::HLERequestContext& ctx) {
@@ -1298,7 +1300,7 @@ void Hid::SetPalmaBoostMode(Kernel::HLERequestContext& ctx) {
1298 1300
1299class HidDbg final : public ServiceFramework<HidDbg> { 1301class HidDbg final : public ServiceFramework<HidDbg> {
1300public: 1302public:
1301 explicit HidDbg() : ServiceFramework{"hid:dbg"} { 1303 explicit HidDbg(Core::System& system_) : ServiceFramework{system_, "hid:dbg"} {
1302 // clang-format off 1304 // clang-format off
1303 static const FunctionInfo functions[] = { 1305 static const FunctionInfo functions[] = {
1304 {0, nullptr, "DeactivateDebugPad"}, 1306 {0, nullptr, "DeactivateDebugPad"},
@@ -1425,7 +1427,7 @@ public:
1425 1427
1426class HidSys final : public ServiceFramework<HidSys> { 1428class HidSys final : public ServiceFramework<HidSys> {
1427public: 1429public:
1428 explicit HidSys() : ServiceFramework{"hid:sys"} { 1430 explicit HidSys(Core::System& system_) : ServiceFramework{system_, "hid:sys"} {
1429 // clang-format off 1431 // clang-format off
1430 static const FunctionInfo functions[] = { 1432 static const FunctionInfo functions[] = {
1431 {31, nullptr, "SendKeyboardLockKeyEvent"}, 1433 {31, nullptr, "SendKeyboardLockKeyEvent"},
@@ -1559,7 +1561,7 @@ public:
1559 1561
1560class HidTmp final : public ServiceFramework<HidTmp> { 1562class HidTmp final : public ServiceFramework<HidTmp> {
1561public: 1563public:
1562 explicit HidTmp() : ServiceFramework{"hid:tmp"} { 1564 explicit HidTmp(Core::System& system_) : ServiceFramework{system_, "hid:tmp"} {
1563 // clang-format off 1565 // clang-format off
1564 static const FunctionInfo functions[] = { 1566 static const FunctionInfo functions[] = {
1565 {0, nullptr, "GetConsoleSixAxisSensorCalibrationValues"}, 1567 {0, nullptr, "GetConsoleSixAxisSensorCalibrationValues"},
@@ -1572,7 +1574,7 @@ public:
1572 1574
1573class HidBus final : public ServiceFramework<HidBus> { 1575class HidBus final : public ServiceFramework<HidBus> {
1574public: 1576public:
1575 explicit HidBus() : ServiceFramework{"hidbus"} { 1577 explicit HidBus(Core::System& system_) : ServiceFramework{system_, "hidbus"} {
1576 // clang-format off 1578 // clang-format off
1577 static const FunctionInfo functions[] = { 1579 static const FunctionInfo functions[] = {
1578 {1, nullptr, "GetBusHandle"}, 1580 {1, nullptr, "GetBusHandle"},
@@ -1602,15 +1604,15 @@ void ReloadInputDevices() {
1602 1604
1603void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { 1605void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
1604 std::make_shared<Hid>(system)->InstallAsService(service_manager); 1606 std::make_shared<Hid>(system)->InstallAsService(service_manager);
1605 std::make_shared<HidBus>()->InstallAsService(service_manager); 1607 std::make_shared<HidBus>(system)->InstallAsService(service_manager);
1606 std::make_shared<HidDbg>()->InstallAsService(service_manager); 1608 std::make_shared<HidDbg>(system)->InstallAsService(service_manager);
1607 std::make_shared<HidSys>()->InstallAsService(service_manager); 1609 std::make_shared<HidSys>(system)->InstallAsService(service_manager);
1608 std::make_shared<HidTmp>()->InstallAsService(service_manager); 1610 std::make_shared<HidTmp>(system)->InstallAsService(service_manager);
1609 1611
1610 std::make_shared<IRS>(system)->InstallAsService(service_manager); 1612 std::make_shared<IRS>(system)->InstallAsService(service_manager);
1611 std::make_shared<IRS_SYS>()->InstallAsService(service_manager); 1613 std::make_shared<IRS_SYS>(system)->InstallAsService(service_manager);
1612 1614
1613 std::make_shared<XCD_SYS>()->InstallAsService(service_manager); 1615 std::make_shared<XCD_SYS>(system)->InstallAsService(service_manager);
1614} 1616}
1615 1617
1616} // namespace Service::HID 1618} // namespace Service::HID
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index c8e4a4b55..1a73b8f73 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -41,7 +41,7 @@ enum class HidController : std::size_t {
41 41
42class IAppletResource final : public ServiceFramework<IAppletResource> { 42class IAppletResource final : public ServiceFramework<IAppletResource> {
43public: 43public:
44 explicit IAppletResource(Core::System& system); 44 explicit IAppletResource(Core::System& system_);
45 ~IAppletResource() override; 45 ~IAppletResource() override;
46 46
47 void ActivateController(HidController controller); 47 void ActivateController(HidController controller);
@@ -71,7 +71,6 @@ private:
71 71
72 std::shared_ptr<Core::Timing::EventType> pad_update_event; 72 std::shared_ptr<Core::Timing::EventType> pad_update_event;
73 std::shared_ptr<Core::Timing::EventType> motion_update_event; 73 std::shared_ptr<Core::Timing::EventType> motion_update_event;
74 Core::System& system;
75 74
76 std::array<std::unique_ptr<ControllerBase>, static_cast<size_t>(HidController::MaxControllers)> 75 std::array<std::unique_ptr<ControllerBase>, static_cast<size_t>(HidController::MaxControllers)>
77 controllers{}; 76 controllers{};
@@ -79,7 +78,7 @@ private:
79 78
80class Hid final : public ServiceFramework<Hid> { 79class Hid final : public ServiceFramework<Hid> {
81public: 80public:
82 explicit Hid(Core::System& system); 81 explicit Hid(Core::System& system_);
83 ~Hid() override; 82 ~Hid() override;
84 83
85 std::shared_ptr<IAppletResource> GetAppletResource(); 84 std::shared_ptr<IAppletResource> GetAppletResource();
@@ -164,7 +163,6 @@ private:
164 static_assert(sizeof(VibrationDeviceInfo) == 0x8, "VibrationDeviceInfo has incorrect size."); 163 static_assert(sizeof(VibrationDeviceInfo) == 0x8, "VibrationDeviceInfo has incorrect size.");
165 164
166 std::shared_ptr<IAppletResource> applet_resource; 165 std::shared_ptr<IAppletResource> applet_resource;
167 Core::System& system;
168}; 166};
169 167
170/// Reload input devices. Used when input configuration changed 168/// Reload input devices. Used when input configuration changed
diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp
index e82fd031b..c8413099f 100644
--- a/src/core/hle/service/hid/irs.cpp
+++ b/src/core/hle/service/hid/irs.cpp
@@ -12,7 +12,7 @@
12 12
13namespace Service::HID { 13namespace Service::HID {
14 14
15IRS::IRS(Core::System& system) : ServiceFramework{"irs"}, system(system) { 15IRS::IRS(Core::System& system_) : ServiceFramework{system_, "irs"} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {302, &IRS::ActivateIrsensor, "ActivateIrsensor"}, 18 {302, &IRS::ActivateIrsensor, "ActivateIrsensor"},
@@ -175,7 +175,7 @@ void IRS::ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx) {
175 175
176IRS::~IRS() = default; 176IRS::~IRS() = default;
177 177
178IRS_SYS::IRS_SYS() : ServiceFramework{"irs:sys"} { 178IRS_SYS::IRS_SYS(Core::System& system_) : ServiceFramework{system_, "irs:sys"} {
179 // clang-format off 179 // clang-format off
180 static const FunctionInfo functions[] = { 180 static const FunctionInfo functions[] = {
181 {500, nullptr, "SetAppletResourceUserId"}, 181 {500, nullptr, "SetAppletResourceUserId"},
diff --git a/src/core/hle/service/hid/irs.h b/src/core/hle/service/hid/irs.h
index 8918ad6ca..be0c486ba 100644
--- a/src/core/hle/service/hid/irs.h
+++ b/src/core/hle/service/hid/irs.h
@@ -7,6 +7,10 @@
7#include "core/hle/kernel/object.h" 7#include "core/hle/kernel/object.h"
8#include "core/hle/service/service.h" 8#include "core/hle/service/service.h"
9 9
10namespace Core {
11class System;
12}
13
10namespace Kernel { 14namespace Kernel {
11class SharedMemory; 15class SharedMemory;
12} 16}
@@ -15,7 +19,7 @@ namespace Service::HID {
15 19
16class IRS final : public ServiceFramework<IRS> { 20class IRS final : public ServiceFramework<IRS> {
17public: 21public:
18 explicit IRS(Core::System& system); 22 explicit IRS(Core::System& system_);
19 ~IRS() override; 23 ~IRS() override;
20 24
21private: 25private:
@@ -37,14 +41,14 @@ private:
37 void RunIrLedProcessor(Kernel::HLERequestContext& ctx); 41 void RunIrLedProcessor(Kernel::HLERequestContext& ctx);
38 void StopImageProcessorAsync(Kernel::HLERequestContext& ctx); 42 void StopImageProcessorAsync(Kernel::HLERequestContext& ctx);
39 void ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx); 43 void ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx);
44
40 std::shared_ptr<Kernel::SharedMemory> shared_mem; 45 std::shared_ptr<Kernel::SharedMemory> shared_mem;
41 const u32 device_handle{0xABCD}; 46 const u32 device_handle{0xABCD};
42 Core::System& system;
43}; 47};
44 48
45class IRS_SYS final : public ServiceFramework<IRS_SYS> { 49class IRS_SYS final : public ServiceFramework<IRS_SYS> {
46public: 50public:
47 explicit IRS_SYS(); 51 explicit IRS_SYS(Core::System& system);
48 ~IRS_SYS() override; 52 ~IRS_SYS() override;
49}; 53};
50 54
diff --git a/src/core/hle/service/hid/xcd.cpp b/src/core/hle/service/hid/xcd.cpp
index c8e9125f6..43a8840d0 100644
--- a/src/core/hle/service/hid/xcd.cpp
+++ b/src/core/hle/service/hid/xcd.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::HID { 7namespace Service::HID {
8 8
9XCD_SYS::XCD_SYS() : ServiceFramework{"xcd:sys"} { 9XCD_SYS::XCD_SYS(Core::System& system_) : ServiceFramework{system_, "xcd:sys"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, nullptr, "GetDataFormat"}, 12 {0, nullptr, "GetDataFormat"},
diff --git a/src/core/hle/service/hid/xcd.h b/src/core/hle/service/hid/xcd.h
index fd506d303..54932c228 100644
--- a/src/core/hle/service/hid/xcd.h
+++ b/src/core/hle/service/hid/xcd.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::HID { 13namespace Service::HID {
10 14
11class XCD_SYS final : public ServiceFramework<XCD_SYS> { 15class XCD_SYS final : public ServiceFramework<XCD_SYS> {
12public: 16public:
13 explicit XCD_SYS(); 17 explicit XCD_SYS(Core::System& system_);
14 ~XCD_SYS() override; 18 ~XCD_SYS() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/lbl/lbl.cpp b/src/core/hle/service/lbl/lbl.cpp
index 17350b403..6ad3a2877 100644
--- a/src/core/hle/service/lbl/lbl.cpp
+++ b/src/core/hle/service/lbl/lbl.cpp
@@ -15,7 +15,7 @@ namespace Service::LBL {
15 15
16class LBL final : public ServiceFramework<LBL> { 16class LBL final : public ServiceFramework<LBL> {
17public: 17public:
18 explicit LBL() : ServiceFramework{"lbl"} { 18 explicit LBL(Core::System& system_) : ServiceFramework{system_, "lbl"} {
19 // clang-format off 19 // clang-format off
20 static const FunctionInfo functions[] = { 20 static const FunctionInfo functions[] = {
21 {0, nullptr, "SaveCurrentSetting"}, 21 {0, nullptr, "SaveCurrentSetting"},
@@ -84,8 +84,8 @@ private:
84 bool vr_mode_enabled = false; 84 bool vr_mode_enabled = false;
85}; 85};
86 86
87void InstallInterfaces(SM::ServiceManager& sm) { 87void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
88 std::make_shared<LBL>()->InstallAsService(sm); 88 std::make_shared<LBL>(system)->InstallAsService(sm);
89} 89}
90 90
91} // namespace Service::LBL 91} // namespace Service::LBL
diff --git a/src/core/hle/service/lbl/lbl.h b/src/core/hle/service/lbl/lbl.h
index bf6f400f8..9c2021026 100644
--- a/src/core/hle/service/lbl/lbl.h
+++ b/src/core/hle/service/lbl/lbl.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::LBL { 15namespace Service::LBL {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::LBL 19} // namespace Service::LBL
diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp
index 49972cd69..ee908f399 100644
--- a/src/core/hle/service/ldn/ldn.cpp
+++ b/src/core/hle/service/ldn/ldn.cpp
@@ -13,7 +13,7 @@ namespace Service::LDN {
13 13
14class IMonitorService final : public ServiceFramework<IMonitorService> { 14class IMonitorService final : public ServiceFramework<IMonitorService> {
15public: 15public:
16 explicit IMonitorService() : ServiceFramework{"IMonitorService"} { 16 explicit IMonitorService(Core::System& system_) : ServiceFramework{system_, "IMonitorService"} {
17 // clang-format off 17 // clang-format off
18 static const FunctionInfo functions[] = { 18 static const FunctionInfo functions[] = {
19 {0, nullptr, "GetStateForMonitor"}, 19 {0, nullptr, "GetStateForMonitor"},
@@ -33,7 +33,7 @@ public:
33 33
34class LDNM final : public ServiceFramework<LDNM> { 34class LDNM final : public ServiceFramework<LDNM> {
35public: 35public:
36 explicit LDNM() : ServiceFramework{"ldn:m"} { 36 explicit LDNM(Core::System& system_) : ServiceFramework{system_, "ldn:m"} {
37 // clang-format off 37 // clang-format off
38 static const FunctionInfo functions[] = { 38 static const FunctionInfo functions[] = {
39 {0, &LDNM::CreateMonitorService, "CreateMonitorService"} 39 {0, &LDNM::CreateMonitorService, "CreateMonitorService"}
@@ -48,15 +48,15 @@ public:
48 48
49 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 49 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
50 rb.Push(RESULT_SUCCESS); 50 rb.Push(RESULT_SUCCESS);
51 rb.PushIpcInterface<IMonitorService>(); 51 rb.PushIpcInterface<IMonitorService>(system);
52 } 52 }
53}; 53};
54 54
55class ISystemLocalCommunicationService final 55class ISystemLocalCommunicationService final
56 : public ServiceFramework<ISystemLocalCommunicationService> { 56 : public ServiceFramework<ISystemLocalCommunicationService> {
57public: 57public:
58 explicit ISystemLocalCommunicationService() 58 explicit ISystemLocalCommunicationService(Core::System& system_)
59 : ServiceFramework{"ISystemLocalCommunicationService"} { 59 : ServiceFramework{system_, "ISystemLocalCommunicationService"} {
60 // clang-format off 60 // clang-format off
61 static const FunctionInfo functions[] = { 61 static const FunctionInfo functions[] = {
62 {0, nullptr, "GetState"}, 62 {0, nullptr, "GetState"},
@@ -99,7 +99,8 @@ public:
99class IUserLocalCommunicationService final 99class IUserLocalCommunicationService final
100 : public ServiceFramework<IUserLocalCommunicationService> { 100 : public ServiceFramework<IUserLocalCommunicationService> {
101public: 101public:
102 explicit IUserLocalCommunicationService() : ServiceFramework{"IUserLocalCommunicationService"} { 102 explicit IUserLocalCommunicationService(Core::System& system_)
103 : ServiceFramework{system_, "IUserLocalCommunicationService"} {
103 // clang-format off 104 // clang-format off
104 static const FunctionInfo functions[] = { 105 static const FunctionInfo functions[] = {
105 {0, nullptr, "GetState"}, 106 {0, nullptr, "GetState"},
@@ -148,7 +149,7 @@ public:
148 149
149class LDNS final : public ServiceFramework<LDNS> { 150class LDNS final : public ServiceFramework<LDNS> {
150public: 151public:
151 explicit LDNS() : ServiceFramework{"ldn:s"} { 152 explicit LDNS(Core::System& system_) : ServiceFramework{system_, "ldn:s"} {
152 // clang-format off 153 // clang-format off
153 static const FunctionInfo functions[] = { 154 static const FunctionInfo functions[] = {
154 {0, &LDNS::CreateSystemLocalCommunicationService, "CreateSystemLocalCommunicationService"}, 155 {0, &LDNS::CreateSystemLocalCommunicationService, "CreateSystemLocalCommunicationService"},
@@ -163,13 +164,13 @@ public:
163 164
164 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 165 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
165 rb.Push(RESULT_SUCCESS); 166 rb.Push(RESULT_SUCCESS);
166 rb.PushIpcInterface<ISystemLocalCommunicationService>(); 167 rb.PushIpcInterface<ISystemLocalCommunicationService>(system);
167 } 168 }
168}; 169};
169 170
170class LDNU final : public ServiceFramework<LDNU> { 171class LDNU final : public ServiceFramework<LDNU> {
171public: 172public:
172 explicit LDNU() : ServiceFramework{"ldn:u"} { 173 explicit LDNU(Core::System& system_) : ServiceFramework{system_, "ldn:u"} {
173 // clang-format off 174 // clang-format off
174 static const FunctionInfo functions[] = { 175 static const FunctionInfo functions[] = {
175 {0, &LDNU::CreateUserLocalCommunicationService, "CreateUserLocalCommunicationService"}, 176 {0, &LDNU::CreateUserLocalCommunicationService, "CreateUserLocalCommunicationService"},
@@ -184,14 +185,14 @@ public:
184 185
185 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 186 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
186 rb.Push(RESULT_SUCCESS); 187 rb.Push(RESULT_SUCCESS);
187 rb.PushIpcInterface<IUserLocalCommunicationService>(); 188 rb.PushIpcInterface<IUserLocalCommunicationService>(system);
188 } 189 }
189}; 190};
190 191
191void InstallInterfaces(SM::ServiceManager& sm) { 192void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
192 std::make_shared<LDNM>()->InstallAsService(sm); 193 std::make_shared<LDNM>(system)->InstallAsService(sm);
193 std::make_shared<LDNS>()->InstallAsService(sm); 194 std::make_shared<LDNS>(system)->InstallAsService(sm);
194 std::make_shared<LDNU>()->InstallAsService(sm); 195 std::make_shared<LDNU>(system)->InstallAsService(sm);
195} 196}
196 197
197} // namespace Service::LDN 198} // namespace Service::LDN
diff --git a/src/core/hle/service/ldn/ldn.h b/src/core/hle/service/ldn/ldn.h
index 6b2a3c2b2..3ccd9738b 100644
--- a/src/core/hle/service/ldn/ldn.h
+++ b/src/core/hle/service/ldn/ldn.h
@@ -4,6 +4,10 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
@@ -11,6 +15,6 @@ class ServiceManager;
11namespace Service::LDN { 15namespace Service::LDN {
12 16
13/// Registers all LDN services with the specified service manager. 17/// Registers all LDN services with the specified service manager.
14void InstallInterfaces(SM::ServiceManager& sm); 18void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
15 19
16} // namespace Service::LDN 20} // namespace Service::LDN
diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp
index 65c209725..fff68326b 100644
--- a/src/core/hle/service/ldr/ldr.cpp
+++ b/src/core/hle/service/ldr/ldr.cpp
@@ -115,7 +115,7 @@ static_assert(sizeof(NROInfo) == 0x60, "NROInfo has invalid size.");
115 115
116class DebugMonitor final : public ServiceFramework<DebugMonitor> { 116class DebugMonitor final : public ServiceFramework<DebugMonitor> {
117public: 117public:
118 explicit DebugMonitor() : ServiceFramework{"ldr:dmnt"} { 118 explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "ldr:dmnt"} {
119 // clang-format off 119 // clang-format off
120 static const FunctionInfo functions[] = { 120 static const FunctionInfo functions[] = {
121 {0, nullptr, "AddProcessToDebugLaunchQueue"}, 121 {0, nullptr, "AddProcessToDebugLaunchQueue"},
@@ -130,7 +130,7 @@ public:
130 130
131class ProcessManager final : public ServiceFramework<ProcessManager> { 131class ProcessManager final : public ServiceFramework<ProcessManager> {
132public: 132public:
133 explicit ProcessManager() : ServiceFramework{"ldr:pm"} { 133 explicit ProcessManager(Core::System& system_) : ServiceFramework{system_, "ldr:pm"} {
134 // clang-format off 134 // clang-format off
135 static const FunctionInfo functions[] = { 135 static const FunctionInfo functions[] = {
136 {0, nullptr, "CreateProcess"}, 136 {0, nullptr, "CreateProcess"},
@@ -147,7 +147,7 @@ public:
147 147
148class Shell final : public ServiceFramework<Shell> { 148class Shell final : public ServiceFramework<Shell> {
149public: 149public:
150 explicit Shell() : ServiceFramework{"ldr:shel"} { 150 explicit Shell(Core::System& system_) : ServiceFramework{system_, "ldr:shel"} {
151 // clang-format off 151 // clang-format off
152 static const FunctionInfo functions[] = { 152 static const FunctionInfo functions[] = {
153 {0, nullptr, "AddProcessToLaunchQueue"}, 153 {0, nullptr, "AddProcessToLaunchQueue"},
@@ -161,7 +161,7 @@ public:
161 161
162class RelocatableObject final : public ServiceFramework<RelocatableObject> { 162class RelocatableObject final : public ServiceFramework<RelocatableObject> {
163public: 163public:
164 explicit RelocatableObject(Core::System& system) : ServiceFramework{"ldr:ro"}, system(system) { 164 explicit RelocatableObject(Core::System& system_) : ServiceFramework{system_, "ldr:ro"} {
165 // clang-format off 165 // clang-format off
166 static const FunctionInfo functions[] = { 166 static const FunctionInfo functions[] = {
167 {0, &RelocatableObject::LoadNro, "LoadNro"}, 167 {0, &RelocatableObject::LoadNro, "LoadNro"},
@@ -639,13 +639,12 @@ private:
639 Common::Is4KBAligned(header.segment_headers[RO_INDEX].memory_size) && 639 Common::Is4KBAligned(header.segment_headers[RO_INDEX].memory_size) &&
640 Common::Is4KBAligned(header.segment_headers[DATA_INDEX].memory_size); 640 Common::Is4KBAligned(header.segment_headers[DATA_INDEX].memory_size);
641 } 641 }
642 Core::System& system;
643}; 642};
644 643
645void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) { 644void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
646 std::make_shared<DebugMonitor>()->InstallAsService(sm); 645 std::make_shared<DebugMonitor>(system)->InstallAsService(sm);
647 std::make_shared<ProcessManager>()->InstallAsService(sm); 646 std::make_shared<ProcessManager>(system)->InstallAsService(sm);
648 std::make_shared<Shell>()->InstallAsService(sm); 647 std::make_shared<Shell>(system)->InstallAsService(sm);
649 std::make_shared<RelocatableObject>(system)->InstallAsService(sm); 648 std::make_shared<RelocatableObject>(system)->InstallAsService(sm);
650} 649}
651 650
diff --git a/src/core/hle/service/ldr/ldr.h b/src/core/hle/service/ldr/ldr.h
index 7ac8c0b65..104fc15c5 100644
--- a/src/core/hle/service/ldr/ldr.h
+++ b/src/core/hle/service/ldr/ldr.h
@@ -4,6 +4,10 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp
index 49a42a9c9..f884b2735 100644
--- a/src/core/hle/service/lm/lm.cpp
+++ b/src/core/hle/service/lm/lm.cpp
@@ -18,8 +18,9 @@ namespace Service::LM {
18 18
19class ILogger final : public ServiceFramework<ILogger> { 19class ILogger final : public ServiceFramework<ILogger> {
20public: 20public:
21 explicit ILogger(Manager& manager_, Core::Memory::Memory& memory_) 21 explicit ILogger(Core::System& system_)
22 : ServiceFramework("ILogger"), manager{manager_}, memory{memory_} { 22 : ServiceFramework{system_, "ILogger"}, manager{system_.GetLogManager()},
23 memory{system_.Memory()} {
23 static const FunctionInfo functions[] = { 24 static const FunctionInfo functions[] = {
24 {0, &ILogger::Log, "Log"}, 25 {0, &ILogger::Log, "Log"},
25 {1, &ILogger::SetDestination, "SetDestination"}, 26 {1, &ILogger::SetDestination, "SetDestination"},
@@ -81,8 +82,7 @@ private:
81 82
82class LM final : public ServiceFramework<LM> { 83class LM final : public ServiceFramework<LM> {
83public: 84public:
84 explicit LM(Manager& manager_, Core::Memory::Memory& memory_) 85 explicit LM(Core::System& system_) : ServiceFramework{system_, "lm"} {
85 : ServiceFramework{"lm"}, manager{manager_}, memory{memory_} {
86 // clang-format off 86 // clang-format off
87 static const FunctionInfo functions[] = { 87 static const FunctionInfo functions[] = {
88 {0, &LM::OpenLogger, "OpenLogger"}, 88 {0, &LM::OpenLogger, "OpenLogger"},
@@ -98,16 +98,12 @@ private:
98 98
99 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 99 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
100 rb.Push(RESULT_SUCCESS); 100 rb.Push(RESULT_SUCCESS);
101 rb.PushIpcInterface<ILogger>(manager, memory); 101 rb.PushIpcInterface<ILogger>(system);
102 } 102 }
103
104 Manager& manager;
105 Core::Memory::Memory& memory;
106}; 103};
107 104
108void InstallInterfaces(Core::System& system) { 105void InstallInterfaces(Core::System& system) {
109 std::make_shared<LM>(system.GetLogManager(), system.Memory()) 106 std::make_shared<LM>(system)->InstallAsService(system.ServiceManager());
110 ->InstallAsService(system.ServiceManager());
111} 107}
112 108
113} // namespace Service::LM 109} // namespace Service::LM
diff --git a/src/core/hle/service/mig/mig.cpp b/src/core/hle/service/mig/mig.cpp
index 113a4665c..1599d941b 100644
--- a/src/core/hle/service/mig/mig.cpp
+++ b/src/core/hle/service/mig/mig.cpp
@@ -12,7 +12,7 @@ namespace Service::Migration {
12 12
13class MIG_USR final : public ServiceFramework<MIG_USR> { 13class MIG_USR final : public ServiceFramework<MIG_USR> {
14public: 14public:
15 explicit MIG_USR() : ServiceFramework{"mig:usr"} { 15 explicit MIG_USR(Core::System& system_) : ServiceFramework{system_, "mig:usr"} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {10, nullptr, "TryGetLastMigrationInfo"}, 18 {10, nullptr, "TryGetLastMigrationInfo"},
@@ -33,8 +33,8 @@ public:
33 } 33 }
34}; 34};
35 35
36void InstallInterfaces(SM::ServiceManager& sm) { 36void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
37 std::make_shared<MIG_USR>()->InstallAsService(sm); 37 std::make_shared<MIG_USR>(system)->InstallAsService(sm);
38} 38}
39 39
40} // namespace Service::Migration 40} // namespace Service::Migration
diff --git a/src/core/hle/service/mig/mig.h b/src/core/hle/service/mig/mig.h
index 288c1c1b3..2b24cdf2c 100644
--- a/src/core/hle/service/mig/mig.h
+++ b/src/core/hle/service/mig/mig.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::Migration { 15namespace Service::Migration {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::Migration 19} // namespace Service::Migration
diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp
index d7080b715..26be9e45b 100644
--- a/src/core/hle/service/mii/mii.cpp
+++ b/src/core/hle/service/mii/mii.cpp
@@ -18,7 +18,8 @@ constexpr ResultCode ERROR_INVALID_ARGUMENT{ErrorModule::Mii, 1};
18 18
19class IDatabaseService final : public ServiceFramework<IDatabaseService> { 19class IDatabaseService final : public ServiceFramework<IDatabaseService> {
20public: 20public:
21 explicit IDatabaseService() : ServiceFramework{"IDatabaseService"} { 21 explicit IDatabaseService(Core::System& system_)
22 : ServiceFramework{system_, "IDatabaseService"} {
22 // clang-format off 23 // clang-format off
23 static const FunctionInfo functions[] = { 24 static const FunctionInfo functions[] = {
24 {0, &IDatabaseService::IsUpdated, "IsUpdated"}, 25 {0, &IDatabaseService::IsUpdated, "IsUpdated"},
@@ -252,7 +253,8 @@ private:
252 253
253class MiiDBModule final : public ServiceFramework<MiiDBModule> { 254class MiiDBModule final : public ServiceFramework<MiiDBModule> {
254public: 255public:
255 explicit MiiDBModule(const char* name) : ServiceFramework{name} { 256 explicit MiiDBModule(Core::System& system_, const char* name)
257 : ServiceFramework{system_, name} {
256 // clang-format off 258 // clang-format off
257 static const FunctionInfo functions[] = { 259 static const FunctionInfo functions[] = {
258 {0, &MiiDBModule::GetDatabaseService, "GetDatabaseService"}, 260 {0, &MiiDBModule::GetDatabaseService, "GetDatabaseService"},
@@ -266,7 +268,7 @@ private:
266 void GetDatabaseService(Kernel::HLERequestContext& ctx) { 268 void GetDatabaseService(Kernel::HLERequestContext& ctx) {
267 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 269 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
268 rb.Push(RESULT_SUCCESS); 270 rb.Push(RESULT_SUCCESS);
269 rb.PushIpcInterface<IDatabaseService>(); 271 rb.PushIpcInterface<IDatabaseService>(system);
270 272
271 LOG_DEBUG(Service_Mii, "called"); 273 LOG_DEBUG(Service_Mii, "called");
272 } 274 }
@@ -274,7 +276,7 @@ private:
274 276
275class MiiImg final : public ServiceFramework<MiiImg> { 277class MiiImg final : public ServiceFramework<MiiImg> {
276public: 278public:
277 explicit MiiImg() : ServiceFramework{"miiimg"} { 279 explicit MiiImg(Core::System& system_) : ServiceFramework{system_, "miiimg"} {
278 // clang-format off 280 // clang-format off
279 static const FunctionInfo functions[] = { 281 static const FunctionInfo functions[] = {
280 {0, nullptr, "Initialize"}, 282 {0, nullptr, "Initialize"},
@@ -298,11 +300,11 @@ public:
298 } 300 }
299}; 301};
300 302
301void InstallInterfaces(SM::ServiceManager& sm) { 303void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
302 std::make_shared<MiiDBModule>("mii:e")->InstallAsService(sm); 304 std::make_shared<MiiDBModule>(system, "mii:e")->InstallAsService(sm);
303 std::make_shared<MiiDBModule>("mii:u")->InstallAsService(sm); 305 std::make_shared<MiiDBModule>(system, "mii:u")->InstallAsService(sm);
304 306
305 std::make_shared<MiiImg>()->InstallAsService(sm); 307 std::make_shared<MiiImg>(system)->InstallAsService(sm);
306} 308}
307 309
308} // namespace Service::Mii 310} // namespace Service::Mii
diff --git a/src/core/hle/service/mii/mii.h b/src/core/hle/service/mii/mii.h
index 7ce9be50e..9d3238e72 100644
--- a/src/core/hle/service/mii/mii.h
+++ b/src/core/hle/service/mii/mii.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::Mii { 15namespace Service::Mii {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::Mii 19} // namespace Service::Mii
diff --git a/src/core/hle/service/mm/mm_u.cpp b/src/core/hle/service/mm/mm_u.cpp
index 25c24e537..b0cb07d24 100644
--- a/src/core/hle/service/mm/mm_u.cpp
+++ b/src/core/hle/service/mm/mm_u.cpp
@@ -6,12 +6,13 @@
6#include "core/hle/ipc_helpers.h" 6#include "core/hle/ipc_helpers.h"
7#include "core/hle/kernel/client_session.h" 7#include "core/hle/kernel/client_session.h"
8#include "core/hle/service/mm/mm_u.h" 8#include "core/hle/service/mm/mm_u.h"
9#include "core/hle/service/sm/sm.h"
9 10
10namespace Service::MM { 11namespace Service::MM {
11 12
12class MM_U final : public ServiceFramework<MM_U> { 13class MM_U final : public ServiceFramework<MM_U> {
13public: 14public:
14 explicit MM_U() : ServiceFramework{"mm:u"} { 15 explicit MM_U(Core::System& system_) : ServiceFramework{system_, "mm:u"} {
15 // clang-format off 16 // clang-format off
16 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
17 {0, &MM_U::InitializeOld, "InitializeOld"}, 18 {0, &MM_U::InitializeOld, "InitializeOld"},
@@ -104,8 +105,8 @@ private:
104 u32 id{1}; 105 u32 id{1};
105}; 106};
106 107
107void InstallInterfaces(SM::ServiceManager& service_manager) { 108void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
108 std::make_shared<MM_U>()->InstallAsService(service_manager); 109 std::make_shared<MM_U>(system)->InstallAsService(service_manager);
109} 110}
110 111
111} // namespace Service::MM 112} // namespace Service::MM
diff --git a/src/core/hle/service/mm/mm_u.h b/src/core/hle/service/mm/mm_u.h
index 5439fa653..49b6a3355 100644
--- a/src/core/hle/service/mm/mm_u.h
+++ b/src/core/hle/service/mm/mm_u.h
@@ -4,11 +4,17 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "core/hle/service/service.h" 7namespace Core {
8class System;
9}
10
11namespace Service::SM {
12class ServiceManager;
13}
8 14
9namespace Service::MM { 15namespace Service::MM {
10 16
11/// Registers all MM services with the specified service manager. 17/// Registers all MM services with the specified service manager.
12void InstallInterfaces(SM::ServiceManager& service_manager); 18void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
13 19
14} // namespace Service::MM 20} // namespace Service::MM
diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp
index e38dea1f4..b8d627ca8 100644
--- a/src/core/hle/service/ncm/ncm.cpp
+++ b/src/core/hle/service/ncm/ncm.cpp
@@ -14,8 +14,8 @@ namespace Service::NCM {
14 14
15class ILocationResolver final : public ServiceFramework<ILocationResolver> { 15class ILocationResolver final : public ServiceFramework<ILocationResolver> {
16public: 16public:
17 explicit ILocationResolver(FileSys::StorageId id) 17 explicit ILocationResolver(Core::System& system_, FileSys::StorageId id)
18 : ServiceFramework{"ILocationResolver"}, storage(id) { 18 : ServiceFramework{system_, "ILocationResolver"}, storage{id} {
19 // clang-format off 19 // clang-format off
20 static const FunctionInfo functions[] = { 20 static const FunctionInfo functions[] = {
21 {0, nullptr, "ResolveProgramPath"}, 21 {0, nullptr, "ResolveProgramPath"},
@@ -50,7 +50,8 @@ private:
50 50
51class IRegisteredLocationResolver final : public ServiceFramework<IRegisteredLocationResolver> { 51class IRegisteredLocationResolver final : public ServiceFramework<IRegisteredLocationResolver> {
52public: 52public:
53 explicit IRegisteredLocationResolver() : ServiceFramework{"IRegisteredLocationResolver"} { 53 explicit IRegisteredLocationResolver(Core::System& system_)
54 : ServiceFramework{system_, "IRegisteredLocationResolver"} {
54 // clang-format off 55 // clang-format off
55 static const FunctionInfo functions[] = { 56 static const FunctionInfo functions[] = {
56 {0, nullptr, "ResolveProgramPath"}, 57 {0, nullptr, "ResolveProgramPath"},
@@ -72,7 +73,8 @@ public:
72 73
73class IAddOnContentLocationResolver final : public ServiceFramework<IAddOnContentLocationResolver> { 74class IAddOnContentLocationResolver final : public ServiceFramework<IAddOnContentLocationResolver> {
74public: 75public:
75 explicit IAddOnContentLocationResolver() : ServiceFramework{"IAddOnContentLocationResolver"} { 76 explicit IAddOnContentLocationResolver(Core::System& system_)
77 : ServiceFramework{system_, "IAddOnContentLocationResolver"} {
76 // clang-format off 78 // clang-format off
77 static const FunctionInfo functions[] = { 79 static const FunctionInfo functions[] = {
78 {0, nullptr, "ResolveAddOnContentPath"}, 80 {0, nullptr, "ResolveAddOnContentPath"},
@@ -89,7 +91,7 @@ public:
89 91
90class LR final : public ServiceFramework<LR> { 92class LR final : public ServiceFramework<LR> {
91public: 93public:
92 explicit LR() : ServiceFramework{"lr"} { 94 explicit LR(Core::System& system_) : ServiceFramework{system_, "lr"} {
93 // clang-format off 95 // clang-format off
94 static const FunctionInfo functions[] = { 96 static const FunctionInfo functions[] = {
95 {0, nullptr, "OpenLocationResolver"}, 97 {0, nullptr, "OpenLocationResolver"},
@@ -105,7 +107,7 @@ public:
105 107
106class NCM final : public ServiceFramework<NCM> { 108class NCM final : public ServiceFramework<NCM> {
107public: 109public:
108 explicit NCM() : ServiceFramework{"ncm"} { 110 explicit NCM(Core::System& system_) : ServiceFramework{system_, "ncm"} {
109 // clang-format off 111 // clang-format off
110 static const FunctionInfo functions[] = { 112 static const FunctionInfo functions[] = {
111 {0, nullptr, "CreateContentStorage"}, 113 {0, nullptr, "CreateContentStorage"},
@@ -130,9 +132,9 @@ public:
130 } 132 }
131}; 133};
132 134
133void InstallInterfaces(SM::ServiceManager& sm) { 135void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
134 std::make_shared<LR>()->InstallAsService(sm); 136 std::make_shared<LR>(system)->InstallAsService(sm);
135 std::make_shared<NCM>()->InstallAsService(sm); 137 std::make_shared<NCM>(system)->InstallAsService(sm);
136} 138}
137 139
138} // namespace Service::NCM 140} // namespace Service::NCM
diff --git a/src/core/hle/service/ncm/ncm.h b/src/core/hle/service/ncm/ncm.h
index 7bc8518a6..ee01eddc0 100644
--- a/src/core/hle/service/ncm/ncm.h
+++ b/src/core/hle/service/ncm/ncm.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::NCM { 15namespace Service::NCM {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::NCM 19} // namespace Service::NCM
diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp
index 780ea30fe..6ab35de47 100644
--- a/src/core/hle/service/nfc/nfc.cpp
+++ b/src/core/hle/service/nfc/nfc.cpp
@@ -16,7 +16,7 @@ namespace Service::NFC {
16 16
17class IAm final : public ServiceFramework<IAm> { 17class IAm final : public ServiceFramework<IAm> {
18public: 18public:
19 explicit IAm() : ServiceFramework{"NFC::IAm"} { 19 explicit IAm(Core::System& system_) : ServiceFramework{system_, "NFC::IAm"} {
20 // clang-format off 20 // clang-format off
21 static const FunctionInfo functions[] = { 21 static const FunctionInfo functions[] = {
22 {0, nullptr, "Initialize"}, 22 {0, nullptr, "Initialize"},
@@ -31,7 +31,7 @@ public:
31 31
32class NFC_AM final : public ServiceFramework<NFC_AM> { 32class NFC_AM final : public ServiceFramework<NFC_AM> {
33public: 33public:
34 explicit NFC_AM() : ServiceFramework{"nfc:am"} { 34 explicit NFC_AM(Core::System& system_) : ServiceFramework{system_, "nfc:am"} {
35 // clang-format off 35 // clang-format off
36 static const FunctionInfo functions[] = { 36 static const FunctionInfo functions[] = {
37 {0, &NFC_AM::CreateAmInterface, "CreateAmInterface"}, 37 {0, &NFC_AM::CreateAmInterface, "CreateAmInterface"},
@@ -47,13 +47,13 @@ private:
47 47
48 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 48 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
49 rb.Push(RESULT_SUCCESS); 49 rb.Push(RESULT_SUCCESS);
50 rb.PushIpcInterface<IAm>(); 50 rb.PushIpcInterface<IAm>(system);
51 } 51 }
52}; 52};
53 53
54class MFIUser final : public ServiceFramework<MFIUser> { 54class MFIUser final : public ServiceFramework<MFIUser> {
55public: 55public:
56 explicit MFIUser() : ServiceFramework{"NFC::MFIUser"} { 56 explicit MFIUser(Core::System& system_) : ServiceFramework{system_, "NFC::MFIUser"} {
57 // clang-format off 57 // clang-format off
58 static const FunctionInfo functions[] = { 58 static const FunctionInfo functions[] = {
59 {0, nullptr, "Initialize"}, 59 {0, nullptr, "Initialize"},
@@ -79,7 +79,7 @@ public:
79 79
80class NFC_MF_U final : public ServiceFramework<NFC_MF_U> { 80class NFC_MF_U final : public ServiceFramework<NFC_MF_U> {
81public: 81public:
82 explicit NFC_MF_U() : ServiceFramework{"nfc:mf:u"} { 82 explicit NFC_MF_U(Core::System& system_) : ServiceFramework{system_, "nfc:mf:u"} {
83 // clang-format off 83 // clang-format off
84 static const FunctionInfo functions[] = { 84 static const FunctionInfo functions[] = {
85 {0, &NFC_MF_U::CreateUserInterface, "CreateUserInterface"}, 85 {0, &NFC_MF_U::CreateUserInterface, "CreateUserInterface"},
@@ -95,13 +95,13 @@ private:
95 95
96 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 96 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
97 rb.Push(RESULT_SUCCESS); 97 rb.Push(RESULT_SUCCESS);
98 rb.PushIpcInterface<MFIUser>(); 98 rb.PushIpcInterface<MFIUser>(system);
99 } 99 }
100}; 100};
101 101
102class IUser final : public ServiceFramework<IUser> { 102class IUser final : public ServiceFramework<IUser> {
103public: 103public:
104 explicit IUser() : ServiceFramework{"NFC::IUser"} { 104 explicit IUser(Core::System& system_) : ServiceFramework{system_, "NFC::IUser"} {
105 // clang-format off 105 // clang-format off
106 static const FunctionInfo functions[] = { 106 static const FunctionInfo functions[] = {
107 {0, &IUser::InitializeOld, "InitializeOld"}, 107 {0, &IUser::InitializeOld, "InitializeOld"},
@@ -171,7 +171,7 @@ private:
171 171
172class NFC_U final : public ServiceFramework<NFC_U> { 172class NFC_U final : public ServiceFramework<NFC_U> {
173public: 173public:
174 explicit NFC_U() : ServiceFramework{"nfc:user"} { 174 explicit NFC_U(Core::System& system_) : ServiceFramework{system_, "nfc:user"} {
175 // clang-format off 175 // clang-format off
176 static const FunctionInfo functions[] = { 176 static const FunctionInfo functions[] = {
177 {0, &NFC_U::CreateUserInterface, "CreateUserInterface"}, 177 {0, &NFC_U::CreateUserInterface, "CreateUserInterface"},
@@ -187,13 +187,13 @@ private:
187 187
188 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 188 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
189 rb.Push(RESULT_SUCCESS); 189 rb.Push(RESULT_SUCCESS);
190 rb.PushIpcInterface<IUser>(); 190 rb.PushIpcInterface<IUser>(system);
191 } 191 }
192}; 192};
193 193
194class ISystem final : public ServiceFramework<ISystem> { 194class ISystem final : public ServiceFramework<ISystem> {
195public: 195public:
196 explicit ISystem() : ServiceFramework{"ISystem"} { 196 explicit ISystem(Core::System& system_) : ServiceFramework{system_, "ISystem"} {
197 // clang-format off 197 // clang-format off
198 static const FunctionInfo functions[] = { 198 static const FunctionInfo functions[] = {
199 {0, nullptr, "Initialize"}, 199 {0, nullptr, "Initialize"},
@@ -230,7 +230,7 @@ public:
230 230
231class NFC_SYS final : public ServiceFramework<NFC_SYS> { 231class NFC_SYS final : public ServiceFramework<NFC_SYS> {
232public: 232public:
233 explicit NFC_SYS() : ServiceFramework{"nfc:sys"} { 233 explicit NFC_SYS(Core::System& system_) : ServiceFramework{system_, "nfc:sys"} {
234 // clang-format off 234 // clang-format off
235 static const FunctionInfo functions[] = { 235 static const FunctionInfo functions[] = {
236 {0, &NFC_SYS::CreateSystemInterface, "CreateSystemInterface"}, 236 {0, &NFC_SYS::CreateSystemInterface, "CreateSystemInterface"},
@@ -246,15 +246,15 @@ private:
246 246
247 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 247 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
248 rb.Push(RESULT_SUCCESS); 248 rb.Push(RESULT_SUCCESS);
249 rb.PushIpcInterface<ISystem>(); 249 rb.PushIpcInterface<ISystem>(system);
250 } 250 }
251}; 251};
252 252
253void InstallInterfaces(SM::ServiceManager& sm) { 253void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
254 std::make_shared<NFC_AM>()->InstallAsService(sm); 254 std::make_shared<NFC_AM>(system)->InstallAsService(sm);
255 std::make_shared<NFC_MF_U>()->InstallAsService(sm); 255 std::make_shared<NFC_MF_U>(system)->InstallAsService(sm);
256 std::make_shared<NFC_U>()->InstallAsService(sm); 256 std::make_shared<NFC_U>(system)->InstallAsService(sm);
257 std::make_shared<NFC_SYS>()->InstallAsService(sm); 257 std::make_shared<NFC_SYS>(system)->InstallAsService(sm);
258} 258}
259 259
260} // namespace Service::NFC 260} // namespace Service::NFC
diff --git a/src/core/hle/service/nfc/nfc.h b/src/core/hle/service/nfc/nfc.h
index 4d2d815f9..5a94b076d 100644
--- a/src/core/hle/service/nfc/nfc.h
+++ b/src/core/hle/service/nfc/nfc.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::NFC { 15namespace Service::NFC {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::NFC 19} // namespace Service::NFC
diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp
index a0469ffbd..5557da72e 100644
--- a/src/core/hle/service/nfp/nfp.cpp
+++ b/src/core/hle/service/nfp/nfp.cpp
@@ -21,8 +21,9 @@ namespace ErrCodes {
21constexpr ResultCode ERR_NO_APPLICATION_AREA(ErrorModule::NFP, 152); 21constexpr ResultCode ERR_NO_APPLICATION_AREA(ErrorModule::NFP, 152);
22} // namespace ErrCodes 22} // namespace ErrCodes
23 23
24Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name) 24Module::Interface::Interface(std::shared_ptr<Module> module_, Core::System& system_,
25 : ServiceFramework(name), module(std::move(module)), system(system) { 25 const char* name)
26 : ServiceFramework{system_, name}, module{std::move(module_)} {
26 auto& kernel = system.Kernel(); 27 auto& kernel = system.Kernel();
27 nfc_tag_load = Kernel::WritableEvent::CreateEventPair(kernel, "IUser:NFCTagDetected"); 28 nfc_tag_load = Kernel::WritableEvent::CreateEventPair(kernel, "IUser:NFCTagDetected");
28} 29}
@@ -31,8 +32,8 @@ Module::Interface::~Interface() = default;
31 32
32class IUser final : public ServiceFramework<IUser> { 33class IUser final : public ServiceFramework<IUser> {
33public: 34public:
34 IUser(Module::Interface& nfp_interface, Core::System& system) 35 explicit IUser(Module::Interface& nfp_interface_, Core::System& system_)
35 : ServiceFramework("NFP::IUser"), nfp_interface(nfp_interface) { 36 : ServiceFramework{system_, "NFP::IUser"}, nfp_interface{nfp_interface_} {
36 static const FunctionInfo functions[] = { 37 static const FunctionInfo functions[] = {
37 {0, &IUser::Initialize, "Initialize"}, 38 {0, &IUser::Initialize, "Initialize"},
38 {1, &IUser::Finalize, "Finalize"}, 39 {1, &IUser::Finalize, "Finalize"},
diff --git a/src/core/hle/service/nfp/nfp.h b/src/core/hle/service/nfp/nfp.h
index 200013795..295de535b 100644
--- a/src/core/hle/service/nfp/nfp.h
+++ b/src/core/hle/service/nfp/nfp.h
@@ -16,7 +16,8 @@ class Module final {
16public: 16public:
17 class Interface : public ServiceFramework<Interface> { 17 class Interface : public ServiceFramework<Interface> {
18 public: 18 public:
19 explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name); 19 explicit Interface(std::shared_ptr<Module> module_, Core::System& system_,
20 const char* name);
20 ~Interface() override; 21 ~Interface() override;
21 22
22 struct ModelInfo { 23 struct ModelInfo {
@@ -43,7 +44,6 @@ public:
43 44
44 protected: 45 protected:
45 std::shared_ptr<Module> module; 46 std::shared_ptr<Module> module;
46 Core::System& system;
47 }; 47 };
48}; 48};
49 49
diff --git a/src/core/hle/service/nfp/nfp_user.cpp b/src/core/hle/service/nfp/nfp_user.cpp
index 298184f17..10b0ef944 100644
--- a/src/core/hle/service/nfp/nfp_user.cpp
+++ b/src/core/hle/service/nfp/nfp_user.cpp
@@ -6,8 +6,8 @@
6 6
7namespace Service::NFP { 7namespace Service::NFP {
8 8
9NFP_User::NFP_User(std::shared_ptr<Module> module, Core::System& system) 9NFP_User::NFP_User(std::shared_ptr<Module> module_, Core::System& system_)
10 : Module::Interface(std::move(module), system, "nfp:user") { 10 : Interface(std::move(module_), system_, "nfp:user") {
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, &NFP_User::CreateUserInterface, "CreateUserInterface"}, 12 {0, &NFP_User::CreateUserInterface, "CreateUserInterface"},
13 }; 13 };
diff --git a/src/core/hle/service/nfp/nfp_user.h b/src/core/hle/service/nfp/nfp_user.h
index 1686ebf20..7f3c124f6 100644
--- a/src/core/hle/service/nfp/nfp_user.h
+++ b/src/core/hle/service/nfp/nfp_user.h
@@ -10,7 +10,7 @@ namespace Service::NFP {
10 10
11class NFP_User final : public Module::Interface { 11class NFP_User final : public Module::Interface {
12public: 12public:
13 explicit NFP_User(std::shared_ptr<Module> module, Core::System& system); 13 explicit NFP_User(std::shared_ptr<Module> module_, Core::System& system_);
14 ~NFP_User() override; 14 ~NFP_User() override;
15}; 15};
16 16
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp
index db7ec6d0e..ef5176bea 100644
--- a/src/core/hle/service/nifm/nifm.cpp
+++ b/src/core/hle/service/nifm/nifm.cpp
@@ -23,7 +23,7 @@ enum class RequestState : u32 {
23 23
24class IScanRequest final : public ServiceFramework<IScanRequest> { 24class IScanRequest final : public ServiceFramework<IScanRequest> {
25public: 25public:
26 explicit IScanRequest() : ServiceFramework("IScanRequest") { 26 explicit IScanRequest(Core::System& system_) : ServiceFramework{system_, "IScanRequest"} {
27 // clang-format off 27 // clang-format off
28 static const FunctionInfo functions[] = { 28 static const FunctionInfo functions[] = {
29 {0, nullptr, "Submit"}, 29 {0, nullptr, "Submit"},
@@ -40,7 +40,7 @@ public:
40 40
41class IRequest final : public ServiceFramework<IRequest> { 41class IRequest final : public ServiceFramework<IRequest> {
42public: 42public:
43 explicit IRequest(Core::System& system) : ServiceFramework("IRequest") { 43 explicit IRequest(Core::System& system_) : ServiceFramework{system_, "IRequest"} {
44 static const FunctionInfo functions[] = { 44 static const FunctionInfo functions[] = {
45 {0, &IRequest::GetRequestState, "GetRequestState"}, 45 {0, &IRequest::GetRequestState, "GetRequestState"},
46 {1, &IRequest::GetResult, "GetResult"}, 46 {1, &IRequest::GetResult, "GetResult"},
@@ -140,7 +140,7 @@ private:
140 140
141class INetworkProfile final : public ServiceFramework<INetworkProfile> { 141class INetworkProfile final : public ServiceFramework<INetworkProfile> {
142public: 142public:
143 explicit INetworkProfile() : ServiceFramework("INetworkProfile") { 143 explicit INetworkProfile(Core::System& system_) : ServiceFramework{system_, "INetworkProfile"} {
144 static const FunctionInfo functions[] = { 144 static const FunctionInfo functions[] = {
145 {0, nullptr, "Update"}, 145 {0, nullptr, "Update"},
146 {1, nullptr, "PersistOld"}, 146 {1, nullptr, "PersistOld"},
@@ -152,7 +152,7 @@ public:
152 152
153class IGeneralService final : public ServiceFramework<IGeneralService> { 153class IGeneralService final : public ServiceFramework<IGeneralService> {
154public: 154public:
155 IGeneralService(Core::System& system); 155 explicit IGeneralService(Core::System& system_);
156 156
157private: 157private:
158 void GetClientId(Kernel::HLERequestContext& ctx) { 158 void GetClientId(Kernel::HLERequestContext& ctx) {
@@ -169,7 +169,7 @@ private:
169 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 169 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
170 170
171 rb.Push(RESULT_SUCCESS); 171 rb.Push(RESULT_SUCCESS);
172 rb.PushIpcInterface<IScanRequest>(); 172 rb.PushIpcInterface<IScanRequest>(system);
173 } 173 }
174 void CreateRequest(Kernel::HLERequestContext& ctx) { 174 void CreateRequest(Kernel::HLERequestContext& ctx) {
175 LOG_DEBUG(Service_NIFM, "called"); 175 LOG_DEBUG(Service_NIFM, "called");
@@ -207,7 +207,7 @@ private:
207 IPC::ResponseBuilder rb{ctx, 6, 0, 1}; 207 IPC::ResponseBuilder rb{ctx, 6, 0, 1};
208 208
209 rb.Push(RESULT_SUCCESS); 209 rb.Push(RESULT_SUCCESS);
210 rb.PushIpcInterface<INetworkProfile>(); 210 rb.PushIpcInterface<INetworkProfile>(system);
211 rb.PushRaw<u128>(uuid); 211 rb.PushRaw<u128>(uuid);
212 } 212 }
213 void IsWirelessCommunicationEnabled(Kernel::HLERequestContext& ctx) { 213 void IsWirelessCommunicationEnabled(Kernel::HLERequestContext& ctx) {
@@ -239,11 +239,10 @@ private:
239 rb.Push<u8>(1); 239 rb.Push<u8>(1);
240 } 240 }
241 } 241 }
242 Core::System& system;
243}; 242};
244 243
245IGeneralService::IGeneralService(Core::System& system) 244IGeneralService::IGeneralService(Core::System& system_)
246 : ServiceFramework("IGeneralService"), system(system) { 245 : ServiceFramework{system_, "IGeneralService"} {
247 // clang-format off 246 // clang-format off
248 static const FunctionInfo functions[] = { 247 static const FunctionInfo functions[] = {
249 {1, &IGeneralService::GetClientId, "GetClientId"}, 248 {1, &IGeneralService::GetClientId, "GetClientId"},
@@ -296,8 +295,8 @@ IGeneralService::IGeneralService(Core::System& system)
296 295
297class NetworkInterface final : public ServiceFramework<NetworkInterface> { 296class NetworkInterface final : public ServiceFramework<NetworkInterface> {
298public: 297public:
299 explicit NetworkInterface(const char* name, Core::System& system) 298 explicit NetworkInterface(const char* name, Core::System& system_)
300 : ServiceFramework{name}, system(system) { 299 : ServiceFramework{system_, name} {
301 static const FunctionInfo functions[] = { 300 static const FunctionInfo functions[] = {
302 {4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"}, 301 {4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
303 {5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"}, 302 {5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"},
@@ -305,6 +304,7 @@ public:
305 RegisterHandlers(functions); 304 RegisterHandlers(functions);
306 } 305 }
307 306
307private:
308 void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) { 308 void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) {
309 LOG_DEBUG(Service_NIFM, "called"); 309 LOG_DEBUG(Service_NIFM, "called");
310 310
@@ -320,9 +320,6 @@ public:
320 rb.Push(RESULT_SUCCESS); 320 rb.Push(RESULT_SUCCESS);
321 rb.PushIpcInterface<IGeneralService>(system); 321 rb.PushIpcInterface<IGeneralService>(system);
322 } 322 }
323
324private:
325 Core::System& system;
326}; 323};
327 324
328void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { 325void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h
index 6857e18f9..c3dd4f386 100644
--- a/src/core/hle/service/nifm/nifm.h
+++ b/src/core/hle/service/nifm/nifm.h
@@ -4,14 +4,14 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Service::SM {
8class ServiceManager;
9}
10
11namespace Core { 7namespace Core {
12class System; 8class System;
13} 9}
14 10
11namespace Service::SM {
12class ServiceManager;
13}
14
15namespace Service::NIFM { 15namespace Service::NIFM {
16 16
17/// Registers all NIFM services with the specified service manager. 17/// Registers all NIFM services with the specified service manager.
diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp
index 11aa74828..d33b26129 100644
--- a/src/core/hle/service/nim/nim.cpp
+++ b/src/core/hle/service/nim/nim.cpp
@@ -17,7 +17,8 @@ namespace Service::NIM {
17 17
18class IShopServiceAsync final : public ServiceFramework<IShopServiceAsync> { 18class IShopServiceAsync final : public ServiceFramework<IShopServiceAsync> {
19public: 19public:
20 IShopServiceAsync() : ServiceFramework("IShopServiceAsync") { 20 explicit IShopServiceAsync(Core::System& system_)
21 : ServiceFramework{system_, "IShopServiceAsync"} {
21 // clang-format off 22 // clang-format off
22 static const FunctionInfo functions[] = { 23 static const FunctionInfo functions[] = {
23 {0, nullptr, "Cancel"}, 24 {0, nullptr, "Cancel"},
@@ -35,7 +36,8 @@ public:
35 36
36class IShopServiceAccessor final : public ServiceFramework<IShopServiceAccessor> { 37class IShopServiceAccessor final : public ServiceFramework<IShopServiceAccessor> {
37public: 38public:
38 IShopServiceAccessor() : ServiceFramework("IShopServiceAccessor") { 39 explicit IShopServiceAccessor(Core::System& system_)
40 : ServiceFramework{system_, "IShopServiceAccessor"} {
39 // clang-format off 41 // clang-format off
40 static const FunctionInfo functions[] = { 42 static const FunctionInfo functions[] = {
41 {0, &IShopServiceAccessor::CreateAsyncInterface, "CreateAsyncInterface"}, 43 {0, &IShopServiceAccessor::CreateAsyncInterface, "CreateAsyncInterface"},
@@ -50,13 +52,14 @@ private:
50 LOG_WARNING(Service_NIM, "(STUBBED) called"); 52 LOG_WARNING(Service_NIM, "(STUBBED) called");
51 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 53 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
52 rb.Push(RESULT_SUCCESS); 54 rb.Push(RESULT_SUCCESS);
53 rb.PushIpcInterface<IShopServiceAsync>(); 55 rb.PushIpcInterface<IShopServiceAsync>(system);
54 } 56 }
55}; 57};
56 58
57class IShopServiceAccessServer final : public ServiceFramework<IShopServiceAccessServer> { 59class IShopServiceAccessServer final : public ServiceFramework<IShopServiceAccessServer> {
58public: 60public:
59 IShopServiceAccessServer() : ServiceFramework("IShopServiceAccessServer") { 61 explicit IShopServiceAccessServer(Core::System& system_)
62 : ServiceFramework{system_, "IShopServiceAccessServer"} {
60 // clang-format off 63 // clang-format off
61 static const FunctionInfo functions[] = { 64 static const FunctionInfo functions[] = {
62 {0, &IShopServiceAccessServer::CreateAccessorInterface, "CreateAccessorInterface"}, 65 {0, &IShopServiceAccessServer::CreateAccessorInterface, "CreateAccessorInterface"},
@@ -71,13 +74,13 @@ private:
71 LOG_WARNING(Service_NIM, "(STUBBED) called"); 74 LOG_WARNING(Service_NIM, "(STUBBED) called");
72 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 75 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
73 rb.Push(RESULT_SUCCESS); 76 rb.Push(RESULT_SUCCESS);
74 rb.PushIpcInterface<IShopServiceAccessor>(); 77 rb.PushIpcInterface<IShopServiceAccessor>(system);
75 } 78 }
76}; 79};
77 80
78class NIM final : public ServiceFramework<NIM> { 81class NIM final : public ServiceFramework<NIM> {
79public: 82public:
80 explicit NIM() : ServiceFramework{"nim"} { 83 explicit NIM(Core::System& system_) : ServiceFramework{system_, "nim"} {
81 // clang-format off 84 // clang-format off
82 static const FunctionInfo functions[] = { 85 static const FunctionInfo functions[] = {
83 {0, nullptr, "CreateSystemUpdateTask"}, 86 {0, nullptr, "CreateSystemUpdateTask"},
@@ -207,7 +210,7 @@ public:
207 210
208class NIM_ECA final : public ServiceFramework<NIM_ECA> { 211class NIM_ECA final : public ServiceFramework<NIM_ECA> {
209public: 212public:
210 explicit NIM_ECA() : ServiceFramework{"nim:eca"} { 213 explicit NIM_ECA(Core::System& system_) : ServiceFramework{system_, "nim:eca"} {
211 // clang-format off 214 // clang-format off
212 static const FunctionInfo functions[] = { 215 static const FunctionInfo functions[] = {
213 {0, &NIM_ECA::CreateServerInterface, "CreateServerInterface"}, 216 {0, &NIM_ECA::CreateServerInterface, "CreateServerInterface"},
@@ -226,13 +229,13 @@ private:
226 LOG_WARNING(Service_NIM, "(STUBBED) called"); 229 LOG_WARNING(Service_NIM, "(STUBBED) called");
227 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 230 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
228 rb.Push(RESULT_SUCCESS); 231 rb.Push(RESULT_SUCCESS);
229 rb.PushIpcInterface<IShopServiceAccessServer>(); 232 rb.PushIpcInterface<IShopServiceAccessServer>(system);
230 } 233 }
231}; 234};
232 235
233class NIM_SHP final : public ServiceFramework<NIM_SHP> { 236class NIM_SHP final : public ServiceFramework<NIM_SHP> {
234public: 237public:
235 explicit NIM_SHP() : ServiceFramework{"nim:shp"} { 238 explicit NIM_SHP(Core::System& system_) : ServiceFramework{system_, "nim:shp"} {
236 // clang-format off 239 // clang-format off
237 static const FunctionInfo functions[] = { 240 static const FunctionInfo functions[] = {
238 {0, nullptr, "RequestDeviceAuthenticationToken"}, 241 {0, nullptr, "RequestDeviceAuthenticationToken"},
@@ -272,8 +275,8 @@ public:
272class IEnsureNetworkClockAvailabilityService final 275class IEnsureNetworkClockAvailabilityService final
273 : public ServiceFramework<IEnsureNetworkClockAvailabilityService> { 276 : public ServiceFramework<IEnsureNetworkClockAvailabilityService> {
274public: 277public:
275 explicit IEnsureNetworkClockAvailabilityService(Core::System& system) 278 explicit IEnsureNetworkClockAvailabilityService(Core::System& system_)
276 : ServiceFramework("IEnsureNetworkClockAvailabilityService") { 279 : ServiceFramework{system_, "IEnsureNetworkClockAvailabilityService"} {
277 static const FunctionInfo functions[] = { 280 static const FunctionInfo functions[] = {
278 {0, &IEnsureNetworkClockAvailabilityService::StartTask, "StartTask"}, 281 {0, &IEnsureNetworkClockAvailabilityService::StartTask, "StartTask"},
279 {1, &IEnsureNetworkClockAvailabilityService::GetFinishNotificationEvent, 282 {1, &IEnsureNetworkClockAvailabilityService::GetFinishNotificationEvent,
@@ -345,7 +348,7 @@ private:
345 348
346class NTC final : public ServiceFramework<NTC> { 349class NTC final : public ServiceFramework<NTC> {
347public: 350public:
348 explicit NTC(Core::System& system) : ServiceFramework{"ntc"}, system(system) { 351 explicit NTC(Core::System& system_) : ServiceFramework{system_, "ntc"} {
349 // clang-format off 352 // clang-format off
350 static const FunctionInfo functions[] = { 353 static const FunctionInfo functions[] = {
351 {0, &NTC::OpenEnsureNetworkClockAvailabilityService, "OpenEnsureNetworkClockAvailabilityService"}, 354 {0, &NTC::OpenEnsureNetworkClockAvailabilityService, "OpenEnsureNetworkClockAvailabilityService"},
@@ -380,13 +383,12 @@ private:
380 IPC::ResponseBuilder rb{ctx, 2}; 383 IPC::ResponseBuilder rb{ctx, 2};
381 rb.Push(RESULT_SUCCESS); 384 rb.Push(RESULT_SUCCESS);
382 } 385 }
383 Core::System& system;
384}; 386};
385 387
386void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) { 388void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
387 std::make_shared<NIM>()->InstallAsService(sm); 389 std::make_shared<NIM>(system)->InstallAsService(sm);
388 std::make_shared<NIM_ECA>()->InstallAsService(sm); 390 std::make_shared<NIM_ECA>(system)->InstallAsService(sm);
389 std::make_shared<NIM_SHP>()->InstallAsService(sm); 391 std::make_shared<NIM_SHP>(system)->InstallAsService(sm);
390 std::make_shared<NTC>(system)->InstallAsService(sm); 392 std::make_shared<NTC>(system)->InstallAsService(sm);
391} 393}
392 394
diff --git a/src/core/hle/service/nim/nim.h b/src/core/hle/service/nim/nim.h
index dbe25dc01..571153fe6 100644
--- a/src/core/hle/service/nim/nim.h
+++ b/src/core/hle/service/nim/nim.h
@@ -4,14 +4,14 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Service::SM {
8class ServiceManager;
9}
10
11namespace Core { 7namespace Core {
12class System; 8class System;
13} 9}
14 10
11namespace Service::SM {
12class ServiceManager;
13}
14
15namespace Service::NIM { 15namespace Service::NIM {
16 16
17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
diff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cpp
index 8fa16fb08..f7a58f659 100644
--- a/src/core/hle/service/npns/npns.cpp
+++ b/src/core/hle/service/npns/npns.cpp
@@ -12,7 +12,7 @@ namespace Service::NPNS {
12 12
13class NPNS_S final : public ServiceFramework<NPNS_S> { 13class NPNS_S final : public ServiceFramework<NPNS_S> {
14public: 14public:
15 explicit NPNS_S() : ServiceFramework{"npns:s"} { 15 explicit NPNS_S(Core::System& system_) : ServiceFramework{system_, "npns:s"} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {1, nullptr, "ListenAll"}, 18 {1, nullptr, "ListenAll"},
@@ -62,7 +62,7 @@ public:
62 62
63class NPNS_U final : public ServiceFramework<NPNS_U> { 63class NPNS_U final : public ServiceFramework<NPNS_U> {
64public: 64public:
65 explicit NPNS_U() : ServiceFramework{"npns:u"} { 65 explicit NPNS_U(Core::System& system_) : ServiceFramework{system_, "npns:u"} {
66 // clang-format off 66 // clang-format off
67 static const FunctionInfo functions[] = { 67 static const FunctionInfo functions[] = {
68 {1, nullptr, "ListenAll"}, 68 {1, nullptr, "ListenAll"},
@@ -91,9 +91,9 @@ public:
91 } 91 }
92}; 92};
93 93
94void InstallInterfaces(SM::ServiceManager& sm) { 94void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
95 std::make_shared<NPNS_S>()->InstallAsService(sm); 95 std::make_shared<NPNS_S>(system)->InstallAsService(sm);
96 std::make_shared<NPNS_U>()->InstallAsService(sm); 96 std::make_shared<NPNS_U>(system)->InstallAsService(sm);
97} 97}
98 98
99} // namespace Service::NPNS 99} // namespace Service::NPNS
diff --git a/src/core/hle/service/npns/npns.h b/src/core/hle/service/npns/npns.h
index 861cd3e48..3b7596b6b 100644
--- a/src/core/hle/service/npns/npns.h
+++ b/src/core/hle/service/npns/npns.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::NPNS { 15namespace Service::NPNS {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::NPNS 19} // namespace Service::NPNS
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp
index 2594e6839..ef7584641 100644
--- a/src/core/hle/service/ns/ns.cpp
+++ b/src/core/hle/service/ns/ns.cpp
@@ -18,7 +18,8 @@
18 18
19namespace Service::NS { 19namespace Service::NS {
20 20
21IAccountProxyInterface::IAccountProxyInterface() : ServiceFramework{"IAccountProxyInterface"} { 21IAccountProxyInterface::IAccountProxyInterface(Core::System& system_)
22 : ServiceFramework{system_, "IAccountProxyInterface"} {
22 // clang-format off 23 // clang-format off
23 static const FunctionInfo functions[] = { 24 static const FunctionInfo functions[] = {
24 {0, nullptr, "CreateUserAccount"}, 25 {0, nullptr, "CreateUserAccount"},
@@ -31,7 +32,7 @@ IAccountProxyInterface::IAccountProxyInterface() : ServiceFramework{"IAccountPro
31IAccountProxyInterface::~IAccountProxyInterface() = default; 32IAccountProxyInterface::~IAccountProxyInterface() = default;
32 33
33IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_) 34IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_)
34 : ServiceFramework{"IApplicationManagerInterface"}, system{system_} { 35 : ServiceFramework{system_, "IApplicationManagerInterface"} {
35 // clang-format off 36 // clang-format off
36 static const FunctionInfo functions[] = { 37 static const FunctionInfo functions[] = {
37 {0, nullptr, "ListApplicationRecord"}, 38 {0, nullptr, "ListApplicationRecord"},
@@ -428,8 +429,8 @@ ResultVal<u64> IApplicationManagerInterface::ConvertApplicationLanguageToLanguag
428 return MakeResult(static_cast<u64>(*language_code)); 429 return MakeResult(static_cast<u64>(*language_code));
429} 430}
430 431
431IApplicationVersionInterface::IApplicationVersionInterface() 432IApplicationVersionInterface::IApplicationVersionInterface(Core::System& system_)
432 : ServiceFramework{"IApplicationVersionInterface"} { 433 : ServiceFramework{system_, "IApplicationVersionInterface"} {
433 // clang-format off 434 // clang-format off
434 static const FunctionInfo functions[] = { 435 static const FunctionInfo functions[] = {
435 {0, nullptr, "GetLaunchRequiredVersion"}, 436 {0, nullptr, "GetLaunchRequiredVersion"},
@@ -449,8 +450,8 @@ IApplicationVersionInterface::IApplicationVersionInterface()
449 450
450IApplicationVersionInterface::~IApplicationVersionInterface() = default; 451IApplicationVersionInterface::~IApplicationVersionInterface() = default;
451 452
452IContentManagementInterface::IContentManagementInterface() 453IContentManagementInterface::IContentManagementInterface(Core::System& system_)
453 : ServiceFramework{"IContentManagementInterface"} { 454 : ServiceFramework{system_, "IContentManagementInterface"} {
454 // clang-format off 455 // clang-format off
455 static const FunctionInfo functions[] = { 456 static const FunctionInfo functions[] = {
456 {11, nullptr, "CalculateApplicationOccupiedSize"}, 457 {11, nullptr, "CalculateApplicationOccupiedSize"},
@@ -469,7 +470,8 @@ IContentManagementInterface::IContentManagementInterface()
469 470
470IContentManagementInterface::~IContentManagementInterface() = default; 471IContentManagementInterface::~IContentManagementInterface() = default;
471 472
472IDocumentInterface::IDocumentInterface() : ServiceFramework{"IDocumentInterface"} { 473IDocumentInterface::IDocumentInterface(Core::System& system_)
474 : ServiceFramework{system_, "IDocumentInterface"} {
473 // clang-format off 475 // clang-format off
474 static const FunctionInfo functions[] = { 476 static const FunctionInfo functions[] = {
475 {21, nullptr, "GetApplicationContentPath"}, 477 {21, nullptr, "GetApplicationContentPath"},
@@ -483,7 +485,8 @@ IDocumentInterface::IDocumentInterface() : ServiceFramework{"IDocumentInterface"
483 485
484IDocumentInterface::~IDocumentInterface() = default; 486IDocumentInterface::~IDocumentInterface() = default;
485 487
486IDownloadTaskInterface::IDownloadTaskInterface() : ServiceFramework{"IDownloadTaskInterface"} { 488IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_)
489 : ServiceFramework{system_, "IDownloadTaskInterface"} {
487 // clang-format off 490 // clang-format off
488 static const FunctionInfo functions[] = { 491 static const FunctionInfo functions[] = {
489 {701, nullptr, "ClearTaskStatusList"}, 492 {701, nullptr, "ClearTaskStatusList"},
@@ -503,7 +506,8 @@ IDownloadTaskInterface::IDownloadTaskInterface() : ServiceFramework{"IDownloadTa
503 506
504IDownloadTaskInterface::~IDownloadTaskInterface() = default; 507IDownloadTaskInterface::~IDownloadTaskInterface() = default;
505 508
506IECommerceInterface::IECommerceInterface() : ServiceFramework{"IECommerceInterface"} { 509IECommerceInterface::IECommerceInterface(Core::System& system_)
510 : ServiceFramework{system_, "IECommerceInterface"} {
507 // clang-format off 511 // clang-format off
508 static const FunctionInfo functions[] = { 512 static const FunctionInfo functions[] = {
509 {0, nullptr, "RequestLinkDevice"}, 513 {0, nullptr, "RequestLinkDevice"},
@@ -521,8 +525,8 @@ IECommerceInterface::IECommerceInterface() : ServiceFramework{"IECommerceInterfa
521 525
522IECommerceInterface::~IECommerceInterface() = default; 526IECommerceInterface::~IECommerceInterface() = default;
523 527
524IFactoryResetInterface::IFactoryResetInterface::IFactoryResetInterface() 528IFactoryResetInterface::IFactoryResetInterface(Core::System& system_)
525 : ServiceFramework{"IFactoryResetInterface"} { 529 : ServiceFramework{system_, "IFactoryResetInterface"} {
526 // clang-format off 530 // clang-format off
527 static const FunctionInfo functions[] = { 531 static const FunctionInfo functions[] = {
528 {100, nullptr, "ResetToFactorySettings"}, 532 {100, nullptr, "ResetToFactorySettings"},
@@ -540,7 +544,7 @@ IFactoryResetInterface::IFactoryResetInterface::IFactoryResetInterface()
540 544
541IFactoryResetInterface::~IFactoryResetInterface() = default; 545IFactoryResetInterface::~IFactoryResetInterface() = default;
542 546
543NS::NS(const char* name, Core::System& system_) : ServiceFramework{name}, system{system_} { 547NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} {
544 // clang-format off 548 // clang-format off
545 static const FunctionInfo functions[] = { 549 static const FunctionInfo functions[] = {
546 {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, 550 {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"},
@@ -565,7 +569,7 @@ std::shared_ptr<IApplicationManagerInterface> NS::GetApplicationManagerInterface
565 569
566class NS_DEV final : public ServiceFramework<NS_DEV> { 570class NS_DEV final : public ServiceFramework<NS_DEV> {
567public: 571public:
568 explicit NS_DEV() : ServiceFramework{"ns:dev"} { 572 explicit NS_DEV(Core::System& system_) : ServiceFramework{system_, "ns:dev"} {
569 // clang-format off 573 // clang-format off
570 static const FunctionInfo functions[] = { 574 static const FunctionInfo functions[] = {
571 {0, nullptr, "LaunchProgram"}, 575 {0, nullptr, "LaunchProgram"},
@@ -592,7 +596,8 @@ public:
592 596
593class ISystemUpdateControl final : public ServiceFramework<ISystemUpdateControl> { 597class ISystemUpdateControl final : public ServiceFramework<ISystemUpdateControl> {
594public: 598public:
595 explicit ISystemUpdateControl() : ServiceFramework{"ISystemUpdateControl"} { 599 explicit ISystemUpdateControl(Core::System& system_)
600 : ServiceFramework{system_, "ISystemUpdateControl"} {
596 // clang-format off 601 // clang-format off
597 static const FunctionInfo functions[] = { 602 static const FunctionInfo functions[] = {
598 {0, nullptr, "HasDownloaded"}, 603 {0, nullptr, "HasDownloaded"},
@@ -627,7 +632,7 @@ public:
627 632
628class NS_SU final : public ServiceFramework<NS_SU> { 633class NS_SU final : public ServiceFramework<NS_SU> {
629public: 634public:
630 explicit NS_SU() : ServiceFramework{"ns:su"} { 635 explicit NS_SU(Core::System& system_) : ServiceFramework{system_, "ns:su"} {
631 // clang-format off 636 // clang-format off
632 static const FunctionInfo functions[] = { 637 static const FunctionInfo functions[] = {
633 {0, nullptr, "GetBackgroundNetworkUpdateState"}, 638 {0, nullptr, "GetBackgroundNetworkUpdateState"},
@@ -659,13 +664,13 @@ private:
659 664
660 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 665 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
661 rb.Push(RESULT_SUCCESS); 666 rb.Push(RESULT_SUCCESS);
662 rb.PushIpcInterface<ISystemUpdateControl>(); 667 rb.PushIpcInterface<ISystemUpdateControl>(system);
663 } 668 }
664}; 669};
665 670
666class NS_VM final : public ServiceFramework<NS_VM> { 671class NS_VM final : public ServiceFramework<NS_VM> {
667public: 672public:
668 explicit NS_VM() : ServiceFramework{"ns:vm"} { 673 explicit NS_VM(Core::System& system_) : ServiceFramework{system_, "ns:vm"} {
669 // clang-format off 674 // clang-format off
670 static const FunctionInfo functions[] = { 675 static const FunctionInfo functions[] = {
671 {1200, nullptr, "NeedsUpdateVulnerability"}, 676 {1200, nullptr, "NeedsUpdateVulnerability"},
@@ -686,9 +691,9 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system
686 std::make_shared<NS>("ns:rt", system)->InstallAsService(service_manager); 691 std::make_shared<NS>("ns:rt", system)->InstallAsService(service_manager);
687 std::make_shared<NS>("ns:web", system)->InstallAsService(service_manager); 692 std::make_shared<NS>("ns:web", system)->InstallAsService(service_manager);
688 693
689 std::make_shared<NS_DEV>()->InstallAsService(service_manager); 694 std::make_shared<NS_DEV>(system)->InstallAsService(service_manager);
690 std::make_shared<NS_SU>()->InstallAsService(service_manager); 695 std::make_shared<NS_SU>(system)->InstallAsService(service_manager);
691 std::make_shared<NS_VM>()->InstallAsService(service_manager); 696 std::make_shared<NS_VM>(system)->InstallAsService(service_manager);
692 697
693 std::make_shared<PL_U>(system)->InstallAsService(service_manager); 698 std::make_shared<PL_U>(system)->InstallAsService(service_manager);
694} 699}
diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h
index c90ccd755..991271f3e 100644
--- a/src/core/hle/service/ns/ns.h
+++ b/src/core/hle/service/ns/ns.h
@@ -20,7 +20,7 @@ namespace NS {
20 20
21class IAccountProxyInterface final : public ServiceFramework<IAccountProxyInterface> { 21class IAccountProxyInterface final : public ServiceFramework<IAccountProxyInterface> {
22public: 22public:
23 explicit IAccountProxyInterface(); 23 explicit IAccountProxyInterface(Core::System& system_);
24 ~IAccountProxyInterface() override; 24 ~IAccountProxyInterface() override;
25}; 25};
26 26
@@ -36,43 +36,41 @@ private:
36 void GetApplicationControlData(Kernel::HLERequestContext& ctx); 36 void GetApplicationControlData(Kernel::HLERequestContext& ctx);
37 void GetApplicationDesiredLanguage(Kernel::HLERequestContext& ctx); 37 void GetApplicationDesiredLanguage(Kernel::HLERequestContext& ctx);
38 void ConvertApplicationLanguageToLanguageCode(Kernel::HLERequestContext& ctx); 38 void ConvertApplicationLanguageToLanguageCode(Kernel::HLERequestContext& ctx);
39
40 Core::System& system;
41}; 39};
42 40
43class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> { 41class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> {
44public: 42public:
45 explicit IApplicationVersionInterface(); 43 explicit IApplicationVersionInterface(Core::System& system_);
46 ~IApplicationVersionInterface() override; 44 ~IApplicationVersionInterface() override;
47}; 45};
48 46
49class IContentManagementInterface final : public ServiceFramework<IContentManagementInterface> { 47class IContentManagementInterface final : public ServiceFramework<IContentManagementInterface> {
50public: 48public:
51 explicit IContentManagementInterface(); 49 explicit IContentManagementInterface(Core::System& system_);
52 ~IContentManagementInterface() override; 50 ~IContentManagementInterface() override;
53}; 51};
54 52
55class IDocumentInterface final : public ServiceFramework<IDocumentInterface> { 53class IDocumentInterface final : public ServiceFramework<IDocumentInterface> {
56public: 54public:
57 explicit IDocumentInterface(); 55 explicit IDocumentInterface(Core::System& system_);
58 ~IDocumentInterface() override; 56 ~IDocumentInterface() override;
59}; 57};
60 58
61class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> { 59class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> {
62public: 60public:
63 explicit IDownloadTaskInterface(); 61 explicit IDownloadTaskInterface(Core::System& system_);
64 ~IDownloadTaskInterface() override; 62 ~IDownloadTaskInterface() override;
65}; 63};
66 64
67class IECommerceInterface final : public ServiceFramework<IECommerceInterface> { 65class IECommerceInterface final : public ServiceFramework<IECommerceInterface> {
68public: 66public:
69 explicit IECommerceInterface(); 67 explicit IECommerceInterface(Core::System& system_);
70 ~IECommerceInterface() override; 68 ~IECommerceInterface() override;
71}; 69};
72 70
73class IFactoryResetInterface final : public ServiceFramework<IFactoryResetInterface> { 71class IFactoryResetInterface final : public ServiceFramework<IFactoryResetInterface> {
74public: 72public:
75 explicit IFactoryResetInterface(); 73 explicit IFactoryResetInterface(Core::System& system_);
76 ~IFactoryResetInterface() override; 74 ~IFactoryResetInterface() override;
77}; 75};
78 76
@@ -90,7 +88,7 @@ private:
90 88
91 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 89 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
92 rb.Push(RESULT_SUCCESS); 90 rb.Push(RESULT_SUCCESS);
93 rb.PushIpcInterface<T>(); 91 rb.PushIpcInterface<T>(system);
94 } 92 }
95 93
96 void PushIApplicationManagerInterface(Kernel::HLERequestContext& ctx) { 94 void PushIApplicationManagerInterface(Kernel::HLERequestContext& ctx) {
@@ -108,8 +106,6 @@ private:
108 106
109 return std::make_shared<T>(std::forward<Args>(args)...); 107 return std::make_shared<T>(std::forward<Args>(args)...);
110 } 108 }
111
112 Core::System& system;
113}; 109};
114 110
115/// Registers all NS services with the specified service manager. 111/// Registers all NS services with the specified service manager.
diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp
index 5ccec2637..ccc137e40 100644
--- a/src/core/hle/service/ns/pl_u.cpp
+++ b/src/core/hle/service/ns/pl_u.cpp
@@ -141,8 +141,8 @@ struct PL_U::Impl {
141 std::vector<FontRegion> shared_font_regions; 141 std::vector<FontRegion> shared_font_regions;
142}; 142};
143 143
144PL_U::PL_U(Core::System& system) 144PL_U::PL_U(Core::System& system_)
145 : ServiceFramework("pl:u"), impl{std::make_unique<Impl>()}, system(system) { 145 : ServiceFramework{system_, "pl:u"}, impl{std::make_unique<Impl>()} {
146 // clang-format off 146 // clang-format off
147 static const FunctionInfo functions[] = { 147 static const FunctionInfo functions[] = {
148 {0, &PL_U::RequestLoad, "RequestLoad"}, 148 {0, &PL_U::RequestLoad, "RequestLoad"},
diff --git a/src/core/hle/service/ns/pl_u.h b/src/core/hle/service/ns/pl_u.h
index 27161bd7a..224dcb997 100644
--- a/src/core/hle/service/ns/pl_u.h
+++ b/src/core/hle/service/ns/pl_u.h
@@ -20,7 +20,7 @@ void EncryptSharedFont(const std::vector<u32>& input, std::vector<u8>& output, s
20 20
21class PL_U final : public ServiceFramework<PL_U> { 21class PL_U final : public ServiceFramework<PL_U> {
22public: 22public:
23 explicit PL_U(Core::System& system); 23 explicit PL_U(Core::System& system_);
24 ~PL_U() override; 24 ~PL_U() override;
25 25
26private: 26private:
@@ -33,7 +33,6 @@ private:
33 33
34 struct Impl; 34 struct Impl;
35 std::unique_ptr<Impl> impl; 35 std::unique_ptr<Impl> impl;
36 Core::System& system;
37}; 36};
38 37
39} // namespace NS 38} // namespace NS
diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp
index 7bfa5cac9..d72c531f6 100644
--- a/src/core/hle/service/nvdrv/interface.cpp
+++ b/src/core/hle/service/nvdrv/interface.cpp
@@ -297,8 +297,8 @@ void NVDRV::DumpGraphicsMemoryInfo(Kernel::HLERequestContext& ctx) {
297 rb.Push(RESULT_SUCCESS); 297 rb.Push(RESULT_SUCCESS);
298} 298}
299 299
300NVDRV::NVDRV(std::shared_ptr<Module> nvdrv, const char* name) 300NVDRV::NVDRV(Core::System& system_, std::shared_ptr<Module> nvdrv_, const char* name)
301 : ServiceFramework(name), nvdrv(std::move(nvdrv)) { 301 : ServiceFramework{system_, name}, nvdrv{std::move(nvdrv_)} {
302 static const FunctionInfo functions[] = { 302 static const FunctionInfo functions[] = {
303 {0, &NVDRV::Open, "Open"}, 303 {0, &NVDRV::Open, "Open"},
304 {1, &NVDRV::Ioctl1, "Ioctl"}, 304 {1, &NVDRV::Ioctl1, "Ioctl"},
diff --git a/src/core/hle/service/nvdrv/interface.h b/src/core/hle/service/nvdrv/interface.h
index e05f905ae..5c777c59b 100644
--- a/src/core/hle/service/nvdrv/interface.h
+++ b/src/core/hle/service/nvdrv/interface.h
@@ -16,10 +16,10 @@ namespace Service::Nvidia {
16 16
17class NVDRV final : public ServiceFramework<NVDRV> { 17class NVDRV final : public ServiceFramework<NVDRV> {
18public: 18public:
19 NVDRV(std::shared_ptr<Module> nvdrv, const char* name); 19 explicit NVDRV(Core::System& system_, std::shared_ptr<Module> nvdrv_, const char* name);
20 ~NVDRV() override; 20 ~NVDRV() override;
21 21
22 void SignalGPUInterruptSyncpt(const u32 syncpoint_id, const u32 value); 22 void SignalGPUInterruptSyncpt(u32 syncpoint_id, u32 value);
23 23
24private: 24private:
25 void Open(Kernel::HLERequestContext& ctx); 25 void Open(Kernel::HLERequestContext& ctx);
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index 56d927b12..8e0c9f093 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -30,11 +30,11 @@ namespace Service::Nvidia {
30void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger, 30void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger,
31 Core::System& system) { 31 Core::System& system) {
32 auto module_ = std::make_shared<Module>(system); 32 auto module_ = std::make_shared<Module>(system);
33 std::make_shared<NVDRV>(module_, "nvdrv")->InstallAsService(service_manager); 33 std::make_shared<NVDRV>(system, module_, "nvdrv")->InstallAsService(service_manager);
34 std::make_shared<NVDRV>(module_, "nvdrv:a")->InstallAsService(service_manager); 34 std::make_shared<NVDRV>(system, module_, "nvdrv:a")->InstallAsService(service_manager);
35 std::make_shared<NVDRV>(module_, "nvdrv:s")->InstallAsService(service_manager); 35 std::make_shared<NVDRV>(system, module_, "nvdrv:s")->InstallAsService(service_manager);
36 std::make_shared<NVDRV>(module_, "nvdrv:t")->InstallAsService(service_manager); 36 std::make_shared<NVDRV>(system, module_, "nvdrv:t")->InstallAsService(service_manager);
37 std::make_shared<NVMEMP>()->InstallAsService(service_manager); 37 std::make_shared<NVMEMP>(system)->InstallAsService(service_manager);
38 nvflinger.SetNVDrvInstance(module_); 38 nvflinger.SetNVDrvInstance(module_);
39} 39}
40 40
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index bfffc1e88..5985d2179 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -100,7 +100,7 @@ struct EventInterface {
100 100
101class Module final { 101class Module final {
102public: 102public:
103 Module(Core::System& system); 103 explicit Module(Core::System& system_);
104 ~Module(); 104 ~Module();
105 105
106 /// Returns a pointer to one of the available devices, identified by its name. 106 /// Returns a pointer to one of the available devices, identified by its name.
diff --git a/src/core/hle/service/nvdrv/nvmemp.cpp b/src/core/hle/service/nvdrv/nvmemp.cpp
index 73b37e805..331c02243 100644
--- a/src/core/hle/service/nvdrv/nvmemp.cpp
+++ b/src/core/hle/service/nvdrv/nvmemp.cpp
@@ -8,7 +8,7 @@
8 8
9namespace Service::Nvidia { 9namespace Service::Nvidia {
10 10
11NVMEMP::NVMEMP() : ServiceFramework("nvmemp") { 11NVMEMP::NVMEMP(Core::System& system_) : ServiceFramework{system_, "nvmemp"} {
12 static const FunctionInfo functions[] = { 12 static const FunctionInfo functions[] = {
13 {0, &NVMEMP::Open, "Open"}, 13 {0, &NVMEMP::Open, "Open"},
14 {1, &NVMEMP::GetAruid, "GetAruid"}, 14 {1, &NVMEMP::GetAruid, "GetAruid"},
diff --git a/src/core/hle/service/nvdrv/nvmemp.h b/src/core/hle/service/nvdrv/nvmemp.h
index c453ee4db..724c27ef9 100644
--- a/src/core/hle/service/nvdrv/nvmemp.h
+++ b/src/core/hle/service/nvdrv/nvmemp.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Nvidia { 13namespace Service::Nvidia {
10 14
11class NVMEMP final : public ServiceFramework<NVMEMP> { 15class NVMEMP final : public ServiceFramework<NVMEMP> {
12public: 16public:
13 NVMEMP(); 17 explicit NVMEMP(Core::System& system_);
14 ~NVMEMP() override; 18 ~NVMEMP() override;
15 19
16private: 20private:
diff --git a/src/core/hle/service/olsc/olsc.cpp b/src/core/hle/service/olsc/olsc.cpp
index aad4ca706..4440135ed 100644
--- a/src/core/hle/service/olsc/olsc.cpp
+++ b/src/core/hle/service/olsc/olsc.cpp
@@ -12,7 +12,7 @@ namespace Service::OLSC {
12 12
13class OLSC final : public ServiceFramework<OLSC> { 13class OLSC final : public ServiceFramework<OLSC> {
14public: 14public:
15 explicit OLSC() : ServiceFramework{"olsc:u"} { 15 explicit OLSC(Core::System& system_) : ServiceFramework{system_, "olsc:u"} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, &OLSC::Initialize, "Initialize"}, 18 {0, &OLSC::Initialize, "Initialize"},
@@ -62,8 +62,8 @@ private:
62 bool initialized{}; 62 bool initialized{};
63}; 63};
64 64
65void InstallInterfaces(SM::ServiceManager& service_manager) { 65void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
66 std::make_shared<OLSC>()->InstallAsService(service_manager); 66 std::make_shared<OLSC>(system)->InstallAsService(service_manager);
67} 67}
68 68
69} // namespace Service::OLSC 69} // namespace Service::OLSC
diff --git a/src/core/hle/service/olsc/olsc.h b/src/core/hle/service/olsc/olsc.h
index edee4376b..24f24ca6b 100644
--- a/src/core/hle/service/olsc/olsc.h
+++ b/src/core/hle/service/olsc/olsc.h
@@ -4,6 +4,10 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
@@ -11,6 +15,6 @@ class ServiceManager;
11namespace Service::OLSC { 15namespace Service::OLSC {
12 16
13/// Registers all SSL services with the specified service manager. 17/// Registers all SSL services with the specified service manager.
14void InstallInterfaces(SM::ServiceManager& service_manager); 18void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
15 19
16} // namespace Service::OLSC 20} // namespace Service::OLSC
diff --git a/src/core/hle/service/pcie/pcie.cpp b/src/core/hle/service/pcie/pcie.cpp
index c568a0adc..80c0fc7ac 100644
--- a/src/core/hle/service/pcie/pcie.cpp
+++ b/src/core/hle/service/pcie/pcie.cpp
@@ -12,7 +12,7 @@ namespace Service::PCIe {
12 12
13class ISession final : public ServiceFramework<ISession> { 13class ISession final : public ServiceFramework<ISession> {
14public: 14public:
15 explicit ISession() : ServiceFramework{"ISession"} { 15 explicit ISession(Core::System& system_) : ServiceFramework{system_, "ISession"} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, nullptr, "QueryFunctions"}, 18 {0, nullptr, "QueryFunctions"},
@@ -48,7 +48,7 @@ public:
48 48
49class PCIe final : public ServiceFramework<PCIe> { 49class PCIe final : public ServiceFramework<PCIe> {
50public: 50public:
51 explicit PCIe() : ServiceFramework{"pcie"} { 51 explicit PCIe(Core::System& system_) : ServiceFramework{system, "pcie"} {
52 // clang-format off 52 // clang-format off
53 static const FunctionInfo functions[] = { 53 static const FunctionInfo functions[] = {
54 {0, nullptr, "RegisterClassDriver"}, 54 {0, nullptr, "RegisterClassDriver"},
@@ -60,8 +60,8 @@ public:
60 } 60 }
61}; 61};
62 62
63void InstallInterfaces(SM::ServiceManager& sm) { 63void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
64 std::make_shared<PCIe>()->InstallAsService(sm); 64 std::make_shared<PCIe>(system)->InstallAsService(sm);
65} 65}
66 66
67} // namespace Service::PCIe 67} // namespace Service::PCIe
diff --git a/src/core/hle/service/pcie/pcie.h b/src/core/hle/service/pcie/pcie.h
index 59c22ca45..e5709a72f 100644
--- a/src/core/hle/service/pcie/pcie.h
+++ b/src/core/hle/service/pcie/pcie.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::PCIe { 15namespace Service::PCIe {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::PCIe 19} // namespace Service::PCIe
diff --git a/src/core/hle/service/pctl/module.cpp b/src/core/hle/service/pctl/module.cpp
index caf14ed61..6ab1e4124 100644
--- a/src/core/hle/service/pctl/module.cpp
+++ b/src/core/hle/service/pctl/module.cpp
@@ -11,7 +11,8 @@ namespace Service::PCTL {
11 11
12class IParentalControlService final : public ServiceFramework<IParentalControlService> { 12class IParentalControlService final : public ServiceFramework<IParentalControlService> {
13public: 13public:
14 IParentalControlService() : ServiceFramework("IParentalControlService") { 14 explicit IParentalControlService(Core::System& system_)
15 : ServiceFramework{system_, "IParentalControlService"} {
15 // clang-format off 16 // clang-format off
16 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
17 {1, &IParentalControlService::Initialize, "Initialize"}, 18 {1, &IParentalControlService::Initialize, "Initialize"},
@@ -137,7 +138,7 @@ void Module::Interface::CreateService(Kernel::HLERequestContext& ctx) {
137 138
138 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 139 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
139 rb.Push(RESULT_SUCCESS); 140 rb.Push(RESULT_SUCCESS);
140 rb.PushIpcInterface<IParentalControlService>(); 141 rb.PushIpcInterface<IParentalControlService>(system);
141} 142}
142 143
143void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx) { 144void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx) {
@@ -145,20 +146,20 @@ void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext
145 146
146 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 147 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
147 rb.Push(RESULT_SUCCESS); 148 rb.Push(RESULT_SUCCESS);
148 rb.PushIpcInterface<IParentalControlService>(); 149 rb.PushIpcInterface<IParentalControlService>(system);
149} 150}
150 151
151Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) 152Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_, const char* name)
152 : ServiceFramework(name), module(std::move(module)) {} 153 : ServiceFramework{system_, name}, module{std::move(module_)} {}
153 154
154Module::Interface::~Interface() = default; 155Module::Interface::~Interface() = default;
155 156
156void InstallInterfaces(SM::ServiceManager& service_manager) { 157void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
157 auto module = std::make_shared<Module>(); 158 auto module = std::make_shared<Module>();
158 std::make_shared<PCTL>(module, "pctl")->InstallAsService(service_manager); 159 std::make_shared<PCTL>(system, module, "pctl")->InstallAsService(service_manager);
159 std::make_shared<PCTL>(module, "pctl:a")->InstallAsService(service_manager); 160 std::make_shared<PCTL>(system, module, "pctl:a")->InstallAsService(service_manager);
160 std::make_shared<PCTL>(module, "pctl:r")->InstallAsService(service_manager); 161 std::make_shared<PCTL>(system, module, "pctl:r")->InstallAsService(service_manager);
161 std::make_shared<PCTL>(module, "pctl:s")->InstallAsService(service_manager); 162 std::make_shared<PCTL>(system, module, "pctl:s")->InstallAsService(service_manager);
162} 163}
163 164
164} // namespace Service::PCTL 165} // namespace Service::PCTL
diff --git a/src/core/hle/service/pctl/module.h b/src/core/hle/service/pctl/module.h
index 3e449110d..4c7e09a3b 100644
--- a/src/core/hle/service/pctl/module.h
+++ b/src/core/hle/service/pctl/module.h
@@ -6,13 +6,18 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::PCTL { 13namespace Service::PCTL {
10 14
11class Module final { 15class Module final {
12public: 16public:
13 class Interface : public ServiceFramework<Interface> { 17 class Interface : public ServiceFramework<Interface> {
14 public: 18 public:
15 explicit Interface(std::shared_ptr<Module> module, const char* name); 19 explicit Interface(Core::System& system_, std::shared_ptr<Module> module_,
20 const char* name);
16 ~Interface() override; 21 ~Interface() override;
17 22
18 void CreateService(Kernel::HLERequestContext& ctx); 23 void CreateService(Kernel::HLERequestContext& ctx);
@@ -24,6 +29,6 @@ public:
24}; 29};
25 30
26/// Registers all PCTL services with the specified service manager. 31/// Registers all PCTL services with the specified service manager.
27void InstallInterfaces(SM::ServiceManager& service_manager); 32void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
28 33
29} // namespace Service::PCTL 34} // namespace Service::PCTL
diff --git a/src/core/hle/service/pctl/pctl.cpp b/src/core/hle/service/pctl/pctl.cpp
index af9d1433a..16dd34f90 100644
--- a/src/core/hle/service/pctl/pctl.cpp
+++ b/src/core/hle/service/pctl/pctl.cpp
@@ -6,8 +6,8 @@
6 6
7namespace Service::PCTL { 7namespace Service::PCTL {
8 8
9PCTL::PCTL(std::shared_ptr<Module> module, const char* name) 9PCTL::PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name)
10 : Module::Interface(std::move(module), name) { 10 : Interface{system_, std::move(module_), name} {
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, &PCTL::CreateService, "CreateService"}, 12 {0, &PCTL::CreateService, "CreateService"},
13 {1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"}, 13 {1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"},
diff --git a/src/core/hle/service/pctl/pctl.h b/src/core/hle/service/pctl/pctl.h
index c33ea80b6..275d23007 100644
--- a/src/core/hle/service/pctl/pctl.h
+++ b/src/core/hle/service/pctl/pctl.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/pctl/module.h" 7#include "core/hle/service/pctl/module.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::PCTL { 13namespace Service::PCTL {
10 14
11class PCTL final : public Module::Interface { 15class PCTL final : public Module::Interface {
12public: 16public:
13 explicit PCTL(std::shared_ptr<Module> module, const char* name); 17 explicit PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name);
14 ~PCTL() override; 18 ~PCTL() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/pcv/pcv.cpp b/src/core/hle/service/pcv/pcv.cpp
index 8bfc0276e..68b2c4178 100644
--- a/src/core/hle/service/pcv/pcv.cpp
+++ b/src/core/hle/service/pcv/pcv.cpp
@@ -12,7 +12,7 @@ namespace Service::PCV {
12 12
13class PCV final : public ServiceFramework<PCV> { 13class PCV final : public ServiceFramework<PCV> {
14public: 14public:
15 explicit PCV() : ServiceFramework{"pcv"} { 15 explicit PCV(Core::System& system_) : ServiceFramework{system_, "pcv"} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, nullptr, "SetPowerEnabled"}, 18 {0, nullptr, "SetPowerEnabled"},
@@ -54,7 +54,7 @@ public:
54 54
55class PCV_ARB final : public ServiceFramework<PCV_ARB> { 55class PCV_ARB final : public ServiceFramework<PCV_ARB> {
56public: 56public:
57 explicit PCV_ARB() : ServiceFramework{"pcv:arb"} { 57 explicit PCV_ARB(Core::System& system_) : ServiceFramework{system_, "pcv:arb"} {
58 // clang-format off 58 // clang-format off
59 static const FunctionInfo functions[] = { 59 static const FunctionInfo functions[] = {
60 {0, nullptr, "ReleaseControl"}, 60 {0, nullptr, "ReleaseControl"},
@@ -67,7 +67,7 @@ public:
67 67
68class PCV_IMM final : public ServiceFramework<PCV_IMM> { 68class PCV_IMM final : public ServiceFramework<PCV_IMM> {
69public: 69public:
70 explicit PCV_IMM() : ServiceFramework{"pcv:imm"} { 70 explicit PCV_IMM(Core::System& system_) : ServiceFramework{system_, "pcv:imm"} {
71 // clang-format off 71 // clang-format off
72 static const FunctionInfo functions[] = { 72 static const FunctionInfo functions[] = {
73 {0, nullptr, "SetClockRate"}, 73 {0, nullptr, "SetClockRate"},
@@ -78,10 +78,10 @@ public:
78 } 78 }
79}; 79};
80 80
81void InstallInterfaces(SM::ServiceManager& sm) { 81void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
82 std::make_shared<PCV>()->InstallAsService(sm); 82 std::make_shared<PCV>(system)->InstallAsService(sm);
83 std::make_shared<PCV_ARB>()->InstallAsService(sm); 83 std::make_shared<PCV_ARB>(system)->InstallAsService(sm);
84 std::make_shared<PCV_IMM>()->InstallAsService(sm); 84 std::make_shared<PCV_IMM>(system)->InstallAsService(sm);
85} 85}
86 86
87} // namespace Service::PCV 87} // namespace Service::PCV
diff --git a/src/core/hle/service/pcv/pcv.h b/src/core/hle/service/pcv/pcv.h
index 219a893c3..c61a0b591 100644
--- a/src/core/hle/service/pcv/pcv.h
+++ b/src/core/hle/service/pcv/pcv.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::PCV { 15namespace Service::PCV {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::PCV 19} // namespace Service::PCV
diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp
index a771a51b4..68736c40c 100644
--- a/src/core/hle/service/pm/pm.cpp
+++ b/src/core/hle/service/pm/pm.cpp
@@ -44,7 +44,7 @@ void GetApplicationPidGeneric(Kernel::HLERequestContext& ctx,
44 44
45class BootMode final : public ServiceFramework<BootMode> { 45class BootMode final : public ServiceFramework<BootMode> {
46public: 46public:
47 explicit BootMode() : ServiceFramework{"pm:bm"} { 47 explicit BootMode(Core::System& system_) : ServiceFramework{system_, "pm:bm"} {
48 static const FunctionInfo functions[] = { 48 static const FunctionInfo functions[] = {
49 {0, &BootMode::GetBootMode, "GetBootMode"}, 49 {0, &BootMode::GetBootMode, "GetBootMode"},
50 {1, &BootMode::SetMaintenanceBoot, "SetMaintenanceBoot"}, 50 {1, &BootMode::SetMaintenanceBoot, "SetMaintenanceBoot"},
@@ -75,8 +75,8 @@ private:
75 75
76class DebugMonitor final : public ServiceFramework<DebugMonitor> { 76class DebugMonitor final : public ServiceFramework<DebugMonitor> {
77public: 77public:
78 explicit DebugMonitor(const Kernel::KernelCore& kernel) 78 explicit DebugMonitor(Core::System& system_)
79 : ServiceFramework{"pm:dmnt"}, kernel(kernel) { 79 : ServiceFramework{system_, "pm:dmnt"}, kernel{system_.Kernel()} {
80 // clang-format off 80 // clang-format off
81 static const FunctionInfo functions[] = { 81 static const FunctionInfo functions[] = {
82 {0, nullptr, "GetJitDebugProcessIdList"}, 82 {0, nullptr, "GetJitDebugProcessIdList"},
@@ -125,8 +125,9 @@ private:
125 125
126class Info final : public ServiceFramework<Info> { 126class Info final : public ServiceFramework<Info> {
127public: 127public:
128 explicit Info(const std::vector<std::shared_ptr<Kernel::Process>>& process_list) 128 explicit Info(Core::System& system_,
129 : ServiceFramework{"pm:info"}, process_list(process_list) { 129 const std::vector<std::shared_ptr<Kernel::Process>>& process_list_)
130 : ServiceFramework{system_, "pm:info"}, process_list{process_list_} {
130 static const FunctionInfo functions[] = { 131 static const FunctionInfo functions[] = {
131 {0, &Info::GetTitleId, "GetTitleId"}, 132 {0, &Info::GetTitleId, "GetTitleId"},
132 }; 133 };
@@ -160,8 +161,8 @@ private:
160 161
161class Shell final : public ServiceFramework<Shell> { 162class Shell final : public ServiceFramework<Shell> {
162public: 163public:
163 explicit Shell(const Kernel::KernelCore& kernel) 164 explicit Shell(Core::System& system_)
164 : ServiceFramework{"pm:shell"}, kernel(kernel) { 165 : ServiceFramework{system_, "pm:shell"}, kernel{system_.Kernel()} {
165 // clang-format off 166 // clang-format off
166 static const FunctionInfo functions[] = { 167 static const FunctionInfo functions[] = {
167 {0, nullptr, "LaunchProgram"}, 168 {0, nullptr, "LaunchProgram"},
@@ -190,11 +191,11 @@ private:
190}; 191};
191 192
192void InstallInterfaces(Core::System& system) { 193void InstallInterfaces(Core::System& system) {
193 std::make_shared<BootMode>()->InstallAsService(system.ServiceManager()); 194 std::make_shared<BootMode>(system)->InstallAsService(system.ServiceManager());
194 std::make_shared<DebugMonitor>(system.Kernel())->InstallAsService(system.ServiceManager()); 195 std::make_shared<DebugMonitor>(system)->InstallAsService(system.ServiceManager());
195 std::make_shared<Info>(system.Kernel().GetProcessList()) 196 std::make_shared<Info>(system, system.Kernel().GetProcessList())
196 ->InstallAsService(system.ServiceManager()); 197 ->InstallAsService(system.ServiceManager());
197 std::make_shared<Shell>(system.Kernel())->InstallAsService(system.ServiceManager()); 198 std::make_shared<Shell>(system)->InstallAsService(system.ServiceManager());
198} 199}
199 200
200} // namespace Service::PM 201} // namespace Service::PM
diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp
index b9ef86b72..392fda73e 100644
--- a/src/core/hle/service/prepo/prepo.cpp
+++ b/src/core/hle/service/prepo/prepo.cpp
@@ -16,8 +16,7 @@ namespace Service::PlayReport {
16 16
17class PlayReport final : public ServiceFramework<PlayReport> { 17class PlayReport final : public ServiceFramework<PlayReport> {
18public: 18public:
19 explicit PlayReport(const char* name, Core::System& system) 19 explicit PlayReport(const char* name, Core::System& system_) : ServiceFramework{system_, name} {
20 : ServiceFramework{name}, system(system) {
21 // clang-format off 20 // clang-format off
22 static const FunctionInfo functions[] = { 21 static const FunctionInfo functions[] = {
23 {10100, &PlayReport::SaveReport<Core::Reporter::PlayReportType::Old>, "SaveReportOld"}, 22 {10100, &PlayReport::SaveReport<Core::Reporter::PlayReportType::Old>, "SaveReportOld"},
@@ -140,8 +139,6 @@ private:
140 IPC::ResponseBuilder rb{ctx, 2}; 139 IPC::ResponseBuilder rb{ctx, 2};
141 rb.Push(RESULT_SUCCESS); 140 rb.Push(RESULT_SUCCESS);
142 } 141 }
143
144 Core::System& system;
145}; 142};
146 143
147void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { 144void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
diff --git a/src/core/hle/service/prepo/prepo.h b/src/core/hle/service/prepo/prepo.h
index a5682ee26..395b57ead 100644
--- a/src/core/hle/service/prepo/prepo.h
+++ b/src/core/hle/service/prepo/prepo.h
@@ -4,14 +4,14 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Service::SM {
8class ServiceManager;
9}
10
11namespace Core { 7namespace Core {
12class System; 8class System;
13} 9}
14 10
11namespace Service::SM {
12class ServiceManager;
13}
14
15namespace Service::PlayReport { 15namespace Service::PlayReport {
16 16
17void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system); 17void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
diff --git a/src/core/hle/service/psc/psc.cpp b/src/core/hle/service/psc/psc.cpp
index 99e1c9042..5a52b2b05 100644
--- a/src/core/hle/service/psc/psc.cpp
+++ b/src/core/hle/service/psc/psc.cpp
@@ -14,7 +14,7 @@ namespace Service::PSC {
14 14
15class PSC_C final : public ServiceFramework<PSC_C> { 15class PSC_C final : public ServiceFramework<PSC_C> {
16public: 16public:
17 explicit PSC_C() : ServiceFramework{"psc:c"} { 17 explicit PSC_C(Core::System& system_) : ServiceFramework{system_, "psc:c"} {
18 // clang-format off 18 // clang-format off
19 static const FunctionInfo functions[] = { 19 static const FunctionInfo functions[] = {
20 {0, nullptr, "Initialize"}, 20 {0, nullptr, "Initialize"},
@@ -35,7 +35,7 @@ public:
35 35
36class IPmModule final : public ServiceFramework<IPmModule> { 36class IPmModule final : public ServiceFramework<IPmModule> {
37public: 37public:
38 explicit IPmModule() : ServiceFramework{"IPmModule"} { 38 explicit IPmModule(Core::System& system_) : ServiceFramework{system_, "IPmModule"} {
39 // clang-format off 39 // clang-format off
40 static const FunctionInfo functions[] = { 40 static const FunctionInfo functions[] = {
41 {0, nullptr, "Initialize"}, 41 {0, nullptr, "Initialize"},
@@ -52,7 +52,7 @@ public:
52 52
53class PSC_M final : public ServiceFramework<PSC_M> { 53class PSC_M final : public ServiceFramework<PSC_M> {
54public: 54public:
55 explicit PSC_M() : ServiceFramework{"psc:m"} { 55 explicit PSC_M(Core::System& system_) : ServiceFramework{system_, "psc:m"} {
56 // clang-format off 56 // clang-format off
57 static const FunctionInfo functions[] = { 57 static const FunctionInfo functions[] = {
58 {0, &PSC_M::GetPmModule, "GetPmModule"}, 58 {0, &PSC_M::GetPmModule, "GetPmModule"},
@@ -68,13 +68,13 @@ private:
68 68
69 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 69 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
70 rb.Push(RESULT_SUCCESS); 70 rb.Push(RESULT_SUCCESS);
71 rb.PushIpcInterface<IPmModule>(); 71 rb.PushIpcInterface<IPmModule>(system);
72 } 72 }
73}; 73};
74 74
75void InstallInterfaces(SM::ServiceManager& sm) { 75void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
76 std::make_shared<PSC_C>()->InstallAsService(sm); 76 std::make_shared<PSC_C>(system)->InstallAsService(sm);
77 std::make_shared<PSC_M>()->InstallAsService(sm); 77 std::make_shared<PSC_M>(system)->InstallAsService(sm);
78} 78}
79 79
80} // namespace Service::PSC 80} // namespace Service::PSC
diff --git a/src/core/hle/service/psc/psc.h b/src/core/hle/service/psc/psc.h
index 5052eb02c..89344f32d 100644
--- a/src/core/hle/service/psc/psc.h
+++ b/src/core/hle/service/psc/psc.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::PSC { 15namespace Service::PSC {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::PSC 19} // namespace Service::PSC
diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cpp
index 6d9e6bd09..b4b0dd241 100644
--- a/src/core/hle/service/ptm/psm.cpp
+++ b/src/core/hle/service/ptm/psm.cpp
@@ -14,7 +14,7 @@ namespace Service::PSM {
14 14
15class PSM final : public ServiceFramework<PSM> { 15class PSM final : public ServiceFramework<PSM> {
16public: 16public:
17 explicit PSM() : ServiceFramework{"psm"} { 17 explicit PSM(Core::System& system_) : ServiceFramework{system_, "psm"} {
18 // clang-format off 18 // clang-format off
19 static const FunctionInfo functions[] = { 19 static const FunctionInfo functions[] = {
20 {0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"}, 20 {0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"},
@@ -72,8 +72,8 @@ private:
72 ChargerType charger_type{ChargerType::RegularCharger}; 72 ChargerType charger_type{ChargerType::RegularCharger};
73}; 73};
74 74
75void InstallInterfaces(SM::ServiceManager& sm) { 75void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
76 std::make_shared<PSM>()->InstallAsService(sm); 76 std::make_shared<PSM>(system)->InstallAsService(sm);
77} 77}
78 78
79} // namespace Service::PSM 79} // namespace Service::PSM
diff --git a/src/core/hle/service/ptm/psm.h b/src/core/hle/service/ptm/psm.h
index a286793ae..2930ce26a 100644
--- a/src/core/hle/service/ptm/psm.h
+++ b/src/core/hle/service/ptm/psm.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::PSM { 15namespace Service::PSM {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::PSM 19} // namespace Service::PSM
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index fb4979af2..360e0bf37 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -90,9 +90,10 @@ namespace Service {
90 return function_string; 90 return function_string;
91} 91}
92 92
93ServiceFrameworkBase::ServiceFrameworkBase(const char* service_name, u32 max_sessions, 93ServiceFrameworkBase::ServiceFrameworkBase(Core::System& system_, const char* service_name_,
94 InvokerFn* handler_invoker) 94 u32 max_sessions_, InvokerFn* handler_invoker_)
95 : service_name(service_name), max_sessions(max_sessions), handler_invoker(handler_invoker) {} 95 : system{system_}, service_name{service_name_}, max_sessions{max_sessions_},
96 handler_invoker{handler_invoker_} {}
96 97
97ServiceFrameworkBase::~ServiceFrameworkBase() = default; 98ServiceFrameworkBase::~ServiceFrameworkBase() = default;
98 99
@@ -146,8 +147,8 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext
146 } 147 }
147 buf.push_back('}'); 148 buf.push_back('}');
148 149
149 Core::System::GetInstance().GetReporter().SaveUnimplementedFunctionReport( 150 system.GetReporter().SaveUnimplementedFunctionReport(ctx, ctx.GetCommand(), function_name,
150 ctx, ctx.GetCommand(), function_name, service_name); 151 service_name);
151 UNIMPLEMENTED_MSG("Unknown / unimplemented {}", fmt::to_string(buf)); 152 UNIMPLEMENTED_MSG("Unknown / unimplemented {}", fmt::to_string(buf));
152} 153}
153 154
@@ -171,7 +172,7 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& co
171 } 172 }
172 case IPC::CommandType::ControlWithContext: 173 case IPC::CommandType::ControlWithContext:
173 case IPC::CommandType::Control: { 174 case IPC::CommandType::Control: {
174 Core::System::GetInstance().ServiceManager().InvokeControlRequest(context); 175 system.ServiceManager().InvokeControlRequest(context);
175 break; 176 break;
176 } 177 }
177 case IPC::CommandType::RequestWithContext: 178 case IPC::CommandType::RequestWithContext:
@@ -197,7 +198,7 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system
197 198
198 system.GetFileSystemController().CreateFactories(*system.GetFilesystem(), false); 199 system.GetFileSystemController().CreateFactories(*system.GetFilesystem(), false);
199 200
200 SM::ServiceManager::InstallInterfaces(sm, system.Kernel()); 201 SM::ServiceManager::InstallInterfaces(sm, system);
201 202
202 Account::InstallInterfaces(system); 203 Account::InstallInterfaces(system);
203 AM::InstallInterfaces(*sm, *nv_flinger, system); 204 AM::InstallInterfaces(*sm, *nv_flinger, system);
@@ -205,51 +206,51 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system
205 APM::InstallInterfaces(system); 206 APM::InstallInterfaces(system);
206 Audio::InstallInterfaces(*sm, system); 207 Audio::InstallInterfaces(*sm, system);
207 BCAT::InstallInterfaces(system); 208 BCAT::InstallInterfaces(system);
208 BPC::InstallInterfaces(*sm); 209 BPC::InstallInterfaces(*sm, system);
209 BtDrv::InstallInterfaces(*sm, system); 210 BtDrv::InstallInterfaces(*sm, system);
210 BTM::InstallInterfaces(*sm, system); 211 BTM::InstallInterfaces(*sm, system);
211 Capture::InstallInterfaces(*sm); 212 Capture::InstallInterfaces(*sm, system);
212 ERPT::InstallInterfaces(*sm); 213 ERPT::InstallInterfaces(*sm, system);
213 ES::InstallInterfaces(*sm); 214 ES::InstallInterfaces(*sm, system);
214 EUPLD::InstallInterfaces(*sm); 215 EUPLD::InstallInterfaces(*sm, system);
215 Fatal::InstallInterfaces(*sm, system); 216 Fatal::InstallInterfaces(*sm, system);
216 FGM::InstallInterfaces(*sm); 217 FGM::InstallInterfaces(*sm, system);
217 FileSystem::InstallInterfaces(system); 218 FileSystem::InstallInterfaces(system);
218 Friend::InstallInterfaces(*sm, system); 219 Friend::InstallInterfaces(*sm, system);
219 Glue::InstallInterfaces(system); 220 Glue::InstallInterfaces(system);
220 GRC::InstallInterfaces(*sm); 221 GRC::InstallInterfaces(*sm, system);
221 HID::InstallInterfaces(*sm, system); 222 HID::InstallInterfaces(*sm, system);
222 LBL::InstallInterfaces(*sm); 223 LBL::InstallInterfaces(*sm, system);
223 LDN::InstallInterfaces(*sm); 224 LDN::InstallInterfaces(*sm, system);
224 LDR::InstallInterfaces(*sm, system); 225 LDR::InstallInterfaces(*sm, system);
225 LM::InstallInterfaces(system); 226 LM::InstallInterfaces(system);
226 Migration::InstallInterfaces(*sm); 227 Migration::InstallInterfaces(*sm, system);
227 Mii::InstallInterfaces(*sm); 228 Mii::InstallInterfaces(*sm, system);
228 MM::InstallInterfaces(*sm); 229 MM::InstallInterfaces(*sm, system);
229 NCM::InstallInterfaces(*sm); 230 NCM::InstallInterfaces(*sm, system);
230 NFC::InstallInterfaces(*sm); 231 NFC::InstallInterfaces(*sm, system);
231 NFP::InstallInterfaces(*sm, system); 232 NFP::InstallInterfaces(*sm, system);
232 NIFM::InstallInterfaces(*sm, system); 233 NIFM::InstallInterfaces(*sm, system);
233 NIM::InstallInterfaces(*sm, system); 234 NIM::InstallInterfaces(*sm, system);
234 NPNS::InstallInterfaces(*sm); 235 NPNS::InstallInterfaces(*sm, system);
235 NS::InstallInterfaces(*sm, system); 236 NS::InstallInterfaces(*sm, system);
236 Nvidia::InstallInterfaces(*sm, *nv_flinger, system); 237 Nvidia::InstallInterfaces(*sm, *nv_flinger, system);
237 OLSC::InstallInterfaces(*sm); 238 OLSC::InstallInterfaces(*sm, system);
238 PCIe::InstallInterfaces(*sm); 239 PCIe::InstallInterfaces(*sm, system);
239 PCTL::InstallInterfaces(*sm); 240 PCTL::InstallInterfaces(*sm, system);
240 PCV::InstallInterfaces(*sm); 241 PCV::InstallInterfaces(*sm, system);
241 PlayReport::InstallInterfaces(*sm, system); 242 PlayReport::InstallInterfaces(*sm, system);
242 PM::InstallInterfaces(system); 243 PM::InstallInterfaces(system);
243 PSC::InstallInterfaces(*sm); 244 PSC::InstallInterfaces(*sm, system);
244 PSM::InstallInterfaces(*sm); 245 PSM::InstallInterfaces(*sm, system);
245 Set::InstallInterfaces(*sm); 246 Set::InstallInterfaces(*sm, system);
246 Sockets::InstallInterfaces(*sm, system); 247 Sockets::InstallInterfaces(*sm, system);
247 SPL::InstallInterfaces(*sm); 248 SPL::InstallInterfaces(*sm, system);
248 SSL::InstallInterfaces(*sm); 249 SSL::InstallInterfaces(*sm, system);
249 Time::InstallInterfaces(system); 250 Time::InstallInterfaces(system);
250 USB::InstallInterfaces(*sm); 251 USB::InstallInterfaces(*sm, system);
251 VI::InstallInterfaces(*sm, *nv_flinger); 252 VI::InstallInterfaces(*sm, system, *nv_flinger);
252 WLAN::InstallInterfaces(*sm); 253 WLAN::InstallInterfaces(*sm, system);
253} 254}
254 255
255Services::~Services() = default; 256Services::~Services() = default;
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index ed4792289..62a182310 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -80,6 +80,9 @@ protected:
80 template <typename Self> 80 template <typename Self>
81 using HandlerFnP = void (Self::*)(Kernel::HLERequestContext&); 81 using HandlerFnP = void (Self::*)(Kernel::HLERequestContext&);
82 82
83 /// System context that the service operates under.
84 Core::System& system;
85
83private: 86private:
84 template <typename T> 87 template <typename T>
85 friend class ServiceFramework; 88 friend class ServiceFramework;
@@ -93,7 +96,8 @@ private:
93 using InvokerFn = void(ServiceFrameworkBase* object, HandlerFnP<ServiceFrameworkBase> member, 96 using InvokerFn = void(ServiceFrameworkBase* object, HandlerFnP<ServiceFrameworkBase> member,
94 Kernel::HLERequestContext& ctx); 97 Kernel::HLERequestContext& ctx);
95 98
96 ServiceFrameworkBase(const char* service_name, u32 max_sessions, InvokerFn* handler_invoker); 99 explicit ServiceFrameworkBase(Core::System& system_, const char* service_name_,
100 u32 max_sessions_, InvokerFn* handler_invoker_);
97 ~ServiceFrameworkBase() override; 101 ~ServiceFrameworkBase() override;
98 102
99 void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n); 103 void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n);
@@ -151,11 +155,15 @@ protected:
151 155
152 /** 156 /**
153 * Initializes the handler with no functions installed. 157 * Initializes the handler with no functions installed.
154 * @param max_sessions Maximum number of sessions that can be 158 *
155 * connected to this service at the same time. 159 * @param system_ The system context to construct this service under.
160 * @param service_name_ Name of the service.
161 * @param max_sessions_ Maximum number of sessions that can be
162 * connected to this service at the same time.
156 */ 163 */
157 explicit ServiceFramework(const char* service_name, u32 max_sessions = DefaultMaxSessions) 164 explicit ServiceFramework(Core::System& system_, const char* service_name_,
158 : ServiceFrameworkBase(service_name, max_sessions, Invoker) {} 165 u32 max_sessions_ = DefaultMaxSessions)
166 : ServiceFrameworkBase(system_, service_name_, max_sessions_, Invoker) {}
159 167
160 /// Registers handlers in the service. 168 /// Registers handlers in the service.
161 template <std::size_t N> 169 template <std::size_t N>
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp
index ffbf90b00..d953b4303 100644
--- a/src/core/hle/service/set/set.cpp
+++ b/src/core/hle/service/set/set.cpp
@@ -188,7 +188,7 @@ void SET::GetKeyCodeMap2(Kernel::HLERequestContext& ctx) {
188 GetKeyCodeMapImpl(ctx); 188 GetKeyCodeMapImpl(ctx);
189} 189}
190 190
191SET::SET() : ServiceFramework("set") { 191SET::SET(Core::System& system_) : ServiceFramework{system_, "set"} {
192 // clang-format off 192 // clang-format off
193 static const FunctionInfo functions[] = { 193 static const FunctionInfo functions[] = {
194 {0, &SET::GetLanguageCode, "GetLanguageCode"}, 194 {0, &SET::GetLanguageCode, "GetLanguageCode"},
diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/set.h
index 8ac9c169d..d5bd7828d 100644
--- a/src/core/hle/service/set/set.h
+++ b/src/core/hle/service/set/set.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Set { 13namespace Service::Set {
10 14
11/// This is "nn::settings::LanguageCode", which is a NUL-terminated string stored in a u64. 15/// This is "nn::settings::LanguageCode", which is a NUL-terminated string stored in a u64.
@@ -32,7 +36,7 @@ LanguageCode GetLanguageCodeFromIndex(std::size_t idx);
32 36
33class SET final : public ServiceFramework<SET> { 37class SET final : public ServiceFramework<SET> {
34public: 38public:
35 explicit SET(); 39 explicit SET(Core::System& system_);
36 ~SET() override; 40 ~SET() override;
37 41
38private: 42private:
diff --git a/src/core/hle/service/set/set_cal.cpp b/src/core/hle/service/set/set_cal.cpp
index 3fbfecc9e..b2aa7bc0c 100644
--- a/src/core/hle/service/set/set_cal.cpp
+++ b/src/core/hle/service/set/set_cal.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::Set { 7namespace Service::Set {
8 8
9SET_CAL::SET_CAL() : ServiceFramework("set:cal") { 9SET_CAL::SET_CAL(Core::System& system_) : ServiceFramework{system_, "set:cal"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, nullptr, "GetBluetoothBdAddress"}, 12 {0, nullptr, "GetBluetoothBdAddress"},
diff --git a/src/core/hle/service/set/set_cal.h b/src/core/hle/service/set/set_cal.h
index a0677e815..a29fc3ddd 100644
--- a/src/core/hle/service/set/set_cal.h
+++ b/src/core/hle/service/set/set_cal.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Set { 13namespace Service::Set {
10 14
11class SET_CAL final : public ServiceFramework<SET_CAL> { 15class SET_CAL final : public ServiceFramework<SET_CAL> {
12public: 16public:
13 explicit SET_CAL(); 17 explicit SET_CAL(Core::System& system_);
14 ~SET_CAL() override; 18 ~SET_CAL() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/set/set_fd.cpp b/src/core/hle/service/set/set_fd.cpp
index 565882a31..f04dc5047 100644
--- a/src/core/hle/service/set/set_fd.cpp
+++ b/src/core/hle/service/set/set_fd.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::Set { 7namespace Service::Set {
8 8
9SET_FD::SET_FD() : ServiceFramework("set:fd") { 9SET_FD::SET_FD(Core::System& system_) : ServiceFramework{system_, "set:fd"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {2, nullptr, "SetSettingsItemValue"}, 12 {2, nullptr, "SetSettingsItemValue"},
diff --git a/src/core/hle/service/set/set_fd.h b/src/core/hle/service/set/set_fd.h
index 216e65f1f..c28cb301e 100644
--- a/src/core/hle/service/set/set_fd.h
+++ b/src/core/hle/service/set/set_fd.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Set { 13namespace Service::Set {
10 14
11class SET_FD final : public ServiceFramework<SET_FD> { 15class SET_FD final : public ServiceFramework<SET_FD> {
12public: 16public:
13 explicit SET_FD(); 17 explicit SET_FD(Core::System& system_);
14 ~SET_FD() override; 18 ~SET_FD() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp
index 080b5743e..19b8f113d 100644
--- a/src/core/hle/service/set/set_sys.cpp
+++ b/src/core/hle/service/set/set_sys.cpp
@@ -103,7 +103,7 @@ void SET_SYS::SetColorSetId(Kernel::HLERequestContext& ctx) {
103 rb.Push(RESULT_SUCCESS); 103 rb.Push(RESULT_SUCCESS);
104} 104}
105 105
106SET_SYS::SET_SYS() : ServiceFramework("set:sys") { 106SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
107 // clang-format off 107 // clang-format off
108 static const FunctionInfo functions[] = { 108 static const FunctionInfo functions[] = {
109 {0, nullptr, "SetLanguageCode"}, 109 {0, nullptr, "SetLanguageCode"},
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/set_sys.h
index 13ee2cf46..edb185a68 100644
--- a/src/core/hle/service/set/set_sys.h
+++ b/src/core/hle/service/set/set_sys.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Set { 13namespace Service::Set {
10 14
11class SET_SYS final : public ServiceFramework<SET_SYS> { 15class SET_SYS final : public ServiceFramework<SET_SYS> {
12public: 16public:
13 explicit SET_SYS(); 17 explicit SET_SYS(Core::System& system_);
14 ~SET_SYS() override; 18 ~SET_SYS() override;
15 19
16private: 20private:
diff --git a/src/core/hle/service/set/settings.cpp b/src/core/hle/service/set/settings.cpp
index cf5541ca8..212ebc427 100644
--- a/src/core/hle/service/set/settings.cpp
+++ b/src/core/hle/service/set/settings.cpp
@@ -7,14 +7,15 @@
7#include "core/hle/service/set/set_fd.h" 7#include "core/hle/service/set/set_fd.h"
8#include "core/hle/service/set/set_sys.h" 8#include "core/hle/service/set/set_sys.h"
9#include "core/hle/service/set/settings.h" 9#include "core/hle/service/set/settings.h"
10#include "core/hle/service/sm/sm.h"
10 11
11namespace Service::Set { 12namespace Service::Set {
12 13
13void InstallInterfaces(SM::ServiceManager& service_manager) { 14void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
14 std::make_shared<SET>()->InstallAsService(service_manager); 15 std::make_shared<SET>(system)->InstallAsService(service_manager);
15 std::make_shared<SET_CAL>()->InstallAsService(service_manager); 16 std::make_shared<SET_CAL>(system)->InstallAsService(service_manager);
16 std::make_shared<SET_FD>()->InstallAsService(service_manager); 17 std::make_shared<SET_FD>(system)->InstallAsService(service_manager);
17 std::make_shared<SET_SYS>()->InstallAsService(service_manager); 18 std::make_shared<SET_SYS>(system)->InstallAsService(service_manager);
18} 19}
19 20
20} // namespace Service::Set 21} // namespace Service::Set
diff --git a/src/core/hle/service/set/settings.h b/src/core/hle/service/set/settings.h
index 6606ce776..7a6950dd0 100644
--- a/src/core/hle/service/set/settings.h
+++ b/src/core/hle/service/set/settings.h
@@ -4,11 +4,17 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "core/hle/service/service.h" 7namespace Core {
8class System;
9}
10
11namespace Service::SM {
12class ServiceManager;
13}
8 14
9namespace Service::Set { 15namespace Service::Set {
10 16
11/// Registers all Settings services with the specified service manager. 17/// Registers all Settings services with the specified service manager.
12void InstallInterfaces(SM::ServiceManager& service_manager); 18void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
13 19
14} // namespace Service::Set 20} // namespace Service::Set
diff --git a/src/core/hle/service/sm/controller.cpp b/src/core/hle/service/sm/controller.cpp
index 972aaa6d9..916177efd 100644
--- a/src/core/hle/service/sm/controller.cpp
+++ b/src/core/hle/service/sm/controller.cpp
@@ -48,7 +48,7 @@ void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) {
48} 48}
49 49
50// https://switchbrew.org/wiki/IPC_Marshalling 50// https://switchbrew.org/wiki/IPC_Marshalling
51Controller::Controller() : ServiceFramework("IpcController") { 51Controller::Controller(Core::System& system_) : ServiceFramework{system_, "IpcController"} {
52 static const FunctionInfo functions[] = { 52 static const FunctionInfo functions[] = {
53 {0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"}, 53 {0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"},
54 {1, nullptr, "CopyFromCurrentDomain"}, 54 {1, nullptr, "CopyFromCurrentDomain"},
diff --git a/src/core/hle/service/sm/controller.h b/src/core/hle/service/sm/controller.h
index 180c6da50..7494f898d 100644
--- a/src/core/hle/service/sm/controller.h
+++ b/src/core/hle/service/sm/controller.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::SM { 13namespace Service::SM {
10 14
11class Controller final : public ServiceFramework<Controller> { 15class Controller final : public ServiceFramework<Controller> {
12public: 16public:
13 Controller(); 17 explicit Controller(Core::System& system_);
14 ~Controller() override; 18 ~Controller() override;
15 19
16private: 20private:
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp
index 9c1da361b..4da69f503 100644
--- a/src/core/hle/service/sm/sm.cpp
+++ b/src/core/hle/service/sm/sm.cpp
@@ -38,14 +38,13 @@ static ResultCode ValidateServiceName(const std::string& name) {
38 return RESULT_SUCCESS; 38 return RESULT_SUCCESS;
39} 39}
40 40
41void ServiceManager::InstallInterfaces(std::shared_ptr<ServiceManager> self, 41void ServiceManager::InstallInterfaces(std::shared_ptr<ServiceManager> self, Core::System& system) {
42 Kernel::KernelCore& kernel) {
43 ASSERT(self->sm_interface.expired()); 42 ASSERT(self->sm_interface.expired());
44 43
45 auto sm = std::make_shared<SM>(self, kernel); 44 auto sm = std::make_shared<SM>(self, system);
46 sm->InstallAsNamedPort(kernel); 45 sm->InstallAsNamedPort(system.Kernel());
47 self->sm_interface = sm; 46 self->sm_interface = sm;
48 self->controller_interface = std::make_unique<Controller>(); 47 self->controller_interface = std::make_unique<Controller>(system);
49} 48}
50 49
51ResultVal<std::shared_ptr<Kernel::ServerPort>> ServiceManager::RegisterService(std::string name, 50ResultVal<std::shared_ptr<Kernel::ServerPort>> ServiceManager::RegisterService(std::string name,
@@ -190,8 +189,9 @@ void SM::UnregisterService(Kernel::HLERequestContext& ctx) {
190 rb.Push(service_manager->UnregisterService(name)); 189 rb.Push(service_manager->UnregisterService(name));
191} 190}
192 191
193SM::SM(std::shared_ptr<ServiceManager> service_manager, Kernel::KernelCore& kernel) 192SM::SM(std::shared_ptr<ServiceManager> service_manager_, Core::System& system_)
194 : ServiceFramework{"sm:", 4}, service_manager{std::move(service_manager)}, kernel{kernel} { 193 : ServiceFramework{system_, "sm:", 4},
194 service_manager{std::move(service_manager_)}, kernel{system_.Kernel()} {
195 static const FunctionInfo functions[] = { 195 static const FunctionInfo functions[] = {
196 {0x00000000, &SM::Initialize, "Initialize"}, 196 {0x00000000, &SM::Initialize, "Initialize"},
197 {0x00000001, &SM::GetService, "GetService"}, 197 {0x00000001, &SM::GetService, "GetService"},
diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h
index 6790c86f0..3f46ae44f 100644
--- a/src/core/hle/service/sm/sm.h
+++ b/src/core/hle/service/sm/sm.h
@@ -16,6 +16,10 @@
16#include "core/hle/result.h" 16#include "core/hle/result.h"
17#include "core/hle/service/service.h" 17#include "core/hle/service/service.h"
18 18
19namespace Core {
20class System;
21}
22
19namespace Kernel { 23namespace Kernel {
20class ClientPort; 24class ClientPort;
21class ClientSession; 25class ClientSession;
@@ -31,7 +35,7 @@ class Controller;
31/// Interface to "sm:" service 35/// Interface to "sm:" service
32class SM final : public ServiceFramework<SM> { 36class SM final : public ServiceFramework<SM> {
33public: 37public:
34 explicit SM(std::shared_ptr<ServiceManager> service_manager, Kernel::KernelCore& kernel); 38 explicit SM(std::shared_ptr<ServiceManager> service_manager_, Core::System& system_);
35 ~SM() override; 39 ~SM() override;
36 40
37private: 41private:
@@ -46,7 +50,7 @@ private:
46 50
47class ServiceManager { 51class ServiceManager {
48public: 52public:
49 static void InstallInterfaces(std::shared_ptr<ServiceManager> self, Kernel::KernelCore& kernel); 53 static void InstallInterfaces(std::shared_ptr<ServiceManager> self, Core::System& system);
50 54
51 explicit ServiceManager(Kernel::KernelCore& kernel_); 55 explicit ServiceManager(Kernel::KernelCore& kernel_);
52 ~ServiceManager(); 56 ~ServiceManager();
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp
index a74be9370..a9875b9a6 100644
--- a/src/core/hle/service/sockets/bsd.cpp
+++ b/src/core/hle/service/sockets/bsd.cpp
@@ -827,8 +827,8 @@ void BSD::BuildErrnoResponse(Kernel::HLERequestContext& ctx, Errno bsd_errno) co
827 rb.PushEnum(bsd_errno); 827 rb.PushEnum(bsd_errno);
828} 828}
829 829
830BSD::BSD(Core::System& system, const char* name) 830BSD::BSD(Core::System& system_, const char* name)
831 : ServiceFramework(name), worker_pool{system, this} { 831 : ServiceFramework{system_, name}, worker_pool{system_, this} {
832 // clang-format off 832 // clang-format off
833 static const FunctionInfo functions[] = { 833 static const FunctionInfo functions[] = {
834 {0, &BSD::RegisterClient, "RegisterClient"}, 834 {0, &BSD::RegisterClient, "RegisterClient"},
@@ -873,7 +873,7 @@ BSD::BSD(Core::System& system, const char* name)
873 873
874BSD::~BSD() = default; 874BSD::~BSD() = default;
875 875
876BSDCFG::BSDCFG() : ServiceFramework{"bsdcfg"} { 876BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} {
877 // clang-format off 877 // clang-format off
878 static const FunctionInfo functions[] = { 878 static const FunctionInfo functions[] = {
879 {0, nullptr, "SetIfUp"}, 879 {0, nullptr, "SetIfUp"},
diff --git a/src/core/hle/service/sockets/bsd.h b/src/core/hle/service/sockets/bsd.h
index 357531951..f14713fc4 100644
--- a/src/core/hle/service/sockets/bsd.h
+++ b/src/core/hle/service/sockets/bsd.h
@@ -26,7 +26,7 @@ namespace Service::Sockets {
26 26
27class BSD final : public ServiceFramework<BSD> { 27class BSD final : public ServiceFramework<BSD> {
28public: 28public:
29 explicit BSD(Core::System& system, const char* name); 29 explicit BSD(Core::System& system_, const char* name);
30 ~BSD() override; 30 ~BSD() override;
31 31
32private: 32private:
@@ -176,7 +176,7 @@ private:
176 176
177class BSDCFG final : public ServiceFramework<BSDCFG> { 177class BSDCFG final : public ServiceFramework<BSDCFG> {
178public: 178public:
179 explicit BSDCFG(); 179 explicit BSDCFG(Core::System& system_);
180 ~BSDCFG() override; 180 ~BSDCFG() override;
181}; 181};
182 182
diff --git a/src/core/hle/service/sockets/ethc.cpp b/src/core/hle/service/sockets/ethc.cpp
index abbeb4c50..05681ca2d 100644
--- a/src/core/hle/service/sockets/ethc.cpp
+++ b/src/core/hle/service/sockets/ethc.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::Sockets { 7namespace Service::Sockets {
8 8
9ETHC_C::ETHC_C() : ServiceFramework{"ethc:c"} { 9ETHC_C::ETHC_C(Core::System& system_) : ServiceFramework{system_, "ethc:c"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, nullptr, "Initialize"}, 12 {0, nullptr, "Initialize"},
@@ -23,7 +23,7 @@ ETHC_C::ETHC_C() : ServiceFramework{"ethc:c"} {
23 23
24ETHC_C::~ETHC_C() = default; 24ETHC_C::~ETHC_C() = default;
25 25
26ETHC_I::ETHC_I() : ServiceFramework{"ethc:i"} { 26ETHC_I::ETHC_I(Core::System& system_) : ServiceFramework{system_, "ethc:i"} {
27 // clang-format off 27 // clang-format off
28 static const FunctionInfo functions[] = { 28 static const FunctionInfo functions[] = {
29 {0, nullptr, "GetReadableHandle"}, 29 {0, nullptr, "GetReadableHandle"},
diff --git a/src/core/hle/service/sockets/ethc.h b/src/core/hle/service/sockets/ethc.h
index da2c7f741..71884182e 100644
--- a/src/core/hle/service/sockets/ethc.h
+++ b/src/core/hle/service/sockets/ethc.h
@@ -6,17 +6,21 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Sockets { 13namespace Service::Sockets {
10 14
11class ETHC_C final : public ServiceFramework<ETHC_C> { 15class ETHC_C final : public ServiceFramework<ETHC_C> {
12public: 16public:
13 explicit ETHC_C(); 17 explicit ETHC_C(Core::System& system_);
14 ~ETHC_C() override; 18 ~ETHC_C() override;
15}; 19};
16 20
17class ETHC_I final : public ServiceFramework<ETHC_I> { 21class ETHC_I final : public ServiceFramework<ETHC_I> {
18public: 22public:
19 explicit ETHC_I(); 23 explicit ETHC_I(Core::System& system_);
20 ~ETHC_I() override; 24 ~ETHC_I() override;
21}; 25};
22 26
diff --git a/src/core/hle/service/sockets/nsd.cpp b/src/core/hle/service/sockets/nsd.cpp
index 40d781124..51c3739bb 100644
--- a/src/core/hle/service/sockets/nsd.cpp
+++ b/src/core/hle/service/sockets/nsd.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::Sockets { 7namespace Service::Sockets {
8 8
9NSD::NSD(const char* name) : ServiceFramework(name) { 9NSD::NSD(Core::System& system_, const char* name) : ServiceFramework{system_, name} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {10, nullptr, "GetSettingName"}, 12 {10, nullptr, "GetSettingName"},
diff --git a/src/core/hle/service/sockets/nsd.h b/src/core/hle/service/sockets/nsd.h
index d842e3232..becf93125 100644
--- a/src/core/hle/service/sockets/nsd.h
+++ b/src/core/hle/service/sockets/nsd.h
@@ -4,14 +4,17 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "core/hle/kernel/hle_ipc.h"
8#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
9 8
9namespace Core {
10class System;
11}
12
10namespace Service::Sockets { 13namespace Service::Sockets {
11 14
12class NSD final : public ServiceFramework<NSD> { 15class NSD final : public ServiceFramework<NSD> {
13public: 16public:
14 explicit NSD(const char* name); 17 explicit NSD(Core::System& system_, const char* name);
15 ~NSD() override; 18 ~NSD() override;
16}; 19};
17 20
diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp
index e3017451f..3a6329f56 100644
--- a/src/core/hle/service/sockets/sfdnsres.cpp
+++ b/src/core/hle/service/sockets/sfdnsres.cpp
@@ -7,25 +7,7 @@
7 7
8namespace Service::Sockets { 8namespace Service::Sockets {
9 9
10void SFDNSRES::GetAddrInfoRequest(Kernel::HLERequestContext& ctx) { 10SFDNSRES::SFDNSRES(Core::System& system_) : ServiceFramework{system_, "sfdnsres"} {
11 struct Parameters {
12 u8 use_nsd_resolve;
13 u32 unknown;
14 u64 process_id;
15 };
16
17 IPC::RequestParser rp{ctx};
18 const auto parameters = rp.PopRaw<Parameters>();
19
20 LOG_WARNING(Service,
21 "(STUBBED) called. use_nsd_resolve={}, unknown=0x{:08X}, process_id=0x{:016X}",
22 parameters.use_nsd_resolve, parameters.unknown, parameters.process_id);
23
24 IPC::ResponseBuilder rb{ctx, 2};
25 rb.Push(RESULT_SUCCESS);
26}
27
28SFDNSRES::SFDNSRES() : ServiceFramework("sfdnsres") {
29 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
30 {0, nullptr, "SetDnsAddressesPrivate"}, 12 {0, nullptr, "SetDnsAddressesPrivate"},
31 {1, nullptr, "GetDnsAddressPrivate"}, 13 {1, nullptr, "GetDnsAddressPrivate"},
@@ -49,4 +31,22 @@ SFDNSRES::SFDNSRES() : ServiceFramework("sfdnsres") {
49 31
50SFDNSRES::~SFDNSRES() = default; 32SFDNSRES::~SFDNSRES() = default;
51 33
34void SFDNSRES::GetAddrInfoRequest(Kernel::HLERequestContext& ctx) {
35 struct Parameters {
36 u8 use_nsd_resolve;
37 u32 unknown;
38 u64 process_id;
39 };
40
41 IPC::RequestParser rp{ctx};
42 const auto parameters = rp.PopRaw<Parameters>();
43
44 LOG_WARNING(Service,
45 "(STUBBED) called. use_nsd_resolve={}, unknown=0x{:08X}, process_id=0x{:016X}",
46 parameters.use_nsd_resolve, parameters.unknown, parameters.process_id);
47
48 IPC::ResponseBuilder rb{ctx, 2};
49 rb.Push(RESULT_SUCCESS);
50}
51
52} // namespace Service::Sockets 52} // namespace Service::Sockets
diff --git a/src/core/hle/service/sockets/sfdnsres.h b/src/core/hle/service/sockets/sfdnsres.h
index acd3647bb..faa6b7d0d 100644
--- a/src/core/hle/service/sockets/sfdnsres.h
+++ b/src/core/hle/service/sockets/sfdnsres.h
@@ -7,11 +7,15 @@
7#include "core/hle/kernel/hle_ipc.h" 7#include "core/hle/kernel/hle_ipc.h"
8#include "core/hle/service/service.h" 8#include "core/hle/service/service.h"
9 9
10namespace Core {
11class System;
12}
13
10namespace Service::Sockets { 14namespace Service::Sockets {
11 15
12class SFDNSRES final : public ServiceFramework<SFDNSRES> { 16class SFDNSRES final : public ServiceFramework<SFDNSRES> {
13public: 17public:
14 explicit SFDNSRES(); 18 explicit SFDNSRES(Core::System& system_);
15 ~SFDNSRES() override; 19 ~SFDNSRES() override;
16 20
17private: 21private:
diff --git a/src/core/hle/service/sockets/sockets.cpp b/src/core/hle/service/sockets/sockets.cpp
index 1d27f7906..96f73bce3 100644
--- a/src/core/hle/service/sockets/sockets.cpp
+++ b/src/core/hle/service/sockets/sockets.cpp
@@ -13,15 +13,15 @@ namespace Service::Sockets {
13void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { 13void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
14 std::make_shared<BSD>(system, "bsd:s")->InstallAsService(service_manager); 14 std::make_shared<BSD>(system, "bsd:s")->InstallAsService(service_manager);
15 std::make_shared<BSD>(system, "bsd:u")->InstallAsService(service_manager); 15 std::make_shared<BSD>(system, "bsd:u")->InstallAsService(service_manager);
16 std::make_shared<BSDCFG>()->InstallAsService(service_manager); 16 std::make_shared<BSDCFG>(system)->InstallAsService(service_manager);
17 17
18 std::make_shared<ETHC_C>()->InstallAsService(service_manager); 18 std::make_shared<ETHC_C>(system)->InstallAsService(service_manager);
19 std::make_shared<ETHC_I>()->InstallAsService(service_manager); 19 std::make_shared<ETHC_I>(system)->InstallAsService(service_manager);
20 20
21 std::make_shared<NSD>("nsd:a")->InstallAsService(service_manager); 21 std::make_shared<NSD>(system, "nsd:a")->InstallAsService(service_manager);
22 std::make_shared<NSD>("nsd:u")->InstallAsService(service_manager); 22 std::make_shared<NSD>(system, "nsd:u")->InstallAsService(service_manager);
23 23
24 std::make_shared<SFDNSRES>()->InstallAsService(service_manager); 24 std::make_shared<SFDNSRES>(system)->InstallAsService(service_manager);
25} 25}
26 26
27} // namespace Service::Sockets 27} // namespace Service::Sockets
diff --git a/src/core/hle/service/spl/csrng.cpp b/src/core/hle/service/spl/csrng.cpp
index 674928798..1beca417c 100644
--- a/src/core/hle/service/spl/csrng.cpp
+++ b/src/core/hle/service/spl/csrng.cpp
@@ -6,7 +6,8 @@
6 6
7namespace Service::SPL { 7namespace Service::SPL {
8 8
9CSRNG::CSRNG(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "csrng") { 9CSRNG::CSRNG(Core::System& system_, std::shared_ptr<Module> module_)
10 : Interface(system_, std::move(module_), "csrng") {
10 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
11 {0, &CSRNG::GetRandomBytes, "GetRandomBytes"}, 12 {0, &CSRNG::GetRandomBytes, "GetRandomBytes"},
12 }; 13 };
diff --git a/src/core/hle/service/spl/csrng.h b/src/core/hle/service/spl/csrng.h
index 764d5ceb0..5c0bd2199 100644
--- a/src/core/hle/service/spl/csrng.h
+++ b/src/core/hle/service/spl/csrng.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/spl/module.h" 7#include "core/hle/service/spl/module.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::SPL { 13namespace Service::SPL {
10 14
11class CSRNG final : public Module::Interface { 15class CSRNG final : public Module::Interface {
12public: 16public:
13 explicit CSRNG(std::shared_ptr<Module> module); 17 explicit CSRNG(Core::System& system_, std::shared_ptr<Module> module_);
14 ~CSRNG() override; 18 ~CSRNG() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp
index 865ed3b91..dea6b0fe0 100644
--- a/src/core/hle/service/spl/module.cpp
+++ b/src/core/hle/service/spl/module.cpp
@@ -17,8 +17,9 @@
17 17
18namespace Service::SPL { 18namespace Service::SPL {
19 19
20Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) 20Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_,
21 : ServiceFramework(name), module(std::move(module)), 21 const char* name)
22 : ServiceFramework{system_, name}, module{std::move(module_)},
22 rng(Settings::values.rng_seed.GetValue().value_or(std::time(nullptr))) {} 23 rng(Settings::values.rng_seed.GetValue().value_or(std::time(nullptr))) {}
23 24
24Module::Interface::~Interface() = default; 25Module::Interface::~Interface() = default;
@@ -38,10 +39,10 @@ void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) {
38 rb.Push(RESULT_SUCCESS); 39 rb.Push(RESULT_SUCCESS);
39} 40}
40 41
41void InstallInterfaces(SM::ServiceManager& service_manager) { 42void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
42 auto module = std::make_shared<Module>(); 43 auto module = std::make_shared<Module>();
43 std::make_shared<CSRNG>(module)->InstallAsService(service_manager); 44 std::make_shared<CSRNG>(system, module)->InstallAsService(service_manager);
44 std::make_shared<SPL>(module)->InstallAsService(service_manager); 45 std::make_shared<SPL>(system, module)->InstallAsService(service_manager);
45} 46}
46 47
47} // namespace Service::SPL 48} // namespace Service::SPL
diff --git a/src/core/hle/service/spl/module.h b/src/core/hle/service/spl/module.h
index afa1f0295..71855c1bf 100644
--- a/src/core/hle/service/spl/module.h
+++ b/src/core/hle/service/spl/module.h
@@ -7,13 +7,18 @@
7#include <random> 7#include <random>
8#include "core/hle/service/service.h" 8#include "core/hle/service/service.h"
9 9
10namespace Core {
11class System;
12}
13
10namespace Service::SPL { 14namespace Service::SPL {
11 15
12class Module final { 16class Module final {
13public: 17public:
14 class Interface : public ServiceFramework<Interface> { 18 class Interface : public ServiceFramework<Interface> {
15 public: 19 public:
16 explicit Interface(std::shared_ptr<Module> module, const char* name); 20 explicit Interface(Core::System& system_, std::shared_ptr<Module> module_,
21 const char* name);
17 ~Interface() override; 22 ~Interface() override;
18 23
19 void GetRandomBytes(Kernel::HLERequestContext& ctx); 24 void GetRandomBytes(Kernel::HLERequestContext& ctx);
@@ -27,6 +32,6 @@ public:
27}; 32};
28 33
29/// Registers all SPL services with the specified service manager. 34/// Registers all SPL services with the specified service manager.
30void InstallInterfaces(SM::ServiceManager& service_manager); 35void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
31 36
32} // namespace Service::SPL 37} // namespace Service::SPL
diff --git a/src/core/hle/service/spl/spl.cpp b/src/core/hle/service/spl/spl.cpp
index 773551464..3fabc2c79 100644
--- a/src/core/hle/service/spl/spl.cpp
+++ b/src/core/hle/service/spl/spl.cpp
@@ -6,7 +6,8 @@
6 6
7namespace Service::SPL { 7namespace Service::SPL {
8 8
9SPL::SPL(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "spl:") { 9SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_)
10 : Interface(system_, std::move(module_), "spl:") {
10 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
11 {0, nullptr, "GetConfig"}, 12 {0, nullptr, "GetConfig"},
12 {1, nullptr, "ModularExponentiate"}, 13 {1, nullptr, "ModularExponentiate"},
diff --git a/src/core/hle/service/spl/spl.h b/src/core/hle/service/spl/spl.h
index 3637d1623..d27d16b86 100644
--- a/src/core/hle/service/spl/spl.h
+++ b/src/core/hle/service/spl/spl.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/spl/module.h" 7#include "core/hle/service/spl/module.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::SPL { 13namespace Service::SPL {
10 14
11class SPL final : public Module::Interface { 15class SPL final : public Module::Interface {
12public: 16public:
13 explicit SPL(std::shared_ptr<Module> module); 17 explicit SPL(Core::System& system_, std::shared_ptr<Module> module_);
14 ~SPL() override; 18 ~SPL() override;
15}; 19};
16 20
diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp
index 1ba8c19a0..dc2baca4a 100644
--- a/src/core/hle/service/ssl/ssl.cpp
+++ b/src/core/hle/service/ssl/ssl.cpp
@@ -12,7 +12,7 @@ namespace Service::SSL {
12 12
13class ISslConnection final : public ServiceFramework<ISslConnection> { 13class ISslConnection final : public ServiceFramework<ISslConnection> {
14public: 14public:
15 ISslConnection() : ServiceFramework("ISslConnection") { 15 explicit ISslConnection(Core::System& system_) : ServiceFramework{system_, "ISslConnection"} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, nullptr, "SetSocketDescriptor"}, 18 {0, nullptr, "SetSocketDescriptor"},
@@ -52,7 +52,7 @@ public:
52 52
53class ISslContext final : public ServiceFramework<ISslContext> { 53class ISslContext final : public ServiceFramework<ISslContext> {
54public: 54public:
55 ISslContext() : ServiceFramework("ISslContext") { 55 explicit ISslContext(Core::System& system_) : ServiceFramework{system_, "ISslContext"} {
56 static const FunctionInfo functions[] = { 56 static const FunctionInfo functions[] = {
57 {0, &ISslContext::SetOption, "SetOption"}, 57 {0, &ISslContext::SetOption, "SetOption"},
58 {1, nullptr, "GetOption"}, 58 {1, nullptr, "GetOption"},
@@ -92,13 +92,13 @@ private:
92 92
93 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 93 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
94 rb.Push(RESULT_SUCCESS); 94 rb.Push(RESULT_SUCCESS);
95 rb.PushIpcInterface<ISslConnection>(); 95 rb.PushIpcInterface<ISslConnection>(system);
96 } 96 }
97}; 97};
98 98
99class SSL final : public ServiceFramework<SSL> { 99class SSL final : public ServiceFramework<SSL> {
100public: 100public:
101 explicit SSL() : ServiceFramework{"ssl"} { 101 explicit SSL(Core::System& system_) : ServiceFramework{system_, "ssl"} {
102 // clang-format off 102 // clang-format off
103 static const FunctionInfo functions[] = { 103 static const FunctionInfo functions[] = {
104 {0, &SSL::CreateContext, "CreateContext"}, 104 {0, &SSL::CreateContext, "CreateContext"},
@@ -123,7 +123,7 @@ private:
123 123
124 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 124 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
125 rb.Push(RESULT_SUCCESS); 125 rb.Push(RESULT_SUCCESS);
126 rb.PushIpcInterface<ISslContext>(); 126 rb.PushIpcInterface<ISslContext>(system);
127 } 127 }
128 128
129 void SetInterfaceVersion(Kernel::HLERequestContext& ctx) { 129 void SetInterfaceVersion(Kernel::HLERequestContext& ctx) {
@@ -137,8 +137,8 @@ private:
137 } 137 }
138}; 138};
139 139
140void InstallInterfaces(SM::ServiceManager& service_manager) { 140void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
141 std::make_shared<SSL>()->InstallAsService(service_manager); 141 std::make_shared<SSL>(system)->InstallAsService(service_manager);
142} 142}
143 143
144} // namespace Service::SSL 144} // namespace Service::SSL
diff --git a/src/core/hle/service/ssl/ssl.h b/src/core/hle/service/ssl/ssl.h
index 5cb04c3b9..a3aa4b4b5 100644
--- a/src/core/hle/service/ssl/ssl.h
+++ b/src/core/hle/service/ssl/ssl.h
@@ -4,6 +4,10 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
@@ -11,6 +15,6 @@ class ServiceManager;
11namespace Service::SSL { 15namespace Service::SSL {
12 16
13/// Registers all SSL services with the specified service manager. 17/// Registers all SSL services with the specified service manager.
14void InstallInterfaces(SM::ServiceManager& service_manager); 18void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
15 19
16} // namespace Service::SSL 20} // namespace Service::SSL
diff --git a/src/core/hle/service/time/interface.cpp b/src/core/hle/service/time/interface.cpp
index ba8fd6152..a01d9e0ff 100644
--- a/src/core/hle/service/time/interface.cpp
+++ b/src/core/hle/service/time/interface.cpp
@@ -7,7 +7,7 @@
7namespace Service::Time { 7namespace Service::Time {
8 8
9Time::Time(std::shared_ptr<Module> module, Core::System& system, const char* name) 9Time::Time(std::shared_ptr<Module> module, Core::System& system, const char* name)
10 : Module::Interface(std::move(module), system, name) { 10 : Interface(std::move(module), system, name) {
11 // clang-format off 11 // clang-format off
12 static const FunctionInfo functions[] = { 12 static const FunctionInfo functions[] = {
13 {0, &Time::GetStandardUserSystemClock, "GetStandardUserSystemClock"}, 13 {0, &Time::GetStandardUserSystemClock, "GetStandardUserSystemClock"},
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp
index 7d0474e0b..7b7ac282d 100644
--- a/src/core/hle/service/time/time.cpp
+++ b/src/core/hle/service/time/time.cpp
@@ -21,8 +21,8 @@ namespace Service::Time {
21 21
22class ISystemClock final : public ServiceFramework<ISystemClock> { 22class ISystemClock final : public ServiceFramework<ISystemClock> {
23public: 23public:
24 explicit ISystemClock(Clock::SystemClockCore& clock_core, Core::System& system) 24 explicit ISystemClock(Clock::SystemClockCore& clock_core_, Core::System& system_)
25 : ServiceFramework("ISystemClock"), clock_core{clock_core}, system{system} { 25 : ServiceFramework{system_, "ISystemClock"}, clock_core{clock_core_} {
26 // clang-format off 26 // clang-format off
27 static const FunctionInfo functions[] = { 27 static const FunctionInfo functions[] = {
28 {0, &ISystemClock::GetCurrentTime, "GetCurrentTime"}, 28 {0, &ISystemClock::GetCurrentTime, "GetCurrentTime"},
@@ -82,13 +82,12 @@ private:
82 } 82 }
83 83
84 Clock::SystemClockCore& clock_core; 84 Clock::SystemClockCore& clock_core;
85 Core::System& system;
86}; 85};
87 86
88class ISteadyClock final : public ServiceFramework<ISteadyClock> { 87class ISteadyClock final : public ServiceFramework<ISteadyClock> {
89public: 88public:
90 explicit ISteadyClock(Clock::SteadyClockCore& clock_core, Core::System& system) 89 explicit ISteadyClock(Clock::SteadyClockCore& clock_core_, Core::System& system_)
91 : ServiceFramework("ISteadyClock"), clock_core{clock_core}, system{system} { 90 : ServiceFramework{system_, "ISteadyClock"}, clock_core{clock_core_} {
92 static const FunctionInfo functions[] = { 91 static const FunctionInfo functions[] = {
93 {0, &ISteadyClock::GetCurrentTimePoint, "GetCurrentTimePoint"}, 92 {0, &ISteadyClock::GetCurrentTimePoint, "GetCurrentTimePoint"},
94 {2, nullptr, "GetTestOffset"}, 93 {2, nullptr, "GetTestOffset"},
@@ -119,7 +118,6 @@ private:
119 } 118 }
120 119
121 Clock::SteadyClockCore& clock_core; 120 Clock::SteadyClockCore& clock_core;
122 Core::System& system;
123}; 121};
124 122
125ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( 123ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal(
@@ -206,7 +204,8 @@ void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) {
206 LOG_DEBUG(Service_Time, "called"); 204 LOG_DEBUG(Service_Time, "called");
207 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 205 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
208 rb.Push(RESULT_SUCCESS); 206 rb.Push(RESULT_SUCCESS);
209 rb.PushIpcInterface<ITimeZoneService>(system.GetTimeManager().GetTimeZoneContentManager()); 207 rb.PushIpcInterface<ITimeZoneService>(system,
208 system.GetTimeManager().GetTimeZoneContentManager());
210} 209}
211 210
212void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx) { 211void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx) {
@@ -375,8 +374,9 @@ void Module::Interface::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& c
375 rb.PushCopyObjects(SharedFrom(&system.Kernel().GetTimeSharedMem())); 374 rb.PushCopyObjects(SharedFrom(&system.Kernel().GetTimeSharedMem()));
376} 375}
377 376
378Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name) 377Module::Interface::Interface(std::shared_ptr<Module> module_, Core::System& system_,
379 : ServiceFramework(name), module{std::move(module)}, system{system} {} 378 const char* name)
379 : ServiceFramework{system_, name}, module{std::move(module_)} {}
380 380
381Module::Interface::~Interface() = default; 381Module::Interface::~Interface() = default;
382 382
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h
index 49f4aac0a..975a8ae5b 100644
--- a/src/core/hle/service/time/time.h
+++ b/src/core/hle/service/time/time.h
@@ -20,7 +20,8 @@ public:
20 20
21 class Interface : public ServiceFramework<Interface> { 21 class Interface : public ServiceFramework<Interface> {
22 public: 22 public:
23 explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name); 23 explicit Interface(std::shared_ptr<Module> module_, Core::System& system_,
24 const char* name);
24 ~Interface() override; 25 ~Interface() override;
25 26
26 void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx); 27 void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx);
@@ -44,7 +45,6 @@ public:
44 45
45 protected: 46 protected:
46 std::shared_ptr<Module> module; 47 std::shared_ptr<Module> module;
47 Core::System& system;
48 }; 48 };
49}; 49};
50 50
diff --git a/src/core/hle/service/time/time_zone_service.cpp b/src/core/hle/service/time/time_zone_service.cpp
index ff3a10b3e..25cecbc83 100644
--- a/src/core/hle/service/time/time_zone_service.cpp
+++ b/src/core/hle/service/time/time_zone_service.cpp
@@ -10,8 +10,9 @@
10 10
11namespace Service::Time { 11namespace Service::Time {
12 12
13ITimeZoneService ::ITimeZoneService(TimeZone::TimeZoneContentManager& time_zone_content_manager) 13ITimeZoneService ::ITimeZoneService(Core::System& system_,
14 : ServiceFramework("ITimeZoneService"), time_zone_content_manager{time_zone_content_manager} { 14 TimeZone::TimeZoneContentManager& time_zone_manager_)
15 : ServiceFramework{system_, "ITimeZoneService"}, time_zone_content_manager{time_zone_manager_} {
15 static const FunctionInfo functions[] = { 16 static const FunctionInfo functions[] = {
16 {0, &ITimeZoneService::GetDeviceLocationName, "GetDeviceLocationName"}, 17 {0, &ITimeZoneService::GetDeviceLocationName, "GetDeviceLocationName"},
17 {1, nullptr, "SetDeviceLocationName"}, 18 {1, nullptr, "SetDeviceLocationName"},
diff --git a/src/core/hle/service/time/time_zone_service.h b/src/core/hle/service/time/time_zone_service.h
index cb495748b..2c9b97603 100644
--- a/src/core/hle/service/time/time_zone_service.h
+++ b/src/core/hle/service/time/time_zone_service.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Time { 13namespace Service::Time {
10 14
11namespace TimeZone { 15namespace TimeZone {
@@ -14,7 +18,8 @@ class TimeZoneContentManager;
14 18
15class ITimeZoneService final : public ServiceFramework<ITimeZoneService> { 19class ITimeZoneService final : public ServiceFramework<ITimeZoneService> {
16public: 20public:
17 explicit ITimeZoneService(TimeZone::TimeZoneContentManager& time_zone_manager); 21 explicit ITimeZoneService(Core::System& system_,
22 TimeZone::TimeZoneContentManager& time_zone_manager_);
18 23
19private: 24private:
20 void GetDeviceLocationName(Kernel::HLERequestContext& ctx); 25 void GetDeviceLocationName(Kernel::HLERequestContext& ctx);
diff --git a/src/core/hle/service/usb/usb.cpp b/src/core/hle/service/usb/usb.cpp
index d033f8603..579de83e4 100644
--- a/src/core/hle/service/usb/usb.cpp
+++ b/src/core/hle/service/usb/usb.cpp
@@ -15,7 +15,7 @@ namespace Service::USB {
15 15
16class IDsInterface final : public ServiceFramework<IDsInterface> { 16class IDsInterface final : public ServiceFramework<IDsInterface> {
17public: 17public:
18 explicit IDsInterface() : ServiceFramework{"IDsInterface"} { 18 explicit IDsInterface(Core::System& system_) : ServiceFramework{system_, "IDsInterface"} {
19 // clang-format off 19 // clang-format off
20 static const FunctionInfo functions[] = { 20 static const FunctionInfo functions[] = {
21 {0, nullptr, "GetDsEndpoint"}, 21 {0, nullptr, "GetDsEndpoint"},
@@ -40,7 +40,7 @@ public:
40 40
41class USB_DS final : public ServiceFramework<USB_DS> { 41class USB_DS final : public ServiceFramework<USB_DS> {
42public: 42public:
43 explicit USB_DS() : ServiceFramework{"usb:ds"} { 43 explicit USB_DS(Core::System& system_) : ServiceFramework{system_, "usb:ds"} {
44 // clang-format off 44 // clang-format off
45 static const FunctionInfo functions[] = { 45 static const FunctionInfo functions[] = {
46 {0, nullptr, "BindDevice"}, 46 {0, nullptr, "BindDevice"},
@@ -65,7 +65,8 @@ public:
65 65
66class IClientEpSession final : public ServiceFramework<IClientEpSession> { 66class IClientEpSession final : public ServiceFramework<IClientEpSession> {
67public: 67public:
68 explicit IClientEpSession() : ServiceFramework{"IClientEpSession"} { 68 explicit IClientEpSession(Core::System& system_)
69 : ServiceFramework{system_, "IClientEpSession"} {
69 // clang-format off 70 // clang-format off
70 static const FunctionInfo functions[] = { 71 static const FunctionInfo functions[] = {
71 {0, nullptr, "Open"}, 72 {0, nullptr, "Open"},
@@ -86,7 +87,8 @@ public:
86 87
87class IClientIfSession final : public ServiceFramework<IClientIfSession> { 88class IClientIfSession final : public ServiceFramework<IClientIfSession> {
88public: 89public:
89 explicit IClientIfSession() : ServiceFramework{"IClientIfSession"} { 90 explicit IClientIfSession(Core::System& system_)
91 : ServiceFramework{system_, "IClientIfSession"} {
90 // clang-format off 92 // clang-format off
91 static const FunctionInfo functions[] = { 93 static const FunctionInfo functions[] = {
92 {0, nullptr, "Unknown0"}, 94 {0, nullptr, "Unknown0"},
@@ -108,7 +110,7 @@ public:
108 110
109class USB_HS final : public ServiceFramework<USB_HS> { 111class USB_HS final : public ServiceFramework<USB_HS> {
110public: 112public:
111 explicit USB_HS() : ServiceFramework{"usb:hs"} { 113 explicit USB_HS(Core::System& system_) : ServiceFramework{system_, "usb:hs"} {
112 // clang-format off 114 // clang-format off
113 static const FunctionInfo functions[] = { 115 static const FunctionInfo functions[] = {
114 {0, nullptr, "BindClientProcess"}, 116 {0, nullptr, "BindClientProcess"},
@@ -129,7 +131,7 @@ public:
129 131
130class IPdSession final : public ServiceFramework<IPdSession> { 132class IPdSession final : public ServiceFramework<IPdSession> {
131public: 133public:
132 explicit IPdSession() : ServiceFramework{"IPdSession"} { 134 explicit IPdSession(Core::System& system_) : ServiceFramework{system_, "IPdSession"} {
133 // clang-format off 135 // clang-format off
134 static const FunctionInfo functions[] = { 136 static const FunctionInfo functions[] = {
135 {0, nullptr, "BindNoticeEvent"}, 137 {0, nullptr, "BindNoticeEvent"},
@@ -148,7 +150,7 @@ public:
148 150
149class USB_PD final : public ServiceFramework<USB_PD> { 151class USB_PD final : public ServiceFramework<USB_PD> {
150public: 152public:
151 explicit USB_PD() : ServiceFramework{"usb:pd"} { 153 explicit USB_PD(Core::System& system_) : ServiceFramework{system_, "usb:pd"} {
152 // clang-format off 154 // clang-format off
153 static const FunctionInfo functions[] = { 155 static const FunctionInfo functions[] = {
154 {0, &USB_PD::GetPdSession, "GetPdSession"}, 156 {0, &USB_PD::GetPdSession, "GetPdSession"},
@@ -164,13 +166,14 @@ private:
164 166
165 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 167 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
166 rb.Push(RESULT_SUCCESS); 168 rb.Push(RESULT_SUCCESS);
167 rb.PushIpcInterface<IPdSession>(); 169 rb.PushIpcInterface<IPdSession>(system);
168 } 170 }
169}; 171};
170 172
171class IPdCradleSession final : public ServiceFramework<IPdCradleSession> { 173class IPdCradleSession final : public ServiceFramework<IPdCradleSession> {
172public: 174public:
173 explicit IPdCradleSession() : ServiceFramework{"IPdCradleSession"} { 175 explicit IPdCradleSession(Core::System& system_)
176 : ServiceFramework{system_, "IPdCradleSession"} {
174 // clang-format off 177 // clang-format off
175 static const FunctionInfo functions[] = { 178 static const FunctionInfo functions[] = {
176 {0, nullptr, "VdmUserWrite"}, 179 {0, nullptr, "VdmUserWrite"},
@@ -191,7 +194,7 @@ public:
191 194
192class USB_PD_C final : public ServiceFramework<USB_PD_C> { 195class USB_PD_C final : public ServiceFramework<USB_PD_C> {
193public: 196public:
194 explicit USB_PD_C() : ServiceFramework{"usb:pd:c"} { 197 explicit USB_PD_C(Core::System& system_) : ServiceFramework{system_, "usb:pd:c"} {
195 // clang-format off 198 // clang-format off
196 static const FunctionInfo functions[] = { 199 static const FunctionInfo functions[] = {
197 {0, &USB_PD_C::GetPdCradleSession, "GetPdCradleSession"}, 200 {0, &USB_PD_C::GetPdCradleSession, "GetPdCradleSession"},
@@ -205,7 +208,7 @@ private:
205 void GetPdCradleSession(Kernel::HLERequestContext& ctx) { 208 void GetPdCradleSession(Kernel::HLERequestContext& ctx) {
206 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 209 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
207 rb.Push(RESULT_SUCCESS); 210 rb.Push(RESULT_SUCCESS);
208 rb.PushIpcInterface<IPdCradleSession>(); 211 rb.PushIpcInterface<IPdCradleSession>(system);
209 212
210 LOG_DEBUG(Service_USB, "called"); 213 LOG_DEBUG(Service_USB, "called");
211 } 214 }
@@ -213,7 +216,7 @@ private:
213 216
214class USB_PM final : public ServiceFramework<USB_PM> { 217class USB_PM final : public ServiceFramework<USB_PM> {
215public: 218public:
216 explicit USB_PM() : ServiceFramework{"usb:pm"} { 219 explicit USB_PM(Core::System& system_) : ServiceFramework{system_, "usb:pm"} {
217 // clang-format off 220 // clang-format off
218 static const FunctionInfo functions[] = { 221 static const FunctionInfo functions[] = {
219 {0, nullptr, "Unknown0"}, 222 {0, nullptr, "Unknown0"},
@@ -229,12 +232,12 @@ public:
229 } 232 }
230}; 233};
231 234
232void InstallInterfaces(SM::ServiceManager& sm) { 235void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
233 std::make_shared<USB_DS>()->InstallAsService(sm); 236 std::make_shared<USB_DS>(system)->InstallAsService(sm);
234 std::make_shared<USB_HS>()->InstallAsService(sm); 237 std::make_shared<USB_HS>(system)->InstallAsService(sm);
235 std::make_shared<USB_PD>()->InstallAsService(sm); 238 std::make_shared<USB_PD>(system)->InstallAsService(sm);
236 std::make_shared<USB_PD_C>()->InstallAsService(sm); 239 std::make_shared<USB_PD_C>(system)->InstallAsService(sm);
237 std::make_shared<USB_PM>()->InstallAsService(sm); 240 std::make_shared<USB_PM>(system)->InstallAsService(sm);
238} 241}
239 242
240} // namespace Service::USB 243} // namespace Service::USB
diff --git a/src/core/hle/service/usb/usb.h b/src/core/hle/service/usb/usb.h
index 970a11fe8..fc366df34 100644
--- a/src/core/hle/service/usb/usb.h
+++ b/src/core/hle/service/usb/usb.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::USB { 15namespace Service::USB {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::USB 19} // namespace Service::USB
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 86bd604f4..af5b8b0b9 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -492,8 +492,8 @@ private:
492 492
493class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> { 493class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> {
494public: 494public:
495 explicit IHOSBinderDriver(NVFlinger::NVFlinger& nv_flinger) 495 explicit IHOSBinderDriver(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
496 : ServiceFramework("IHOSBinderDriver"), nv_flinger(nv_flinger) { 496 : ServiceFramework{system_, "IHOSBinderDriver"}, nv_flinger(nv_flinger_) {
497 static const FunctionInfo functions[] = { 497 static const FunctionInfo functions[] = {
498 {0, &IHOSBinderDriver::TransactParcel, "TransactParcel"}, 498 {0, &IHOSBinderDriver::TransactParcel, "TransactParcel"},
499 {1, &IHOSBinderDriver::AdjustRefcount, "AdjustRefcount"}, 499 {1, &IHOSBinderDriver::AdjustRefcount, "AdjustRefcount"},
@@ -689,7 +689,8 @@ private:
689 689
690class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> { 690class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> {
691public: 691public:
692 explicit ISystemDisplayService() : ServiceFramework("ISystemDisplayService") { 692 explicit ISystemDisplayService(Core::System& system_)
693 : ServiceFramework{system_, "ISystemDisplayService"} {
693 static const FunctionInfo functions[] = { 694 static const FunctionInfo functions[] = {
694 {1200, nullptr, "GetZOrderCountMin"}, 695 {1200, nullptr, "GetZOrderCountMin"},
695 {1202, nullptr, "GetZOrderCountMax"}, 696 {1202, nullptr, "GetZOrderCountMax"},
@@ -790,8 +791,8 @@ private:
790 791
791class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> { 792class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> {
792public: 793public:
793 explicit IManagerDisplayService(NVFlinger::NVFlinger& nv_flinger) 794 explicit IManagerDisplayService(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
794 : ServiceFramework("IManagerDisplayService"), nv_flinger(nv_flinger) { 795 : ServiceFramework{system_, "IManagerDisplayService"}, nv_flinger{nv_flinger_} {
795 // clang-format off 796 // clang-format off
796 static const FunctionInfo functions[] = { 797 static const FunctionInfo functions[] = {
797 {200, nullptr, "AllocateProcessHeapBlock"}, 798 {200, nullptr, "AllocateProcessHeapBlock"},
@@ -935,7 +936,7 @@ private:
935 936
936class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> { 937class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> {
937public: 938public:
938 explicit IApplicationDisplayService(NVFlinger::NVFlinger& nv_flinger); 939 explicit IApplicationDisplayService(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_);
939 940
940private: 941private:
941 enum class ConvertedScaleMode : u64 { 942 enum class ConvertedScaleMode : u64 {
@@ -959,7 +960,7 @@ private:
959 960
960 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 961 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
961 rb.Push(RESULT_SUCCESS); 962 rb.Push(RESULT_SUCCESS);
962 rb.PushIpcInterface<IHOSBinderDriver>(nv_flinger); 963 rb.PushIpcInterface<IHOSBinderDriver>(system, nv_flinger);
963 } 964 }
964 965
965 void GetSystemDisplayService(Kernel::HLERequestContext& ctx) { 966 void GetSystemDisplayService(Kernel::HLERequestContext& ctx) {
@@ -967,7 +968,7 @@ private:
967 968
968 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 969 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
969 rb.Push(RESULT_SUCCESS); 970 rb.Push(RESULT_SUCCESS);
970 rb.PushIpcInterface<ISystemDisplayService>(); 971 rb.PushIpcInterface<ISystemDisplayService>(system);
971 } 972 }
972 973
973 void GetManagerDisplayService(Kernel::HLERequestContext& ctx) { 974 void GetManagerDisplayService(Kernel::HLERequestContext& ctx) {
@@ -975,7 +976,7 @@ private:
975 976
976 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 977 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
977 rb.Push(RESULT_SUCCESS); 978 rb.Push(RESULT_SUCCESS);
978 rb.PushIpcInterface<IManagerDisplayService>(nv_flinger); 979 rb.PushIpcInterface<IManagerDisplayService>(system, nv_flinger);
979 } 980 }
980 981
981 void GetIndirectDisplayTransactionService(Kernel::HLERequestContext& ctx) { 982 void GetIndirectDisplayTransactionService(Kernel::HLERequestContext& ctx) {
@@ -983,7 +984,7 @@ private:
983 984
984 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 985 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
985 rb.Push(RESULT_SUCCESS); 986 rb.Push(RESULT_SUCCESS);
986 rb.PushIpcInterface<IHOSBinderDriver>(nv_flinger); 987 rb.PushIpcInterface<IHOSBinderDriver>(system, nv_flinger);
987 } 988 }
988 989
989 void OpenDisplay(Kernel::HLERequestContext& ctx) { 990 void OpenDisplay(Kernel::HLERequestContext& ctx) {
@@ -1261,8 +1262,9 @@ private:
1261 NVFlinger::NVFlinger& nv_flinger; 1262 NVFlinger::NVFlinger& nv_flinger;
1262}; 1263};
1263 1264
1264IApplicationDisplayService::IApplicationDisplayService(NVFlinger::NVFlinger& nv_flinger) 1265IApplicationDisplayService::IApplicationDisplayService(Core::System& system_,
1265 : ServiceFramework("IApplicationDisplayService"), nv_flinger(nv_flinger) { 1266 NVFlinger::NVFlinger& nv_flinger_)
1267 : ServiceFramework{system_, "IApplicationDisplayService"}, nv_flinger{nv_flinger_} {
1266 static const FunctionInfo functions[] = { 1268 static const FunctionInfo functions[] = {
1267 {100, &IApplicationDisplayService::GetRelayService, "GetRelayService"}, 1269 {100, &IApplicationDisplayService::GetRelayService, "GetRelayService"},
1268 {101, &IApplicationDisplayService::GetSystemDisplayService, "GetSystemDisplayService"}, 1270 {101, &IApplicationDisplayService::GetSystemDisplayService, "GetSystemDisplayService"},
@@ -1303,8 +1305,8 @@ static bool IsValidServiceAccess(Permission permission, Policy policy) {
1303 return false; 1305 return false;
1304} 1306}
1305 1307
1306void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, NVFlinger::NVFlinger& nv_flinger, 1308void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, Core::System& system,
1307 Permission permission) { 1309 NVFlinger::NVFlinger& nv_flinger, Permission permission) {
1308 IPC::RequestParser rp{ctx}; 1310 IPC::RequestParser rp{ctx};
1309 const auto policy = rp.PopEnum<Policy>(); 1311 const auto policy = rp.PopEnum<Policy>();
1310 1312
@@ -1317,13 +1319,14 @@ void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, NVFlinger::NV
1317 1319
1318 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 1320 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
1319 rb.Push(RESULT_SUCCESS); 1321 rb.Push(RESULT_SUCCESS);
1320 rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger); 1322 rb.PushIpcInterface<IApplicationDisplayService>(system, nv_flinger);
1321} 1323}
1322 1324
1323void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nv_flinger) { 1325void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system,
1324 std::make_shared<VI_M>(nv_flinger)->InstallAsService(service_manager); 1326 NVFlinger::NVFlinger& nv_flinger) {
1325 std::make_shared<VI_S>(nv_flinger)->InstallAsService(service_manager); 1327 std::make_shared<VI_M>(system, nv_flinger)->InstallAsService(service_manager);
1326 std::make_shared<VI_U>(nv_flinger)->InstallAsService(service_manager); 1328 std::make_shared<VI_S>(system, nv_flinger)->InstallAsService(service_manager);
1329 std::make_shared<VI_U>(system, nv_flinger)->InstallAsService(service_manager);
1327} 1330}
1328 1331
1329} // namespace Service::VI 1332} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h
index 5229fa753..eec531d54 100644
--- a/src/core/hle/service/vi/vi.h
+++ b/src/core/hle/service/vi/vi.h
@@ -7,6 +7,10 @@
7#include <memory> 7#include <memory>
8#include "common/common_types.h" 8#include "common/common_types.h"
9 9
10namespace Core {
11class System;
12}
13
10namespace Kernel { 14namespace Kernel {
11class HLERequestContext; 15class HLERequestContext;
12} 16}
@@ -43,11 +47,12 @@ enum class Policy {
43}; 47};
44 48
45namespace detail { 49namespace detail {
46void GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, NVFlinger::NVFlinger& nv_flinger, 50void GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, Core::System& system,
47 Permission permission); 51 NVFlinger::NVFlinger& nv_flinger, Permission permission);
48} // namespace detail 52} // namespace detail
49 53
50/// Registers all VI services with the specified service manager. 54/// Registers all VI services with the specified service manager.
51void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nv_flinger); 55void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system,
56 NVFlinger::NVFlinger& nv_flinger);
52 57
53} // namespace Service::VI 58} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi_m.cpp b/src/core/hle/service/vi/vi_m.cpp
index 41da3ee93..87db1c416 100644
--- a/src/core/hle/service/vi/vi_m.cpp
+++ b/src/core/hle/service/vi/vi_m.cpp
@@ -8,7 +8,8 @@
8 8
9namespace Service::VI { 9namespace Service::VI {
10 10
11VI_M::VI_M(NVFlinger::NVFlinger& nv_flinger) : ServiceFramework{"vi:m"}, nv_flinger{nv_flinger} { 11VI_M::VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
12 : ServiceFramework{system_, "vi:m"}, nv_flinger{nv_flinger_} {
12 static const FunctionInfo functions[] = { 13 static const FunctionInfo functions[] = {
13 {2, &VI_M::GetDisplayService, "GetDisplayService"}, 14 {2, &VI_M::GetDisplayService, "GetDisplayService"},
14 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 15 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
@@ -21,7 +22,7 @@ VI_M::~VI_M() = default;
21void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) { 22void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) {
22 LOG_DEBUG(Service_VI, "called"); 23 LOG_DEBUG(Service_VI, "called");
23 24
24 detail::GetDisplayServiceImpl(ctx, nv_flinger, Permission::Manager); 25 detail::GetDisplayServiceImpl(ctx, system, nv_flinger, Permission::Manager);
25} 26}
26 27
27} // namespace Service::VI 28} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi_m.h b/src/core/hle/service/vi/vi_m.h
index ee2489874..d79c41beb 100644
--- a/src/core/hle/service/vi/vi_m.h
+++ b/src/core/hle/service/vi/vi_m.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Kernel { 13namespace Kernel {
10class HLERequestContext; 14class HLERequestContext;
11} 15}
@@ -18,7 +22,7 @@ namespace Service::VI {
18 22
19class VI_M final : public ServiceFramework<VI_M> { 23class VI_M final : public ServiceFramework<VI_M> {
20public: 24public:
21 explicit VI_M(NVFlinger::NVFlinger& nv_flinger); 25 explicit VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_);
22 ~VI_M() override; 26 ~VI_M() override;
23 27
24private: 28private:
diff --git a/src/core/hle/service/vi/vi_s.cpp b/src/core/hle/service/vi/vi_s.cpp
index 6acb51e2a..5cd22f7df 100644
--- a/src/core/hle/service/vi/vi_s.cpp
+++ b/src/core/hle/service/vi/vi_s.cpp
@@ -8,7 +8,8 @@
8 8
9namespace Service::VI { 9namespace Service::VI {
10 10
11VI_S::VI_S(NVFlinger::NVFlinger& nv_flinger) : ServiceFramework{"vi:s"}, nv_flinger{nv_flinger} { 11VI_S::VI_S(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
12 : ServiceFramework{system_, "vi:s"}, nv_flinger{nv_flinger_} {
12 static const FunctionInfo functions[] = { 13 static const FunctionInfo functions[] = {
13 {1, &VI_S::GetDisplayService, "GetDisplayService"}, 14 {1, &VI_S::GetDisplayService, "GetDisplayService"},
14 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 15 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
@@ -21,7 +22,7 @@ VI_S::~VI_S() = default;
21void VI_S::GetDisplayService(Kernel::HLERequestContext& ctx) { 22void VI_S::GetDisplayService(Kernel::HLERequestContext& ctx) {
22 LOG_DEBUG(Service_VI, "called"); 23 LOG_DEBUG(Service_VI, "called");
23 24
24 detail::GetDisplayServiceImpl(ctx, nv_flinger, Permission::System); 25 detail::GetDisplayServiceImpl(ctx, system, nv_flinger, Permission::System);
25} 26}
26 27
27} // namespace Service::VI 28} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi_s.h b/src/core/hle/service/vi/vi_s.h
index 6790673ab..5f1f8f290 100644
--- a/src/core/hle/service/vi/vi_s.h
+++ b/src/core/hle/service/vi/vi_s.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Kernel { 13namespace Kernel {
10class HLERequestContext; 14class HLERequestContext;
11} 15}
@@ -18,7 +22,7 @@ namespace Service::VI {
18 22
19class VI_S final : public ServiceFramework<VI_S> { 23class VI_S final : public ServiceFramework<VI_S> {
20public: 24public:
21 explicit VI_S(NVFlinger::NVFlinger& nv_flinger); 25 explicit VI_S(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_);
22 ~VI_S() override; 26 ~VI_S() override;
23 27
24private: 28private:
diff --git a/src/core/hle/service/vi/vi_u.cpp b/src/core/hle/service/vi/vi_u.cpp
index 44e00a4f6..0079d51f0 100644
--- a/src/core/hle/service/vi/vi_u.cpp
+++ b/src/core/hle/service/vi/vi_u.cpp
@@ -8,7 +8,8 @@
8 8
9namespace Service::VI { 9namespace Service::VI {
10 10
11VI_U::VI_U(NVFlinger::NVFlinger& nv_flinger) : ServiceFramework{"vi:u"}, nv_flinger{nv_flinger} { 11VI_U::VI_U(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
12 : ServiceFramework{system_, "vi:u"}, nv_flinger{nv_flinger_} {
12 static const FunctionInfo functions[] = { 13 static const FunctionInfo functions[] = {
13 {0, &VI_U::GetDisplayService, "GetDisplayService"}, 14 {0, &VI_U::GetDisplayService, "GetDisplayService"},
14 {1, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 15 {1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
@@ -21,7 +22,7 @@ VI_U::~VI_U() = default;
21void VI_U::GetDisplayService(Kernel::HLERequestContext& ctx) { 22void VI_U::GetDisplayService(Kernel::HLERequestContext& ctx) {
22 LOG_DEBUG(Service_VI, "called"); 23 LOG_DEBUG(Service_VI, "called");
23 24
24 detail::GetDisplayServiceImpl(ctx, nv_flinger, Permission::User); 25 detail::GetDisplayServiceImpl(ctx, system, nv_flinger, Permission::User);
25} 26}
26 27
27} // namespace Service::VI 28} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi_u.h b/src/core/hle/service/vi/vi_u.h
index b59f986f0..8e3885c73 100644
--- a/src/core/hle/service/vi/vi_u.h
+++ b/src/core/hle/service/vi/vi_u.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Kernel { 13namespace Kernel {
10class HLERequestContext; 14class HLERequestContext;
11} 15}
@@ -18,7 +22,7 @@ namespace Service::VI {
18 22
19class VI_U final : public ServiceFramework<VI_U> { 23class VI_U final : public ServiceFramework<VI_U> {
20public: 24public:
21 explicit VI_U(NVFlinger::NVFlinger& nv_flinger); 25 explicit VI_U(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_);
22 ~VI_U() override; 26 ~VI_U() override;
23 27
24private: 28private:
diff --git a/src/core/hle/service/wlan/wlan.cpp b/src/core/hle/service/wlan/wlan.cpp
index 0260d7dcf..ddbf04069 100644
--- a/src/core/hle/service/wlan/wlan.cpp
+++ b/src/core/hle/service/wlan/wlan.cpp
@@ -12,7 +12,7 @@ namespace Service::WLAN {
12 12
13class WLANInfra final : public ServiceFramework<WLANInfra> { 13class WLANInfra final : public ServiceFramework<WLANInfra> {
14public: 14public:
15 explicit WLANInfra() : ServiceFramework{"wlan:inf"} { 15 explicit WLANInfra(Core::System& system_) : ServiceFramework{system_, "wlan:inf"} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, nullptr, "OpenMode"}, 18 {0, nullptr, "OpenMode"},
@@ -55,7 +55,7 @@ public:
55 55
56class WLANLocal final : public ServiceFramework<WLANLocal> { 56class WLANLocal final : public ServiceFramework<WLANLocal> {
57public: 57public:
58 explicit WLANLocal() : ServiceFramework{"wlan:lcl"} { 58 explicit WLANLocal(Core::System& system_) : ServiceFramework{system_, "wlan:lcl"} {
59 // clang-format off 59 // clang-format off
60 static const FunctionInfo functions[] = { 60 static const FunctionInfo functions[] = {
61 {0, nullptr, "Unknown0"}, 61 {0, nullptr, "Unknown0"},
@@ -120,7 +120,7 @@ public:
120 120
121class WLANLocalGetFrame final : public ServiceFramework<WLANLocalGetFrame> { 121class WLANLocalGetFrame final : public ServiceFramework<WLANLocalGetFrame> {
122public: 122public:
123 explicit WLANLocalGetFrame() : ServiceFramework{"wlan:lg"} { 123 explicit WLANLocalGetFrame(Core::System& system_) : ServiceFramework{system_, "wlan:lg"} {
124 // clang-format off 124 // clang-format off
125 static const FunctionInfo functions[] = { 125 static const FunctionInfo functions[] = {
126 {0, nullptr, "Unknown"}, 126 {0, nullptr, "Unknown"},
@@ -133,7 +133,7 @@ public:
133 133
134class WLANSocketGetFrame final : public ServiceFramework<WLANSocketGetFrame> { 134class WLANSocketGetFrame final : public ServiceFramework<WLANSocketGetFrame> {
135public: 135public:
136 explicit WLANSocketGetFrame() : ServiceFramework{"wlan:sg"} { 136 explicit WLANSocketGetFrame(Core::System& system_) : ServiceFramework{system_, "wlan:sg"} {
137 // clang-format off 137 // clang-format off
138 static const FunctionInfo functions[] = { 138 static const FunctionInfo functions[] = {
139 {0, nullptr, "Unknown"}, 139 {0, nullptr, "Unknown"},
@@ -146,7 +146,7 @@ public:
146 146
147class WLANSocketManager final : public ServiceFramework<WLANSocketManager> { 147class WLANSocketManager final : public ServiceFramework<WLANSocketManager> {
148public: 148public:
149 explicit WLANSocketManager() : ServiceFramework{"wlan:soc"} { 149 explicit WLANSocketManager(Core::System& system_) : ServiceFramework{system_, "wlan:soc"} {
150 // clang-format off 150 // clang-format off
151 static const FunctionInfo functions[] = { 151 static const FunctionInfo functions[] = {
152 {0, nullptr, "Unknown0"}, 152 {0, nullptr, "Unknown0"},
@@ -169,12 +169,12 @@ public:
169 } 169 }
170}; 170};
171 171
172void InstallInterfaces(SM::ServiceManager& sm) { 172void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
173 std::make_shared<WLANInfra>()->InstallAsService(sm); 173 std::make_shared<WLANInfra>(system)->InstallAsService(sm);
174 std::make_shared<WLANLocal>()->InstallAsService(sm); 174 std::make_shared<WLANLocal>(system)->InstallAsService(sm);
175 std::make_shared<WLANLocalGetFrame>()->InstallAsService(sm); 175 std::make_shared<WLANLocalGetFrame>(system)->InstallAsService(sm);
176 std::make_shared<WLANSocketGetFrame>()->InstallAsService(sm); 176 std::make_shared<WLANSocketGetFrame>(system)->InstallAsService(sm);
177 std::make_shared<WLANSocketManager>()->InstallAsService(sm); 177 std::make_shared<WLANSocketManager>(system)->InstallAsService(sm);
178} 178}
179 179
180} // namespace Service::WLAN 180} // namespace Service::WLAN
diff --git a/src/core/hle/service/wlan/wlan.h b/src/core/hle/service/wlan/wlan.h
index 054ea928a..3899eedbb 100644
--- a/src/core/hle/service/wlan/wlan.h
+++ b/src/core/hle/service/wlan/wlan.h
@@ -4,12 +4,16 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
10 14
11namespace Service::WLAN { 15namespace Service::WLAN {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::WLAN 19} // namespace Service::WLAN
diff --git a/src/yuzu_tester/service/yuzutest.cpp b/src/yuzu_tester/service/yuzutest.cpp
index 2d3f6e3a7..e257fae25 100644
--- a/src/yuzu_tester/service/yuzutest.cpp
+++ b/src/yuzu_tester/service/yuzutest.cpp
@@ -4,6 +4,7 @@
4 4
5#include <memory> 5#include <memory>
6#include "common/string_util.h" 6#include "common/string_util.h"
7#include "core/core.h"
7#include "core/hle/ipc_helpers.h" 8#include "core/hle/ipc_helpers.h"
8#include "core/hle/service/service.h" 9#include "core/hle/service/service.h"
9#include "core/hle/service/sm/sm.h" 10#include "core/hle/service/sm/sm.h"
@@ -15,10 +16,10 @@ constexpr u64 SERVICE_VERSION = 0x00000002;
15 16
16class YuzuTest final : public ServiceFramework<YuzuTest> { 17class YuzuTest final : public ServiceFramework<YuzuTest> {
17public: 18public:
18 explicit YuzuTest(std::string data, 19 explicit YuzuTest(Core::System& system_, std::string data_,
19 std::function<void(std::vector<TestResult>)> finish_callback) 20 std::function<void(std::vector<TestResult>)> finish_callback_)
20 : ServiceFramework{"yuzutest"}, data(std::move(data)), 21 : ServiceFramework{system_, "yuzutest"}, data{std::move(data_)}, finish_callback{std::move(
21 finish_callback(std::move(finish_callback)) { 22 finish_callback_)} {
22 static const FunctionInfo functions[] = { 23 static const FunctionInfo functions[] = {
23 {0, &YuzuTest::Initialize, "Initialize"}, 24 {0, &YuzuTest::Initialize, "Initialize"},
24 {1, &YuzuTest::GetServiceVersion, "GetServiceVersion"}, 25 {1, &YuzuTest::GetServiceVersion, "GetServiceVersion"},
@@ -104,9 +105,11 @@ private:
104 std::function<void(std::vector<TestResult>)> finish_callback; 105 std::function<void(std::vector<TestResult>)> finish_callback;
105}; 106};
106 107
107void InstallInterfaces(SM::ServiceManager& sm, std::string data, 108void InstallInterfaces(Core::System& system, std::string data,
108 std::function<void(std::vector<TestResult>)> finish_callback) { 109 std::function<void(std::vector<TestResult>)> finish_callback) {
109 std::make_shared<YuzuTest>(data, finish_callback)->InstallAsService(sm); 110 auto& sm = system.ServiceManager();
111 std::make_shared<YuzuTest>(system, std::move(data), std::move(finish_callback))
112 ->InstallAsService(sm);
110} 113}
111 114
112} // namespace Service::Yuzu 115} // namespace Service::Yuzu
diff --git a/src/yuzu_tester/service/yuzutest.h b/src/yuzu_tester/service/yuzutest.h
index eca129c8c..7794814fa 100644
--- a/src/yuzu_tester/service/yuzutest.h
+++ b/src/yuzu_tester/service/yuzutest.h
@@ -7,8 +7,8 @@
7#include <functional> 7#include <functional>
8#include <string> 8#include <string>
9 9
10namespace Service::SM { 10namespace Core {
11class ServiceManager; 11class System;
12} 12}
13 13
14namespace Service::Yuzu { 14namespace Service::Yuzu {
@@ -19,7 +19,7 @@ struct TestResult {
19 std::string name; 19 std::string name;
20}; 20};
21 21
22void InstallInterfaces(SM::ServiceManager& sm, std::string data, 22void InstallInterfaces(Core::System& system, std::string data,
23 std::function<void(std::vector<TestResult>)> finish_callback); 23 std::function<void(std::vector<TestResult>)> finish_callback);
24 24
25} // namespace Service::Yuzu 25} // namespace Service::Yuzu
diff --git a/src/yuzu_tester/yuzu.cpp b/src/yuzu_tester/yuzu.cpp
index 88e4bd1f7..ea94a6537 100644
--- a/src/yuzu_tester/yuzu.cpp
+++ b/src/yuzu_tester/yuzu.cpp
@@ -247,9 +247,10 @@ int main(int argc, char** argv) {
247 "additional help.\n\nError Code: {:04X}-{:04X}\nError Description: {}", 247 "additional help.\n\nError Code: {:04X}-{:04X}\nError Description: {}",
248 loader_id, error_id, static_cast<Loader::ResultStatus>(error_id)); 248 loader_id, error_id, static_cast<Loader::ResultStatus>(error_id));
249 } 249 }
250 break;
250 } 251 }
251 252
252 Service::Yuzu::InstallInterfaces(system.ServiceManager(), datastring, callback); 253 Service::Yuzu::InstallInterfaces(system, datastring, callback);
253 254
254 system.TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", 255 system.TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend",
255 "SDLHideTester"); 256 "SDLHideTester");