mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 22:57:45 +00:00
Variant2 exds are now readable
This commit is contained in:
parent
4c573cde73
commit
28abe4c6f9
4 changed files with 56 additions and 20 deletions
33
deps/datReader/Exd.cpp
vendored
33
deps/datReader/Exd.cpp
vendored
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "bparse.h"
|
#include "bparse.h"
|
||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
|
#include <fstream>
|
||||||
#include "Exh.h"
|
#include "Exh.h"
|
||||||
|
|
||||||
using xiv::utils::bparse::extract;
|
using xiv::utils::bparse::extract;
|
||||||
|
@ -58,7 +58,7 @@ namespace xiv
|
||||||
for ( auto &file_ptr : _files )
|
for ( auto &file_ptr : _files )
|
||||||
{
|
{
|
||||||
// Get a stream
|
// Get a stream
|
||||||
std::vector< char > dataCpy = file_ptr->get_data_sections().front();
|
std::vector< char > dataCpy = file_ptr->get_data_sections().front();
|
||||||
std::istringstream iss( std::string( dataCpy.begin(), dataCpy.end() ) );
|
std::istringstream iss( std::string( dataCpy.begin(), dataCpy.end() ) );
|
||||||
|
|
||||||
// Extract the header and skip to the record indices
|
// Extract the header and skip to the record indices
|
||||||
|
@ -101,12 +101,17 @@ namespace xiv
|
||||||
iss.seekg( cacheEntryIt->second.offset + 6 );
|
iss.seekg( cacheEntryIt->second.offset + 6 );
|
||||||
|
|
||||||
uint8_t subRows = *reinterpret_cast< uint8_t* >( &dataCpy[ cacheEntryIt->second.offset + 5 ] );
|
uint8_t subRows = *reinterpret_cast< uint8_t* >( &dataCpy[ cacheEntryIt->second.offset + 5 ] );
|
||||||
|
|
||||||
|
if( subRow >= subRows )
|
||||||
|
throw std::runtime_error( "Out of bounds sub-row!" );
|
||||||
|
|
||||||
|
int offset = cacheEntryIt->second.offset + 6 + ( subRow * _exh->get_header().data_offset + 2 * ( subRow + 1 ) );
|
||||||
|
|
||||||
for( auto& member_entry : _exh->get_exh_members() )
|
for( auto& member_entry : _exh->get_exh_members() )
|
||||||
{
|
{
|
||||||
// Seek to the position of the member to extract.
|
// Seek to the position of the member to extract.
|
||||||
// 6 is because we have uint32_t/uint16_t at the start of each record
|
// 6 is because we have uint32_t/uint16_t at the start of each record
|
||||||
iss.seekg( cacheEntryIt->second.offset + 6 + member_entry.offset );
|
iss.seekg( offset + member_entry.offset );
|
||||||
|
|
||||||
// Switch depending on the type to extract
|
// Switch depending on the type to extract
|
||||||
switch( member_entry.type )
|
switch( member_entry.type )
|
||||||
|
@ -115,9 +120,10 @@ namespace xiv
|
||||||
// Extract the offset to the actual string
|
// Extract the offset to the actual string
|
||||||
// Seek to it then extract the actual string
|
// Seek to it then extract the actual string
|
||||||
{
|
{
|
||||||
auto string_offset = extract<uint32_t>( iss, "string_offset", false );
|
throw std::runtime_error( "String not implemented for variant 2!" );
|
||||||
iss.seekg( cacheEntryIt->second.offset + 6 + _exh->get_header().data_offset + string_offset );
|
//auto string_offset = extract<uint32_t>( iss, "string_offset", false );
|
||||||
fields.emplace_back( utils::bparse::extract_cstring( iss, "string" ) );
|
//iss.seekg( cacheEntryIt->second.offset + 6 + _exh->get_header().data_offset + string_offset );
|
||||||
|
//fields.emplace_back( utils::bparse::extract_cstring( iss, "string" ) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -129,9 +135,18 @@ namespace xiv
|
||||||
fields.emplace_back( extract<int8_t>( iss, "int8_t" ) );
|
fields.emplace_back( extract<int8_t>( iss, "int8_t" ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DataType::uint8:
|
||||||
|
fields.emplace_back( extract<uint8_t>( iss, "uint8_t" ) );
|
||||||
|
break;
|
||||||
|
|
||||||
case DataType::int16:
|
case DataType::int16:
|
||||||
fields.emplace_back( extract<int16_t>( iss, "int16_t", false ) );
|
fields.emplace_back( extract<int16_t>( iss, "int16_t", false ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DataType::uint16:
|
||||||
|
fields.emplace_back( extract<uint16_t>( iss, "uint16_t", false ) );
|
||||||
|
break;
|
||||||
|
|
||||||
case DataType::int32:
|
case DataType::int32:
|
||||||
fields.emplace_back( extract<int32_t>( iss, "int32_t", false ) );
|
fields.emplace_back( extract<int32_t>( iss, "int32_t", false ) );
|
||||||
break;
|
break;
|
||||||
|
@ -184,7 +199,7 @@ namespace xiv
|
||||||
fields.reserve( member_count );
|
fields.reserve( member_count );
|
||||||
iss.seekg( cacheEntryIt->second.offset + 6 );
|
iss.seekg( cacheEntryIt->second.offset + 6 );
|
||||||
|
|
||||||
uint8_t subRows = *reinterpret_cast< uint8_t* >( &dataCpy[ cacheEntryIt->second.offset + 5 ] );
|
uint8_t subRows = *reinterpret_cast< uint8_t* >( &dataCpy[ cacheEntryIt->second.offset + 5 ] );
|
||||||
|
|
||||||
for( auto& member_entry : _exh->get_exh_members() )
|
for( auto& member_entry : _exh->get_exh_members() )
|
||||||
{
|
{
|
||||||
|
|
6
deps/datReader/Exh.h
vendored
6
deps/datReader/Exh.h
vendored
|
@ -31,9 +31,9 @@ namespace xiv
|
||||||
uint16_t field_count;
|
uint16_t field_count;
|
||||||
uint16_t exd_count;
|
uint16_t exd_count;
|
||||||
uint16_t language_count;
|
uint16_t language_count;
|
||||||
uint16_t unknown1;
|
uint16_t unknown1;
|
||||||
uint8_t u2;
|
uint8_t u2;
|
||||||
uint8_t variant;
|
uint8_t variant;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ExhMember
|
struct ExhMember
|
||||||
|
|
|
@ -6117,6 +6117,22 @@ struct ZoneSharedGroup
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template< class T >
|
||||||
|
std::shared_ptr< T > get( uint32_t id, uint32_t slotId )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
auto info = std::make_shared< T >( id, slotId, this );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
catch( std::runtime_error error )
|
||||||
|
{
|
||||||
|
std::cout << error.what();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::set< uint32_t > m_AchievementIdList;
|
std::set< uint32_t > m_AchievementIdList;
|
||||||
std::set< uint32_t > m_AchievementCategoryIdList;
|
std::set< uint32_t > m_AchievementCategoryIdList;
|
||||||
|
|
|
@ -21,8 +21,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" );
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
@ -38,15 +38,20 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
g_log.info( "getting id list " );
|
//g_log.info( "getting id list " );
|
||||||
auto idList = g_exdData.getTerritoryTypeIdList();
|
//auto idList = g_exdData.getGilShopIdList();
|
||||||
|
|
||||||
g_log.info( "getting id list done" );
|
//g_log.info( "getting id list done" );
|
||||||
for( auto id : idList )
|
//for( auto id : idList )
|
||||||
{
|
{
|
||||||
auto teri1 = g_exdData.get< Core::Data::TerritoryType >( id );
|
auto teri1 = g_exdData.get< Core::Data::GilShopItem >( 262440, 0 );
|
||||||
|
g_log.info( "0 -> " + std::to_string( teri1->item ) );
|
||||||
|
|
||||||
g_log.info( teri1->name );
|
auto teri2 = g_exdData.get< Core::Data::GilShopItem >( 262440, 1 );
|
||||||
|
g_log.info( "1 -> " + std::to_string( teri2->item ) );
|
||||||
|
|
||||||
|
auto teri3 = g_exdData.get< Core::Data::GilShopItem >( 262440, 2 );
|
||||||
|
g_log.info( "2 -> " + std::to_string( teri3->item ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue