Allow long mapnames in playlist

This commit is contained in:
momo5502 2016-11-02 18:44:20 +01:00
parent 9a2e72cb3d
commit 11ace37f2e
8 changed files with 39 additions and 9 deletions

2
deps/fmt vendored

@ -1 +1 @@
Subproject commit 8f455c10b0f1aee898f71313b21c43b098dadb34
Subproject commit 7ce7def515a38ea87517a1cd6406e4b773da241b

2
deps/mongoose vendored

@ -1 +1 @@
Subproject commit 39a17f8a72ecc8b4ff842f0f3c81e55dc8e988fb
Subproject commit f4f310cf517b029b04878095551c38573692d062

2
deps/zlib vendored

@ -1 +1 @@
Subproject commit d1d577490c15a0c6862473d7576352a9f18ef811
Subproject commit 94575859cf7f657f0f31aff4c50761fe3f182699

View File

@ -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

View File

@ -4,6 +4,7 @@ namespace Components
{
std::string Playlist::CurrentPlaylistBuffer;
std::string Playlist::ReceivedPlaylistBuffer;
std::map<const void*, std::string> 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<bool>(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<DWORD(const char**)>(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<void(char*, const char*, int)>(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<bool>(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();
}

View File

@ -18,9 +18,14 @@ namespace Components
private:
static std::string CurrentPlaylistBuffer;
static std::map<const void*, std::string> 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);
};
}

View File

@ -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;

View File

@ -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;