Merge branch 'master'
This commit is contained in:
commit
fa71b85a11
@ -35,13 +35,14 @@ namespace Components
|
|||||||
Command::Execute("onlinegame 1");
|
Command::Execute("onlinegame 1");
|
||||||
Command::Execute("exec default_xboxlive.cfg");
|
Command::Execute("exec default_xboxlive.cfg");
|
||||||
Command::Execute("xblive_rankedmatch 1");
|
Command::Execute("xblive_rankedmatch 1");
|
||||||
Command::Execute("xblive_privatematch 0");
|
Command::Execute("xblive_privatematch 1");
|
||||||
//Command::Execute("xstartprivatematch");
|
Command::Execute("xstartprivatematch");
|
||||||
|
//Command::Execute("xstartlobby");
|
||||||
Command::Execute("sv_network_fps 1000");
|
Command::Execute("sv_network_fps 1000");
|
||||||
Command::Execute("com_maxfps 125");
|
Command::Execute("com_maxfps 125");
|
||||||
|
|
||||||
// Process command line?
|
// Process command line?
|
||||||
Utils::Hook::Call<void()>(0x60C3D0)();
|
//Utils::Hook::Call<void()>(0x60C3D0)();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(naked) Dedicated::PostInitializationStub()
|
void __declspec(naked) Dedicated::PostInitializationStub()
|
||||||
@ -58,7 +59,7 @@ namespace Components
|
|||||||
|
|
||||||
void Dedicated::MapRotate()
|
void Dedicated::MapRotate()
|
||||||
{
|
{
|
||||||
if (Dvar::Var("party_host").Get<bool>())
|
if (Dvar::Var("party_enable").Get<bool>() && Dvar::Var("party_host").Get<bool>())
|
||||||
{
|
{
|
||||||
Logger::Print("Not performing map rotation as we are hosting a party!\n");
|
Logger::Print("Not performing map rotation as we are hosting a party!\n");
|
||||||
return;
|
return;
|
||||||
@ -257,13 +258,6 @@ namespace Components
|
|||||||
Dedicated::Heartbeat();
|
Dedicated::Heartbeat();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wrap xstartprivatematch
|
|
||||||
Command::Add("lobby_start", [] (Command::Params params)
|
|
||||||
{
|
|
||||||
Playlist::LoadPlaylist();
|
|
||||||
Command::Execute("xstartprivatematch", false);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
std::vector<Dvar::Callback> Dvar::RegistrationCallbacks;
|
||||||
|
|
||||||
Dvar::Var::Var(std::string dvarName) : Var()
|
Dvar::Var::Var(std::string dvarName) : Var()
|
||||||
{
|
{
|
||||||
this->dvar = Game::Dvar_FindVar(dvarName.data());
|
this->dvar = Game::Dvar_FindVar(dvarName.data());
|
||||||
@ -125,9 +127,18 @@ namespace Components
|
|||||||
return Game::Dvar_RegisterInt(name, value, min, max, flag.val, description);
|
return Game::Dvar_RegisterInt(name, value, min, max, flag.val, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Dvar::OnInit(Dvar::Callback callback)
|
||||||
|
{
|
||||||
|
Dvar::RegistrationCallbacks.push_back(callback);
|
||||||
|
}
|
||||||
|
|
||||||
Game::dvar_t* Dvar::RegisterName(const char* name, const char* default, Game::dvar_flag flag, const char* description)
|
Game::dvar_t* Dvar::RegisterName(const char* name, const char* default, Game::dvar_flag flag, const char* description)
|
||||||
{
|
{
|
||||||
// TODO: Register string dvars here
|
// Run callbacks
|
||||||
|
for (auto callback : Dvar::RegistrationCallbacks)
|
||||||
|
{
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
|
||||||
// Name watcher
|
// Name watcher
|
||||||
Renderer::OnFrame([] ()
|
Renderer::OnFrame([] ()
|
||||||
@ -171,4 +182,9 @@ namespace Components
|
|||||||
// Hook dvar 'name' registration
|
// Hook dvar 'name' registration
|
||||||
Utils::Hook(0x40531C, Dvar::RegisterName, HOOK_CALL).Install()->Quick();
|
Utils::Hook(0x40531C, Dvar::RegisterName, HOOK_CALL).Install()->Quick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dvar::~Dvar()
|
||||||
|
{
|
||||||
|
Dvar::RegistrationCallbacks.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ namespace Components
|
|||||||
class Dvar : public Component
|
class Dvar : public Component
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
typedef void(*Callback)();
|
||||||
|
|
||||||
struct Flag
|
struct Flag
|
||||||
{
|
{
|
||||||
Flag(Game::dvar_flag flag) : val(flag){};
|
Flag(Game::dvar_flag flag) : val(flag){};
|
||||||
@ -37,13 +39,18 @@ namespace Components
|
|||||||
};
|
};
|
||||||
|
|
||||||
Dvar();
|
Dvar();
|
||||||
|
~Dvar();
|
||||||
const char* GetName() { return "Dvar"; };
|
const char* GetName() { return "Dvar"; };
|
||||||
|
|
||||||
|
static void OnInit(Callback callback);
|
||||||
|
|
||||||
// Only strings and bools use this type of declaration
|
// Only strings and bools use this type of declaration
|
||||||
template<typename T> static Var Register(const char* name, T value, Flag flag, const char* description);
|
template<typename T> static Var Register(const char* name, T value, Flag flag, const char* description);
|
||||||
template<typename T> static Var Register(const char* name, T value, T min, T max, Flag flag, const char* description);
|
template<typename T> static Var Register(const char* name, T value, T min, T max, Flag flag, const char* description);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static std::vector<Callback> RegistrationCallbacks;
|
||||||
|
|
||||||
static Game::dvar_t* RegisterName(const char* name, const char* default, Game::dvar_flag flag, const char* description);
|
static Game::dvar_t* RegisterName(const char* name, const char* default, Game::dvar_flag flag, const char* description);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -97,8 +97,21 @@ namespace Components
|
|||||||
if (Party::LobbyMap.size() <= 1) Game::Steam_JoinLobby(id, 0);
|
if (Party::LobbyMap.size() <= 1) Game::Steam_JoinLobby(id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DWORD Party::UIDvarIntStub(char* dvar)
|
||||||
|
{
|
||||||
|
if (!_stricmp(dvar, "onlinegame"))
|
||||||
|
{
|
||||||
|
return 0x649E660;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Utils::Hook::Call<DWORD(char*)>(0x4D5390)(dvar);
|
||||||
|
}
|
||||||
|
|
||||||
Party::Party()
|
Party::Party()
|
||||||
{
|
{
|
||||||
|
Dvar::Register<bool>("party_enable", false, Game::dvar_flag::DVAR_FLAG_NONE, "Enable party system");
|
||||||
|
Dvar::Register<bool>("xblive_privatematch", true, Game::dvar_flag::DVAR_FLAG_WRITEPROTECTED, "").Get<Game::dvar_t*>();
|
||||||
|
|
||||||
// various changes to SV_DirectConnect-y stuff to allow non-party joinees
|
// various changes to SV_DirectConnect-y stuff to allow non-party joinees
|
||||||
Utils::Hook::Set<WORD>(0x460D96, 0x90E9);
|
Utils::Hook::Set<WORD>(0x460D96, 0x90E9);
|
||||||
Utils::Hook::Set<BYTE>(0x460F0A, 0xEB);
|
Utils::Hook::Set<BYTE>(0x460F0A, 0xEB);
|
||||||
@ -140,6 +153,29 @@ namespace Components
|
|||||||
// Allow xpartygo in public lobbies
|
// Allow xpartygo in public lobbies
|
||||||
Utils::Hook::Set<BYTE>(0x5A969E, 0xEB);
|
Utils::Hook::Set<BYTE>(0x5A969E, 0xEB);
|
||||||
|
|
||||||
|
// Always open lobby menu when connecting
|
||||||
|
// It's not possible to entirely patch it via code
|
||||||
|
//Utils::Hook::Set<BYTE>(0x5B1698, 0xEB);
|
||||||
|
//Utils::Hook::Nop(0x5029F2, 6);
|
||||||
|
//Utils::Hook::SetString(0x70573C, "menu_xboxlive_lobby");
|
||||||
|
|
||||||
|
// Disallow selecting team in private match
|
||||||
|
//Utils::Hook::Nop(0x5B2BD8, 6);
|
||||||
|
|
||||||
|
// Force teams, even if not private match
|
||||||
|
Utils::Hook::Set<BYTE>(0x487BB2, 0xEB);
|
||||||
|
|
||||||
|
// Force xblive_privatematch 0 and rename it
|
||||||
|
Utils::Hook::Set<BYTE>(0x420A6A, 4);
|
||||||
|
Utils::Hook::Set<BYTE>(0x420A6C, 0);
|
||||||
|
Utils::Hook::Set<char*>(0x420A6E, "xblive_privatematch2");
|
||||||
|
|
||||||
|
// Enable XP Bar
|
||||||
|
Utils::Hook(0x62A2A7, Party::UIDvarIntStub, HOOK_CALL).Install()->Quick();
|
||||||
|
|
||||||
|
// Fix xstartlobby
|
||||||
|
//Utils::Hook::Set<BYTE>(0x5B71CD, 0xEB);
|
||||||
|
|
||||||
// Patch party_minplayers to 1 and protect it
|
// Patch party_minplayers to 1 and protect it
|
||||||
//Utils::Hook(0x4D5D51, Party::RegisterMinPlayers, HOOK_CALL).Install()->Quick();
|
//Utils::Hook(0x4D5D51, Party::RegisterMinPlayers, HOOK_CALL).Install()->Quick();
|
||||||
|
|
||||||
@ -225,7 +261,7 @@ namespace Components
|
|||||||
// 1 - Party, use Steam_JoinLobby to connect
|
// 1 - Party, use Steam_JoinLobby to connect
|
||||||
// 2 - Match, use CL_ConnectFromParty to connect
|
// 2 - Match, use CL_ConnectFromParty to connect
|
||||||
|
|
||||||
if (Dvar::Var("party_host").Get<bool>()) // Party hosting
|
if (Dvar::Var("party_enable").Get<bool>() && Dvar::Var("party_host").Get<bool>()) // Party hosting
|
||||||
{
|
{
|
||||||
info.Set("matchtype", "1");
|
info.Set("matchtype", "1");
|
||||||
}
|
}
|
||||||
|
@ -36,5 +36,7 @@ namespace Components
|
|||||||
static Game::dvar_t* RegisterMinPlayers(const char* name, int value, int min, int max, Game::dvar_flag flag, const char* description);
|
static Game::dvar_t* RegisterMinPlayers(const char* name, int value, int min, int max, Game::dvar_flag flag, const char* description);
|
||||||
|
|
||||||
static void ConnectError(std::string message);
|
static void ConnectError(std::string message);
|
||||||
|
|
||||||
|
static DWORD UIDvarIntStub(char* dvar);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -59,17 +59,8 @@ namespace Components
|
|||||||
|
|
||||||
Playlist::Playlist()
|
Playlist::Playlist()
|
||||||
{
|
{
|
||||||
// Apply new playlist
|
// Default playlists
|
||||||
char* playlist = "mp_playlists_dlc2";
|
Utils::Hook::Set<char*>(0x60B06E, "playlists_default.info");
|
||||||
Utils::Hook::Set<char*>(0x494803, playlist);
|
|
||||||
Utils::Hook::Set<char*>(0x4C6EC1, playlist);
|
|
||||||
Utils::Hook::Set<char*>(0x4CF7F9, playlist);
|
|
||||||
Utils::Hook::Set<char*>(0x4D6E63, playlist);
|
|
||||||
Utils::Hook::Set<char*>(0x4D7358, playlist);
|
|
||||||
Utils::Hook::Set<char*>(0x4D73C8, playlist);
|
|
||||||
Utils::Hook::Set<char*>(0x4F4EA1, playlist);
|
|
||||||
Utils::Hook::Set<char*>(0x4D47FB, "mp_playlists_dlc2.ff");
|
|
||||||
Utils::Hook::Set<char*>(0x60B06E, "playlists.patch2");
|
|
||||||
|
|
||||||
// disable playlist download function
|
// disable playlist download function
|
||||||
Utils::Hook::Set<BYTE>(0x4D4790, 0xC3);
|
Utils::Hook::Set<BYTE>(0x4D4790, 0xC3);
|
||||||
@ -92,7 +83,7 @@ namespace Components
|
|||||||
// Store playlist buffer on load
|
// Store playlist buffer on load
|
||||||
Utils::Hook(0x42961C, Playlist::StorePlaylistStub, HOOK_CALL).Install()->Quick();
|
Utils::Hook(0x42961C, Playlist::StorePlaylistStub, HOOK_CALL).Install()->Quick();
|
||||||
|
|
||||||
if (Dedicated::IsDedicated())
|
//if (Dedicated::IsDedicated())
|
||||||
{
|
{
|
||||||
// Custom playlist loading
|
// Custom playlist loading
|
||||||
Utils::Hook(0x420B5A, Playlist::LoadPlaylist, HOOK_JUMP).Install()->Quick();
|
Utils::Hook(0x420B5A, Playlist::LoadPlaylist, HOOK_JUMP).Install()->Quick();
|
||||||
|
Loading…
Reference in New Issue
Block a user