diff --git a/deps/fmt b/deps/fmt index 8f455c10..7ce7def5 160000 --- a/deps/fmt +++ b/deps/fmt @@ -1 +1 @@ -Subproject commit 8f455c10b0f1aee898f71313b21c43b098dadb34 +Subproject commit 7ce7def515a38ea87517a1cd6406e4b773da241b diff --git a/deps/mongoose b/deps/mongoose index 39a17f8a..f4f310cf 160000 --- a/deps/mongoose +++ b/deps/mongoose @@ -1 +1 @@ -Subproject commit 39a17f8a72ecc8b4ff842f0f3c81e55dc8e988fb +Subproject commit f4f310cf517b029b04878095551c38573692d062 diff --git a/deps/zlib b/deps/zlib index d1d57749..94575859 160000 --- a/deps/zlib +++ b/deps/zlib @@ -1 +1 @@ -Subproject commit d1d577490c15a0c6862473d7576352a9f18ef811 +Subproject commit 94575859cf7f657f0f31aff4c50761fe3f182699 diff --git a/premake/zlib.lua b/premake/zlib.lua index b520c48d..77d4c349 100644 --- a/premake/zlib.lua +++ b/premake/zlib.lua @@ -21,6 +21,7 @@ function zlib.includes() if not zlib.settings then error("You need to call zlib.setup first") end includedirs { zlib.settings.source } + defines { "ssize_t=int" } defines(zlib.settings.defines) end diff --git a/src/Components/Modules/Playlist.cpp b/src/Components/Modules/Playlist.cpp index 08a7057d..b44d4e44 100644 --- a/src/Components/Modules/Playlist.cpp +++ b/src/Components/Modules/Playlist.cpp @@ -4,6 +4,7 @@ namespace Components { std::string Playlist::CurrentPlaylistBuffer; std::string Playlist::ReceivedPlaylistBuffer; + std::map Playlist::MapRelocation; void Playlist::LoadPlaylist() { @@ -26,7 +27,7 @@ namespace Components if (playlist.Exists()) { Logger::Print("Parsing playlist '%s'...\n", playlist.GetName().data()); - Game::Live_ParsePlaylists(playlist.GetBuffer().data()); + Game::Playlist_ParsePlaylists(playlist.GetBuffer().data()); Utils::Hook::Set(0x1AD3680, true); // Playlist loaded } else @@ -37,6 +38,7 @@ namespace Components DWORD Playlist::StorePlaylistStub(const char** buffer) { + Playlist::MapRelocation.clear(); Playlist::CurrentPlaylistBuffer = *buffer; return Utils::Hook::Call(0x4C0350)(buffer); } @@ -87,7 +89,7 @@ namespace Components // Load and continue connection Logger::Print("Received playlist, loading and continuing connection...\n"); - Game::Live_ParsePlaylists(Playlist::ReceivedPlaylistBuffer.data()); + Game::Playlist_ParsePlaylists(Playlist::ReceivedPlaylistBuffer.data()); Party::PlaylistContinue(); } } @@ -102,6 +104,23 @@ namespace Components } } + void Playlist::MapNameCopy(char *dest, const char *src, int destsize) + { + Utils::Hook::Call(0x4D6F80)(dest, src, destsize); + Playlist::MapRelocation[dest] = src; + } + + void Playlist::SetMapName(const char* cvar, const char* value) + { + auto i = Playlist::MapRelocation.find(value); + if (i != Playlist::MapRelocation.end()) + { + value = i->second.data(); + } + + Game::Dvar_SetStringByName(cvar, value); + } + Playlist::Playlist() { // Default playlists @@ -125,6 +144,9 @@ namespace Components //Got playlists is true //Utils::Hook::Set(0x1AD3680, true); + Utils::Hook(0x42A19D, Playlist::MapNameCopy, HOOK_CALL).Install()->Quick(); + Utils::Hook(0x4A6FEE, Playlist::SetMapName, HOOK_CALL).Install()->Quick(); + // Store playlist buffer on load Utils::Hook(0x42961C, Playlist::StorePlaylistStub, HOOK_CALL).Install()->Quick(); @@ -143,6 +165,7 @@ namespace Components Playlist::~Playlist() { + Playlist::MapRelocation.clear(); Playlist::CurrentPlaylistBuffer.clear(); Playlist::ReceivedPlaylistBuffer.clear(); } diff --git a/src/Components/Modules/Playlist.hpp b/src/Components/Modules/Playlist.hpp index 15cbfa5a..550c6ad3 100644 --- a/src/Components/Modules/Playlist.hpp +++ b/src/Components/Modules/Playlist.hpp @@ -18,9 +18,14 @@ namespace Components private: static std::string CurrentPlaylistBuffer; + static std::map MapRelocation; + static DWORD StorePlaylistStub(const char** buffer); static void PlaylistRequest(Network::Address address, std::string data); static void PlaylistReponse(Network::Address address, std::string data); + + static void MapNameCopy(char *dest, const char *src, int destsize); + static void SetMapName(const char* cvar, const char* value); }; } diff --git a/src/Game/Functions.cpp b/src/Game/Functions.cpp index d0b66073..335bbf43 100644 --- a/src/Game/Functions.cpp +++ b/src/Game/Functions.cpp @@ -151,7 +151,6 @@ namespace Game NET_OutOfBandData_t NET_OutOfBandData = (NET_OutOfBandData_t)0x49C7E0; Live_MPAcceptInvite_t Live_MPAcceptInvite = (Live_MPAcceptInvite_t)0x420A6D; - Live_ParsePlaylists_t Live_ParsePlaylists = (Live_ParsePlaylists_t)0x4295A0; LoadModdableRawfile_t LoadModdableRawfile = (LoadModdableRawfile_t)0x61ABC0; @@ -164,6 +163,8 @@ namespace Game PartyHost_GetMemberAddressBySlot_t PartyHost_GetMemberAddressBySlot = (PartyHost_GetMemberAddressBySlot_t)0x44E100; PartyHost_GetMemberName_t PartyHost_GetMemberName = (PartyHost_GetMemberName_t)0x44BE90; + Playlist_ParsePlaylists_t Playlist_ParsePlaylists = (Playlist_ParsePlaylists_t)0x4295A0; + R_AddCmdDrawStretchPic_t R_AddCmdDrawStretchPic = (R_AddCmdDrawStretchPic_t)0x509770; R_AllocStaticIndexBuffer_t R_AllocStaticIndexBuffer = (R_AllocStaticIndexBuffer_t)0x51E7A0; R_Cinematic_StartPlayback_Now_t R_Cinematic_StartPlayback_Now = (R_Cinematic_StartPlayback_Now_t)0x51C5B0; diff --git a/src/Game/Functions.hpp b/src/Game/Functions.hpp index b74c33e9..ca3de9dc 100644 --- a/src/Game/Functions.hpp +++ b/src/Game/Functions.hpp @@ -371,9 +371,6 @@ namespace Game typedef void(__cdecl * Live_MPAcceptInvite_t)(_XSESSION_INFO *hostInfo, const int controllerIndex, bool fromGameInvite); extern Live_MPAcceptInvite_t Live_MPAcceptInvite; - typedef void(__cdecl * Live_ParsePlaylists_t)(const char* data); - extern Live_ParsePlaylists_t Live_ParsePlaylists; - typedef char* (__cdecl * LoadModdableRawfile_t)(int a1, const char* filename); extern LoadModdableRawfile_t LoadModdableRawfile; @@ -398,6 +395,9 @@ namespace Game typedef const char *(__cdecl * PartyHost_GetMemberName_t)(PartyData_s* party, const int clientNum); extern PartyHost_GetMemberName_t PartyHost_GetMemberName; + typedef void(__cdecl * Playlist_ParsePlaylists_t)(const char* data); + extern Playlist_ParsePlaylists_t Playlist_ParsePlaylists; + typedef Font* (__cdecl * R_RegisterFont_t)(const char* asset); extern R_RegisterFont_t R_RegisterFont;