fix(cache): less peds on init (#1268)
This commit is contained in:
parent
7537b9b343
commit
99bbe9ae1c
@ -9,24 +9,21 @@ namespace big
|
||||
{
|
||||
static bool init = ([] {
|
||||
if (g_gta_data_service->state() == eGtaDataUpdateState::ON_INIT_WAITING)
|
||||
{
|
||||
// parse RPFs loaded before init
|
||||
yim_fipackfile::for_each_fipackfile();
|
||||
g_gta_data_service->set_state(eGtaDataUpdateState::ON_INIT_UPDATE_START);
|
||||
}
|
||||
}(),true);
|
||||
|
||||
auto result = g_hooking->get_original<fipackfile_mount>()(this_, mount_point);
|
||||
|
||||
if (g_gta_data_service->state() == eGtaDataUpdateState::ON_INIT_UPDATE_START)
|
||||
{
|
||||
yim_fipackfile rpf_wrapper = yim_fipackfile(this_);
|
||||
yim_fipackfile rpf_wrapper = yim_fipackfile(this_, mount_point);
|
||||
std::for_each(yim_fipackfile::m_wrapper_call_back.begin(), yim_fipackfile::m_wrapper_call_back.end(), [&rpf_wrapper](std::function<size_t(yim_fipackfile & rpf_wrapper)> cb) {
|
||||
cb(rpf_wrapper);
|
||||
});
|
||||
|
||||
if (!stricmp(this_->GetName(), "BgScript.rpf"))
|
||||
{
|
||||
yim_fipackfile::for_each_fipackfile();
|
||||
g_gta_data_service->set_state(eGtaDataUpdateState::ON_INIT_UPDATE_END);
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ namespace big
|
||||
}
|
||||
|
||||
gta_data_service::gta_data_service() :
|
||||
m_peds_cache(g_file_manager->get_project_file("./cache/peds.bin"), 3),
|
||||
m_vehicles_cache(g_file_manager->get_project_file("./cache/vehicles.bin"), 2),
|
||||
m_weapons_cache(g_file_manager->get_project_file("./cache/weapons.bin"), 3),
|
||||
m_peds_cache(g_file_manager->get_project_file("./cache/peds.bin"), 4),
|
||||
m_vehicles_cache(g_file_manager->get_project_file("./cache/vehicles.bin"), 3),
|
||||
m_weapons_cache(g_file_manager->get_project_file("./cache/weapons.bin"), 4),
|
||||
m_update_state(eGtaDataUpdateState::IDLE)
|
||||
{
|
||||
if (!is_cache_up_to_date())
|
||||
|
@ -6,9 +6,10 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
yim_fipackfile::yim_fipackfile(rage::fiPackfile* rpf)
|
||||
yim_fipackfile::yim_fipackfile(rage::fiPackfile* rpf, const std::string& mount_name)
|
||||
{
|
||||
this->rpf = rpf;
|
||||
this->mount_name = mount_name;
|
||||
}
|
||||
|
||||
void yim_fipackfile::add_wrapper_call_back(std::function<size_t(yim_fipackfile& rpf_wrapper)> cb)
|
||||
@ -18,7 +19,7 @@ namespace big
|
||||
|
||||
void yim_fipackfile::for_each_fipackfile()
|
||||
{
|
||||
for (int i = 0; i < 3672; i++)
|
||||
for (int i = 1; i < 3672; i++) // fipackfile ctor start with 1
|
||||
{
|
||||
auto* rpf = g_pointers->m_gta.m_fipackfile_instances[i];
|
||||
|
||||
@ -37,7 +38,7 @@ namespace big
|
||||
{
|
||||
std::vector<std::filesystem::path> file_paths;
|
||||
if (parent.empty())
|
||||
parent = "/";
|
||||
parent = mount_name;
|
||||
|
||||
std::vector<std::string> directories;
|
||||
|
||||
|
@ -8,11 +8,10 @@ namespace big
|
||||
class yim_fipackfile
|
||||
{
|
||||
rage::fiPackfile* rpf;
|
||||
std::string mount_name;
|
||||
|
||||
public:
|
||||
explicit yim_fipackfile(rage::fiPackfile* rpf);
|
||||
|
||||
static std::vector<std::string> get_non_dlc_mounted_devices_names();
|
||||
explicit yim_fipackfile(rage::fiPackfile* rpf, const std::string& mount_name = "/");
|
||||
|
||||
static inline std::vector<std::function<size_t(yim_fipackfile& rpf_wrapper)>> m_wrapper_call_back;
|
||||
|
||||
|
Reference in New Issue
Block a user