1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-01 00:27:44 +00:00

Greatly improved exd struct gen and also updated struct test

This commit is contained in:
Mordred 2017-11-30 23:41:27 +01:00
parent 8174d4082c
commit e75c392b9f
9 changed files with 4408 additions and 25 deletions

View file

@ -1,11 +1,11 @@
#include "Session.h"
namespace Core {
Session::Session( void )
Session::Session()
{
}
Session::~Session( void )
Session::~Session()
{
}

View file

@ -20,8 +20,8 @@ namespace Core {
std::string newCharName;
Session( void );
~Session( void );
Session();
~Session();
uint32_t getIp() const;

View file

@ -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 ) );
};
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 )
{
try

View file

@ -10,6 +10,7 @@
#include <ExdData.h>
#include <ExdCat.h>
#include <Exd.h>
#include <set>
namespace Core {
namespace Data {
@ -36,6 +37,8 @@ STRUCTS
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::exd::ExdData > m_exd_data;
@ -43,6 +46,10 @@ DATACCESS
DIRECTGETTERS
IDLISTS
IDLISTGETTERS
};
}

View file

@ -1,5 +1,5 @@
{
"version": "2017.10.05.0000.0000",
"version": "2017.11.15.0000.0000",
"sheets": [
{
"sheet": "Achievement",
@ -189,7 +189,7 @@
"index": 30,
"name": "Cost{Type}"
},
{
{
"index": 31,
"name": "Cost"
},
@ -2868,7 +2868,7 @@
},
{
"sheet": "DeepDungeonItem",
"defaultcolumn": "Name",
"defaultColumn": "Name",
"definitions": [
{
"name": "Icon",
@ -2877,7 +2877,7 @@
}
},
{
"index": 2,
"index": 1,
"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",
"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",
"defaultColumn": "Item",
@ -4513,11 +4569,19 @@
},
{
"index": 1,
"name": "Required{Rank}"
"name": "Required{GrandCompanyRank}",
"converter": {
"type": "link",
"target": "GrandCompanyRank"
}
},
{
"index": 2,
"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",
"defaultColumn": "Item[0]",
@ -7935,7 +8019,7 @@
]
},
{
"sheet": "Salvage",
"sheet": "Salvage",
"defaultColumn": "OptimalSkill",
"definitions": [
{

View file

@ -31,8 +31,8 @@ Core::Logger g_log;
Core::Data::ExdData g_exdData;
bool skipUnmapped = true;
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( "/opt/sapphire_3_15_0/bin/sqpack" );
const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv" );
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";
}
std::string generateIdListDecl( const std::string &exd )
{
return " std::set< uint32_t > m_" + exd + "IdList;\n";
}
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 )
@ -288,14 +304,18 @@ int main()
g_log.fatal( "Error setting up EXD data " );
return 0;
}
g_log.info( "Generating structs, this may take several minutes..." );
g_log.info( "Go grab a coffee..." );
std::string structDefs;
std::string idListsDecl;
std::string dataDecl;
std::string getterDecl;
std::string datAccCall;
std::string getterDef;
std::string constructorDecl;
std::string forwards;
std::string idListGetters;
//BOOST_FOREACH( boost::property_tree::ptree::value_type &sheet, m_propTree.get_child( "sheets" ) )
//{
@ -310,10 +330,12 @@ int main()
forwards += "struct " + name +";\n";
structDefs += generateStruct( name );
dataDecl += generateDatAccessDecl( name );
idListsDecl += generateIdListDecl( name );
getterDecl += generateDirectGetters( name );
datAccCall += generateSetDatAccessCall( name );
getterDef += generateDirectGetterDef( name );
constructorDecl += generateConstructorsDecl( name );
idListGetters += generateIdListGetter( name );
}
// 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( result, std::regex( "\\STRUCTS" ), structDefs );
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( "\\IDLISTGETTERS" ), idListGetters );
// 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

View file

@ -25,8 +25,8 @@ Core::Logger g_log;
Core::Data::ExdDataGenerated g_exdData;
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( "/opt/sapphire_3_15_0/bin/sqpack" );
const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv" );
int main()
@ -41,10 +41,15 @@ int main()
return 0;
}
auto teri = g_exdData.getTerritoryType( 132 );
g_log.info( teri->name );
g_log.info( teri->bg );
auto idList = g_exdData.getTerritoryTypeIdList();
for( auto id : idList )
{
auto teri1 = g_exdData.getTerritoryType( id );
g_log.info( teri1->name );
g_log.info( teri1->bg );
}
return 0;
}