mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-06 10:47:45 +00:00
incoming packet deserialization
This commit is contained in:
parent
a322e81a53
commit
98bb3eb436
3 changed files with 44 additions and 6 deletions
|
@ -178,6 +178,18 @@ public:
|
|||
initialize();
|
||||
};
|
||||
|
||||
FFXIVIpcPacket< T, T1 >( const FFXIVARR_PACKET_RAW& rawPacket )
|
||||
{
|
||||
auto segHdrSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
|
||||
auto copySize = std::min< uint32_t >( sizeof( T ), rawPacket.segHdr.size - segHdrSize );
|
||||
|
||||
memcpy( &m_segHdr, &rawPacket.segHdr, segHdrSize );
|
||||
memcpy( &m_data, &rawPacket.data[0] + segHdrSize, copySize );
|
||||
|
||||
memset( &m_ipcHdr, 0, sizeof( FFXIVARR_IPC_HEADER ) );
|
||||
m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType );
|
||||
}
|
||||
|
||||
uint32_t getContentSize() override
|
||||
{
|
||||
return sizeof( FFXIVARR_IPC_HEADER ) + sizeof( T );
|
||||
|
|
26
src/common/Network/PacketDef/Zone/ClientZoneDef.h
Normal file
26
src/common/Network/PacketDef/Zone/ClientZoneDef.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef _CORE_NETWORK_PACKETS_ZONE_CLIENT_IPC_H
|
||||
#define _CORE_NETWORK_PACKETS_ZONE_CLIENT_IPC_H
|
||||
|
||||
#include <Common.h>
|
||||
#include <Network/CommonNetwork.h>
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
namespace Packets {
|
||||
namespace Client {
|
||||
|
||||
struct FFXIVIpcGmCommand1 : FFXIVIpcBasePacket< GMCommand1 >
|
||||
{
|
||||
/* 0000 */ uint32_t commandId;
|
||||
/* 0004 */ uint32_t param1;
|
||||
/* 0008 */ uint32_t param2;
|
||||
/* 000C */ char unknown_C[28];
|
||||
/* 0028 */ uint32_t param3;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif //_CORE_NETWORK_PACKETS_ZONE_CLIENT_IPC_H
|
|
@ -6,6 +6,7 @@
|
|||
#include <Logging/Logger.h>
|
||||
#include <Network/PacketContainer.h>
|
||||
#include <Network/CommonActorControl.h>
|
||||
#include <Network/PacketDef/Zone/ClientZoneDef.h>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
|
@ -91,12 +92,11 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R
|
|||
if( player.getGmRank() <= 0 )
|
||||
return;
|
||||
|
||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
||||
auto commandId = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
||||
|
||||
uint32_t param1 = *reinterpret_cast< uint32_t* >( ©.data[0x14] );
|
||||
uint32_t param2 = *reinterpret_cast< uint32_t* >( ©.data[0x18] );
|
||||
uint32_t param3 = *reinterpret_cast< uint32_t* >( ©.data[0x28] );
|
||||
auto packet = ZoneChannelPacket< Client::FFXIVIpcGmCommand1 >( inPacket );
|
||||
auto commandId = packet.data().commandId;
|
||||
auto param1 = packet.data().param1;
|
||||
auto param2 = packet.data().param2;
|
||||
auto param3 = packet.data().param3;
|
||||
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->debug( player.getName() + " used GM1 commandId: " + std::to_string( commandId ) +
|
||||
|
|
Loading…
Add table
Reference in a new issue