Merge branch 'master' of ssh://git.axiodl.com:6431/libAthena/athena

This commit is contained in:
Jack Andersen 2018-07-15 21:42:29 -10:00
commit 61bfac431e
3 changed files with 26 additions and 22 deletions

View File

@ -14,7 +14,7 @@ set(ATHENA_MINOR_VERSION 3)
set(ATHENA_PATCH_VERSION 0)
set(ATHENA_VERSION
${ATHENA_MAJOR_VERSION}.${ATHENA_MINOR_VERSION}.${ATHENA_PATCH_VERSION})
set(ATHENA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(ATHENA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "Athena Include Path")
################
# Athena Build #
@ -22,7 +22,7 @@ set(ATHENA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
add_subdirectory(extern)
include_directories(${ATHENA_INCLUDE_DIR} ${LZO_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${LZO_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
if(WIN32)
list(APPEND CORE_EXTRA src/win32_largefilewrapper.c include/win32_largefilewrapper.h

View File

@ -879,7 +879,7 @@ public:
* @param fixedLen If non-negative, this is a fixed-length string read
* @return The read string
*/
inline std::string readString(atInt32 fixedLen = -1)
inline std::string readString(atInt32 fixedLen = -1, bool doSeek=true)
{
if (fixedLen == 0)
return std::string();
@ -891,13 +891,13 @@ public:
{
ret += chr;
if (fixedLen >= 0 && i >= fixedLen)
if (fixedLen > 0 && i >= fixedLen)
break;
chr = readByte();
}
if (fixedLen >= 0 && i < fixedLen)
if (doSeek && fixedLen > 0 && i < fixedLen)
seek(fixedLen - i);
return ret;
@ -911,7 +911,7 @@ public:
* @param fixedLen If non-negative, this is a fixed-length string read
* @return The read wstring
*/
inline std::wstring readWString(atInt32 fixedLen = -1)
inline std::wstring readWString(atInt32 fixedLen = -1, bool doSeek=true)
{
if (fixedLen == 0)
return std::wstring();
@ -924,13 +924,13 @@ public:
{
ret += chr;
if (fixedLen >= 0 && i >= fixedLen)
if (fixedLen > 0 && i >= fixedLen)
break;
chr = readUint16();
}
if (fixedLen >= 0 && i < fixedLen)
if (doSeek && fixedLen > 0 && i < fixedLen)
seek(fixedLen - i);
return ret;
@ -945,7 +945,7 @@ public:
* @param fixedLen If non-negative, this is a fixed-length string read
* @return The read wstring
*/
inline std::wstring readWStringLittle(atInt32 fixedLen = -1)
inline std::wstring readWStringLittle(atInt32 fixedLen = -1, bool doSeek=true)
{
if (fixedLen == 0)
return std::wstring();
@ -958,13 +958,13 @@ public:
{
ret += chr;
if (fixedLen >= 0 && i >= fixedLen)
if (fixedLen > 0 && i >= fixedLen)
break;
chr = readUint16Little();
}
if (fixedLen >= 0 && i < fixedLen)
if (doSeek && fixedLen > 0 && i < fixedLen)
seek(fixedLen - i);
return ret;
@ -979,7 +979,7 @@ public:
* @param fixedLen If non-negative, this is a fixed-length string read
* @return The read wstring
*/
inline std::wstring readWStringBig(atInt32 fixedLen = -1)
inline std::wstring readWStringBig(atInt32 fixedLen = -1, bool doSeek = true)
{
if (fixedLen == 0)
return std::wstring();
@ -991,13 +991,13 @@ public:
{
ret += chr;
if (fixedLen >= 0 && i >= fixedLen)
if (fixedLen > 0 && i >= fixedLen)
break;
chr = readUint16Big();
}
if (fixedLen >= 0 && i < fixedLen)
if (doSeek && fixedLen > 0 && i < fixedLen)
seek(fixedLen - i);
return ret;
@ -1012,7 +1012,7 @@ public:
* @param fixedLen If non-negative, this is a fixed-length string read
* @return The read wstring
*/
inline std::u16string readU16StringBig(atInt32 fixedLen = -1)
inline std::u16string readU16StringBig(atInt32 fixedLen = -1, bool doSeek = true)
{
if (fixedLen == 0)
return std::u16string();
@ -1024,13 +1024,13 @@ public:
{
ret += chr;
if (fixedLen >= 0 && i >= fixedLen)
if (fixedLen > 0 && i >= fixedLen)
break;
chr = readUint16Big();
}
if (fixedLen >= 0 && i < fixedLen)
if (doSeek && fixedLen > 0 && i < fixedLen)
seek(fixedLen - i);
return ret;
@ -1045,7 +1045,7 @@ public:
* @param fixedLen If non-negative, this is a fixed-length string read
* @return The read wstring
*/
inline std::u32string readU32StringBig(atInt32 fixedLen = -1)
inline std::u32string readU32StringBig(atInt32 fixedLen = -1, bool doSeek = true)
{
if (fixedLen == 0)
return std::u32string();
@ -1057,13 +1057,13 @@ public:
{
ret += chr;
if (fixedLen >= 0 && i >= fixedLen)
if (fixedLen > 0 && i >= fixedLen)
break;
chr = readUint32Big();
}
if (fixedLen >= 0 && i < fixedLen)
if (doSeek && fixedLen > 0 && i < fixedLen)
seek(fixedLen - i);
return ret;

View File

@ -95,12 +95,16 @@ void WiiSaveWriter::writeBanner(WiiBanner* banner)
writeInt16(banner->animationSpeed());
seek(22);
writeStringAsWString(banner->title());
for (char16_t c : banner->title())
writeUint16(c);
writeUint16(0);
if (position() != 0x0080)
seek(0x0080, SeekOrigin::Begin);
writeStringAsWString(banner->subtitle());
for (char16_t c : banner->subtitle())
writeUint16(c);
writeUint16(0);
if (position() != 0x00C0)
seek(0x00C0, SeekOrigin::Begin);