WiimoteEmu: Fix battery level handling and remove old comments.
This commit is contained in:
parent
6c0902ab0a
commit
3945aa6242
|
@ -225,14 +225,18 @@ void Wiimote::HandleRequestStatus(const OutputReportRequestStatus&)
|
|||
// Update status struct
|
||||
m_status.extension = m_extension_port.IsDeviceConnected();
|
||||
|
||||
// TODO: Battery level will break determinism in TAS/Netplay
|
||||
// Based on testing, old WiiLi.org docs, and WiiUse library:
|
||||
// Max battery level seems to be 0xc8 (decimal 200)
|
||||
constexpr u8 MAX_BATTERY_LEVEL = 0xc8;
|
||||
|
||||
m_status.battery = (u8)(m_battery_setting->GetValue() * MAX_BATTERY_LEVEL);
|
||||
|
||||
if (Core::WantsDeterminism())
|
||||
{
|
||||
// One less thing to break determinism:
|
||||
m_status.battery = MAX_BATTERY_LEVEL;
|
||||
}
|
||||
|
||||
// Battery levels in voltage
|
||||
// 0x00 - 0x32: level 1
|
||||
// 0x33 - 0x43: level 2
|
||||
// 0x33 - 0x54: level 3
|
||||
// 0x55 - 0xff: level 4
|
||||
m_status.battery = (u8)(m_battery_setting->GetValue() * 0xff);
|
||||
// Less than 0x20 triggers the low-battery flag:
|
||||
m_status.battery_low = m_status.battery < 0x20;
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ Wiimote::Wiimote(const unsigned int index) : m_index(index)
|
|||
m_options->numeric_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::NumericSetting>(_trans("Speaker Pan"), 0, -127, 127));
|
||||
m_options->numeric_settings.emplace_back(
|
||||
m_battery_setting = new ControllerEmu::NumericSetting(_trans("Battery"), 95.0 / 100, 0, 255));
|
||||
m_battery_setting = new ControllerEmu::NumericSetting(_trans("Battery"), 95.0 / 100, 0, 100));
|
||||
|
||||
// hotkeys
|
||||
groups.emplace_back(m_hotkeys = new ControllerEmu::ModifySettingsButton(_trans("Hotkeys")));
|
||||
|
|
Loading…
Reference in New Issue