1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 07:07:45 +00:00

Merge pull request #417 from NotAdam/boost_scrap

appveyor test
This commit is contained in:
Mordred 2018-10-27 16:45:28 +02:00 committed by GitHub
commit d6111ebc3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 119 additions and 220 deletions

View file

@ -5,7 +5,7 @@ configuration:
- Debug - Debug
platform: platform:
- Win32 - Win64
environment: environment:
MSVC_DEFAULT_OPTIONS: ON MSVC_DEFAULT_OPTIONS: ON
@ -20,7 +20,7 @@ before_build:
- git submodule update --init - git submodule update --init
- mkdir build - mkdir build
- cd build - cd build
- cmake .. -G "Visual Studio 15 2017" - cmake .. -G "Visual Studio 15 2017 Win64"
- cmake --build . --target ALL_BUILD --config Debug - cmake --build . --target ALL_BUILD --config Debug
build_script: build_script:

View file

@ -40,9 +40,9 @@ add_subdirectory( "src/servers" )
#add_subdirectory( "src/dbm" ) #add_subdirectory( "src/dbm" )
#add_subdirectory( "src/tools/exd_common_gen" ) #add_subdirectory( "src/tools/exd_common_gen" )
#add_subdirectory( "src/tools/exd_struct_gen" ) add_subdirectory( "src/tools/exd_struct_gen" )
#add_subdirectory( "src/tools/exd_struct_test" ) add_subdirectory( "src/tools/exd_struct_test" )
#add_subdirectory( "src/tools/quest_parser" ) add_subdirectory( "src/tools/quest_parser" )
#add_subdirectory( "src/tools/discovery_parser" ) #add_subdirectory( "src/tools/discovery_parser" )
#add_subdirectory( "src/tools/mob_parse" ) #add_subdirectory( "src/tools/mob_parse" )
#add_subdirectory("src/tools/pcb_reader") #add_subdirectory("src/tools/pcb_reader")

View file

@ -1,75 +1,13 @@
{ {
// See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file. // See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file.
"configurations": [ "configurations": [
{
"name": "x86-Debug",
"generator": "Visual Studio 14 2015",
"configurationType": "Debug",
"buildRoot": "${env.USERPROFILE}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "-DCMAKE_BUILD_TYPE=\"Debug\"",
"buildCommandArgs": "-m -v:minimal",
"variables": [
{
"name": "Boost_COMPILER",
"value": "-vc140"
}
]
},
{
"name": "x86-Release",
"generator": "Visual Studio 14 2015",
"configurationType": "Release",
"buildRoot": "${env.USERPROFILE}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-m -v:minimal",
"variables": [
{
"name": "Boost_COMPILER",
"value": "-vc140"
}
]
},
{
"name": "x64-Debug",
"generator": "Visual Studio 14 2015 Win64",
"configurationType": "Debug",
"buildRoot": "${env.USERPROFILE}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "-DCMAKE_BUILD_TYPE=\"Debug\"",
"buildCommandArgs": "-m -v:minimal",
"variables": [
{
"name": "Boost_COMPILER",
"value": "-vc140"
}
]
},
{
"name": "x64-Release",
"generator": "Visual Studio 14 2015 Win64",
"configurationType": "Release",
"buildRoot": "${env.USERPROFILE}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-m -v:minimal",
"variables": [
{
"name": "Boost_COMPILER",
"value": "-vc140"
}
]
},
{ {
"name": "x86-Debug", "name": "x86-Debug",
"generator": "Visual Studio 15 2017", "generator": "Visual Studio 15 2017",
"configurationType": "Debug", "configurationType": "Debug",
"buildRoot": "${env.USERPROFILE}\\CMakeBuild\\${workspaceHash}\\build\\${name}", "buildRoot": "${env.USERPROFILE}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "-DCMAKE_BUILD_TYPE=\"Debug\"", "cmakeCommandArgs": "-DCMAKE_BUILD_TYPE=\"Debug\"",
"buildCommandArgs": "-m -v:minimal", "buildCommandArgs": "-m -v:minimal"
"variables": [
{
"name": "Boost_COMPILER",
"value": "-vc141"
}
]
}, },
{ {
"name": "x86-Release", "name": "x86-Release",
@ -77,13 +15,7 @@
"configurationType": "Release", "configurationType": "Release",
"buildRoot": "${env.USERPROFILE}\\CMakeBuild\\${workspaceHash}\\build\\${name}", "buildRoot": "${env.USERPROFILE}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "-m -v:minimal", "buildCommandArgs": "-m -v:minimal"
"variables": [
{
"name": "Boost_COMPILER",
"value": "-vc141"
}
]
}, },
{ {
"name": "x64-Debug", "name": "x64-Debug",
@ -91,13 +23,7 @@
"configurationType": "Debug", "configurationType": "Debug",
"buildRoot": "${env.USERPROFILE}\\CMakeBuild\\${workspaceHash}\\build\\${name}", "buildRoot": "${env.USERPROFILE}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "-DCMAKE_BUILD_TYPE=\"Debug\"", "cmakeCommandArgs": "-DCMAKE_BUILD_TYPE=\"Debug\"",
"buildCommandArgs": "-m -v:minimal", "buildCommandArgs": "-m -v:minimal"
"variables": [
{
"name": "Boost_COMPILER",
"value": "-vc141"
}
]
}, },
{ {
"name": "x64-Release", "name": "x64-Release",
@ -105,13 +31,7 @@
"configurationType": "Release", "configurationType": "Release",
"buildRoot": "${env.USERPROFILE}\\CMakeBuild\\${workspaceHash}\\build\\${name}", "buildRoot": "${env.USERPROFILE}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "-m -v:minimal", "buildCommandArgs": "-m -v:minimal"
"variables": [
{
"name": "Boost_COMPILER",
"value": "-vc141"
}
]
} }
] ]
} }

