feat(GTA Cache): removed unused old code (#1663)
This commit is contained in:
parent
ee61858489
commit
2f1f094b89
@ -265,7 +265,7 @@ namespace rage
|
||||
|
||||
bool fiPackfile::Mount(const char* mount_point)
|
||||
{
|
||||
return big::g_hooking->get_original<big::hooks::fipackfile_mount>()(this, mount_point);
|
||||
return big::g_pointers->m_gta.m_fipackfile_mount(this, mount_point);
|
||||
}
|
||||
|
||||
void fiPackfile::ClosePackfile()
|
||||
|
@ -110,8 +110,6 @@ namespace big
|
||||
|
||||
detour_hook_helper::add<hooks::write_vehicle_proximity_migration_data_node>("WVPMDN", g_pointers->m_gta.m_write_vehicle_proximity_migration_data_node);
|
||||
|
||||
detour_hook_helper::add<hooks::fipackfile_mount>("FPFM", g_pointers->m_gta.m_fipackfile_mount);
|
||||
|
||||
detour_hook_helper::add<hooks::allow_weapons_in_vehicle>("AWIV", g_pointers->m_gta.m_allow_weapons_in_vehicle);
|
||||
|
||||
detour_hook_helper::add<hooks::netfilter_handle_message>("NHM", g_pointers->m_gta.m_netfilter_handle_message);
|
||||
|
@ -148,8 +148,6 @@ namespace big
|
||||
|
||||
static void write_vehicle_proximity_migration_data_node(rage::netObject* veh, CVehicleProximityMigrationDataNode* node);
|
||||
|
||||
static bool fipackfile_mount(rage::fiPackfile* this_, const char* mount_point);
|
||||
|
||||
static bool allow_weapons_in_vehicle(int64_t unk, int weaponinfo_group);
|
||||
static int netfilter_handle_message(__int64 filter, char* message, int flags);
|
||||
};
|
||||
|
@ -1,37 +0,0 @@
|
||||
#include "gta/fidevice.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "services/gta_data/gta_data_service.hpp"
|
||||
#include "services/gta_data/yim_fipackfile.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::fipackfile_mount(rage::fiPackfile* this_, const char* mount_point)
|
||||
{
|
||||
static bool init = ([] {
|
||||
if (g_gta_data_service->state() == eGtaDataUpdateState::ON_INIT_WAITING)
|
||||
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_, mount_point);
|
||||
const auto files = rpf_wrapper.get_file_paths();
|
||||
for (const auto& file : files)
|
||||
{
|
||||
std::for_each(yim_fipackfile::m_wrapper_call_back.begin(), yim_fipackfile::m_wrapper_call_back.end(), [&rpf_wrapper, file](std::function<void(yim_fipackfile & rpf_wrapper, std::filesystem::path path)> cb) {
|
||||
cb(rpf_wrapper, file);
|
||||
});
|
||||
}
|
||||
|
||||
if (!stricmp(this_->GetName(), "BgScript.rpf"))
|
||||
{
|
||||
yim_fipackfile::for_each_fipackfile();
|
||||
g_gta_data_service->set_state(eGtaDataUpdateState::ON_INIT_UPDATE_END);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
@ -62,27 +62,6 @@ namespace big
|
||||
m_update_state = state;
|
||||
}
|
||||
|
||||
void gta_data_service::update_in_online()
|
||||
{
|
||||
m_update_state = eGtaDataUpdateState::WAITING_FOR_SINGLE_PLAYER;
|
||||
g_fiber_pool->queue_job([this] {
|
||||
while (*g_pointers->m_gta.m_game_state != eGameState::Playing)
|
||||
{
|
||||
script::get_current()->yield(100ms);
|
||||
}
|
||||
m_update_state = eGtaDataUpdateState::WAITING_FOR_ONLINE;
|
||||
|
||||
session::join_type(eSessionType::SOLO);
|
||||
|
||||
while (!*g_pointers->m_gta.m_is_session_started)
|
||||
{
|
||||
script::get_current()->yield(100ms);
|
||||
}
|
||||
m_update_state = eGtaDataUpdateState::UPDATING;
|
||||
rebuild_cache();
|
||||
});
|
||||
}
|
||||
|
||||
void gta_data_service::update_now()
|
||||
{
|
||||
m_update_state = eGtaDataUpdateState::WAITING_FOR_SINGLE_PLAYER;
|
||||
@ -92,14 +71,6 @@ namespace big
|
||||
});
|
||||
}
|
||||
|
||||
void gta_data_service::update_on_init()
|
||||
{
|
||||
m_update_state = eGtaDataUpdateState::ON_INIT_WAITING;
|
||||
g_thread_pool->push([this] {
|
||||
rebuild_cache();
|
||||
});
|
||||
}
|
||||
|
||||
// innefficient getters, don't care to fix right now
|
||||
const ped_item& gta_data_service::ped_by_hash(std::uint32_t hash)
|
||||
{
|
||||
@ -501,11 +472,6 @@ namespace big
|
||||
{
|
||||
yim_fipackfile::for_each_fipackfile();
|
||||
}
|
||||
else
|
||||
{
|
||||
while (state() != eGtaDataUpdateState::ON_INIT_UPDATE_END)
|
||||
std::this_thread::sleep_for(100ms);
|
||||
}
|
||||
|
||||
static bool translate_lebel = false;
|
||||
|
||||
|
@ -11,11 +11,7 @@ namespace big
|
||||
IDLE,
|
||||
NEEDS_UPDATE,
|
||||
WAITING_FOR_SINGLE_PLAYER,
|
||||
WAITING_FOR_ONLINE,
|
||||
UPDATING,
|
||||
ON_INIT_WAITING,
|
||||
ON_INIT_UPDATE_START,
|
||||
ON_INIT_UPDATE_END
|
||||
UPDATING
|
||||
};
|
||||
|
||||
using ped_map = std::map<std::string, ped_item>;
|
||||
@ -31,9 +27,7 @@ namespace big
|
||||
bool cache_needs_update() const;
|
||||
eGtaDataUpdateState state() const;
|
||||
void set_state(eGtaDataUpdateState state);
|
||||
void update_in_online();
|
||||
void update_now();
|
||||
void update_on_init();
|
||||
|
||||
const ped_item& ped_by_hash(std::uint32_t hash);
|
||||
const vehicle_item& vehicle_by_hash(std::uint32_t hash);
|
||||
|
@ -16,18 +16,10 @@ namespace big
|
||||
components::sub_title("GTA cache stats:");
|
||||
ImGui::Text("Peds Cached: %d\nVehicles Cached: %d\nWeapons Cached: %d", ped_count, veh_count, wep_count);
|
||||
|
||||
if (components::button("Rebuild Cache in Online"))
|
||||
if (components::button("Rebuild Cache"))
|
||||
{
|
||||
g_gta_data_service->set_state(eGtaDataUpdateState::NEEDS_UPDATE);
|
||||
|
||||
if (!*g_pointers->m_gta.m_is_session_started)
|
||||
{
|
||||
g_gta_data_service->update_in_online();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_gta_data_service->update_now();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,28 +26,10 @@ namespace big
|
||||
{
|
||||
ImGui::Text("GAME_CACHE_UPDATE"_T.data());
|
||||
|
||||
if (*g_pointers->m_gta.m_is_session_started)
|
||||
{
|
||||
if (ImGui::Button("GAME_CACHE_UPDATE_CACHE"_T.data()))
|
||||
{
|
||||
g_gta_data_service->update_now();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ImGui::Button("GAME_CACHE_UPDATE_CACHE"_T.data()))
|
||||
{
|
||||
g_gta_data_service->update_now();
|
||||
}
|
||||
|
||||
if (*g_pointers->m_gta.m_game_state == eGameState::Respawn)
|
||||
{
|
||||
if (ImGui::Button("GAME_CACHE_ON_INIT"_T.data()))
|
||||
{
|
||||
g_gta_data_service->update_on_init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -57,30 +39,12 @@ namespace big
|
||||
|
||||
break;
|
||||
}
|
||||
case eGtaDataUpdateState::WAITING_FOR_ONLINE:
|
||||
{
|
||||
ImGui::Text("GAME_CACHE_WAITING_FOR_ONLINE"_T.data());
|
||||
|
||||
break;
|
||||
}
|
||||
case eGtaDataUpdateState::UPDATING:
|
||||
{
|
||||
ImGui::Text("GAME_CACHE_UPDATING"_T.data());
|
||||
|
||||
break;
|
||||
}
|
||||
case eGtaDataUpdateState::ON_INIT_WAITING:
|
||||
{
|
||||
ImGui::Text("GAME_CACHE_WAITING_FOR_SINGLE_PLAYER"_T.data());
|
||||
|
||||
break;
|
||||
}
|
||||
case eGtaDataUpdateState::ON_INIT_UPDATE_START:
|
||||
{
|
||||
ImGui::Text("GAME_CACHE_UPDATING"_T.data());
|
||||
|
||||
break;
|
||||
}
|
||||
case eGtaDataUpdateState::IDLE:
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
Reference in New Issue
Block a user