diff --git a/CMakeLists.txt b/CMakeLists.txt index 2befb7a..e4ac8f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,6 +125,11 @@ add_library(athena-sakura EXCLUDE_FROM_ALL include/athena/SpritePart.hpp ) +target_include_directories(athena-sakura PUBLIC + $ + $ +) + add_library(athena-wiisave EXCLUDE_FROM_ALL src/athena/WiiBanner.cpp src/athena/WiiFile.cpp @@ -154,6 +159,10 @@ if(NOT MSVC AND NOT GEKKO AND NOT NX) set_source_files_properties(src/aes.cpp PROPERTIES COMPILE_FLAGS -maes) endif() +target_include_directories(athena-wiisave PUBLIC + $ + $ +) add_library(athena-zelda EXCLUDE_FROM_ALL src/athena/ALTTPFile.cpp @@ -190,6 +199,11 @@ add_library(athena-zelda EXCLUDE_FROM_ALL include/athena/ZQuestFileWriter.hpp ) +target_include_directories(athena-zelda PUBLIC + $ + $ +) + # Icon set(ATHENA_ICO ${CMAKE_CURRENT_SOURCE_DIR}/Athena.ico) diff --git a/src/athena/ALTTPFile.cpp b/src/athena/ALTTPFile.cpp index ac97988..30ed87c 100644 --- a/src/athena/ALTTPFile.cpp +++ b/src/athena/ALTTPFile.cpp @@ -9,7 +9,7 @@ ALTTPFile::ALTTPFile(std::vector quests, std::vector b void ALTTPFile::setQuest(atUint32 id, ALTTPQuest* val) { if (id > m_quests.size()) { - atWarning("index out of range"); + atWarning(fmt("index out of range")); return; } @@ -19,7 +19,7 @@ void ALTTPFile::setQuest(atUint32 id, ALTTPQuest* val) { std::vector ALTTPFile::questList() const { return m_quests; } ALTTPQuest* ALTTPFile::quest(atUint32 id) const { if (id > m_quests.size()) { - atWarning("index out of range"); + atWarning(fmt("index out of range")); return nullptr; } diff --git a/src/athena/ALTTPFileReader.cpp b/src/athena/ALTTPFileReader.cpp index feeea49..de8912b 100644 --- a/src/athena/ALTTPFileReader.cpp +++ b/src/athena/ALTTPFileReader.cpp @@ -211,7 +211,7 @@ ALTTPDungeonItemFlags ALTTPFileReader::readDungeonFlags() { flags.HyruleCastle = (flagsByte >> 6) & 1; flags.SewerPassage = (flagsByte >> 7) & 1; - atDebug("{:x} {:x}", flags.flags1, flags.flags2); + atDebug(fmt("{:x} {:x}"), flags.flags1, flags.flags2); return flags; } diff --git a/src/athena/ALTTPQuest.cpp b/src/athena/ALTTPQuest.cpp index e2ef984..ba96ec5 100644 --- a/src/athena/ALTTPQuest.cpp +++ b/src/athena/ALTTPQuest.cpp @@ -29,7 +29,7 @@ std::vector ALTTPQuest::overworldEvents() const { return m ALTTPOverworldEvent* ALTTPQuest::overworldEvent(atUint32 id) const { if (id > m_overworldEvents.size() - 1) { - atWarning("index out of range"); + atWarning(fmt("index out of range")); return nullptr; } @@ -126,7 +126,7 @@ void ALTTPQuest::setDungeonKeys(std::vector val) { m_dungeonKeys = val; void ALTTPQuest::setDungeonKeys(atUint32 id, atUint8 val) { if (id > m_dungeonKeys.size() - 1) { - atWarning("index out of range"); + atWarning(fmt("index out of range")); return; } @@ -135,7 +135,7 @@ void ALTTPQuest::setDungeonKeys(atUint32 id, atUint8 val) { atUint8 ALTTPQuest::dungeonKeys(atUint32 id) const { if (id > m_dungeonKeys.size() - 1) { - atWarning("index out of range"); + atWarning(fmt("index out of range")); return 0; } @@ -176,7 +176,7 @@ void ALTTPQuest::setOldManFlags(std::vector flags) { m_oldManFlags = fl void ALTTPQuest::setOldManFlag(atUint32 id, atUint8 val) { if (id > m_oldManFlags.size() - 1) { - atWarning("index out of range"); + atWarning(fmt("index out of range")); return; } @@ -185,7 +185,7 @@ void ALTTPQuest::setOldManFlag(atUint32 id, atUint8 val) { atUint8 ALTTPQuest::oldManFlag(atUint32 id) { if (id > m_oldManFlags.size() - 1) { - atWarning("index out of range"); + atWarning(fmt("index out of range")); return 0; } return m_oldManFlags[id]; @@ -201,7 +201,7 @@ void ALTTPQuest::setUnknown1(std::vector flags) { m_unknown1 = flags; } void ALTTPQuest::setUnknown1(atUint32 id, atUint8 val) { if (id > m_unknown1.size()) { - atWarning("index out of range"); + atWarning(fmt("index out of range")); return; } @@ -210,7 +210,7 @@ void ALTTPQuest::setUnknown1(atUint32 id, atUint8 val) { atUint8 ALTTPQuest::unknown1(atUint32 id) { if (id > m_unknown1.size()) { - atWarning("index out of range"); + atWarning(fmt("index out of range")); return 0; } @@ -223,7 +223,7 @@ void ALTTPQuest::setPlayerName(std::vector playerName) { m_playerName void ALTTPQuest::setPlayerName(const std::string& playerName) { if (playerName == std::string() || playerName.size() > 6) { - atWarning("index out of range"); + atWarning(fmt("index out of range")); return; } @@ -401,7 +401,7 @@ void ALTTPQuest::setDungeonDeathTotals(std::vector val) { m_dungeonDea void ALTTPQuest::setDungeonDeathTotal(atUint32 id, atUint16 val) { if (id > m_dungeonDeathTotals.size()) { - atWarning("index out of range"); + atWarning(fmt("index out of range")); return; } @@ -410,7 +410,7 @@ void ALTTPQuest::setDungeonDeathTotal(atUint32 id, atUint16 val) { atUint16 ALTTPQuest::dungeonDeathTotal(atUint32 id) const { if (id > m_dungeonDeathTotals.size()) { - atWarning("index out of range"); + atWarning(fmt("index out of range")); return 0; } diff --git a/src/athena/SkywardSwordFile.cpp b/src/athena/SkywardSwordFile.cpp index eba259b..0f09938 100644 --- a/src/athena/SkywardSwordFile.cpp +++ b/src/athena/SkywardSwordFile.cpp @@ -19,7 +19,7 @@ void SkywardSwordFile::addQuest(athena::SkywardSwordQuest* q) { SkywardSwordQuest* SkywardSwordFile::quest(atUint32 id) { if (id > m_quests.size() - 1) { - atWarning("index out of range"); + atWarning(fmt("index out of range")); return nullptr; } diff --git a/src/athena/SkywardSwordFileReader.cpp b/src/athena/SkywardSwordFileReader.cpp index 67b81ba..bb54055 100644 --- a/src/athena/SkywardSwordFileReader.cpp +++ b/src/athena/SkywardSwordFileReader.cpp @@ -17,14 +17,14 @@ SkywardSwordFile* SkywardSwordFileReader::read() { SkywardSwordFile* file = NULL; if (length() != 0xFBE0) { - atError("File not the expected size of 0xFBE0"); + atError(fmt("File not the expected size of 0xFBE0")); return nullptr; } atUint32 magic = readUint32(); if (magic != SkywardSwordFile::USMagic && magic != SkywardSwordFile::JAMagic && magic != SkywardSwordFile::EUMagic) { - atError("Not a valid Skyward Sword save file"); + atError(fmt("Not a valid Skyward Sword save file")); return nullptr; } @@ -32,7 +32,7 @@ SkywardSwordFile* SkywardSwordFileReader::read() { atUint32 headerSize = readUint32(); // Seems to be (headerSize - 1) if (headerSize != 0x1D) { - atError("Invalid header size, Corrupted data?"); + atError(fmt("Invalid header size, Corrupted data?")); return nullptr; } diff --git a/src/athena/SkywardSwordFileWriter.cpp b/src/athena/SkywardSwordFileWriter.cpp index d76d93e..394c3d8 100644 --- a/src/athena/SkywardSwordFileWriter.cpp +++ b/src/athena/SkywardSwordFileWriter.cpp @@ -14,7 +14,7 @@ SkywardSwordFileWriter::SkywardSwordFileWriter(const std::string& filename) : Me void SkywardSwordFileWriter::write(SkywardSwordFile* file) { if (!file) { - atError("file cannot be NULL"); + atError(fmt("file cannot be NULL")); return; } @@ -31,7 +31,7 @@ void SkywardSwordFileWriter::write(SkywardSwordFile* file) { for (SkywardSwordQuest* q : quests) { if (q->length() != 0x53C0) { - atError("q->data() not 0x53C0 bytes in length"); + atError(fmt("q->data() not 0x53C0 bytes in length")); return; } diff --git a/src/athena/SkywardSwordQuest.cpp b/src/athena/SkywardSwordQuest.cpp index f9604d2..61cba31 100644 --- a/src/athena/SkywardSwordQuest.cpp +++ b/src/athena/SkywardSwordQuest.cpp @@ -43,7 +43,7 @@ atUint8* SkywardSwordQuest::skipData() const { return m_skipData.get(); } void SkywardSwordQuest::setPlayerName(const std::string& name) { if (name.length() > 8) - atDebug("WARNING: name cannot be greater than 8 characters, automatically truncating"); + atDebug(fmt("WARNING: name cannot be greater than 8 characters, automatically truncating")); const utf8proc_uint8_t* buf = reinterpret_cast(name.c_str()); for (atUint32 i = 0; i < 8; i++) { @@ -57,7 +57,7 @@ void SkywardSwordQuest::setPlayerName(const std::string& name) { utf8proc_int32_t wc; utf8proc_ssize_t len = utf8proc_iterate(buf, -1, &wc); if (len < 0) { - atError("invalid UTF-8 string"); + atError(fmt("invalid UTF-8 string")); return; } buf += len; diff --git a/src/athena/SpriteFileReader.cpp b/src/athena/SpriteFileReader.cpp index 5a3711a..f505b78 100644 --- a/src/athena/SpriteFileReader.cpp +++ b/src/athena/SpriteFileReader.cpp @@ -16,7 +16,7 @@ Sakura::SpriteFile* SpriteFileReader::readFile() { atUint32 magic = readUint32(); if (magic != Sakura::SpriteFile::Magic) { - atError("Not a valid Sakura Sprite container"); + atError(fmt("Not a valid Sakura Sprite container")); return nullptr; } @@ -24,7 +24,7 @@ Sakura::SpriteFile* SpriteFileReader::readFile() { // TODO: Make this more verbose if (version != Sakura::SpriteFile::Version) { - atError("Unsupported version"); + atError(fmt("Unsupported version")); return nullptr; } @@ -51,7 +51,7 @@ Sakura::SpriteFile* SpriteFileReader::readFile() { // which require data to be 32 byte aligned, or it causes some issues. // It's also convenient to have this, for later expansion. atUint32 reserved = readUint32(); - UNUSED(reserved); + //UNUSED(reserved); // Next we have to load the textures // If we tried to add them one at a time to the sprite container @@ -175,7 +175,7 @@ Sakura::SpriteFile* SpriteFileReader::readFile() { #endif else { - atError("Sprite names cannot be empty"); + atError(fmt("Sprite names cannot be empty")); return nullptr; } } diff --git a/src/athena/SpriteFileWriter.cpp b/src/athena/SpriteFileWriter.cpp index 72b6bd5..345619e 100644 --- a/src/athena/SpriteFileWriter.cpp +++ b/src/athena/SpriteFileWriter.cpp @@ -11,7 +11,7 @@ SpriteFileWriter::SpriteFileWriter(std::string_view filepath) : MemoryCopyWriter void SpriteFileWriter::writeFile(Sakura::SpriteFile* file) { if (!file) { - atError("file cannot be NULL"); + atError(fmt("file cannot be NULL")); return; } diff --git a/src/athena/WiiFile.cpp b/src/athena/WiiFile.cpp index db207d5..07875b8 100644 --- a/src/athena/WiiFile.cpp +++ b/src/athena/WiiFile.cpp @@ -78,7 +78,7 @@ bool WiiFile::isFile() const { return (m_type == WiiFile::File); } void WiiFile::addChild(WiiFile* file) { if (!isDirectory()) { - atWarning("{} is not a directory", filename()); + atWarning(fmt("{} is not a directory"), filename()); return; } diff --git a/src/athena/WiiSaveReader.cpp b/src/athena/WiiSaveReader.cpp index ff9df7c..7d24051 100644 --- a/src/athena/WiiSaveReader.cpp +++ b/src/athena/WiiSaveReader.cpp @@ -27,14 +27,14 @@ std::unique_ptr WiiSaveReader::readSave() { WiiSave* ret = new WiiSave; if (length() < 0xF0C0) { - atError("Not a valid WiiSave"); + atError(fmt("Not a valid WiiSave")); return nullptr; } WiiBanner* banner = this->readBanner(); if (!banner) { - atError("Invalid banner"); + atError(fmt("Invalid banner")); return nullptr; } @@ -42,14 +42,14 @@ std::unique_ptr WiiSaveReader::readSave() { atUint32 bkVer = readUint32(); if (bkVer != 0x00000070) { - atError("Invalid BacKup header size"); + atError(fmt("Invalid BacKup header size")); return nullptr; } atUint32 bkMagic = readUint32(); if (bkMagic != 0x426B0001) { - atError("Invalid BacKup header magic"); + atError(fmt("Invalid BacKup header magic")); return nullptr; } @@ -130,7 +130,7 @@ WiiBanner* WiiSaveReader::readBanner() { std::cerr << std::endl; setData(oldData, oldLen); seek(oldPos, SeekOrigin::Begin); - atError("MD5 Mismatch"); + atError(fmt("MD5 Mismatch")); return nullptr; } @@ -158,7 +158,7 @@ WiiBanner* WiiSaveReader::readBanner() { // Make sure to reset m_reader values back to the old ones. setData(oldData, oldLen); seek(oldPos, SeekOrigin::Begin); - atError("Invalid Header Magic"); + atError(fmt("Invalid Header Magic")); return nullptr; } diff --git a/src/athena/WiiSaveWriter.cpp b/src/athena/WiiSaveWriter.cpp index 92318b0..7e9db36 100644 --- a/src/athena/WiiSaveWriter.cpp +++ b/src/athena/WiiSaveWriter.cpp @@ -30,7 +30,7 @@ WiiSaveWriter::WiiSaveWriter(const std::string& filename) : MemoryCopyWriter(fil bool WiiSaveWriter::writeSave(WiiSave* save, atUint8* macAddress, atUint32 ngId, atUint8* ngPriv, atUint8* ngSig, atUint32 ngKeyId, const std::string& filepath) { if (!save) { - atError("save cannot be NULL"); + atError(fmt("save cannot be NULL")); return false; } diff --git a/src/athena/ZQuestFileReader.cpp b/src/athena/ZQuestFileReader.cpp index bda6125..b1c445f 100644 --- a/src/athena/ZQuestFileReader.cpp +++ b/src/athena/ZQuestFileReader.cpp @@ -23,14 +23,14 @@ ZQuestFile* ZQuestFileReader::read() { magic = readUint32(); if ((magic & 0x00FFFFFF) != (ZQuestFile::Magic & 0x00FFFFFF)) { - atError("Not a valid ZQuest file"); + atError(fmt("Not a valid ZQuest file")); return nullptr; } version = readUint32(); if (version > ZQuestFile::Version) { - atError("Unsupported ZQuest version"); + atError(fmt("Unsupported ZQuest version")); return nullptr; } @@ -60,7 +60,7 @@ ZQuestFile* ZQuestFileReader::read() { if (version >= ZQUEST_VERSION_CHECK(2, 0, 0)) { if (checksum != athena::checksums::crc32(data.get(), compressedLen)) { - atError("Checksum mismatch, data corrupt"); + atError(fmt("Checksum mismatch, data corrupt")); return nullptr; } } else { @@ -75,7 +75,7 @@ ZQuestFile* ZQuestFileReader::read() { if (dstLen != uncompressedLen) { delete[] dst; - atError("Error decompressing data"); + atError(fmt("Error decompressing data")); return nullptr; } diff --git a/src/athena/ZQuestFileWriter.cpp b/src/athena/ZQuestFileWriter.cpp index 7a9dacc..b5bad54 100644 --- a/src/athena/ZQuestFileWriter.cpp +++ b/src/athena/ZQuestFileWriter.cpp @@ -11,7 +11,7 @@ ZQuestFileWriter::ZQuestFileWriter(const std::string& filename) : MemoryCopyWrit void ZQuestFileWriter::write(ZQuestFile* quest, bool compress) { if (!quest) { - atError("quest cannot be NULL"); + atError(fmt("quest cannot be NULL")); return; }