Athena IO Library
athena::io::WiiSaveReader Class Reference

Wii data.bin reader class. More...

#include <WiiSaveReader.hpp>

Inheritance diagram for athena::io::WiiSaveReader:
Inheritance graph
Collaboration diagram for athena::io::WiiSaveReader:
Collaboration graph

Public Member Functions

 WiiSaveReader (const atUint8 *, atUint64)
 This constructor takes an existing buffer to read from. More...
 
 WiiSaveReader (const std::string &)
 This constructor creates an instance from a file on disk. More...
 
std::unique_ptr< WiiSavereadSave ()
 readSave More...
 

Additional Inherited Members

- Protected Member Functions inherited from athena::io::MemoryCopyReader
void loadData ()
 
 MemoryCopyReader (const void *data, atUint64 length)
 This constructor copies an existing buffer to read from. More...
 
 MemoryCopyReader (const std::string &filename)
 This constructor creates an instance from a file on disk. More...
 
void setData (const atUint8 *data, atUint64 length)
 
 MemoryReader (const void *data, atUint64 length, bool takeOwnership=false, bool globalErr=true)
 This constructor references an existing buffer to read from. More...
 
void seek (atInt64 pos, SeekOrigin origin=SeekOrigin::Current)
 Sets the buffers position relative to the specified position.
It seeks relative to the current position by default. More...
 
atUint64 position () const
 Returns the current position in the stream. More...
 
atUint64 length () const
 Returns whether or not the stream is at the end. More...
 
void setData (const atUint8 *data, atUint64 length, bool takeOwnership=false)
 Sets the buffer to the given one, deleting the current one.
BEWARE: As this deletes the current buffer it WILL cause a loss of data if that was not the intent.
Once you pass the data to setData DO NOT delete the buffer as Stream now owns the address, this is done to keep memory usage down. More...
 
atUint8 * data () const
 Returns a copy of the current buffer.
Changes to the copy do not affect the buffer so it's perfectly safe to directly edit the buffer and use setData to set the new information.
However once you pass the data to setData DO NOT delete the buffer as Stream now owns the address, this is done to keep memory usage down. More...
 
atUint64 readUBytesToBuf (void *buf, atUint64 len)
 Reads a specified number of bytes to user-allocated buffer. More...
 
- Protected Member Functions inherited from athena::io::IStreamReader
void seekAlign64 ()
 Sets the buffer's position relative to the next 64-byte aligned position.

 
void seekAlign32 ()
 Sets the buffers position relative to the next 32-byte aligned position.

 
void seekAlign16 ()
 Sets the buffer's position relative to the next 16-byte aligned position.

 
bool atEnd () const
 Returns whether or not the stream is at the end. More...
 
atInt8 readByte ()
 Reads a byte at the current position and advances the current position. More...
 
template<class T >
atInt8 readVal (typename std::enable_if< std::is_same< T, atInt8 >::value >::type *=0)
 
template<class T >
atInt8 readValLittle (typename std::enable_if< std::is_same< T, atInt8 >::value >::type *=0)
 
template<class T >
atInt8 readValBig (typename std::enable_if< std::is_same< T, atInt8 >::value >::type *=0)
 
atUint8 readUByte ()
 Reads a byte at the current position and advances the current position. More...
 
template<class T >
atUint8 readVal (typename std::enable_if< std::is_same< T, atUint8 >::value >::type *=0)
 
template<class T >
atUint8 readValLittle (typename std::enable_if< std::is_same< T, atUint8 >::value >::type *=0)
 
template<class T >
atUint8 readValBig (typename std::enable_if< std::is_same< T, atUint8 >::value >::type *=0)
 
std::unique_ptr< atInt8[]> readBytes (atUint64 length)
 Reads a byte at the current position and advances the current position. More...
 
std::unique_ptr< atUint8[]> readUBytes (atUint64 length)
 Reads a byte at the current position and advances the current position. More...
 
atUint64 readBytesToBuf (void *buf, atUint64 len)
 Attempts to read a fixed length of data into a pre-allocated buffer. More...
 
atInt16 readInt16 ()
 Reads a Int16 and swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
atInt16 readVal (typename std::enable_if< std::is_same< T, atInt16 >::value >::type *=0)
 
atInt16 readInt16Little ()
 Reads a Int16 and swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
