mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
psm: Stub GetChargerType
Used by LovePotion Lua Homebrew. Stubbed as connected to official Nintendo Switch dock.
This commit is contained in:
parent
10a2d20e26
commit
314a948373
2 changed files with 27 additions and 24 deletions
|
@ -13,12 +13,15 @@
|
||||||
namespace Service::PSM {
|
namespace Service::PSM {
|
||||||
|
|
||||||
constexpr u32 BATTERY_FULLY_CHARGED = 100; // 100% Full
|
constexpr u32 BATTERY_FULLY_CHARGED = 100; // 100% Full
|
||||||
|
constexpr u32 BATTERY_CURRENTLY_CHARGING = 1; // Plugged into an official dock
|
||||||
|
|
||||||
PSM::PSM() : ServiceFramework{"psm"} {
|
class PSM final : public ServiceFramework<PSM> {
|
||||||
|
public:
|
||||||
|
explicit PSM() : ServiceFramework{"psm"} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"},
|
{0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"},
|
||||||
{1, nullptr, "GetChargerType"},
|
{1, &PSM::GetChargerType, "GetChargerType"},
|
||||||
{2, nullptr, "EnableBatteryCharging"},
|
{2, nullptr, "EnableBatteryCharging"},
|
||||||
{3, nullptr, "DisableBatteryCharging"},
|
{3, nullptr, "DisableBatteryCharging"},
|
||||||
{4, nullptr, "IsBatteryChargingEnabled"},
|
{4, nullptr, "IsBatteryChargingEnabled"},
|
||||||
|
@ -41,9 +44,10 @@ PSM::PSM() : ServiceFramework{"psm"} {
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
PSM::~PSM() = default;
|
~PSM() override = default;
|
||||||
|
|
||||||
void PSM::GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) {
|
private:
|
||||||
|
void GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_PSM, "(STUBBED) called");
|
LOG_WARNING(Service_PSM, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
@ -51,6 +55,15 @@ void PSM::GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push<u32>(BATTERY_FULLY_CHARGED);
|
rb.Push<u32>(BATTERY_FULLY_CHARGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetChargerType(Kernel::HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service_PSM, "(STUBBED) called");
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.Push<u32>(BATTERY_CURRENTLY_CHARGING);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm) {
|
void InstallInterfaces(SM::ServiceManager& sm) {
|
||||||
std::make_shared<PSM>()->InstallAsService(sm);
|
std::make_shared<PSM>()->InstallAsService(sm);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "core/hle/service/service.h"
|
|
||||||
|
|
||||||
namespace Service::SM {
|
namespace Service::SM {
|
||||||
class ServiceManager;
|
class ServiceManager;
|
||||||
|
@ -11,15 +10,6 @@ class ServiceManager;
|
||||||
|
|
||||||
namespace Service::PSM {
|
namespace Service::PSM {
|
||||||
|
|
||||||
class PSM final : public ServiceFramework<PSM> {
|
|
||||||
public:
|
|
||||||
explicit PSM();
|
|
||||||
~PSM() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void GetBatteryChargePercentage(Kernel::HLERequestContext& ctx);
|
|
||||||
};
|
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm);
|
void InstallInterfaces(SM::ServiceManager& sm);
|
||||||
|
|
||||||
} // namespace Service::PSM
|
} // namespace Service::PSM
|
||||||
|
|
Loading…
Reference in a new issue