Merge branch 'develop' into confirmation-v2

This commit is contained in:
m 2022-12-22 07:10:33 -06:00
commit 160b5cd325
18 changed files with 52 additions and 22 deletions

7
.gitmodules vendored
View File

@ -25,10 +25,6 @@
[submodule "deps/lua"] [submodule "deps/lua"]
path = deps/lua path = deps/lua
url = https://github.com/lua/lua.git 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"] [submodule "deps/libtomcrypt"]
path = deps/libtomcrypt path = deps/libtomcrypt
url = https://github.com/libtom/libtomcrypt.git url = https://github.com/libtom/libtomcrypt.git
@ -55,3 +51,6 @@
path = deps/gsc-tool path = deps/gsc-tool
url = https://github.com/xensik/gsc-tool.git url = https://github.com/xensik/gsc-tool.git
branch = xlabs branch = xlabs
[submodule "deps/stb"]
path = deps/stb
url = https://github.com/nothings/stb.git

2
deps/GSL vendored

@ -1 +1 @@
Subproject commit 517ed29228d18cf2c5004d10826090108e06f049 Subproject commit 6c6111acb7b5d687ac006969ac96e5b1f21374cd

2
deps/asmjit vendored

@ -1 +1 @@
Subproject commit 0c03ed2f7497441ac0de232bda2e6b8cc041b2dc Subproject commit 5b5b0b38775938df4d3779604ff1db60b9a9dcbf

2
deps/curl vendored

@ -1 +1 @@
Subproject commit 89ee5cfb38b22f9ff68c34aa55ca2c242be90826 Subproject commit 3736c0a209d929bcb1c9da909096e406c7d444b7

2
deps/json vendored

@ -1 +1 @@
Subproject commit a3e6e26dc83a726b292f5be0492fcc408663ce55 Subproject commit 4c6cde72e533158e044252718c013a48bcff346c

2
deps/libtomcrypt vendored

@ -1 +1 @@
Subproject commit 3474ca37124c6fe78f5461876542e226a25b5f1f Subproject commit 29986d04f2dca985ee64fbca1c7431ea3e3422f4

2
deps/minhook vendored

@ -1 +1 @@
Subproject commit 426cb6880035ee3cceed05384bb3f2db01a20a15 Subproject commit 49d03ad118cf7f6768c79a8f187e14b8f2a07f94

2
deps/protobuf vendored

@ -1 +1 @@
Subproject commit 57786d126249b5ed4f42b579047941805e742949 Subproject commit 7ce9c415455c098409222702b3b4572b47232882

2
deps/rapidjson vendored

@ -1 +1 @@
Subproject commit 06d58b9e848c650114556a23294d0b6440078c61 Subproject commit a98e99992bd633a2736cc41f96ec85ef0c50e44d

2
deps/stb vendored

@ -1 +1 @@
Subproject commit af1a5bc352164740c1cc1354942b1c6b72eacb8a Subproject commit 8b5f1f37b5b75829fc72d38e7b5d4bcbf8a26d55

2
deps/zlib vendored

@ -1 +1 @@
Subproject commit 04f42ceca40f73e2978b50e93806c2a18c1281fc Subproject commit e554695638228b846d49657f31eeff0ca4680e8a

View File

