yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

service: Eliminate usages of the global system instance

Completely removes all usages of the global system instance within the
services code by passing in the using system instance to the services.
This commit is contained in:
Lioncash 2020-11-26 15:19:08 -05:00
parent 322349e8cc
commit 1a954b2a59
222 changed files with 1221 additions and 907 deletions

View File

@ -47,8 +47,8 @@ static constexpr u32 SanitizeJPEGSize(std::size_t size) {
class IManagerForSystemService final : public ServiceFramework<IManagerForSystemService> { class IManagerForSystemService final : public ServiceFramework<IManagerForSystemService> {
public: public:
explicit IManagerForSystemService(Common::UUID user_id) explicit IManagerForSystemService(Core::System& system_, Common::UUID)
: ServiceFramework("IManagerForSystemService") { : ServiceFramework{system_, "IManagerForSystemService"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "CheckAvailability"}, {0, nullptr, "CheckAvailability"},
@ -83,8 +83,8 @@ public:
// 3.0.0+ // 3.0.0+
class IFloatingRegistrationRequest final : public ServiceFramework<IFloatingRegistrationRequest> { class IFloatingRegistrationRequest final : public ServiceFramework<IFloatingRegistrationRequest> {
public: public:
explicit IFloatingRegistrationRequest(Common::UUID user_id) explicit IFloatingRegistrationRequest(Core::System& system_, Common::UUID)
: ServiceFramework("IFloatingRegistrationRequest") { : ServiceFramework{system_, "IFloatingRegistrationRequest"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetSessionId"}, {0, nullptr, "GetSessionId"},
@ -108,7 +108,8 @@ public:
class IAdministrator final : public ServiceFramework<IAdministrator> { class IAdministrator final : public ServiceFramework<IAdministrator> {
public: public:
explicit IAdministrator(Common::UUID user_id) : ServiceFramework("IAdministrator") { explicit IAdministrator(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IAdministrator"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "CheckAvailability"}, {0, nullptr, "CheckAvailability"},
@ -165,8 +166,8 @@ public:
class IAuthorizationRequest final : public ServiceFramework<IAuthorizationRequest> { class IAuthorizationRequest final : public ServiceFramework<IAuthorizationRequest> {
public: public:
explicit IAuthorizationRequest(Common::UUID user_id) explicit IAuthorizationRequest(Core::System& system_, Common::UUID)
: ServiceFramework("IAuthorizationRequest") { : ServiceFramework{system_, "IAuthorizationRequest"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetSessionId"}, {0, nullptr, "GetSessionId"},
@ -184,7 +185,8 @@ public:
class IOAuthProcedure final : public ServiceFramework<IOAuthProcedure> { class IOAuthProcedure final : public ServiceFramework<IOAuthProcedure> {
public: public:
explicit IOAuthProcedure(Common::UUID user_id) : ServiceFramework("IOAuthProcedure") { explicit IOAuthProcedure(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IOAuthProcedure"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "PrepareAsync"}, {0, nullptr, "PrepareAsync"},
@ -202,8 +204,8 @@ public:
// 3.0.0+ // 3.0.0+
class IOAuthProcedureForExternalNsa final : public ServiceFramework<IOAuthProcedureForExternalNsa> { class IOAuthProcedureForExternalNsa final : public ServiceFramework<IOAuthProcedureForExternalNsa> {
public: public:
explicit IOAuthProcedureForExternalNsa(Common::UUID user_id) explicit IOAuthProcedureForExternalNsa(Core::System& system_, Common::UUID)
: ServiceFramework("IOAuthProcedureForExternalNsa") { : ServiceFramework{system_, "IOAuthProcedureForExternalNsa"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "PrepareAsync"}, {0, nullptr, "PrepareAsync"},
@ -225,8 +227,8 @@ public:
class IOAuthProcedureForNintendoAccountLinkage final class IOAuthProcedureForNintendoAccountLinkage final
: public ServiceFramework<IOAuthProcedureForNintendoAccountLinkage> { : public ServiceFramework<IOAuthProcedureForNintendoAccountLinkage> {
public: public:
explicit IOAuthProcedureForNintendoAccountLinkage(Common::UUID user_id) explicit IOAuthProcedureForNintendoAccountLinkage(Core::System& system_, Common::UUID)
: ServiceFramework("IOAuthProcedureForNintendoAccountLinkage") { : ServiceFramework{system_, "IOAuthProcedureForNintendoAccountLinkage"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "PrepareAsync"}, {0, nullptr, "PrepareAsync"},
@ -246,7 +248,8 @@ public:
class INotifier final : public ServiceFramework<INotifier> { class INotifier final : public ServiceFramework<INotifier> {
public: public:
explicit INotifier(Common::UUID user_id) : ServiceFramework("INotifier") { explicit INotifier(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "INotifier"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetSystemEvent"}, {0, nullptr, "GetSystemEvent"},
@ -259,9 +262,9 @@ public:
class IProfileCommon : public ServiceFramework<IProfileCommon> { class IProfileCommon : public ServiceFramework<IProfileCommon> {
public: public:
explicit IProfileCommon(const char* name, bool editor_commands, Common::UUID user_id, explicit IProfileCommon(Core::System& system_, const char* name, bool editor_commands,
ProfileManager& profile_manager) Common::UUID user_id_, ProfileManager& profile_manager_)
: ServiceFramework(name), profile_manager(profile_manager), user_id(user_id) { : ServiceFramework{system_, name}, profile_manager{profile_manager_}, user_id{user_id_} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IProfileCommon::Get, "Get"}, {0, &IProfileCommon::Get, "Get"},
{1, &IProfileCommon::GetBase, "GetBase"}, {1, &IProfileCommon::GetBase, "GetBase"},
@ -427,19 +430,21 @@ protected:
class IProfile final : public IProfileCommon { class IProfile final : public IProfileCommon {
public: public:
IProfile(Common::UUID user_id, ProfileManager& profile_manager) explicit IProfile(Core::System& system_, Common::UUID user_id_,
: IProfileCommon("IProfile", false, user_id, profile_manager) {} ProfileManager& profile_manager_)
: IProfileCommon{system_, "IProfile", false, user_id_, profile_manager_} {}
}; };
class IProfileEditor final : public IProfileCommon { class IProfileEditor final : public IProfileCommon {
public: public:
IProfileEditor(Common::UUID user_id, ProfileManager& profile_manager) explicit IProfileEditor(Core::System& system_, Common::UUID user_id_,
: IProfileCommon("IProfileEditor", true, user_id, profile_manager) {} ProfileManager& profile_manager_)
: IProfileCommon{system_, "IProfileEditor", true, user_id_, profile_manager_} {}
}; };
class IAsyncContext final : public ServiceFramework<IAsyncContext> { class IAsyncContext final : public ServiceFramework<IAsyncContext> {
public: public:
explicit IAsyncContext(Common::UUID user_id) : ServiceFramework("IAsyncContext") { explicit IAsyncContext(Core::System& system_) : ServiceFramework{system_, "IAsyncContext"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetSystemEvent"}, {0, nullptr, "GetSystemEvent"},
@ -455,7 +460,8 @@ public:
class ISessionObject final : public ServiceFramework<ISessionObject> { class ISessionObject final : public ServiceFramework<ISessionObject> {
public: public:
explicit ISessionObject(Common::UUID user_id) : ServiceFramework("ISessionObject") { explicit ISessionObject(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "ISessionObject"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{999, nullptr, "Dummy"}, {999, nullptr, "Dummy"},
@ -468,7 +474,8 @@ public:
class IGuestLoginRequest final : public ServiceFramework<IGuestLoginRequest> { class IGuestLoginRequest final : public ServiceFramework<IGuestLoginRequest> {
public: public:
explicit IGuestLoginRequest(Common::UUID) : ServiceFramework("IGuestLoginRequest") { explicit IGuestLoginRequest(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IGuestLoginRequest"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetSessionId"}, {0, nullptr, "GetSessionId"},
@ -487,8 +494,8 @@ public:
class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { class IManagerForApplication final : public ServiceFramework<IManagerForApplication> {
public: public:
explicit IManagerForApplication(Common::UUID user_id) explicit IManagerForApplication(Core::System& system_, Common::UUID user_id_)
: ServiceFramework("IManagerForApplication"), user_id(user_id) { : ServiceFramework{system_, "IManagerForApplication"}, user_id{user_id_} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"},
@ -534,8 +541,8 @@ private:
class IAsyncNetworkServiceLicenseKindContext final class IAsyncNetworkServiceLicenseKindContext final
: public ServiceFramework<IAsyncNetworkServiceLicenseKindContext> { : public ServiceFramework<IAsyncNetworkServiceLicenseKindContext> {
public: public:
explicit IAsyncNetworkServiceLicenseKindContext(Common::UUID user_id) explicit IAsyncNetworkServiceLicenseKindContext(Core::System& system_, Common::UUID)
: ServiceFramework("IAsyncNetworkServiceLicenseKindContext") { : ServiceFramework{system_, "IAsyncNetworkServiceLicenseKindContext"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetSystemEvent"}, {0, nullptr, "GetSystemEvent"},
@ -554,8 +561,8 @@ public:
class IOAuthProcedureForUserRegistration final class IOAuthProcedureForUserRegistration final
: public ServiceFramework<IOAuthProcedureForUserRegistration> { : public ServiceFramework<IOAuthProcedureForUserRegistration> {
public: public:
explicit IOAuthProcedureForUserRegistration(Common::UUID user_id) explicit IOAuthProcedureForUserRegistration(Core::System& system_, Common::UUID)
: ServiceFramework("IOAuthProcedureForUserRegistration") { : ServiceFramework{system_, "IOAuthProcedureForUserRegistration"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "PrepareAsync"}, {0, nullptr, "PrepareAsync"},
@ -578,7 +585,7 @@ public:
class DAUTH_O final : public ServiceFramework<DAUTH_O> { class DAUTH_O final : public ServiceFramework<DAUTH_O> {
public: public:
explicit DAUTH_O(Common::UUID) : ServiceFramework("dauth:o") { explicit DAUTH_O(Core::System& system_, Common::UUID) : ServiceFramework{system_, "dauth:o"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, // [5.0.0-5.1.0] GeneratePostData {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, // [5.0.0-5.1.0] GeneratePostData
@ -597,7 +604,8 @@ public:
// 6.0.0+ // 6.0.0+
class IAsyncResult final : public ServiceFramework<IAsyncResult> { class IAsyncResult final : public ServiceFramework<IAsyncResult> {
public: public:
explicit IAsyncResult(Common::UUID user_id) : ServiceFramework("IAsyncResult") { explicit IAsyncResult(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IAsyncResult"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetResult"}, {0, nullptr, "GetResult"},
@ -656,7 +664,7 @@ void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IProfile>(user_id, *profile_manager); rb.PushIpcInterface<IProfile>(system, user_id, *profile_manager);
} }
void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx) { void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx) {
@ -731,7 +739,7 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo
LOG_DEBUG(Service_ACC, "called"); LOG_DEBUG(Service_ACC, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IManagerForApplication>(profile_manager->GetLastOpenedUser()); rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser());
} }
void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) {
@ -769,7 +777,7 @@ void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IProfileEditor>(user_id, *profile_manager); rb.PushIpcInterface<IProfileEditor>(system, user_id, *profile_manager);
} }
void Module::Interface::ListQualifiedUsers(Kernel::HLERequestContext& ctx) { void Module::Interface::ListQualifiedUsers(Kernel::HLERequestContext& ctx) {
@ -791,7 +799,7 @@ void Module::Interface::LoadOpenContext(Kernel::HLERequestContext& ctx) {
// TODO: Find the differences between this and GetBaasAccountManagerForApplication // TODO: Find the differences between this and GetBaasAccountManagerForApplication
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IManagerForApplication>(profile_manager->GetLastOpenedUser()); rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser());
} }
void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx) { void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx) {
@ -827,11 +835,11 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex
rb.PushRaw<u128>(profile_manager->GetUser(0)->uuid); rb.PushRaw<u128>(profile_manager->GetUser(0)->uuid);
} }
Module::Interface::Interface(std::shared_ptr<Module> module, Module::Interface::Interface(std::shared_ptr<Module> module_,
std::shared_ptr<ProfileManager> profile_manager, Core::System& system, std::shared_ptr<ProfileManager> profile_manager_,
const char* name) Core::System& system_, const char* name)
: ServiceFramework(name), module(std::move(module)), : ServiceFramework{system_, name}, module{std::move(module_)}, profile_manager{std::move(
profile_manager(std::move(profile_manager)), system(system) {} profile_manager_)} {}
Module::Interface::~Interface() = default; Module::Interface::~Interface() = default;

View File

@ -15,8 +15,8 @@ class Module final {
public: public:
class Interface : public ServiceFramework<Interface> { class Interface : public ServiceFramework<Interface> {
public: public:
explicit Interface(std::shared_ptr<Module> module, explicit Interface(std::shared_ptr<Module> module_,
std::shared_ptr<ProfileManager> profile_manager, Core::System& system, std::shared_ptr<ProfileManager> profile_manager_, Core::System& system_,
const char* name); const char* name);
~Interface() override; ~Interface() override;
@ -60,7 +60,6 @@ public:
protected: protected:
std::shared_ptr<Module> module; std::shared_ptr<Module> module;
std::shared_ptr<ProfileManager> profile_manager; std::shared_ptr<ProfileManager> profile_manager;
Core::System& system;
}; };
}; };

View File

@ -64,7 +64,7 @@ struct LaunchParameterAccountPreselectedUser {
static_assert(sizeof(LaunchParameterAccountPreselectedUser) == 0x88); static_assert(sizeof(LaunchParameterAccountPreselectedUser) == 0x88);
IWindowController::IWindowController(Core::System& system_) IWindowController::IWindowController(Core::System& system_)
: ServiceFramework("IWindowController"), system{system_} { : ServiceFramework{system_, "IWindowController"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "CreateWindow"}, {0, nullptr, "CreateWindow"},
@ -99,7 +99,8 @@ void IWindowController::AcquireForegroundRights(Kernel::HLERequestContext& ctx)
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
IAudioController::IAudioController() : ServiceFramework("IAudioController") { IAudioController::IAudioController(Core::System& system_)
: ServiceFramework{system_, "IAudioController"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IAudioController::SetExpectedMasterVolume, "SetExpectedMasterVolume"}, {0, &IAudioController::SetExpectedMasterVolume, "SetExpectedMasterVolume"},
@ -180,7 +181,8 @@ void IAudioController::SetTransparentAudioRate(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
IDisplayController::IDisplayController() : ServiceFramework("IDisplayController") { IDisplayController::IDisplayController(Core::System& system_)
: ServiceFramework{system_, "IDisplayController"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetLastForegroundCaptureImage"}, {0, nullptr, "GetLastForegroundCaptureImage"},
@ -219,7 +221,8 @@ IDisplayController::IDisplayController() : ServiceFramework("IDisplayController"
IDisplayController::~IDisplayController() = default; IDisplayController::~IDisplayController() = default;
IDebugFunctions::IDebugFunctions() : ServiceFramework{"IDebugFunctions"} { IDebugFunctions::IDebugFunctions(Core::System& system_)
: ServiceFramework{system_, "IDebugFunctions"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "NotifyMessageToHomeMenuForDebug"}, {0, nullptr, "NotifyMessageToHomeMenuForDebug"},
@ -246,8 +249,8 @@ IDebugFunctions::IDebugFunctions() : ServiceFramework{"IDebugFunctions"} {
IDebugFunctions::~IDebugFunctions() = default; IDebugFunctions::~IDebugFunctions() = default;
ISelfController::ISelfController(Core::System& system, NVFlinger::NVFlinger& nvflinger) ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nvflinger_)
: ServiceFramework("ISelfController"), system(system), nvflinger(nvflinger) { : ServiceFramework{system_, "ISelfController"}, nvflinger{nvflinger_} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &ISelfController::Exit, "Exit"}, {0, &ISelfController::Exit, "Exit"},
@ -605,9 +608,9 @@ void AppletMessageQueue::RequestExit() {
PushMessage(AppletMessage::ExitRequested); PushMessage(AppletMessage::ExitRequested);
} }
ICommonStateGetter::ICommonStateGetter(Core::System& system, ICommonStateGetter::ICommonStateGetter(Core::System& system_,
std::shared_ptr<AppletMessageQueue> msg_queue) std::shared_ptr<AppletMessageQueue> msg_queue_)
: ServiceFramework("ICommonStateGetter"), system(system), msg_queue(std::move(msg_queue)) { : ServiceFramework{system_, "ICommonStateGetter"}, msg_queue{std::move(msg_queue_)} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &ICommonStateGetter::GetEventHandle, "GetEventHandle"}, {0, &ICommonStateGetter::GetEventHandle, "GetEventHandle"},
@ -795,8 +798,9 @@ private:
std::vector<u8> buffer; std::vector<u8> buffer;
}; };
IStorage::IStorage(std::vector<u8>&& buffer) IStorage::IStorage(Core::System& system_, std::vector<u8>&& buffer)
: ServiceFramework("IStorage"), impl{std::make_shared<StorageDataImpl>(std::move(buffer))} { : ServiceFramework{system_, "IStorage"}, impl{std::make_shared<StorageDataImpl>(
std::move(buffer))} {
Register(); Register();
} }
@ -819,7 +823,7 @@ void IStorage::Open(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IStorageAccessor>(*this); rb.PushIpcInterface<IStorageAccessor>(system, *this);
} }
void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) {
@ -841,8 +845,8 @@ void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
class ILibraryAppletAccessor final : public ServiceFramework<ILibraryAppletAccessor> { class ILibraryAppletAccessor final : public ServiceFramework<ILibraryAppletAccessor> {
public: public:
explicit ILibraryAppletAccessor(std::shared_ptr<Applets::Applet> applet) explicit ILibraryAppletAccessor(Core::System& system_, std::shared_ptr<Applets::Applet> applet_)
: ServiceFramework("ILibraryAppletAccessor"), applet(std::move(applet)) { : ServiceFramework{system_, "ILibraryAppletAccessor"}, applet{std::move(applet_)} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"}, {0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"},
@ -997,8 +1001,8 @@ private:
std::shared_ptr<Applets::Applet> applet; std::shared_ptr<Applets::Applet> applet;
}; };
IStorageAccessor::IStorageAccessor(IStorage& storage) IStorageAccessor::IStorageAccessor(Core::System& system_, IStorage& backing_)
: ServiceFramework("IStorageAccessor"), backing(storage) { : ServiceFramework{system_, "IStorageAccessor"}, backing{backing_} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IStorageAccessor::GetSize, "GetSize"}, {0, &IStorageAccessor::GetSize, "GetSize"},
@ -1069,7 +1073,7 @@ void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) {
} }
ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_) ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_)
: ServiceFramework("ILibraryAppletCreator"), system{system_} { : ServiceFramework{system_, "ILibraryAppletCreator"} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &ILibraryAppletCreator::CreateLibraryApplet, "CreateLibraryApplet"}, {0, &ILibraryAppletCreator::CreateLibraryApplet, "CreateLibraryApplet"},
{1, nullptr, "TerminateAllLibraryApplets"}, {1, nullptr, "TerminateAllLibraryApplets"},
@ -1105,7 +1109,7 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx)
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<AM::ILibraryAppletAccessor>(applet); rb.PushIpcInterface<ILibraryAppletAccessor>(system, applet);
} }
void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) { void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) {
@ -1117,7 +1121,7 @@ void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<AM::IStorage>(std::move(buffer)); rb.PushIpcInterface<IStorage>(system, std::move(buffer));
} }
void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx) { void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx) {
@ -1144,11 +1148,11 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IStorage>(std::move(memory)); rb.PushIpcInterface<IStorage>(system, std::move(memory));
} }
IApplicationFunctions::IApplicationFunctions(Core::System& system_) IApplicationFunctions::IApplicationFunctions(Core::System& system_)
: ServiceFramework("IApplicationFunctions"), system{system_} { : ServiceFramework{system_, "IApplicationFunctions"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{1, &IApplicationFunctions::PopLaunchParameter, "PopLaunchParameter"}, {1, &IApplicationFunctions::PopLaunchParameter, "PopLaunchParameter"},
@ -1300,7 +1304,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
if (data.has_value()) { if (data.has_value()) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IStorage>(std::move(*data)); rb.PushIpcInterface<IStorage>(system, std::move(*data));
launch_popped_application_specific = true; launch_popped_application_specific = true;
return; return;
} }
@ -1323,7 +1327,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
std::vector<u8> buffer(sizeof(LaunchParameterAccountPreselectedUser)); std::vector<u8> buffer(sizeof(LaunchParameterAccountPreselectedUser));
std::memcpy(buffer.data(), &params, buffer.size()); std::memcpy(buffer.data(), &params, buffer.size());
rb.PushIpcInterface<IStorage>(std::move(buffer)); rb.PushIpcInterface<IStorage>(system, std::move(buffer));
launch_popped_account_preselect = true; launch_popped_account_preselect = true;
return; return;
} }
@ -1621,14 +1625,14 @@ void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger
std::make_shared<AppletAE>(nvflinger, message_queue, system)->InstallAsService(service_manager); std::make_shared<AppletAE>(nvflinger, message_queue, system)->InstallAsService(service_manager);
std::make_shared<AppletOE>(nvflinger, message_queue, system)->InstallAsService(service_manager); std::make_shared<AppletOE>(nvflinger, message_queue, system)->InstallAsService(service_manager);
std::make_shared<IdleSys>()->InstallAsService(service_manager); std::make_shared<IdleSys>(system)->InstallAsService(service_manager);
std::make_shared<OMM>()->InstallAsService(service_manager); std::make_shared<OMM>(system)->InstallAsService(service_manager);
std::make_shared<SPSM>()->InstallAsService(service_manager); std::make_shared<SPSM>(system)->InstallAsService(service_manager);
std::make_shared<TCAP>()->InstallAsService(service_manager); std::make_shared<TCAP>(system)->InstallAsService(service_manager);
} }
IHomeMenuFunctions::IHomeMenuFunctions(Kernel::KernelCore& kernel) IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_)
: ServiceFramework("IHomeMenuFunctions"), kernel(kernel) { : ServiceFramework{system_, "IHomeMenuFunctions"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"}, {10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"},
@ -1647,7 +1651,7 @@ IHomeMenuFunctions::IHomeMenuFunctions(Kernel::KernelCore& kernel)
RegisterHandlers(functions); RegisterHandlers(functions);
pop_from_general_channel_event = Kernel::WritableEvent::CreateEventPair( pop_from_general_channel_event = Kernel::WritableEvent::CreateEventPair(
kernel, "IHomeMenuFunctions:PopFromGeneralChannelEvent"); system.Kernel(), "IHomeMenuFunctions:PopFromGeneralChannelEvent");
} }
IHomeMenuFunctions::~IHomeMenuFunctions() = default; IHomeMenuFunctions::~IHomeMenuFunctions() = default;
@ -1667,7 +1671,8 @@ void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(Kernel::HLERequestContext
rb.PushCopyObjects(pop_from_general_channel_event.readable); rb.PushCopyObjects(pop_from_general_channel_event.readable);
} }
IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStateController") { IGlobalStateController::IGlobalStateController(Core::System& system_)
: ServiceFramework{system_, "IGlobalStateController"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "RequestToEnterSleep"}, {0, nullptr, "RequestToEnterSleep"},
@ -1690,7 +1695,8 @@ IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStat
IGlobalStateController::~IGlobalStateController() = default; IGlobalStateController::~IGlobalStateController() = default;
IApplicationCreator::IApplicationCreator() : ServiceFramework("IApplicationCreator") { IApplicationCreator::IApplicationCreator(Core::System& system_)
: ServiceFramework{system_, "IApplicationCreator"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "CreateApplication"}, {0, nullptr, "CreateApplication"},
@ -1705,8 +1711,8 @@ IApplicationCreator::IApplicationCreator() : ServiceFramework("IApplicationCreat
IApplicationCreator::~IApplicationCreator() = default; IApplicationCreator::~IApplicationCreator() = default;
IProcessWindingController::IProcessWindingController() IProcessWindingController::IProcessWindingController(Core::System& system_)
: ServiceFramework("IProcessWindingController") { : ServiceFramework{system_, "IProcessWindingController"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetLaunchReason"}, {0, nullptr, "GetLaunchReason"},

View File

@ -77,13 +77,11 @@ public:
private: private:
void GetAppletResourceUserId(Kernel::HLERequestContext& ctx); void GetAppletResourceUserId(Kernel::HLERequestContext& ctx);
void AcquireForegroundRights(Kernel::HLERequestContext& ctx); void AcquireForegroundRights(Kernel::HLERequestContext& ctx);
Core::System& system;
}; };
class IAudioController final : public ServiceFramework<IAudioController> { class IAudioController final : public ServiceFramework<IAudioController> {
public: public:
IAudioController(); explicit IAudioController(Core::System& system_);
~IAudioController() override; ~IAudioController() override;
private: private:
@ -109,13 +107,13 @@ private:
class IDisplayController final : public ServiceFramework<IDisplayController> { class IDisplayController final : public ServiceFramework<IDisplayController> {
public: public:
IDisplayController(); explicit IDisplayController(Core::System& system_);
~IDisplayController() override; ~IDisplayController() override;
}; };
class IDebugFunctions final : public ServiceFramework<IDebugFunctions> { class IDebugFunctions final : public ServiceFramework<IDebugFunctions> {
public: public:
IDebugFunctions(); explicit IDebugFunctions(Core::System& system_);
~IDebugFunctions() override; ~IDebugFunctions() override;
}; };
@ -154,7 +152,6 @@ private:
Disable = 2, Disable = 2,
}; };
Core::System& system;
NVFlinger::NVFlinger& nvflinger; NVFlinger::NVFlinger& nvflinger;
Kernel::EventPair launchable_event; Kernel::EventPair launchable_event;
Kernel::EventPair accumulated_suspended_tick_changed_event; Kernel::EventPair accumulated_suspended_tick_changed_event;
@ -167,8 +164,8 @@ private:
class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> { class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> {
public: public:
explicit ICommonStateGetter(Core::System& system, explicit ICommonStateGetter(Core::System& system_,
std::shared_ptr<AppletMessageQueue> msg_queue); std::shared_ptr<AppletMessageQueue> msg_queue_);
~ICommonStateGetter() override; ~ICommonStateGetter() override;
private: private:
@ -196,7 +193,6 @@ private:
void GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx); void GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx);
void SetCpuBoostMode(Kernel::HLERequestContext& ctx); void SetCpuBoostMode(Kernel::HLERequestContext& ctx);
Core::System& system;
std::shared_ptr<AppletMessageQueue> msg_queue; std::shared_ptr<AppletMessageQueue> msg_queue;
bool vr_mode_state{}; bool vr_mode_state{};
}; };
@ -211,7 +207,7 @@ public:
class IStorage final : public ServiceFramework<IStorage> { class IStorage final : public ServiceFramework<IStorage> {
public: public:
explicit IStorage(std::vector<u8>&& buffer); explicit IStorage(Core::System& system_, std::vector<u8>&& buffer);
~IStorage() override; ~IStorage() override;
std::vector<u8>& GetData() { std::vector<u8>& GetData() {
@ -235,7 +231,7 @@ private:
class IStorageAccessor final : public ServiceFramework<IStorageAccessor> { class IStorageAccessor final : public ServiceFramework<IStorageAccessor> {
public: public:
explicit IStorageAccessor(IStorage& backing); explicit IStorageAccessor(Core::System& system_, IStorage& backing_);
~IStorageAccessor() override; ~IStorageAccessor() override;
private: private:
@ -255,8 +251,6 @@ private:
void CreateLibraryApplet(Kernel::HLERequestContext& ctx); void CreateLibraryApplet(Kernel::HLERequestContext& ctx);
void CreateStorage(Kernel::HLERequestContext& ctx); void CreateStorage(Kernel::HLERequestContext& ctx);
void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx); void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx);
Core::System& system;
}; };
class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> { class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> {
@ -299,12 +293,11 @@ private:
s32 previous_program_index{-1}; s32 previous_program_index{-1};
Kernel::EventPair gpu_error_detected_event; Kernel::EventPair gpu_error_detected_event;
Kernel::EventPair friend_invitation_storage_channel_event; Kernel::EventPair friend_invitation_storage_channel_event;
Core::System& system;
}; };
class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> { class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> {
public: public:
explicit IHomeMenuFunctions(Kernel::KernelCore& kernel); explicit IHomeMenuFunctions(Core::System& system_);
~IHomeMenuFunctions() override; ~IHomeMenuFunctions() override;
private: private:
@ -312,24 +305,23 @@ private:
void GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx); void GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx);
Kernel::EventPair pop_from_general_channel_event; Kernel::EventPair pop_from_general_channel_event;
Kernel::KernelCore& kernel;
}; };
class IGlobalStateController final : public ServiceFramework<IGlobalStateController> { class IGlobalStateController final : public ServiceFramework<IGlobalStateController> {
public: public:
IGlobalStateController(); explicit IGlobalStateController(Core::System& system_);
~IGlobalStateController() override; ~IGlobalStateController() override;
}; };
class IApplicationCreator final : public ServiceFramework<IApplicationCreator> { class IApplicationCreator final : public ServiceFramework<IApplicationCreator> {
public: public:
IApplicationCreator(); explicit IApplicationCreator(Core::System& system_);
~IApplicationCreator() override; ~IApplicationCreator() override;
}; };
class IProcessWindingController final : public ServiceFramework<IProcessWindingController> { class IProcessWindingController final : public ServiceFramework<IProcessWindingController> {
public: public:
IProcessWindingController(); explicit IProcessWindingController(Core::System& system_);
~IProcessWindingController() override; ~IProcessWindingController() override;
}; };

View File

@ -13,11 +13,11 @@ namespace Service::AM {
class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> { class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> {
public: public:
explicit ILibraryAppletProxy(NVFlinger::NVFlinger& nvflinger, explicit ILibraryAppletProxy(NVFlinger::NVFlinger& nvflinger_,
std::shared_ptr<AppletMessageQueue> msg_queue, std::shared_ptr<AppletMessageQueue> msg_queue_,
Core::System& system) Core::System& system_)
: ServiceFramework("ILibraryAppletProxy"), nvflinger(nvflinger), : ServiceFramework{system_, "ILibraryAppletProxy"}, nvflinger{nvflinger_},
msg_queue(std::move(msg_queue)), system(system) { msg_queue{std::move(msg_queue_)} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
@ -66,7 +66,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IAudioController>(); rb.PushIpcInterface<IAudioController>(system);
} }
void GetDisplayController(Kernel::HLERequestContext& ctx) { void GetDisplayController(Kernel::HLERequestContext& ctx) {
@ -74,7 +74,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDisplayController>(); rb.PushIpcInterface<IDisplayController>(system);
} }
void GetProcessWindingController(Kernel::HLERequestContext& ctx) { void GetProcessWindingController(Kernel::HLERequestContext& ctx) {
@ -82,7 +82,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IProcessWindingController>(); rb.PushIpcInterface<IProcessWindingController>(system);
} }
void GetDebugFunctions(Kernel::HLERequestContext& ctx) { void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
@ -90,7 +90,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDebugFunctions>(); rb.PushIpcInterface<IDebugFunctions>(system);
} }
void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
@ -111,15 +111,15 @@ private:
NVFlinger::NVFlinger& nvflinger; NVFlinger::NVFlinger& nvflinger;
std::shared_ptr<AppletMessageQueue> msg_queue; std::shared_ptr<AppletMessageQueue> msg_queue;
Core::System& system;
}; };
class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> { class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> {
public: public:
explicit ISystemAppletProxy(NVFlinger::NVFlinger& nvflinger, explicit ISystemAppletProxy(NVFlinger::NVFlinger& nvflinger_,
std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system) std::shared_ptr<AppletMessageQueue> msg_queue_,
: ServiceFramework("ISystemAppletProxy"), nvflinger(nvflinger), Core::System& system_)
msg_queue(std::move(msg_queue)), system(system) { : ServiceFramework{system_, "ISystemAppletProxy"}, nvflinger{nvflinger_},
msg_queue{std::move(msg_queue_)} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &ISystemAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, {0, &ISystemAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
@ -170,7 +170,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IAudioController>(); rb.PushIpcInterface<IAudioController>(system);
} }
void GetDisplayController(Kernel::HLERequestContext& ctx) { void GetDisplayController(Kernel::HLERequestContext& ctx) {
@ -178,7 +178,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDisplayController>(); rb.PushIpcInterface<IDisplayController>(system);
} }
void GetDebugFunctions(Kernel::HLERequestContext& ctx) { void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
@ -186,7 +186,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDebugFunctions>(); rb.PushIpcInterface<IDebugFunctions>(system);
} }
void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
@ -202,7 +202,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IHomeMenuFunctions>(system.Kernel()); rb.PushIpcInterface<IHomeMenuFunctions>(system);
} }
void GetGlobalStateController(Kernel::HLERequestContext& ctx) { void GetGlobalStateController(Kernel::HLERequestContext& ctx) {
@ -210,7 +210,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IGlobalStateController>(); rb.PushIpcInterface<IGlobalStateController>(system);
} }
void GetApplicationCreator(Kernel::HLERequestContext& ctx) { void GetApplicationCreator(Kernel::HLERequestContext& ctx) {
@ -218,12 +218,11 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IApplicationCreator>(); rb.PushIpcInterface<IApplicationCreator>(system);
} }
NVFlinger::NVFlinger& nvflinger; NVFlinger::NVFlinger& nvflinger;
std::shared_ptr<AppletMessageQueue> msg_queue; std::shared_ptr<AppletMessageQueue> msg_queue;
Core::System& system;
}; };
void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) { void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) {
@ -250,10 +249,10 @@ void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) {
rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system); rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system);
} }
AppletAE::AppletAE(NVFlinger::NVFlinger& nvflinger, std::shared_ptr<AppletMessageQueue> msg_queue, AppletAE::AppletAE(NVFlinger::NVFlinger& nvflinger_, std::shared_ptr<AppletMessageQueue> msg_queue_,
Core::System& system) Core::System& system_)
: ServiceFramework("appletAE"), nvflinger(nvflinger), msg_queue(std::move(msg_queue)), : ServiceFramework{system_, "appletAE"}, nvflinger{nvflinger_}, msg_queue{
system(system) { std::move(msg_queue_)} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"}, {100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"},

View File

@ -23,8 +23,8 @@ class AppletMessageQueue;
class AppletAE final : public ServiceFramework<AppletAE> { class AppletAE final : public ServiceFramework<AppletAE> {
public: public:
explicit AppletAE(NVFlinger::NVFlinger& nvflinger, explicit AppletAE(NVFlinger::NVFlinger& nvflinger_,
std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system); std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_);
~AppletAE() override; ~AppletAE() override;
const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const; const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const;
@ -36,7 +36,6 @@ private:
NVFlinger::NVFlinger& nvflinger; NVFlinger::NVFlinger& nvflinger;
std::shared_ptr<AppletMessageQueue> msg_queue; std::shared_ptr<AppletMessageQueue> msg_queue;
Core::System& system;
}; };
} // namespace AM } // namespace AM

View File

@ -12,10 +12,11 @@ namespace Service::AM {
class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { class IApplicationProxy final : public ServiceFramework<IApplicationProxy> {
public: public:
explicit IApplicationProxy(NVFlinger::NVFlinger& nvflinger, explicit IApplicationProxy(NVFlinger::NVFlinger& nvflinger_,
std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system) std::shared_ptr<AppletMessageQueue> msg_queue_,
: ServiceFramework("IApplicationProxy"), nvflinger(nvflinger), Core::System& system_)
msg_queue(std::move(msg_queue)), system(system) { : ServiceFramework{system_, "IApplicationProxy"}, nvflinger{nvflinger_},
msg_queue{std::move(msg_queue_)} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"}, {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"},
@ -39,7 +40,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IAudioController>(); rb.PushIpcInterface<IAudioController>(system);
} }
void GetDisplayController(Kernel::HLERequestContext& ctx) { void GetDisplayController(Kernel::HLERequestContext& ctx) {
@ -47,7 +48,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDisplayController>(); rb.PushIpcInterface<IDisplayController>(system);
} }
void GetDebugFunctions(Kernel::HLERequestContext& ctx) { void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
@ -55,7 +56,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDebugFunctions>(); rb.PushIpcInterface<IDebugFunctions>(system);
} }
void GetWindowController(Kernel::HLERequestContext& ctx) { void GetWindowController(Kernel::HLERequestContext& ctx) {
@ -100,7 +101,6 @@ private:
NVFlinger::NVFlinger& nvflinger; NVFlinger::NVFlinger& nvflinger;
std::shared_ptr<AppletMessageQueue> msg_queue; std::shared_ptr<AppletMessageQueue> msg_queue;
Core::System& system;
}; };
void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) { void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) {
@ -111,10 +111,10 @@ void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) {
rb.PushIpcInterface<IApplicationProxy>(nvflinger, msg_queue, system); rb.PushIpcInterface<IApplicationProxy>(nvflinger, msg_queue, system);
} }
AppletOE::AppletOE(NVFlinger::NVFlinger& nvflinger, std::shared_ptr<AppletMessageQueue> msg_queue, AppletOE::AppletOE(NVFlinger::NVFlinger& nvflinger_, std::shared_ptr<AppletMessageQueue> msg_queue_,
Core::System& system) Core::System& system_)
: ServiceFramework("appletOE"), nvflinger(nvflinger), msg_queue(std::move(msg_queue)), : ServiceFramework{system_, "appletOE"}, nvflinger{nvflinger_}, msg_queue{
system(system) { std::move(msg_queue_)} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"}, {0, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"},
}; };

View File

@ -23,8 +23,8 @@ class AppletMessageQueue;
class AppletOE final : public ServiceFramework<AppletOE> { class AppletOE final : public ServiceFramework<AppletOE> {
public: public:
explicit AppletOE(NVFlinger::NVFlinger& nvflinger, explicit AppletOE(NVFlinger::NVFlinger& nvflinger_,
std::shared_ptr<AppletMessageQueue> msg_queue, Core::System& system); std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_);
~AppletOE() override; ~AppletOE() override;
const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const; const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const;
@ -34,7 +34,6 @@ private:
NVFlinger::NVFlinger& nvflinger; NVFlinger::NVFlinger& nvflinger;
std::shared_ptr<AppletMessageQueue> msg_queue; std::shared_ptr<AppletMessageQueue> msg_queue;
Core::System& system;
}; };
} // namespace AM } // namespace AM

View File

@ -46,7 +46,7 @@ static Core::Frontend::ControllerParameters ConvertToFrontendParameters(
} }
Controller::Controller(Core::System& system_, const Core::Frontend::ControllerApplet& frontend_) Controller::Controller(Core::System& system_, const Core::Frontend::ControllerApplet& frontend_)
: Applet{system_.Kernel()}, frontend(frontend_) {} : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
Controller::~Controller() = default; Controller::~Controller() = default;
@ -245,7 +245,7 @@ void Controller::ConfigurationComplete() {
complete = true; complete = true;
out_data = std::vector<u8>(sizeof(ControllerSupportResultInfo)); out_data = std::vector<u8>(sizeof(ControllerSupportResultInfo));
std::memcpy(out_data.data(), &result_info, out_data.size()); std::memcpy(out_data.data(), &result_info, out_data.size());
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(out_data))); broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(out_data)));
broker.SignalStateChanged(); broker.SignalStateChanged();
} }

View File

@ -120,6 +120,7 @@ public:
private: private:
const Core::Frontend::ControllerApplet& frontend; const Core::Frontend::ControllerApplet& frontend;
Core::System& system;
ControllerAppletVersion controller_applet_version; ControllerAppletVersion controller_applet_version;
ControllerSupportArgPrivate controller_private_arg; ControllerSupportArgPrivate controller_private_arg;

View File

@ -87,7 +87,7 @@ ResultCode Decode64BitError(u64 error) {
} // Anonymous namespace } // Anonymous namespace
Error::Error(Core::System& system_, const Core::Frontend::ErrorApplet& frontend_) Error::Error(Core::System& system_, const Core::Frontend::ErrorApplet& frontend_)
: Applet{system_.Kernel()}, frontend(frontend_), system{system_} {} : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
Error::~Error() = default; Error::~Error() = default;
@ -186,7 +186,7 @@ void Error::Execute() {
void Error::DisplayCompleted() { void Error::DisplayCompleted() {
complete = true; complete = true;
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::vector<u8>{})); broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::vector<u8>{}));
broker.SignalStateChanged(); broker.SignalStateChanged();
} }

View File

@ -38,7 +38,7 @@ static void LogCurrentStorage(AppletDataBroker& broker, std::string_view prefix)
} }
Auth::Auth(Core::System& system_, Core::Frontend::ParentalControlsApplet& frontend_) Auth::Auth(Core::System& system_, Core::Frontend::ParentalControlsApplet& frontend_)
: Applet{system_.Kernel()}, frontend(frontend_) {} : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
Auth::~Auth() = default; Auth::~Auth() = default;
@ -135,8 +135,8 @@ void Auth::Execute() {
} }
} }
void Auth::AuthFinished(bool successful) { void Auth::AuthFinished(bool is_successful) {
this->successful = successful; this->successful = is_successful;
struct Return { struct Return {
ResultCode result_code; ResultCode result_code;
@ -148,12 +148,12 @@ void Auth::AuthFinished(bool successful) {
std::vector<u8> out(sizeof(Return)); std::vector<u8> out(sizeof(Return));
std::memcpy(out.data(), &return_, sizeof(Return)); std::memcpy(out.data(), &return_, sizeof(Return));
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(out))); broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(out)));
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
PhotoViewer::PhotoViewer(Core::System& system_, const Core::Frontend::PhotoViewerApplet& frontend_) PhotoViewer::PhotoViewer(Core::System& system_, const Core::Frontend::PhotoViewerApplet& frontend_)
: Applet{system_.Kernel()}, frontend(frontend_), system{system_} {} : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
PhotoViewer::~PhotoViewer() = default; PhotoViewer::~PhotoViewer() = default;
@ -198,12 +198,12 @@ void PhotoViewer::Execute() {
} }
void PhotoViewer::ViewFinished() { void PhotoViewer::ViewFinished() {
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::vector<u8>{})); broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::vector<u8>{}));
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
StubApplet::StubApplet(Core::System& system_, AppletId id_) StubApplet::StubApplet(Core::System& system_, AppletId id_)
: Applet{system_.Kernel()}, id(id_), system{system_} {} : Applet{system_.Kernel()}, id{id_}, system{system_} {}
StubApplet::~StubApplet() = default; StubApplet::~StubApplet() = default;
@ -234,8 +234,9 @@ void StubApplet::ExecuteInteractive() {
LOG_WARNING(Service_AM, "called (STUBBED)"); LOG_WARNING(Service_AM, "called (STUBBED)");
LogCurrentStorage(broker, "ExecuteInteractive"); LogCurrentStorage(broker, "ExecuteInteractive");
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::vector<u8>(0x1000))); broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::vector<u8>(0x1000)));
broker.PushInteractiveDataFromApplet(std::make_shared<IStorage>(std::vector<u8>(0x1000))); broker.PushInteractiveDataFromApplet(
std::make_shared<IStorage>(system, std::vector<u8>(0x1000)));
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
@ -243,8 +244,9 @@ void StubApplet::Execute() {
LOG_WARNING(Service_AM, "called (STUBBED)"); LOG_WARNING(Service_AM, "called (STUBBED)");
LogCurrentStorage(broker, "Execute"); LogCurrentStorage(broker, "Execute");
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::vector<u8>(0x1000))); broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::vector<u8>(0x1000)));
broker.PushInteractiveDataFromApplet(std::make_shared<IStorage>(std::vector<u8>(0x1000))); broker.PushInteractiveDataFromApplet(
std::make_shared<IStorage>(system, std::vector<u8>(0x1000)));
broker.SignalStateChanged(); broker.SignalStateChanged();
} }

