mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-08 19:57:46 +00:00
Added a util function to get opCode from RAW_PACKET
This commit is contained in:
parent
faff95ac09
commit
147ebedfde
4 changed files with 14 additions and 4 deletions
|
@ -19,6 +19,12 @@ std::string Util::binaryToHexString( uint8_t* pBinData, uint16_t size )
|
|||
return outStr;
|
||||
|
||||
}
|
||||
|
||||
uint16_t Util::getOpCode( Sapphire::Network::Packets::FFXIVARR_PACKET_RAW& raw )
|
||||
{
|
||||
return *reinterpret_cast< uint16_t* >( &raw.data[ 2 ] );
|
||||
}
|
||||
|
||||
std::string Util::toLowerCopy( const std::string& inStr )
|
||||
{
|
||||
std::string out = inStr;
|
||||
|
|
|
@ -4,10 +4,13 @@
|
|||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <Network/CommonNetwork.h>
|
||||
|
||||
namespace Sapphire::Common::Util
|
||||
{
|
||||
|
||||
uint16_t getOpCode( Network::Packets::FFXIVARR_PACKET_RAW& raw );
|
||||
|
||||
std::string binaryToHexString( uint8_t* pBinData, uint16_t size );
|
||||
|
||||
std::string binaryToHexDump( uint8_t* pBinData, uint16_t size );
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "Forwards.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
using namespace Sapphire::Network::Packets::LobbyPackets;
|
||||
using namespace Sapphire::Network::Packets::LobbyPackets::Server;
|
||||
|
@ -478,9 +479,9 @@ void Lobby::GameConnection::handleGamePacket( Network::Packets::FFXIVARR_PACKET_
|
|||
if( m_pSession )
|
||||
accountId = m_pSession->getAccountID();
|
||||
|
||||
Logger::info( "[accountId#{0}] OpCode {1}", accountId, *reinterpret_cast< uint16_t* >( &packet.data[ 2 ] ) );
|
||||
Logger::info( "[accountId#{0}] OpCode {1}", accountId, Util::getOpCode( packet ) );
|
||||
|
||||
switch( *reinterpret_cast< uint16_t* >( &packet.data[ 2 ] ) )
|
||||
switch( Util::getOpCode( packet ) )
|
||||
{
|
||||
case LoginEx:
|
||||
{
|
||||
|
|
|
@ -228,7 +228,7 @@ void Sapphire::Network::GameConnection::queueOutPacket( std::vector< Packets::FF
|
|||
|
||||
void Sapphire::Network::GameConnection::handleZonePacket( Sapphire::Network::Packets::FFXIVARR_PACKET_RAW& pPacket )
|
||||
{
|
||||
uint16_t opcode = *reinterpret_cast< uint16_t* >( &pPacket.data[ 0x02 ] );
|
||||
uint16_t opcode = Util::getOpCode( pPacket );
|
||||
auto it = m_zoneHandlerMap.find( opcode );
|
||||
|
||||
if( it != m_zoneHandlerMap.end() )
|
||||
|
@ -259,7 +259,7 @@ void Sapphire::Network::GameConnection::handleZonePacket( Sapphire::Network::Pac
|
|||
|
||||
void Sapphire::Network::GameConnection::handleChatPacket( Sapphire::Network::Packets::FFXIVARR_PACKET_RAW& pPacket )
|
||||
{
|
||||
uint16_t opcode = *reinterpret_cast< uint16_t* >( &pPacket.data[ 0x02 ] );
|
||||
uint16_t opcode = Util::getOpCode( pPacket );
|
||||
auto it = m_chatHandlerMap.find( opcode );
|
||||
|
||||
if( it != m_chatHandlerMap.end() )
|
||||
|
|
Loading…
Add table
Reference in a new issue