Check updates once a day, fix config save issue

This commit is contained in:
Grinch_ 2021-07-11 15:05:17 +06:00
parent d75d1aa00e
commit 13c191d0dd
4 changed files with 25 additions and 3 deletions

View File

@ -7,11 +7,20 @@
void CheatMenu::DrawWindow()
{
ImGuiIO& io = ImGui::GetIO();
static bool game_running = true;
if (FrontEndMenuManager.m_bMenuActive)
m_bShowMouse = false;
{
if (game_running)
{
config.WriteToDisk();
game_running = false;
m_bShowMouse = false;
}
}
else
{
game_running = true;
if (Globals::m_bShowMenu || m_Commands::m_bShowMenu)
{
if (Globals::m_bShowMenu)
@ -75,7 +84,9 @@ CheatMenu::CheatMenu()
if (m_bShowMouse != Globals::m_bShowMenu)
{
if (m_bShowMouse) // Only write when the menu closes
{
config.WriteToDisk();
}
m_bShowMouse = Globals::m_bShowMenu;
}
@ -187,7 +198,16 @@ void MenuThread(void* param)
GITHUB_LINK "\n" << std::endl;
CFastman92limitAdjuster::Init();
CheatMenu menu;
Updater::CheckForUpdate();
time_t now = time(0);
struct tm tstruct = *localtime(&now);
int last_check_date = config.GetValue("config.last_update_checked", 0);
if (last_check_date != tstruct.tm_mday)
{
Updater::CheckForUpdate();
config.SetValue("config.last_update_checked", tstruct.tm_mday);
}
while (true)
{

View File

@ -5,6 +5,7 @@ class CJson
{
private:
std::string m_FilePath;
public:
nlohmann::json m_Data;

View File

@ -2,6 +2,7 @@
#include "Updater.h"
#include "Ui.h"
#include "MenuInfo.h"
#include "Util.h"
void Updater::CheckForUpdate()
{

View File

@ -300,7 +300,7 @@ void Visual::Draw()
ImGui::TextWrapped(
"These options won't work if you got any mods that drastically changes the game hud. i.e. Mobile Hud, GTA 5 Hud etc.");
ImGui::Spacing();
Ui::ColorPickerAddress("Armourbar color", *(int*)0x5890FC, ImVec4(180, 25, 29, 255));
Ui::ColorPickerAddress("Armourbar color", *(int*)0x5890FC, ImVec4(225, 225, 225, 255));
Ui::EditAddress<float>("Armourbar posX", 0x866B78, -999, 94, 999);
Ui::EditAddress<float>("Armourbar posY", 0x862D38, -999, 48, 999);
Ui::ColorPickerAddress("Breathbar color", *(int*)0x5891EB, ImVec4(172, 203, 241, 255));