1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-02 16:57:47 +00:00

bit of cleanup and sqpack fix

This commit is contained in:
NotAdam 2020-02-02 17:14:59 +11:00
parent 5b843c66dd
commit 39aa49f092

View file

@ -1,11 +1,19 @@
#include "SqPack.h" #include "SqPack.h"
namespace xiv { namespace xiv::dat {
namespace dat { enum PlatformId :
uint8_t
{
Win32,
PS3,
PS4
};
struct SqPackHeader struct SqPackHeader
{ {
char magic[0x8]; char magic[0x8];
uint32_t zero; PlatformId platformId;
uint8_t padding0[3];
uint32_t size; uint32_t size;
uint32_t version; uint32_t version;
uint32_t type; uint32_t type;
@ -17,10 +25,9 @@ namespace dat {
uint32_t type; uint32_t type;
}; };
} }
}
namespace xiv { namespace xiv::utils:: bparse
namespace utils { {
namespace bparse {
template<> template<>
inline void reorder< xiv::dat::SqPackHeader >( xiv::dat::SqPackHeader& i_struct ) inline void reorder< xiv::dat::SqPackHeader >( xiv::dat::SqPackHeader& i_struct )
{ {
@ -28,7 +35,7 @@ namespace bparse {
{ {
xiv::utils::bparse::reorder( i_struct.magic[ i ] ); xiv::utils::bparse::reorder( i_struct.magic[ i ] );
} }
xiv::utils::bparse::reorder(i_struct.zero); xiv::utils::bparse::reorder( i_struct.platformId );
xiv::utils::bparse::reorder( i_struct.size ); xiv::utils::bparse::reorder( i_struct.size );
xiv::utils::bparse::reorder( i_struct.version ); xiv::utils::bparse::reorder( i_struct.version );
xiv::utils::bparse::reorder( i_struct.type ); xiv::utils::bparse::reorder( i_struct.type );
@ -41,18 +48,14 @@ namespace bparse {
xiv::utils::bparse::reorder( i_struct.type ); xiv::utils::bparse::reorder( i_struct.type );
} }
} }
}
};
using xiv::utils::bparse::extract; using xiv::utils::bparse::extract;
namespace xiv namespace xiv::dat
{
namespace dat
{ {
SqPack::SqPack( const std::experimental::filesystem::path& path ) :
// Open the file // Open the file
SqPack::SqPack( const std::experimental::filesystem::path& path ) :
m_handle( path.string(), std::ios_base::in | std::ios_base::binary ) m_handle( path.string(), std::ios_base::in | std::ios_base::binary )
{ {
// Extract the header // Extract the header
@ -73,4 +76,3 @@ namespace dat
} }
} }
}