View File

@ -29,10 +29,11 @@ public:
void ExecuteInteractive() override; void ExecuteInteractive() override;
void Execute() override; void Execute() override;
void AuthFinished(bool successful = true); void AuthFinished(bool is_successful = true);
private: private:
Core::Frontend::ParentalControlsApplet& frontend; Core::Frontend::ParentalControlsApplet& frontend;
Core::System& system;
bool complete = false; bool complete = false;
bool successful = false; bool successful = false;

View File

@ -17,7 +17,7 @@ constexpr ResultCode ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1};
ProfileSelect::ProfileSelect(Core::System& system_, ProfileSelect::ProfileSelect(Core::System& system_,
const Core::Frontend::ProfileSelectApplet& frontend_) const Core::Frontend::ProfileSelectApplet& frontend_)
: Applet{system_.Kernel()}, frontend(frontend_) {} : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
ProfileSelect::~ProfileSelect() = default; ProfileSelect::~ProfileSelect() = default;
@ -50,7 +50,7 @@ void ProfileSelect::ExecuteInteractive() {
void ProfileSelect::Execute() { void ProfileSelect::Execute() {
if (complete) { if (complete) {
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(final_data))); broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(final_data)));
return; return;
} }
@ -71,7 +71,7 @@ void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) {
final_data = std::vector<u8>(sizeof(UserSelectionOutput)); final_data = std::vector<u8>(sizeof(UserSelectionOutput));
std::memcpy(final_data.data(), &output, final_data.size()); std::memcpy(final_data.data(), &output, final_data.size());
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(final_data))); broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(final_data)));
broker.SignalStateChanged(); broker.SignalStateChanged();
} }

View File

@ -53,6 +53,7 @@ private:
bool complete = false; bool complete = false;
ResultCode status = RESULT_SUCCESS; ResultCode status = RESULT_SUCCESS;
std::vector<u8> final_data; std::vector<u8> final_data;
Core::System& system;
}; };
} // namespace Service::AM::Applets } // namespace Service::AM::Applets

View File

@ -53,7 +53,7 @@ static Core::Frontend::SoftwareKeyboardParameters ConvertToFrontendParameters(
SoftwareKeyboard::SoftwareKeyboard(Core::System& system_, SoftwareKeyboard::SoftwareKeyboard(Core::System& system_,
const Core::Frontend::SoftwareKeyboardApplet& frontend_) const Core::Frontend::SoftwareKeyboardApplet& frontend_)
: Applet{system_.Kernel()}, frontend(frontend_) {} : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
SoftwareKeyboard::~SoftwareKeyboard() = default; SoftwareKeyboard::~SoftwareKeyboard() = default;
@ -122,7 +122,7 @@ void SoftwareKeyboard::ExecuteInteractive() {
switch (request) { switch (request) {
case Request::Calc: { case Request::Calc: {
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::vector<u8>{1})); broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::vector<u8>{1}));
broker.SignalStateChanged(); broker.SignalStateChanged();
break; break;
} }
@ -135,7 +135,7 @@ void SoftwareKeyboard::ExecuteInteractive() {
void SoftwareKeyboard::Execute() { void SoftwareKeyboard::Execute() {
if (complete) { if (complete) {
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(final_data))); broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(final_data)));
broker.SignalStateChanged(); broker.SignalStateChanged();
return; return;
} }
@ -179,15 +179,17 @@ void SoftwareKeyboard::WriteText(std::optional<std::u16string> text) {
final_data = output_main; final_data = output_main;
if (complete) { if (complete) {
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(output_main))); broker.PushNormalDataFromApplet(
std::make_shared<IStorage>(system, std::move(output_main)));
broker.SignalStateChanged(); broker.SignalStateChanged();
} else { } else {
broker.PushInteractiveDataFromApplet(std::make_shared<IStorage>(std::move(output_sub))); broker.PushInteractiveDataFromApplet(
std::make_shared<IStorage>(system, std::move(output_sub)));
} }
} else { } else {
output_main[0] = 1; output_main[0] = 1;
complete = true; complete = true;
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(output_main))); broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(output_main)));
broker.SignalStateChanged(); broker.SignalStateChanged();
} }
} }

View File

@ -80,6 +80,7 @@ private:
bool complete = false; bool complete = false;
bool is_inline = false; bool is_inline = false;
std::vector<u8> final_data; std::vector<u8> final_data;
Core::System& system;
}; };
} // namespace Service::AM::Applets } // namespace Service::AM::Applets

View File

@ -290,7 +290,7 @@ void WebBrowser::Finalize() {
std::vector<u8> data(sizeof(WebCommonReturnValue)); std::vector<u8> data(sizeof(WebCommonReturnValue));
std::memcpy(data.data(), &out, sizeof(WebCommonReturnValue)); std::memcpy(data.data(), &out, sizeof(WebCommonReturnValue));
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(std::move(data))); broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(data)));
broker.SignalStateChanged(); broker.SignalStateChanged();
if (!temporary_dir.empty() && Common::FS::IsDirectory(temporary_dir)) { if (!temporary_dir.empty() && Common::FS::IsDirectory(temporary_dir)) {

View File

@ -6,7 +6,7 @@
namespace Service::AM { namespace Service::AM {
IdleSys::IdleSys() : ServiceFramework{"idle:sys"} { IdleSys::IdleSys(Core::System& system_) : ServiceFramework{system_, "idle:sys"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetAutoPowerDownEvent"}, {0, nullptr, "GetAutoPowerDownEvent"},

View File

@ -6,11 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::AM { namespace Service::AM {
class IdleSys final : public ServiceFramework<IdleSys> { class IdleSys final : public ServiceFramework<IdleSys> {
public: public:
explicit IdleSys(); explicit IdleSys(Core::System& system_);
~IdleSys() override; ~IdleSys() override;
}; };

View File

@ -6,7 +6,7 @@
namespace Service::AM { namespace Service::AM {
OMM::OMM() : ServiceFramework{"omm"} { OMM::OMM(Core::System& system_) : ServiceFramework{system_, "omm"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetOperationMode"}, {0, nullptr, "GetOperationMode"},

View File

@ -6,11 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::AM { namespace Service::AM {
class OMM final : public ServiceFramework<OMM> { class OMM final : public ServiceFramework<OMM> {
public: public:
explicit OMM(); explicit OMM(Core::System& system_);
~OMM() override; ~OMM() override;
}; };

View File

@ -6,7 +6,7 @@
namespace Service::AM { namespace Service::AM {
SPSM::SPSM() : ServiceFramework{"spsm"} { SPSM::SPSM(Core::System& system_) : ServiceFramework{system_, "spsm"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetState"}, {0, nullptr, "GetState"},

View File

@ -6,11 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::AM { namespace Service::AM {
class SPSM final : public ServiceFramework<SPSM> { class SPSM final : public ServiceFramework<SPSM> {
public: public:
explicit SPSM(); explicit SPSM(Core::System& system_);
~SPSM() override; ~SPSM() override;
}; };

View File

@ -6,7 +6,7 @@
namespace Service::AM { namespace Service::AM {
TCAP::TCAP() : ServiceFramework{"tcap"} { TCAP::TCAP(Core::System& system_) : ServiceFramework{system_, "tcap"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetContinuousHighSkinTemperatureEvent"}, {0, nullptr, "GetContinuousHighSkinTemperatureEvent"},

View File

@ -6,11 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::AM { namespace Service::AM {
class TCAP final : public ServiceFramework<TCAP> { class TCAP final : public ServiceFramework<TCAP> {
public: public:
explicit TCAP(); explicit TCAP(Core::System& system_);
~TCAP() override; ~TCAP() override;
}; };

View File

@ -48,8 +48,8 @@ static std::vector<u64> AccumulateAOCTitleIDs(Core::System& system) {
return add_on_content; return add_on_content;
} }
AOC_U::AOC_U(Core::System& system) AOC_U::AOC_U(Core::System& system_)
: ServiceFramework("aoc:u"), add_on_content(AccumulateAOCTitleIDs(system)), system(system) { : ServiceFramework{system_, "aoc:u"}, add_on_content{AccumulateAOCTitleIDs(system)} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "CountAddOnContentByApplicationId"}, {0, nullptr, "CountAddOnContentByApplicationId"},

View File

@ -6,6 +6,10 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Kernel { namespace Kernel {
class WritableEvent; class WritableEvent;
} }
@ -26,7 +30,6 @@ private:
std::vector<u64> add_on_content; std::vector<u64> add_on_content;
Kernel::EventPair aoc_change_event; Kernel::EventPair aoc_change_event;
Core::System& system;
}; };
/// Registers all AOC services with the specified service manager. /// Registers all AOC services with the specified service manager.

View File

@ -14,13 +14,14 @@ Module::~Module() = default;
void InstallInterfaces(Core::System& system) { void InstallInterfaces(Core::System& system) {
auto module_ = std::make_shared<Module>(); auto module_ = std::make_shared<Module>();
std::make_shared<APM>(module_, system.GetAPMController(), "apm") std::make_shared<APM>(system, module_, system.GetAPMController(), "apm")
->InstallAsService(system.ServiceManager()); ->InstallAsService(system.ServiceManager());
std::make_shared<APM>(module_, system.GetAPMController(), "apm:p") std::make_shared<APM>(system, module_, system.GetAPMController(), "apm:p")
->InstallAsService(system.ServiceManager()); ->InstallAsService(system.ServiceManager());
std::make_shared<APM>(module_, system.GetAPMController(), "apm:am") std::make_shared<APM>(system, module_, system.GetAPMController(), "apm:am")
->InstallAsService(system.ServiceManager());
std::make_shared<APM_Sys>(system, system.GetAPMController())
->InstallAsService(system.ServiceManager()); ->InstallAsService(system.ServiceManager());
std::make_shared<APM_Sys>(system.GetAPMController())->InstallAsService(system.ServiceManager());
} }
} // namespace Service::APM } // namespace Service::APM

View File

@ -4,7 +4,9 @@
#pragma once #pragma once
#include "core/hle/service/service.h" namespace Core {
class System;
}
namespace Service::APM { namespace Service::APM {

View File

@ -12,7 +12,8 @@ namespace Service::APM {
class ISession final : public ServiceFramework<ISession> { class ISession final : public ServiceFramework<ISession> {
public: public:
ISession(Controller& controller) : ServiceFramework("ISession"), controller(controller) { explicit ISession(Core::System& system_, Controller& controller_)
: ServiceFramework{system_, "ISession"}, controller{controller_} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"}, {0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"},
{1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"}, {1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"},
@ -50,8 +51,9 @@ private:
Controller& controller; Controller& controller;
}; };
APM::APM(std::shared_ptr<Module> apm, Controller& controller, const char* name) APM::APM(Core::System& system_, std::shared_ptr<Module> apm_, Controller& controller_,
: ServiceFramework(name), apm(std::move(apm)), controller(controller) { const char* name)
: ServiceFramework{system_, name}, apm(std::move(apm_)), controller{controller_} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &APM::OpenSession, "OpenSession"}, {0, &APM::OpenSession, "OpenSession"},
{1, &APM::GetPerformanceMode, "GetPerformanceMode"}, {1, &APM::GetPerformanceMode, "GetPerformanceMode"},
@ -67,7 +69,7 @@ void APM::OpenSession(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISession>(controller); rb.PushIpcInterface<ISession>(system, controller);
} }
void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) { void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
@ -77,7 +79,8 @@ void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
rb.PushEnum(controller.GetCurrentPerformanceMode()); rb.PushEnum(controller.GetCurrentPerformanceMode());
} }
APM_Sys::APM_Sys(Controller& controller) : ServiceFramework{"apm:sys"}, controller(controller) { APM_Sys::APM_Sys(Core::System& system_, Controller& controller_)
: ServiceFramework{system_, "apm:sys"}, controller{controller_} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "RequestPerformanceMode"}, {0, nullptr, "RequestPerformanceMode"},
@ -101,7 +104,7 @@ void APM_Sys::GetPerformanceEvent(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISession>(controller); rb.PushIpcInterface<ISession>(system, controller);
} }
void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) { void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) {

View File

@ -13,7 +13,8 @@ class Module;
class APM final : public ServiceFramework<APM> { class APM final : public ServiceFramework<APM> {
public: public:
explicit APM(std::shared_ptr<Module> apm, Controller& controller, const char* name); explicit APM(Core::System& system_, std::shared_ptr<Module> apm_, Controller& controller_,
const char* name);
~APM() override; ~APM() override;
private: private:
@ -26,7 +27,7 @@ private:
class APM_Sys final : public ServiceFramework<APM_Sys> { class APM_Sys final : public ServiceFramework<APM_Sys> {
public: public:
explicit APM_Sys(Controller& controller); explicit APM_Sys(Core::System& system_, Controller& controller);
~APM_Sys() override; ~APM_Sys() override;
void SetCpuBoostMode(Kernel::HLERequestContext& ctx); void SetCpuBoostMode(Kernel::HLERequestContext& ctx);

View File

@ -8,7 +8,7 @@
namespace Service::Audio { namespace Service::Audio {
AudCtl::AudCtl() : ServiceFramework{"audctl"} { AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetTargetVolume"}, {0, nullptr, "GetTargetVolume"},

View File

@ -6,11 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::Audio { namespace Service::Audio {
class AudCtl final : public ServiceFramework<AudCtl> { class AudCtl final : public ServiceFramework<AudCtl> {
public: public:
explicit AudCtl(); explicit AudCtl(Core::System& system_);
~AudCtl() override; ~AudCtl() override;
private: private:

View File

@ -6,7 +6,7 @@
namespace Service::Audio { namespace Service::Audio {
AudDbg::AudDbg(const char* name) : ServiceFramework{name} { AudDbg::AudDbg(Core::System& system_, const char* name) : ServiceFramework{system_, name} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "RequestSuspendForDebug"}, {0, nullptr, "RequestSuspendForDebug"},

View File

@ -6,11 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::Audio { namespace Service::Audio {
class AudDbg final : public ServiceFramework<AudDbg> { class AudDbg final : public ServiceFramework<AudDbg> {
public: public:
explicit AudDbg(const char* name); explicit AudDbg(Core::System& system_, const char* name);
~AudDbg() override; ~AudDbg() override;
}; };

View File

@ -6,7 +6,7 @@
namespace Service::Audio { namespace Service::Audio {
AudInA::AudInA() : ServiceFramework{"audin:a"} { AudInA::AudInA(Core::System& system_) : ServiceFramework{system_, "audin:a"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "RequestSuspendAudioIns"}, {0, nullptr, "RequestSuspendAudioIns"},

View File

@ -6,11 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::Audio { namespace Service::Audio {
class AudInA final : public ServiceFramework<AudInA> { class AudInA final : public ServiceFramework<AudInA> {
public: public:
explicit AudInA(); explicit AudInA(Core::System& system_);
~AudInA() override; ~AudInA() override;
}; };

View File

@ -11,7 +11,7 @@ namespace Service::Audio {
class IAudioIn final : public ServiceFramework<IAudioIn> { class IAudioIn final : public ServiceFramework<IAudioIn> {
public: public:
IAudioIn() : ServiceFramework("IAudioIn") { explicit IAudioIn(Core::System& system_) : ServiceFramework{system_, "IAudioIn"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetAudioInState"}, {0, nullptr, "GetAudioInState"},
@ -36,7 +36,7 @@ public:
} }
}; };
AudInU::AudInU() : ServiceFramework("audin:u") { AudInU::AudInU(Core::System& system_) : ServiceFramework{system_, "audin:u"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &AudInU::ListAudioIns, "ListAudioIns"}, {0, &AudInU::ListAudioIns, "ListAudioIns"},
@ -96,7 +96,7 @@ void AudInU::OpenInOutImpl(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 6, 0, 1}; IPC::ResponseBuilder rb{ctx, 6, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushRaw<AudInOutParams>(params); rb.PushRaw<AudInOutParams>(params);
rb.PushIpcInterface<IAudioIn>(); rb.PushIpcInterface<IAudioIn>(system);
} }
void AudInU::OpenAudioIn(Kernel::HLERequestContext& ctx) { void AudInU::OpenAudioIn(Kernel::HLERequestContext& ctx) {

View File

@ -6,6 +6,10 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Kernel { namespace Kernel {
class HLERequestContext; class HLERequestContext;
} }
@ -14,7 +18,7 @@ namespace Service::Audio {
class AudInU final : public ServiceFramework<AudInU> { class AudInU final : public ServiceFramework<AudInU> {
public: public:
explicit AudInU(); explicit AudInU(Core::System& system_);
~AudInU() override; ~AudInU() override;
private: private:

View File

@ -20,22 +20,22 @@
namespace Service::Audio { namespace Service::Audio {
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
std::make_shared<AudCtl>()->InstallAsService(service_manager); std::make_shared<AudCtl>(system)->InstallAsService(service_manager);
std::make_shared<AudOutA>()->InstallAsService(service_manager); std::make_shared<AudOutA>(system)->InstallAsService(service_manager);
std::make_shared<AudOutU>(system)->InstallAsService(service_manager); std::make_shared<AudOutU>(system)->InstallAsService(service_manager);
std::make_shared<AudInA>()->InstallAsService(service_manager); std::make_shared<AudInA>(system)->InstallAsService(service_manager);
std::make_shared<AudInU>()->InstallAsService(service_manager); std::make_shared<AudInU>(system)->InstallAsService(service_manager);
std::make_shared<AudRecA>()->InstallAsService(service_manager); std::make_shared<AudRecA>(system)->InstallAsService(service_manager);
std::make_shared<AudRecU>()->InstallAsService(service_manager); std::make_shared<AudRecU>(system)->InstallAsService(service_manager);
std::make_shared<AudRenA>()->InstallAsService(service_manager); std::make_shared<AudRenA>(system)->InstallAsService(service_manager);
std::make_shared<AudRenU>(system)->InstallAsService(service_manager); std::make_shared<AudRenU>(system)->InstallAsService(service_manager);
std::make_shared<CodecCtl>()->InstallAsService(service_manager); std::make_shared<CodecCtl>(system)->InstallAsService(service_manager);
std::make_shared<HwOpus>()->InstallAsService(service_manager); std::make_shared<HwOpus>(system)->InstallAsService(service_manager);
std::make_shared<AudDbg>("audin:d")->InstallAsService(service_manager); std::make_shared<AudDbg>(system, "audin:d")->InstallAsService(service_manager);
std::make_shared<AudDbg>("audout:d")->InstallAsService(service_manager); std::make_shared<AudDbg>(system, "audout:d")->InstallAsService(service_manager);
std::make_shared<AudDbg>("audrec:d")->InstallAsService(service_manager); std::make_shared<AudDbg>(system, "audrec:d")->InstallAsService(service_manager);
std::make_shared<AudDbg>("audren:d")->InstallAsService(service_manager); std::make_shared<AudDbg>(system, "audren:d")->InstallAsService(service_manager);
} }
} // namespace Service::Audio } // namespace Service::Audio

View File

@ -6,7 +6,7 @@
namespace Service::Audio { namespace Service::Audio {
AudOutA::AudOutA() : ServiceFramework{"audout:a"} { AudOutA::AudOutA(Core::System& system_) : ServiceFramework{system_, "audout:a"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "RequestSuspendAudioOuts"}, {0, nullptr, "RequestSuspendAudioOuts"},

View File

@ -6,11 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::Audio { namespace Service::Audio {
class AudOutA final : public ServiceFramework<AudOutA> { class AudOutA final : public ServiceFramework<AudOutA> {
public: public:
explicit AudOutA(); explicit AudOutA(Core::System& system_);
~AudOutA() override; ~AudOutA() override;
}; };

View File

@ -40,11 +40,11 @@ enum class AudioState : u32 {
class IAudioOut final : public ServiceFramework<IAudioOut> { class IAudioOut final : public ServiceFramework<IAudioOut> {
public: public:
IAudioOut(Core::System& system, AudoutParams audio_params, AudioCore::AudioOut& audio_core, IAudioOut(Core::System& system_, AudoutParams audio_params_, AudioCore::AudioOut& audio_core_,
std::string&& device_name, std::string&& unique_name) std::string&& device_name_, std::string&& unique_name)
: ServiceFramework("IAudioOut"), audio_core(audio_core), : ServiceFramework{system_, "IAudioOut"}, audio_core{audio_core_},
device_name(std::move(device_name)), device_name{std::move(device_name_)}, audio_params{audio_params_}, main_memory{
audio_params(audio_params), main_memory{system.Memory()} { system.Memory()} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IAudioOut::GetAudioOutState, "GetAudioOutState"}, {0, &IAudioOut::GetAudioOutState, "GetAudioOutState"},
@ -213,7 +213,7 @@ private:
Core::Memory::Memory& main_memory; Core::Memory::Memory& main_memory;
}; };
AudOutU::AudOutU(Core::System& system_) : ServiceFramework("audout:u"), system{system_} { AudOutU::AudOutU(Core::System& system_) : ServiceFramework{system_, "audout:u"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &AudOutU::ListAudioOutsImpl, "ListAudioOuts"}, {0, &AudOutU::ListAudioOutsImpl, "ListAudioOuts"},

View File

@ -34,8 +34,6 @@ private:
std::vector<std::shared_ptr<IAudioOut>> audio_out_interfaces; std::vector<std::shared_ptr<IAudioOut>> audio_out_interfaces;
std::unique_ptr<AudioCore::AudioOut> audio_core; std::unique_ptr<AudioCore::AudioOut> audio_core;
Core::System& system;
}; };
} // namespace Service::Audio } // namespace Service::Audio

View File

@ -6,7 +6,7 @@
namespace Service::Audio { namespace Service::Audio {
AudRecA::AudRecA() : ServiceFramework{"audrec:a"} { AudRecA::AudRecA(Core::System& system_) : ServiceFramework{system_, "audrec:a"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "RequestSuspendFinalOutputRecorders"}, {0, nullptr, "RequestSuspendFinalOutputRecorders"},

View File

@ -6,11 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::Audio { namespace Service::Audio {
class AudRecA final : public ServiceFramework<AudRecA> { class AudRecA final : public ServiceFramework<AudRecA> {
public: public:
explicit AudRecA(); explicit AudRecA(Core::System& system_);
~AudRecA() override; ~AudRecA() override;
}; };

View File

@ -8,7 +8,8 @@ namespace Service::Audio {
class IFinalOutputRecorder final : public ServiceFramework<IFinalOutputRecorder> { class IFinalOutputRecorder final : public ServiceFramework<IFinalOutputRecorder> {
public: public:
IFinalOutputRecorder() : ServiceFramework("IFinalOutputRecorder") { explicit IFinalOutputRecorder(Core::System& system_)
: ServiceFramework{system_, "IFinalOutputRecorder"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetFinalOutputRecorderState"}, {0, nullptr, "GetFinalOutputRecorderState"},
@ -29,7 +30,7 @@ public:
} }
}; };
AudRecU::AudRecU() : ServiceFramework("audrec:u") { AudRecU::AudRecU(Core::System& system_) : ServiceFramework{system_, "audrec:u"} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "OpenFinalOutputRecorder"}, {0, nullptr, "OpenFinalOutputRecorder"},
}; };

View File

@ -6,15 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Kernel { namespace Core {
class HLERequestContext; class System;
} }
namespace Service::Audio { namespace Service::Audio {
class AudRecU final : public ServiceFramework<AudRecU> { class AudRecU final : public ServiceFramework<AudRecU> {
public: public:
explicit AudRecU(); explicit AudRecU(Core::System& system_);
~AudRecU() override; ~AudRecU() override;
}; };

View File

@ -6,7 +6,7 @@
namespace Service::Audio { namespace Service::Audio {
AudRenA::AudRenA() : ServiceFramework{"audren:a"} { AudRenA::AudRenA(Core::System& system_) : ServiceFramework{system_, "audren:a"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "RequestSuspendAudioRenderers"}, {0, nullptr, "RequestSuspendAudioRenderers"},

View File

@ -6,11 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::Audio { namespace Service::Audio {
class AudRenA final : public ServiceFramework<AudRenA> { class AudRenA final : public ServiceFramework<AudRenA> {
public: public:
explicit AudRenA(); explicit AudRenA(Core::System& system_);
~AudRenA() override; ~AudRenA() override;
}; };

View File

@ -28,7 +28,7 @@ class IAudioRenderer final : public ServiceFramework<IAudioRenderer> {
public: public:
explicit IAudioRenderer(Core::System& system, AudioCommon::AudioRendererParameter audren_params, explicit IAudioRenderer(Core::System& system, AudioCommon::AudioRendererParameter audren_params,
const std::size_t instance_number) const std::size_t instance_number)
: ServiceFramework("IAudioRenderer") { : ServiceFramework{system, "IAudioRenderer"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IAudioRenderer::GetSampleRate, "GetSampleRate"}, {0, &IAudioRenderer::GetSampleRate, "GetSampleRate"},
@ -167,8 +167,8 @@ private:
class IAudioDevice final : public ServiceFramework<IAudioDevice> { class IAudioDevice final : public ServiceFramework<IAudioDevice> {
public: public:
explicit IAudioDevice(Core::System& system, u32_le revision_num) explicit IAudioDevice(Core::System& system_, u32_le revision_num)
: ServiceFramework("IAudioDevice"), revision{revision_num} { : ServiceFramework{system_, "IAudioDevice"}, revision{revision_num} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"}, {0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"},
{1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"}, {1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"},
@ -325,7 +325,7 @@ private:
}; // namespace Audio }; // namespace Audio
AudRenU::AudRenU(Core::System& system_) : ServiceFramework("audren:u"), system{system_} { AudRenU::AudRenU(Core::System& system_) : ServiceFramework{system_, "audren:u"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &AudRenU::OpenAudioRenderer, "OpenAudioRenderer"}, {0, &AudRenU::OpenAudioRenderer, "OpenAudioRenderer"},

View File

@ -31,7 +31,6 @@ private:
void OpenAudioRendererImpl(Kernel::HLERequestContext& ctx); void OpenAudioRendererImpl(Kernel::HLERequestContext& ctx);
std::size_t audren_instance_count = 0; std::size_t audren_instance_count = 0;
Core::System& system;
}; };
// Describes a particular audio feature that may be supported in a particular revision. // Describes a particular audio feature that may be supported in a particular revision.

View File

@ -2,14 +2,11 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/logging/log.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/service/audio/codecctl.h" #include "core/hle/service/audio/codecctl.h"
namespace Service::Audio { namespace Service::Audio {
CodecCtl::CodecCtl() : ServiceFramework("codecctl") { CodecCtl::CodecCtl(Core::System& system_) : ServiceFramework{system_, "codecctl"} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "InitializeCodecController"}, {0, nullptr, "InitializeCodecController"},
{1, nullptr, "FinalizeCodecController"}, {1, nullptr, "FinalizeCodecController"},

View File

@ -6,15 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Kernel { namespace Core {
class HLERequestContext; class System;
} }
namespace Service::Audio { namespace Service::Audio {
class CodecCtl final : public ServiceFramework<CodecCtl> { class CodecCtl final : public ServiceFramework<CodecCtl> {
public: public:
explicit CodecCtl(); explicit CodecCtl(Core::System& system_);
~CodecCtl() override; ~CodecCtl() override;
}; };

View File

@ -160,8 +160,9 @@ private:
class IHardwareOpusDecoderManager final : public ServiceFramework<IHardwareOpusDecoderManager> { class IHardwareOpusDecoderManager final : public ServiceFramework<IHardwareOpusDecoderManager> {
public: public:
explicit IHardwareOpusDecoderManager(OpusDecoderState decoder_state) explicit IHardwareOpusDecoderManager(Core::System& system_, OpusDecoderState decoder_state)
: ServiceFramework("IHardwareOpusDecoderManager"), decoder_state{std::move(decoder_state)} { : ServiceFramework{system_, "IHardwareOpusDecoderManager"}, decoder_state{
std::move(decoder_state)} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IHardwareOpusDecoderManager::DecodeInterleavedOld, "DecodeInterleavedOld"}, {0, &IHardwareOpusDecoderManager::DecodeInterleavedOld, "DecodeInterleavedOld"},
@ -287,10 +288,10 @@ void HwOpus::OpenOpusDecoder(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IHardwareOpusDecoderManager>( rb.PushIpcInterface<IHardwareOpusDecoderManager>(
OpusDecoderState{std::move(decoder), sample_rate, channel_count}); system, OpusDecoderState{std::move(decoder), sample_rate, channel_count});
} }
HwOpus::HwOpus() : ServiceFramework("hwopus") { HwOpus::HwOpus(Core::System& system_) : ServiceFramework{system_, "hwopus"} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &HwOpus::OpenOpusDecoder, "OpenOpusDecoder"}, {0, &HwOpus::OpenOpusDecoder, "OpenOpusDecoder"},
{1, &HwOpus::GetWorkBufferSize, "GetWorkBufferSize"}, {1, &HwOpus::GetWorkBufferSize, "GetWorkBufferSize"},

View File

@ -6,11 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::Audio { namespace Service::Audio {
class HwOpus final : public ServiceFramework<HwOpus> { class HwOpus final : public ServiceFramework<HwOpus> {
public: public:
explicit HwOpus(); explicit HwOpus(Core::System& system_);
~HwOpus() override; ~HwOpus() override;
private: private:

View File

@ -88,9 +88,11 @@ struct DeliveryCacheDirectoryEntry {
class IDeliveryCacheProgressService final : public ServiceFramework<IDeliveryCacheProgressService> { class IDeliveryCacheProgressService final : public ServiceFramework<IDeliveryCacheProgressService> {
public: public:
IDeliveryCacheProgressService(std::shared_ptr<Kernel::ReadableEvent> event, explicit IDeliveryCacheProgressService(Core::System& system_,
const DeliveryCacheProgressImpl& impl) std::shared_ptr<Kernel::ReadableEvent> event_,
: ServiceFramework{"IDeliveryCacheProgressService"}, event(std::move(event)), impl(impl) { const DeliveryCacheProgressImpl& impl_)
: ServiceFramework{system_, "IDeliveryCacheProgressService"}, event{std::move(event_)},
impl{impl_} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IDeliveryCacheProgressService::GetEvent, "GetEvent"}, {0, &IDeliveryCacheProgressService::GetEvent, "GetEvent"},
@ -126,7 +128,7 @@ private:
class IBcatService final : public ServiceFramework<IBcatService> { class IBcatService final : public ServiceFramework<IBcatService> {
public: public:
explicit IBcatService(Core::System& system_, Backend& backend_) explicit IBcatService(Core::System& system_, Backend& backend_)
: ServiceFramework("IBcatService"), system{system_}, backend{backend_}, : ServiceFramework{system_, "IBcatService"}, backend{backend_},
progress{{ progress{{
ProgressServiceBackend{system_.Kernel(), "Normal"}, ProgressServiceBackend{system_.Kernel(), "Normal"},
ProgressServiceBackend{system_.Kernel(), "Directory"}, ProgressServiceBackend{system_.Kernel(), "Directory"},
@ -171,7 +173,7 @@ private:
std::shared_ptr<IDeliveryCacheProgressService> CreateProgressService(SyncType type) { std::shared_ptr<IDeliveryCacheProgressService> CreateProgressService(SyncType type) {
auto& backend{progress.at(static_cast<std::size_t>(type))}; auto& backend{progress.at(static_cast<std::size_t>(type))};
return std::make_shared<IDeliveryCacheProgressService>(backend.GetEvent(), return std::make_shared<IDeliveryCacheProgressService>(system, backend.GetEvent(),
backend.GetImpl()); backend.GetImpl());
} }
@ -261,7 +263,6 @@ private:
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
Core::System& system;
Backend& backend; Backend& backend;
std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress; std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress;
@ -277,8 +278,8 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {
class IDeliveryCacheFileService final : public ServiceFramework<IDeliveryCacheFileService> { class IDeliveryCacheFileService final : public ServiceFramework<IDeliveryCacheFileService> {
public: public:
IDeliveryCacheFileService(FileSys::VirtualDir root_) explicit IDeliveryCacheFileService(Core::System& system_, FileSys::VirtualDir root_)
: ServiceFramework{"IDeliveryCacheFileService"}, root(std::move(root_)) { : ServiceFramework{system_, "IDeliveryCacheFileService"}, root(std::move(root_)) {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IDeliveryCacheFileService::Open, "Open"}, {0, &IDeliveryCacheFileService::Open, "Open"},
@ -394,8 +395,8 @@ private:
class IDeliveryCacheDirectoryService final class IDeliveryCacheDirectoryService final
: public ServiceFramework<IDeliveryCacheDirectoryService> { : public ServiceFramework<IDeliveryCacheDirectoryService> {
public: public:
IDeliveryCacheDirectoryService(FileSys::VirtualDir root_) explicit IDeliveryCacheDirectoryService(Core::System& system_, FileSys::VirtualDir root_)
: ServiceFramework{"IDeliveryCacheDirectoryService"}, root(std::move(root_)) { : ServiceFramework{system_, "IDeliveryCacheDirectoryService"}, root(std::move(root_)) {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IDeliveryCacheDirectoryService::Open, "Open"}, {0, &IDeliveryCacheDirectoryService::Open, "Open"},
@ -492,8 +493,8 @@ private:
class IDeliveryCacheStorageService final : public ServiceFramework<IDeliveryCacheStorageService> { class IDeliveryCacheStorageService final : public ServiceFramework<IDeliveryCacheStorageService> {
public: public:
IDeliveryCacheStorageService(FileSys::VirtualDir root_) explicit IDeliveryCacheStorageService(Core::System& system_, FileSys::VirtualDir root_)
: ServiceFramework{"IDeliveryCacheStorageService"}, root(std::move(root_)) { : ServiceFramework{system_, "IDeliveryCacheStorageService"}, root(std::move(root_)) {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IDeliveryCacheStorageService::CreateFileService, "CreateFileService"}, {0, &IDeliveryCacheStorageService::CreateFileService, "CreateFileService"},
@ -518,7 +519,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDeliveryCacheFileService>(root); rb.PushIpcInterface<IDeliveryCacheFileService>(system, root);
} }
void CreateDirectoryService(Kernel::HLERequestContext& ctx) { void CreateDirectoryService(Kernel::HLERequestContext& ctx) {
@ -526,7 +527,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDeliveryCacheDirectoryService>(root); rb.PushIpcInterface<IDeliveryCacheDirectoryService>(system, root);
} }
void EnumerateDeliveryCacheDirectory(Kernel::HLERequestContext& ctx) { void EnumerateDeliveryCacheDirectory(Kernel::HLERequestContext& ctx) {
@ -551,10 +552,10 @@ private:
void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) { void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_BCAT, "called"); LOG_DEBUG(Service_BCAT, "called");
const auto title_id = system.CurrentProcess()->GetTitleID();
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDeliveryCacheStorageService>( rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id));
fsc.GetBCATDirectory(system.CurrentProcess()->GetTitleID()));
} }
void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId(
@ -566,7 +567,7 @@ void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId(
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDeliveryCacheStorageService>(fsc.GetBCATDirectory(title_id)); rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id));
} }
std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System& system, std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System& system,
@ -582,10 +583,9 @@ std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System
Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_, Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_,
FileSystem::FileSystemController& fsc_, const char* name) FileSystem::FileSystemController& fsc_, const char* name)
: ServiceFramework(name), fsc{fsc_}, module{std::move(module_)}, : ServiceFramework{system_, name}, fsc{fsc_}, module{std::move(module_)},
backend{CreateBackendFromSettings(system_, backend{CreateBackendFromSettings(system_,
[&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })}, [&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })} {}
system{system_} {}
Module::Interface::~Interface() = default; Module::Interface::~Interface() = default;

View File

@ -37,9 +37,6 @@ public:
std::shared_ptr<Module> module; std::shared_ptr<Module> module;
std::unique_ptr<Backend> backend; std::unique_ptr<Backend> backend;
private:
Core::System& system;
}; };
}; };

View File

@ -12,7 +12,7 @@ namespace Service::BPC {
class BPC final : public ServiceFramework<BPC> { class BPC final : public ServiceFramework<BPC> {
public: public:
explicit BPC() : ServiceFramework{"bpc"} { explicit BPC(Core::System& system_) : ServiceFramework{system_, "bpc"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "ShutdownSystem"}, {0, nullptr, "ShutdownSystem"},
@ -40,7 +40,7 @@ public:
class BPC_R final : public ServiceFramework<BPC_R> { class BPC_R final : public ServiceFramework<BPC_R> {
public: public:
explicit BPC_R() : ServiceFramework{"bpc:r"} { explicit BPC_R(Core::System& system_) : ServiceFramework{system_, "bpc:r"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetRtcTime"}, {0, nullptr, "GetRtcTime"},
@ -55,9 +55,9 @@ public:
} }
}; };
void InstallInterfaces(SM::ServiceManager& sm) { void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
std::make_shared<BPC>()->InstallAsService(sm); std::make_shared<BPC>(system)->InstallAsService(sm);
std::make_shared<BPC_R>()->InstallAsService(sm); std::make_shared<BPC_R>(system)->InstallAsService(sm);
} }
} // namespace Service::BPC } // namespace Service::BPC

View File

@ -4,12 +4,16 @@
#pragma once #pragma once
namespace Core {
class System;
}
namespace Service::SM { namespace Service::SM {
class ServiceManager; class ServiceManager;
} }
namespace Service::BPC { namespace Service::BPC {
void InstallInterfaces(SM::ServiceManager& sm); void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
} // namespace Service::BPC } // namespace Service::BPC

View File

@ -17,7 +17,7 @@ namespace Service::BtDrv {
class Bt final : public ServiceFramework<Bt> { class Bt final : public ServiceFramework<Bt> {
public: public:
explicit Bt(Core::System& system) : ServiceFramework{"bt"} { explicit Bt(Core::System& system_) : ServiceFramework{system_, "bt"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "LeClientReadCharacteristic"}, {0, nullptr, "LeClientReadCharacteristic"},
@ -52,7 +52,7 @@ private:
class BtDrv final : public ServiceFramework<BtDrv> { class BtDrv final : public ServiceFramework<BtDrv> {
public: public:
explicit BtDrv() : ServiceFramework{"btdrv"} { explicit BtDrv(Core::System& system_) : ServiceFramework{system_, "btdrv"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "InitializeBluetoothDriver"}, {0, nullptr, "InitializeBluetoothDriver"},
@ -166,7 +166,7 @@ public:
}; };
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) { void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
std::make_shared<BtDrv>()->InstallAsService(sm); std::make_shared<BtDrv>(system)->InstallAsService(sm);
std::make_shared<Bt>(system)->InstallAsService(sm); std::make_shared<Bt>(system)->InstallAsService(sm);
} }

View File

@ -18,7 +18,7 @@ namespace Service::BTM {
class IBtmUserCore final : public ServiceFramework<IBtmUserCore> { class IBtmUserCore final : public ServiceFramework<IBtmUserCore> {
public: public:
explicit IBtmUserCore(Core::System& system) : ServiceFramework{"IBtmUserCore"} { explicit IBtmUserCore(Core::System& system_) : ServiceFramework{system_, "IBtmUserCore"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IBtmUserCore::AcquireBleScanEvent, "AcquireBleScanEvent"}, {0, &IBtmUserCore::AcquireBleScanEvent, "AcquireBleScanEvent"},
@ -107,7 +107,7 @@ private:
class BTM_USR final : public ServiceFramework<BTM_USR> { class BTM_USR final : public ServiceFramework<BTM_USR> {
public: public:
explicit BTM_USR(Core::System& system) : ServiceFramework{"btm:u"}, system(system) { explicit BTM_USR(Core::System& system_) : ServiceFramework{system_, "btm:u"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &BTM_USR::GetCore, "GetCore"}, {0, &BTM_USR::GetCore, "GetCore"},
@ -124,13 +124,11 @@ private:
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IBtmUserCore>(system); rb.PushIpcInterface<IBtmUserCore>(system);
} }
Core::System& system;
}; };
class BTM final : public ServiceFramework<BTM> { class BTM final : public ServiceFramework<BTM> {
public: public:
explicit BTM() : ServiceFramework{"btm"} { explicit BTM(Core::System& system_) : ServiceFramework{system_, "btm"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetState"}, {0, nullptr, "GetState"},
@ -207,7 +205,7 @@ public:
class BTM_DBG final : public ServiceFramework<BTM_DBG> { class BTM_DBG final : public ServiceFramework<BTM_DBG> {
public: public:
explicit BTM_DBG() : ServiceFramework{"btm:dbg"} { explicit BTM_DBG(Core::System& system_) : ServiceFramework{system_, "btm:dbg"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "AcquireDiscoveryEvent"}, {0, nullptr, "AcquireDiscoveryEvent"},
@ -232,7 +230,7 @@ public:
class IBtmSystemCore final : public ServiceFramework<IBtmSystemCore> { class IBtmSystemCore final : public ServiceFramework<IBtmSystemCore> {
public: public:
explicit IBtmSystemCore() : ServiceFramework{"IBtmSystemCore"} { explicit IBtmSystemCore(Core::System& system_) : ServiceFramework{system_, "IBtmSystemCore"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "StartGamepadPairing"}, {0, nullptr, "StartGamepadPairing"},
@ -254,7 +252,7 @@ public:
class BTM_SYS final : public ServiceFramework<BTM_SYS> { class BTM_SYS final : public ServiceFramework<BTM_SYS> {
public: public:
explicit BTM_SYS() : ServiceFramework{"btm:sys"} { explicit BTM_SYS(Core::System& system_) : ServiceFramework{system_, "btm:sys"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &BTM_SYS::GetCore, "GetCore"}, {0, &BTM_SYS::GetCore, "GetCore"},
@ -270,14 +268,14 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IBtmSystemCore>(); rb.PushIpcInterface<IBtmSystemCore>(system);
} }
}; };
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) { void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
std::make_shared<BTM>()->InstallAsService(sm); std::make_shared<BTM>(system)->InstallAsService(sm);
std::make_shared<BTM_DBG>()->InstallAsService(sm); std::make_shared<BTM_DBG>(system)->InstallAsService(sm);
std::make_shared<BTM_SYS>()->InstallAsService(sm); std::make_shared<BTM_SYS>(system)->InstallAsService(sm);
std::make_shared<BTM_USR>(system)->InstallAsService(sm); std::make_shared<BTM_USR>(system)->InstallAsService(sm);
} }

View File

@ -13,13 +13,13 @@
namespace Service::Capture { namespace Service::Capture {
void InstallInterfaces(SM::ServiceManager& sm) { void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
std::make_shared<CAPS_A>()->InstallAsService(sm); std::make_shared<CAPS_A>(system)->InstallAsService(sm);
std::make_shared<CAPS_C>()->InstallAsService(sm); std::make_shared<CAPS_C>(system)->InstallAsService(sm);
std::make_shared<CAPS_U>()->InstallAsService(sm); std::make_shared<CAPS_U>(system)->InstallAsService(sm);
std::make_shared<CAPS_SC>()->InstallAsService(sm); std::make_shared<CAPS_SC>(system)->InstallAsService(sm);
std::make_shared<CAPS_SS>()->InstallAsService(sm); std::make_shared<CAPS_SS>(system)->InstallAsService(sm);
std::make_shared<CAPS_SU>()->InstallAsService(sm); std::make_shared<CAPS_SU>(system)->InstallAsService(sm);
} }
} // namespace Service::Capture } // namespace Service::Capture

View File

@ -6,6 +6,10 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::SM { namespace Service::SM {
class ServiceManager; class ServiceManager;
} }
@ -87,6 +91,6 @@ static_assert(sizeof(ApplicationAlbumFileEntry) == 0x30,
"ApplicationAlbumFileEntry has incorrect size."); "ApplicationAlbumFileEntry has incorrect size.");
/// Registers all Capture services with the specified service manager. /// Registers all Capture services with the specified service manager.
void InstallInterfaces(SM::ServiceManager& sm); void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
} // namespace Service::Capture } // namespace Service::Capture

View File

@ -8,7 +8,8 @@ namespace Service::Capture {
class IAlbumAccessorSession final : public ServiceFramework<IAlbumAccessorSession> { class IAlbumAccessorSession final : public ServiceFramework<IAlbumAccessorSession> {
public: public:
explicit IAlbumAccessorSession() : ServiceFramework{"IAlbumAccessorSession"} { explicit IAlbumAccessorSession(Core::System& system_)
: ServiceFramework{system_, "IAlbumAccessorSession"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{2001, nullptr, "OpenAlbumMovieReadStream"}, {2001, nullptr, "OpenAlbumMovieReadStream"},
@ -26,7 +27,7 @@ public:
} }
}; };
CAPS_A::CAPS_A() : ServiceFramework("caps:a") { CAPS_A::CAPS_A(Core::System& system_) : ServiceFramework{system_, "caps:a"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetAlbumFileCount"}, {0, nullptr, "GetAlbumFileCount"},

View File

@ -6,6 +6,10 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Kernel { namespace Kernel {
class HLERequestContext; class HLERequestContext;
} }
@ -14,7 +18,7 @@ namespace Service::Capture {
class CAPS_A final : public ServiceFramework<CAPS_A> { class CAPS_A final : public ServiceFramework<CAPS_A> {
public: public:
explicit CAPS_A(); explicit CAPS_A(Core::System& system_);
~CAPS_A() override; ~CAPS_A() override;
}; };

View File

@ -10,7 +10,8 @@ namespace Service::Capture {
class IAlbumControlSession final : public ServiceFramework<IAlbumControlSession> { class IAlbumControlSession final : public ServiceFramework<IAlbumControlSession> {
public: public:
explicit IAlbumControlSession() : ServiceFramework{"IAlbumControlSession"} { explicit IAlbumControlSession(Core::System& system_)
: ServiceFramework{system_, "IAlbumControlSession"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{2001, nullptr, "OpenAlbumMovieReadStream"}, {2001, nullptr, "OpenAlbumMovieReadStream"},
@ -44,7 +45,7 @@ public:
} }
}; };
CAPS_C::CAPS_C() : ServiceFramework("caps:c") { CAPS_C::CAPS_C(Core::System& system_) : ServiceFramework{system_, "caps:c"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{1, nullptr, "CaptureRawImage"}, {1, nullptr, "CaptureRawImage"},

View File

@ -6,6 +6,10 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Kernel { namespace Kernel {
class HLERequestContext; class HLERequestContext;
} }
@ -14,7 +18,7 @@ namespace Service::Capture {
class CAPS_C final : public ServiceFramework<CAPS_C> { class CAPS_C final : public ServiceFramework<CAPS_C> {
public: public:
explicit CAPS_C(); explicit CAPS_C(Core::System& system_);
~CAPS_C() override; ~CAPS_C() override;
private: private:

View File

@ -6,7 +6,7 @@
namespace Service::Capture { namespace Service::Capture {
CAPS_SC::CAPS_SC() : ServiceFramework("caps:sc") { CAPS_SC::CAPS_SC(Core::System& system_) : ServiceFramework{system_, "caps:sc"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{1, nullptr, "CaptureRawImage"}, {1, nullptr, "CaptureRawImage"},

View File

@ -6,15 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Kernel { namespace Core {
class HLERequestContext; class System;
} }
namespace Service::Capture { namespace Service::Capture {
class CAPS_SC final : public ServiceFramework<CAPS_SC> { class CAPS_SC final : public ServiceFramework<CAPS_SC> {
public: public:
explicit CAPS_SC(); explicit CAPS_SC(Core::System& system_);
~CAPS_SC() override; ~CAPS_SC() override;
}; };

View File

@ -6,7 +6,7 @@
namespace Service::Capture { namespace Service::Capture {
CAPS_SS::CAPS_SS() : ServiceFramework("caps:ss") { CAPS_SS::CAPS_SS(Core::System& system_) : ServiceFramework{system_, "caps:ss"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{201, nullptr, "SaveScreenShot"}, {201, nullptr, "SaveScreenShot"},

View File

@ -6,15 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Kernel { namespace Core {
class HLERequestContext; class System;
} }
namespace Service::Capture { namespace Service::Capture {
class CAPS_SS final : public ServiceFramework<CAPS_SS> { class CAPS_SS final : public ServiceFramework<CAPS_SS> {
public: public:
explicit CAPS_SS(); explicit CAPS_SS(Core::System& system_);
~CAPS_SS() override; ~CAPS_SS() override;
}; };

View File

@ -8,7 +8,7 @@
namespace Service::Capture { namespace Service::Capture {
CAPS_SU::CAPS_SU() : ServiceFramework("caps:su") { CAPS_SU::CAPS_SU(Core::System& system_) : ServiceFramework{system_, "caps:su"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{32, &CAPS_SU::SetShimLibraryVersion, "SetShimLibraryVersion"}, {32, &CAPS_SU::SetShimLibraryVersion, "SetShimLibraryVersion"},

View File

@ -6,6 +6,10 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Kernel { namespace Kernel {
class HLERequestContext; class HLERequestContext;
} }
@ -14,7 +18,7 @@ namespace Service::Capture {
class CAPS_SU final : public ServiceFramework<CAPS_SU> { class CAPS_SU final : public ServiceFramework<CAPS_SU> {
public: public:
explicit CAPS_SU(); explicit CAPS_SU(Core::System& system_);
~CAPS_SU() override; ~CAPS_SU() override;
private: private:

View File

@ -12,8 +12,8 @@ namespace Service::Capture {
class IAlbumAccessorApplicationSession final class IAlbumAccessorApplicationSession final
: public ServiceFramework<IAlbumAccessorApplicationSession> { : public ServiceFramework<IAlbumAccessorApplicationSession> {
public: public:
explicit IAlbumAccessorApplicationSession() explicit IAlbumAccessorApplicationSession(Core::System& system_)
: ServiceFramework{"IAlbumAccessorApplicationSession"} { : ServiceFramework{system_, "IAlbumAccessorApplicationSession"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{2001, nullptr, "OpenAlbumMovieReadStream"}, {2001, nullptr, "OpenAlbumMovieReadStream"},
@ -28,7 +28,7 @@ public:
} }
}; };
CAPS_U::CAPS_U() : ServiceFramework("caps:u") { CAPS_U::CAPS_U(Core::System& system_) : ServiceFramework{system_, "caps:u"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{32, &CAPS_U::SetShimLibraryVersion, "SetShimLibraryVersion"}, {32, &CAPS_U::SetShimLibraryVersion, "SetShimLibraryVersion"},

View File

@ -6,6 +6,10 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Kernel { namespace Kernel {
class HLERequestContext; class HLERequestContext;
} }
@ -14,7 +18,7 @@ namespace Service::Capture {
class CAPS_U final : public ServiceFramework<CAPS_U> { class CAPS_U final : public ServiceFramework<CAPS_U> {
public: public:
explicit CAPS_U(); explicit CAPS_U(Core::System& system_);
~CAPS_U() override; ~CAPS_U() override;
private: private:

View File

@ -12,7 +12,7 @@ namespace Service::ERPT {
class ErrorReportContext final : public ServiceFramework<ErrorReportContext> { class ErrorReportContext final : public ServiceFramework<ErrorReportContext> {
public: public:
explicit ErrorReportContext() : ServiceFramework{"erpt:c"} { explicit ErrorReportContext(Core::System& system_) : ServiceFramework{system_, "erpt:c"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "SubmitContext"}, {0, nullptr, "SubmitContext"},
@ -35,7 +35,7 @@ public:
class ErrorReportSession final : public ServiceFramework<ErrorReportSession> { class ErrorReportSession final : public ServiceFramework<ErrorReportSession> {
public: public:
explicit ErrorReportSession() : ServiceFramework{"erpt:r"} { explicit ErrorReportSession(Core::System& system_) : ServiceFramework{system_, "erpt:r"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "OpenReport"}, {0, nullptr, "OpenReport"},
@ -48,9 +48,9 @@ public:
} }
}; };
void InstallInterfaces(SM::ServiceManager& sm) { void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
std::make_shared<ErrorReportContext>()->InstallAsService(sm); std::make_shared<ErrorReportContext>(system)->InstallAsService(sm);
std::make_shared<ErrorReportSession>()->InstallAsService(sm); std::make_shared<ErrorReportSession>(system)->InstallAsService(sm);
} }
} // namespace Service::ERPT } // namespace Service::ERPT

View File

@ -4,6 +4,10 @@
#pragma once #pragma once
namespace Core {
class System;
}
namespace Service::SM { namespace Service::SM {
class ServiceManager; class ServiceManager;
} }
@ -11,6 +15,6 @@ class ServiceManager;
namespace Service::ERPT { namespace Service::ERPT {
/// Registers all ERPT services with the specified service manager. /// Registers all ERPT services with the specified service manager.
void InstallInterfaces(SM::ServiceManager& sm); void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
} // namespace Service::ERPT } // namespace Service::ERPT

View File

@ -14,7 +14,7 @@ constexpr ResultCode ERROR_INVALID_RIGHTS_ID{ErrorModule::ETicket, 3};
class ETicket final : public ServiceFramework<ETicket> { class ETicket final : public ServiceFramework<ETicket> {
public: public:
explicit ETicket() : ServiceFramework{"es"} { explicit ETicket(Core::System& system_) : ServiceFramework{system_, "es"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{1, &ETicket::ImportTicket, "ImportTicket"}, {1, &ETicket::ImportTicket, "ImportTicket"},
@ -305,8 +305,8 @@ private:
Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance();
}; };
void InstallInterfaces(SM::ServiceManager& service_manager) { void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
std::make_shared<ETicket>()->InstallAsService(service_manager); std::make_shared<ETicket>(system)->InstallAsService(service_manager);
} }
} // namespace Service::ES } // namespace Service::ES

View File

@ -4,6 +4,10 @@
#pragma once #pragma once
namespace Core {
class System;
}
namespace Service::SM { namespace Service::SM {
class ServiceManager; class ServiceManager;
} }
@ -11,6 +15,6 @@ class ServiceManager;
namespace Service::ES { namespace Service::ES {
/// Registers all ES services with the specified service manager. /// Registers all ES services with the specified service manager.
void InstallInterfaces(SM::ServiceManager& service_manager); void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
} // namespace Service::ES } // namespace Service::ES

View File

@ -12,7 +12,7 @@ namespace Service::EUPLD {
class ErrorUploadContext final : public ServiceFramework<ErrorUploadContext> { class ErrorUploadContext final : public ServiceFramework<ErrorUploadContext> {
public: public:
explicit ErrorUploadContext() : ServiceFramework{"eupld:c"} { explicit ErrorUploadContext(Core::System& system_) : ServiceFramework{system_, "eupld:c"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "SetUrl"}, {0, nullptr, "SetUrl"},
@ -29,7 +29,7 @@ public:
class ErrorUploadRequest final : public ServiceFramework<ErrorUploadRequest> { class ErrorUploadRequest final : public ServiceFramework<ErrorUploadRequest> {
public: public:
explicit ErrorUploadRequest() : ServiceFramework{"eupld:r"} { explicit ErrorUploadRequest(Core::System& system_) : ServiceFramework{system_, "eupld:r"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "Initialize"}, {0, nullptr, "Initialize"},
@ -45,9 +45,9 @@ public:
} }
}; };
void InstallInterfaces(SM::ServiceManager& sm) { void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
std::make_shared<ErrorUploadContext>()->InstallAsService(sm); std::make_shared<ErrorUploadContext>(system)->InstallAsService(sm);
std::make_shared<ErrorUploadRequest>()->InstallAsService(sm); std::make_shared<ErrorUploadRequest>(system)->InstallAsService(sm);
} }
} // namespace Service::EUPLD } // namespace Service::EUPLD

View File

@ -4,6 +4,10 @@
#pragma once #pragma once
namespace Core {
class System;
}
namespace Service::SM { namespace Service::SM {
class ServiceManager; class ServiceManager;
} }
@ -11,6 +15,6 @@ class ServiceManager;
namespace Service::EUPLD { namespace Service::EUPLD {
/// Registers all EUPLD services with the specified service manager. /// Registers all EUPLD services with the specified service manager.
void InstallInterfaces(SM::ServiceManager& sm); void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
} // namespace Service::EUPLD } // namespace Service::EUPLD

View File

@ -20,8 +20,9 @@
namespace Service::Fatal { namespace Service::Fatal {
Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name) Module::Interface::Interface(std::shared_ptr<Module> module_, Core::System& system_,
: ServiceFramework(name), module(std::move(module)), system(system) {} const char* name)
: ServiceFramework{system_, name}, module{std::move(module_)} {}
Module::Interface::~Interface() = default; Module::Interface::~Interface() = default;

View File

@ -16,7 +16,8 @@ class Module final {
public: public:
class Interface : public ServiceFramework<Interface> { class Interface : public ServiceFramework<Interface> {
public: public:
explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name); explicit Interface(std::shared_ptr<Module> module_, Core::System& system_,
const char* name);
~Interface() override; ~Interface() override;
void ThrowFatal(Kernel::HLERequestContext& ctx); void ThrowFatal(Kernel::HLERequestContext& ctx);
@ -25,7 +26,6 @@ public:
protected: protected:
std::shared_ptr<Module> module; std::shared_ptr<Module> module;
Core::System& system;
}; };
}; };

View File

@ -6,8 +6,8 @@
namespace Service::Fatal { namespace Service::Fatal {
Fatal_P::Fatal_P(std::shared_ptr<Module> module, Core::System& system) Fatal_P::Fatal_P(std::shared_ptr<Module> module_, Core::System& system_)
: Module::Interface(std::move(module), system, "fatal:p") {} : Interface(std::move(module_), system_, "fatal:p") {}
Fatal_P::~Fatal_P() = default; Fatal_P::~Fatal_P() = default;

View File

@ -10,7 +10,7 @@ namespace Service::Fatal {
class Fatal_P final : public Module::Interface { class Fatal_P final : public Module::Interface {
public: public:
explicit Fatal_P(std::shared_ptr<Module> module, Core::System& system); explicit Fatal_P(std::shared_ptr<Module> module_, Core::System& system_);
~Fatal_P() override; ~Fatal_P() override;
}; };

View File

@ -6,8 +6,8 @@
namespace Service::Fatal { namespace Service::Fatal {
Fatal_U::Fatal_U(std::shared_ptr<Module> module, Core::System& system) Fatal_U::Fatal_U(std::shared_ptr<Module> module_, Core::System& system_)
: Module::Interface(std::move(module), system, "fatal:u") { : Interface(std::move(module_), system_, "fatal:u") {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &Fatal_U::ThrowFatal, "ThrowFatal"}, {0, &Fatal_U::ThrowFatal, "ThrowFatal"},
{1, &Fatal_U::ThrowFatalWithPolicy, "ThrowFatalWithPolicy"}, {1, &Fatal_U::ThrowFatalWithPolicy, "ThrowFatalWithPolicy"},

View File

@ -10,7 +10,7 @@ namespace Service::Fatal {
class Fatal_U final : public Module::Interface { class Fatal_U final : public Module::Interface {
public: public:
explicit Fatal_U(std::shared_ptr<Module> module, Core::System& system); explicit Fatal_U(std::shared_ptr<Module> module_, Core::System& system_);
~Fatal_U() override; ~Fatal_U() override;
}; };

View File

@ -14,7 +14,7 @@ namespace Service::FGM {
class IRequest final : public ServiceFramework<IRequest> { class IRequest final : public ServiceFramework<IRequest> {
public: public:
explicit IRequest() : ServiceFramework{"IRequest"} { explicit IRequest(Core::System& system_) : ServiceFramework{system_, "IRequest"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "Initialize"}, {0, nullptr, "Initialize"},
@ -30,7 +30,7 @@ public:
class FGM final : public ServiceFramework<FGM> { class FGM final : public ServiceFramework<FGM> {
public: public:
explicit FGM(const char* name) : ServiceFramework{name} { explicit FGM(Core::System& system_, const char* name) : ServiceFramework{system_, name} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &FGM::Initialize, "Initialize"}, {0, &FGM::Initialize, "Initialize"},
@ -46,13 +46,13 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IRequest>(); rb.PushIpcInterface<IRequest>(system);
} }
}; };
class FGM_DBG final : public ServiceFramework<FGM_DBG> { class FGM_DBG final : public ServiceFramework<FGM_DBG> {
public: public:
explicit FGM_DBG() : ServiceFramework{"fgm:dbg"} { explicit FGM_DBG(Core::System& system_) : ServiceFramework{system_, "fgm:dbg"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "Initialize"}, {0, nullptr, "Initialize"},
@ -65,11 +65,11 @@ public:
} }
}; };
void InstallInterfaces(SM::ServiceManager& sm) { void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
std::make_shared<FGM>("fgm")->InstallAsService(sm); std::make_shared<FGM>(system, "fgm")->InstallAsService(sm);
std::make_shared<FGM>("fgm:0")->InstallAsService(sm); std::make_shared<FGM>(system, "fgm:0")->InstallAsService(sm);
std::make_shared<FGM>("fgm:9")->InstallAsService(sm); std::make_shared<FGM>(system, "fgm:9")->InstallAsService(sm);
std::make_shared<FGM_DBG>()->InstallAsService(sm); std::make_shared<FGM_DBG>(system)->InstallAsService(sm);
} }
} // namespace Service::FGM } // namespace Service::FGM

View File

@ -4,12 +4,16 @@
#pragma once #pragma once
namespace Core {
class System;
}
namespace Service::SM { namespace Service::SM {
class ServiceManager; class ServiceManager;
} }
namespace Service::FGM { namespace Service::FGM {
void InstallInterfaces(SM::ServiceManager& sm); void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
} // namespace Service::FGM } // namespace Service::FGM

View File

@ -728,11 +728,9 @@ void FileSystemController::CreateFactories(FileSys::VfsFilesystem& vfs, bool ove
} }
void InstallInterfaces(Core::System& system) { void InstallInterfaces(Core::System& system) {
std::make_shared<FSP_LDR>()->InstallAsService(system.ServiceManager()); std::make_shared<FSP_LDR>(system)->InstallAsService(system.ServiceManager());
std::make_shared<FSP_PR>()->InstallAsService(system.ServiceManager()); std::make_shared<FSP_PR>(system)->InstallAsService(system.ServiceManager());
std::make_shared<FSP_SRV>(system.GetFileSystemController(), system.GetContentProvider(), std::make_shared<FSP_SRV>(system)->InstallAsService(system.ServiceManager());
system.GetReporter())
->InstallAsService(system.ServiceManager());
} }
} // namespace Service::FileSystem } // namespace Service::FileSystem

View File

@ -7,7 +7,7 @@
namespace Service::FileSystem { namespace Service::FileSystem {
FSP_LDR::FSP_LDR() : ServiceFramework{"fsp:ldr"} { FSP_LDR::FSP_LDR(Core::System& system_) : ServiceFramework{system_, "fsp:ldr"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "OpenCodeFileSystem"}, {0, nullptr, "OpenCodeFileSystem"},

View File

@ -6,11 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::FileSystem { namespace Service::FileSystem {
class FSP_LDR final : public ServiceFramework<FSP_LDR> { class FSP_LDR final : public ServiceFramework<FSP_LDR> {
public: public:
explicit FSP_LDR(); explicit FSP_LDR(Core::System& system_);
~FSP_LDR() override; ~FSP_LDR() override;
}; };

View File

@ -7,7 +7,7 @@
namespace Service::FileSystem { namespace Service::FileSystem {
FSP_PR::FSP_PR() : ServiceFramework{"fsp:pr"} { FSP_PR::FSP_PR(Core::System& system_) : ServiceFramework{system_, "fsp:pr"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "RegisterProgram"}, {0, nullptr, "RegisterProgram"},

View File

@ -6,11 +6,15 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::FileSystem { namespace Service::FileSystem {
class FSP_PR final : public ServiceFramework<FSP_PR> { class FSP_PR final : public ServiceFramework<FSP_PR> {
public: public:
explicit FSP_PR(); explicit FSP_PR(Core::System& system_);
~FSP_PR() override; ~FSP_PR() override;
}; };

View File

@ -14,6 +14,7 @@
#include "common/hex_util.h" #include "common/hex_util.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "core/core.h"
#include "core/file_sys/directory.h" #include "core/file_sys/directory.h"
#include "core/file_sys/errors.h" #include "core/file_sys/errors.h"
#include "core/file_sys/mode.h" #include "core/file_sys/mode.h"
@ -56,8 +57,8 @@ enum class FileSystemType : u8 {
class IStorage final : public ServiceFramework<IStorage> { class IStorage final : public ServiceFramework<IStorage> {
public: public:
explicit IStorage(FileSys::VirtualFile backend_) explicit IStorage(Core::System& system_, FileSys::VirtualFile backend_)
: ServiceFramework("IStorage"), backend(std::move(backend_)) { : ServiceFramework{system_, "IStorage"}, backend(std::move(backend_)) {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IStorage::Read, "Read"}, {0, &IStorage::Read, "Read"},
{1, nullptr, "Write"}, {1, nullptr, "Write"},
@ -114,8 +115,8 @@ private:
class IFile final : public ServiceFramework<IFile> { class IFile final : public ServiceFramework<IFile> {
public: public:
explicit IFile(FileSys::VirtualFile backend_) explicit IFile(Core::System& system_, FileSys::VirtualFile backend_)
: ServiceFramework("IFile"), backend(std::move(backend_)) { : ServiceFramework{system_, "IFile"}, backend(std::move(backend_)) {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IFile::Read, "Read"}, {1, &IFile::Write, "Write"}, {0, &IFile::Read, "Read"}, {1, &IFile::Write, "Write"},
{2, &IFile::Flush, "Flush"}, {3, &IFile::SetSize, "SetSize"}, {2, &IFile::Flush, "Flush"}, {3, &IFile::SetSize, "SetSize"},
@ -246,8 +247,8 @@ static void BuildEntryIndex(std::vector<FileSys::Entry>& entries, const std::vec
class IDirectory final : public ServiceFramework<IDirectory> { class IDirectory final : public ServiceFramework<IDirectory> {
public: public:
explicit IDirectory(FileSys::VirtualDir backend_) explicit IDirectory(Core::System& system_, FileSys::VirtualDir backend_)
: ServiceFramework("IDirectory"), backend(std::move(backend_)) { : ServiceFramework{system_, "IDirectory"}, backend(std::move(backend_)) {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IDirectory::Read, "Read"}, {0, &IDirectory::Read, "Read"},
{1, &IDirectory::GetEntryCount, "GetEntryCount"}, {1, &IDirectory::GetEntryCount, "GetEntryCount"},
@ -302,8 +303,9 @@ private:
class IFileSystem final : public ServiceFramework<IFileSystem> { class IFileSystem final : public ServiceFramework<IFileSystem> {
public: public:
explicit IFileSystem(FileSys::VirtualDir backend, SizeGetter size) explicit IFileSystem(Core::System& system_, FileSys::VirtualDir backend_, SizeGetter size_)
: ServiceFramework("IFileSystem"), backend(std::move(backend)), size(std::move(size)) { : ServiceFramework{system_, "IFileSystem"}, backend{std::move(backend_)}, size{std::move(
size_)} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IFileSystem::CreateFile, "CreateFile"}, {0, &IFileSystem::CreateFile, "CreateFile"},
{1, &IFileSystem::DeleteFile, "DeleteFile"}, {1, &IFileSystem::DeleteFile, "DeleteFile"},
@ -420,7 +422,7 @@ public:
return; return;
} }
auto file = std::make_shared<IFile>(result.Unwrap()); auto file = std::make_shared<IFile>(system, result.Unwrap());
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -445,7 +447,7 @@ public:
return; return;
} }
auto directory = std::make_shared<IDirectory>(result.Unwrap()); auto directory = std::make_shared<IDirectory>(system, result.Unwrap());
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -500,8 +502,9 @@ private:
class ISaveDataInfoReader final : public ServiceFramework<ISaveDataInfoReader> { class ISaveDataInfoReader final : public ServiceFramework<ISaveDataInfoReader> {
public: public:
explicit ISaveDataInfoReader(FileSys::SaveDataSpaceId space, FileSystemController& fsc) explicit ISaveDataInfoReader(Core::System& system_, FileSys::SaveDataSpaceId space,
: ServiceFramework("ISaveDataInfoReader"), fsc(fsc) { FileSystemController& fsc_)
: ServiceFramework{system_, "ISaveDataInfoReader"}, fsc{fsc_} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &ISaveDataInfoReader::ReadSaveDataInfo, "ReadSaveDataInfo"}, {0, &ISaveDataInfoReader::ReadSaveDataInfo, "ReadSaveDataInfo"},
}; };
@ -650,10 +653,9 @@ private:
u64 next_entry_index = 0; u64 next_entry_index = 0;
}; };
FSP_SRV::FSP_SRV(FileSystemController& fsc_, const FileSys::ContentProvider& content_provider_, FSP_SRV::FSP_SRV(Core::System& system_)
const Core::Reporter& reporter_) : ServiceFramework{system_, "fsp-srv"}, fsc{system.GetFileSystemController()},
: ServiceFramework("fsp-srv"), fsc(fsc_), content_provider{content_provider_}, content_provider{system.GetContentProvider()}, reporter{system.GetReporter()} {
reporter(reporter_) {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "OpenFileSystem"}, {0, nullptr, "OpenFileSystem"},
@ -803,8 +805,9 @@ void FSP_SRV::OpenFileSystemWithPatch(Kernel::HLERequestContext& ctx) {
void FSP_SRV::OpenSdCardFileSystem(Kernel::HLERequestContext& ctx) { void FSP_SRV::OpenSdCardFileSystem(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_FS, "called"); LOG_DEBUG(Service_FS, "called");
auto filesystem = std::make_shared<IFileSystem>( auto filesystem =
fsc.OpenSDMC().Unwrap(), SizeGetter::FromStorageId(fsc, FileSys::StorageId::SdCard)); std::make_shared<IFileSystem>(system, fsc.OpenSDMC().Unwrap(),
SizeGetter::FromStorageId(fsc, FileSys::StorageId::SdCard));
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -864,8 +867,8 @@ void FSP_SRV::OpenSaveDataFileSystem(Kernel::HLERequestContext& ctx) {
UNREACHABLE(); UNREACHABLE();
} }
auto filesystem = auto filesystem = std::make_shared<IFileSystem>(system, std::move(dir.Unwrap()),
std::make_shared<IFileSystem>(std::move(dir.Unwrap()), SizeGetter::FromStorageId(fsc, id)); SizeGetter::FromStorageId(fsc, id));
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -884,7 +887,8 @@ void FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(Kernel::HLERequestContext&
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISaveDataInfoReader>(std::make_shared<ISaveDataInfoReader>(space, fsc)); rb.PushIpcInterface<ISaveDataInfoReader>(
std::make_shared<ISaveDataInfoReader>(system, space, fsc));
} }
void FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute(Kernel::HLERequestContext& ctx) { void FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute(Kernel::HLERequestContext& ctx) {
@ -933,7 +937,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
return; return;
} }
auto storage = std::make_shared<IStorage>(std::move(romfs.Unwrap())); auto storage = std::make_shared<IStorage>(system, std::move(romfs.Unwrap()));
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -957,7 +961,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) {
if (archive != nullptr) { if (archive != nullptr) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface(std::make_shared<IStorage>(archive)); rb.PushIpcInterface(std::make_shared<IStorage>(system, archive));
return; return;
} }
@ -973,7 +977,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) {
const FileSys::PatchManager pm{title_id, fsc, content_provider}; const FileSys::PatchManager pm{title_id, fsc, content_provider};
auto storage = std::make_shared<IStorage>( auto storage = std::make_shared<IStorage>(
pm.PatchRomFS(std::move(data.Unwrap()), 0, FileSys::ContentRecordType::Data)); system, pm.PatchRomFS(std::move(data.Unwrap()), 0, FileSys::ContentRecordType::Data));
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -1035,7 +1039,8 @@ void FSP_SRV::GetAccessLogVersionInfo(Kernel::HLERequestContext& ctx) {
class IMultiCommitManager final : public ServiceFramework<IMultiCommitManager> { class IMultiCommitManager final : public ServiceFramework<IMultiCommitManager> {
public: public:
explicit IMultiCommitManager() : ServiceFramework("IMultiCommitManager") { explicit IMultiCommitManager(Core::System& system_)
: ServiceFramework{system_, "IMultiCommitManager"} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{1, &IMultiCommitManager::Add, "Add"}, {1, &IMultiCommitManager::Add, "Add"},
{2, &IMultiCommitManager::Commit, "Commit"}, {2, &IMultiCommitManager::Commit, "Commit"},
@ -1066,7 +1071,7 @@ void FSP_SRV::OpenMultiCommitManager(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IMultiCommitManager>(std::make_shared<IMultiCommitManager>()); rb.PushIpcInterface<IMultiCommitManager>(std::make_shared<IMultiCommitManager>(system));
} }
} // namespace Service::FileSystem } // namespace Service::FileSystem

View File

@ -33,8 +33,7 @@ enum class LogMode : u32 {
class FSP_SRV final : public ServiceFramework<FSP_SRV> { class FSP_SRV final : public ServiceFramework<FSP_SRV> {
public: public:
explicit FSP_SRV(FileSystemController& fsc_, const FileSys::ContentProvider& content_provider_, explicit FSP_SRV(Core::System& system_);
const Core::Reporter& reporter_);
~FSP_SRV() override; ~FSP_SRV() override;
private: private:

View File

@ -17,7 +17,7 @@ namespace Service::Friend {
class IFriendService final : public ServiceFramework<IFriendService> { class IFriendService final : public ServiceFramework<IFriendService> {
public: public:
IFriendService() : ServiceFramework("IFriendService") { explicit IFriendService(Core::System& system_) : ServiceFramework{system_, "IFriendService"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetCompletionEvent"}, {0, nullptr, "GetCompletionEvent"},
@ -171,8 +171,8 @@ private:
class INotificationService final : public ServiceFramework<INotificationService> { class INotificationService final : public ServiceFramework<INotificationService> {
public: public:
INotificationService(Common::UUID uuid, Core::System& system) explicit INotificationService(Common::UUID uuid_, Core::System& system_)
: ServiceFramework("INotificationService"), uuid(uuid) { : ServiceFramework{system_, "INotificationService"}, uuid{uuid_} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &INotificationService::GetEvent, "GetEvent"}, {0, &INotificationService::GetEvent, "GetEvent"},
@ -267,7 +267,7 @@ private:
void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) { void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IFriendService>(); rb.PushIpcInterface<IFriendService>(system);
LOG_DEBUG(Service_ACC, "called"); LOG_DEBUG(Service_ACC, "called");
} }
@ -282,8 +282,9 @@ void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx
rb.PushIpcInterface<INotificationService>(uuid, system); rb.PushIpcInterface<INotificationService>(uuid, system);
} }
Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name) Module::Interface::Interface(std::shared_ptr<Module> module_, Core::System& system_,
: ServiceFramework(name), module(std::move(module)), system(system) {} const char* name)
: ServiceFramework{system_, name}, module{std::move(module_)} {}
Module::Interface::~Interface() = default; Module::Interface::~Interface() = default;

View File

@ -16,7 +16,8 @@ class Module final {
public: public:
class Interface : public ServiceFramework<Interface> { class Interface : public ServiceFramework<Interface> {
public: public:
explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name); explicit Interface(std::shared_ptr<Module> module_, Core::System& system_,
const char* name);
~Interface() override; ~Interface() override;
void CreateFriendService(Kernel::HLERequestContext& ctx); void CreateFriendService(Kernel::HLERequestContext& ctx);
@ -24,7 +25,6 @@ public:
protected: protected:
std::shared_ptr<Module> module; std::shared_ptr<Module> module;
Core::System& system;
}; };
}; };

Some files were not shown because too many files have changed in this diff Show More