mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-27 10:47:02 +02:00
extra battery states
This commit is contained in:
parent
8b6bbee749
commit
aba37aa510
3 changed files with 30 additions and 7 deletions
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
|
|
|
|||
|
|
@ -136,10 +136,10 @@ PSM::PSM(Core::System& system_) : ServiceFramework{system_, "psm"} {
|
|||
{9, nullptr, "DisableEnoughPowerChargeEmulation"},
|
||||
{10, nullptr, "EnableFastBatteryCharging"},
|
||||
{11, nullptr, "DisableFastBatteryCharging"},
|
||||
{12, nullptr, "GetBatteryVoltageState"},
|
||||
{12, &PSM::GetBatteryVoltageState, "GetBatteryVoltageState"},
|
||||
{13, nullptr, "GetRawBatteryChargePercentage"},
|
||||
{14, nullptr, "IsEnoughPowerSupplied"},
|
||||
{15, nullptr, "GetBatteryAgePercentage"},
|
||||
{15, &PSM::GetBatteryAgePercentage, "GetBatteryAgePercentage"},
|
||||
{16, nullptr, "GetBatteryChargeInfoEvent"},
|
||||
{17, &PSM::GetBatteryChargeInfoFields, "GetBatteryChargeInfoFields"},
|
||||
{18, nullptr, "GetBatteryChargeCalibratedEvent"},
|
||||
|
|
@ -189,6 +189,20 @@ void PSM::OpenSession(HLERequestContext& ctx) {
|
|||
rb.PushIpcInterface<IPsmSession>(system);
|
||||
}
|
||||
|
||||
void PSM::GetBatteryVoltageState(HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_PTM, "(stubbed)");
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<u32>(0); //
|
||||
}
|
||||
|
||||
void PSM::GetBatteryAgePercentage(HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_PTM, "(stubbed)");
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<f64>(1.f);
|
||||
}
|
||||
|
||||
struct BatteryChargeInfoFields {
|
||||
u32 input_current_limit; //mA
|
||||
u32 boost_mode_current_limit;
|
||||
|
|
@ -200,9 +214,9 @@ struct BatteryChargeInfoFields {
|
|||
INSERT_PADDING_BYTES_NOINIT(2);
|
||||
u32 vdd50_state;
|
||||
u32 temperature_celcius;
|
||||
u32 battery_charge_percentage;
|
||||
f32 battery_charge_percentage;
|
||||
u32 battery_charge_milli_voltage;
|
||||
u32 battery_age_percentage;
|
||||
f32 battery_age_percentage;
|
||||
u32 usb_power_role;
|
||||
u32 usb_charger_type;
|
||||
u32 charger_input_voltage_limit;
|
||||
|
|
@ -214,17 +228,21 @@ struct BatteryChargeInfoFields {
|
|||
INSERT_PADDING_BYTES_NOINIT(0x14); //[+17.0.0]
|
||||
};
|
||||
static_assert(sizeof(struct BatteryChargeInfoFields) == 0x54);
|
||||
|
||||
void PSM::GetBatteryChargeInfoFields(HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_PTM, "called");
|
||||
Common::PowerStatus power_status = Common::GetPowerStatus();
|
||||
|
||||
BatteryChargeInfoFields r{};
|
||||
r.battery_charge_percentage = power_status.percentage; //100%
|
||||
r.battery_age_percentage = power_status.percentage; //100%
|
||||
r.battery_charge_percentage = f32(power_status.percentage); //100%
|
||||
r.battery_age_percentage = f32(power_status.percentage); //100%
|
||||
r.battery_charging = power_status.charging ? 1 : 0;
|
||||
r.charger_type = u32(power_status.has_battery && power_status.charging
|
||||
? ChargerType::RegularCharger : ChargerType::Unplugged);
|
||||
r.charger_input_voltage_limit = 100;
|
||||
r.charger_input_voltage_limit = 100;
|
||||
r.input_current_limit = 100;
|
||||
r.boost_mode_current_limit = 100;
|
||||
r.fast_charge_current_limit = 100;
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ private:
|
|||
void GetBatteryChargePercentage(HLERequestContext& ctx);
|
||||
void GetChargerType(HLERequestContext& ctx);
|
||||
void OpenSession(HLERequestContext& ctx);
|
||||
void GetBatteryVoltageState(HLERequestContext& ctx);
|
||||
void GetBatteryAgePercentage(HLERequestContext& ctx);
|
||||
void GetBatteryChargeInfoFields(HLERequestContext& ctx);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue