Simplify DeployPacketStub

This commit is contained in:
momo5502 2016-02-10 20:11:34 +01:00
parent e3904db37c
commit dea6d5714a
2 changed files with 12 additions and 22 deletions

View File

@ -119,7 +119,8 @@ namespace Components
void Network::SendCommand(Game::netsrc_t type, Network::Address target, std::string command, std::string data) void Network::SendCommand(Game::netsrc_t type, Network::Address target, std::string command, std::string data)
{ {
// Use space a separator (possible separators are '\n', ' ') // Use space a separator (possible separators are '\n', ' ').
// Though, our handler only needs exactly 1 char as separator and doesn't which char it is
std::string packet; std::string packet;
packet.append(command); packet.append(command);
packet.append(" ", 1); packet.append(" ", 1);
@ -182,7 +183,7 @@ namespace Components
return 1; return 1;
} }
void Network::DeployPacket(Game::netadr_t from, Game::msg_t* msg) void Network::DeployPacket(Game::netadr_t* from, Game::msg_t* msg)
{ {
if (Network::PacketHandlers.find(Network::SelectedPacket) != Network::PacketHandlers.end()) if (Network::PacketHandlers.find(Network::SelectedPacket) != Network::PacketHandlers.end())
{ {
@ -211,27 +212,16 @@ namespace Components
{ {
__asm __asm
{ {
push ebp //C54 lea eax, [esp + 0C54h]
// esp = C54h? push ebp // Command
mov eax, [esp + 0C54h + 14h] push eax // Address pointer
push eax
mov eax, [esp + 0C58h + 10h]
push eax
mov eax, [esp + 0C5Ch + 0Ch]
push eax
mov eax, [esp + 0C60h + 08h]
push eax
mov eax, [esp + 0C64h + 04h]
push eax
call Network::DeployPacket call Network::DeployPacket
add esp, 14h add esp, 8h
add esp, 4h
mov al, 1 mov al, 1
//C50 pop edi
pop edi //C4C pop esi
pop esi //C48 pop ebp
pop ebp //C44 pop ebx
pop ebx //C40
add esp, 0C40h add esp, 0C40h
retn retn
} }

View File

@ -63,7 +63,7 @@ namespace Components
static std::string SelectedPacket; static std::string SelectedPacket;
static std::map<std::string, Callback> PacketHandlers; static std::map<std::string, Callback> PacketHandlers;
static int PacketInterceptionHandler(const char* packet); static int PacketInterceptionHandler(const char* packet);
static void DeployPacket(Game::netadr_t from, Game::msg_t* msg); static void DeployPacket(Game::netadr_t* from, Game::msg_t* msg);
static void DeployPacketStub(); static void DeployPacketStub();
}; };
} }