diff --git a/.gitmodules b/.gitmodules index 3e52ed56..a6a9bd10 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,10 +25,6 @@ [submodule "deps/lua"] path = deps/lua url = https://github.com/lua/lua.git -[submodule "deps/stb"] - path = deps/stb - url = https://github.com/nothings/stb.git - branch = develop [submodule "deps/libtomcrypt"] path = deps/libtomcrypt url = https://github.com/libtom/libtomcrypt.git @@ -55,3 +51,6 @@ path = deps/gsc-tool url = https://github.com/xensik/gsc-tool.git branch = xlabs +[submodule "deps/stb"] + path = deps/stb + url = https://github.com/nothings/stb.git diff --git a/deps/GSL b/deps/GSL index 517ed292..6c6111ac 160000 --- a/deps/GSL +++ b/deps/GSL @@ -1 +1 @@ -Subproject commit 517ed29228d18cf2c5004d10826090108e06f049 +Subproject commit 6c6111acb7b5d687ac006969ac96e5b1f21374cd diff --git a/deps/asmjit b/deps/asmjit index 0c03ed2f..5b5b0b38 160000 --- a/deps/asmjit +++ b/deps/asmjit @@ -1 +1 @@ -Subproject commit 0c03ed2f7497441ac0de232bda2e6b8cc041b2dc +Subproject commit 5b5b0b38775938df4d3779604ff1db60b9a9dcbf diff --git a/deps/curl b/deps/curl index 89ee5cfb..3736c0a2 160000 --- a/deps/curl +++ b/deps/curl @@ -1 +1 @@ -Subproject commit 89ee5cfb38b22f9ff68c34aa55ca2c242be90826 +Subproject commit 3736c0a209d929bcb1c9da909096e406c7d444b7 diff --git a/deps/json b/deps/json index a3e6e26d..4c6cde72 160000 --- a/deps/json +++ b/deps/json @@ -1 +1 @@ -Subproject commit a3e6e26dc83a726b292f5be0492fcc408663ce55 +Subproject commit 4c6cde72e533158e044252718c013a48bcff346c diff --git a/deps/libtomcrypt b/deps/libtomcrypt index 3474ca37..29986d04 160000 --- a/deps/libtomcrypt +++ b/deps/libtomcrypt @@ -1 +1 @@ -Subproject commit 3474ca37124c6fe78f5461876542e226a25b5f1f +Subproject commit 29986d04f2dca985ee64fbca1c7431ea3e3422f4 diff --git a/deps/minhook b/deps/minhook index 426cb688..49d03ad1 160000 --- a/deps/minhook +++ b/deps/minhook @@ -1 +1 @@ -Subproject commit 426cb6880035ee3cceed05384bb3f2db01a20a15 +Subproject commit 49d03ad118cf7f6768c79a8f187e14b8f2a07f94 diff --git a/deps/protobuf b/deps/protobuf index 57786d12..7ce9c415 160000 --- a/deps/protobuf +++ b/deps/protobuf @@ -1 +1 @@ -Subproject commit 57786d126249b5ed4f42b579047941805e742949 +Subproject commit 7ce9c415455c098409222702b3b4572b47232882 diff --git a/deps/rapidjson b/deps/rapidjson index 06d58b9e..a98e9999 160000 --- a/deps/rapidjson +++ b/deps/rapidjson @@ -1 +1 @@ -Subproject commit 06d58b9e848c650114556a23294d0b6440078c61 +Subproject commit a98e99992bd633a2736cc41f96ec85ef0c50e44d diff --git a/deps/stb b/deps/stb index af1a5bc3..8b5f1f37 160000 --- a/deps/stb +++ b/deps/stb @@ -1 +1 @@ -Subproject commit af1a5bc352164740c1cc1354942b1c6b72eacb8a +Subproject commit 8b5f1f37b5b75829fc72d38e7b5d4bcbf8a26d55 diff --git a/deps/zlib b/deps/zlib index 04f42cec..e5546956 160000 --- a/deps/zlib +++ b/deps/zlib @@ -1 +1 @@ -Subproject commit 04f42ceca40f73e2978b50e93806c2a18c1281fc +Subproject commit e554695638228b846d49657f31eeff0ca4680e8a diff --git a/src/client/component/discord.cpp b/src/client/component/discord.cpp index b8587789..7677662f 100644 --- a/src/client/component/discord.cpp +++ b/src/client/component/discord.cpp @@ -67,9 +67,12 @@ namespace discord if (game::environment::is_mp()) { + static char clean_gametype[0x80] = {0}; const auto gametype = game::UI_GetGameTypeDisplayName( game::Dvar_FindVar("g_gametype")->current.string); - strcpy_s(details, 0x80, utils::string::va("%s on %s", gametype, mapname)); + utils::string::strip(gametype, + clean_gametype, sizeof(clean_gametype)); + strcpy_s(details, 0x80, utils::string::va("%s on %s", clean_gametype, mapname)); static char clean_hostname[0x80] = {0}; utils::string::strip(game::Dvar_FindVar("sv_hostname")->current.string, diff --git a/src/client/component/download.cpp b/src/client/component/download.cpp index 8ed64987..9d4ce938 100644 --- a/src/client/component/download.cpp +++ b/src/client/component/download.cpp @@ -174,7 +174,15 @@ namespace download const auto& result = data.value(); if (result.code != CURLE_OK) { - menu_error(utils::string::va("Download failed: %s (%i)\n", curl_easy_strerror(result.code), result.code)); + menu_error(utils::string::va("Download failed: %s (%i)\n", + curl_easy_strerror(result.code), result.code)); + return; + } + + if (result.response_code >= 400) + { + menu_error(utils::string::va("Download failed: Server returned bad response code %i\n", + result.response_code)); return; } diff --git a/src/client/component/fastfiles.cpp b/src/client/component/fastfiles.cpp index cfd984f1..a85bfb8b 100644 --- a/src/client/component/fastfiles.cpp +++ b/src/client/component/fastfiles.cpp @@ -167,6 +167,10 @@ namespace fastfiles { const auto language = game::SEH_GetCurrentLanguageCode(); try_load_zone(language + "_"s + name, false); + if (game::environment::is_mp()) + { + try_load_zone(language + "_"s + name + "_mp"s, false); + } } if (!fastfiles::exists(name)) @@ -256,7 +260,7 @@ namespace fastfiles { if (!mod_dir.empty()) { - const auto path = utils::string::va("%s\\%s\\%s", + const auto path = utils::string::va("%s\\%s\\%s", dir.data(), mod_dir.data(), base_filename); if (utils::io::file_exists(path)) @@ -309,7 +313,7 @@ namespace fastfiles return fastfiles::usermap_exists(file); } - template + template inline void merge(std::vector* target, T* source, size_t length) { if (source) @@ -321,7 +325,7 @@ namespace fastfiles } } - template + template inline void merge(std::vector* target, std::vector source) { for (auto& entry : source) @@ -450,7 +454,7 @@ namespace fastfiles }); } - void enum_assets(const game::XAssetType type, + void enum_assets(const game::XAssetType type, const std::function& callback, const bool includeOverride) { game::DB_EnumXAssets_Internal(type, static_cast([](game::XAssetHeader header, void* data) @@ -524,7 +528,7 @@ namespace fastfiles { utils::hook::nop(0x368153_b, 2); // DB_InflateInit } - + if (game::environment::is_sp()) { // Allow loading mp maps diff --git a/src/client/component/map_patches.cpp b/src/client/component/map_patches.cpp index 2e909163..7c59b80c 100644 --- a/src/client/component/map_patches.cpp +++ b/src/client/component/map_patches.cpp @@ -12,7 +12,7 @@ namespace map_patches public: void post_unpack() override { - if (!game::environment::is_mp()) + if (game::environment::is_sp()) { return; } diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index f09043c2..4303c910 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -183,6 +183,8 @@ namespace party cl_disconnect_hook.invoke(show_main_menu); } + std::unordered_map hash_cache; + std::string get_file_hash(const std::string& file) { if (!utils::io::file_exists(file)) @@ -190,8 +192,15 @@ namespace party return {}; } + const auto iter = hash_cache.find(file); + if (iter != hash_cache.end()) + { + return iter->second; + } + const auto data = utils::io::read_file(file); const auto sha = utils::cryptography::sha1::compute(data, true); + hash_cache[file] = sha; return sha; } @@ -450,6 +459,8 @@ namespace party return; } + fastfiles::set_usermap(mapname); + for (const auto& [ext, key, opt] : usermap_files) { char buffer[0x100] = {0}; @@ -493,6 +504,7 @@ namespace party fastfiles::set_usermap(map); } + hash_cache.clear(); current_sv_mapname = map; utils::hook::invoke(0x54BBB0_b, map, a2, a3, a4, a5); } diff --git a/src/common/utils/http.cpp b/src/common/utils/http.cpp index 987dadaf..d7afc2d3 100644 --- a/src/common/utils/http.cpp +++ b/src/common/utils/http.cpp @@ -83,11 +83,14 @@ namespace utils::http } const auto code = curl_easy_perform(curl); + unsigned int response_code{}; + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code); if (code == CURLE_OK) { result result; result.code = code; + result.response_code = response_code; result.buffer = std::move(buffer); return result; diff --git a/src/common/utils/http.hpp b/src/common/utils/http.hpp index d0e7c35c..d0fdbc2f 100644 --- a/src/common/utils/http.hpp +++ b/src/common/utils/http.hpp @@ -12,6 +12,7 @@ namespace utils::http struct result { CURLcode code{}; + unsigned int response_code{}; std::string buffer{}; };