summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2022-09-08 19:03:31 +0200
committerGitHub <noreply@github.com>2022-09-08 19:03:31 +0200
commit710210365a86c28805f31211852d80fbe9d371e1 (patch)
treec3fb7cf44e6cd4529ec7402f97dba4178e958e18 /Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp
parent2dfe91336a739ba10d9bfcf7c85c1e8f4802e1b2 (diff)
parent67c97a0bf26b4272632e3aaaab43fd571f0cfe70 (diff)
Merge pull request #11038 from AdmiralCurtiss/steam-overlay-crash-fix-wgi
WGInput: Work around crash with Steam overlay.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp6
1 files changed, 5 insertions, 1 deletions
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<WGI::IGameControllerBatteryInfo>();
+ if (!battery_info)
+ return false;
const winrt::Windows::Devices::Power::BatteryReport report =
- m_raw_controller.TryGetBatteryReport();
+ battery_info.TryGetBatteryReport();
if (!report)
return false;