Deglobalize System: IRS

This commit is contained in:
David Marcec 2019-09-21 18:49:44 +10:00
parent 28181919a6
commit 07823b61a1
3 changed files with 6 additions and 5 deletions

View File

@ -1061,7 +1061,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system
std::make_shared<HidSys>()->InstallAsService(service_manager); std::make_shared<HidSys>()->InstallAsService(service_manager);
std::make_shared<HidTmp>()->InstallAsService(service_manager); std::make_shared<HidTmp>()->InstallAsService(service_manager);
std::make_shared<IRS>()->InstallAsService(service_manager); std::make_shared<IRS>(system)->InstallAsService(service_manager);
std::make_shared<IRS_SYS>()->InstallAsService(service_manager); std::make_shared<IRS_SYS>()->InstallAsService(service_manager);
std::make_shared<XCD_SYS>()->InstallAsService(service_manager); std::make_shared<XCD_SYS>()->InstallAsService(service_manager);

View File

@ -11,7 +11,7 @@
namespace Service::HID { namespace Service::HID {
IRS::IRS() : ServiceFramework{"irs"} { IRS::IRS(Core::System& system) : ServiceFramework{"irs"}, system(system) {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{302, &IRS::ActivateIrsensor, "ActivateIrsensor"}, {302, &IRS::ActivateIrsensor, "ActivateIrsensor"},
@ -37,7 +37,7 @@ IRS::IRS() : ServiceFramework{"irs"} {
RegisterHandlers(functions); RegisterHandlers(functions);
auto& kernel = Core::System::GetInstance().Kernel(); auto& kernel = system.Kernel();
shared_mem = Kernel::SharedMemory::Create( shared_mem = Kernel::SharedMemory::Create(
kernel, nullptr, 0x8000, Kernel::MemoryPermission::ReadWrite, kernel, nullptr, 0x8000, Kernel::MemoryPermission::ReadWrite,
Kernel::MemoryPermission::Read, 0, Kernel::MemoryRegion::BASE, "IRS:SharedMemory"); Kernel::MemoryPermission::Read, 0, Kernel::MemoryRegion::BASE, "IRS:SharedMemory");
@ -98,7 +98,7 @@ void IRS::GetImageTransferProcessorState(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 5}; IPC::ResponseBuilder rb{ctx, 5};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushRaw<u64>(Core::System::GetInstance().CoreTiming().GetTicks()); rb.PushRaw<u64>(system.CoreTiming().GetTicks());
rb.PushRaw<u32>(0); rb.PushRaw<u32>(0);
} }

View File

@ -15,7 +15,7 @@ namespace Service::HID {
class IRS final : public ServiceFramework<IRS> { class IRS final : public ServiceFramework<IRS> {
public: public:
explicit IRS(); explicit IRS(Core::System& system);
~IRS() override; ~IRS() override;
private: private:
@ -39,6 +39,7 @@ private:
void ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx); void ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx);
Kernel::SharedPtr<Kernel::SharedMemory> shared_mem; Kernel::SharedPtr<Kernel::SharedMemory> shared_mem;
const u32 device_handle{0xABCD}; const u32 device_handle{0xABCD};
Core::System& system;
}; };
class IRS_SYS final : public ServiceFramework<IRS_SYS> { class IRS_SYS final : public ServiceFramework<IRS_SYS> {