1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-02 16:57:47 +00:00

Plenty more cleanup and code quality adjustments.

This commit is contained in:
Mordred 2019-03-11 22:48:33 +01:00
parent 35a8461dbb
commit 8a35c4e370
25 changed files with 459 additions and 533 deletions

View file

@ -1,15 +1,14 @@
#include "LoginSession.h" #include "LoginSession.h"
namespace Sapphire { namespace Sapphire {
LoginSession::LoginSession( void ) LoginSession::LoginSession( void )
{ {
//setSocket(NULL); //setSocket(NULL);
}
} LoginSession::~LoginSession( void )
{
LoginSession::~LoginSession( void )
{ }
}
} }

View file

@ -14,8 +14,8 @@ namespace Sapphire
{ {
private: private:
uint32_t m_IP; uint32_t m_ip;
uint32_t m_accountID; uint32_t m_accountId;
uint8_t m_sessionId[56]; uint8_t m_sessionId[56];
public: public:
@ -25,9 +25,9 @@ namespace Sapphire
~LoginSession( void ); ~LoginSession( void );
uint32_t getIP() uint32_t getIp()
{ {
return m_IP; return m_ip;
} }
void setSessionId( uint8_t* sessionId ) void setSessionId( uint8_t* sessionId )
@ -35,29 +35,21 @@ namespace Sapphire
memcpy( m_sessionId, sessionId, 56 ); memcpy( m_sessionId, sessionId, 56 );
} }
void setIP( uint32_t iP ) void setIp( uint32_t ip )
{ {
m_IP = iP; m_ip = ip;
} }
uint32_t getAccountID() uint32_t getAccountId()
{ {
return m_accountID; return m_accountId;
} }
void setAccountID( uint32_t iD ) void setAccountId( uint32_t id )
{ {
m_accountID = iD; m_accountId = id;
} }
/*INLINE CLobbySocket* getSocket() {
return m_pGS;
}
INLINE void setSocket(CLobbySocket * pS) {
m_pGS = pS;
}*/
}; };
} }

View file

@ -33,7 +33,6 @@ namespace Sapphire::Common::Config
} network; } network;
}; };
struct WorldConfig struct WorldConfig
{ {
GlobalConfig global; GlobalConfig global;

View file

@ -29,8 +29,7 @@ namespace Sapphire::Util
"message digest", "message digest",
"abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
"12345678901234567890123456789012345678901234567890123456789012" \ "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
"345678901234567890"
}; };
static const char* val[] = static const char* val[] =

View file

