mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-28 22:17:53 -05:00
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:
@ -297,8 +297,8 @@ void NVDRV::DumpGraphicsMemoryInfo(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
NVDRV::NVDRV(std::shared_ptr<Module> nvdrv, const char* name)
|
||||
: ServiceFramework(name), nvdrv(std::move(nvdrv)) {
|
||||
NVDRV::NVDRV(Core::System& system_, std::shared_ptr<Module> nvdrv_, const char* name)
|
||||
: ServiceFramework{system_, name}, nvdrv{std::move(nvdrv_)} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &NVDRV::Open, "Open"},
|
||||
{1, &NVDRV::Ioctl1, "Ioctl"},
|
||||
|
@ -16,10 +16,10 @@ namespace Service::Nvidia {
|
||||
|
||||
class NVDRV final : public ServiceFramework<NVDRV> {
|
||||
public:
|
||||
NVDRV(std::shared_ptr<Module> nvdrv, const char* name);
|
||||
explicit NVDRV(Core::System& system_, std::shared_ptr<Module> nvdrv_, const char* name);
|
||||
~NVDRV() override;
|
||||
|
||||
void SignalGPUInterruptSyncpt(const u32 syncpoint_id, const u32 value);
|
||||
void SignalGPUInterruptSyncpt(u32 syncpoint_id, u32 value);
|
||||
|
||||
private:
|
||||
void Open(Kernel::HLERequestContext& ctx);
|
||||
|
@ -30,11 +30,11 @@ namespace Service::Nvidia {
|
||||
void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger,
|
||||
Core::System& system) {
|
||||
auto module_ = std::make_shared<Module>(system);
|
||||
std::make_shared<NVDRV>(module_, "nvdrv")->InstallAsService(service_manager);
|
||||
std::make_shared<NVDRV>(module_, "nvdrv:a")->InstallAsService(service_manager);
|
||||
std::make_shared<NVDRV>(module_, "nvdrv:s")->InstallAsService(service_manager);
|
||||
std::make_shared<NVDRV>(module_, "nvdrv:t")->InstallAsService(service_manager);
|
||||
std::make_shared<NVMEMP>()->InstallAsService(service_manager);
|
||||
std::make_shared<NVDRV>(system, module_, "nvdrv")->InstallAsService(service_manager);
|
||||
std::make_shared<NVDRV>(system, module_, "nvdrv:a")->InstallAsService(service_manager);
|
||||
std::make_shared<NVDRV>(system, module_, "nvdrv:s")->InstallAsService(service_manager);
|
||||
std::make_shared<NVDRV>(system, module_, "nvdrv:t")->InstallAsService(service_manager);
|
||||
std::make_shared<NVMEMP>(system)->InstallAsService(service_manager);
|
||||
nvflinger.SetNVDrvInstance(module_);
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ struct EventInterface {
|
||||
|
||||
class Module final {
|
||||
public:
|
||||
Module(Core::System& system);
|
||||
explicit Module(Core::System& system_);
|
||||
~Module();
|
||||
|
||||
/// Returns a pointer to one of the available devices, identified by its name.
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
namespace Service::Nvidia {
|
||||
|
||||
NVMEMP::NVMEMP() : ServiceFramework("nvmemp") {
|
||||
NVMEMP::NVMEMP(Core::System& system_) : ServiceFramework{system_, "nvmemp"} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &NVMEMP::Open, "Open"},
|
||||
{1, &NVMEMP::GetAruid, "GetAruid"},
|
||||
|
@ -6,11 +6,15 @@
|
||||
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Service::Nvidia {
|
||||
|
||||
class NVMEMP final : public ServiceFramework<NVMEMP> {
|
||||
public:
|
||||
NVMEMP();
|
||||
explicit NVMEMP(Core::System& system_);
|
||||
~NVMEMP() override;
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user