@@ -59,23 +59,27 @@ namespace {
5959 bool is_hook_mode;
6060
6161 void check_for_updates () {
62- const auto latest_release_url = std::format (
63- " https://api.github.com/repos/acidicoala/{}/releases/latest" ,
64- PROJECT_NAME
65- );
66- const auto res = kb::http_client::get_json (latest_release_url);
67- const auto latest_tag = res[" tag_name" ].get <std::string>();
68- const auto current_tag = std::format (" v{}" , PROJECT_VERSION);
69-
70- if (current_tag == latest_tag) {
71- LOG_DEBUG (" Running the latest version" );
72- } else {
73- const auto release_page = std::format (
74- " https://github.com/acidicoala/{}/releases/{}" ,
75- PROJECT_NAME, latest_tag
62+ try {
63+ const auto latest_release_url = std::format (
64+ " https://api.github.com/repos/acidicoala/{}/releases/latest" ,
65+ PROJECT_NAME
7666 );
67+ const auto res = kb::http_client::get_json (latest_release_url);
68+ const auto latest_tag = res[" tag_name" ].get <std::string>();
69+ const auto current_tag = std::format (" v{}" , PROJECT_VERSION);
7770
78- LOG_WARN (" New version {} available: {}" , latest_tag, release_page);
71+ if (current_tag == latest_tag) {
72+ LOG_DEBUG (" Running the latest version" );
73+ } else {
74+ const auto release_page = std::format (
75+ " https://github.com/acidicoala/{}/releases/{}" ,
76+ PROJECT_NAME, latest_tag
77+ );
78+
79+ LOG_WARN (" New version {} available: {}" , latest_tag, release_page);
80+ }
81+ } catch (const std::exception& e) {
82+ LOG_ERROR (" {} -> Unexpected error: {}" , __func__, e.what ());
7983 }
8084 }
8185
@@ -134,7 +138,9 @@ namespace {
134138 static const auto CreateInterface$ = KB_LIB_GET_FUNC (steamclient_handle, CreateInterface);
135139
136140 if (auto * steamapi_handle = kb::lib::get_lib_handle (STEAM_API_MODULE)) {
137- if (steamapi_handle != original_steamapi_handle) {
141+ if (original_steamapi_handle == nullptr ) { // hook mode on Windows
142+ original_steamapi_handle = steamapi_handle;
143+ } else if (steamapi_handle != original_steamapi_handle) {
138144 LOG_WARN (
139145 " {} -> steamapi_handle ({}) != original_steamapi_handle ({})" ,
140146 __func__, steamapi_handle, original_steamapi_handle
@@ -287,12 +293,6 @@ namespace smoke_api {
287293 kb::win::check_self_duplicates ();
288294#endif
289295
290- #ifdef KB_DEBUG
291- // TODO: Add config option to toggle this and show native OS notification
292- // The real reason behind this is for automatic testing of HTTPs dependencies
293- std::thread (check_for_updates).detach ();
294- #endif
295-
296296 // We need to hook functions in either mode
297297 kb::hook::init (true );
298298
@@ -313,6 +313,14 @@ namespace smoke_api {
313313 }
314314 }
315315
316+ void post_init () {
317+ #ifdef KB_DEBUG
318+ // TODO: Add config option to toggle this and show native OS notification
319+ // The real reason behind this is for automatic testing of HTTPs dependencies
320+ std::thread (check_for_updates).detach ();
321+ #endif
322+ }
323+
316324 void shutdown () {
317325 try {
318326 static bool shutdown_complete = false ;
0 commit comments