atInt16 readValLittle (typename std::enable_if< std::is_same< T, atInt16 >::value >::type *=0)
 
atInt16 readInt16Big ()
 Reads a Int16 and swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
atInt16 readValBig (typename std::enable_if< std::is_same< T, atInt16 >::value >::type *=0)
 
atUint16 readUint16 ()
 Reads a Uint16 and swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
atUint16 readVal (typename std::enable_if< std::is_same< T, atUint16 >::value >::type *=0)
 
atUint16 readUint16Little ()
 Reads a Uint16 and swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
atUint16 readValLittle (typename std::enable_if< std::is_same< T, atUint16 >::value >::type *=0)
 
atUint16 readUint16Big ()
 Reads a Uint16 and swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
atUint16 readValBig (typename std::enable_if< std::is_same< T, atUint16 >::value >::type *=0)
 
atInt32 readInt32 ()
 Reads a Int32 and swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
atInt32 readVal (typename std::enable_if< std::is_same< T, atInt32 >::value >::type *=0)
 
atInt32 readInt32Little ()
 Reads a Int32 and swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
atInt32 readValLittle (typename std::enable_if< std::is_same< T, atInt32 >::value >::type *=0)
 
atInt32 readInt32Big ()
 Reads a Int32 and swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
atInt32 readValBig (typename std::enable_if< std::is_same< T, atInt32 >::value >::type *=0)
 
atUint32 readUint32 ()
 Reads a Uint32 and swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
atUint32 readVal (typename std::enable_if< std::is_same< T, atUint32 >::value >::type *=0)
 
atUint32 readUint32Little ()
 Reads a Uint32 and swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
atInt32 readValLittle (typename std::enable_if< std::is_same< T, atUint32 >::value >::type *=0)
 
atUint32 readUint32Big ()
 Reads a Uint32 and swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
atUint32 readValBig (typename std::enable_if< std::is_same< T, atUint32 >::value >::type *=0)
 
atInt64 readInt64 ()
 Reads a Int64 and swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
atInt64 readVal (typename std::enable_if< std::is_same< T, atInt64 >::value >::type *=0)
 
atInt64 readInt64Little ()
 Reads a Int64 and swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
atInt64 readValLittle (typename std::enable_if< std::is_same< T, atInt64 >::value >::type *=0)
 
atInt64 readInt64Big ()
 Reads a Int64 and swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
atInt64 readValBig (typename std::enable_if< std::is_same< T, atInt64 >::value >::type *=0)
 
atUint64 readUint64 ()
 Reads a Uint64 and swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
atUint64 readVal (typename std::enable_if< std::is_same< T, atUint64 >::value >::type *=0)
 
atUint64 readUint64Little ()
 Reads a Uint64 and swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
atUint64 readValLittle (typename std::enable_if< std::is_same< T, atUint64 >::value >::type *=0)
 
atUint64 readUint64Big ()
 Reads a Uint64 and swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
atUint64 readValBig (typename std::enable_if< std::is_same< T, atUint64 >::value >::type *=0)
 
float readFloat ()
 Reads a float and swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
float readVal (typename std::enable_if< std::is_same< T, float >::value >::type *=0)
 
float readFloatLittle ()
 Reads a float and swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
float readValLittle (typename std::enable_if< std::is_same< T, float >::value >::type *=0)
 
float readFloatBig ()
 Reads a float and swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
float readValBig (typename std::enable_if< std::is_same< T, float >::value >::type *=0)
 
double readDouble ()
 Reads a double and swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
double readVal (typename std::enable_if< std::is_same< T, double >::value >::type *=0)
 
double readDoubleLittle ()
 Reads a double and swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
double readValLittle (typename std::enable_if< std::is_same< T, double >::value >::type *=0)
 
double readDoubleBig ()
 Reads a double and swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
double readValBig (typename std::enable_if< std::is_same< T, double >::value >::type *=0)
 
bool readBool ()
 Reads a bool and advances the current position. More...
 
template<class T >
bool readVal (typename std::enable_if< std::is_same< T, bool >::value >::type *=0)
 
template<class T >
bool readValLittle (typename std::enable_if< std::is_same< T, bool >::value >::type *=0)
 
template<class T >
bool readValBig (typename std::enable_if< std::is_same< T, bool >::value >::type *=0)
 
