Use the timestamp when validating cache version (#2834)

This commit is contained in:
maybegreat48 2024-03-18 13:33:09 +00:00 committed by GitHub
parent 7ba85de412
commit d0c5ffaa40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -89,7 +89,7 @@ namespace big
{
cache_file.load();
if (cache_file.up_to_date(mem_region.size()))
if (cache_file.up_to_date(mem_region.timestamp()))
{
LOG(INFO) << batch_name.str << " pointers cache is up to date, using it.";

View File

@ -150,7 +150,7 @@ namespace big
}
}
const auto file_version = memory::module("GTA5.exe").size();
const auto file_version = memory::module("GTA5.exe").timestamp();
return m_peds_cache.up_to_date(file_version) && m_vehicles_cache.up_to_date(file_version) && m_weapons_cache.up_to_date(file_version);
}
@ -522,7 +522,7 @@ namespace big
LOG(VERBOSE) << "Starting cache saving procedure...";
g_thread_pool->push([this, peds = std::move(peds), vehicles = std::move(vehicles), weapons = std::move(weapons), weapon_components = std::move(weapon_components)] {
const auto file_version = memory::module("GTA5.exe").size();
const auto file_version = memory::module("GTA5.exe").timestamp();
{
const auto data_size = sizeof(ped_item) * peds.size();

View File

@ -31,7 +31,7 @@ namespace big
m_cache_file.load();
if (m_cache_file.up_to_date(memory::module("GTA5.exe").size()))
if (m_cache_file.up_to_date(memory::module("GTA5.exe").timestamp()))
{
LOG(INFO) << "Loading tunables from cache";
m_loading = true;
@ -107,7 +107,7 @@ namespace big
data_ptr += sizeof(tunable_save_struct);
}
m_cache_file.set_header_version(memory::module("GTA5.exe").size());
m_cache_file.set_header_version(memory::module("GTA5.exe").timestamp());
m_cache_file.set_data(std::move(data), data_size);
m_cache_file.write();
}