diff --git a/bin/config/settings_lobby.xml b/bin/config/settings_lobby.xml
deleted file mode 100644
index df2052ce..00000000
--- a/bin/config/settings_lobby.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
- 54994
- 54998
-
- 127.0.0.1
-
- 127.0.0.1
-
- 54992
-
- 127.0.0.1:80
-
- default
-
-
- 127.0.0.1
- 3306
- root
-
- sapphire
-
-
-
-
- false
-
- 67
-
-
- Sapphire
-
-
\ No newline at end of file
diff --git a/bin/config/settings_rest.xml b/bin/config/settings_rest.xml
deleted file mode 100644
index c0b84b7f..00000000
--- a/bin/config/settings_rest.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
- 54994
- 54998
-
- 127.0.0.1
-
- C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack
-
-
- 127.0.0.1
-
- 127.0.0.1
-
- default
-
- 80
-
- 127.0.0.1
- 3306
- root
-
- sapphire
-
-
-
-
-
- 255
-
-
diff --git a/bin/config/settings_zone.xml b/bin/config/settings_zone.xml
deleted file mode 100644
index 5282957a..00000000
--- a/bin/config/settings_zone.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
- 54992
-
- 127.0.0.1
-
- C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack
-
-
-
- ./compiledscripts/
- ./cache/
-
-
- true
- ../scripts/native/
- ../cmake-build-debug/
- cmake --build %1% --target %2%
-
-
-
-
- ./compiledscripts/
-
-
- 127.0.0.1
- 3306
- root
-
- sapphire
- 2
- 2
-
-
-
-
-
-
- <<<Welcome to Sapphire>>>
- This is a very good server
- You can change these messages by editing MotDArray in config/settings_zone.xml
-
-
-
diff --git a/src/common/Forwards.h b/src/common/Forwards.h
index 515bfe0e..5c8061db 100644
--- a/src/common/Forwards.h
+++ b/src/common/Forwards.h
@@ -6,9 +6,9 @@
namespace Core
{
- class XMLConfig;
+ class ConfigMgr;
- typedef boost::shared_ptr XMLConfigPtr;
+ typedef boost::shared_ptr ConfigMgrPtr;
namespace Network
diff --git a/src/servers/sapphire_api/main.cpp b/src/servers/sapphire_api/main.cpp
index d42d53cf..d4fac57b 100644
--- a/src/servers/sapphire_api/main.cpp
+++ b/src/servers/sapphire_api/main.cpp
@@ -7,7 +7,7 @@
#include
#include
-#include
+#include
#include
#include
@@ -52,13 +52,13 @@ void default_resource_send( const HttpServer &server, const shared_ptr< HttpServ
const shared_ptr< ifstream > &ifs );
-auto m_pConfig = boost::make_shared< Core::XMLConfig >();
+auto m_pConfig = boost::make_shared< Core::ConfigMgr >();
HttpServer server;
-std::string configPath( "config/settings_rest.xml" );
+std::string configPath( "rest.ini" );
void reloadConfig()
{
- m_pConfig = boost::make_shared< Core::XMLConfig >();
+ m_pConfig = boost::make_shared< Core::ConfigMgr >();
if( !m_pConfig->loadConfig( configPath ) )
throw "Error loading config ";
@@ -96,43 +96,43 @@ bool loadSettings( int32_t argc, char* argv[] )
if( arg == "ip" )
{
// todo: ip addr in config
- m_pConfig->setValue< std::string >( "Settings.General.ListenIP", val );
+ m_pConfig->setValue< std::string >( "GlobalNetwork.RestHost", val );
}
else if( arg == "p" || arg == "port" )
{
- m_pConfig->setValue< std::string >( "Settings.General.ListenPort", val );
+ m_pConfig->setValue< std::string >( "GlobalNetwork.RestPort", val );
}
else if( arg == "exdpath" || arg == "datapath" )
{
- m_pConfig->setValue< std::string >( "Settings.General.DataPath", val );
+ m_pConfig->setValue< std::string >( "GlobalParameters.DataPath", val );
}
else if( arg == "h" || arg == "dbhost" )
{
- m_pConfig->setValue< std::string >( "Settings.General.Mysql.Host", val );
+ m_pConfig->setValue< std::string >( "Database.Host", val );
}
else if( arg == "dbport" )
{
- m_pConfig->setValue< std::string >( "Settings.General.Mysql.Port", val );
+ m_pConfig->setValue< std::string >( "Database.Port", val );
}
else if( arg == "u" || arg == "user" || arg == "dbuser" )
{
- m_pConfig->setValue< std::string >( "Settings.General.Mysql.Username", val );
+ m_pConfig->setValue< std::string >( "Database.Username", val );
}
else if( arg == "pass" || arg == "dbpass" )
{
- m_pConfig->setValue< std::string >( "Settings.General.Mysql.Pass", val );
+ m_pConfig->setValue< std::string >( "Database.Password", val );
}
else if( arg == "d" || arg == "db" || arg == "database" )
{
- m_pConfig->setValue< std::string >( "Settings.General.Mysql.Database", val );
+ m_pConfig->setValue< std::string >( "Database.Database", val );
}
else if ( arg == "lobbyip" || arg == "lobbyhost" )
{
- m_pConfig->setValue< std::string >( "Settings.General.LobbyHost", val );
+ m_pConfig->setValue< std::string >( "GlobalNetwork.LobbyHost", val );
}
else if ( arg == "lobbyport" )
{
- m_pConfig->setValue< std::string >( "Settings.General.LobbyPort", val );
+ m_pConfig->setValue< std::string >( "GlobalNetwork.LobbyPort", val );
}
}
catch( ... )
@@ -143,7 +143,7 @@ bool loadSettings( int32_t argc, char* argv[] )
}
g_log.info( "Setting up generated EXD data" );
- if( !g_exdDataGen.init( m_pConfig->getValue< std::string >( "Settings.General.DataPath", "" ) ) )
+ if( !g_exdDataGen.init( m_pConfig->getValue< std::string >( "GlobalParameters.DataPath", "" ) ) )
{
g_log.fatal( "Error setting up generated EXD data " );
return false;
@@ -152,19 +152,19 @@ bool loadSettings( int32_t argc, char* argv[] )
Core::Db::DbLoader loader;
Core::Db::ConnectionInfo info;
- info.password = m_pConfig->getValue< std::string >( "Settings.General.Mysql.Pass", "" );
- info.host = m_pConfig->getValue< std::string >( "Settings.General.Mysql.Host", "127.0.0.1" );
- info.database = m_pConfig->getValue< std::string >( "Settings.General.Mysql.Database", "sapphire" );
- info.port = m_pConfig->getValue< uint16_t >( "Settings.General.Mysql.Port", 3306 );
- info.user = m_pConfig->getValue< std::string >( "Settings.General.Mysql.Username", "root" );
- info.syncThreads = m_pConfig->getValue< uint8_t >( "Settings.General.Mysql.SyncThreads", 2 );
- info.asyncThreads = m_pConfig->getValue< uint8_t >( "Settings.General.Mysql.AsyncThreads", 2 );
+ info.password = m_pConfig->getValue< std::string >( "Database.Password", "" );
+ info.host = m_pConfig->getValue< std::string >( "Database.Host", "127.0.0.1" );
+ info.database = m_pConfig->getValue< std::string >( "Database.Database", "sapphire" );
+ info.port = m_pConfig->getValue< uint16_t >( "Database.Port", 3306 );
+ info.user = m_pConfig->getValue< std::string >( "Database.Username", "root" );
+ info.syncThreads = m_pConfig->getValue< uint8_t >( "Database.SyncThreads", 2 );
+ info.asyncThreads = m_pConfig->getValue< uint8_t >( "Database.AsyncThreads", 2 );
loader.addDb( g_charaDb, info );
if( !loader.initDbs() )
return false;
- server.config.port = static_cast< uint16_t >( std::stoul( m_pConfig->getValue< std::string >( "Settings.General.HttpPort", "80" ) ) );
+ server.config.port = static_cast< uint16_t >( std::stoul( m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort", "80" ) ) );
g_log.info( "Database: Connected to " + info.host + ":" + std::to_string( info.port ) );
@@ -269,8 +269,8 @@ void createAccount( shared_ptr response, shared_ptrgetValue< std::string >( "Settings.General.LobbyHost" ) +
- "\", \"frontierHost\":\"" + m_pConfig->getValue< std::string >( "Settings.General.FrontierHost" ) + "\"}";
+ "\", \"lobbyHost\":\"" + m_pConfig->getValue< std::string >( "GlobalNetwork.LobbyHost" ) +
+ "\", \"frontierHost\":\"" + m_pConfig->getValue< std::string >( "GlobalNetwork.RestHost" ) + "\"}";
*response << buildHttpResponse( 200, json_string, JSON );
}
else
@@ -301,8 +301,8 @@ void login( shared_ptr response, shared_ptrgetValue< std::string >("Settings.General.LobbyHost") +
- "\", \"frontierHost\":\"" + m_pConfig->getValue< std::string >( "Settings.General.FrontierHost" ) + "\"}";
+ "\", \"lobbyHost\":\"" + m_pConfig->getValue< std::string >( "GlobalNetwork.LobbyHost" ) +
+ "\", \"frontierHost\":\"" + m_pConfig->getValue< std::string >( "GlobalNetwork.RestHost" ) + "\"}";
*response << buildHttpResponse( 200, json_string, JSON );
}
else
@@ -333,7 +333,7 @@ void deleteCharacter( shared_ptr response, shared_ptrgetValue< std::string >( "Settings.General.ServerSecret" ) != secret )
+ if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@@ -374,14 +374,14 @@ void createCharacter( shared_ptr response, shared_ptrgetValue< std::string >( "Settings.General.ServerSecret" ) != secret )
+ if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
}
else
{
- int32_t charId = g_sapphireAPI.createCharacter( result, name, finalJson, m_pConfig->getValue< uint8_t >( "Settings.Parameters.DefaultGMRank", 255 ) );
+ int32_t charId = g_sapphireAPI.createCharacter( result, name, finalJson, m_pConfig->getValue< uint8_t >( "CharacterCreation.DefaultGMRank", 255 ) );
std::string json_string = "{\"result\":\"" + std::to_string( charId ) + "\"}";
*response << buildHttpResponse( 200, json_string, JSON );
@@ -414,7 +414,7 @@ void insertSession( shared_ptr response, shared_ptr( "accountId" );
std::string secret = pt.get( "secret" );
// reloadConfig();
- if( m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" ) != secret )
+ if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@@ -448,7 +448,7 @@ void checkNameTaken( shared_ptr response, shared_ptrgetValue< std::string >( "Settings.General.ServerSecret" ) != secret )
+ if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@@ -486,7 +486,7 @@ void checkSession( shared_ptr response, shared_ptrgetValue< std::string >( "Settings.General.ServerSecret" ) != secret )
+ if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@@ -523,7 +523,7 @@ void getNextCharId( shared_ptr response, shared_ptrgetValue< std::string >( "Settings.General.ServerSecret" ) != secret )
+ if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@@ -555,7 +555,7 @@ void getNextContentId( shared_ptr response, shared_ptrgetValue< std::string >( "Settings.General.ServerSecret" ) != secret )
+ if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@@ -591,7 +591,7 @@ void getCharacterList( shared_ptr response, shared_ptrgetValue< std::string >( "Settings.General.ServerSecret" ) != secret )
+ if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@@ -756,8 +756,8 @@ int main( int argc, char* argv[] )
if( !loadSettings( argc, argv ) )
throw std::exception();
- server.config.port = stoi( m_pConfig->getValue< std::string >( "Settings.General.HttpPort", "80" ) );
- g_log.info( "Starting API server at port " + m_pConfig->getValue< std::string >( "Settings.General.HttpPort", "80" ) + "..." );
+ server.config.port = stoi( m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort", "80" ) );
+ g_log.info( "Starting API server at port " + m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort", "80" ) + "..." );
server.resource["^/ZoneName/([0-9]+)$"]["GET"] = &getZoneName;
server.resource["^/sapphire-api/lobby/createAccount"]["POST"] = &createAccount;
diff --git a/src/servers/sapphire_lobby/GameConnection.cpp b/src/servers/sapphire_lobby/GameConnection.cpp
index 12c40d78..2d99df2c 100644
--- a/src/servers/sapphire_lobby/GameConnection.cpp
+++ b/src/servers/sapphire_lobby/GameConnection.cpp
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
#include
@@ -129,10 +130,10 @@ void Core::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, ui
serverListPacket.data().seq = 1;
serverListPacket.data().offset = 0;
serverListPacket.data().numServers = 1;
- serverListPacket.data().server[0].id = g_serverLobby.getConfig()->getValue( "Settings.Parameters.WorldID", 1 );
+ serverListPacket.data().server[0].id = g_serverLobby.getConfig()->getValue( "Lobby.WorldID", 1 );
serverListPacket.data().server[0].index = 0;
serverListPacket.data().final = 1;
- strcpy( serverListPacket.data().server[0].name, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() );
+ strcpy( serverListPacket.data().server[0].name, g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
pRP.addPacket( serverListPacket );
@@ -166,11 +167,11 @@ void Core::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, ui
auto& charEntry = charList[charIndex];
details.uniqueId = get< 1 >( charEntry );
details.contentId = get< 2 >( charEntry );
- details.serverId = g_serverLobby.getConfig()->getValue( "Settings.Parameters.WorldID", 1 );
+ details.serverId = g_serverLobby.getConfig()->getValue( "Lobby.WorldID", 1 );
details.index = charIndex;
strcpy( details.charDetailJson, get< 3 >( charEntry ).c_str() );
strcpy( details.nameChara, get< 0 >( charEntry ).c_str() );
- strcpy( details.nameServer, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() );
+ strcpy( details.nameServer, g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
charListPacket.data().charaDetails[j] = details;
@@ -238,8 +239,8 @@ void Core::Network::GameConnection::enterWorld( FFXIVARR_PACKET_RAW& packet, uin
enterWorldPacket.data().contentId = lookupId;
enterWorldPacket.data().seq = sequence;
- strcpy( enterWorldPacket.data().host, g_serverLobby.getConfig()->getValue< std::string >( "Settings.General.ZoneIp" ).c_str() );
- enterWorldPacket.data().port = g_serverLobby.getConfig()->getValue< uint16_t >( "Settings.General.ZonePort" );
+ strcpy( enterWorldPacket.data().host, g_serverLobby.getConfig()->getValue< std::string >( "GlobalNetwork.ZoneHost" ).c_str() );
+ enterWorldPacket.data().port = g_serverLobby.getConfig()->getValue< uint16_t >( "GlobalNetwork.ZonePort" );
enterWorldPacket.data().charId = logInCharId;
memcpy( enterWorldPacket.data().sid, m_pSession->getSessionId(), 66 );
@@ -251,7 +252,7 @@ bool Core::Network::GameConnection::sendServiceAccountList( FFXIVARR_PACKET_RAW&
{
LobbySessionPtr pSession = g_serverLobby.getSession( ( char* )&packet.data[0] + 0x20 );
- if( g_serverLobby.getConfig()->getValue< bool >( "Settings.Parameters.AllowNoSessionConnect" ) && pSession == nullptr )
+ if( g_serverLobby.getConfig()->getValue< bool >( "Lobby.AllowNoSessionConnect" ) && pSession == nullptr )
{
auto session = make_LobbySession();
session->setAccountID( 0 );
@@ -319,7 +320,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac
charCreatePacket.data().content_id = newContentId;
strcpy( charCreatePacket.data().name, name.c_str() );
- strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() );
+ strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
charCreatePacket.data().type = 1;
charCreatePacket.data().seq = sequence;
charCreatePacket.data().unknown = 1;
@@ -343,7 +344,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac
charCreatePacket.data().content_id = newContentId;
strcpy( charCreatePacket.data().name, name.c_str() );
- strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() );
+ strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
charCreatePacket.data().type = 2;
charCreatePacket.data().seq = sequence;
charCreatePacket.data().unknown = 1;
@@ -374,7 +375,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac
//charCreatePacket.data().content_id = deletePlayer.getContentId();
charCreatePacket.data().content_id = 0;
strcpy( charCreatePacket.data().name, name.c_str() );
- strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() );
+ strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
charCreatePacket.data().type = 4;
charCreatePacket.data().seq = sequence;
charCreatePacket.data().unknown = 1;
diff --git a/src/servers/sapphire_lobby/ServerLobby.cpp b/src/servers/sapphire_lobby/ServerLobby.cpp
index 82693b12..ff59fd84 100644
--- a/src/servers/sapphire_lobby/ServerLobby.cpp
+++ b/src/servers/sapphire_lobby/ServerLobby.cpp
@@ -8,7 +8,7 @@
#include
#include
-#include
+#include
//#include "LobbySession.h"
@@ -37,7 +37,7 @@ namespace Core {
m_configPath( configPath ),
m_numConnections( 0 )
{
- m_pConfig = boost::shared_ptr( new XMLConfig );
+ m_pConfig = boost::shared_ptr< ConfigMgr >( new ConfigMgr );
}
ServerLobby::~ServerLobby( void )
@@ -49,7 +49,7 @@ namespace Core {
return g_restConnector.getSession( sessionId );
}
- XMLConfigPtr ServerLobby::getConfig() const
+ ConfigMgrPtr ServerLobby::getConfig() const
{
return m_pConfig;
}
@@ -109,23 +109,19 @@ namespace Core {
if( arg == "ip" )
{
// todo: ip addr in config
- m_pConfig->setValue< std::string >( "Settings.General.ListenIp", val );
+ m_pConfig->setValue< std::string >( "GlobalNetwork.LobbyHost", val );
}
else if( arg == "p" || arg == "port" )
{
- m_pConfig->setValue< std::string >( "Settings.General.ListenPort", val );
- }
- else if( arg == "ap" || arg == "auth" || arg == "authport" )
- {
- m_pConfig->setValue< std::string>( "Settings.General.AuthPort", val );
+ m_pConfig->setValue< std::string >( "GlobalNetwork.LobbyPort", val );
}
else if( arg == "worldip" || arg == "worldip" )
{
- m_pConfig->setValue < std::string >( "Settings.General.WorldIp", val );
+ m_pConfig->setValue < std::string >( "GlobalNetwork.ZoneHost", val );
}
else if( arg == "worldport" )
{
- m_pConfig->setValue< std::string >( "Settings.General.WorldPort", val );
+ m_pConfig->setValue< std::string >( "GlobalNetwork.ZonePort", val );
}
}
catch( ... )
@@ -135,11 +131,11 @@ namespace Core {
}
}
- m_port = m_pConfig->getValue< uint16_t >( "Settings.General.ListenPort", 54994 );
- m_ip = m_pConfig->getValue< std::string >( "Settings.General.ListenIp", "0.0.0.0" );
+ m_port = m_pConfig->getValue< uint16_t >( "GlobalNetwork.LobbyPort", 54994 );
+ m_ip = m_pConfig->getValue< std::string >( "GlobalNetwork.LobbyHost", "0.0.0.0" );
- g_restConnector.restHost = m_pConfig->getValue< std::string >( "Settings.General.RestHost" );
- g_restConnector.serverSecret = m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" );
+ g_restConnector.restHost = m_pConfig->getValue< std::string >( "GlobalNetwork.RestHost" ) + ":" + m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort" );
+ g_restConnector.serverSecret = m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" );
return true;
}
diff --git a/src/servers/sapphire_lobby/ServerLobby.h b/src/servers/sapphire_lobby/ServerLobby.h
index 8f28cdc0..b4efd1db 100644
--- a/src/servers/sapphire_lobby/ServerLobby.h
+++ b/src/servers/sapphire_lobby/ServerLobby.h
@@ -6,7 +6,6 @@
#include