Athena IO Library
|
The Minish Cap Save save data writer class. More...
#include <MCFileWriter.hpp>
Public Member Functions | |
MCFileWriter (atUint8 *, atUint64) | |
This constructor takes an existing buffer to write to. More... | |
MCFileWriter (const std::string &) | |
This constructor creates an instance from a file on disk. More... | |
void | writeFile (MCFile *file) |
Writes the given save data to a file on disk. More... | |
Static Public Member Functions | |
static atUint16 | calculateChecksum (atUint8 *data, atUint32 length) |
Additional Inherited Members | |
Protected Member Functions inherited from athena::io::MemoryCopyWriter | |
MemoryCopyWriter (atUint8 *data=nullptr, atUint64 length=0x10) | |
This constructor copies an existing buffer to write to. More... | |
MemoryCopyWriter (const std::string &filename) | |
This constructor creates an instance from a file on disk. 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... | |
void | setData (const atUint8 *data, atUint64 length) |
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... | |
void | writeUBytes (const atUint8 *data, atUint64 len) |
Writes the given buffer with the specified length, buffers can be bigger than the length however it's undefined behavior to try and write a buffer which is smaller than the given length. More... | |
MemoryWriter (atUint8 *data, atUint64 length, bool takeOwnership=false) | |
This constructor references an existing buffer to write to in-place. More... | |
atUint64 | position () const |
Returns the current position in the stream. More... | |
atUint64 | length () const |
Returns the length of the stream. More... | |
bool | isOpen () const |
void | setData (atUint8 *data, atUint64 length, bool takeOwnership=false) |
Sets the buffer to the given one, deleting the current one if it owns it. 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. More... | |
void | setFilepath (const std::string &filepath) |
Sets the target file. More... | |
std::string | filepath () const |
Returns the target file. | |
void | save (const std::string &filename="") |
Saves the file to the specified file. More... | |
Protected Member Functions inherited from athena::io::IStreamWriter | |
void | seekAlign32 () |
Sets the buffers position relative to the next 32-byte aligned position. | |
bool | atEnd () const |
Returns whether or not the stream is at the end. More... | |
void | writeUByte (atUint8 val) |
Writes a byte at the current position and advances the position by one byte. More... | |
void | writeVal (atUint8 val) |
void | writeValLittle (atUint8 val) |
void | writeValBig (atUint8 val) |
void | writeByte (atInt8 val) |
Writes a byte at the current position and advances the position by one byte. More... | |
void | writeVal (atInt8 val) |
void | writeValLittle (atInt8 val) |
void | writeValBig (atInt8 val) |
void | writeBytes (const void *data, atUint64 len) |
Writes the given buffer with the specified length, buffers can be bigger than the length however it's undefined behavior to try and write a buffer which is smaller than the given length. More... | |
void | writeInt16 (atInt16 val) |
Writes an Int16 to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (atInt16 val) |
void | writeInt16Little (atInt16 val) |
Writes an Int16 to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (atInt16 val) |
void | writeInt16Big (atInt16 val) |
Writes an Int16 to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (atInt16 val) |
void | writeUint16 (atUint16 val) |
Writes an Uint16 to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (atUint16 val) |
void | writeUint16Little (atUint16 val) |
Writes an Uint16 to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (atUint16 val) |
void | writeUint16Big (atUint16 val) |
Writes an Uint16 to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (atUint16 val) |
void | writeInt32 (atInt32 val) |
Writes an Int32 to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (atInt32 val) |
void | writeInt32Little (atInt32 val) |
Writes an Int32 to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (atInt32 val) |
void | writeInt32Big (atInt32 val) |
Writes an Int32 to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (atInt32 val) |
void | writeUint32 (atUint32 val) |
Writes an Uint32 to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (atUint32 val) |
void | writeUint32Little (atUint32 val) |
Writes an Uint32 to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (atUint32 val) |
void | writeUint32Big (atUint32 val) |
Writes an Uint32 to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (atUint32 val) |
void | writeInt64 (atInt64 val) |
Writes an Int64 to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (atInt64 val) |
void | writeInt64Little (atInt64 val) |
Writes an Int64 to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (atInt64 val) |
void | writeInt64Big (atInt64 val) |
Writes an Int64 to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (atInt64 val) |
void | writeUint64 (atUint64 val) |
Writes an Uint64 to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (atUint64 val) |
void | writeUint64Little (atUint64 val) |
Writes an Uint64 to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (atUint64 val) |
void | writeUint64Big (atUint64 val) |
Writes an Uint64 to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (atUint64 val) |
void | writeFloat (float val) |
Writes an float to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (float val) |
void | writeFloatLittle (float val) |
Writes an float to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (float val) |
void | writeFloatBig (float val) |
Writes an float to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (float val) |
void | writeDouble (double val) |
Writes an double to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (double val) |
void | writeDoubleLittle (double val) |
Writes an double to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (double val) |
void | writeDoubleBig (double val) |
Writes an double to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (double val) |
void | writeBool (bool val) |
Writes an bool to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (bool val) |
void | writeValLittle (bool val) |
void | writeValBig (bool val) |
void | writeVec2f (const atVec2f &vec) |
Writes an atVec2f (8 bytes) to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (const atVec2f &val) |
void | writeVec2fLittle (const atVec2f &vec) |
Writes an atVec2f (8 bytes) to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (const atVec2f &val) |
void | writeVec2fBig (const atVec2f &vec) |
Writes an atVec2f (8 bytes) to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (const atVec2f &val) |
void | writeVec3f (const atVec3f &vec) |
Writes an atVec3f (12 bytes) to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (const atVec3f &val) |
void | writeVec3fLittle (const atVec3f &vec) |
Writes an atVec3f (12 bytes) to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (const atVec3f &val) |
void | writeVec3fBig (const atVec3f &vec) |
Writes an atVec3f (12 bytes) to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (const atVec3f &val) |
void | writeVec4f (const atVec4f &vec) |
Writes an atVec4f (16 bytes) to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (const atVec4f &val) |
void | writeVec4fLittle (const atVec4f &vec) |
Writes an atVec4f (16 bytes) to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (const atVec4f &val) |
void | writeVec4fBig (const atVec4f &vec) |
Writes an atVec4f (16 bytes) to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (const atVec4f &val) |
void | writeVec2d (const atVec2d &vec) |
Writes an atVec2d (16 bytes) to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (const atVec2d &val) |
void | writeVec2dLittle (const atVec2d &vec) |
Writes an atVec2d (16 bytes) to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (const atVec2d &val) |
void | writeVec2dBig (const atVec2d &vec) |
Writes an atVec2d (16 bytes) to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (const atVec2d &val) |
void | writeVec3d (const atVec3d &vec) |
Writes an atVec3d (24 bytes) to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (const atVec3d &val) |
void | writeVec3dLittle (const atVec3d &vec) |
Writes an atVec3d (24 bytes) to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (const atVec3d &val) |
void | writeVec3dBig (const atVec3d &vec) |
Writes an atVec3d (24 bytes) to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (const atVec3d &val) |
void | writeVec4d (const atVec4d &vec) |
Writes an atVec4d (32 bytes) to the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeVal (const atVec4d &val) |
void | writeVec4dLittle (const atVec4d &vec) |
Writes an atVec4d (32 bytes) to the buffer and advances the buffer. It also swaps the bytes against little depending on the platform. More... | |
void | writeValLittle (const atVec4d &val) |
void | writeVec4dBig (const atVec4d &vec) |
Writes an atVec4d (32 bytes) to the buffer and advances the buffer. It also swaps the bytes against big depending on the platform. More... | |
void | writeValBig (const atVec4d &val) |
void | writeStringAsWString (const std::string &str, atInt32 fixedLen=-1) |
Converts a UTF8 string to a wide-char string in the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeStringAsWStringLittle (const std::string &str, atInt32 fixedLen=-1) |
Converts a UTF8 string to a wide-char string in the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeStringAsWStringBig (const std::string &str, atInt32 fixedLen=-1) |
Converts a UTF8 string to a wide-char string in the buffer and advances the buffer. It also swaps the bytes depending on the platform and Stream settings. More... | |
void | writeString (const std::string &str, atInt32 fixedLen=-1) |
Writes an string to the buffer and advances the buffer. More... | |
void | writeVal (const std::string &val) |
void | writeWString (const std::wstring &str, atInt32 fixedLen=-1) |
Writes an wstring to the buffer and advances the buffer. More... | |
void | writeVal (const std::wstring &val) |
void | writeWStringLittle (const std::wstring &str, atInt32 fixedLen=-1) |
Writes an wstring to the buffer and advances the buffer. More... | |
void | writeValLittle (const std::wstring &val) |
void | writeWStringBig (const std::wstring &str, atInt32 fixedLen=-1) |
Writes an wstring to the buffer and advances the buffer. More... | |
void | writeValBig (const std::wstring &val) |
void | fill (atUint8 val, atUint64 length) |
void | fill (atInt8 val, atUint64 length) |
template<class T > | |
void | enumerate (const std::vector< T > &vector, 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 writes using numeric type T. More... | |
template<class T > | |
void | enumerateLittle (const std::vector< T > &vector, 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 writes using numeric type T. More... | |
template<class T > | |
void | enumerateBig (const std::vector< T > &vector, 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 writes using numeric type T. More... | |
template<class T > | |
void | enumerate (const std::vector< T > &vector, 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 writes using non-numeric 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::MemoryCopyWriter | |
std::unique_ptr< atUint8[]> | m_dataCopy |
Protected Attributes inherited from athena::io::MemoryWriter | |
atUint8 * | m_data |
atUint64 | m_length |
atUint64 | m_position |
bool | m_bufferOwned |
std::string | m_filepath |
Path to the target file. | |
Protected Attributes inherited from athena::io::IStream | |
bool | m_hasError = false |
Endian | m_endian = BigEndian |
The Minish Cap Save save data writer class.
A Class for writing binary data to a The Minish Cap Save File, all work is done using a memory buffer, and not written directly from the disk.
Definition at line 22 of file MCFileWriter.hpp.
athena::io::MCFileWriter::MCFileWriter | ( | atUint8 * | , |
atUint64 | |||
) |
This constructor takes an existing buffer to write to.
data | The existing buffer |
length | The length of the existing buffer |
athena::io::MCFileWriter::MCFileWriter | ( | const std::string & | ) |
This constructor creates an instance from a file on disk.
filename | The file to create the stream from |
void athena::io::MCFileWriter::writeFile | ( | MCFile * | file | ) |
Writes the given save data to a file on disk.
file | Save data to write |