diff --git a/deps/GSL b/deps/GSL index 3325bbd..466e4eb 160000 --- a/deps/GSL +++ b/deps/GSL @@ -1 +1 @@ -Subproject commit 3325bbd33d24d1f8f5a0f69e782c92ad5a39a68e +Subproject commit 466e4ebaa54dcf4257698d707d76d69a90614450 diff --git a/deps/asmjit b/deps/asmjit index e8c8e2e..cecc73f 160000 --- a/deps/asmjit +++ b/deps/asmjit @@ -1 +1 @@ -Subproject commit e8c8e2e48a1a38154c8e8864eb3bc61db80a1e31 +Subproject commit cecc73f2979e9704c81a2c2ec79a7475b31c56ac diff --git a/deps/gsc-tool b/deps/gsc-tool index 2d9781c..c508e5b 160000 --- a/deps/gsc-tool +++ b/deps/gsc-tool @@ -1 +1 @@ -Subproject commit 2d9781ce0ce9e8551eaf040d7761fd986f33cfdc +Subproject commit c508e5b10f5ecef9313ef49b0ec6b8ebf52e182f diff --git a/deps/libtomcrypt b/deps/libtomcrypt index a6b9aff..d448df1 160000 --- a/deps/libtomcrypt +++ b/deps/libtomcrypt @@ -1 +1 @@ -Subproject commit a6b9aff7aab857fe1b491710a5c5b9e2be49cb08 +Subproject commit d448df1938e8988bcdb0eed6591387e82b26874b diff --git a/deps/minhook b/deps/minhook index c3fcafd..565968b 160000 --- a/deps/minhook +++ b/deps/minhook @@ -1 +1 @@ -Subproject commit c3fcafdc10146beb5919319d0683e44e3c30d537 +Subproject commit 565968b28583221751cc2810e09ea621745fc3a3 diff --git a/src/client/component/fastfiles.cpp b/src/client/component/fastfiles.cpp index 5b7dfd7..7830283 100644 --- a/src/client/component/fastfiles.cpp +++ b/src/client/component/fastfiles.cpp @@ -18,6 +18,14 @@ namespace fastfiles { utils::hook::detour db_try_load_x_file_internal_hook; utils::hook::detour db_find_x_asset_header_hook; + utils::hook::detour db_read_stream_file_hook; + + int db_read_stream_file_stub(int allow_abort, int finish) + { + // always use lz4 compressor type when reading stream files + *game::g_compressor = game::DB_COMPRESSOR_LZX; + return db_read_stream_file_hook.invoke(allow_abort, finish); + } void db_try_load_x_file_internal(const char* zone_name, const int flags) { @@ -145,6 +153,9 @@ namespace fastfiles } }); + // Allow loading of mixed compressor types + utils::hook::nop(SELECT_VALUE(0x1401536D7, 0x140242DF7), 2); + reallocate_asset_pool(); if (!game::environment::is_sp()) @@ -155,6 +166,9 @@ namespace fastfiles utils::hook::inject(0x14026FFAC, xmodel_pool + 8); utils::hook::inject(0x14027463C, xmodel_pool + 8); utils::hook::inject(0x140274689, xmodel_pool + 8); + + // Fix compressor type on streamed file load + db_read_stream_file_hook.create(0x14027AA70, db_read_stream_file_stub); } } }; diff --git a/src/client/component/gsc/script_loading.cpp b/src/client/component/gsc/script_loading.cpp index 7bc80bd..51abed0 100644 --- a/src/client/component/gsc/script_loading.cpp +++ b/src/client/component/gsc/script_loading.cpp @@ -362,7 +362,7 @@ namespace gsc build = static_cast(static_cast(build) | static_cast(xsk::gsc::build::dev_blocks)); } - gsc_ctx->init(build, []([[maybe_unused]] auto const* ctx, const auto& included_path) -> std::pair> + gsc_ctx->init(build, []([[maybe_unused]] const auto* ctx, const auto& included_path) -> std::pair> { const auto script_name = std::filesystem::path(included_path).replace_extension().string(); diff --git a/src/client/component/mods.cpp b/src/client/component/mods.cpp index 9f32a78..8590779 100644 --- a/src/client/component/mods.cpp +++ b/src/client/component/mods.cpp @@ -16,7 +16,7 @@ namespace mods { utils::hook::detour sys_create_file_hook; - void db_build_os_path_from_source(const char* zone_name, game::FF_DIR source, int size, char* filename) + void db_build_os_path_from_source(const char* zone_name, const game::FF_DIR source, const int size, char* filename) { char user_map[MAX_PATH]{}; @@ -201,7 +201,7 @@ namespace mods if (!mod_name.empty() && !mod_name.starts_with("mods/")) { - mod_name = "mods/" + mod_name; + mod_name.insert(0, "mods/"); } // change fs_game if needed diff --git a/src/client/game/structs.hpp b/src/client/game/structs.hpp index e12f4de..17b475d 100644 --- a/src/client/game/structs.hpp +++ b/src/client/game/structs.hpp @@ -1471,7 +1471,7 @@ namespace game DB_ZONE_BASEMAP = 0x20, DB_ZONE_TRANSIENT_POOL = 0x40, DB_ZONE_TRANSIENT_MASK = 0x40, - DB_ZONE_CUSTOM = 0x80, + DB_ZONE_CUSTOM = 0x1000, }; enum FF_DIR @@ -1486,6 +1486,15 @@ namespace game HANDLE handle; }; + enum DB_CompressorType + { + DB_COMPRESSOR_INVALID = 0x0, + DB_COMPRESSOR_ZLIB = 0x1, + DB_COMPRESSOR_UNK2 = 0x2, + DB_COMPRESSOR_PASSTHROUGH = 0x3, + DB_COMPRESSOR_LZX = 0x4, + }; + namespace mp { enum diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index 5058f15..216abeb 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -269,6 +269,7 @@ namespace game WEAK symbol g_assetEntryPool{0x142CC2400, 0x14379F100}; WEAK symbol g_poolSize{0x140804140, 0x1409B4B90}; WEAK symbol g_assetNames{0x140803C90, 0x1409B3180}; + WEAK symbol g_compressor{0x141598580, 0x141E0B080}; WEAK symbol threadIds{0x149632EC0, 0x147DCEA30};