From 4615338c9e79032200b3e1015e9dde32ff32870c Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Sat, 16 Jul 2022 03:47:31 +0600 Subject: [PATCH] Log mod info, add option to disable updates #66 --- src/dllmain.cpp | 35 ++++++++++++++++++++++++++--------- src/menu.cpp | 5 +++++ src/menu.h | 1 + src/updater.cpp | 5 ----- src/updater.h | 9 --------- 5 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/dllmain.cpp b/src/dllmain.cpp index 2f15784..5ac6427 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -2,6 +2,7 @@ #include "cheatmenu.h" #include "updater.h" #include "rpc.h" +#include "menu.h" void MenuThread(void* param) { @@ -49,6 +50,15 @@ void MenuThread(void* param) return; } + Log::Print("Starting " MENU_TITLE " (" BUILD_NUMBER ")\nAuthor: Grinch_\nDiscord: " + DISCORD_INVITE "\nMore Info: " GITHUB_LINK); + + // date time + SYSTEMTIME st; + GetSystemTime(&st); + Log::Print("Date: {}-{}-{} Time: {}:{}\n", st.wYear, st.wMonth, st.wDay, + st.wHour, st.wMinute); + /* TODO: Find a better way Since you could still name it something else @@ -61,6 +71,7 @@ void MenuThread(void* param) return; } CFastman92limitAdjuster::Init(); + Log::Print("Game detected: GTA San Andreas 1.0 US"); #elif GTAVC if (GetModuleHandle("vcmp-proxy.dll") || GetModuleHandle("vcmp-proxy.asi")) { @@ -68,23 +79,29 @@ void MenuThread(void* param) MessageBox(NULL, "VCMP detected. Exiting " FILE_NAME, FILE_NAME, MB_ICONERROR); return; } + Log::Print("Game detected: GTA Vice City 1.0 EN"); +#else + Log::Print("Game detected: GTA III 1.0 EN"); #endif - Log::Print("Starting " MENU_TITLE " (" BUILD_NUMBER ")\nAuthor: Grinch_\nDiscord: " - DISCORD_INVITE "\nMore Info: " GITHUB_LINK); + bool modloader = GetModuleHandle("modloader.asi"); + const char *path = PLUGIN_PATH((char*)""); + Log::Print("Install location: {}", modloader && strstr(path, "modloader") ? "Modloader" : "Game directory"); + Log::Print("CLEO installed: {}", GetModuleHandle("cleo.asi") || GetModuleHandle("cleo_redux.asi") ? "True" : "False"); + Log::Print("FLA installed: {}", GetModuleHandle("$fastman92limitAdjuster.asi") ? "True" : "False"); + Log::Print("Mixsets installed: {}", GetModuleHandle("MixSets.asi") ? "True" : "False"); + Log::Print("Modloader installed: {}", modloader ? "True" : "False"); + Log::Print("OLA installed: {}", GetModuleHandle("III.VC.SA.LimitAdjuster.asi") ? "True" : "False"); + Log::Print("ProjectProps installed: {}", GetModuleHandle("ProjectProps.asi") ? "True" : "False"); + Log::Print("Renderhook installed: {}", GetModuleHandle("_gtaRenderHook.asi") ? "True" : "False"); + Log::Print("Widescreen Fix installed: {}\n", GetModuleHandle("GTASA.WidescreenFix.asi") ? "True" : "False"); - // date time - SYSTEMTIME st; - GetSystemTime(&st); - Log::Print("Date: {}-{}-{} Time: {}:{}\n", st.wYear, st.wMonth, st.wDay, - st.wHour, st.wMinute); CheatMenu::Init(); // Checking for updates once a day - if (gConfig.Get("Menu.LastUpdateChecked", 0) != st.wDay) + if (Menu::m_bAutoCheckUpdate && gConfig.Get("Menu.LastUpdateChecked", 0) != st.wDay) { Updater::CheckUpdate(); - Updater::IncrementDailyUsageCounter(); gConfig.Set("Menu.LastUpdateChecked", st.wDay); } diff --git a/src/menu.cpp b/src/menu.cpp index c7f736c..1037e9c 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -32,6 +32,7 @@ void Menu::Init() Overlay::textColor[2] = gConfig.Get("Overlay.TextColor.Blue", 1.0f); Overlay::textColor[3] = gConfig.Get("Overlay.TextColor.Alpha", 1.0f); m_bDiscordRPC = gConfig.Get("Menu.DiscordRPC", false); + m_bAutoCheckUpdate = gConfig.Get("Menu.AutoCheckUpdate", true); m_bTextOnlyMode = gConfig.Get("Menu.TextOnlyMode", false); Util::GetCPUUsageInit(); @@ -352,6 +353,10 @@ void Menu::ShowPage() ImGui::Spacing(); ImGui::Columns(2, NULL, false); + if (ImGui::Checkbox(TEXT("Menu.AutoCheckUpdate"), &m_bAutoCheckUpdate)) + { + gConfig.Set("Menu.AutoCheckUpdate", m_bAutoCheckUpdate); + } if (ImGui::Checkbox(TEXT("Menu.DiscordRPC"), &m_bDiscordRPC)) { if (m_bDiscordRPC) diff --git a/src/menu.h b/src/menu.h index 81be981..9484683 100644 --- a/src/menu.h +++ b/src/menu.h @@ -44,6 +44,7 @@ public: static inline bool m_bShowMenu; static inline char m_nInputBuffer[INPUT_BUFFER_SIZE] = ""; }; + static inline bool m_bAutoCheckUpdate; static inline bool m_bDiscordRPC; static inline bool m_bTextOnlyMode; diff --git a/src/updater.cpp b/src/updater.cpp index 80a0897..366f1ac 100644 --- a/src/updater.cpp +++ b/src/updater.cpp @@ -24,11 +24,6 @@ void Updater::CheckUpdate() } } -void Updater::IncrementDailyUsageCounter() -{ - URLDownloadToFile(NULL, "https://github.com/user-grinch/Cheat-Menu/releases/download/3.2/counter.info", "", 0, NULL); -} - void Updater::Process() { if (Updater::curState != States::CHECKING) diff --git a/src/updater.h b/src/updater.h index 4a9634f..71e4514 100644 --- a/src/updater.h +++ b/src/updater.h @@ -31,15 +31,6 @@ public: // Is updated version available from GitHub static bool IsUpdateAvailable(); - /* - Just downloading counter.info file from GitHub repository - Initial plan was to add google analytics but people will freak - out about that (though every site has it in some form) - - Pretty barebones but this shouldn't raise any concerns (i hope) - */ - static void IncrementDailyUsageCounter(); - // Needs to run in it's own thread to prevent the game from freezing static void Process();