@ -18,7 +18,7 @@ Sapphire::Db::DbConnection::DbConnection( ConnectionInfo& connInfo ) :
} }
Sapphire::Db::DbConnection::DbConnection( Sapphire::LockedWaitQueue< std::shared_ptr< Operation > >* queue, Sapphire::Db::DbConnection::DbConnection( Sapphire::LockedWaitQueue< std::shared_ptr< Operation > >* queue,
Sapphire::Db::ConnectionInfo& connInfo ) : Sapphire::Db::ConnectionInfo& connInfo ) :
m_reconnecting( false ), m_reconnecting( false ),
m_prepareError( false ), m_prepareError( false ),
m_queue( queue ), m_queue( queue ),
@ -209,7 +209,9 @@ std::shared_ptr< Mysql::PreparedStatement > Sapphire::Db::DbConnection::getPrepa
return ret; return ret;
} }
void Sapphire::Db::DbConnection::prepareStatement( uint32_t index, const std::string& sql, Sapphire::Db::ConnectionFlags flags ) void Sapphire::Db::DbConnection::prepareStatement( uint32_t index,
const std::string& sql,
Sapphire::Db::ConnectionFlags flags )
{ {
m_queries.insert( PreparedStatementMap::value_type( index, std::make_pair( sql, flags ) ) ); m_queries.insert( PreparedStatementMap::value_type( index, std::make_pair( sql, flags ) ) );

View file

@ -104,5 +104,5 @@ bool Sapphire::Db::DbLoader::process( std::queue< Predicate >& queue )
template template
Sapphire::Db::DbLoader& Sapphire::Db::DbLoader&
Sapphire::Db::DbLoader::addDb< Sapphire::Db::ZoneDbConnection >( Sapphire::Db::DbWorkerPool< Sapphire::Db::ZoneDbConnection >&, Sapphire::Db::DbLoader::addDb< Sapphire::Db::ZoneDbConnection >( Sapphire::Db::DbWorkerPool< Sapphire::Db::ZoneDbConnection >&,
const ConnectionInfo& ); const ConnectionInfo& );

View file

@ -2,7 +2,8 @@
#include "Operation.h" #include "Operation.h"
#include "Util/LockedWaitQueue.h" #include "Util/LockedWaitQueue.h"
Sapphire::Db::DbWorker::DbWorker( Sapphire::LockedWaitQueue< std::shared_ptr< Operation > >* newQueue, DbConnection* pConn ) Sapphire::Db::DbWorker::DbWorker( Sapphire::LockedWaitQueue< std::shared_ptr< Operation > >* newQueue,
DbConnection* pConn )
{ {
m_pConn = pConn; m_pConn = pConn;
m_queue = newQueue; m_queue = newQueue;

View file

@ -10,8 +10,7 @@
#include "Logging/Logger.h" #include "Logging/Logger.h"
#include <mysql.h> #include <mysql.h>
class PingOperation : class PingOperation : public Sapphire::Db::Operation
public Sapphire::Db::Operation
{ {
bool execute() override bool execute() override
{ {
@ -256,25 +255,5 @@ void Sapphire::Db::DbWorkerPool< T >::directExecute( std::shared_ptr< PreparedSt
connection->unlock(); connection->unlock();
} }
/*
template <class T>
void DatabaseWorkerPool<T>::ExecuteOrAppend(SQLTransaction& trans, const char* sql)
{
if (!trans)
Execute(sql);
else
trans->Append(sql);
}
template <class T>
void DatabaseWorkerPool<T>::ExecuteOrAppend(SQLTransaction& trans, PreparedStatement* stmt)
{
if (!trans)
Execute(stmt);
else
trans->Append(stmt);
}
*/
template template
class Sapphire::Db::DbWorkerPool< Sapphire::Db::ZoneDbConnection >; class Sapphire::Db::DbWorkerPool< Sapphire::Db::ZoneDbConnection >;

View file

@ -44,7 +44,7 @@ namespace Sapphire::Db
bool prepareStatements(); bool prepareStatements();
inline ConnectionInfo getConnectionInfo() const const ConnectionInfo& getConnectionInfo() const
{ {
return m_connectionInfo; return m_connectionInfo;
} }

View file

@ -39,9 +39,8 @@ bool Sapphire::Db::StatementTask::execute()
Sapphire::Db::PreparedStatementTask::PreparedStatementTask( std::shared_ptr< Sapphire::Db::PreparedStatement > stmt, Sapphire::Db::PreparedStatementTask::PreparedStatementTask( std::shared_ptr< Sapphire::Db::PreparedStatement > stmt,
bool async ) : bool async ) :
m_stmt( stmt ) m_stmt( stmt )
//, m_result(nullptr)
{ {
m_hasResult = async; // If the operation is async, then there's a result m_hasResult = async; // If the operation is async, then there's a result
} }

View file

@ -9,8 +9,7 @@ namespace Sapphire::Db
{ {
class PreparedStatement; class PreparedStatement;
class StatementTask : class StatementTask : public Operation
public Operation
{ {
public: public:
@ -20,15 +19,9 @@ namespace Sapphire::Db
bool execute() override; bool execute() override;
// QueryResultFuture getFuture() const
// {
// return m_result->get_future();
// }
private: private:
std::string m_sql; std::string m_sql;
bool m_hasResult; bool m_hasResult;
// QueryResultPromise *m_result;
}; };
class PreparedStatementTask : class PreparedStatementTask :
@ -40,12 +33,10 @@ namespace Sapphire::Db
~PreparedStatementTask(); ~PreparedStatementTask();
bool execute() override; bool execute() override;
//PreparedQueryResultFuture getFuture() { return m_result->get_future(); }
protected: protected:
std::shared_ptr< PreparedStatement > m_stmt; std::shared_ptr< PreparedStatement > m_stmt;
bool m_hasResult; bool m_hasResult;
//PreparedQueryResultPromise* m_result;
}; };
} }

View file

@ -5,33 +5,28 @@
namespace Sapphire namespace Sapphire
{ {
class ConfigMgr; class ConfigMgr;
using ConfigMgrPtr = std::shared_ptr< ConfigMgr >;
class Framework; class Framework;
using ConfigMgrPtr = std::shared_ptr< ConfigMgr >;
using FrameworkPtr = std::shared_ptr< Framework >; using FrameworkPtr = std::shared_ptr< Framework >;
namespace Network
{
class Hive;
class Acceptor;
class Connection;
using HivePtr = std::shared_ptr< Hive >;
using AcceptorPtr = std::shared_ptr< Acceptor >;
using ConnectionPtr = std::shared_ptr< Connection >;
namespace Packets
{
class GamePacket;
class FFXIVPacketBase;
using GamePacketPtr = std::shared_ptr< GamePacket >;
using FFXIVPacketBasePtr = std::shared_ptr< FFXIVPacketBase >;
}
}
} }
namespace Sapphire::Network
{
class Hive;
class Acceptor;
class Connection;
using HivePtr = std::shared_ptr< Hive >;
using AcceptorPtr = std::shared_ptr< Acceptor >;
using ConnectionPtr = std::shared_ptr< Connection >;
}
namespace Sapphire::Network::Packets
{
class GamePacket;
class FFXIVPacketBase;
using GamePacketPtr = std::shared_ptr< GamePacket >;
using FFXIVPacketBasePtr = std::shared_ptr< FFXIVPacketBase >;
}
#endif #endif

View file

@ -10,82 +10,78 @@
namespace fs = std::experimental::filesystem; namespace fs = std::experimental::filesystem;
namespace Sapphire Sapphire::Logger::Logger()
{ {
Logger::Logger() }
{
} Sapphire::Logger::~Logger()
{
Logger::~Logger()
{
}
void Logger::init( const std::string& logPath )
{
auto pos = logPath.find_last_of( fs::path::preferred_separator );
if( pos != std::string::npos )
{
std::string realPath = logPath.substr( 0, pos );
fs::create_directories( realPath );
}
spdlog::init_thread_pool( 8192, 1 );
auto stdout_sink = std::make_shared< spdlog::sinks::stdout_color_sink_mt >();
auto daily_sink = std::make_shared< spdlog::sinks::daily_file_sink_mt >( logPath + ".log", 0, 0 );
std::vector< spdlog::sink_ptr > sinks { stdout_sink, daily_sink };
auto logger = std::make_shared< spdlog::async_logger >( "logger", sinks.begin(), sinks.end(),
spdlog::thread_pool(), spdlog::async_overflow_policy::block );
spdlog::register_logger( logger );
spdlog::set_pattern( "[%H:%M:%S.%e] [%^%l%$] %v" );
spdlog::set_level( spdlog::level::debug );
// always flush the log on criticial messages, otherwise it's done by libc
// see: https://github.com/gabime/spdlog/wiki/7.-Flush-policy
// nb: if the server crashes, log data can be missing from the file unless something logs critical just before it does
spdlog::flush_on( spdlog::level::critical );
}
void Logger::setLogLevel( uint8_t logLevel )
{
spdlog::set_level( static_cast< spdlog::level::level_enum >( logLevel ) );
}
void Logger::error( const std::string& text )
{
spdlog::get( "logger" )->error( text );
}
void Logger::warn( const std::string& text )
{
spdlog::get( "logger" )->warn( text );
}
void Logger::info( const std::string& text )
{
spdlog::get( "logger" )->info( text );
}
void Logger::debug( const std::string& text )
{
spdlog::get( "logger" )->debug( text );
}
void Logger::fatal( const std::string& text )
{
spdlog::get( "logger" )->critical( text );
}
void Logger::trace( const std::string& text )
{
spdlog::get( "logger" )->trace( text );
}
} }
void Sapphire::Logger::init( const std::string& logPath )
{
auto pos = logPath.find_last_of( fs::path::preferred_separator );
if( pos != std::string::npos )
{
std::string realPath = logPath.substr( 0, pos );
fs::create_directories( realPath );
}
spdlog::init_thread_pool( 8192, 1 );
auto stdout_sink = std::make_shared< spdlog::sinks::stdout_color_sink_mt >();
auto daily_sink = std::make_shared< spdlog::sinks::daily_file_sink_mt >( logPath + ".log", 0, 0 );
std::vector< spdlog::sink_ptr > sinks { stdout_sink, daily_sink };
auto logger = std::make_shared< spdlog::async_logger >( "logger", sinks.begin(), sinks.end(),
spdlog::thread_pool(), spdlog::async_overflow_policy::block );
spdlog::register_logger( logger );
spdlog::set_pattern( "[%H:%M:%S.%e] [%^%l%$] %v" );
spdlog::set_level( spdlog::level::debug );
// always flush the log on criticial messages, otherwise it's done by libc
// see: https://github.com/gabime/spdlog/wiki/7.-Flush-policy
// nb: if the server crashes, log data can be missing from the file unless something logs critical just before it does
spdlog::flush_on( spdlog::level::critical );
}
void Sapphire::Logger::setLogLevel( uint8_t logLevel )
{
spdlog::set_level( static_cast< spdlog::level::level_enum >( logLevel ) );
}
void Sapphire::Logger::error( const std::string& text )
{
spdlog::get( "logger" )->error( text );
}
void Sapphire::Logger::warn( const std::string& text )
{
spdlog::get( "logger" )->warn( text );
}
void Sapphire::Logger::info( const std::string& text )
{
spdlog::get( "logger" )->info( text );
}
void Sapphire::Logger::debug( const std::string& text )
{
spdlog::get( "logger" )->debug( text );
}
void Sapphire::Logger::fatal( const std::string& text )
{
spdlog::get( "logger" )->critical( text );
}
void Sapphire::Logger::trace( const std::string& text )
{
spdlog::get( "logger" )->trace( text );
}

View file

@ -2,12 +2,7 @@
#include "Acceptor.h" #include "Acceptor.h"
#include "Connection.h" #include "Connection.h"
namespace Sapphire::Network Sapphire::Network::Acceptor::Acceptor( HivePtr hive ) :
{
//-----------------------------------------------------------------------------
Acceptor::Acceptor( HivePtr hive ) :
m_hive( hive ), m_hive( hive ),
m_acceptor( hive->getService() ), m_acceptor( hive->getService() ),
m_io_strand( hive->getService() ), m_io_strand( hive->getService() ),
@ -15,22 +10,21 @@ Acceptor::Acceptor( HivePtr hive ) :
{ {
} }
Acceptor::~Acceptor() Sapphire::Network::Acceptor::~Acceptor()
{ {
} }
bool Sapphire::Network::Acceptor::onAccept( ConnectionPtr connection, const std::string& host, uint16_t port )
bool Acceptor::onAccept( ConnectionPtr connection, const std::string& host, uint16_t port )
{ {
return true; return true;
} }
void Acceptor::onError( const asio::error_code& error ) void Sapphire::Network::Acceptor::onError( const asio::error_code& error )
{ {
} }
void Acceptor::startError( const asio::error_code& error ) void Sapphire::Network::Acceptor::startError( const asio::error_code& error )
{ {
uint32_t v1 = 1; uint32_t v1 = 1;
uint32_t v2 = 0; uint32_t v2 = 0;
@ -43,7 +37,7 @@ void Acceptor::startError( const asio::error_code& error )
} }
} }
void Acceptor::dispatchAccept( ConnectionPtr connection ) void Sapphire::Network::Acceptor::dispatchAccept( ConnectionPtr connection )
{ {
m_acceptor.async_accept( connection->getSocket(), m_acceptor.async_accept( connection->getSocket(),
connection->getStrand().wrap( std::bind( &Acceptor::handleAccept, connection->getStrand().wrap( std::bind( &Acceptor::handleAccept,
@ -52,7 +46,7 @@ void Acceptor::dispatchAccept( ConnectionPtr connection )
connection ) ) ); connection ) ) );
} }
void Acceptor::handleAccept( const asio::error_code& error, ConnectionPtr connection ) void Sapphire::Network::Acceptor::handleAccept( const asio::error_code& error, ConnectionPtr connection )
{ {
if( error || hasError() || m_hive->hasStopped() ) if( error || hasError() || m_hive->hasStopped() )
{ {
@ -78,17 +72,17 @@ void Acceptor::handleAccept( const asio::error_code& error, ConnectionPtr connec
} }
} }
void Acceptor::stop() void Sapphire::Network::Acceptor::stop()
{ {
} }
void Acceptor::accept( ConnectionPtr connection ) void Sapphire::Network::Acceptor::accept( ConnectionPtr connection )
{ {
m_io_strand.post( std::bind( &Acceptor::dispatchAccept, shared_from_this(), connection ) ); m_io_strand.post( std::bind( &Acceptor::dispatchAccept, shared_from_this(), connection ) );
} }
void Acceptor::listen( const std::string& host, const uint16_t& port ) void Sapphire::Network::Acceptor::listen( const std::string& host, const uint16_t& port )
{ {
try try
{ {
@ -109,21 +103,19 @@ void Acceptor::listen( const std::string& host, const uint16_t& port )
} }
HivePtr Acceptor::getHive() Sapphire::Network::HivePtr Sapphire::Network::Acceptor::getHive()
{ {
return m_hive; return m_hive;
} }
asio::ip::tcp::acceptor& Acceptor::getAcceptor() asio::ip::tcp::acceptor& Sapphire::Network::Acceptor::getAcceptor()
{ {
return m_acceptor; return m_acceptor;
} }
bool Acceptor::hasError() bool Sapphire::Network::Acceptor::hasError()
{ {
uint32_t v1 = 1; uint32_t v1 = 1;
uint32_t v2 = 1; uint32_t v2 = 1;
return ( m_error_state.compare_exchange_strong( v1, v2 ) ); return ( m_error_state.compare_exchange_strong( v1, v2 ) );
} }
}

View file

@ -3,11 +3,7 @@
#include <functional> #include <functional>
#include "Framework.h" #include "Framework.h"
namespace Sapphire::Network Sapphire::Network::Connection::Connection( HivePtr hive, FrameworkPtr pFw ) :
{
//-----------------------------------------------------------------------------
Connection::Connection( HivePtr hive, FrameworkPtr pFw ) :
m_hive( hive ), m_hive( hive ),
m_socket( hive->getService() ), m_socket( hive->getService() ),
m_io_strand( hive->getService() ), m_io_strand( hive->getService() ),
@ -17,11 +13,11 @@ Connection::Connection( HivePtr hive, FrameworkPtr pFw ) :
{ {
} }
Connection::~Connection() Sapphire::Network::Connection::~Connection()
{ {
} }
void Connection::bind( const std::string& ip, uint16_t port ) void Sapphire::Network::Connection::bind( const std::string& ip, uint16_t port )
{ {
asio::ip::tcp::endpoint endpoint( asio::ip::address::from_string( ip ), port ); asio::ip::tcp::endpoint endpoint( asio::ip::address::from_string( ip ), port );
m_socket.open( endpoint.protocol() ); m_socket.open( endpoint.protocol() );
@ -29,7 +25,7 @@ void Connection::bind( const std::string& ip, uint16_t port )
m_socket.bind( endpoint ); m_socket.bind( endpoint );
} }
void Connection::startSend() void Sapphire::Network::Connection::startSend()
{ {
if( !m_pending_sends.empty() ) if( !m_pending_sends.empty() )
{ {
@ -42,7 +38,7 @@ void Connection::startSend()
} }
} }
void Connection::startRecv( int32_t total_bytes ) void Sapphire::Network::Connection::startRecv( int32_t total_bytes )
{ {
if( total_bytes > 0 ) if( total_bytes > 0 )
{ {
@ -65,7 +61,7 @@ void Connection::startRecv( int32_t total_bytes )
} }
} }
void Connection::startError( const asio::error_code& error ) void Sapphire::Network::Connection::startError( const asio::error_code& error )
{ {
uint32_t v1 = 1; uint32_t v1 = 1;
uint32_t v2 = 0; uint32_t v2 = 0;
@ -78,7 +74,7 @@ void Connection::startError( const asio::error_code& error )
} }
} }
void Connection::handleConnect( const asio::error_code& error ) void Sapphire::Network::Connection::handleConnect( const asio::error_code& error )
{ {
if( error || hasError() || m_hive->hasStopped() ) if( error || hasError() || m_hive->hasStopped() )
{ {
@ -98,8 +94,8 @@ void Connection::handleConnect( const asio::error_code& error )
} }
} }
void void Sapphire::Network::Connection::handleSend( const asio::error_code& error,
Connection::handleSend( const asio::error_code& error, std::list< std::vector< uint8_t > >::iterator itr ) std::list< std::vector< uint8_t > >::iterator itr )
{ {
if( error || hasError() || m_hive->hasStopped() ) if( error || hasError() || m_hive->hasStopped() )
{ {
@ -113,7 +109,7 @@ Connection::handleSend( const asio::error_code& error, std::list< std::vector< u
} }
} }
void Connection::handleRecv( const asio::error_code& error, int32_t actual_bytes ) void Sapphire::Network::Connection::handleRecv( const asio::error_code& error, int32_t actual_bytes )
{ {
if( error || hasError() || m_hive->hasStopped() ) if( error || hasError() || m_hive->hasStopped() )
{ {
@ -132,7 +128,7 @@ void Connection::handleRecv( const asio::error_code& error, int32_t actual_bytes
} }
} }
void Connection::dispatchSend( std::vector< uint8_t > buffer ) void Sapphire::Network::Connection::dispatchSend( std::vector< uint8_t > buffer )
{ {
bool should_start_send = m_pending_sends.empty(); bool should_start_send = m_pending_sends.empty();
m_pending_sends.push_back( buffer ); m_pending_sends.push_back( buffer );
@ -142,7 +138,7 @@ void Connection::dispatchSend( std::vector< uint8_t > buffer )
} }
} }
void Connection::dispatchRecv( int32_t total_bytes ) void Sapphire::Network::Connection::dispatchRecv( int32_t total_bytes )
{ {
bool should_start_receive = m_pending_recvs.empty(); bool should_start_receive = m_pending_recvs.empty();
m_pending_recvs.push_back( total_bytes ); m_pending_recvs.push_back( total_bytes );
@ -153,61 +149,61 @@ void Connection::dispatchRecv( int32_t total_bytes )
} }
void Connection::connect( const std::string& host, uint16_t port ) void Sapphire::Network::Connection::connect( const std::string& host, uint16_t port )
{ {
asio::ip::tcp::resolver resolver( m_hive->getService() ); asio::ip::tcp::resolver resolver( m_hive->getService() );
asio::ip::tcp::resolver::query query( host, std::to_string( port ) ); asio::ip::tcp::resolver::query query( host, std::to_string( port ) );
asio::ip::tcp::resolver::iterator iterator = resolver.resolve( query ); asio::ip::tcp::resolver::iterator iterator = resolver.resolve( query );
m_socket.async_connect( *iterator, m_socket.async_connect( *iterator,
m_io_strand.wrap( std::bind( &Connection::handleConnect, shared_from_this(), std::placeholders::_1 ) ) ); m_io_strand.wrap( std::bind( &Connection::handleConnect,
shared_from_this(), std::placeholders::_1 ) ) );
} }
void Connection::disconnect() void Sapphire::Network::Connection::disconnect()
{ {
onDisconnect(); onDisconnect();
m_socket.close(); m_socket.close();
} }
void Connection::recv( int32_t total_bytes ) void Sapphire::Network::Connection::recv( int32_t total_bytes )
{ {
m_io_strand.post( std::bind( &Connection::dispatchRecv, shared_from_this(), total_bytes ) ); m_io_strand.post( std::bind( &Connection::dispatchRecv, shared_from_this(), total_bytes ) );
} }
void Connection::send( const std::vector< uint8_t >& buffer ) void Sapphire::Network::Connection::send( const std::vector< uint8_t >& buffer )
{ {
m_io_strand.post( std::bind( &Connection::dispatchSend, shared_from_this(), buffer ) ); m_io_strand.post( std::bind( &Connection::dispatchSend, shared_from_this(), buffer ) );
} }
asio::ip::tcp::socket& Connection::getSocket() asio::ip::tcp::socket& Sapphire::Network::Connection::getSocket()
{ {
return m_socket; return m_socket;
} }
asio::strand& Connection::getStrand() asio::strand& Sapphire::Network::Connection::getStrand()
{ {
return m_io_strand; return m_io_strand;
} }
HivePtr Connection::getHive() Sapphire::Network::HivePtr Sapphire::Network::Connection::getHive()
{ {
return m_hive; return m_hive;
} }
void Connection::setReceiveBufferSize( int32_t size ) void Sapphire::Network::Connection::setReceiveBufferSize( int32_t size )
{ {
m_receive_buffer_size = size; m_receive_buffer_size = size;
} }
int32_t Connection::getReceiveBufferSize() const int32_t Sapphire::Network::Connection::getReceiveBufferSize() const
{ {
return m_receive_buffer_size; return m_receive_buffer_size;
} }
bool Connection::hasError() bool Sapphire::Network::Connection::hasError()
{ {
uint32_t v1 = 1; uint32_t v1 = 1;
uint32_t v2 = 1; uint32_t v2 = 1;
return ( m_error_state.compare_exchange_strong( v1, v2 ) ); return ( m_error_state.compare_exchange_strong( v1, v2 ) );
} }
}

View file

@ -22,9 +22,7 @@ namespace Sapphire::Network
{ {
class Hive; class Hive;
class Acceptor; class Acceptor;
class Connection; class Connection;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -32,7 +30,6 @@ namespace Sapphire::Network
class Connection : public std::enable_shared_from_this< Connection > class Connection : public std::enable_shared_from_this< Connection >
{ {
friend class Acceptor; friend class Acceptor;
friend class Hive; friend class Hive;
protected: protected:

View file

@ -1,5 +1,5 @@
#ifndef _GAMEPACKET_NEW_H #ifndef _GAMEPACKET_H
#define _GAMEPACKET_NEW_H #define _GAMEPACKET_H
#include <stdint.h> #include <stdint.h>
#include <iostream> #include <iostream>
@ -17,320 +17,318 @@
namespace Sapphire::Network::Packets namespace Sapphire::Network::Packets
{ {
// Must forward define these in order to enable the compiler to produce the // Must forward define these in order to enable the compiler to produce the
// correct template functions. // correct template functions.
template< typename T, typename T1 >
class FFXIVIpcPacket;
template< typename T, typename T1 > template< class T >
class FFXIVIpcPacket; using ZoneChannelPacket = FFXIVIpcPacket< T, ServerZoneIpcType >;
template< class T > template< class T >
using ZoneChannelPacket = FFXIVIpcPacket< T, ServerZoneIpcType >; using ChatChannelPacket = FFXIVIpcPacket< T, ServerChatIpcType >;
template< class T > template< class T >
using ChatChannelPacket = FFXIVIpcPacket< T, ServerChatIpcType >; using LobbyChannelPacket = FFXIVIpcPacket< T, ServerLobbyIpcType >;
template< class T >
using LobbyChannelPacket = FFXIVIpcPacket< T, ServerLobbyIpcType >;
template< class T, typename... Args > template< class T, typename... Args >
std::shared_ptr< ZoneChannelPacket< T > > makeZonePacket( Args... args ) std::shared_ptr< ZoneChannelPacket< T > > makeZonePacket( Args... args )
{
return std::make_shared< ZoneChannelPacket< T > >( args... );
}
template< class T, typename... Args >
std::shared_ptr< T > makeWrappedPacket( Args... args )
{
return std::make_shared< T >( args... );
}
template< class T, typename... Args >
std::shared_ptr< ChatChannelPacket< T > > makeChatPacket( Args... args )
{
return std::make_shared< ChatChannelPacket< T > >( args... );
}
template< class T, typename... Args >
std::shared_ptr< LobbyChannelPacket< T > > makeLobbyPacket( Args... args )
{
return std::make_shared< LobbyChannelPacket< T > >( args... );
}
/**
* The base implementation of a game packet. Needed for parsing packets.
*/
template< typename T1 >
class FFXIVIpcPacketBase
{
public:
virtual ~FFXIVIpcPacketBase() = default;
/**
* @brief Gets the IPC type of this packet. (Useful for determining the
* type of a parsed packet.)
*/
virtual T1 ipcType() = 0;
};
////////////////////////////////////////////////7
class FFXIVPacketBase
{
public:
FFXIVPacketBase() :
m_segmentType( 0 )
{ {
initializeSegmentHeader(); return std::make_shared< ZoneChannelPacket< T > >( args... );
} }
FFXIVPacketBase( uint16_t segmentType, uint32_t sourceActorId, uint32_t targetActorId ) : template< class T, typename... Args >
m_segmentType( segmentType ) std::shared_ptr< T > makeWrappedPacket( Args... args )
{ {
initializeSegmentHeader(); return std::make_shared< T >( args... );
setSourceActor( sourceActorId );
setTargetActor( targetActorId );
} }
std::size_t getSize() const template< class T, typename... Args >
std::shared_ptr< ChatChannelPacket< T > > makeChatPacket( Args... args )
{ {
return m_segHdr.size; return std::make_shared< ChatChannelPacket< T > >( args... );
} }
virtual std::vector< uint8_t > getData() const template< class T, typename... Args >
std::shared_ptr< LobbyChannelPacket< T > > makeLobbyPacket( Args... args )
{ {
return {}; return std::make_shared< LobbyChannelPacket< T > >( args... );
}
protected:
/** The segment header */
FFXIVARR_PACKET_SEGMENT_HEADER m_segHdr;
uint16_t m_segmentType;
public:
virtual size_t getContentSize()
{
return 0;
};
virtual std::vector< uint8_t > getContent()
{
return {};
};
/**
* @brief Gets the segment type of this packet.
*/
uint16_t getSegmentType() const
{
return m_segmentType;
} }
/** /**
* @brief Sets the source actor id for this packet. * The base implementation of a game packet. Needed for parsing packets.
* @param actorId The source actor id.
*/ */
void setSourceActor( uint32_t actorId ) template< typename T1 >
class FFXIVIpcPacketBase
{ {
m_segHdr.source_actor = actorId; public:
virtual ~FFXIVIpcPacketBase() = default;
/**
* @brief Gets the IPC type of this packet. (Useful for determining the
* type of a parsed packet.)
*/
virtual T1 ipcType() = 0;
}; };
/** ////////////////////////////////////////////////7
* @brief Gets the source actor id for this packet.
* @return The source actor id. class FFXIVPacketBase
*/
uint32_t getSourceActor() const
{ {
return m_segHdr.source_actor; public:
FFXIVPacketBase() :
m_segmentType( 0 )
{
initializeSegmentHeader();
}
FFXIVPacketBase( uint16_t segmentType, uint32_t sourceActorId, uint32_t targetActorId ) :
m_segmentType( segmentType )
{
initializeSegmentHeader();
setSourceActor( sourceActorId );
setTargetActor( targetActorId );
}
std::size_t getSize() const
{
return m_segHdr.size;
}
virtual std::vector< uint8_t > getData() const
{
return {};
}
protected:
/** The segment header */
FFXIVARR_PACKET_SEGMENT_HEADER m_segHdr;
uint16_t m_segmentType;
public:
virtual size_t getContentSize()
{
return 0;
};
virtual std::vector< uint8_t > getContent()
{
return {};
};
/**
* @brief Gets the segment type of this packet.
*/
uint16_t getSegmentType() const
{
return m_segmentType;
}
/**
* @brief Sets the source actor id for this packet.
* @param actorId The source actor id.
*/
void setSourceActor( uint32_t actorId )
{
m_segHdr.source_actor = actorId;
};
/**
* @brief Gets the source actor id for this packet.
* @return The source actor id.
*/
uint32_t getSourceActor() const
{
return m_segHdr.source_actor;
};
/**
* @brief Sets the target actor id for this packet.
* @param actorId The target actor id.
*/
void setTargetActor( uint32_t actorId )
{
m_segHdr.target_actor = actorId;
};
/**
* @brief Gets the target actor id for this packet.
*/
uint32_t getTargetActor( void ) const
{
return m_segHdr.target_actor;
};
/** Initializes the fields of the segment header structure */
virtual void initializeSegmentHeader( void )
{
// Zero out the structure.
memset( &m_segHdr, 0, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
// Set the values of static fields.
// The size must be the sum of the segment header and the content
m_segHdr.size = static_cast< uint32_t >( sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + getContentSize() );
m_segHdr.type = getSegmentType();
}
}; };
/** template< typename T, typename T1 >
* @brief Sets the target actor id for this packet. class FFXIVIpcPacket :
* @param actorId The target actor id. public FFXIVIpcPacketBase< T1 >, public FFXIVPacketBase
*/
void setTargetActor( uint32_t actorId )
{ {
m_segHdr.target_actor = actorId; public:
FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId, uint32_t targetActorId ) :
FFXIVPacketBase( 3, sourceActorId, targetActorId )
{
initialize();
};
FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId ) :
FFXIVPacketBase( 3, sourceActorId, sourceActorId )
{
initialize();
};
FFXIVIpcPacket< T, T1 >( const FFXIVARR_PACKET_RAW& rawPacket )
{
auto ipcHdrSize = sizeof( FFXIVARR_IPC_HEADER );
auto copySize = std::min< size_t >( sizeof( T ), rawPacket.segHdr.size - ipcHdrSize );
memcpy( &m_segHdr, &rawPacket.segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
memcpy( &m_data, &rawPacket.data[ 0 ] + ipcHdrSize, copySize );
memset( &m_ipcHdr, 0, ipcHdrSize );
m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType );
}
size_t getContentSize() override
{
return sizeof( FFXIVARR_IPC_HEADER ) + sizeof( T );
}
std::vector< uint8_t > getContent() override
{
std::vector< uint8_t > content( getContentSize() );
memcpy( content.data(), &m_ipcHdr, sizeof( FFXIVARR_IPC_HEADER ) );
memcpy( content.data() + sizeof( FFXIVARR_IPC_HEADER ), &m_data, sizeof( T ) );
return content;
}
std::vector< uint8_t > getData() const override
{
auto segmentHeaderSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
auto ipcHeaderSize = sizeof( FFXIVARR_IPC_HEADER );
auto dataSize = sizeof( m_data );
std::vector< uint8_t > data( segmentHeaderSize + ipcHeaderSize + dataSize );
memcpy( &data[ 0 ], &m_segHdr, segmentHeaderSize );
memcpy( &data[ segmentHeaderSize ], &m_ipcHdr, ipcHeaderSize );
memcpy( &data[ segmentHeaderSize + ipcHeaderSize ], &m_data, dataSize );
return data;
}
T1 ipcType() override
{
return static_cast< T1 >( m_data._ServerIpcType );
};
/** Gets a reference to the underlying IPC data structure. */
T& data()
{
return m_data;
};
const T& data() const
{
return m_data;
}
protected:
/** Initializes the fields of the header structures */
virtual void initialize()
{
// Zero out the structures.
memset( &m_ipcHdr, 0, sizeof( FFXIVARR_IPC_HEADER ) );
memset( &m_data, 0, sizeof( T ) );
// The IPC type itself.
m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType );
m_ipcHdr.timestamp = Util::getTimeSeconds();
m_segHdr.size = sizeof( T ) + sizeof( FFXIVARR_IPC_HEADER ) + sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
};
protected:
/** The IPC packet header */
FFXIVARR_IPC_HEADER m_ipcHdr;
/** The underlying data portion of the packet as a structure */
T m_data;
}; };
/**
* @brief Gets the target actor id for this packet. class FFXIVRawPacket :
*/ public FFXIVPacketBase
uint32_t getTargetActor( void ) const
{ {
return m_segHdr.target_actor; public:
FFXIVRawPacket( uint16_t type, uint32_t size, uint32_t sourceActorId, uint32_t targetActorId ) :
m_data( std::vector< uint8_t >( size - sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ) ),
FFXIVPacketBase( type, sourceActorId, targetActorId )
{
initialize();
m_segHdr.size = size;
};
FFXIVRawPacket( char* data, uint16_t size ) :
m_data( std::vector< uint8_t >( size ) )
{
auto segmentHdrSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
memcpy( &m_data[ 0 ], data + segmentHdrSize, size - segmentHdrSize );
memcpy( &m_segHdr, data, segmentHdrSize );
}
size_t getContentSize() override
{
return m_data.size();
}
std::vector< uint8_t > getContent() override
{
return m_data;
}
virtual std::vector< uint8_t > getData() const override
{
std::vector< uint8_t > data( sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + m_data.size() );
memcpy( &data[ 0 ], &m_segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
memcpy( &data[ sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ], &m_data[ 0 ], m_data.size() );
return data;
}
/** Gets a reference to the underlying IPC data structure. */
std::vector< uint8_t >& data()
{
return m_data;
};
protected:
/** Initializes the fields of the header structures */
virtual void initialize()
{
// Zero out the structures.
memset( &m_data[ 0 ], 0, m_data.size() );
};
protected:
/** The underlying data portion of the packet as a structure */
std::vector< uint8_t > m_data;
}; };
/** Initializes the fields of the segment header structure */
virtual void initializeSegmentHeader( void )
{
// Zero out the structure.
memset( &m_segHdr, 0, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
// Set the values of static fields.
// The size must be the sum of the segment header and the content
m_segHdr.size = static_cast< uint32_t >( sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + getContentSize() );
m_segHdr.type = getSegmentType();
}
};
template< typename T, typename T1 >
class FFXIVIpcPacket :
public FFXIVIpcPacketBase< T1 >, public FFXIVPacketBase
{
public:
FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId, uint32_t targetActorId ) :
FFXIVPacketBase( 3, sourceActorId, targetActorId )
{
initialize();
};
FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId ) :
FFXIVPacketBase( 3, sourceActorId, sourceActorId )
{
initialize();
};
FFXIVIpcPacket< T, T1 >( const FFXIVARR_PACKET_RAW& rawPacket )
{
auto ipcHdrSize = sizeof( FFXIVARR_IPC_HEADER );
auto copySize = std::min< size_t >( sizeof( T ), rawPacket.segHdr.size - ipcHdrSize );
memcpy( &m_segHdr, &rawPacket.segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
memcpy( &m_data, &rawPacket.data[ 0 ] + ipcHdrSize, copySize );
memset( &m_ipcHdr, 0, ipcHdrSize );
m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType );
}
size_t getContentSize() override
{
return sizeof( FFXIVARR_IPC_HEADER ) + sizeof( T );
}
std::vector< uint8_t > getContent() override
{
std::vector< uint8_t > content( getContentSize() );
memcpy( content.data(), &m_ipcHdr, sizeof( FFXIVARR_IPC_HEADER ) );
memcpy( content.data() + sizeof( FFXIVARR_IPC_HEADER ), &m_data, sizeof( T ) );
return content;
}
std::vector< uint8_t > getData() const override
{
auto segmentHeaderSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
auto ipcHeaderSize = sizeof( FFXIVARR_IPC_HEADER );
auto dataSize = sizeof( m_data );
std::vector< uint8_t > data( segmentHeaderSize + ipcHeaderSize + dataSize );
memcpy( &data[ 0 ], &m_segHdr, segmentHeaderSize );
memcpy( &data[ segmentHeaderSize ], &m_ipcHdr, ipcHeaderSize );
memcpy( &data[ segmentHeaderSize + ipcHeaderSize ], &m_data, dataSize );
return data;
}
T1 ipcType() override
{
return static_cast< T1 >( m_data._ServerIpcType );
};
/** Gets a reference to the underlying IPC data structure. */
T& data()
{
return m_data;
};
const T& data() const
{
return m_data;
}
protected:
/** Initializes the fields of the header structures */
virtual void initialize()
{
// Zero out the structures.
memset( &m_ipcHdr, 0, sizeof( FFXIVARR_IPC_HEADER ) );
memset( &m_data, 0, sizeof( T ) );
// The IPC type itself.
m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType );
m_ipcHdr.timestamp = Util::getTimeSeconds();
m_segHdr.size = sizeof( T ) + sizeof( FFXIVARR_IPC_HEADER ) + sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
};
protected:
/** The IPC packet header */
FFXIVARR_IPC_HEADER m_ipcHdr;
/** The underlying data portion of the packet as a structure */
T m_data;
};
class FFXIVRawPacket :
public FFXIVPacketBase
{
public:
FFXIVRawPacket( uint16_t type, uint32_t size, uint32_t sourceActorId, uint32_t targetActorId ) :
m_data( std::vector< uint8_t >( size - sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ) ),
FFXIVPacketBase( type, sourceActorId, targetActorId )
{
initialize();
m_segHdr.size = size;
};
FFXIVRawPacket( char* data, uint16_t size ) :
m_data( std::vector< uint8_t >( size ) )
{
auto segmentHdrSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
memcpy( &m_data[ 0 ], data + segmentHdrSize, size - segmentHdrSize );
memcpy( &m_segHdr, data, segmentHdrSize );
}
size_t getContentSize() override
{
return m_data.size();
}
std::vector< uint8_t > getContent() override
{
return m_data;
}
virtual std::vector< uint8_t > getData() const override
{
std::vector< uint8_t > data( sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + m_data.size() );
memcpy( &data[ 0 ], &m_segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
memcpy( &data[ sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ], &m_data[ 0 ], m_data.size() );
return data;
}
/** Gets a reference to the underlying IPC data structure. */
std::vector< uint8_t >& data()
{
return m_data;
};
protected:
/** Initializes the fields of the header structures */
virtual void initialize()
{
// Zero out the structures.
memset( &m_data[ 0 ], 0, m_data.size() );
};
protected:
/** The underlying data portion of the packet as a structure */
std::vector< uint8_t > m_data;
};
} }
#endif /*_CORE_NETWORK_PACKETS_CGAMEPACKETNEW_H*/ #endif

View file

@ -2,44 +2,41 @@
#include <functional> #include <functional>
#include "Hive.h" #include "Hive.h"
namespace Sapphire::Network
{
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
Hive::Hive() : Sapphire::Network::Hive::Hive() :
m_work_ptr( new asio::io_service::work( m_io_service ) ), m_work_ptr( new asio::io_service::work( m_io_service ) ),
m_shutdown( 0 ) m_shutdown( 0 )
{ {
} }
Hive::~Hive() Sapphire::Network::Hive::~Hive()
{ {
} }
asio::io_service& Hive::getService() asio::io_service& Sapphire::Network::Hive::getService()
{ {
return m_io_service; return m_io_service;
} }
bool Hive::hasStopped() bool Sapphire::Network::Hive::hasStopped()
{ {
uint32_t v1 = 1; uint32_t v1 = 1;
uint32_t v2 = 1; uint32_t v2 = 1;
return m_shutdown.compare_exchange_strong( v1, v2 ); return m_shutdown.compare_exchange_strong( v1, v2 );
} }
void Hive::poll() void Sapphire::Network::Hive::poll()
{ {
m_io_service.poll(); m_io_service.poll();
} }
void Hive::run() void Sapphire::Network::Hive::run()
{ {
m_io_service.run(); m_io_service.run();
} }
void Hive::stop() void Sapphire::Network::Hive::stop()
{ {
uint32_t v1 = 1; uint32_t v1 = 1;
uint32_t v2 = 0; uint32_t v2 = 0;
@ -51,7 +48,7 @@ void Hive::stop()
} }
} }
void Hive::reset() void Sapphire::Network::Hive::reset()
{ {
uint32_t v1 = 0; uint32_t v1 = 0;
uint32_t v2 = 1; uint32_t v2 = 1;
@ -61,5 +58,3 @@ void Hive::reset()
m_work_ptr.reset( new asio::io_service::work( m_io_service ) ); m_work_ptr.reset( new asio::io_service::work( m_io_service ) );
} }
} }
}

View file

@ -12,7 +12,6 @@ namespace Sapphire::Network::Packets
{ {
using FFXIVPacketBasePtr = std::shared_ptr< FFXIVPacketBase >; using FFXIVPacketBasePtr = std::shared_ptr< FFXIVPacketBase >;
class PacketContainer class PacketContainer
{ {
public: public:

View file

@ -9,7 +9,6 @@ namespace Sapphire::Util
{ {
template< typename T, typename ActorIdType = uint32_t > template< typename T, typename ActorIdType = uint32_t >
class SpawnIndexAllocator class SpawnIndexAllocator
{ {
public: public:

View file

@ -32,7 +32,7 @@ namespace Sapphire::Util
void valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t& outIndex ); void valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t& outIndex );
template <class T> template< class T >
inline void hashCombine( std::size_t& seed, const T& v ) inline void hashCombine( std::size_t& seed, const T& v )
{ {
std::hash< T > hasher; std::hash< T > hasher;

View file

@ -55,8 +55,8 @@ foreach(_scriptDir ${children})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ScriptLoader.cpp.in" "${_scriptDir}/ScriptLoader.cpp") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ScriptLoader.cpp.in" "${_scriptDir}/ScriptLoader.cpp")
if( UNIX ) if( UNIX )
cotire("script_${_name}") cotire("script_${_name}")
endif() endif()
if(MSVC) if(MSVC)

View file

@ -13,11 +13,11 @@
namespace Sapphire::Entity namespace Sapphire::Entity
{ {
typedef struct using HateListEntry = struct
{ {
uint32_t m_hateAmount; uint32_t m_hateAmount;
CharaPtr m_pChara; CharaPtr m_pChara;
} HateListEntry; };
enum class BNpcState enum class BNpcState
{ {

View file

@ -25,7 +25,7 @@ namespace Sapphire::Entity
uint8_t m_customize[26]; uint8_t m_customize[26];
public: public:
BNpcTemplate() {}; BNpcTemplate() = default;
BNpcTemplate( uint32_t id, uint32_t baseId, uint32_t nameId, uint64_t weaponMain, uint64_t weaponSub, uint8_t aggressionMode, BNpcTemplate( uint32_t id, uint32_t baseId, uint32_t nameId, uint64_t weaponMain, uint64_t weaponSub, uint8_t aggressionMode,
uint8_t enemyType, uint8_t onlineStatus, uint8_t pose, uint16_t modelChara, uint8_t enemyType, uint8_t onlineStatus, uint8_t pose, uint16_t modelChara,

View file

@ -60,9 +60,8 @@ namespace Sapphire::Entity
Action::ActionCallback interruptCallback, uint64_t additional ); Action::ActionCallback interruptCallback, uint64_t additional );
/*! start/register a normal event */ /*! start/register a normal event */
void void eventStart( uint64_t actorId, uint32_t eventId, Event::EventHandler::EventType eventParam, uint8_t eventParam1,
eventStart( uint64_t actorId, uint32_t eventId, Event::EventHandler::EventType eventParam, uint8_t eventParam1, uint32_t eventParam2, Event::EventHandler::EventFinishCallback callback = nullptr );
uint32_t eventParam2, Event::EventHandler::EventFinishCallback callback = nullptr );
/*! play a subevent */ /*! play a subevent */
void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam2, uint32_t eventParam3 ); void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam2, uint32_t eventParam3 );
@ -70,9 +69,8 @@ namespace Sapphire::Entity
void playGilShop( uint32_t eventId, uint32_t flags, void playGilShop( uint32_t eventId, uint32_t flags,
Event::EventHandler::SceneReturnCallback eventCallback ); Event::EventHandler::SceneReturnCallback eventCallback );
void void directorPlayScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam3,
directorPlayScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam3, uint32_t eventParam4, uint32_t eventParam4, uint32_t eventParam5 = 0 );
uint32_t eventParam5 = 0 );
/*! play a subevent */ /*! play a subevent */
void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, void playScene( uint32_t eventId, uint32_t scene, uint32_t flags,