atVec2f readVec2f ()
 Reads an atVec2f (8 bytes), swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
atVec2f readVal (typename std::enable_if< std::is_same< T, atVec2f >::value >::type *=0)
 
atVec2f readVec2fLittle ()
 Reads an atVec2f (8 bytes), swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
atVec2f readValLittle (typename std::enable_if< std::is_same< T, atVec2f >::value >::type *=0)
 
atVec2f readVec2fBig ()
 Reads an atVec2f (8 bytes), swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
atVec2f readValBig (typename std::enable_if< std::is_same< T, atVec2f >::value >::type *=0)
 
atVec3f readVec3f ()
 Reads an atVec3f (12 bytes), swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
atVec3f readVal (typename std::enable_if< std::is_same< T, atVec3f >::value >::type *=0)
 
atVec3f readVec3fLittle ()
 Reads an atVec3f (12 bytes), swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
atVec3f readValLittle (typename std::enable_if< std::is_same< T, atVec3f >::value >::type *=0)
 
atVec3f readVec3fBig ()
 Reads an atVec3f (12 bytes), swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
atVec3f readValBig (typename std::enable_if< std::is_same< T, atVec3f >::value >::type *=0)
 
atVec4f readVec4f ()
 Reads an atVec4f (16 bytes), swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
atVec4f readVal (typename std::enable_if< std::is_same< T, atVec4f >::value >::type *=0)
 
atVec4f readVec4fLittle ()
 Reads an atVec4f (16 bytes), swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
atVec4f readValLittle (typename std::enable_if< std::is_same< T, atVec4f >::value >::type *=0)
 
atVec4f readVec4fBig ()
 Reads an atVec4f (16 bytes), swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
atVec4f readValBig (typename std::enable_if< std::is_same< T, atVec4f >::value >::type *=0)
 
atVec2d readVec2d ()
 Reads an atVec2d (16 bytes), swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
atVec2d readVal (typename std::enable_if< std::is_same< T, atVec2d >::value >::type *=0)
 
atVec2d readVec2dLittle ()
 Reads an atVec2d (16 bytes), swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
atVec2d readValLittle (typename std::enable_if< std::is_same< T, atVec2d >::value >::type *=0)
 
atVec2d readVec2dBig ()
 Reads an atVec2d (16 bytes), swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
atVec2d readValBig (typename std::enable_if< std::is_same< T, atVec2d >::value >::type *=0)
 
atVec3d readVec3d ()
 Reads an atVec3d (24 bytes), swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
atVec3d readVal (typename std::enable_if< std::is_same< T, atVec3d >::value >::type *=0)
 
atVec3d readVec3dLittle ()
 Reads an atVec3d (24 bytes), swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
atVec3d readValLittle (typename std::enable_if< std::is_same< T, atVec3d >::value >::type *=0)
 
atVec3d readVec3dBig ()
 Reads an atVec3d (24 bytes), swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
atVec3d readValBig (typename std::enable_if< std::is_same< T, atVec3d >::value >::type *=0)
 
atVec4d readVec4d ()
 Reads an atVec4d (32 bytes), swaps to endianness specified by setEndian depending on platform and advances the current position. More...
 
template<class T >
atVec4d readVal (typename std::enable_if< std::is_same< T, atVec4d >::value >::type *=0)
 
atVec4d readVec4dLittle ()
 Reads an atVec4d (32 bytes), swaps against little endianness depending on platform and advances the current position. More...
 
template<class T >
atVec4d readValLittle (typename std::enable_if< std::is_same< T, atVec4d >::value >::type *=0)
 
atVec4d readVec4dBig ()
 Reads an atVec4d (32 bytes), swaps against big endianness depending on platform and advances the current position. More...
 
template<class T >
atVec4d readValBig (typename std::enable_if< std::is_same< T, atVec4d >::value >::type *=0)
 
std::string readWStringAsString (atInt32 fixedLen=-1)
 Reads a wide-char string (using endianness from setEndian), converts to UTF8 and advances the position in the file. More...
 
std::string readWStringAsStringLittle (atInt32 fixedLen=-1)
 Reads a wide-char string (against little-endian), converts to UTF8 and advances the position in the file. More...
 
std::string readWStringAsStringBig (atInt32 fixedLen=-1)
 Reads a wide-char string (against big-endian), converts to UTF8 and advances the position in the file. More...
 
