Prepare connecting
This commit is contained in:
parent
5c1fe422e4
commit
1f525186e9
@ -160,6 +160,25 @@ namespace network
|
|||||||
send_data(address, data.data(), data.size());
|
send_data(address, data.data(), data.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
game::netadr_t address_from_string(const std::string& address)
|
||||||
|
{
|
||||||
|
game::netadr_t addr{};
|
||||||
|
addr.localNetID = game::NS_SERVER;
|
||||||
|
|
||||||
|
if (!game::NET_StringToAdr(address.data(), &addr))
|
||||||
|
{
|
||||||
|
addr.type = game::NA_BAD;
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addr.type == game::NA_IP)
|
||||||
|
{
|
||||||
|
addr.type = game::NA_RAWIP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
|
||||||
class component final : public component_interface
|
class component final : public component_interface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -12,4 +12,6 @@ namespace network
|
|||||||
|
|
||||||
void send_data(const game::netadr_t& address, const void* data, size_t length);
|
void send_data(const game::netadr_t& address, const void* data, size_t length);
|
||||||
void send_data(const game::netadr_t& address, const std::string& data);
|
void send_data(const game::netadr_t& address, const std::string& data);
|
||||||
|
|
||||||
|
game::netadr_t address_from_string(const std::string& address);
|
||||||
}
|
}
|
||||||
|
37
src/client/component/party.cpp
Normal file
37
src/client/component/party.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#include <std_include.hpp>
|
||||||
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
|
#include "network.hpp"
|
||||||
|
#include "game/game.hpp"
|
||||||
|
|
||||||
|
#include <utils/hook.hpp>
|
||||||
|
|
||||||
|
namespace party
|
||||||
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
void connect_stub(const char* address)
|
||||||
|
{
|
||||||
|
auto addr = network::address_from_string(address);
|
||||||
|
|
||||||
|
game::XSESSION_INFO info{};
|
||||||
|
game::CL_ConnectFromLobby(0, &info, &addr, 1, 0, "mp_nuketown_x", "tdm");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class component final : public component_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void post_unpack() override
|
||||||
|
{
|
||||||
|
utils::hook::jump(0x141EE6030_g, connect_stub);
|
||||||
|
|
||||||
|
/*network::on("_pong", [](const game::netadr_t& source, const network::data_view& data)
|
||||||
|
{
|
||||||
|
|
||||||
|
});*/
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
REGISTER_COMPONENT(party::component)
|
@ -35,6 +35,8 @@ namespace game
|
|||||||
|
|
||||||
// NET
|
// NET
|
||||||
WEAK symbol<bool(netsrc_t sock, int length, const void* data, const netadr_t* to)> NET_SendPacket{0x142332F70_g};
|
WEAK symbol<bool(netsrc_t sock, int length, const void* data, const netadr_t* to)> NET_SendPacket{0x142332F70_g};
|
||||||
|
WEAK symbol<bool(char const*, netadr_t*)> NET_StringToAdr{0x1421731E0_g};
|
||||||
|
WEAK symbol<bool(netadr_t*, char const*)> NetAdr_InitFromString{0x142332F70_g};
|
||||||
|
|
||||||
// Sys
|
// Sys
|
||||||
WEAK symbol<void()> Sys_ShowConsole{0x142333F80_g};
|
WEAK symbol<void()> Sys_ShowConsole{0x142333F80_g};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user