mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-02 08:57:44 +00:00
Greatly improved exd struct gen and also updated struct test
This commit is contained in:
parent
8174d4082c
commit
e75c392b9f
9 changed files with 4408 additions and 25 deletions
|
@ -1,11 +1,11 @@
|
||||||
#include "Session.h"
|
#include "Session.h"
|
||||||
namespace Core {
|
namespace Core {
|
||||||
Session::Session( void )
|
Session::Session()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Session::~Session( void )
|
Session::~Session()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,8 @@ namespace Core {
|
||||||
|
|
||||||
std::string newCharName;
|
std::string newCharName;
|
||||||
|
|
||||||
Session( void );
|
Session();
|
||||||
~Session( void );
|
~Session();
|
||||||
|
|
||||||
uint32_t getIp() const;
|
uint32_t getIp() const;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,18 @@ xiv::exd::Exd Core::Data::ExdDataGenerated::setupDatAccess( const std::string& n
|
||||||
return static_cast< xiv::exd::Exd >( cat.get_data_ln( lang ) );
|
return static_cast< xiv::exd::Exd >( cat.get_data_ln( lang ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void Core::Data::ExdDataGenerated::loadIdList( xiv::exd::Exd& data, std::set< uint32_t >& outIdList )
|
||||||
|
{
|
||||||
|
auto pDataRows = data.get_rows();
|
||||||
|
|
||||||
|
for( auto row : pDataRows )
|
||||||
|
{
|
||||||
|
uint32_t id = row.first;
|
||||||
|
outIdList.insert( id );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Core::Data::ExdDataGenerated::init( const std::string& path )
|
bool Core::Data::ExdDataGenerated::init( const std::string& path )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <ExdData.h>
|
#include <ExdData.h>
|
||||||
#include <ExdCat.h>
|
#include <ExdCat.h>
|
||||||
#include <Exd.h>
|
#include <Exd.h>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Data {
|
namespace Data {
|
||||||
|
@ -36,6 +37,8 @@ STRUCTS
|
||||||
return *boost::get< T >( &fields.at( index ) );
|
return *boost::get< T >( &fields.at( index ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void loadIdList( xiv::exd::Exd& data, std::set< uint32_t >& outIdList );
|
||||||
|
|
||||||
boost::shared_ptr< xiv::dat::GameData > m_data;
|
boost::shared_ptr< xiv::dat::GameData > m_data;
|
||||||
boost::shared_ptr< xiv::exd::ExdData > m_exd_data;
|
boost::shared_ptr< xiv::exd::ExdData > m_exd_data;
|
||||||
|
|
||||||
|
@ -43,6 +46,10 @@ DATACCESS
|
||||||
|
|
||||||
DIRECTGETTERS
|
DIRECTGETTERS
|
||||||
|
|
||||||
|
IDLISTS
|
||||||
|
|
||||||
|
IDLISTGETTERS
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "2017.10.05.0000.0000",
|
"version": "2017.11.15.0000.0000",
|
||||||
"sheets": [
|
"sheets": [
|
||||||
{
|
{
|
||||||
"sheet": "Achievement",
|
"sheet": "Achievement",
|
||||||
|
@ -2868,7 +2868,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"sheet": "DeepDungeonItem",
|
"sheet": "DeepDungeonItem",
|
||||||
"defaultcolumn": "Name",
|
"defaultColumn": "Name",
|
||||||
"definitions": [
|
"definitions": [
|
||||||
{
|
{
|
||||||
"name": "Icon",
|
"name": "Icon",
|
||||||
|
@ -2877,7 +2877,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"index": 2,
|
"index": 1,
|
||||||
"name": "Singular"
|
"name": "Singular"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -3476,6 +3476,42 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"sheet": "EquipRaceCategory",
|
||||||
|
"definitions": [
|
||||||
|
{
|
||||||
|
"name": "Hyur"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"index": 1,
|
||||||
|
"name": "Elezen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"index": 2,
|
||||||
|
"name": "Lalafell"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"index": 3,
|
||||||
|
"name": "Miqo'te"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"index": 4,
|
||||||
|
"name": "Roegadyn"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"index": 5,
|
||||||
|
"name": "Au Ra"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"index": 6,
|
||||||
|
"name": "Male"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"index": 7,
|
||||||
|
"name": "Female"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"sheet": "EquipSlotCategory",
|
"sheet": "EquipSlotCategory",
|
||||||
"definitions": [
|
"definitions": [
|
||||||
|
@ -4500,6 +4536,26 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"sheet": "GCScripShopCategory",
|
||||||
|
"definitions": [
|
||||||
|
{
|
||||||
|
"name": "GrandCompany",
|
||||||
|
"converter": {
|
||||||
|
"type": "link",
|
||||||
|
"target": "GrandCompany"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"index": 1,
|
||||||
|
"name": "Tier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"index": 2,
|
||||||
|
"name": "SubCategory"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"sheet": "GCScripShopItem",
|
"sheet": "GCScripShopItem",
|
||||||
"defaultColumn": "Item",
|
"defaultColumn": "Item",
|
||||||
|
@ -4513,11 +4569,19 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"index": 1,
|
"index": 1,
|
||||||
"name": "Required{Rank}"
|
"name": "Required{GrandCompanyRank}",
|
||||||
|
"converter": {
|
||||||
|
"type": "link",
|
||||||
|
"target": "GrandCompanyRank"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"index": 2,
|
"index": 2,
|
||||||
"name": "Cost{GCSeals}"
|
"name": "Cost{GCSeals}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"index": 3,
|
||||||
|
"name": "SortKey"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -6211,6 +6275,26 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"sheet": "MasterpieceSupplyMultiplier",
|
||||||
|
"definitions": [
|
||||||
|
{
|
||||||
|
"type": "repeat",
|
||||||
|
"count": 2,
|
||||||
|
"definition": {
|
||||||
|
"name": "XpMultiplier"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"index": 4,
|
||||||
|
"type": "repeat",
|
||||||
|
"count": 2,
|
||||||
|
"definition": {
|
||||||
|
"name": "CurrencyMultiplier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"sheet": "Materia",
|
"sheet": "Materia",
|
||||||
"defaultColumn": "Item[0]",
|
"defaultColumn": "Item[0]",
|
||||||
|
@ -7935,7 +8019,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"sheet": "Salvage",
|
"sheet": "Salvage",
|
||||||
"defaultColumn": "OptimalSkill",
|
"defaultColumn": "OptimalSkill",
|
||||||
"definitions": [
|
"definitions": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,8 +31,8 @@ Core::Logger g_log;
|
||||||
Core::Data::ExdData g_exdData;
|
Core::Data::ExdData g_exdData;
|
||||||
bool skipUnmapped = true;
|
bool skipUnmapped = true;
|
||||||
|
|
||||||
const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
//const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||||
//const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv" );
|
const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv" );
|
||||||
std::map< uint8_t, std::string > g_typeMap;
|
std::map< uint8_t, std::string > g_typeMap;
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,9 +41,25 @@ std::string generateDatAccessDecl( const std::string &exd )
|
||||||
return " xiv::exd::Exd m_" + exd + "Dat;\n";
|
return " xiv::exd::Exd m_" + exd + "Dat;\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string generateIdListDecl( const std::string &exd )
|
||||||
|
{
|
||||||
|
return " std::set< uint32_t > m_" + exd + "IdList;\n";
|
||||||
|
}
|
||||||
|
|
||||||
std::string generateDirectGetters( const std::string& exd )
|
std::string generateDirectGetters( const std::string& exd )
|
||||||
{
|
{
|
||||||
return " boost::shared_ptr< " + exd + " > get" + exd + "( uint32_t " + exd + "Id );";
|
return " boost::shared_ptr< " + exd + " > get" + exd + "( uint32_t " + exd + "Id );\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string generateIdListGetter( const std::string &exd )
|
||||||
|
{
|
||||||
|
std::string IdListGetter = "const std::set< uint32_t >& Core::Data::ExdDataGenerated::get" + exd + "IdList()\n"
|
||||||
|
"{\n"
|
||||||
|
" if( m_" + exd + "IdList.size() == 0 )\n"
|
||||||
|
" loadIdList( m_" + exd + "Dat, m_" + exd + "IdList );\n"
|
||||||
|
" return m_" + exd + "IdList;\n"
|
||||||
|
"}\n";
|
||||||
|
return IdListGetter;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string generateSetDatAccessCall( const std::string &exd )
|
std::string generateSetDatAccessCall( const std::string &exd )
|
||||||
|
@ -288,14 +304,18 @@ int main()
|
||||||
g_log.fatal( "Error setting up EXD data " );
|
g_log.fatal( "Error setting up EXD data " );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
g_log.info( "Generating structs, this may take several minutes..." );
|
||||||
|
g_log.info( "Go grab a coffee..." );
|
||||||
|
|
||||||
std::string structDefs;
|
std::string structDefs;
|
||||||
|
std::string idListsDecl;
|
||||||
std::string dataDecl;
|
std::string dataDecl;
|
||||||
std::string getterDecl;
|
std::string getterDecl;
|
||||||
std::string datAccCall;
|
std::string datAccCall;
|
||||||
std::string getterDef;
|
std::string getterDef;
|
||||||
std::string constructorDecl;
|
std::string constructorDecl;
|
||||||
std::string forwards;
|
std::string forwards;
|
||||||
|
std::string idListGetters;
|
||||||
|
|
||||||
//BOOST_FOREACH( boost::property_tree::ptree::value_type &sheet, m_propTree.get_child( "sheets" ) )
|
//BOOST_FOREACH( boost::property_tree::ptree::value_type &sheet, m_propTree.get_child( "sheets" ) )
|
||||||
//{
|
//{
|
||||||
|
@ -310,10 +330,12 @@ int main()
|
||||||
forwards += "struct " + name +";\n";
|
forwards += "struct " + name +";\n";
|
||||||
structDefs += generateStruct( name );
|
structDefs += generateStruct( name );
|
||||||
dataDecl += generateDatAccessDecl( name );
|
dataDecl += generateDatAccessDecl( name );
|
||||||
|
idListsDecl += generateIdListDecl( name );
|
||||||
getterDecl += generateDirectGetters( name );
|
getterDecl += generateDirectGetters( name );
|
||||||
datAccCall += generateSetDatAccessCall( name );
|
datAccCall += generateSetDatAccessCall( name );
|
||||||
getterDef += generateDirectGetterDef( name );
|
getterDef += generateDirectGetterDef( name );
|
||||||
constructorDecl += generateConstructorsDecl( name );
|
constructorDecl += generateConstructorsDecl( name );
|
||||||
|
idListGetters += generateIdListGetter( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
// for all sheets in the json i guess....
|
// for all sheets in the json i guess....
|
||||||
|
@ -322,7 +344,10 @@ int main()
|
||||||
result = std::regex_replace( exdH, std::regex( "\\FORWARDS" ), forwards );
|
result = std::regex_replace( exdH, std::regex( "\\FORWARDS" ), forwards );
|
||||||
result = std::regex_replace( result, std::regex( "\\STRUCTS" ), structDefs );
|
result = std::regex_replace( result, std::regex( "\\STRUCTS" ), structDefs );
|
||||||
result = std::regex_replace( result, std::regex( "\\DATACCESS" ), dataDecl );
|
result = std::regex_replace( result, std::regex( "\\DATACCESS" ), dataDecl );
|
||||||
|
result = std::regex_replace( result, std::regex( "\\IDLISTS" ), idListsDecl );
|
||||||
result = std::regex_replace( result, std::regex( "\\DIRECTGETTERS" ), getterDecl );
|
result = std::regex_replace( result, std::regex( "\\DIRECTGETTERS" ), getterDecl );
|
||||||
|
result = std::regex_replace( result, std::regex( "\\IDLISTGETTERS" ), idListGetters );
|
||||||
|
|
||||||
|
|
||||||
// g_log.info( result );
|
// g_log.info( result );
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -25,8 +25,8 @@ Core::Logger g_log;
|
||||||
Core::Data::ExdDataGenerated g_exdData;
|
Core::Data::ExdDataGenerated g_exdData;
|
||||||
|
|
||||||
|
|
||||||
const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
//const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||||
//const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv" );
|
const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv" );
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
@ -41,10 +41,15 @@ int main()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto teri = g_exdData.getTerritoryType( 132 );
|
auto idList = g_exdData.getTerritoryTypeIdList();
|
||||||
|
|
||||||
g_log.info( teri->name );
|
for( auto id : idList )
|
||||||
g_log.info( teri->bg );
|
{
|
||||||
|
auto teri1 = g_exdData.getTerritoryType( id );
|
||||||
|
|
||||||
|
g_log.info( teri1->name );
|
||||||
|
g_log.info( teri1->bg );
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue