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

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

View File

@ -6,6 +6,10 @@
#include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::SM {
class ServiceManager;
}
@ -87,6 +91,6 @@ static_assert(sizeof(ApplicationAlbumFileEntry) == 0x30,
"ApplicationAlbumFileEntry has incorrect size.");
/// 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

View File

@ -8,7 +8,8 @@ namespace Service::Capture {
class IAlbumAccessorSession final : public ServiceFramework<IAlbumAccessorSession> {
public:
explicit IAlbumAccessorSession() : ServiceFramework{"IAlbumAccessorSession"} {
explicit IAlbumAccessorSession(Core::System& system_)
: ServiceFramework{system_, "IAlbumAccessorSession"} {
// clang-format off
static const FunctionInfo functions[] = {
{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
static const FunctionInfo functions[] = {
{0, nullptr, "GetAlbumFileCount"},

View File

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

View File

@ -10,7 +10,8 @@ namespace Service::Capture {
class IAlbumControlSession final : public ServiceFramework<IAlbumControlSession> {
public:
explicit IAlbumControlSession() : ServiceFramework{"IAlbumControlSession"} {
explicit IAlbumControlSession(Core::System& system_)
: ServiceFramework{system_, "IAlbumControlSession"} {
// clang-format off
static const FunctionInfo functions[] = {
{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
static const FunctionInfo functions[] = {
{1, nullptr, "CaptureRawImage"},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,8 +12,8 @@ namespace Service::Capture {
class IAlbumAccessorApplicationSession final
: public ServiceFramework<IAlbumAccessorApplicationSession> {
public:
explicit IAlbumAccessorApplicationSession()
: ServiceFramework{"IAlbumAccessorApplicationSession"} {
explicit IAlbumAccessorApplicationSession(Core::System& system_)
: ServiceFramework{system_, "IAlbumAccessorApplicationSession"} {
// clang-format off
static const FunctionInfo functions[] = {
{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
static const FunctionInfo functions[] = {
{32, &CAPS_U::SetShimLibraryVersion, "SetShimLibraryVersion"},

View File

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