std::string readString (atInt32 fixedLen=-1)
 Reads a string and advances the position in the file. More...
 
template<class T >
std::string readVal (typename std::enable_if< std::is_same< T, std::string >::value >::type *=0)
 
std::wstring readWString (atInt32 fixedLen=-1)
 Reads a wstring and advances the position in the file. More...
 
template<class T >
std::wstring readVal (typename std::enable_if< std::is_same< T, std::wstring >::value >::type *=0)
 
std::wstring readWStringLittle (atInt32 fixedLen=-1)
 Reads a wstring assuming little-endian characters and advances the position in the file. More...
 
template<class T >
std::wstring readValLittle (typename std::enable_if< std::is_same< T, std::wstring >::value >::type *=0)
 
std::wstring readWStringBig (atInt32 fixedLen=-1)
 Reads a wstring assuming big-endian characters and advances the position in the file. More...
 
template<class T >
std::wstring readValBig (typename std::enable_if< std::is_same< T, std::wstring >::value >::type *=0)
 
template<class T >
void enumerate (std::vector< T > &vector, size_t count, typename std::enable_if< std::is_arithmetic< T >::value||std::is_same< T, atVec2f >::value||std::is_same< T, atVec3f >::value||std::is_same< T, atVec4f >::value >::type *=0)
 Performs automatic std::vector enumeration reads using numeric type T. More...
 
template<class T >
void enumerateLittle (std::vector< T > &vector, size_t count, typename std::enable_if< std::is_arithmetic< T >::value||std::is_same< T, atVec2f >::value||std::is_same< T, atVec3f >::value||std::is_same< T, atVec4f >::value >::type *=0)
 Performs automatic std::vector enumeration reads using numeric type T. More...
 
template<class T >
void enumerateBig (std::vector< T > &vector, size_t count, typename std::enable_if< std::is_arithmetic< T >::value||std::is_same< T, atVec2f >::value||std::is_same< T, atVec3f >::value||std::is_same< T, atVec4f >::value >::type *=0)
 Performs automatic std::vector enumeration reads using numeric type T. More...
 
template<class T >
void enumerate (std::vector< T > &vector, size_t count, typename std::enable_if<!std::is_arithmetic< T >::value &&!std::is_same< T, atVec2f >::value &&!std::is_same< T, atVec3f >::value &&!std::is_same< T, atVec4f >::value >::type *=0)
 Performs automatic std::vector enumeration reads using non-numeric type T. More...
 
template<class T >
void enumerate (std::vector< T > &vector, size_t count, std::function< void(IStreamReader &, T &)> readf)
 Performs lambda-assisted std::vector enumeration reads using type T. More...
 
- Protected Member Functions inherited from athena::io::IStream
void setError ()
 
void setEndian (Endian endian)
 
Endian endian () const
 
bool isBigEndian () const
 
bool isLittleEndian () const
 
bool hasError () const
 
- Protected Attributes inherited from athena::io::MemoryCopyReader
std::unique_ptr< atUint8[]> m_dataCopy
 
std::string m_filepath
 Path to the target file.
 
- Protected Attributes inherited from athena::io::MemoryReader
const void * m_data = nullptr
 
atUint64 m_length = 0
 
atUint64 m_position = 0
 
bool m_owns = false
 
bool m_globalErr = true
 
- Protected Attributes inherited from athena::io::IStream
bool m_hasError = false
 
Endian m_endian = BigEndian
 

Detailed Description

Wii data.bin reader class.

A Class for reading binary data from a wii data.bin file, all work is done using a memory buffer, and not read directly from the disk.

See also
BinaryReader

Definition at line 24 of file WiiSaveReader.hpp.

Constructor & Destructor Documentation

athena::io::WiiSaveReader::WiiSaveReader ( const atUint8 *  ,
atUint64   
)

This constructor takes an existing buffer to read from.

Parameters
dataThe existing buffer
lengthThe length of the existing buffer
athena::io::WiiSaveReader::WiiSaveReader ( const std::string &  )

This constructor creates an instance from a file on disk.

Parameters
filenameThe file to create the stream from

Member Function Documentation

std::unique_ptr<WiiSave> athena::io::WiiSaveReader::readSave ( )

readSave

Returns

The documentation for this class was generated from the following file: