Get default node via hastebin
This commit is contained in:
parent
a5cca963e0
commit
2a4c06ad5e
@ -3,6 +3,7 @@
|
||||
namespace Components
|
||||
{
|
||||
std::string Network::SelectedPacket;
|
||||
wink::signal<wink::slot<Network::CallbackRaw>> Network::StartupSignal;
|
||||
std::map<std::string, wink::slot<Network::Callback>> Network::PacketHandlers;
|
||||
|
||||
Network::Address::Address(std::string addrString)
|
||||
@ -98,6 +99,11 @@ namespace Components
|
||||
Network::PacketHandlers[Utils::StrToLower(packet)] = callback;
|
||||
}
|
||||
|
||||
void Network::OnStart(Network::CallbackRaw* callback)
|
||||
{
|
||||
Network::StartupSignal.connect(callback);
|
||||
}
|
||||
|
||||
void Network::Send(Game::netsrc_t type, Network::Address target, std::string data)
|
||||
{
|
||||
// NET_OutOfBandPrint only supports non-binary data!
|
||||
@ -219,6 +225,21 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
void Network::NetworkStart()
|
||||
{
|
||||
Network::StartupSignal();
|
||||
}
|
||||
|
||||
void __declspec(naked) Network::NetworkStartStub()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov eax, 64D900h
|
||||
call eax
|
||||
jmp Network::NetworkStart
|
||||
}
|
||||
}
|
||||
|
||||
void __declspec(naked) Network::DeployPacketStub()
|
||||
{
|
||||
__asm
|
||||
@ -246,9 +267,15 @@ namespace Components
|
||||
Utils::Hook::Set<DWORD>(0x4AEF08, 0x1FFFC);
|
||||
Utils::Hook::Set<DWORD>(0x4AEFA3, 0x1FFFC);
|
||||
|
||||
// increase max port binding attempts from 10 to 255
|
||||
Utils::Hook::Set<BYTE>(0x4FD48A, 0xFF);
|
||||
|
||||
// Parse port as short in Net_AddrToString
|
||||
Utils::Hook::Set<char*>(0x4698E3, "%u.%u.%u.%u:%hu");
|
||||
|
||||
// Install startup handler
|
||||
Utils::Hook(0x4FD4D4, Network::NetworkStartStub, HOOK_JUMP).Install()->Quick();
|
||||
|
||||
// Install interception handler
|
||||
Utils::Hook(0x5AA709, Network::PacketInterceptionHandler, HOOK_CALL).Install()->Quick();
|
||||
|
||||
@ -260,5 +287,6 @@ namespace Components
|
||||
{
|
||||
Network::SelectedPacket.clear();
|
||||
Network::PacketHandlers.clear();
|
||||
Network::StartupSignal.clear();
|
||||
}
|
||||
}
|
||||
|
@ -39,12 +39,14 @@ namespace Components
|
||||
};
|
||||
|
||||
typedef void(Callback)(Address address, std::string data);
|
||||
typedef void(CallbackRaw)();
|
||||
|
||||
Network();
|
||||
~Network();
|
||||
const char* GetName() { return "Network"; };
|
||||
|
||||
static void Handle(std::string packet, Callback* callback);
|
||||
static void OnStart(CallbackRaw* callback);
|
||||
|
||||
// Send quake-styled binary data
|
||||
static void Send(Address target, std::string data);
|
||||
@ -65,9 +67,14 @@ namespace Components
|
||||
private:
|
||||
static SOCKET TcpSocket;
|
||||
static std::string SelectedPacket;
|
||||
static wink::signal<wink::slot<CallbackRaw>> StartupSignal;
|
||||
static std::map<std::string, wink::slot<Callback>> PacketHandlers;
|
||||
|
||||
static int PacketInterceptionHandler(const char* packet);
|
||||
static void DeployPacket(Game::netadr_t* from, Game::msg_t* msg);
|
||||
static void DeployPacketStub();
|
||||
|
||||
static void NetworkStart();
|
||||
static void NetworkStartStub();
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
namespace Components
|
||||
{
|
||||
Utils::Cryptography::ECDSA::Key Node::SignatureKey;
|
||||
@ -285,7 +287,7 @@ namespace Components
|
||||
// Load stored nodes
|
||||
Dvar::OnInit([] ()
|
||||
{
|
||||
Node::Nodes.clear();
|
||||
//Node::Nodes.clear();
|
||||
Node::LoadNodes();
|
||||
});
|
||||
|
||||
@ -648,6 +650,25 @@ namespace Components
|
||||
// Install frame handlers
|
||||
Dedicated::OnFrame(Node::FrameHandler);
|
||||
Renderer::OnFrame(Node::FrameHandler);
|
||||
|
||||
Network::OnStart([] ()
|
||||
{
|
||||
std::async([] ()
|
||||
{
|
||||
std::this_thread::sleep_for(100ms);
|
||||
|
||||
auto nodes = Utils::WebIO("IW4x", "http://hastebin.com/raw/qodibixora").Get();
|
||||
auto nodeArray = Utils::Explode(nodes, '\n');
|
||||
|
||||
for (auto nodeEntry : nodeArray)
|
||||
{
|
||||
if (!nodeEntry.empty())
|
||||
{
|
||||
Node::AddNode(nodeEntry);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Node::~Node()
|
||||
|
@ -16,6 +16,7 @@ namespace Components
|
||||
const char* GetName() { return "Node"; };
|
||||
bool UnitTest();
|
||||
|
||||
static void AddNode(Network::Address address);
|
||||
static std::vector<Network::Address> GetDediList();
|
||||
|
||||
private:
|
||||
@ -61,7 +62,6 @@ namespace Components
|
||||
static void LoadNodes();
|
||||
static void StoreNodes(bool force);
|
||||
|
||||
static void AddNode(Network::Address address);
|
||||
static void SendNodeList(Network::Address address);
|
||||
static NodeEntry* FindNode(Network::Address address);
|
||||
static ClientSession* FindSession(Network::Address address);
|
||||
|
@ -177,6 +177,8 @@ namespace Game
|
||||
|
||||
gentity_t* g_entities = (gentity_t*)0x18835D8;
|
||||
|
||||
SOCKET* ip_socket = (SOCKET*)0x64A3008;
|
||||
|
||||
void* ReallocateAssetPool(XAssetType type, unsigned int newSize)
|
||||
{
|
||||
int elSize = DB_GetXAssetSizeHandlers[type]();
|
||||
|
@ -357,6 +357,8 @@ namespace Game
|
||||
|
||||
extern gentity_t* g_entities;
|
||||
|
||||
extern SOCKET* ip_socket;
|
||||
|
||||
void* ReallocateAssetPool(XAssetType type, unsigned int newSize);
|
||||
void Menu_FreeItemMemory(Game::itemDef_t* item);
|
||||
const char* TabeLookup(StringTable* stringtable, int row, int column);
|
||||
|
Loading…
Reference in New Issue
Block a user