View file

@ -1,8 +1,13 @@
# Sapphire - FINAL FANTASY XIV Server Emulator # Sapphire - FINAL FANTASY XIV Server Emulator
<p align="center">
<img src="https://i.imgur.com/I4bj1tR.png" alt="FFXIV Sapphire"/>
</p>
[![Discord Server](https://img.shields.io/badge/discord-Sapphire-7289DA.svg)](https://discord.gg/xxcdCER) [![Discord Server](https://img.shields.io/badge/discord-Sapphire-7289DA.svg)](https://discord.gg/xxcdCER)
[![Linux Build Status](https://travis-ci.org/SapphireMordred/Sapphire.svg?branch=master)](https://travis-ci.org/SapphireMordred/Sapphire) [![Linux Build Status](https://travis-ci.org/SapphireMordred/Sapphire.svg?branch=master)](https://travis-ci.org/SapphireMordred/Sapphire)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/lil7lxa3ty165emm?svg=true)](https://ci.appveyor.com/project/SapphireMordred/Sapphire) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/lil7lxa3ty165emm?svg=true)](https://ci.appveyor.com/project/SapphireMordred/Sapphire)
![FFXIV Sapphire](http://i.imgur.com/I4bj1tR.png)
Sapphire is a FINAL FANTASY XIV 4.0+ Server Emulator currently in development. Sapphire is a FINAL FANTASY XIV 4.0+ Server Emulator currently in development.
@ -13,8 +18,7 @@ Sapphire requires the following software:
| *Name* | *Windows* | *Linux* | | *Name* | *Windows* | *Linux* |
| ------ | --------- | ------- | | ------ | --------- | ------- |
| CMake 3.0.2+ and C++14 capable compiler | [Visual Studio 2017](https://www.visualstudio.com/) | `gcc 4.9` and `g++ 4.9` or newer | | CMake 3.0.2+ and C++17 capable compiler | [Visual Studio 2017](https://www.visualstudio.com/) | `gcc 7` and `g++ 7` or newer |
| Boost 1.63.0 | [Win32 precompiled binaries](https://sourceforge.net/projects/boost/files/boost-binaries/1.63.0/boost_1_63_0-msvc-14.0-32.exe/download) | Boost libraries from your distribution's package manager |
| MySQL Server 5.7 | [Official Site](https://dev.mysql.com/downloads/mysql/) | MySQL server from your distribution's package manager | | MySQL Server 5.7 | [Official Site](https://dev.mysql.com/downloads/mysql/) | MySQL server from your distribution's package manager |
Please check the [wiki](https://github.com/SapphireMordred/Sapphire/wiki) for detailed installation/build instructions for your OS. Please check the [wiki](https://github.com/SapphireMordred/Sapphire/wiki) for detailed installation/build instructions for your OS.

View file

@ -86,16 +86,16 @@ find_path(MYSQL_INCLUDE_DIR
/usr/local/include /usr/local/include
/usr/local/include/mysql /usr/local/include/mysql
/usr/local/mysql/include /usr/local/mysql/include
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.7/include"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.6/include"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.5/include"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.1/include"
"${PROGRAM_FILES_64}/MySQL/include"
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.7/include" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.7/include"
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.6/include" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.6/include"
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.5/include" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.5/include"
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.1/include" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.1/include"
"${PROGRAM_FILES_32}/MySQL/include" "${PROGRAM_FILES_32}/MySQL/include"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.7/include"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.6/include"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.5/include"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.1/include"
"${PROGRAM_FILES_64}/MySQL/include"
"C:/MySQL/include" "C:/MySQL/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.7;Location]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.7;Location]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.6;Location]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.6;Location]/include"
@ -142,15 +142,6 @@ if( WIN32 )
libmysql libmysql
PATHS PATHS
${MYSQL_ADD_LIBRARIES_PATH} ${MYSQL_ADD_LIBRARIES_PATH}
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.7/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.6/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.5/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.1/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.7/lib/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.6/lib/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.5/lib/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.1/lib/opt"
"${PROGRAM_FILES_64}/MySQL/lib"
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.7/lib" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.7/lib"
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.6/lib" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.6/lib"
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.5/lib" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.5/lib"
@ -160,6 +151,15 @@ if( WIN32 )
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.5/lib/opt" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.5/lib/opt"
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.1/lib/opt" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.1/lib/opt"
"${PROGRAM_FILES_32}/MySQL/lib" "${PROGRAM_FILES_32}/MySQL/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.7/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.6/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.5/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.1/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.7/lib/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.6/lib/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.5/lib/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.1/lib/opt"
"${PROGRAM_FILES_64}/MySQL/lib"
"C:/MySQL/lib/debug" "C:/MySQL/lib/debug"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.7;Location]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.7;Location]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.6;Location]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.6;Location]/lib"
@ -223,15 +223,6 @@ endif( UNIX )
if( WIN32 ) if( WIN32 )
find_program(MYSQL_EXECUTABLE mysql find_program(MYSQL_EXECUTABLE mysql
PATHS PATHS
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.7/bin"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.6/bin"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.5/bin"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.1/bin"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.7/bin/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.6/bin/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.5/bin/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.1/bin/opt"
"${PROGRAM_FILES_64}/MySQL/bin"
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.7/bin" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.7/bin"
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.6/bin" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.6/bin"
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.5/bin" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.5/bin"
@ -241,6 +232,15 @@ if( WIN32 )
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.5/bin/opt" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.5/bin/opt"
"${PROGRAM_FILES_32}/MySQL/MySQL Server 5.1/bin/opt" "${PROGRAM_FILES_32}/MySQL/MySQL Server 5.1/bin/opt"
"${PROGRAM_FILES_32}/MySQL/bin" "${PROGRAM_FILES_32}/MySQL/bin"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.7/bin"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.6/bin"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.5/bin"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.1/bin"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.7/bin/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.6/bin/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.5/bin/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.1/bin/opt"
"${PROGRAM_FILES_64}/MySQL/bin"
"C:/MySQL/bin/debug" "C:/MySQL/bin/debug"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.7;Location]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.7;Location]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.6;Location]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.6;Location]/bin"

View file

@ -17,7 +17,7 @@ else()
# edit and continue # edit and continue
message(STATUS "Enabling Edit and Continue..") message(STATUS "Enabling Edit and Continue..")
add_definitions(/ZI) add_definitions(/Zi)
# incremental linking # incremental linking
message(STATUS "Enabling Incremental Linking..") message(STATUS "Enabling Incremental Linking..")

View file

@ -26,7 +26,7 @@ set_target_properties(exd_common_gen PROPERTIES
if (UNIX) if (UNIX)
target_link_libraries (exd_common_gen common xivdat pthread mysqlclient dl z) target_link_libraries (exd_common_gen common xivdat pthread mysqlclient dl z)
else() else()
target_link_libraries (exd_common_gen common xivdat libmysql zlib1) target_link_libraries (exd_common_gen common xivdat libmysql zlib)
# ignore unchecked iterators warnings from msvc # ignore unchecked iterators warnings from msvc
add_definitions(-D_SCL_SECURE_NO_WARNINGS) add_definitions(-D_SCL_SECURE_NO_WARNINGS)

View file

@ -24,10 +24,8 @@ set_target_properties(exd_struct_gen PROPERTIES
) )
if (UNIX) if (UNIX)
target_link_libraries (exd_struct_gen common xivdat pthread mysqlclient dl z) target_link_libraries (exd_struct_gen common xivdat pthread mysqlclient dl z stdc++fs)
else() else()
target_link_libraries (exd_struct_gen common xivdat libmysql zlib1) target_link_libraries (exd_struct_gen common xivdat mysql zlib)
endif() endif()
target_link_libraries(exd_struct_gen ${Boost_LIBRARIES} ${Boost_LIBRARIES})

View file

@ -9,27 +9,20 @@
#include <iostream> #include <iostream>
#include <cctype> #include <cctype>
#include <set> #include <set>
#include <Exd/ExdData.h> #include <Exd/ExdDataGenerated.h>
#include <Logging/Logger.h> #include <Logging/Logger.h>
#include <boost/range/algorithm/remove_if.hpp>
#include <boost/algorithm/string/classification.hpp> #include <nlohmann/json.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/lexical_cast.hpp>
#include <fstream> #include <fstream>
#include <streambuf> #include <streambuf>
#include <regex> #include <regex>
#include <boost/archive/iterators/ostream_iterator.hpp> #include <algorithm>
Core::Logger g_log; Core::Logger g_log;
Core::Data::ExdData g_exdData; Core::Data::ExdDataGenerated g_exdData;
bool skipUnmapped = true; bool skipUnmapped = true;
std::map< char, std::string > numberToStringMap std::map< char, std::string > numberToStringMap
@ -69,7 +62,7 @@ std::string generateIdListDecl( const std::string& exd )
std::string generateDirectGetters( const std::string& exd ) std::string generateDirectGetters( const std::string& exd )
{ {
return " using " + exd + "Ptr = boost::shared_ptr< " + exd + " >;\n"; return " using " + exd + "Ptr = std::shared_ptr< " + exd + " >;\n";
} }
std::string generateIdListGetter( const std::string& exd ) std::string generateIdListGetter( const std::string& exd )
@ -119,65 +112,38 @@ std::string generateStruct( const std::string& exd )
int count = 0; int count = 0;
using boost::property_tree::ptree; auto json = nlohmann::json();
ptree m_propTree;
boost::property_tree::read_json( "ex.json", m_propTree );
BOOST_FOREACH( boost::property_tree::ptree::value_type& sheet, m_propTree.get_child( "sheets" ) ) std::ifstream exJson( "ex.json" );
{ exJson >> json;
std::string name = sheet.second.get< std::string >( "sheet" );
if( name != exd )
continue;
BOOST_FOREACH( boost::property_tree::ptree::value_type& show, sheet.second.get_child( "definitions" ) ) for( auto& definition : json["sheets"][exd] )
{ {
uint32_t index; uint32_t index;
std::string converterTarget = ""; std::string converterTarget = "";
bool isRepeat = false; bool isRepeat = false;
int num = 0; int num = 0;
try
{
index = show.second.get< uint32_t >( "index" );
}
catch( ... )
{
index = 0;
}
try
{
std::string fieldName = show.second.get< std::string >( "name" );
indexToNameMap[ index ] = fieldName;
}
catch( ... )
{
}
try index = definition["index"].get< uint32_t >();
{ indexToNameMap[ index ] = std::string( definition["name"] );
converterTarget = show.second.get< std::string >( "converter.target" );
if( nameTaken.find( converterTarget ) != nameTaken.end() )
indexToTarget[ index ] = converterTarget;
}
catch( ... )
{
}
try converterTarget = std::string( definition["converter"]["target"] );
{ if( nameTaken.find( converterTarget ) != nameTaken.end() )
show.second.get< std::string >( "type" ); indexToTarget[ index ] = converterTarget;
num = show.second.get< uint8_t >( "count" );
isRepeat = true;
indexIsArrayMap[ index ] = true;
indexCountMap[ index ] = num;
std::string fName = show.second.get< std::string >( "definition.name" );
indexToNameMap[ index ] = fName;
}
catch( ... )
{
}
} if( auto count = definition["count"] )
} {
num = std::stoi( std::string( count ) );
isRepeat = true;
indexIsArrayMap[ index ] = true;
indexCountMap[ index ] = num;
std::string fName = definition["definition"]["name"];
indexToNameMap[ index ] = fName;
}
}
std::string result = "struct " + exd + "\n{\n"; std::string result = "struct " + exd + "\n{\n";
@ -208,8 +174,12 @@ std::string generateStruct( const std::string& exd )
fieldName = indexToNameMap[ count ]; fieldName = indexToNameMap[ count ];
} }
fieldName[ 0 ] = std::tolower( fieldName[ 0 ] ); fieldName[ 0 ] = std::tolower( fieldName[ 0 ] );
fieldName.erase( boost::remove_if( fieldName, boost::is_any_of( ",-':![](){}<>% \x02\x1f\x01\x03" ) ),
fieldName.end() ); std::string badChars = ",-':![](){}<>% \x02\x1f\x01\x03";
std::for_each( badChars.begin(), badChars.end(), [ &fieldName ]( const char c )
{
fieldName.erase( std::remove( fieldName.begin(), fieldName.end(), c ), fieldName.end() );
});
for( auto entry : numberToStringMap ) for( auto entry : numberToStringMap )
{ {
@ -229,7 +199,7 @@ std::string generateStruct( const std::string& exd )
indexToNameMap[ count ] = fieldName; indexToNameMap[ count ] = fieldName;
indexToTypeMap[ count ] = type; indexToTypeMap[ count ] = type;
if( indexToTarget.find( count ) != indexToTarget.end() ) if( indexToTarget.find( count ) != indexToTarget.end() )
result += " boost::shared_ptr< " + indexToTarget[ count ] + "> " + fieldName + ";\n"; result += " std::shared_ptr< " + indexToTarget[ count ] + "> " + fieldName + ";\n";
else else
{ {
if( indexIsArrayMap.find( count ) != indexIsArrayMap.end() ) if( indexIsArrayMap.find( count ) != indexIsArrayMap.end() )
@ -272,7 +242,7 @@ std::string generateConstructorsDecl( const std::string& exd )
continue; continue;
} }
if( indexToTarget.find( count ) != indexToTarget.end() ) if( indexToTarget.find( count ) != indexToTarget.end() )
result += indent + indexToNameMap[ count ] + " = boost::make_shared< " + indexToTarget[ count ] + result += indent + indexToNameMap[ count ] + " = std::make_shared< " + indexToTarget[ count ] +
">( exdData->getField< " + ">( exdData->getField< " +
indexToTypeMap[ count ] + " >( row, " + std::to_string( count ) + " ), exdData );\n"; indexToTypeMap[ count ] + " >( row, " + std::to_string( count ) + " ), exdData );\n";
else else
@ -337,9 +307,10 @@ int main( int argc, char** argv )
std::istreambuf_iterator< char >() ); std::istreambuf_iterator< char >() );
using boost::property_tree::ptree; std::ifstream exJson( "ex.json" );
ptree m_propTree;
boost::property_tree::read_json( "ex.json", m_propTree ); auto json = nlohmann::json();
exJson >> json;
g_log.info( "Setting up EXD data" ); g_log.info( "Setting up EXD data" );
if( !g_exdData.init( datLocation ) ) if( !g_exdData.init( datLocation ) )
@ -366,27 +337,27 @@ int main( int argc, char** argv )
//nameTaken[name] = "1"; //nameTaken[name] = "1";
//} //}
BOOST_FOREACH( boost::property_tree::ptree::value_type& sheet, m_propTree.get_child( "sheets" ) ) for( auto& sheet : json["sheets"] )
{ {
std::string name = sheet.second.get< std::string >( "sheet" ); std::string name = json["sheet"];
forwards += "struct " + name + ";\n"; forwards += "struct " + name + ";\n";
structDefs += generateStruct( name ); structDefs += generateStruct( name );
dataDecl += generateDatAccessDecl( name ); dataDecl += generateDatAccessDecl( name );
idListsDecl += generateIdListDecl( name ); idListsDecl += generateIdListDecl( name );
getterDecl += generateDirectGetters( name ); getterDecl += generateDirectGetters( name );
datAccCall += generateSetDatAccessCall( name ); datAccCall += generateSetDatAccessCall( name );
constructorDecl += generateConstructorsDecl( name ); constructorDecl += generateConstructorsDecl( name );
idListGetters += generateIdListGetter( name ); idListGetters += generateIdListGetter( name );
} }
getterDecl += getterDecl +=
"\n template< class T >\n" "\n template< class T >\n"
" boost::shared_ptr< T > get( uint32_t id )\n" " std::shared_ptr< T > get( uint32_t id )\n"
" {\n" " {\n"
" try\n" " try\n"
" {\n" " {\n"
" auto info = boost::make_shared< T >( id, this );\n" " auto info = std::make_shared< T >( id, this );\n"
" return info;\n" " return info;\n"
" }\n" " }\n"
" catch( ... )\n" " catch( ... )\n"

View file

@ -24,6 +24,6 @@ set_target_properties(exd_struct_test PROPERTIES
if (UNIX) if (UNIX)
target_link_libraries (exd_struct_test common xivdat pthread mysqlclient dl z stdc++fs ) target_link_libraries (exd_struct_test common xivdat pthread mysqlclient dl z stdc++fs )
else() else()
target_link_libraries (exd_struct_test common xivdat libmysql zlib1) target_link_libraries (exd_struct_test common xivdat mysql zlib)
endif() endif()

View file

@ -30,10 +30,8 @@ set_target_properties(quest_parse PROPERTIES
) )
if (UNIX) if (UNIX)
target_link_libraries (quest_parse common xivdat pthread mysqlclient dl z) target_link_libraries (quest_parse common xivdat pthread mysqlclient dl z stdc++fs)
else() else()
target_link_libraries (quest_parse common xivdat libmysql zlib1) target_link_libraries (quest_parse common xivdat mysql zlib)
endif() endif()
target_link_libraries(quest_parse ${Boost_LIBRARIES} ${Boost_LIBRARIES})

View file

@ -4,8 +4,8 @@
#include <locale> #include <locale>
#include <set> #include <set>
#include <string> #include <string>
#include <cstring>
#include <boost/algorithm/string.hpp>
#include <experimental/filesystem> #include <experimental/filesystem>
#include <Exd.h> #include <Exd.h>
@ -15,10 +15,11 @@
#include <GameData.h> #include <GameData.h>
#include <DatCat.h> #include <DatCat.h>
#include <Exd/ExdData.h>
#include <Exd/ExdDataGenerated.h> #include <Exd/ExdDataGenerated.h>
#include <Logging/Logger.h> #include <Logging/Logger.h>
#include <algorithm>
Core::Logger g_log; Core::Logger g_log;
Core::Data::ExdDataGenerated g_exdDataGen; Core::Data::ExdDataGenerated g_exdDataGen;
@ -62,7 +63,7 @@ std::string titleCase( const std::string& str )
} }
void void
createScript( boost::shared_ptr< Core::Data::Quest >& pQuestData, std::set< std::string >& additionalList, int questId ) createScript( std::shared_ptr< Core::Data::Quest >& pQuestData, std::set< std::string >& additionalList, int questId )
{ {
std::string header( std::string header(
"// This is an automatically generated C++ script template\n" "// This is an automatically generated C++ script template\n"
@ -125,7 +126,10 @@ createScript( boost::shared_ptr< Core::Data::Quest >& pQuestData, std::set< std:
else else
{ {
std::string seqName = titleCase( entry ); std::string seqName = titleCase( entry );
boost::replace_all( seqName, "_", "" );
seqName.erase( std::remove_if( seqName.begin(), seqName.end(), []( const char c ) {
return c == '_';
}), seqName.end());
std::string seqId = entry.substr( 4 ); std::string seqId = entry.substr( 4 );
seqStr += " " + seqName + " = " + seqId + ",\n"; seqStr += " " + seqName + " = " + seqId + ",\n";
@ -252,7 +256,11 @@ createScript( boost::shared_ptr< Core::Data::Quest >& pQuestData, std::set< std:
for( auto& entity : script_entities ) for( auto& entity : script_entities )
{ {
auto name = titleCase( entity ); auto name = titleCase( entity );
boost::replace_all( name, "_", "" );
name.erase( std::remove_if( name.begin(), name.end(), []( const char c ) {
return c == '_';
}), name.end());
sentities += " static constexpr auto " + name + ";\n"; sentities += " static constexpr auto " + name + ";\n";
} }