@ -67,9 +67,12 @@ namespace discord
if (game::environment::is_mp()) if (game::environment::is_mp())
{ {
static char clean_gametype[0x80] = {0};
const auto gametype = game::UI_GetGameTypeDisplayName( const auto gametype = game::UI_GetGameTypeDisplayName(
game::Dvar_FindVar("g_gametype")->current.string); 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}; static char clean_hostname[0x80] = {0};
utils::string::strip(game::Dvar_FindVar("sv_hostname")->current.string, utils::string::strip(game::Dvar_FindVar("sv_hostname")->current.string,

View File

@ -174,7 +174,15 @@ namespace download
const auto& result = data.value(); const auto& result = data.value();
if (result.code != CURLE_OK) 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; return;
} }

View File

@ -167,6 +167,10 @@ namespace fastfiles
{ {
const auto language = game::SEH_GetCurrentLanguageCode(); const auto language = game::SEH_GetCurrentLanguageCode();
try_load_zone(language + "_"s + name, false); 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)) if (!fastfiles::exists(name))
@ -256,7 +260,7 @@ namespace fastfiles
{ {
if (!mod_dir.empty()) 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); dir.data(), mod_dir.data(), base_filename);
if (utils::io::file_exists(path)) if (utils::io::file_exists(path))
@ -309,7 +313,7 @@ namespace fastfiles
return fastfiles::usermap_exists(file); return fastfiles::usermap_exists(file);
} }
template <typename T> template <typename T>
inline void merge(std::vector<T>* target, T* source, size_t length) inline void merge(std::vector<T>* target, T* source, size_t length)
{ {
if (source) if (source)
@ -321,7 +325,7 @@ namespace fastfiles
} }
} }
template <typename T> template <typename T>
inline void merge(std::vector<T>* target, std::vector<T> source) inline void merge(std::vector<T>* target, std::vector<T> source)
{ {
for (auto& entry : 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<void(game::XAssetHeader)>& callback, const bool includeOverride) const std::function<void(game::XAssetHeader)>& callback, const bool includeOverride)
{ {
game::DB_EnumXAssets_Internal(type, static_cast<void(*)(game::XAssetHeader, void*)>([](game::XAssetHeader header, void* data) game::DB_EnumXAssets_Internal(type, static_cast<void(*)(game::XAssetHeader, void*)>([](game::XAssetHeader header, void* data)
@ -524,7 +528,7 @@ namespace fastfiles
{ {
utils::hook::nop(0x368153_b, 2); // DB_InflateInit utils::hook::nop(0x368153_b, 2); // DB_InflateInit
} }
if (game::environment::is_sp()) if (game::environment::is_sp())
{ {
// Allow loading mp maps // Allow loading mp maps

View File

@ -12,7 +12,7 @@ namespace map_patches
public: public:
void post_unpack() override void post_unpack() override
{ {
if (!game::environment::is_mp()) if (game::environment::is_sp())
{ {
return; return;
} }

View File

@ -183,6 +183,8 @@ namespace party
cl_disconnect_hook.invoke<void>(show_main_menu); cl_disconnect_hook.invoke<void>(show_main_menu);
} }
std::unordered_map<std::string, std::string> hash_cache;
std::string get_file_hash(const std::string& file) std::string get_file_hash(const std::string& file)
{ {
if (!utils::io::file_exists(file)) if (!utils::io::file_exists(file))
@ -190,8 +192,15 @@ namespace party
return {}; 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 data = utils::io::read_file(file);
const auto sha = utils::cryptography::sha1::compute(data, true); const auto sha = utils::cryptography::sha1::compute(data, true);
hash_cache[file] = sha;
return sha; return sha;
} }
@ -450,6 +459,8 @@ namespace party
return; return;
} }
fastfiles::set_usermap(mapname);
for (const auto& [ext, key, opt] : usermap_files) for (const auto& [ext, key, opt] : usermap_files)
{ {
char buffer[0x100] = {0}; char buffer[0x100] = {0};
@ -493,6 +504,7 @@ namespace party
fastfiles::set_usermap(map); fastfiles::set_usermap(map);
} }
hash_cache.clear();
current_sv_mapname = map; current_sv_mapname = map;
utils::hook::invoke<void>(0x54BBB0_b, map, a2, a3, a4, a5); utils::hook::invoke<void>(0x54BBB0_b, map, a2, a3, a4, a5);
} }

View File

@ -83,11 +83,14 @@ namespace utils::http
} }
const auto code = curl_easy_perform(curl); const auto code = curl_easy_perform(curl);
unsigned int response_code{};
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
if (code == CURLE_OK) if (code == CURLE_OK)
{ {
result result; result result;
result.code = code; result.code = code;
result.response_code = response_code;
result.buffer = std::move(buffer); result.buffer = std::move(buffer);
return result; return result;

View File

@ -12,6 +12,7 @@ namespace utils::http
struct result struct result
{ {
CURLcode code{}; CURLcode code{};
unsigned int response_code{};
std::string buffer{}; std::string buffer{};
}; };