diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2019-01-04 18:18:44 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2019-02-02 19:40:31 -0600 |
| commit | 3945aa624203c2e82160ef7fd045ab74fa47ca95 (patch) | |
| tree | 5a403d33169b53d434898206067176e68c9b99ae /Source/Core | |
| parent | 6c0902ab0a92abe807c201bbd4b1ef912931a17f (diff) | |
WiimoteEmu: Fix battery level handling and remove old comments.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp | 20 | ||||
| -rw-r--r-- | Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp index 30a5fa1efc..f989d70576 100644 --- a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp @@ -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 - - // 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); + // 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; + } + // Less than 0x20 triggers the low-battery flag: m_status.battery_low = m_status.battery < 0x20; diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp index 2dcf99a898..cd2b10347c 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp @@ -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"))); |
