Fix lag on Teleport/Search

This commit is contained in:
Grinch_ 2022-06-16 16:51:22 +06:00
parent 6dfadd3470
commit 1802b17029
3 changed files with 11 additions and 10 deletions

View File

@ -76,11 +76,11 @@ void MenuThread(void* param)
// Checking for updates once a day
SYSTEMTIME st;
GetSystemTime(&st);
if (gConfig.Get("config.update_date", 0) != st.wDay)
if (gConfig.Get("Menu.LastUpdateChecked", 0) != st.wDay)
{
Updater::CheckUpdate();
Updater::IncrementDailyUsageCounter();
gConfig.Set("config.update_date", st.wDay);
gConfig.Set("Menu.LastUpdateChecked", st.wDay);
}
while (true)

View File

@ -88,7 +88,7 @@ void Player::Init()
#ifdef GTASA
// Fix player model being broken after rebuild
patch::RedirectCall(0x5A834D, &PlayerModelBrokenFix);
m_bAimSkinChanger = gConfig.Get("aim_skin_changer", false);
m_bAimSkinChanger = gConfig.Get("Features.AimSkinChanger", false);
#endif
// Custom skins setup
@ -766,7 +766,7 @@ void Player::ShowPage()
if (Ui::CheckboxWithHint(TEXT("Player.AimSkinChanger"), &m_bAimSkinChanger, TEXT("Player.AimSkinChangerTip") + aimSkinChanger.Pressed()))
{
gConfig.Set("aim_skin_changer", m_bAimSkinChanger);
gConfig.Set("Features.AimSkinChanger", m_bAimSkinChanger);
}
if (ImGui::BeginTabBar("AppearanceTabBar"))
{

View File

@ -10,12 +10,12 @@ tRadarTrace* CRadar::ms_RadarTrace = reinterpret_cast<tRadarTrace*>(patch::GetPo
void Teleport::FetchRadarSpriteData()
{
uint cur_timer = CTimer::m_snTimeInMilliseconds;
static uint timer = cur_timer;
static int maxSprites = *(uint*)0x5D5870;
uint timer = CTimer::m_snTimeInMilliseconds;
static uint lastUpdated = timer;
// Update the radar list each 5 seconds
if (cur_timer - timer < 5000)
if (timer - lastUpdated < 5000)
{
return;
}
@ -30,12 +30,13 @@ void Teleport::FetchRadarSpriteData()
std::string key = "Radar." + keyName;
m_tpData.m_pData->Set(key.c_str(), std::format("0, {}, {}, {}", pos.x, pos.y, pos.z));
}
lastUpdated = timer;
}
#endif
void Teleport::Init()
{
m_bQuickTeleport = gConfig.Get("quick_teleport", false);
m_bQuickTeleport = gConfig.Get("Features.QuickTeleport", false);
Events::processScriptsEvent += []
{
@ -219,7 +220,7 @@ void Teleport::ShowPage()
std::string(TEXT_S("Teleport.QuickTeleportHint")
+ quickTeleport.GetNameString()).c_str()))
{
gConfig.Set("quick_teleport", m_bQuickTeleport);
gConfig.Set("Features.QuickTeleport", m_bQuickTeleport);
}
#endif
ImGui::Columns(1);
@ -297,7 +298,7 @@ void Teleport::ShowPage()
}
ImGui::Spacing();
Ui::DrawJSON(m_tpData, TeleportToLocation,RemoveTeleportEntry);
Ui::DrawJSON(m_tpData, TeleportToLocation, RemoveTeleportEntry);
ImGui::EndTabItem();
}
ImGui::EndTabBar();