From 9026a325f2b1376752b9d7de6d18a89bd52494c5 Mon Sep 17 00:00:00 2001 From: m Date: Sun, 14 Aug 2022 17:01:02 -0500 Subject: [PATCH] only warn the user once --- src/client/main.cpp | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/client/main.cpp b/src/client/main.cpp index 4a1a0752..c1486f82 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -81,26 +81,6 @@ void get_aslr_patched_binary(std::string* binary, std::string* data) *binary = patched_binary; } -bool is_steam_registry_found() -{ - static bool is_steam_installed = false; - static bool is_steam_installed_set = false; - - if (!is_steam_installed_set) - { - HKEY key = nullptr; - if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Valve\\Steam", 0, KEY_ALL_ACCESS, &key) == ERROR_SUCCESS) - { - is_steam_installed = true; - RegCloseKey(key); - } - - is_steam_installed_set = true; - } - - return is_steam_installed; -} - FARPROC load_binary(const launcher::mode mode, uint64_t* base_address) { loader loader; @@ -111,9 +91,20 @@ FARPROC load_binary(const launcher::mode mode, uint64_t* base_address) if (library == "steam_api64.dll" && function != "SteamAPI_GetSteamInstallPath") // Arxan requires one valid steam api import - maybe SteamAPI_Shutdown is better? { - if (!is_steam_registry_found()) + static bool check_for_steam_install = false; + if (!check_for_steam_install) { - MSG_BOX_WARN("Could not find Steam in the registry. If Steam is not installed, you must install it for H1-Mod to work."); + HKEY key; + if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Valve\\Steam", 0, KEY_ALL_ACCESS, &key) == ERROR_SUCCESS) + { + RegCloseKey(key); + } + else + { + MSG_BOX_WARN("Could not find Steam in the registry. If Steam is not installed, you must install it for H1-Mod to work."); + } + + check_for_steam_install = true; } return self.get_proc(function);