yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

psm: Stub GetBatteryChargePercentage

Used by LovePotion Lua Homebrew. Stubbed to return 100% charge.
This commit is contained in:
Zach Hilman 2018-10-20 17:23:43 -04:00
parent 3b8c0f8885
commit 10a2d20e26
2 changed files with 14 additions and 1 deletions

View File

@ -12,10 +12,12 @@
namespace Service::PSM { namespace Service::PSM {
constexpr u32 BATTERY_FULLY_CHARGED = 100; // 100% Full
PSM::PSM() : ServiceFramework{"psm"} { PSM::PSM() : ServiceFramework{"psm"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetBatteryChargePercentage"}, {0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"},
{1, nullptr, "GetChargerType"}, {1, nullptr, "GetChargerType"},
{2, nullptr, "EnableBatteryCharging"}, {2, nullptr, "EnableBatteryCharging"},
{3, nullptr, "DisableBatteryCharging"}, {3, nullptr, "DisableBatteryCharging"},
@ -41,6 +43,14 @@ PSM::PSM() : ServiceFramework{"psm"} {
PSM::~PSM() = default; PSM::~PSM() = default;
void PSM::GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_PSM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(BATTERY_FULLY_CHARGED);
}
void InstallInterfaces(SM::ServiceManager& sm) { void InstallInterfaces(SM::ServiceManager& sm) {
std::make_shared<PSM>()->InstallAsService(sm); std::make_shared<PSM>()->InstallAsService(sm);
} }

View File

@ -15,6 +15,9 @@ class PSM final : public ServiceFramework<PSM> {
public: public:
explicit PSM(); explicit PSM();
~PSM() override; ~PSM() override;
private:
void GetBatteryChargePercentage(Kernel::HLERequestContext& ctx);
}; };
void InstallInterfaces(SM::ServiceManager& sm); void InstallInterfaces(SM::ServiceManager& sm);