diff options
| author | 2018-10-22 15:27:05 -0400 | |
|---|---|---|
| committer | 2018-10-22 15:27:05 -0400 | |
| commit | ff6b2d457499156584ef51fb6025d2b3958e3aa5 (patch) | |
| tree | 9143e12cc81e8a672cd91d00163a22877f546411 | |
| parent | Merge pull request #1541 from lioncash/define (diff) | |
| parent | psm: Stub GetChargerType (diff) | |
| download | yuzu-ff6b2d457499156584ef51fb6025d2b3958e3aa5.tar.gz yuzu-ff6b2d457499156584ef51fb6025d2b3958e3aa5.tar.xz yuzu-ff6b2d457499156584ef51fb6025d2b3958e3aa5.zip | |
Merge pull request #1545 from DarkLordZach/psm
psm: Add psm service and stub commands 0 and 1
Diffstat (limited to '')
| -rw-r--r-- | src/common/logging/log.h | 1 | ||||
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/hle/service/ptm/psm.cpp | 71 | ||||
| -rw-r--r-- | src/core/hle/service/ptm/psm.h | 15 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 2 |
5 files changed, 91 insertions, 0 deletions
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index abbd056ee..c9161155a 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h | |||
| @@ -91,6 +91,7 @@ enum class Class : ClassType { | |||
| 91 | Service_PM, ///< The PM service | 91 | Service_PM, ///< The PM service |
| 92 | Service_PREPO, ///< The PREPO (Play report) service | 92 | Service_PREPO, ///< The PREPO (Play report) service |
| 93 | Service_PSC, ///< The PSC service | 93 | Service_PSC, ///< The PSC service |
| 94 | Service_PSM, ///< The PSM service | ||
| 94 | Service_SET, ///< The SET (Settings) service | 95 | Service_SET, ///< The SET (Settings) service |
| 95 | Service_SM, ///< The SM (Service manager) service | 96 | Service_SM, ///< The SM (Service manager) service |
| 96 | Service_SPL, ///< The SPL service | 97 | Service_SPL, ///< The SPL service |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 9b1cfae42..64fdf38cd 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -331,6 +331,8 @@ add_library(core STATIC | |||
| 331 | hle/service/prepo/prepo.h | 331 | hle/service/prepo/prepo.h |
| 332 | hle/service/psc/psc.cpp | 332 | hle/service/psc/psc.cpp |
| 333 | hle/service/psc/psc.h | 333 | hle/service/psc/psc.h |
| 334 | hle/service/ptm/psm.cpp | ||
| 335 | hle/service/ptm/psm.h | ||
| 334 | hle/service/service.cpp | 336 | hle/service/service.cpp |
| 335 | hle/service/service.h | 337 | hle/service/service.h |
| 336 | hle/service/set/set.cpp | 338 | hle/service/set/set.cpp |
diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cpp new file mode 100644 index 000000000..c2d5fda94 --- /dev/null +++ b/src/core/hle/service/ptm/psm.cpp | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <memory> | ||
| 6 | |||
| 7 | #include "common/logging/log.h" | ||
| 8 | #include "core/hle/ipc_helpers.h" | ||
| 9 | #include "core/hle/service/ptm/psm.h" | ||
| 10 | #include "core/hle/service/service.h" | ||
| 11 | #include "core/hle/service/sm/sm.h" | ||
| 12 | |||
| 13 | namespace Service::PSM { | ||
| 14 | |||
| 15 | constexpr u32 BATTERY_FULLY_CHARGED = 100; // 100% Full | ||
| 16 | constexpr u32 BATTERY_CURRENTLY_CHARGING = 1; // Plugged into an official dock | ||
| 17 | |||
| 18 | class PSM final : public ServiceFramework<PSM> { | ||
| 19 | public: | ||
| 20 | explicit PSM() : ServiceFramework{"psm"} { | ||
| 21 | // clang-format off | ||
| 22 | static const FunctionInfo functions[] = { | ||
| 23 | {0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"}, | ||
| 24 | {1, &PSM::GetChargerType, "GetChargerType"}, | ||
| 25 | {2, nullptr, "EnableBatteryCharging"}, | ||
| 26 | {3, nullptr, "DisableBatteryCharging"}, | ||
| 27 | {4, nullptr, "IsBatteryChargingEnabled"}, | ||
| 28 | {5, nullptr, "AcquireControllerPowerSupply"}, | ||
| 29 | {6, nullptr, "ReleaseControllerPowerSupply"}, | ||
| 30 | {7, nullptr, "OpenSession"}, | ||
| 31 | {8, nullptr, "EnableEnoughPowerChargeEmulation"}, | ||
| 32 | {9, nullptr, "DisableEnoughPowerChargeEmulation"}, | ||
| 33 | {10, nullptr, "EnableFastBatteryCharging"}, | ||
| 34 | {11, nullptr, "DisableFastBatteryCharging"}, | ||
| 35 | {12, nullptr, "GetBatteryVoltageState"}, | ||
| 36 | {13, nullptr, "GetRawBatteryChargePercentage"}, | ||
| 37 | {14, nullptr, "IsEnoughPowerSupplied"}, | ||
| 38 | {15, nullptr, "GetBatteryAgePercentage"}, | ||
| 39 | {16, nullptr, "GetBatteryChargeInfoEvent"}, | ||
| 40 | {17, nullptr, "GetBatteryChargeInfoFields"}, | ||
| 41 | }; | ||
| 42 | // clang-format on | ||
| 43 | |||
| 44 | RegisterHandlers(functions); | ||
| 45 | } | ||
| 46 | |||
| 47 | ~PSM() override = default; | ||
| 48 | |||
| 49 | private: | ||
| 50 | void GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) { | ||
| 51 | LOG_WARNING(Service_PSM, "(STUBBED) called"); | ||
| 52 | |||
| 53 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 54 | rb.Push(RESULT_SUCCESS); | ||
| 55 | rb.Push<u32>(BATTERY_FULLY_CHARGED); | ||
| 56 | } | ||
| 57 | |||
| 58 | void GetChargerType(Kernel::HLERequestContext& ctx) { | ||
| 59 | LOG_WARNING(Service_PSM, "(STUBBED) called"); | ||
| 60 | |||
| 61 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 62 | rb.Push(RESULT_SUCCESS); | ||
| 63 | rb.Push<u32>(BATTERY_CURRENTLY_CHARGING); | ||
| 64 | } | ||
| 65 | }; | ||
| 66 | |||
| 67 | void InstallInterfaces(SM::ServiceManager& sm) { | ||
| 68 | std::make_shared<PSM>()->InstallAsService(sm); | ||
| 69 | } | ||
| 70 | |||
| 71 | } // namespace Service::PSM | ||
diff --git a/src/core/hle/service/ptm/psm.h b/src/core/hle/service/ptm/psm.h new file mode 100644 index 000000000..a286793ae --- /dev/null +++ b/src/core/hle/service/ptm/psm.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | namespace Service::SM { | ||
| 8 | class ServiceManager; | ||
| 9 | } | ||
| 10 | |||
| 11 | namespace Service::PSM { | ||
| 12 | |||
| 13 | void InstallInterfaces(SM::ServiceManager& sm); | ||
| 14 | |||
| 15 | } // namespace Service::PSM | ||
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index dd6c6d3b3..a4cf45267 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -58,6 +58,7 @@ | |||
| 58 | #include "core/hle/service/pm/pm.h" | 58 | #include "core/hle/service/pm/pm.h" |
| 59 | #include "core/hle/service/prepo/prepo.h" | 59 | #include "core/hle/service/prepo/prepo.h" |
| 60 | #include "core/hle/service/psc/psc.h" | 60 | #include "core/hle/service/psc/psc.h" |
| 61 | #include "core/hle/service/ptm/psm.h" | ||
| 61 | #include "core/hle/service/service.h" | 62 | #include "core/hle/service/service.h" |
| 62 | #include "core/hle/service/set/settings.h" | 63 | #include "core/hle/service/set/settings.h" |
| 63 | #include "core/hle/service/sm/sm.h" | 64 | #include "core/hle/service/sm/sm.h" |
| @@ -246,6 +247,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm, FileSys::VfsFilesystem& vfs) | |||
| 246 | PlayReport::InstallInterfaces(*sm); | 247 | PlayReport::InstallInterfaces(*sm); |
| 247 | PM::InstallInterfaces(*sm); | 248 | PM::InstallInterfaces(*sm); |
| 248 | PSC::InstallInterfaces(*sm); | 249 | PSC::InstallInterfaces(*sm); |
| 250 | PSM::InstallInterfaces(*sm); | ||
| 249 | Set::InstallInterfaces(*sm); | 251 | Set::InstallInterfaces(*sm); |
| 250 | Sockets::InstallInterfaces(*sm); | 252 | Sockets::InstallInterfaces(*sm); |
| 251 | SPL::InstallInterfaces(*sm); | 253 | SPL::InstallInterfaces(*sm); |