From 67c97a0bf26b4272632e3aaaab43fd571f0cfe70 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Wed, 7 Sep 2022 21:06:26 +0200 Subject: [PATCH] WGInput: Work around crash with Steam overlay. --- .../InputCommon/ControllerInterface/WGInput/WGInput.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp b/Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp index 414d246069..fc6441bb8d 100644 --- a/Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp +++ b/Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp @@ -544,8 +544,12 @@ private: { try { + // Workaround for Steam. If Steam's GameOverlayRenderer64.dll is loaded, battery_info is null. + auto battery_info = m_raw_controller.try_as(); + if (!battery_info) + return false; const winrt::Windows::Devices::Power::BatteryReport report = - m_raw_controller.TryGetBatteryReport(); + battery_info.TryGetBatteryReport(); if (!report) return false;