From ce017ee4a88648809d789c57ff3504f00e91870e Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Mon, 10 Apr 2023 03:01:36 -0500 Subject: [PATCH] properly callIs SteamRunningOnSteamDeck --- library/modules/DFSteam.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/library/modules/DFSteam.cpp b/library/modules/DFSteam.cpp index f58bc7cb4..1226f2a27 100644 --- a/library/modules/DFSteam.cpp +++ b/library/modules/DFSteam.cpp @@ -21,7 +21,8 @@ static const std::vector STEAM_LIBS { bool (*g_SteamAPI_Init)() = nullptr; void (*g_SteamAPI_Shutdown)() = nullptr; -bool (*g_SteamAPI_ISteamUtils_IsSteamRunningOnSteamDeck)() = nullptr; +void* (*g_SteamInternal_FindOrCreateUserInterface)(int, char *) = nullptr; +bool (*g_SteamAPI_ISteamUtils_IsSteamRunningOnSteamDeck)(void*) = nullptr; bool DFSteam::init(color_ostream& out) { for (auto& lib_str : STEAM_LIBS) { @@ -46,6 +47,7 @@ bool DFSteam::init(color_ostream& out) { if (!g_SteamAPI_Init || !g_SteamAPI_Shutdown || !g_SteamAPI_Init()) return false; + bind(g_steam_handle, SteamInternal_FindOrCreateUserInterface); bind(g_steam_handle, SteamAPI_ISteamUtils_IsSteamRunningOnSteamDeck); #undef bind @@ -67,5 +69,11 @@ void DFSteam::cleanup() { bool DFSteam::DFIsSteamRunningOnSteamDeck() { if (!g_SteamAPI_ISteamUtils_IsSteamRunningOnSteamDeck) return false; - return g_SteamAPI_ISteamUtils_IsSteamRunningOnSteamDeck(); + + if (!g_SteamInternal_FindOrCreateUserInterface) + return false; + + void* SteamUtils = g_SteamInternal_FindOrCreateUserInterface(0, "SteamUtils010"); + + return g_SteamAPI_ISteamUtils_IsSteamRunningOnSteamDeck(SteamUtils); }