From c4f443fa8d7b9206b277bea44386becf74cc0897 Mon Sep 17 00:00:00 2001 From: NotAdam Date: Tue, 26 Mar 2019 18:15:23 +1100 Subject: [PATCH] fix sessionid being read incorrectly from version packet, fix lobby key --- src/lobby/GameConnection.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lobby/GameConnection.cpp b/src/lobby/GameConnection.cpp index 4f162d45..93627743 100644 --- a/src/lobby/GameConnection.cpp +++ b/src/lobby/GameConnection.cpp @@ -236,15 +236,15 @@ void Sapphire::Network::GameConnection::enterWorld( FFXIVARR_PACKET_RAW& packet, bool Sapphire::Network::GameConnection::sendServiceAccountList( FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ) { - LobbySessionPtr pSession = g_serverLobby.getSession( ( char* ) &packet.data[ 0 ] + 0x20 ); + LobbySessionPtr pSession = g_serverLobby.getSession( ( char* ) &packet.data[ 0 ] + 0x22 ); if( g_serverLobby.getConfig().allowNoSessionConnect && pSession == nullptr ) { auto session = make_LobbySession(); session->setAccountID( 0 ); - session->setSessionId( ( uint8_t* ) &packet.data[ 0 ] + 0x20 ); + session->setSessionId( ( uint8_t* ) &packet.data[ 0 ] + 0x22 ); pSession = session; - Logger::info( "Allowed connection with no session: {0}", std::string( ( char* ) &packet.data[ 0 ] + 0x20 ) ); + Logger::info( "Allowed connection with no session: {0}", std::string( ( char* ) &packet.data[ 0 ] + 0x22 ) ); } if( pSession != nullptr ) @@ -388,6 +388,8 @@ void Sapphire::Network::GameConnection::handleGamePacket( Packets::FFXIVARR_PACK Logger::info( "OpCode [{0}]", *reinterpret_cast< uint16_t* >( &packet.data[ 2 ] ) ); + Logger::info( Util::binaryToHexDump( packet.data.data(), packet.data.size() ) ); + switch( *reinterpret_cast< uint16_t* >( &packet.data[ 2 ] ) ) { case ClientVersionInfo: @@ -451,7 +453,7 @@ void Sapphire::Network::GameConnection::generateEncryptionKey( uint32_t key, con m_baseKey[ 2 ] = 0x34; m_baseKey[ 3 ] = 0x12; memcpy( m_baseKey + 0x04, &key, 4 ); - m_baseKey[ 8 ] = 0x30; + m_baseKey[ 8 ] = 0xC6; m_baseKey[ 9 ] = 0x11; memcpy( ( char* ) m_baseKey + 0x0C, keyPhrase.c_str(), keyPhrase.size() ); Sapphire::Util::md5( m_baseKey, m_encKey, 0x2C );