From f397f7364424b71e0b5a61fc7f7c4241f7e38282 Mon Sep 17 00:00:00 2001 From: otavepto Date: Tue, 19 Dec 2023 16:48:07 +0200 Subject: [PATCH] add missing env var "SteamOverlayGameId" to steam_client and client_loader --- dll/settings_parser.cpp | 19 +++++++++++++++++-- dll/steam_client.cpp | 2 ++ steamclient_loader/ColdClientLoader.cpp | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/dll/settings_parser.cpp b/dll/settings_parser.cpp index 1257f072..afd69573 100644 --- a/dll/settings_parser.cpp +++ b/dll/settings_parser.cpp @@ -304,9 +304,12 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s if (!appid) { std::string str_appid = get_env_variable("SteamAppId"); std::string str_gameid = get_env_variable("SteamGameId"); - PRINT_DEBUG("str_appid %s str_gameid: %s\n", str_appid.c_str(), str_gameid.c_str()); + std::string str_overlay_gameid = get_env_variable("SteamOverlayGameId"); + + PRINT_DEBUG("str_appid %s str_gameid: %s str_overlay_gameid: %s\n", str_appid.c_str(), str_gameid.c_str(), str_overlay_gameid.c_str()); uint32 appid_env = 0; uint32 gameid_env = 0; + uint32 overlay_gameid = 0; if (str_appid.size() > 0) { try { @@ -324,7 +327,15 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s } } - PRINT_DEBUG("appid_env %u gameid_env: %u\n", appid_env, gameid_env); + if (str_overlay_gameid.size() > 0) { + try { + overlay_gameid = std::stoul(str_overlay_gameid); + } catch (...) { + overlay_gameid = 0; + } + } + + PRINT_DEBUG("appid_env %u gameid_env: %u overlay_gameid: %u\n", appid_env, gameid_env, overlay_gameid); if (appid_env) { appid = appid_env; } @@ -332,6 +343,10 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s if (gameid_env) { appid = gameid_env; } + + if (overlay_gameid) { + appid = overlay_gameid; + } } bool local_save = false; diff --git a/dll/steam_client.cpp b/dll/steam_client.cpp index 261e51f8..2ae8c16e 100644 --- a/dll/steam_client.cpp +++ b/dll/steam_client.cpp @@ -65,6 +65,7 @@ Steam_Client::Steam_Client() if (appid) { set_env_variable("SteamAppId", std::to_string(appid)); set_env_variable("SteamGameId", std::to_string(appid)); + set_env_variable("SteamOverlayGameId", std::to_string(appid)); } steam_overlay = new Steam_Overlay(settings_client, callback_results_client, callbacks_client, run_every_runcb, network); @@ -220,6 +221,7 @@ void Steam_Client::setAppID(uint32 appid) network->setAppID(appid); set_env_variable("SteamAppId", std::to_string(appid)); set_env_variable("SteamGameId", std::to_string(appid)); + set_env_variable("SteamOverlayGameId", std::to_string(appid)); } diff --git a/steamclient_loader/ColdClientLoader.cpp b/steamclient_loader/ColdClientLoader.cpp index 6e790ab7..37a078f8 100644 --- a/steamclient_loader/ColdClientLoader.cpp +++ b/steamclient_loader/ColdClientLoader.cpp @@ -58,6 +58,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance if (AppId[0]) { SetEnvironmentVariableW(L"SteamAppId", AppId); SetEnvironmentVariableW(L"SteamGameId", AppId); + SetEnvironmentVariableW(L"SteamOverlayGameId", AppId); } else { MessageBoxA(NULL, "You forgot to set the AppId.", "ColdClientLoader", MB_ICONERROR); return 0;