diff --git a/CMakeLists.txt b/CMakeLists.txt index 972275c8..57f6f366 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,5 +62,6 @@ add_subdirectory("src/libraries/sapphire/datReader") add_subdirectory("src/libraries/sapphire/mysqlConnector") add_subdirectory("src/tools/exd_common_gen") +add_subdirectory("src/tools/exd_struct_gen") add_subdirectory("src/tools/quest_parser") diff --git a/src/tools/exd_struct_gen/CMakeLists.txt b/src/tools/exd_struct_gen/CMakeLists.txt new file mode 100644 index 00000000..db111ae5 --- /dev/null +++ b/src/tools/exd_struct_gen/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 2.6) +cmake_policy(SET CMP0015 NEW) +project(Tool_ExdStructGen) + +set(SAPPHIRE_BOOST_VER 1.63.0) +set(SAPPHIRE_BOOST_FOLDER_NAME boost_1_63_0) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../bin/") + + +file(GLOB SERVER_PUBLIC_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*") +file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*") + +#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../bin/") +add_executable(exd_struct_gen ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES}) + +set_target_properties(exd_struct_gen PROPERTIES + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS ON + RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/" + RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../bin/" + RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../bin/" + RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../bin/" +) + +if (UNIX) + target_link_libraries (exd_struct_gen Common xivdat pthread mysqlclient dl z) +else() + target_link_libraries (exd_struct_gen Common xivdat libmysql zlib1) +endif() + +target_link_libraries(exd_struct_gen ${Boost_LIBRARIES} ${Boost_LIBRARIES}) + diff --git a/src/tools/exd_struct_gen/main.cpp b/src/tools/exd_struct_gen/main.cpp new file mode 100644 index 00000000..83316d74 --- /dev/null +++ b/src/tools/exd_struct_gen/main.cpp @@ -0,0 +1,63 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +Core::Logger g_log; +Core::Data::ExdData 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" ); + +std::string generateEnum( const std::string& exd ) +{ + + auto& cat = g_exdData.m_exd_data->get_category( exd ); + auto exh = cat.get_header(); + auto exhMem = exh.get_exh_members(); + + for( auto member : exhMem ) + { + g_log.info( std::to_string( static_cast< uint8_t >( member.type ) ) + "\n" ); + } + + return ""; +} + +int main() +{ + + g_log.init(); + + + g_log.info( "Setting up EXD data" ); + if( !g_exdData.init( datLocation ) ) + { + g_log.fatal( "Error setting up EXD data " ); + return 0; + } + + std::string result = + "/* This file has been automatically generated.\n Changes will be lost upon regeneration.\n To change the content edit tools/exd_struct_gen */\n"; + + result += generateEnum( "Quest" ); + g_log.info( result ); + return 0; +}