diff --git a/include/Athena/DNA.hpp b/include/Athena/DNA.hpp index 7910c78..f4479e6 100644 --- a/include/Athena/DNA.hpp +++ b/include/Athena/DNA.hpp @@ -30,7 +30,7 @@ template struct WString; template -struct UTF8; +struct WStringAsString; /** * @brief Base DNA class used against 'atdna' @@ -62,7 +62,7 @@ struct DNA using WString = struct WString; template - using UTF8 = struct UTF8; + using WStringAsString = struct WStringAsString; template struct Seek {}; @@ -125,13 +125,13 @@ struct WString : public DNA, public std::wstring }; template -struct UTF8 : public DNA, public std::string +struct WStringAsString : public DNA, public std::string { typename DNA::Delete expl; inline void read(IStreamReader& reader) - {*this = reader.readUnicode(sizeVar);} + {*this = reader.readWStringAsString(sizeVar);} inline void write(IStreamWriter& writer) const - {writer.writeUnicode(*this, sizeVar);} + {writer.writeStringAsWString(*this, sizeVar);} inline std::string& operator=(const std::string& __str) {return this->assign(__str);} inline std::string& operator=(std::string&& __str) diff --git a/include/Athena/IStreamReader.hpp b/include/Athena/IStreamReader.hpp index 62a859b..10f161e 100644 --- a/include/Athena/IStreamReader.hpp +++ b/include/Athena/IStreamReader.hpp @@ -293,13 +293,13 @@ public: return val; } - /*! \brief Reads a Unicode string and advances the position in the file + /*! \brief Reads a wide-char string, converts to UTF8 and advances the position in the file * * \param fixedLen If non-negative, this is a fixed-length string read * \return std::string The value at the current address * \throw IOException when address is out of range */ - inline std::string readUnicode(atInt32 fixedLen = -1) + inline std::string readWStringAsString(atInt32 fixedLen = -1) { std::wstring tmp; atUint16 chr = readUint16(); diff --git a/include/Athena/IStreamWriter.hpp b/include/Athena/IStreamWriter.hpp index 2b32760..5da5992 100644 --- a/include/Athena/IStreamWriter.hpp +++ b/include/Athena/IStreamWriter.hpp @@ -273,14 +273,14 @@ public: writeUBytes((atUint8*)&vec, 16); } - /*! \brief Writes an unicode string to the buffer and advances the buffer. + /*! \brief 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. * * \sa Endian * \param str The string to write to the buffer * \param fixedLen If not -1, the number of characters to zero-fill string to */ - inline void writeUnicode(const std::string& str, atInt32 fixedLen = -1) + inline void writeStringAsWString(const std::string& str, atInt32 fixedLen = -1) { std::string tmpStr = "\xEF\xBB\xBF" + str; diff --git a/src/Athena/WiiSaveReader.cpp b/src/Athena/WiiSaveReader.cpp index 3d262bb..5a33ea2 100644 --- a/src/Athena/WiiSaveReader.cpp +++ b/src/Athena/WiiSaveReader.cpp @@ -198,12 +198,12 @@ WiiBanner* WiiSaveReader::readBanner() animSpeed = base::readUint16(); base::seek(22); - gameTitle = base::readUnicode(); + gameTitle = base::readWStringAsString(); if (base::position() != 0x0080) base::seek(0x0080, SeekOrigin::Begin); - subTitle = base::readUnicode(); + subTitle = base::readWStringAsString(); if (base::position() != 0x00C0) base::seek(0x00C0, SeekOrigin::Begin); diff --git a/src/Athena/WiiSaveWriter.cpp b/src/Athena/WiiSaveWriter.cpp index f9ea5e9..557f661 100644 --- a/src/Athena/WiiSaveWriter.cpp +++ b/src/Athena/WiiSaveWriter.cpp @@ -110,12 +110,12 @@ void WiiSaveWriter::writeBanner(WiiBanner* banner) base::writeInt16(banner->animationSpeed()); base::seek(22); - base::writeUnicode(banner->title()); + base::writeStringAsWString(banner->title()); if (base::position() != 0x0080) base::seek(0x0080, SeekOrigin::Begin); - base::writeUnicode(banner->subtitle()); + base::writeStringAsWString(banner->subtitle()); if (base::position() != 0x00C0) base::seek(0x00C0, SeekOrigin::Begin);