From d382c6bab91a8ab6ed453f8d87f0db9eff3fdc8e Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sun, 28 Jun 2020 13:11:20 -0500 Subject: WiimoteCommon: Tweak battery level math. --- Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.cpp | 5 ++--- Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface') diff --git a/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.cpp b/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.cpp index 059138e52a..3ff61621d8 100644 --- a/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.cpp @@ -288,8 +288,7 @@ Device::Device(std::unique_ptr wiimote) : m_wiimote(std::m AddInput(new AnalogInput(&m_classic_state.triggers[1], classic_prefix + "R-Analog", 1.f)); // Specialty inputs: - AddInput(new UndetectableAnalogInput( - &m_battery, "Battery", WiimoteCommon::MAX_BATTERY_LEVEL / ciface::BATTERY_INPUT_MAX_VALUE)); + AddInput(new UndetectableAnalogInput(&m_battery, "Battery", 1.f)); AddInput(new UndetectableAnalogInput( &m_extension_number_input, "Attached Extension", WiimoteEmu::ExtensionNumber(1))); AddInput(new UndetectableAnalogInput(&m_mplus_attached_input, "Attached MotionPlus", 1)); @@ -1550,7 +1549,7 @@ void Device::ProcessStatusReport(const InputReportStatus& status) // Update status periodically to keep battery level value up to date. m_status_outdated_time = Clock::now() + std::chrono::seconds(10); - m_battery = status.battery; + m_battery = status.GetEstimatedCharge() * BATTERY_INPUT_MAX_VALUE; m_leds = status.leds; if (!status.ir) diff --git a/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.h b/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.h index 75296c65b1..87165faff4 100644 --- a/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.h +++ b/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.h @@ -233,7 +233,7 @@ private: // Status report is requested every so often to update the battery level. Clock::time_point m_status_outdated_time = Clock::now(); - u8 m_battery = 0; + float m_battery = 0; u8 m_leds = 0; bool m_speaker_configured = false; -- cgit v1.2.3