diff --git a/src/gta/fidevice.cpp b/src/gta/fidevice.cpp index 9969a116..35d43b1e 100644 --- a/src/gta/fidevice.cpp +++ b/src/gta/fidevice.cpp @@ -265,7 +265,7 @@ namespace rage bool fiPackfile::Mount(const char* mount_point) { - return big::g_hooking->get_original()(this, mount_point); + return big::g_pointers->m_gta.m_fipackfile_mount(this, mount_point); } void fiPackfile::ClosePackfile() diff --git a/src/hooking.cpp b/src/hooking.cpp index cc9c8fa4..f6391943 100644 --- a/src/hooking.cpp +++ b/src/hooking.cpp @@ -110,8 +110,6 @@ namespace big detour_hook_helper::add("WVPMDN", g_pointers->m_gta.m_write_vehicle_proximity_migration_data_node); - detour_hook_helper::add("FPFM", g_pointers->m_gta.m_fipackfile_mount); - detour_hook_helper::add("AWIV", g_pointers->m_gta.m_allow_weapons_in_vehicle); detour_hook_helper::add("NHM", g_pointers->m_gta.m_netfilter_handle_message); diff --git a/src/hooking.hpp b/src/hooking.hpp index 4f563bde..bf90c286 100644 --- a/src/hooking.hpp +++ b/src/hooking.hpp @@ -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); }; diff --git a/src/hooks/misc/fipackfile_mount.cpp b/src/hooks/misc/fipackfile_mount.cpp deleted file mode 100644 index 77d70030..00000000 --- a/src/hooks/misc/fipackfile_mount.cpp +++ /dev/null @@ -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()(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 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; - } -} diff --git a/src/services/gta_data/gta_data_service.cpp b/src/services/gta_data/gta_data_service.cpp index f3177133..61558745 100644 --- a/src/services/gta_data/gta_data_service.cpp +++ b/src/services/gta_data/gta_data_service.cpp @@ -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; diff --git a/src/services/gta_data/gta_data_service.hpp b/src/services/gta_data/gta_data_service.hpp index 2c547b17..2046edb3 100644 --- a/src/services/gta_data/gta_data_service.hpp +++ b/src/services/gta_data/gta_data_service.hpp @@ -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; @@ -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); diff --git a/src/views/settings/view_gta_cache.cpp b/src/views/settings/view_gta_cache.cpp index f6fe07c0..4e3252f4 100644 --- a/src/views/settings/view_gta_cache.cpp +++ b/src/views/settings/view_gta_cache.cpp @@ -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(); - } + g_gta_data_service->update_now(); } } } diff --git a/src/views/view_gta_data.cpp b/src/views/view_gta_data.cpp index 2c264c7d..1f6dcc7f 100644 --- a/src/views/view_gta_data.cpp +++ b/src/views/view_gta_data.cpp @@ -26,27 +26,9 @@ 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())) { - 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(); - } - } + g_gta_data_service->update_now(); } 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();