Fix connect protocol and temporary workaround for localhost parties
This commit is contained in:
parent
72e98f8bbb
commit
d67aa26a5d
@ -219,7 +219,7 @@ namespace Components
|
|||||||
|
|
||||||
void Auth::StoreKey()
|
void Auth::StoreKey()
|
||||||
{
|
{
|
||||||
if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled())
|
if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled() && Auth::GuidKey.IsValid())
|
||||||
{
|
{
|
||||||
Proto::Auth::Certificate cert;
|
Proto::Auth::Certificate cert;
|
||||||
cert.set_token(Auth::GuidToken.ToString());
|
cert.set_token(Auth::GuidToken.ToString());
|
||||||
@ -363,7 +363,9 @@ namespace Components
|
|||||||
|
|
||||||
Localization::Set("MPUI_SECURITY_INCREASE_MESSAGE", "");
|
Localization::Set("MPUI_SECURITY_INCREASE_MESSAGE", "");
|
||||||
|
|
||||||
|
// Load the key
|
||||||
Auth::LoadKey(true);
|
Auth::LoadKey(true);
|
||||||
|
Steam::SteamUser()->GetSteamID();
|
||||||
|
|
||||||
QuickPatch::OnFrame(Auth::Frame);
|
QuickPatch::OnFrame(Auth::Frame);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ namespace Components
|
|||||||
ConnectProtocol::EvaluateProtocol();
|
ConnectProtocol::EvaluateProtocol();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ConnectProtocol::ConnectContainer.ConnectString.size() > 0);
|
return (!ConnectProtocol::ConnectContainer.ConnectString.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConnectProtocol::InstallProtocol()
|
bool ConnectProtocol::InstallProtocol()
|
||||||
|
@ -248,7 +248,7 @@ namespace Components
|
|||||||
if (IPCPipe::ServerPipe) delete IPCPipe::ServerPipe;
|
if (IPCPipe::ServerPipe) delete IPCPipe::ServerPipe;
|
||||||
if (IPCPipe::ClientPipe) delete IPCPipe::ClientPipe;
|
if (IPCPipe::ClientPipe) delete IPCPipe::ClientPipe;
|
||||||
|
|
||||||
IPCPipe::ServerPipe = 0;
|
IPCPipe::ServerPipe = nullptr;
|
||||||
IPCPipe::ClientPipe = 0;
|
IPCPipe::ClientPipe = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,11 @@ namespace Components
|
|||||||
}
|
}
|
||||||
bool Network::Address::IsLoopback()
|
bool Network::Address::IsLoopback()
|
||||||
{
|
{
|
||||||
|
if (this->GetIP().full == 0x100007f) // 127.0.0.1
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return Game::NET_IsLocalAddress(this->address);
|
return Game::NET_IsLocalAddress(this->address);
|
||||||
}
|
}
|
||||||
bool Network::Address::IsValid()
|
bool Network::Address::IsValid()
|
||||||
|
@ -90,6 +90,23 @@ namespace Components
|
|||||||
|
|
||||||
SteamID id = Party::GenerateLobbyId();
|
SteamID id = Party::GenerateLobbyId();
|
||||||
|
|
||||||
|
// Temporary workaround
|
||||||
|
// TODO: Patch the 127.0.0.1 -> loopback mapping in the party code
|
||||||
|
if (Party::Container.Target.IsLoopback())
|
||||||
|
{
|
||||||
|
if (*Game::numIP)
|
||||||
|
{
|
||||||
|
Party::Container.Target.SetIP(*Game::localIP);
|
||||||
|
Party::Container.Target.SetType(Game::netadrtype_t::NA_IP);
|
||||||
|
|
||||||
|
Logger::Print("Trying to connect to party with loopback address, using a local ip instead: %s\n", Party::Container.Target.GetCString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger::Print("Trying to connect to party with loopback address, but no local ip was found.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Party::LobbyMap[id.Bits] = Party::Container.Target;
|
Party::LobbyMap[id.Bits] = Party::Container.Target;
|
||||||
|
|
||||||
Game::Steam_JoinLobby(id, 0);
|
Game::Steam_JoinLobby(id, 0);
|
||||||
@ -220,6 +237,9 @@ namespace Components
|
|||||||
Utils::Hook::Xor<DWORD>(0x4D376D, Game::dvar_flag::DVAR_FLAG_LATCHED);
|
Utils::Hook::Xor<DWORD>(0x4D376D, Game::dvar_flag::DVAR_FLAG_LATCHED);
|
||||||
Utils::Hook::Xor<DWORD>(0x5E3789, Game::dvar_flag::DVAR_FLAG_LATCHED);
|
Utils::Hook::Xor<DWORD>(0x5E3789, Game::dvar_flag::DVAR_FLAG_LATCHED);
|
||||||
|
|
||||||
|
// Patch Live_PlayerHasLoopbackAddr
|
||||||
|
//Utils::Hook::Set<DWORD>(0x418F30, 0x90C3C033);
|
||||||
|
|
||||||
Command::Add("connect", [] (Command::Params params)
|
Command::Add("connect", [] (Command::Params params)
|
||||||
{
|
{
|
||||||
if (params.Length() < 2)
|
if (params.Length() < 2)
|
||||||
|
@ -327,6 +327,9 @@ namespace Components
|
|||||||
Utils::Hook::Set<DWORD>(0x45B98F, 0x5188FB); // profile_setBlacklevel
|
Utils::Hook::Set<DWORD>(0x45B98F, 0x5188FB); // profile_setBlacklevel
|
||||||
Utils::Hook::Set<DWORD>(0x45B9A5, 0x5188FB); // profile_toggleCanSkipOffensiveMissions
|
Utils::Hook::Set<DWORD>(0x45B9A5, 0x5188FB); // profile_toggleCanSkipOffensiveMissions
|
||||||
|
|
||||||
|
// Patch SV_IsClientUsingOnlineStatsOffline
|
||||||
|
Utils::Hook::Set<DWORD>(0x46B710, 0x90C3C033);
|
||||||
|
|
||||||
// Fix mouse pitch adjustments
|
// Fix mouse pitch adjustments
|
||||||
UIScript::Add("updateui_mousePitch", [] ()
|
UIScript::Add("updateui_mousePitch", [] ()
|
||||||
{
|
{
|
||||||
|
14
src/Main.cpp
14
src/Main.cpp
@ -4,10 +4,24 @@ namespace Main
|
|||||||
{
|
{
|
||||||
static Utils::Hook EntryPointHook;
|
static Utils::Hook EntryPointHook;
|
||||||
|
|
||||||
|
void SetEnvironment()
|
||||||
|
{
|
||||||
|
wchar_t exeName[512];
|
||||||
|
GetModuleFileName(GetModuleHandle(NULL), exeName, sizeof(exeName) / 2);
|
||||||
|
|
||||||
|
wchar_t* exeBaseName = wcsrchr(exeName, L'\\');
|
||||||
|
exeBaseName[0] = L'\0';
|
||||||
|
exeBaseName++;
|
||||||
|
|
||||||
|
SetCurrentDirectory(exeName);
|
||||||
|
}
|
||||||
|
|
||||||
void Initialize()
|
void Initialize()
|
||||||
{
|
{
|
||||||
Main::EntryPointHook.Uninstall();
|
Main::EntryPointHook.Uninstall();
|
||||||
|
|
||||||
|
SetEnvironment();
|
||||||
|
|
||||||
Utils::Cryptography::Initialize();
|
Utils::Cryptography::Initialize();
|
||||||
Components::Loader::Initialize();
|
Components::Loader::Initialize();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user