Refactored Allow All Vehicles in Heists to use the tunables service and backup the values before writing them. (#2036)

This commit is contained in:
gir489
2023-08-28 06:56:29 -04:00
committed by GitHub
parent 100de3fee5
commit e58f9610b3
2 changed files with 49 additions and 78 deletions

View File

@ -14,26 +14,6 @@ namespace big
tunables_service::tunables_service() :
m_cache_file(g_file_manager.get_project_file("./cache/tunables.bin"), 1)
{
m_cache_file.load();
if (m_cache_file.up_to_date(memory::module("GTA5.exe").size()))
{
LOG(INFO) << "Loading tunables from cache";
m_loading = true;
g_thread_pool->push([this] {
while (!g_pointers->m_gta.m_script_globals[1])
{
if (!m_loading || !g_running)
return;
std::this_thread::yield();
}
load();
});
}
g_tunables_service = this;
}
@ -49,6 +29,16 @@ namespace big
{
script::get_current()->yield();
m_cache_file.load();
if (m_cache_file.up_to_date(memory::module("GTA5.exe").size()))
{
LOG(INFO) << "Loading tunables from cache";
m_loading = true;
load();
}
if (m_initialized || m_loading)
return;