diff options
author | Liam <byteslice@airmail.cc> | 2023-10-20 19:29:15 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-10-20 19:29:32 +0200 |
commit | 2b85e9e997a48714bfa2eca2878ec1f71ca95afe (patch) | |
tree | 8029bfae67e2d712e8736c6d938feba26b4d66ee /src | |
parent | Merge pull request #11748 from liamwhite/kern_1700 (diff) | |
download | yuzu-2b85e9e997a48714bfa2eca2878ec1f71ca95afe.tar yuzu-2b85e9e997a48714bfa2eca2878ec1f71ca95afe.tar.gz yuzu-2b85e9e997a48714bfa2eca2878ec1f71ca95afe.tar.bz2 yuzu-2b85e9e997a48714bfa2eca2878ec1f71ca95afe.tar.lz yuzu-2b85e9e997a48714bfa2eca2878ec1f71ca95afe.tar.xz yuzu-2b85e9e997a48714bfa2eca2878ec1f71ca95afe.tar.zst yuzu-2b85e9e997a48714bfa2eca2878ec1f71ca95afe.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/hle/service/ptm/ts.cpp | 40 | ||||
-rw-r--r-- | src/core/hle/service/ptm/ts.h | 6 |
2 files changed, 40 insertions, 6 deletions
diff --git a/src/core/hle/service/ptm/ts.cpp b/src/core/hle/service/ptm/ts.cpp index ca064dd90..652f38b97 100644 --- a/src/core/hle/service/ptm/ts.cpp +++ b/src/core/hle/service/ptm/ts.cpp @@ -9,6 +9,35 @@ namespace Service::PTM { +enum class Location : u8 { + Internal, + External, +}; + +class ISession : public ServiceFramework<ISession> { +public: + explicit ISession(Core::System& system_) : ServiceFramework{system_, "ISession"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetTemperatureRange"}, + {2, nullptr, "SetMeasurementMode"}, + {4, &ISession::GetTemperature, "GetTemperature"}, + }; + // clang-format on + + RegisterHandlers(functions); + } + +private: + void GetTemperature(HLERequestContext& ctx) { + constexpr f32 temperature = 35; + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(temperature); + } +}; + TS::TS(Core::System& system_) : ServiceFramework{system_, "ts"} { // clang-format off static const FunctionInfo functions[] = { @@ -16,7 +45,7 @@ TS::TS(Core::System& system_) : ServiceFramework{system_, "ts"} { {1, &TS::GetTemperature, "GetTemperature"}, {2, nullptr, "SetMeasurementMode"}, {3, &TS::GetTemperatureMilliC, "GetTemperatureMilliC"}, - {4, nullptr, "OpenSession"}, + {4, &TS::OpenSession, "OpenSession"}, }; // clang-format on @@ -47,4 +76,13 @@ void TS::GetTemperatureMilliC(HLERequestContext& ctx) { rb.Push(temperature); } +void TS::OpenSession(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + [[maybe_unused]] const u32 device_code = rp.Pop<u32>(); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface<ISession>(system); +} + } // namespace Service::PTM diff --git a/src/core/hle/service/ptm/ts.h b/src/core/hle/service/ptm/ts.h index c3f43d5a3..a10a91a64 100644 --- a/src/core/hle/service/ptm/ts.h +++ b/src/core/hle/service/ptm/ts.h @@ -14,13 +14,9 @@ public: ~TS() override; private: - enum class Location : u8 { - Internal, - External, - }; - void GetTemperature(HLERequestContext& ctx); void GetTemperatureMilliC(HLERequestContext& ctx); + void OpenSession(HLERequestContext& ctx); }; } // namespace Service::PTM |