psc: rewrite IPmService

This commit is contained in:
Liam 2024-02-21 21:57:18 -05:00
parent 6c2d6cff19
commit 352297d361
2 changed files with 9 additions and 8 deletions

View File

@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/ipc_helpers.h" #include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/psc/pm_module.h" #include "core/hle/service/psc/pm_module.h"
#include "core/hle/service/psc/pm_service.h" #include "core/hle/service/psc/pm_service.h"
@ -10,7 +10,7 @@ namespace Service::PSC {
IPmService::IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m"} { IPmService::IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IPmService::GetPmModule, "GetPmModule"}, {0, D<&IPmService::GetPmModule>, "GetPmModule"},
}; };
// clang-format on // clang-format on
@ -19,12 +19,10 @@ IPmService::IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m
IPmService::~IPmService() = default; IPmService::~IPmService() = default;
void IPmService::GetPmModule(HLERequestContext& ctx) { Result IPmService::GetPmModule(Out<SharedPointer<IPmModule>> out_module) {
LOG_DEBUG(Service_PSC, "called"); LOG_DEBUG(Service_PSC, "called");
*out_module = std::make_shared<IPmModule>(system);
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; R_SUCCEED();
rb.Push(ResultSuccess);
rb.PushIpcInterface<IPmModule>(system);
} }
} // namespace Service::PSC } // namespace Service::PSC

View File

@ -3,17 +3,20 @@
#pragma once #pragma once
#include "core/hle/service/cmif_types.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Service::PSC { namespace Service::PSC {
class IPmModule;
class IPmService final : public ServiceFramework<IPmService> { class IPmService final : public ServiceFramework<IPmService> {
public: public:
explicit IPmService(Core::System& system_); explicit IPmService(Core::System& system_);
~IPmService() override; ~IPmService() override;
private: private:
void GetPmModule(HLERequestContext& ctx); Result GetPmModule(Out<SharedPointer<IPmModule>> out_module);
}; };
} // namespace Service::PSC } // namespace Service::PSC