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 // Checking for updates once a day
SYSTEMTIME st; SYSTEMTIME st;
GetSystemTime(&st); GetSystemTime(&st);
if (gConfig.Get("config.update_date", 0) != st.wDay) if (gConfig.Get("Menu.LastUpdateChecked", 0) != st.wDay)
{ {
Updater::CheckUpdate(); Updater::CheckUpdate();
Updater::IncrementDailyUsageCounter(); Updater::IncrementDailyUsageCounter();
gConfig.Set("config.update_date", st.wDay); gConfig.Set("Menu.LastUpdateChecked", st.wDay);
} }
while (true) while (true)

View File

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

View File

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