Log mod info, add option to disable updates #66

This commit is contained in:
Grinch_ 2022-07-16 03:47:31 +06:00
parent f3e0b10b6d
commit 4615338c9e
5 changed files with 32 additions and 23 deletions

View File

@ -2,6 +2,7 @@
#include "cheatmenu.h" #include "cheatmenu.h"
#include "updater.h" #include "updater.h"
#include "rpc.h" #include "rpc.h"
#include "menu.h"
void MenuThread(void* param) void MenuThread(void* param)
{ {
@ -49,6 +50,15 @@ void MenuThread(void* param)
return; return;
} }
Log::Print<eLogLevel::None>("Starting " MENU_TITLE " (" BUILD_NUMBER ")\nAuthor: Grinch_\nDiscord: "
DISCORD_INVITE "\nMore Info: " GITHUB_LINK);
// date time
SYSTEMTIME st;
GetSystemTime(&st);
Log::Print<eLogLevel::None>("Date: {}-{}-{} Time: {}:{}\n", st.wYear, st.wMonth, st.wDay,
st.wHour, st.wMinute);
/* /*
TODO: Find a better way TODO: Find a better way
Since you could still name it something else Since you could still name it something else
@ -61,6 +71,7 @@ void MenuThread(void* param)
return; return;
} }
CFastman92limitAdjuster::Init(); CFastman92limitAdjuster::Init();
Log::Print<eLogLevel::None>("Game detected: GTA San Andreas 1.0 US");
#elif GTAVC #elif GTAVC
if (GetModuleHandle("vcmp-proxy.dll") || GetModuleHandle("vcmp-proxy.asi")) 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); MessageBox(NULL, "VCMP detected. Exiting " FILE_NAME, FILE_NAME, MB_ICONERROR);
return; return;
} }
Log::Print<eLogLevel::None>("Game detected: GTA Vice City 1.0 EN");
#else
Log::Print<eLogLevel::None>("Game detected: GTA III 1.0 EN");
#endif #endif
Log::Print<eLogLevel::None>("Starting " MENU_TITLE " (" BUILD_NUMBER ")\nAuthor: Grinch_\nDiscord: " bool modloader = GetModuleHandle("modloader.asi");
DISCORD_INVITE "\nMore Info: " GITHUB_LINK); const char *path = PLUGIN_PATH((char*)"");
Log::Print<eLogLevel::None>("Install location: {}", modloader && strstr(path, "modloader") ? "Modloader" : "Game directory");
Log::Print<eLogLevel::None>("CLEO installed: {}", GetModuleHandle("cleo.asi") || GetModuleHandle("cleo_redux.asi") ? "True" : "False");
Log::Print<eLogLevel::None>("FLA installed: {}", GetModuleHandle("$fastman92limitAdjuster.asi") ? "True" : "False");
Log::Print<eLogLevel::None>("Mixsets installed: {}", GetModuleHandle("MixSets.asi") ? "True" : "False");
Log::Print<eLogLevel::None>("Modloader installed: {}", modloader ? "True" : "False");
Log::Print<eLogLevel::None>("OLA installed: {}", GetModuleHandle("III.VC.SA.LimitAdjuster.asi") ? "True" : "False");
Log::Print<eLogLevel::None>("ProjectProps installed: {}", GetModuleHandle("ProjectProps.asi") ? "True" : "False");
Log::Print<eLogLevel::None>("Renderhook installed: {}", GetModuleHandle("_gtaRenderHook.asi") ? "True" : "False");
Log::Print<eLogLevel::None>("Widescreen Fix installed: {}\n", GetModuleHandle("GTASA.WidescreenFix.asi") ? "True" : "False");
// date time
SYSTEMTIME st;
GetSystemTime(&st);
Log::Print<eLogLevel::None>("Date: {}-{}-{} Time: {}:{}\n", st.wYear, st.wMonth, st.wDay,
st.wHour, st.wMinute);
CheatMenu::Init(); CheatMenu::Init();
// Checking for updates once a day // 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::CheckUpdate();
Updater::IncrementDailyUsageCounter();
gConfig.Set("Menu.LastUpdateChecked", st.wDay); gConfig.Set("Menu.LastUpdateChecked", st.wDay);
} }

View File

@ -32,6 +32,7 @@ void Menu::Init()
Overlay::textColor[2] = gConfig.Get("Overlay.TextColor.Blue", 1.0f); Overlay::textColor[2] = gConfig.Get("Overlay.TextColor.Blue", 1.0f);
Overlay::textColor[3] = gConfig.Get("Overlay.TextColor.Alpha", 1.0f); Overlay::textColor[3] = gConfig.Get("Overlay.TextColor.Alpha", 1.0f);
m_bDiscordRPC = gConfig.Get("Menu.DiscordRPC", false); m_bDiscordRPC = gConfig.Get("Menu.DiscordRPC", false);
m_bAutoCheckUpdate = gConfig.Get("Menu.AutoCheckUpdate", true);
m_bTextOnlyMode = gConfig.Get("Menu.TextOnlyMode", false); m_bTextOnlyMode = gConfig.Get("Menu.TextOnlyMode", false);
Util::GetCPUUsageInit(); Util::GetCPUUsageInit();
@ -352,6 +353,10 @@ void Menu::ShowPage()
ImGui::Spacing(); ImGui::Spacing();
ImGui::Columns(2, NULL, false); 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 (ImGui::Checkbox(TEXT("Menu.DiscordRPC"), &m_bDiscordRPC))
{ {
if (m_bDiscordRPC) if (m_bDiscordRPC)

View File

@ -44,6 +44,7 @@ public:
static inline bool m_bShowMenu; static inline bool m_bShowMenu;
static inline char m_nInputBuffer[INPUT_BUFFER_SIZE] = ""; static inline char m_nInputBuffer[INPUT_BUFFER_SIZE] = "";
}; };
static inline bool m_bAutoCheckUpdate;
static inline bool m_bDiscordRPC; static inline bool m_bDiscordRPC;
static inline bool m_bTextOnlyMode; static inline bool m_bTextOnlyMode;

View File

@ -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() void Updater::Process()
{ {
if (Updater::curState != States::CHECKING) if (Updater::curState != States::CHECKING)

View File

@ -31,15 +31,6 @@ public:
// Is updated version available from GitHub // Is updated version available from GitHub
static bool IsUpdateAvailable(); 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 // Needs to run in it's own thread to prevent the game from freezing
static void Process(); static void Process();