diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/core/hle/service/es/es.cpp | 57 | ||||
-rw-r--r-- | src/core/hle/service/es/es.h | 16 | ||||
-rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.cpp | 10 | ||||
-rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.h | 2 | ||||
-rw-r--r-- | src/core/hle/service/pm/pm.cpp | 70 | ||||
-rw-r--r-- | src/core/hle/service/pm/pm.h | 16 | ||||
-rw-r--r-- | src/core/hle/service/service.cpp | 4 |
8 files changed, 174 insertions, 5 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index f50aa4c60..96e619167 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -136,6 +136,8 @@ add_library(core STATIC hle/service/bcat/bcat.h hle/service/bcat/module.cpp hle/service/bcat/module.h + hle/service/es/es.cpp + hle/service/es/es.h hle/service/fatal/fatal.cpp hle/service/fatal/fatal.h hle/service/fatal/fatal_p.cpp @@ -195,6 +197,8 @@ add_library(core STATIC hle/service/pctl/module.h hle/service/pctl/pctl.cpp hle/service/pctl/pctl.h + hle/service/pm/pm.cpp + hle/service/pm/pm.h hle/service/prepo/prepo.cpp hle/service/prepo/prepo.h hle/service/service.cpp diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp new file mode 100644 index 000000000..d40f18565 --- /dev/null +++ b/src/core/hle/service/es/es.cpp @@ -0,0 +1,57 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/service.h" + +namespace Service::ES { + +class ETicket final : public ServiceFramework<ETicket> { +public: + explicit ETicket() : ServiceFramework{"es"} { + static const FunctionInfo functions[] = { + {1, nullptr, "ImportTicket"}, + {2, nullptr, "ImportTicketCertificateSet"}, + {3, nullptr, "DeleteTicket"}, + {4, nullptr, "DeletePersonalizedTicket"}, + {5, nullptr, "DeleteAllCommonTicket"}, + {6, nullptr, "DeleteAllPersonalizedTicket"}, + {7, nullptr, "DeleteAllPersonalizedTicketEx"}, + {8, nullptr, "GetTitleKey"}, + {9, nullptr, "CountCommonTicket"}, + {10, nullptr, "CountPersonalizedTicket"}, + {11, nullptr, "ListCommonTicket"}, + {12, nullptr, "ListPersonalizedTicket"}, + {13, nullptr, "ListMissingPersonalizedTicket"}, + {14, nullptr, "GetCommonTicketSize"}, + {15, nullptr, "GetPersonalizedTicketSize"}, + {16, nullptr, "GetCommonTicketData"}, + {17, nullptr, "GetPersonalizedTicketData"}, + {18, nullptr, "OwnTicket"}, + {19, nullptr, "GetTicketInfo"}, + {20, nullptr, "ListLightTicketInfo"}, + {21, nullptr, "SignData"}, + {22, nullptr, "GetCommonTicketAndCertificateSize"}, + {23, nullptr, "GetCommonTicketAndCertificateData"}, + {24, nullptr, "ImportPrepurchaseRecord"}, + {25, nullptr, "DeletePrepurchaseRecord"}, + {26, nullptr, "DeleteAllPrepurchaseRecord"}, + {27, nullptr, "CountPrepurchaseRecord"}, + {28, nullptr, "ListPrepurchaseRecord"}, + {29, nullptr, "ListPrepurchaseRecordInfo"}, + {30, nullptr, "Unknown1"}, + {31, nullptr, "Unknown2"}, + {32, nullptr, "Unknown3"}, + {33, nullptr, "Unknown4"}, + {34, nullptr, "Unknown5"}, + {35, nullptr, "Unknown6"}, + }; + RegisterHandlers(functions); + } +}; + +void InstallInterfaces(SM::ServiceManager& service_manager) { + std::make_shared<ETicket>()->InstallAsService(service_manager); +} + +} // namespace Service::ES diff --git a/src/core/hle/service/es/es.h b/src/core/hle/service/es/es.h new file mode 100644 index 000000000..afe70465b --- /dev/null +++ b/src/core/hle/service/es/es.h @@ -0,0 +1,16 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +namespace Service::SM { +class ServiceManager; +} + +namespace Service::ES { + +/// Registers all ES services with the specified service manager. +void InstallInterfaces(SM::ServiceManager& service_manager); + +} // namespace Service::ES diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index cc5cfe34e..1555ea806 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <utility> + #include "core/hle/ipc_helpers.h" #include "core/hle/service/nvdrv/devices/nvdevice.h" #include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" @@ -40,14 +42,14 @@ Module::Module() { devices["/dev/nvhost-nvdec"] = std::make_shared<Devices::nvhost_nvdec>(); } -u32 Module::Open(std::string device_name) { +u32 Module::Open(const std::string& device_name) { ASSERT_MSG(devices.find(device_name) != devices.end(), "Trying to open unknown device {}", device_name); auto device = devices[device_name]; - u32 fd = next_fd++; + const u32 fd = next_fd++; - open_files[fd] = device; + open_files[fd] = std::move(device); return fd; } @@ -56,7 +58,7 @@ u32 Module::Ioctl(u32 fd, u32_le command, const std::vector<u8>& input, std::vec auto itr = open_files.find(fd); ASSERT_MSG(itr != open_files.end(), "Tried to talk to an invalid device"); - auto device = itr->second; + auto& device = itr->second; return device->ioctl({command}, input, output); } diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index 35b2c65fc..184f3c9fc 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h @@ -38,7 +38,7 @@ public: } /// Opens a device node and returns a file descriptor to it. - u32 Open(std::string device_name); + u32 Open(const std::string& device_name); /// Sends an ioctl command to the specified file descriptor. u32 Ioctl(u32 fd, u32 command, const std::vector<u8>& input, std::vector<u8>& output); /// Closes a device file descriptor and returns operation success. diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp new file mode 100644 index 000000000..e20a25689 --- /dev/null +++ b/src/core/hle/service/pm/pm.cpp @@ -0,0 +1,70 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/service.h" + +namespace Service::PM { + +class BootMode final : public ServiceFramework<BootMode> { +public: + explicit BootMode() : ServiceFramework{"pm:bm"} { + static const FunctionInfo functions[] = { + {0, nullptr, "GetBootMode"}, + {1, nullptr, "SetMaintenanceBoot"}, + }; + RegisterHandlers(functions); + } +}; + +class DebugMonitor final : public ServiceFramework<DebugMonitor> { +public: + explicit DebugMonitor() : ServiceFramework{"pm:dmnt"} { + static const FunctionInfo functions[] = { + {0, nullptr, "IsDebugMode"}, + {1, nullptr, "GetDebugProcesses"}, + {2, nullptr, "StartDebugProcess"}, + {3, nullptr, "GetTitlePid"}, + {4, nullptr, "EnableDebugForTitleId"}, + {5, nullptr, "GetApplicationPid"}, + {6, nullptr, "EnableDebugForApplication"}, + }; + RegisterHandlers(functions); + } +}; + +class Info final : public ServiceFramework<Info> { +public: + explicit Info() : ServiceFramework{"pm:info"} { + static const FunctionInfo functions[] = { + {0, nullptr, "GetTitleId"}, + }; + RegisterHandlers(functions); + } +}; + +class Shell final : public ServiceFramework<Shell> { +public: + explicit Shell() : ServiceFramework{"pm:shell"} { + static const FunctionInfo functions[] = { + {0, nullptr, "LaunchProcess"}, + {1, nullptr, "TerminateProcessByPid"}, + {2, nullptr, "TerminateProcessByTitleId"}, + {3, nullptr, "GetProcessEventWaiter"}, + {4, nullptr, "GetProcessEventType"}, + {5, nullptr, "NotifyBootFinished"}, + {6, nullptr, "GetApplicationPid"}, + {7, nullptr, "BoostSystemMemoryResourceLimit"}, + }; + RegisterHandlers(functions); + } +}; + +void InstallInterfaces(SM::ServiceManager& sm) { + std::make_shared<BootMode>()->InstallAsService(sm); + std::make_shared<DebugMonitor>()->InstallAsService(sm); + std::make_shared<Info>()->InstallAsService(sm); + std::make_shared<Shell>()->InstallAsService(sm); +} + +} // namespace Service::PM diff --git a/src/core/hle/service/pm/pm.h b/src/core/hle/service/pm/pm.h new file mode 100644 index 000000000..9fc19fed6 --- /dev/null +++ b/src/core/hle/service/pm/pm.h @@ -0,0 +1,16 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +namespace Service::SM { +class ServiceManager; +} + +namespace Service::PM { + +/// Registers all PM services with the specified service manager. +void InstallInterfaces(SM::ServiceManager& service_manager); + +} // namespace Service::PM diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 0d036bfaa..4daf13fa3 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -21,6 +21,7 @@ #include "core/hle/service/apm/apm.h" #include "core/hle/service/audio/audio.h" #include "core/hle/service/bcat/bcat.h" +#include "core/hle/service/es/es.h" #include "core/hle/service/fatal/fatal.h" #include "core/hle/service/filesystem/filesystem.h" #include "core/hle/service/friend/friend.h" @@ -32,6 +33,7 @@ #include "core/hle/service/ns/ns.h" #include "core/hle/service/nvdrv/nvdrv.h" #include "core/hle/service/pctl/pctl.h" +#include "core/hle/service/pm/pm.h" #include "core/hle/service/prepo/prepo.h" #include "core/hle/service/service.h" #include "core/hle/service/set/settings.h" @@ -187,6 +189,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) { APM::InstallInterfaces(*sm); BCAT::InstallInterfaces(*sm); Audio::InstallInterfaces(*sm); + ES::InstallInterfaces(*sm); Fatal::InstallInterfaces(*sm); FileSystem::InstallInterfaces(*sm); Friend::InstallInterfaces(*sm); @@ -199,6 +202,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) { Nvidia::InstallInterfaces(*sm); PCTL::InstallInterfaces(*sm); PlayReport::InstallInterfaces(*sm); + PM::InstallInterfaces(*sm); Sockets::InstallInterfaces(*sm); SPL::InstallInterfaces(*sm); SSL::InstallInterfaces(*sm); |