From ec4167abca2ecc755a554f62edd860fddaa5a583 Mon Sep 17 00:00:00 2001 From: Antidote Date: Sun, 20 Apr 2014 02:14:15 -0700 Subject: [PATCH] * Major rewrite --- .travis.yml | 19 +- Athena.pri | 108 + Athena.pro | 137 ++ README.md | 5 - include/{ => Athena}/ALTTPEnums.hpp | 2 +- include/Athena/ALTTPEnums.hpp.autosave | 113 + include/{ => Athena}/ALTTPFile.hpp | 4 +- include/Athena/ALTTPFile.hpp.autosave | 91 + include/{ => Athena}/ALTTPFileReader.hpp | 2 +- include/Athena/ALTTPFileReader.hpp.autosave | 68 + include/{ => Athena}/ALTTPFileWriter.hpp | 7 +- include/Athena/ALTTPFileWriter.hpp.autosave | 70 + include/{ => Athena}/ALTTPQuest.hpp | 2 +- include/Athena/ALTTPQuest.hpp.autosave | 685 ++++++ include/{ => Athena}/ALTTPStructs.hpp | 2 +- include/Athena/ALTTPStructs.hpp.autosave | 203 ++ include/{ => Athena}/BinaryReader.hpp | 169 +- include/Athena/BinaryReader.hpp.autosave | 301 +++ include/Athena/BinaryWriter.hpp | 296 +++ include/Athena/Checksums.hpp | 30 + include/{ => Athena}/Compression.hpp | 12 +- include/{ => Athena}/Exception.hpp | 44 +- .../{ => Athena}/FileNotFoundException.hpp | 25 +- include/Athena/FileReader.hpp | 76 + include/Athena/FileWriter.hpp | 72 + include/Athena/Global.hpp | 81 + include/{ => Athena}/IOException.hpp | 22 +- include/Athena/InvalidDataException.hpp | 49 + .../InvalidOperationException.hpp | 25 +- include/{ => Athena}/MCFile.hpp | 10 +- include/{ => Athena}/MCFileReader.hpp | 11 +- include/{ => Athena}/MCFileWriter.hpp | 10 +- include/Athena/NotImplementedException.hpp | 38 + include/Athena/SkywardSwordFile.hpp | 63 + include/Athena/SkywardSwordFileReader.hpp | 39 + include/Athena/SkywardSwordFileWriter.hpp | 40 + include/Athena/SkywardSwordQuest.hpp | 44 + include/{ => Athena}/Sprite.hpp | 19 +- include/{ => Athena}/SpriteFile.hpp | 21 +- include/Athena/SpriteFileReader.hpp | 44 + include/Athena/SpriteFileWriter.hpp | 44 + include/{ => Athena}/SpriteFrame.hpp | 19 +- include/{ => Athena}/SpritePart.hpp | 20 +- include/Athena/Stream.hpp | 79 + include/{ => Athena}/Types.hpp | 64 +- include/{utility.hpp => Athena/Utility.hpp} | 18 +- include/{ => Athena}/WiiBanner.hpp | 13 +- include/{ => Athena}/WiiFile.hpp | 17 +- include/{ => Athena}/WiiImage.hpp | 11 +- include/{ => Athena}/WiiSave.hpp | 13 +- include/{ => Athena}/WiiSaveReader.hpp | 15 +- include/{ => Athena}/WiiSaveWriter.hpp | 12 +- include/{ => Athena}/ZQuestFile.hpp | 12 +- include/{ => Athena}/ZQuestFileReader.hpp | 10 +- include/{ => Athena}/ZQuestFileWriter.hpp | 12 +- include/BinaryWriter.hpp | 176 -- include/Checksums.hpp | 15 - include/InvalidDataException.hpp | 37 - include/Mainpage.hpp | 85 - include/SkywardSwordFile.hpp | 41 - include/SkywardSwordFileReader.hpp | 24 - include/SkywardSwordFileWriter.hpp | 25 - include/SkywardSwordQuest.hpp | 28 - include/SpriteFileReader.hpp | 29 - include/SpriteFileWriter.hpp | 29 - include/Stream.hpp | 261 --- include/TextStream.hpp | 170 -- include/aes.h | 2 +- include/bn.h | 3 +- include/ec.h | 2 +- include/lzo.h | 2 +- include/sha1.h | 2 +- libzelda.cbp | 158 -- libzelda.conf | 1869 ----------------- libzelda.layout | 14 - libzelda.png | Bin 30406 -> 0 bytes libzelda.pri | 100 - libzelda.pro | 125 -- libzelda.vcproj | 222 -- libzelda_wii.cbp | 147 -- license.txt | 674 ------ src/{ => Athena}/ALTTPFile.cpp | 20 +- src/{ => Athena}/ALTTPFileReader.cpp | 34 +- src/{ => Athena}/ALTTPFileWriter.cpp | 36 +- src/{ => Athena}/ALTTPQuest.cpp | 34 +- src/Athena/BinaryReader.cpp | 506 +++++ src/Athena/BinaryWriter.cpp | 505 +++++ src/{ => Athena}/Checksums.cpp | 19 +- src/{ => Athena}/Compression.cpp | 6 +- src/Athena/FileReader.cpp | 333 +++ src/Athena/FileWriter.cpp | 298 +++ src/Athena/Global.cpp | 48 + src/{ => Athena}/MCFile.cpp | 12 +- src/{ => Athena}/MCFileReader.cpp | 12 +- src/{ => Athena}/MCFileWriter.cpp | 12 +- src/Athena/SkywardSwordFile.cpp | 71 + src/Athena/SkywardSwordFileReader.cpp | 84 + src/Athena/SkywardSwordFileWriter.cpp | 75 + src/Athena/SkywardSwordQuest.cpp | 49 + src/{ => Athena}/Sprite.cpp | 23 +- src/{ => Athena}/SpriteFile.cpp | 29 +- src/{ => Athena}/SpriteFileReader.cpp | 68 +- src/{ => Athena}/SpriteFileWriter.cpp | 62 +- src/{ => Athena}/SpriteFrame.cpp | 23 +- src/{ => Athena}/SpritePart.cpp | 23 +- src/{utility.cpp => Athena/Utility.cpp} | 38 +- src/{ => Athena}/WiiBanner.cpp | 16 +- src/{ => Athena}/WiiFile.cpp | 12 +- src/{ => Athena}/WiiImage.cpp | 14 +- src/{ => Athena}/WiiSave.cpp | 22 +- src/{ => Athena}/WiiSaveReader.cpp | 85 +- src/{ => Athena}/WiiSaveWriter.cpp | 84 +- src/{ => Athena}/ZQuestFile.cpp | 14 +- src/{ => Athena}/ZQuestFileReader.cpp | 54 +- src/{ => Athena}/ZQuestFileWriter.cpp | 38 +- src/BinaryReader.cpp | 378 ---- src/BinaryWriter.cpp | 324 --- src/SkywardSwordFile.cpp | 57 - src/SkywardSwordFileReader.cpp | 68 - src/SkywardSwordFileWriter.cpp | 51 - src/SkywardSwordQuest.cpp | 34 - src/Stream.cpp | 383 ---- src/TextStream.cpp | 288 --- src/ec.cpp | 10 +- src/sha1.cpp | 6 +- 125 files changed, 5582 insertions(+), 6434 deletions(-) create mode 100644 Athena.pri create mode 100644 Athena.pro delete mode 100644 README.md rename include/{ => Athena}/ALTTPEnums.hpp (99%) create mode 100644 include/Athena/ALTTPEnums.hpp.autosave rename include/{ => Athena}/ALTTPFile.hpp (94%) create mode 100644 include/Athena/ALTTPFile.hpp.autosave rename include/{ => Athena}/ALTTPFileReader.hpp (95%) create mode 100644 include/Athena/ALTTPFileReader.hpp.autosave rename include/{ => Athena}/ALTTPFileWriter.hpp (92%) create mode 100644 include/Athena/ALTTPFileWriter.hpp.autosave rename include/{ => Athena}/ALTTPQuest.hpp (95%) create mode 100644 include/Athena/ALTTPQuest.hpp.autosave rename include/{ => Athena}/ALTTPStructs.hpp (94%) create mode 100644 include/Athena/ALTTPStructs.hpp.autosave rename include/{ => Athena}/BinaryReader.hpp (56%) create mode 100644 include/Athena/BinaryReader.hpp.autosave create mode 100644 include/Athena/BinaryWriter.hpp create mode 100644 include/Athena/Checksums.hpp rename include/{ => Athena}/Compression.hpp (78%) rename include/{ => Athena}/Exception.hpp (58%) rename include/{ => Athena}/FileNotFoundException.hpp (66%) create mode 100644 include/Athena/FileReader.hpp create mode 100644 include/Athena/FileWriter.hpp create mode 100644 include/Athena/Global.hpp rename include/{ => Athena}/IOException.hpp (68%) create mode 100644 include/Athena/InvalidDataException.hpp rename include/{ => Athena}/InvalidOperationException.hpp (65%) rename include/{ => Athena}/MCFile.hpp (73%) rename include/{ => Athena}/MCFileReader.hpp (84%) rename include/{ => Athena}/MCFileWriter.hpp (87%) create mode 100644 include/Athena/NotImplementedException.hpp create mode 100644 include/Athena/SkywardSwordFile.hpp create mode 100644 include/Athena/SkywardSwordFileReader.hpp create mode 100644 include/Athena/SkywardSwordFileWriter.hpp create mode 100644 include/Athena/SkywardSwordQuest.hpp rename include/{ => Athena}/Sprite.hpp (81%) rename include/{ => Athena}/SpriteFile.hpp (85%) create mode 100644 include/Athena/SpriteFileReader.hpp create mode 100644 include/Athena/SpriteFileWriter.hpp rename include/{ => Athena}/SpriteFrame.hpp (65%) rename include/{ => Athena}/SpritePart.hpp (84%) create mode 100644 include/Athena/Stream.hpp rename include/{ => Athena}/Types.hpp (64%) rename include/{utility.hpp => Athena/Utility.hpp} (78%) rename include/{ => Athena}/WiiBanner.hpp (88%) rename include/{ => Athena}/WiiFile.hpp (79%) rename include/{ => Athena}/WiiImage.hpp (85%) rename include/{ => Athena}/WiiSave.hpp (82%) rename include/{ => Athena}/WiiSaveReader.hpp (83%) rename include/{ => Athena}/WiiSaveWriter.hpp (85%) rename include/{ => Athena}/ZQuestFile.hpp (92%) rename include/{ => Athena}/ZQuestFileReader.hpp (81%) rename include/{ => Athena}/ZQuestFileWriter.hpp (79%) delete mode 100644 include/BinaryWriter.hpp delete mode 100644 include/Checksums.hpp delete mode 100644 include/InvalidDataException.hpp delete mode 100644 include/Mainpage.hpp delete mode 100644 include/SkywardSwordFile.hpp delete mode 100644 include/SkywardSwordFileReader.hpp delete mode 100644 include/SkywardSwordFileWriter.hpp delete mode 100644 include/SkywardSwordQuest.hpp delete mode 100644 include/SpriteFileReader.hpp delete mode 100644 include/SpriteFileWriter.hpp delete mode 100644 include/Stream.hpp delete mode 100644 include/TextStream.hpp delete mode 100644 libzelda.cbp delete mode 100644 libzelda.conf delete mode 100644 libzelda.layout delete mode 100644 libzelda.png delete mode 100644 libzelda.pri delete mode 100644 libzelda.pro delete mode 100644 libzelda.vcproj delete mode 100644 libzelda_wii.cbp delete mode 100644 license.txt rename src/{ => Athena}/ALTTPFile.cpp (62%) rename src/{ => Athena}/ALTTPFileReader.cpp (86%) rename src/{ => Athena}/ALTTPFileWriter.cpp (85%) rename src/{ => Athena}/ALTTPQuest.cpp (86%) create mode 100644 src/Athena/BinaryReader.cpp create mode 100644 src/Athena/BinaryWriter.cpp rename src/{ => Athena}/Checksums.cpp (92%) rename src/{ => Athena}/Compression.cpp (99%) create mode 100644 src/Athena/FileReader.cpp create mode 100644 src/Athena/FileWriter.cpp create mode 100644 src/Athena/Global.cpp rename src/{ => Athena}/MCFile.cpp (62%) rename src/{ => Athena}/MCFileReader.cpp (69%) rename src/{ => Athena}/MCFileWriter.cpp (88%) create mode 100644 src/Athena/SkywardSwordFile.cpp create mode 100644 src/Athena/SkywardSwordFileReader.cpp create mode 100644 src/Athena/SkywardSwordFileWriter.cpp create mode 100644 src/Athena/SkywardSwordQuest.cpp rename src/{ => Athena}/Sprite.cpp (85%) rename src/{ => Athena}/SpriteFile.cpp (86%) rename src/{ => Athena}/SpriteFileReader.cpp (75%) rename src/{ => Athena}/SpriteFileWriter.cpp (52%) rename src/{ => Athena}/SpriteFrame.cpp (53%) rename src/{ => Athena}/SpritePart.cpp (79%) rename src/{utility.cpp => Athena/Utility.cpp} (82%) rename src/{ => Athena}/WiiBanner.cpp (83%) rename src/{ => Athena}/WiiFile.cpp (84%) rename src/{ => Athena}/WiiImage.cpp (89%) rename src/{ => Athena}/WiiSave.cpp (81%) rename src/{ => Athena}/WiiSaveReader.cpp (75%) rename src/{ => Athena}/WiiSaveWriter.cpp (75%) rename src/{ => Athena}/ZQuestFile.cpp (91%) rename src/{ => Athena}/ZQuestFileReader.cpp (62%) rename src/{ => Athena}/ZQuestFileWriter.cpp (67%) delete mode 100644 src/BinaryReader.cpp delete mode 100644 src/BinaryWriter.cpp delete mode 100644 src/SkywardSwordFile.cpp delete mode 100644 src/SkywardSwordFileReader.cpp delete mode 100644 src/SkywardSwordFileWriter.cpp delete mode 100644 src/SkywardSwordQuest.cpp delete mode 100644 src/Stream.cpp delete mode 100644 src/TextStream.cpp diff --git a/.travis.yml b/.travis.yml index 6ad8a79..d46ae3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,17 @@ -install: - - sudo apt-get update - - sudo apt-get install qt4-qmake +compiler: + - gcc-4.8 + +before_install: + - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa + - sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test + - sudo apt-get update -qq + - sudo apt-get install -qq g++-4.8 + - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 + - sudo update-alternatives --config gcc script: - - qmake libzelda.pro - - make + - qmake Athena.pro + - make notifications: - irc: "irc.wiiking.com#wiiking2" + irc: "irc.wiiking2.com#wiiking2" diff --git a/Athena.pri b/Athena.pri new file mode 100644 index 0000000..9b606a7 --- /dev/null +++ b/Athena.pri @@ -0,0 +1,108 @@ +INCLUDEPATH += $$PWD/include + +unix:LIBS += -lz +win32:LIBS += -lzlib +QMAKE_CXXFLAGS += -std=c++11 +CONFIG -= qt + +SOURCES += \ + $$PWD/src/Athena/Utility.cpp \ + $$PWD/src/Athena/FileReader.cpp \ + $$PWD/src/Athena/FileWriter.cpp \ + $$PWD/src/Athena/BinaryReader.cpp \ + $$PWD/src/Athena/BinaryWriter.cpp \ + $$PWD/src/Athena/Global.cpp \ + $$PWD/src/Athena/ALTTPFile.cpp \ + $$PWD/src/Athena/ALTTPFileReader.cpp \ + $$PWD/Athena/ALTTPFileWriter.cpp \ + $$PWD/Athena/ALTTPQuest.cpp \ + $$PWD/Athena/Checksums.cpp \ + $$PWD/Athena/Compression.cpp \ + $$PWD/Athena/MCFile.cpp \ + $$PWD/Athena/MCFileReader.cpp \ + $$PWD/Athena/MCFileWriter.cpp \ + $$PWD/Athena/SkywardSwordFile.cpp \ + $$PWD/Athena/SkywardSwordFileReader.cpp \ + $$PWD/Athena/SkywardSwordFileWriter.cpp \ + $$PWD/Athena/SkywardSwordQuest.cpp \ + $$PWD/Athena/Sprite.cpp \ + $$PWD/Athena/SpriteFile.cpp \ + $$PWD/Athena/SpriteFileReader.cpp \ + $$PWD/Athena/SpriteFileWriter.cpp \ + $$PWD/Athena/SpriteFrame.cpp \ + $$PWD/Athena/SpritePart.cpp \ + $$PWD/Athena/WiiBanner.cpp \ + $$PWD/Athena/WiiFile.cpp \ + $$PWD/Athena/WiiImage.cpp \ + $$PWD/Athena/WiiSave.cpp \ + $$PWD/Athena/WiiSaveReader.cpp \ + $$PWD/Athena/WiiSaveWriter.cpp \ + $$PWD/Athena/ZQuestFile.cpp \ + $$PWD/Athena/ZQuestFileReader.cpp \ + $$PWD/Athena/ZQuestFileWriter.cpp \ + $$PWD/bn.cpp \ + $$PWD/ec.cpp \ + $$PWD/md5.cpp \ + $$PWD/sha1.cpp \ + $$PWD/aes.c \ + $$PWD/lzo.c + +HEADERS += \ + $$PWD/Athena/Stream.hpp \ + $$PWD/Athena/Types.hpp \ + $$PWD/Athena/Utility.hpp \ + $$PWD/Athena/Global.hpp \ + $$PWD/Athena/Exception.hpp \ + $$PWD/Athena/FileNotFoundException.hpp \ + $$PWD/Athena/IOException.hpp \ + $$PWD/Athena/InvalidDataException.hpp \ + $$PWD/Athena/InvalidOperationException.hpp \ + $$PWD/Athena/FileReader.hpp \ + $$PWD/Athena/FileWriter.hpp \ + $$PWD/utf8.h \ + $$PWD/utf8/checked.h \ + $$PWD/utf8/core.h \ + $$PWD/utf8/unchecked.h \ + $$PWD/Athena/BinaryReader.hpp \ + $$PWD/Athena/BinaryWriter.hpp \ + $$PWD/Athena/NotImplementedException.hpp \ + $$PWD/aes.h \ + $$PWD/bn.h \ + $$PWD/ec.h \ + $$PWD/lzo.h \ + $$PWD/md5.h \ + $$PWD/sha1.h \ + $$PWD/Athena/ALTTPEnums.hpp \ + $$PWD/Athena/ALTTPFile.hpp \ + $$PWD/Athena/ALTTPFileReader.hpp \ + $$PWD/Athena/ALTTPFileWriter.hpp \ + $$PWD/Athena/ALTTPQuest.hpp \ + $$PWD/Athena/ALTTPStructs.hpp \ + $$PWD/Athena/Checksums.hpp \ + $$PWD/Athena/Compression.hpp \ + $$PWD/Athena/MCFile.hpp \ + $$PWD/Athena/MCFileReader.hpp \ + $$PWD/Athena/MCFileWriter.hpp \ + $$PWD/Athena/SkywardSwordFile.hpp \ + $$PWD/Athena/SkywardSwordFileReader.hpp \ + $$PWD/Athena/SkywardSwordFileWriter.hpp \ + $$PWD/Athena/SkywardSwordQuest.hpp \ + $$PWD/Athena/Sprite.hpp \ + $$PWD/Athena/SpriteFile.hpp \ + $$PWD/Athena/SpriteFileReader.hpp \ + $$PWD/Athena/SpriteFileWriter.hpp \ + $$PWD/Athena/SpriteFrame.hpp \ + $$PWD/Athena/SpritePart.hpp \ + $$PWD/Athena/WiiBanner.hpp \ + $$PWD/Athena/WiiFile.hpp \ + $$PWD/Athena/WiiImage.hpp \ + $$PWD/Athena/WiiSave.hpp \ + $$PWD/Athena/WiiSaveReader.hpp \ + $$PWD/Athena/WiiSaveWriter.hpp \ + $$PWD/Athena/ZQuestFile.hpp \ + $$PWD/Athena/ZQuestFileReader.hpp \ + $$PWD/Athena/ZQuestFileWriter.hpp + +OTHER_FILES += \ + .travis.yml + diff --git a/Athena.pro b/Athena.pro new file mode 100644 index 0000000..0491fe9 --- /dev/null +++ b/Athena.pro @@ -0,0 +1,137 @@ +CONFIG += staticlib +TEMPLATE= lib +DESTDIR = ./lib + +# Uncomment this if you wish to use Qt with libAthena +#DEFINES += ATHENA_USE_QT + +contains(DEFINES, ATHENA_USE_QT){ + QT += core +} + +CONFIG(debug, debug|release){ + DEFINES += DEBUG + TARGET=Athena-d + # We don't want the objects, + # in the project directory, so tell qmake + # where to put them + OBJECTS_DIR = obj/debug +} + +CONFIG(release, release|debug){ + DEFINES -= DEBUG + TARGET=Athena + # We don't want the objects, + # in the project directory, so tell qmake + # where to put them + OBJECTS_DIR = obj/release +} + +QMAKE_CXXFLAGS += -std=c++11 +INCLUDEPATH += include +CONFIG -= qt + + +SOURCES += \ + src/Athena/Utility.cpp \ + src/Athena/FileReader.cpp \ + src/Athena/FileWriter.cpp \ + src/Athena/BinaryReader.cpp \ + src/Athena/BinaryWriter.cpp \ + src/Athena/Global.cpp \ + src/Athena/ALTTPFile.cpp \ + src/Athena/ALTTPFileReader.cpp \ + src/Athena/ALTTPFileWriter.cpp \ + src/Athena/ALTTPQuest.cpp \ + src/Athena/Checksums.cpp \ + src/Athena/Compression.cpp \ + src/Athena/MCFile.cpp \ + src/Athena/MCFileReader.cpp \ + src/Athena/MCFileWriter.cpp \ + src/Athena/SkywardSwordFile.cpp \ + src/Athena/SkywardSwordFileReader.cpp \ + src/Athena/SkywardSwordFileWriter.cpp \ + src/Athena/SkywardSwordQuest.cpp \ + src/Athena/Sprite.cpp \ + src/Athena/SpriteFile.cpp \ + src/Athena/SpriteFileReader.cpp \ + src/Athena/SpriteFileWriter.cpp \ + src/Athena/SpriteFrame.cpp \ + src/Athena/SpritePart.cpp \ + src/Athena/WiiBanner.cpp \ + src/Athena/WiiFile.cpp \ + src/Athena/WiiImage.cpp \ + src/Athena/WiiSave.cpp \ + src/Athena/WiiSaveReader.cpp \ + src/Athena/WiiSaveWriter.cpp \ + src/Athena/ZQuestFile.cpp \ + src/Athena/ZQuestFileReader.cpp \ + src/Athena/ZQuestFileWriter.cpp \ + src/bn.cpp \ + src/ec.cpp \ + src/md5.cpp \ + src/sha1.cpp \ + src/aes.c \ + src/lzo.c + +INCLUDEPATH += \ + include + +HEADERS += \ + include/Athena/Stream.hpp \ + include/Athena/Types.hpp \ + include/Athena/Utility.hpp \ + include/Athena/Global.hpp \ + include/Athena/Exception.hpp \ + include/Athena/FileNotFoundException.hpp \ + include/Athena/IOException.hpp \ + include/Athena/InvalidDataException.hpp \ + include/Athena/InvalidOperationException.hpp \ + include/Athena/FileReader.hpp \ + include/Athena/FileWriter.hpp \ + include/utf8.h \ + include/utf8/checked.h \ + include/utf8/core.h \ + include/utf8/unchecked.h \ + include/Athena/BinaryReader.hpp \ + include/Athena/BinaryWriter.hpp \ + include/Athena/NotImplementedException.hpp \ + include/aes.h \ + include/bn.h \ + include/ec.h \ + include/lzo.h \ + include/md5.h \ + include/sha1.h \ + include/Athena/ALTTPEnums.hpp \ + include/Athena/ALTTPFile.hpp \ + include/Athena/ALTTPFileReader.hpp \ + include/Athena/ALTTPFileWriter.hpp \ + include/Athena/ALTTPQuest.hpp \ + include/Athena/ALTTPStructs.hpp \ + include/Athena/Checksums.hpp \ + include/Athena/Compression.hpp \ + include/Athena/MCFile.hpp \ + include/Athena/MCFileReader.hpp \ + include/Athena/MCFileWriter.hpp \ + include/Athena/SkywardSwordFile.hpp \ + include/Athena/SkywardSwordFileReader.hpp \ + include/Athena/SkywardSwordFileWriter.hpp \ + include/Athena/SkywardSwordQuest.hpp \ + include/Athena/Sprite.hpp \ + include/Athena/SpriteFile.hpp \ + include/Athena/SpriteFileReader.hpp \ + include/Athena/SpriteFileWriter.hpp \ + include/Athena/SpriteFrame.hpp \ + include/Athena/SpritePart.hpp \ + include/Athena/WiiBanner.hpp \ + include/Athena/WiiFile.hpp \ + include/Athena/WiiImage.hpp \ + include/Athena/WiiSave.hpp \ + include/Athena/WiiSaveReader.hpp \ + include/Athena/WiiSaveWriter.hpp \ + include/Athena/ZQuestFile.hpp \ + include/Athena/ZQuestFileReader.hpp \ + include/Athena/ZQuestFileWriter.hpp + +OTHER_FILES += \ + .travis.yml diff --git a/README.md b/README.md deleted file mode 100644 index 1fafc95..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -libZelda provides several basic classes that can be used to read from -and write to files, and memory, classes such as Stream, BinaryReader, -BinaryWriter, and the currently work in progress TextStream. - -[![Build Status](https://travis-ci.org/Antidote/libzelda.png?branch=master)](https://travis-ci.org/Antidote/libzelda) diff --git a/include/ALTTPEnums.hpp b/include/Athena/ALTTPEnums.hpp similarity index 99% rename from include/ALTTPEnums.hpp rename to include/Athena/ALTTPEnums.hpp index 8b2344e..c5f557c 100644 --- a/include/ALTTPEnums.hpp +++ b/include/Athena/ALTTPEnums.hpp @@ -20,7 +20,7 @@ #include "Types.hpp" -namespace zelda +namespace Athena { enum BowType : char diff --git a/include/Athena/ALTTPEnums.hpp.autosave b/include/Athena/ALTTPEnums.hpp.autosave new file mode 100644 index 0000000..9bdb74b --- /dev/null +++ b/include/Athena/ALTTPEnums.hpp.autosave @@ -0,0 +1,113 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef __ALTTP_ENUMS_HPP__ +#define __ALTTP_ENUMS_HPP__ + +#ifndef __DOXYGEN_IGNORE__ + +#include "Types.hpp" + +namespace Athena +{ + +enum BowType : char +{ + BowNone, + BowArrows, + BowSilverArrows +}; + +enum BoomerangType : char +{ + BoomerangNone, + BoomerangBlue, + BoomerangRed +}; + +enum MagicType : char +{ + MagicNone, + MagicMushroom, + MagicPowder +}; + +enum ArmorType : char +{ + GreenJerkin, + BlueMail, + RedMail +}; + +enum BottleType : char +{ + BottleNone, + BottleMushroom, // No Use + BottleEmpty, + BottleRedPotion, + BottleBluePotion, + BottleFairy, + BottleBee, + BottleGoodBee +}; + + +enum ALTTPStartLocation +{ + LinksHouse = 0x00, + Sanctuary = 0x01, + Any = 0x05 +}; + +enum ALTTPProgressIndicator +{ + LinkInBed, + InCastleWithSword, + CompletedFirstDungeon, + BeatenAghanim +}; + +enum ALTTPMapIcon +{ + Nothing = 0x00, //? + CrossInKakariko = 0x01, //? + CrossAtFirstDungeon = 0x02, // + Pendant = 0x03, + MasterSword = 0x04, + AganhimCastle = 0x05, + Crystal1 = 0x06, + AllCrystals = 0x07, + AganhimGanonTower = 0x08 +}; + +enum ALTTPTagAlong +{ + Noone, + Zelda, + Unknown1, + Oldman, + ZeldaMessage, + Blind, + DwarfFrog, + DwarfLW, + Kiki, + Unknown2, + TheifsChest, + AfterBoss +}; + +} // zelda +#endif // __DOXYGEN_IGNORE__ +#endif // __ALTTP_ENUMS_HPP__ diff --git a/include/ALTTPFile.hpp b/include/Athena/ALTTPFile.hpp similarity index 94% rename from include/ALTTPFile.hpp rename to include/Athena/ALTTPFile.hpp index f2ec7fa..8c88bf5 100644 --- a/include/ALTTPFile.hpp +++ b/include/Athena/ALTTPFile.hpp @@ -16,10 +16,10 @@ #ifndef __ALTTP_FILE_HPP__ #define __ALTTP_FILE_HPP__ -#include +#include "Athena/Types.hpp" #include -namespace zelda +namespace Athena { class ALTTPQuest; diff --git a/include/Athena/ALTTPFile.hpp.autosave b/include/Athena/ALTTPFile.hpp.autosave new file mode 100644 index 0000000..d952ff6 --- /dev/null +++ b/include/Athena/ALTTPFile.hpp.autosave @@ -0,0 +1,91 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef __ALTTP_FILE_HPP__ +#define __ALTTP_FILE_HPP__ + +#include "Athena/Types.hpp" +#include + +namespace Athena +{ + +class ALTTPQuest; + +/*! \class ALTTPFile + * \brief A Link to the Past data container class class + * + * Contains all relevant data for an A Link to the Past + * SRM file. + */ +class ALTTPFile +{ +public: + /*! \brief Quest Iterator + * + * An Iterator typedef for iterating through the Quest lists + */ + typedef std::vector::iterator QuestIter; + + /*! \brief Default constructor + * + * + */ + ALTTPFile(); + + /*! \brief Constructor + * + * \param questList The primary quest list + * \param backupList The backup quest list + */ + ALTTPFile(std::vector questList, std::vector backupList); + + + /*! \brief Sets a quest at the given index + * + * \param id Index to the given quest + * \param val The new quest to assign to the given index + * \throw InvalidOperationException on index out of range + */ + void setQuest(Uint32 id, ALTTPQuest* val); + /*! \brief Returns the primary quest list + * + * \return The primary quest list + */ + std::vector questList() const; + + /*! \brief Returns a quest at the given index + * + * Returns a quest at the given index + * + * \return ALTTPQuest* + * \throw InvalidOperationException on index out of range + */ + ALTTPQuest* quest(Uint32 id) const; + + /*! \brief Returns the number of primary quests + * + * \return The number of quests + */ + Uint32 questCount() const; + +private: + + std::vector m_quests; + std::vector m_backup; +}; + +} // zelda +#endif // __ALTTP_FILE_HPP__ diff --git a/include/ALTTPFileReader.hpp b/include/Athena/ALTTPFileReader.hpp similarity index 95% rename from include/ALTTPFileReader.hpp rename to include/Athena/ALTTPFileReader.hpp index d5d4774..b105d49 100644 --- a/include/ALTTPFileReader.hpp +++ b/include/Athena/ALTTPFileReader.hpp @@ -21,7 +21,7 @@ #include "BinaryReader.hpp" #include "ALTTPQuest.hpp" -namespace zelda +namespace Athena { class ALTTPFile; diff --git a/include/Athena/ALTTPFileReader.hpp.autosave b/include/Athena/ALTTPFileReader.hpp.autosave new file mode 100644 index 0000000..0d4b406 --- /dev/null +++ b/include/Athena/ALTTPFileReader.hpp.autosave @@ -0,0 +1,68 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef __ALTTP_FILE_READER_HPP__ +#define __ALTTP_FILE_READER_HPP__ + +#include +#include "Types.hpp" +#include "BinaryReader.hpp" +#include "ALTTPQuest.hpp" + +namespace Athena +{ +class ALTTPFile; + +namespace io +{ +/*! \class ALTTPFileReader + * \brief A Link to the Past save data reader class + * + * A Class for reading binary data from an ALTTP Save File, + * all work is done using a memory buffer, and not read directly from the disk. + * \sa BinaryReader + */ +class ALTTPFileReader : protected BinaryReader +{ + BINARYREADER_BASE + +public: + /*! \brief This constructor takes an existing buffer to read from. + * + * \param data The existing buffer + * \param length The length of the existing buffer + */ + ALTTPFileReader(Uint8*, Uint64); + + /*! \brief This constructor creates an instance from a file on disk. + * + * \param filename The file to create the stream from + */ + ALTTPFileReader(const std::string&); + + /*! \brief Reads the SRAM data from the buffer + * + * \return ALTTPFile* SRAM data + */ + ALTTPFile* readFile(); +private: + ALTTPRoomFlags* readRoomFlags(); + ALTTPOverworldEvent* readOverworldEvent(); + ALTTPDungeonItemFlags readDungeonFlags(); +}; + +} // io +} // zelda +#endif // __ALTTP_FILE_READER_HPP__ diff --git a/include/ALTTPFileWriter.hpp b/include/Athena/ALTTPFileWriter.hpp similarity index 92% rename from include/ALTTPFileWriter.hpp rename to include/Athena/ALTTPFileWriter.hpp index 825e95e..8a60b94 100644 --- a/include/ALTTPFileWriter.hpp +++ b/include/Athena/ALTTPFileWriter.hpp @@ -17,11 +17,10 @@ #define __ALTTP_FILE_WRITER_HPP__ #include -#include -#include -#include "ALTTPQuest.hpp" +#include "Athena/BinaryWriter.hpp" +#include "Athena/ALTTPQuest.hpp" -namespace zelda +namespace Athena { class ALTTPFile; diff --git a/include/Athena/ALTTPFileWriter.hpp.autosave b/include/Athena/ALTTPFileWriter.hpp.autosave new file mode 100644 index 0000000..bf35f22 --- /dev/null +++ b/include/Athena/ALTTPFileWriter.hpp.autosave @@ -0,0 +1,70 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef __ALTTP_FILE_WRITER_HPP__ +#define __ALTTP_FILE_WRITER_HPP__ + +#include +#include "Athena/BinaryWriter.hpp" +#include "Athena/ALTTPQuest.hpp" + +namespace Athena +{ +class ALTTPFile; + +namespace io +{ +/*! \class ALTTPFileWriter + * \brief A Link to the Past save data writer class + * + * A Class for writing binary data to an ALTTP Save File, + * all work is done using a memory buffer, and not written directly to the disk. + * \sa BinaryReader + */ +class ALTTPFileWriter : protected BinaryWriter +{ + BINARYWRITER_BASE + +public: + /*! \brief This constructor takes an existing buffer to write to. + * + * \param data The existing buffer + * \param length The length of the existing buffer + */ + ALTTPFileWriter(Uint8*, Uint64); + + /*! \brief This constructor creates an instance from a file on disk. + * + * \param filename The file to create the stream from + */ + ALTTPFileWriter(const std::string&); + + /*! \brief Writes the given SRAM data to a file on disk + * + * \param file SRAM data to right + */ + void writeFile(ALTTPFile* file); + +private: + void writeRoomFlags(ALTTPRoomFlags*); + void writeOverworldEvent(ALTTPOverworldEvent*); + void writeDungeonItems(ALTTPDungeonItemFlags); + Uint16 calculateChecksum(Uint32 game); +}; + +} // io +} // zelda + +#endif // __ALTTP_FILE_WRITER_HPP__ diff --git a/include/ALTTPQuest.hpp b/include/Athena/ALTTPQuest.hpp similarity index 95% rename from include/ALTTPQuest.hpp rename to include/Athena/ALTTPQuest.hpp index 31cf51b..d8e27d1 100644 --- a/include/ALTTPQuest.hpp +++ b/include/Athena/ALTTPQuest.hpp @@ -22,7 +22,7 @@ #include "ALTTPStructs.hpp" #include "ALTTPEnums.hpp" -namespace zelda +namespace Athena { /*! \class ALTTPQuest diff --git a/include/Athena/ALTTPQuest.hpp.autosave b/include/Athena/ALTTPQuest.hpp.autosave new file mode 100644 index 0000000..bc91729 --- /dev/null +++ b/include/Athena/ALTTPQuest.hpp.autosave @@ -0,0 +1,685 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see +#ifndef __ALTTP_QUEST_HPP__ +#define __ALTTP_QUEST_HPP__ + +#include "Types.hpp" +#include +#include +#include "ALTTPStructs.hpp" +#include "ALTTPEnums.hpp" + +namespace Athena +{ + +/*! \class ALTTPQuest + * \brief A Link to the Past Quest container class + * + * Contains all relevant data for an A Link to the Past + * Quest entry. + */ +class ALTTPQuest +{ +public: + /*! + * \brief ALTTPQuest + */ + ALTTPQuest(); + ~ALTTPQuest(); + + /*! + * \brief setRoomFlags + * \param flags + */ + void setRoomFlags(std::vector flags); + + /*! + * \brief setRoomFlags + * \param rf + * \param id + */ + void setRoomFlags(ALTTPRoomFlags* rf, Uint32 id); + + /*! + * \brief roomFlags + * \return + */ + std::vector roomFlags(); + + /*! + * \brief roomFlags + * \param id + * \return + */ + ALTTPRoomFlags* roomFlags(Uint32 id); + + /*! + * \brief setOverworldEvents + * \param events + */ + void setOverworldEvents(std::vector events); + + /*! + * \brief setOverworldEvents + * \param ow + * \param id + */ + void setOverworldEvents(ALTTPOverworldEvent* ow, Uint32 id); + + /*! + * \brief overworldEvents + * \return + */ + std::vector overworldEvents() const; + + /*! + * \brief overworldEvent + * \param id + * \return + */ + ALTTPOverworldEvent* overworldEvent(Uint32 id) const; + + /*! + * \brief setInventory + * \param inv + */ + void setInventory(ALTTPInventory* inv); + + /*! + * \brief inventory + * \return + */ + ALTTPInventory* inventory() const; + + /*! + * \brief setRupeeMax + * \param val + */ + void setRupeeMax(Uint16 val); + + /*! + * \brief rupeeMax + * \return + */ + Uint16 rupeeMax() const; + + /*! + * \brief setRupeeCurrent + * \param val + */ + void setRupeeCurrent(Uint16 val); + + /*! + * \brief rupeeCurrent + * \return + */ + Uint16 rupeeCurrent() const; + + /*! + * \brief setCompasses + * \param flags + */ + void setCompasses(ALTTPDungeonItemFlags flags); + + /*! + * \brief compasses + * \return + */ + ALTTPDungeonItemFlags compasses() const; + + /*! + * \brief setBigKeys + * \param flags + */ + void setBigKeys(ALTTPDungeonItemFlags flags); + + /*! + * \brief bigKeys + * \return + */ + ALTTPDungeonItemFlags bigKeys() const; + + /*! + * \brief setDungeonMaps + * \param flags + */ + void setDungeonMaps(ALTTPDungeonItemFlags flags); + + /*! + * \brief dungeonMaps + * \return + */ + ALTTPDungeonItemFlags dungeonMaps() const; + + /*! + * \brief setWishingPond + * \param val + */ + void setWishingPond(Uint16 val); + + /*! + * \brief wishingPond + * \return + */ + Uint16 wishingPond() const; + + /*! + * \brief setHealthMax + * \param val + */ + void setHealthMax(Uint8 val); + + /*! + * \brief healthMax + * \return + */ + Uint8 healthMax() const; + + /*! + * \brief setHealth + * \param val + */ + void setHealth(Uint8 val); + + /*! + * \brief health + * \return + */ + Uint8 health() const; + + /*! + * \brief setMagicPower + * \param val + */ + void setMagicPower(Uint8 val); + + /*! + * \brief magicPower + * \return + */ + Uint8 magicPower() const; + + /*! + * \brief setKeys + * \param val + */ + void setKeys(Uint8 val); + + /*! + * \brief keys + * \return + */ + Uint8 keys() const; + + /*! + * \brief setBombUpgrades + * \param val + */ + void setBombUpgrades(Uint8 val); + + /*! + * \brief bombUpgrades + * \return + */ + Uint8 bombUpgrades() const; + + /*! + * \brief setArrowUpgrades + * \param val + */ + void setArrowUpgrades(Uint8 val); + + /*! + * \brief arrowUpgrades + * \return + */ + Uint8 arrowUpgrades() const; + + /*! + * \brief setHealthFiller + * \param val + */ + void setHealthFiller(Uint8 val); + + /*! + * \brief healthFiller + * \return + */ + Uint8 healthFiller() const; + + /*! + * \brief setMagicFiller + * \param val + */ + void setMagicFiller(Uint8 val); + + /*! + * \brief magicFiller + * \return + */ + Uint8 magicFiller() const; + + /*! + * \brief setPendants + * \param val + */ + void setPendants(ALTTPPendants val); + + /*! + * \brief pendants + * \return + */ + ALTTPPendants pendants() const; + + /*! + * \brief setBombFiller + * \param val + */ + void setBombFiller(Uint8 val); + + /*! + * \brief bombFiller + * \return + */ + Uint8 bombFiller() const; + + /*! + * \brief setArrowFiller + * \param val + */ + void setArrowFiller(Uint8 val); + + /*! + * \brief arrowFiller + * \return + */ + Uint8 arrowFiller() const; + + /*! + * \brief setArrows + * \param val + */ + void setArrows(Uint8 val); + + /*! + * \brief arrows + * \return + */ + Uint8 arrows() const; + + /*! + * \brief setAbilityFlags + * \param val + */ + void setAbilityFlags(ALTTPAbilities val); + + /*! + * \brief abilityFlags + * \return + */ + ALTTPAbilities abilityFlags() const; + + /*! + * \brief setCrystals + * \param val + */ + void setCrystals(ALTTPCrystals val);\ + + /*! + * \brief crystals + * \return + */ + ALTTPCrystals crystals() const; + + /*! + * \brief setMagicUsage + * \param val + */ + void setMagicUsage(ALTTPMagicUsage val); + + /*! + * \brief magicUsage + * \return + */ + ALTTPMagicUsage magicUsage() const; + + /*! + * \brief setDungeonKeys + * \param val + */ + void setDungeonKeys(std::vector val); + + /*! + * \brief setDungeonKeys + * \param id + * \param val + */ + void setDungeonKeys(Uint32 id, Uint8 val); + + /*! + * \brief dungeonKeys + * \param id + * \return + */ + Uint8 dungeonKeys(Uint32 id) const; + + /*! + * \brief dungeonCount + * \return + */ + Uint32 dungeonCount() const; + + /*! + * \brief setProgressIndicator + * \param val + */ + void setProgressIndicator(ALTTPProgressIndicator val); + + /*! + * \brief progressIndicator + * \return + */ + ALTTPProgressIndicator progressIndicator() const; + + /*! + * \brief setProgressFlags1 + * \param val + */ + void setProgressFlags1(ALTTPProgressFlags1 val); + + /*! + * \brief progressFlags1 + * \return + */ + ALTTPProgressFlags1 progressFlags1() const; + + /*! + * \brief setMapIcon + * \param val + */ + void setMapIcon(ALTTPMapIcon val); + + /*! + * \brief mapIcon + * \return + */ + ALTTPMapIcon mapIcon() const; + + /*! + * \brief setStartLocation + * \param val + */ + void setStartLocation(ALTTPStartLocation val); + + /*! + * \brief startLocation + * \return + */ + ALTTPStartLocation startLocation() const; + + /*! + * \brief setProgressFlags2 + * \param val + */ + void setProgressFlags2(ALTTPProgressFlags2 val); + + /*! + * \brief progressFlags2 + * \return + */ + ALTTPProgressFlags2 progressFlags2() const; + + /*! + * \brief setLightDarkWorldIndicator + * \param val + */ + void setLightDarkWorldIndicator(ALTTPLightDarkWorldIndicator val); + + /*! + * \brief lightDarkWorldIndicator + * \return + */ + ALTTPLightDarkWorldIndicator lightDarkWorldIndicator() const; + + /*! + * \brief setTagAlong + * \param val + */ + void setTagAlong(ALTTPTagAlong val); + + /*! + * \brief tagAlong + * \return + */ + ALTTPTagAlong tagAlong() const; + + /*! + * \brief setOldManFlags + * \param flags + */ + void setOldManFlags(std::vector flags); + + /*! + * \brief setOldManFlag + * \param id + * \param val + */ + void setOldManFlag(Uint32 id, Uint8 val); + + /*! + * \brief oldManFlag + * \param id + * \return + */ + Uint8 oldManFlag(Uint32 id); + + /*! + * \brief oldManFlagCount + * \return + */ + Uint32 oldManFlagCount() const; + + /*! + * \brief setBombFlag + * \param flag + */ + void setBombFlag(Uint8 flag); + + /*! + * \brief bombFlag + * \return + */ + Uint8 bombFlag() const; + + /*! + * \brief setUnknown1 + * \param flags + */ + void setUnknown1(std::vector flags); + + /*! + * \brief setUnknown1 + * \param id + * \param val + */ + void setUnknown1(Uint32 id, Uint8 val); + + /*! + * \brief unknown1 + * \param id + * \return + */ + Uint8 unknown1(Uint32 id); + + /*! + * \brief unknown1Count + * \return + */ + Uint32 unknown1Count() const; + + /*! + * \brief setPlayerName + * \param playerName + */ + void setPlayerName(std::vector playerName); + /*! + * \brief setPlayerName + * \param playerName + */ + void setPlayerName(const std::string& playerName); + /*! + * \brief playerName + * \return + */ + std::vector playerName() const; + /*! + * \brief playerNameToString + * \return + */ + std::string playerNameToString() const; + + /*! + * \brief setValid + * \param val + */ + void setValid(bool val); + + /*! + * \brief valid + * \return + */ + bool valid(); + + /*! + * \brief setDungeonDeathTotals + * \param val + */ + void setDungeonDeathTotals(std::vector val); + + /*! + * \brief setDungeonDeathTotal + * \param id + * \param val + */ + void setDungeonDeathTotal(Uint32 id, Uint16 val); + + /*! + * \brief dungeonDeathTotal + * \param id + * \return + */ + Uint16 dungeonDeathTotal(Uint32 id) const; + + /*! + * \brief dungeonDeathTotalCount + * \return + */ + Uint16 dungeonDeathTotalCount() const; + + /*! + * \brief setUnknown2 + * \param val + */ + void setUnknown2(Uint16 val); + + /*! + * \brief unknown2 + * \return + */ + Uint16 unknown2() const; + + /*! + * \brief setDeathSaveCount + * \param val + */ + void setDeathSaveCount(Uint16 val); + + /*! + * \brief deathSaveCount + * \return + */ + Uint16 deathSaveCount() const; + + /*! + * \brief setPostGameDeathCounter + * \param val + */ + void setPostGameDeathCounter(Int16 val); + + /*! + * \brief postGameDeathCounter + * \return + */ + Int16 postGameDeathCounter() const; + + /*! + * \brief setChecksum + * \param checksum + */ + void setChecksum(Uint16 checksum); + + /*! + * \brief checksum + * \return + */ + Uint16 checksum() const; +private: + std::vector m_roomFlags; + std::vector m_overworldEvents; + ALTTPInventory* m_inventory; + Uint16 m_rupeeMax; + Uint16 m_rupeeCurrent; + ALTTPDungeonItemFlags m_compasses; + ALTTPDungeonItemFlags m_bigKeys; + ALTTPDungeonItemFlags m_dungeonMaps; + Uint16 m_wishingPond; + Uint8 m_healthMax; + Uint8 m_health; + Uint8 m_magicPower; + Uint8 m_keys; + Uint8 m_bombUpgrades; + Uint8 m_arrowUpgrades; + Uint8 m_heartFiller; + Uint8 m_magicFiller; + ALTTPPendants m_pendants; + Uint8 m_bombFiller; + Uint8 m_arrowFiller; + Uint8 m_arrows; + ALTTPAbilities m_abilityFlags; + ALTTPCrystals m_crystals; + ALTTPMagicUsage m_magicUsage; + std::vector m_dungeonKeys; + ALTTPProgressIndicator m_progressIndicator; + ALTTPProgressFlags1 m_progressFlags1; + ALTTPMapIcon m_mapIcon; + ALTTPStartLocation m_startLocation; + ALTTPProgressFlags2 m_progressFlags2; + ALTTPLightDarkWorldIndicator m_lightDarkWorldIndicator; + ALTTPTagAlong m_tagAlong; + std::vector m_oldManFlags; + Uint8 m_bombFlag; + std::vector m_unknown1; + std::vector m_playerName; + Uint16 m_valid; + std::vector m_dungeonDeathTotals; + Uint16 m_unknown2; + Uint16 m_deathSaveCount; + Int16 m_postGameDeathCounter; + Uint16 m_checksum; +}; + +} // zelda + +#endif // __ALTTP_QUEST_HPP__ diff --git a/include/ALTTPStructs.hpp b/include/Athena/ALTTPStructs.hpp similarity index 94% rename from include/ALTTPStructs.hpp rename to include/Athena/ALTTPStructs.hpp index f201ff7..1123fc7 100644 --- a/include/ALTTPStructs.hpp +++ b/include/Athena/ALTTPStructs.hpp @@ -21,7 +21,7 @@ #include #include "Types.hpp" -namespace zelda +namespace Athena { struct ALTTPRoomFlags diff --git a/include/Athena/ALTTPStructs.hpp.autosave b/include/Athena/ALTTPStructs.hpp.autosave new file mode 100644 index 0000000..bc41d62 --- /dev/null +++ b/include/Athena/ALTTPStructs.hpp.autosave @@ -0,0 +1,203 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef __ALTTP_STRUCTS_HPP__ +#define __ALTTP_STRUCTS_HPP__ + +#ifndef __DOXYGEN_IGNORE__ + +#include +#include "Types.hpp" + +namespace Athena +{ + +struct ALTTPRoomFlags +{ + bool Chest1:1; + bool Chest2:1; + bool Chest3:1; + bool Chest4:1; + bool Quadrant1:1; + bool Quadrant2:1; + bool Quadrant3:1; + bool Quadrant4:1; + bool Door1:1; + bool Door2:1; + bool Door3:1; + bool Door4:1; + bool BossBattleWon:1; + bool Key:1; + bool KeyOrChest:1; + bool ChestOrTile:1; +}; + +struct ALTTPOverworldEvent +{ + bool Unused1:1; + bool HeartPiece:1; + bool Overlay:1; + bool Unused2:1; + bool Unused3:1; + bool Unused4:1; + bool Set:1; + bool Unused5:1; +}; + +struct ALTTPInventory +{ + char Bow; + char Boomerang; + bool Hookshot; + char Bombs; // Bomb count + char Magic; + bool FireRod; + bool IceRod; + bool Bombos; + bool Ether; + bool Quake; + bool Torch; + bool Hammer; + char Flute; + bool BugNet; + bool Book; + bool Bottles; + bool Somaria; + bool Byrna; + bool MagicCape; + char MagicMirror; + char Gloves; + char Boots; + bool Flippers; + bool MoonPearl; + char Unused; //? + char Sword; + char Shield; + char Armor; + char BottleTypes[4]; +}; + +/*! \struct ALTTPLightDarkWorldIndicator + */ +struct ALTTPLightDarkWorldIndicator +{ + bool Unused1:1; + bool Unused2:1; + bool Unused3:1; + bool Unused4:1; + bool Unused5:1; + bool Unused6:1; + bool IsDarkWorld:1; + bool Unused7:1; +}; + + +struct ALTTPDungeonItemFlags +{ + bool Unused1:1; + bool Unused2:1; + bool GanonsTower:1; + bool TurtleRock:1; + bool GargoylesDomain:1; + bool TowerOfHera:1; + bool IcePalace:1; + bool SkullWoods:1; + bool MiseryMire:1; + bool DarkPalace:1; + bool SwampPalace:1; + bool HyruleCastle2:1; // Doesn't exists in orignal game + bool DesertPalace:1; + bool EasternPalace:1; + bool HyruleCastle:1; // Doesn't exist in original game + bool SewerPassage:1; // Doesn't exist in original game +}; + +struct ALTTPPendants +{ + bool Courage:1; + bool Wisdom:1; + bool Power:1; + bool Unused1:1; + bool Unused2:1; + bool Unused3:1; + bool Unused4:1; + bool Unused5:1; +}; + +struct ALTTPAbilities +{ + char Nothing:1; //? + char Swim:1; + char Dash:1; + char Pull:1; + char Unknown1:1; //--- + char Talk:1; + char Read:1; + char Unknown2:1; //--- +}; + +struct ALTTPCrystals +{ + bool MiseryMire:1; + bool DarkPalace:1; + bool IcePalace:1; + bool TurtleRock:1; + bool SwampPalace:1; + bool GargoyleDomain:1; + bool SkullWoods:1; +}; + +struct ALTTPMagicUsage +{ + bool Normal:1; + bool Half:1; + bool Quarter:1; + bool Unused1:1; + bool Unused2:1; + bool Unused3:1; + bool Unused4:1; + bool Unused5:1; +}; + + +struct ALTTPProgressFlags1 +{ + bool UncleSecretPassage:1; + bool DyingPriest:1; //? + bool ZeldaSanctuary:1; //? + bool Unused1:1; + bool UncleLeftHouse:1; + bool BookOfMudora:1;//? Math says it's a guess need to investigate + bool DwarfPartner:1; //? + bool Unused2:1; +}; + + +struct ALTTPProgressFlags2 +{ + bool BottleFromBum:1; + bool BottleFromSalesMen:1; + bool Unused1:1; //? + bool FluteBoy:1; + bool ThiefsChest:1; + bool SavedSmithPartner:1; + bool Unused2:1; //? + bool SmithsHaveSword:1; +}; + +} + +#endif // __DOXYGEN_IGNORE__ +#endif // __ALTTP_STRUCTS_HPP__ diff --git a/include/BinaryReader.hpp b/include/Athena/BinaryReader.hpp similarity index 56% rename from include/BinaryReader.hpp rename to include/Athena/BinaryReader.hpp index a549359..8edbeaa 100644 --- a/include/BinaryReader.hpp +++ b/include/Athena/BinaryReader.hpp @@ -20,11 +20,10 @@ #include #include -namespace zelda +namespace Athena { namespace io { - /*! \class BinaryReader * \brief A Stream class for reading binary data * @@ -42,16 +41,91 @@ public: * \param length The length of the existing buffer */ BinaryReader(const Uint8* data, Uint64 length); - /*! \brief This constructor takes an existing Stream to read from. - * - * \param stream The stream to read data from - */ - BinaryReader(const Stream& stream); + /*! \brief This constructor creates an instance from a file on disk. * * \param filename The file to create the stream from */ - BinaryReader(const std::string& filename); + BinaryReader(const std::string& filename, std::function progressFun = nullptr); + + ~BinaryReader(); + + /*! \brief Sets the Endianss of the stream + * + * \param endian The Endianess to set \sa Endian + */ + void setEndian(Endian endian); + + /*! \brief Returns the current Endianness of the stream + * + * \return Endian The current Stream Endianess + */ + Endian endian() const; + + /*! \brief Returns whether the stream is BigEndian + * + * \return bool True for BigEndian; False for LittleEndian + */ + bool isBigEndian() const; + + /*! \brief Returns whether the stream is LittleEndian + * + * \return bool True for LittleEndian; False for BigEndian + */ + bool isLittleEndian()const; + + /*! \brief Retuns whether or not the Stream is open. + * + * \return True if open; False otherwise. + */ + bool isOpen() const; + + /*! \brief Sets the buffers position relative to the specified position.
+ * It seeks relative to the current position by default. + * \param position where in the buffer to seek + * \param origin The Origin to seek \sa SeekOrigin + */ + void seek(Int64 pos, SeekOrigin origin = SeekOrigin::Current); + + + /*! \brief Returns whether or not the stream is at the end. + * + * \return bool True if at end; False otherwise. + */ + bool atEnd() const; + + /*! \brief Returns the current position in the stream. + * + * \return Int64 The current position in the stream. + */ + Uint64 position() const; + + /*! \brief Returns whether or not the stream is at the end. + * + * \return bool True if at end; False otherwise. + */ + Uint64 length() const; + + /*! \brief 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. + * \param data The new buffer. + * \param length The length of the new buffer. + * \throw IOException + */ + void setData(const Uint8* data, Uint64 length); + + + /*! \brief 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. + * \return Uint8* The copy of the buffer. + */ + Uint8* data() const; /*! \brief Sets the target file * @@ -65,10 +139,40 @@ public: */ std::string filepath() const; + /*! + * \brief Seeks to the specified bit within the current byte + * \param bit Bit to seek to, range is 0 - 7 + */ + void seekBit(int bit); + + /*! \brief Reads a bit at the current position and advances the current position + * + * \return bool The value at the current position + */ bool readBit(); + + /*! \brief Reads a byte at the current position and advances the current position + * + * \return Int8 The value at the current position + */ Int8 readByte(); + + /*! \brief Reads a byte at the current position and advances the current position + * + * \return Uint8 The value at the current position + */ Uint8 readUByte(); + + /*! \brief Reads a byte at the current position and advances the current position. + * + * \return Uint8* The buffer at the current position from the given length. + */ Int8* readBytes(Int64 length); + + /*! \brief Reads a byte at the current position and advances the current position. + * + * \return Int8* The buffer at the current position from the given length. + */ Uint8* readUBytes(Int64 length); /*! \brief Reads a Int16 and swaps to proper endianness depending on platform @@ -79,7 +183,7 @@ public: * \return Int16 The value at the current address * \throw IOException when address is out of range */ - Int16 readInt16(); + Int16 readInt16(); /*! \brief Reads a Uint16 and swaps to proper endianness depending on platform * and Stream settings, and advances the current position @@ -89,7 +193,7 @@ public: * \return Uint16 The value at the current address * \throw IOException when address is out of range */ - Uint16 readUInt16(); + Uint16 readUint16(); /*! \brief Reads a Int32 and swaps to proper endianness depending on platform * and Stream settings, and advances the current position @@ -99,7 +203,7 @@ public: * \return Int32 The value at the current address * \throw IOException when address is out of range */ - Int32 readInt32(); + Int32 readInt32(); /*! \brief Reads a Uint32 and swaps to proper endianness depending on platform * and Stream settings, and advances the current position @@ -109,7 +213,7 @@ public: * \return Uint32 The value at the current address * \throw IOException when address is out of range */ - Uint32 readUInt32(); + Uint32 readUint32(); /*! \brief Reads a Int64 and swaps to proper endianness depending on platform * and Stream settings, and advances the current position @@ -119,7 +223,7 @@ public: * \return Int64 The value at the current address * \throw IOException when address is out of range */ - Int64 readInt64(); + Int64 readInt64(); /*! \brief Reads a Uint64 and swaps to proper endianness depending on platform * and Stream settings, and advances the current position @@ -129,7 +233,7 @@ public: * \return Uint64 The value at the current address * \throw IOException when address is out of range */ - Uint64 readUInt64(); + Uint64 readUint64(); /*! \brief Reads a float and swaps to proper endianness depending on platform * and Stream settings, and advances the current position @@ -139,7 +243,7 @@ public: * \return float The value at the current address * \throw IOException when address is out of range */ - float readFloat(); + float readFloat(); /*! \brief Reads a double and swaps to proper endianness depending on platform * and Stream settings, and advances the current position @@ -149,13 +253,15 @@ public: * \return double The value at the current address * \throw IOException when address is out of range */ - double readDouble(); + double readDouble(); + /*! \brief Reads a bool and advances the current position * * \return bool The value at the current address * \throw IOException when address is out of range */ - bool readBool(); + bool readBool(); + /*! \brief Reads a Unicode string and advances the position in the file * * \return std::string The value at the current address @@ -173,33 +279,22 @@ public: void setProgressCallback(std::function cb); protected: void loadData(); - /*! \brief Overload of isOpenForWriting in Stream - * - * \return false - */ - bool isOpenForWriting(); - /*! \brief Overload of writeByte in Stream - * - * \throw IOException - */ - void writeByte(Int8 byte); - /*! \brief Overload of writeBytes in Stream - * - * \throw IOException - */ - void writeBytes(Int8*, Int64); + Uint8* m_data; + Uint64 m_length; std::string m_filepath; //!< Path to the target file - Uint32 m_currentLength; - FILE* m_file; + Uint64 m_position; + Uint64 m_bitPosition; + Endian m_endian; std::function m_progressCallback; }; -} -} + +} // io +} // Athena #ifndef BINARYREADER_BASE #define BINARYREADER_BASE \ private: \ - typedef zelda::io::BinaryReader base; + typedef Athena::io::BinaryReader base; #endif // BINARYREADER_BASE diff --git a/include/Athena/BinaryReader.hpp.autosave b/include/Athena/BinaryReader.hpp.autosave new file mode 100644 index 0000000..b47b540 --- /dev/null +++ b/include/Athena/BinaryReader.hpp.autosave @@ -0,0 +1,301 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef __BINARYREADER_HPP__ +#define __BINARYREADER_HPP__ + +#include "Stream.hpp" +#include +#include + +namespace Athena +{ +namespace io +{ +/*! \class BinaryReader + * \brief A Stream class for reading binary data + * + * A Class for reading binary data from a file or memory stream, + * all work is done using a memory buffer, and not read directly from the disk + * this allows for fast, flexible code as well as the ability to quickly modify data + * \sa Stream + */ +class BinaryReader : public Stream +{ +public: + /*! \brief This constructor takes an existing buffer to read from. + * + * \param data The existing buffer + * \param length The length of the existing buffer + */ + BinaryReader(const Uint8* data, Uint64 length); + + /*! \brief This constructor creates an instance from a file on disk. + * + * \param filename The file to create the stream from + */ + BinaryReader(const std::string& filename, std::function progressFun = nullptr); + + ~BinaryReader(); + + /*! \brief Sets the Endianss of the stream + * + * \param endian The Endianess to set \sa Endian + */ + void setEndian(Endian endian); + + /*! \brief Returns the current Endianness of the stream + * + * \return Endian The current Stream Endianess + */ + Endian endian() const; + + /*! \brief Returns whether the stream is BigEndian + * + * \return bool True for BigEndian; False for LittleEndian + */ + bool isBigEndian() const; + + /*! \brief Returns whether the stream is LittleEndian + * + * \return bool True for LittleEndian; False for BigEndian + */ + bool isLittleEndian()const; + + /*! \brief Retuns whether or not the Stream is open. + * + * \return True if open; False otherwise. + */ + bool isOpen() const; + + /*! \brief Sets the buffers position relative to the specified position.
+ * It seeks relative to the current position by default. + * \param position where in the buffer to seek + * \param origin The Origin to seek \sa SeekOrigin + */ + void seek(Int64 pos, SeekOrigin origin = SeekOrigin::Current); + + + /*! \brief Returns whether or not the stream is at the end. + * + * \return bool True if at end; False otherwise. + */ + bool atEnd() const; + + /*! \brief Returns the current position in the stream. + * + * \return Int64 The current position in the stream. + */ + Uint64 position() const; + + /*! \brief Returns whether or not the stream is at the end. + * + * \return bool True if at end; False otherwise. + */ + Uint64 length() const; + + /*! \brief 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. + * \param data The new buffer. + * \param length The length of the new buffer. + * \throw IOException + */ + void setData(const Uint8* data, Uint64 length); + + + /*! \brief 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. + * \return Uint8* The copy of the buffer. + */ + Uint8* data() const; + + /*! \brief Sets the target file + * + * \sa Endian + * \param filepath The path to write to. + */ + void setFilepath(const std::string& filepath); + + /*! \brief Returns the target file + * + */ + std::string filepath() const; + + /*! + * \brief Seeks to the specified bit within the current byte + * \param bit Bit to seek to, range is 0 - 7 + */ + void seekBit(int bit); + + /*! \brief Reads a bit at the current position and advances the current position + * + * \return bool The value at the current position + */ + bool readBit(); + + /*! \brief Reads a byte at the current position and advances the current position + * + * \return Int8 The value at the current position + */ + Int8 readByte(); + + /*! \brief Reads a byte at the current position and advances the current position + * + * \return Uint8 The value at the current position + */ + Uint8 readUByte(); + + /*! \brief Reads a byte at the current position and advances the current position. + * + * \return Uint8* The buffer at the current position from the given length. + */ + Int8* readBytes(Int64 length); + + /*! \brief Reads a byte at the current position and advances the current position. + * + * \return Int8* The buffer at the current position from the given length. + */ + Uint8* readUBytes(Int64 length); + + /*! \brief Reads a Int16 and swaps to proper endianness depending on platform + * and Stream settings, and advances the current position + * + * \sa Endian + * + * \return Int16 The value at the current address + * \throw IOException when address is out of range + */ + Int16 readInt16(); + + /*! \brief Reads a Uint16 and swaps to proper endianness depending on platform + * and Stream settings, and advances the current position + * + * \sa Endian + * + * \return Uint16 The value at the current address + * \throw IOException when address is out of range + */ + Uint16 readUint16(); + + /*! \brief Reads a Int32 and swaps to proper endianness depending on platform + * and Stream settings, and advances the current position + * + * \sa Endian + * + * \return Int32 The value at the current address + * \throw IOException when address is out of range + */ + Int32 readInt32(); + + /*! \brief Reads a Uint32 and swaps to proper endianness depending on platform + * and Stream settings, and advances the current position + * + * \sa Endian + * + * \return Uint32 The value at the current address + * \throw IOException when address is out of range + */ + Uint32 readUint32(); + + /*! \brief Reads a Int64 and swaps to proper endianness depending on platform + * and Stream settings, and advances the current position + * + * \sa Endian + * + * \return Int64 The value at the current address + * \throw IOException when address is out of range + */ + Int64 readInt64(); + + /*! \brief Reads a Uint64 and swaps to proper endianness depending on platform + * and Stream settings, and advances the current position + * + * \sa Endian + * + * \return Uint64 The value at the current address + * \throw IOException when address is out of range + */ + Uint64 readUint64(); + + /*! \brief Reads a float and swaps to proper endianness depending on platform + * and Stream settings, and advances the current position + * + * \sa Endian + * + * \return float The value at the current address + * \throw IOException when address is out of range + */ + float readFloat(); + + /*! \brief Reads a double and swaps to proper endianness depending on platform + * and Stream settings, and advances the current position + * + * \sa Endian + * + * \return double The value at the current address + * \throw IOException when address is out of range + */ + double readDouble(); + + /*! \brief Reads a bool and advances the current position + * + * \return bool The value at the current address + * \throw IOException when address is out of range + */ + bool readBool(); + + /*! \brief Reads a Unicode string and advances the position in the file + * + * \return std::string The value at the current address + * \throw IOException when address is out of range + */ + std::string readUnicode(); + + /*! \brief Reads a string and advances the position in the file + * + * \return std::string The value at the current address + * \throw IOException when address is out of range + */ + std::string readString(); + + void setProgressCallback(std::function cb); +protected: + void loadData(); + Uint8* m_data; + Uint64 m_length; + std::string m_filepath; //!< Path to the target file + Uint64 m_position; + Uint64 m_bitPosition; + Endian m_endian; + std::function m_progressCallback; +}; + +} // io +} // Athena + +#ifndef BINARYREADER_BASE +#define BINARYREADER_BASE \ +private: \ + typedef Athena::io::BinaryReader base; + +#endif // BINARYREADER_BASE + +#endif // __BINARYREADER_HPP__ diff --git a/include/Athena/BinaryWriter.hpp b/include/Athena/BinaryWriter.hpp new file mode 100644 index 0000000..8f52e18 --- /dev/null +++ b/include/Athena/BinaryWriter.hpp @@ -0,0 +1,296 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef __BINARYWRITER_HPP__ +#define __BINARYWRITER_HPP__ + +#include "Stream.hpp" +#include +#include + +namespace Athena +{ +namespace io +{ + +/*! \class BinaryWriter + * \brief A Stream class for writing binary data + * + * A Class for writing binary data to a file or memory stream, + * all work is done using a memory buffer, and not written directly to the disk + * this allows for fast, flexible code as well as the ability to quickly modify data + * \sa Stream + */ +class BinaryWriter : public Stream +{ +public: + /*! \brief This constructor takes an existing buffer to write to. + * + * \param data The existing buffer + * \param length The length of the existing buffer + */ + BinaryWriter(Uint8* data, Uint64 length); + + /*! \brief This constructor creates an instance from a file on disk. + * + * \param filename The file to create the stream from + */ + BinaryWriter(const std::string& filename, std::function progressFun = nullptr); + + ~BinaryWriter(); + + /*! \brief Sets the Endianss of the stream + * + * \param endian The Endianess to set \sa Endian + */ + void setEndian(Endian endian); + + /*! \brief Returns the current Endianness of the stream + * + * \return Endian The current Stream Endianess + */ + Endian endian() const; + + /*! \brief Returns whether the stream is BigEndian + * + * \return bool True for BigEndian; False for LittleEndian + */ + bool isBigEndian() const; + + /*! \brief Returns whether the stream is LittleEndian + * + * \return bool True for LittleEndian; False for BigEndian + */ + bool isLittleEndian()const; + + /*! \brief Retuns whether or not the Stream is open. + * + * \return True if open; False otherwise. + */ + bool isOpen() const; + + /*! \brief Sets the buffers position relative to the specified position.
+ * It seeks relative to the current position by default. + * \param position where in the buffer to seek + * \param origin The Origin to seek \sa SeekOrigin + */ + void seek(Int64 pos, SeekOrigin origin = SeekOrigin::Current); + + + /*! \brief Returns whether or not the stream is at the end. + * + * \return bool True if at end; False otherwise. + */ + bool atEnd() const; + + + /*! \brief Returns the current position in the stream. + * + * \return Int64 The current position in the stream. + */ + Uint64 position() const; + + /*! \brief Returns whether or not the stream is at the end. + * + * \return bool True if at end; False otherwise. + */ + Uint64 length() const; + + /*! \brief 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. + * \param data The new buffer. + * \param length The length of the new buffer. + * \throw IOException + */ + void setData(const Uint8* data, Uint64 length); + + + /*! \brief 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. + * \return Uint8* The copy of the buffer. + */ + Uint8* data() const; + + /*! \brief Sets the target file + * + * \param filepath The path to write to. + */ + void setFilepath(const std::string& filepath); + + /*! \brief + * Returns the target file + */ + std::string filepath() const; + + /*! \brief Saves the file to the specified file. + * + * \param filename If not empty, the filename to save to + */ + void save(const std::string& filename=""); + + /*! + * \brief Seeks to the specified bit within the current byte + * \param bit Bit to seek to, range is 0 - 7 + */ + void seekBit(int bit); + + /*! \brief Writes a bit at the current position and advances the position by one bit. + * \param val the value to write + * \throw IOException + */ + void writeBit(bool val); + + /*! \brief Writes a byte at the current position and advances the position by one byte. + * \param byte The value to write + */ + void writeUByte(Uint8 val); + + /*! \brief Writes a byte at the current position and advances the position by one byte. + * \param byte The value to write + * \throw IOException + */ + void writeByte(Int8 val); + + /*! \brief 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. + * + * \param data The buffer to write + * \param length The amount to write + */ + void writeUBytes(Uint8* data, Uint64 len); + + /*! \brief 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. + * + * \param data The buffer to write + * \param length The amount to write + */ + void writeBytes(Int8* data, Uint64 len); + + /*! \brief Writes an Int16 to the buffer and advances the buffer. + * It also swaps the bytes depending on the platform and Stream settings. + * + * \sa Endian + * \param val The value to write to the buffer + */ + void writeInt16(Int16 val); + + /*! \brief Writes an Uint16 to the buffer and advances the buffer. + * It also swaps the bytes depending on the platform and Stream settings + * + * \sa Endian + * \param val The value to write to the buffer + */ + void writeUint16(Uint16); + + /*! \brief Writes an Int32 to the buffer and advances the buffer. + * It also swaps the bytes depending on the platform and Stream settings. + * + * \sa Endian + * \param val The value to write to the buffer + */ + void writeInt32(Int32); + + /*! \brief Writes an Uint32 to the buffer and advances the buffer. + * It also swaps the bytes depending on the platform and Stream settings. + * + * \sa Endian + * \param val The value to write to the buffer + */ + void writeUint32(Uint32); + + /*! \brief Writes an Int64 to the buffer and advances the buffer. + * It also swaps the bytes depending on the platform and Stream settings. + * + * \sa Endian + * \param val The value to write to the buffer + */ + void writeInt64(Int64); + + /*! \brief Writes an Uint64 to the buffer and advances the buffer. + * It also swaps the bytes depending on the platform and Stream settings. + * + * \sa Endian + * \param val The value to write to the buffer + */ + void writeUint64(Uint64); + + /*! \brief Writes an float to the buffer and advances the buffer. + * It also swaps the bytes depending on the platform and Stream settings. + * + * \sa Endian + * \param val The value to write to the buffer + */ + void writeFloat(float); + + /*! \brief Writes an double to the buffer and advances the buffer. + * It also swaps the bytes depending on the platform and Stream settings. + * + * \sa Endian + * \param val The value to write to the buffer + */ + void writeDouble(double); + + /*! \brief Writes an bool to the buffer and advances the buffer. + * It also swaps the bytes depending on the platform and Stream settings. + * + * \sa Endian + * \param val The value to write to the buffer + */ + void writeBool(bool); + + /*! \brief Writes an unicode string to 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 + */ + void writeUnicode(const std::string& str); + + /*! \brief Writes an string to the buffer and advances the buffer. + * + * \sa Endian + * \param str The string to write to the buffer + */ + void writeString(const std::string& str); + + void setProgressCallback(std::function cb); +protected: + void loadData(); + Uint8* m_data; + Uint64 m_length; + std::string m_filepath; //!< Path to the target file + Uint64 m_position; + Uint64 m_bitPosition; + Endian m_endian; + std::function m_progressCallback; +private: + void resize(Uint64 newSize); +}; +} +} + +#ifndef BINARYWRITER_BASE +#define BINARYWRITER_BASE \ + private: \ + typedef Athena::io::BinaryWriter base; +#endif // BINARYWRITER_BASE +#endif // __BINARY_WRITER_HPP__ diff --git a/include/Athena/Checksums.hpp b/include/Athena/Checksums.hpp new file mode 100644 index 0000000..9d8ecb3 --- /dev/null +++ b/include/Athena/Checksums.hpp @@ -0,0 +1,30 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef CHECKSUMS_HPP +#define CHECKSUMS_HPP + +#include "Athena/Global.hpp" + +namespace Athena +{ +namespace Checksums +{ +Uint32 crc32(const Uint8* data, Uint64 length, Uint32 seed = 0xFFFFFFFF); +Uint16 crc16CCITT(const Uint8* data, Uint64 length, Uint16 seed = 0xFFFF, Uint16 final = 0); +Uint16 crc16(const Uint8* data, Uint64 length); +} +} +#endif // CHECKSUMS_HPP diff --git a/include/Compression.hpp b/include/Athena/Compression.hpp similarity index 78% rename from include/Compression.hpp rename to include/Athena/Compression.hpp index 3e35d3f..0aeca4b 100644 --- a/include/Compression.hpp +++ b/include/Athena/Compression.hpp @@ -1,24 +1,24 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see #ifndef COMPRESSION_HPP #define COMPRESSION_HPP -#include +#include "Athena/Global.hpp" -namespace zelda +namespace Athena { namespace io { diff --git a/include/Exception.hpp b/include/Athena/Exception.hpp similarity index 58% rename from include/Exception.hpp rename to include/Athena/Exception.hpp index cea139e..0c8cd84 100644 --- a/include/Exception.hpp +++ b/include/Athena/Exception.hpp @@ -1,17 +1,17 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see #ifndef __EXCEPTION_HPP__ #define __EXCEPTION_HPP__ @@ -22,11 +22,10 @@ #define __STR(x) __STRX(x) #define __LINE_STRING__ __STR(__LINE__) -namespace zelda +namespace Athena { namespace error { - /*! \class Exception * \brief The baseclass for all Exceptions. * @@ -39,8 +38,11 @@ public: /*! \brief The constructor for an Exception * \param message The error message to throw */ - inline Exception(const std::string& message) : - m_message(message) + inline Exception(const std::string& message, const std::string& file, const std::string& function, const int line) : + m_message(message), + m_file(file), + m_function(function), + m_line(line) { } @@ -51,16 +53,30 @@ public: { return m_message; } + + inline std::string file() const + { + return m_file; + } + + inline std::string function() const + { + return m_function; + } + + inline int line() const + { + return m_line; + } protected: std::string m_message; //!< The error message string + std::string m_file; + std::string m_function; + int m_line; }; - } // error -} // zelda +} // Athena #define THROW_EXCEPTION(msg) \ - do \ - { \ - throw zelda::error::Exception(__LINE_STRING__ " " __FILE__ " " msg); \ - } while(0) + do { throw Athena::error::Exception("Exception: " msg, __FILE__, __PRETTY_FUNCTION__, __LINE__); } while(0) #endif diff --git a/include/FileNotFoundException.hpp b/include/Athena/FileNotFoundException.hpp similarity index 66% rename from include/FileNotFoundException.hpp rename to include/Athena/FileNotFoundException.hpp index d25c2f0..6fd931f 100644 --- a/include/FileNotFoundException.hpp +++ b/include/Athena/FileNotFoundException.hpp @@ -1,28 +1,27 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see #ifndef __FILENOTFOUNDEXCEPTION_HPP__ #define __FILENOTFOUNDEXCEPTION_HPP__ #include "Exception.hpp" -namespace zelda +namespace Athena { namespace error { - /*! \class FileNotFoundException * \brief An excpeption thrown when a file could not be found at the given path. * @@ -37,8 +36,8 @@ public: /*! \brief The constructor for an FileNotFoundException * \param filename The path of the offending file. */ - inline FileNotFoundException(const std::string& filename) : - Exception("Couldn't find \"" + filename + "\", please check that it exists."), + inline FileNotFoundException(const std::string& filename, const std::string& file, const std::string& function, const int line) : + Exception(std::string("FileNotFoundException: Could not find file \"") + filename + std::string("\", please check that it exists."), file, function, line), m_filename(filename) {} @@ -49,14 +48,10 @@ public: private: std::string m_filename; }; - } // error -} // zelda +} // Athena -#define THROW_FILENOTFOUND_EXCEPTION(msg) \ - do \ - { \ - throw zelda::error::FileNotFoundException(__LINE_STRING__ " " __FILE__ " " msg); \ - } while(0) +#define THROW_FILE_NOT_FOUND_EXCEPTION(msg) \ + do { throw Athena::error::FileNotFoundException(msg, __FILE__, __PRETTY_FUNCTION__, __LINE__); } while(0) #endif diff --git a/include/Athena/FileReader.hpp b/include/Athena/FileReader.hpp new file mode 100644 index 0000000..ba1765c --- /dev/null +++ b/include/Athena/FileReader.hpp @@ -0,0 +1,76 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef FILESTREAM_HPP +#define FILESTREAM_HPP + +#include "Stream.hpp" +#include +#include + +namespace Athena +{ +namespace io +{ +class FileReader : public Stream +{ +public: + FileReader(const std::string& filename); + ~FileReader(); + std::string filename() const; + + void setEndian(Endian endian); + Endian endian() const; + bool isBigEndian() const; + bool isLittleEndian() const; + void open(); + void close(); + bool isOpen() const; + bool save(); + void seek(Int64 pos, SeekOrigin origin = SeekOrigin::Current); + bool atEnd() const; + Uint64 position() const; + Uint64 length() const; + + + void seekBit(int); + bool readBit(); + Uint8 readUByte(); + Int8 readByte(); + Uint8* readUBytes(Uint64 len); + Int8* readBytes(Uint64 len); + Uint16 readUint16(); + Int16 readInt16(); + Uint32 readUint32(); + Int32 readInt32(); + Uint64 readUint64(); + Int64 readInt64(); + double readDouble(); + float readFloat(); + bool readBool(); + std::string readString(); + std::string readUnicode(); +private: + std::string m_filename; + FILE* m_fileHandle; + Endian m_endian; + Uint8 m_currentByte; + Uint8 m_bitShift; + bool m_bitValid; +}; +} // io +} // Athena + +#endif // FILESTREAM_HPP diff --git a/include/Athena/FileWriter.hpp b/include/Athena/FileWriter.hpp new file mode 100644 index 0000000..ed8a05b --- /dev/null +++ b/include/Athena/FileWriter.hpp @@ -0,0 +1,72 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef FILEWRITER_HPP +#define FILEWRITER_HPP + +#include "Athena/Stream.hpp" + +namespace Athena +{ +namespace io +{ +class FileWriter : public Stream +{ +public: + FileWriter(const std::string& filename); + ~FileWriter(); + + void setEndian(Endian endian); + Endian endian() const; + bool isBigEndian() const; + bool isLittleEndian() const; + void open(); + void close(); + bool isOpen() const; + bool save(); + void seek(Int64 pos, SeekOrigin origin = SeekOrigin::Current); + bool atEnd() const; + Uint64 position() const; + Uint64 length() const; + + void writeBit (bool val); + void seekBit (int bit); + void writeUByte (Uint8 val); + void writeByte (Int8 val); + void writeUBytes(Uint8* data, Uint64 len); + void writeBytes (Int8* data, Uint64 len); + void writeUint16(Uint16 val); + void writeInt16 (Int16 val); + void writeUint32(Uint32 val); + void writeInt32 (Int32 val); + void writeUint64(Uint64 val); + void writeInt64 (Int64 val); + void writeDouble(double val); + void writeFloat (float val); + void writeBool (bool val); + void writeString(const std::string& val); + void writeUnicode(const std::string& str); +private: + std::string m_filename; + FILE* m_fileHandle; + Endian m_endian; + Uint8 m_currentByte; + Uint8 m_bytePosition; + Uint8 m_bitShift; + bool m_bitValid; +}; +} +} // Athena +#endif // FILEWRITER_HPP diff --git a/include/Athena/Global.hpp b/include/Athena/Global.hpp new file mode 100644 index 0000000..a2e05dc --- /dev/null +++ b/include/Athena/Global.hpp @@ -0,0 +1,81 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef GLOBAL_HPP +#define GLOBAL_HPP + +#include "Athena/Types.hpp" +#include "Athena/Utility.hpp" +#include + +#ifndef aDebug +#define aDebug() \ + std::cout << __FILE__ << "(" << __LINE__ << ") " << __PRETTY_FUNCTION__ << ": " +#endif +#ifndef aError +#define aError() \ + std::cerr << __FILE__ << "(" << __LINE__ << ") " << __PRETTY_FUNCTION__ << ": " +#endif + +#ifndef BLOCKSZ +#define BLOCKSZ 512 +#endif + +namespace Athena +{ +enum class SeekOrigin +{ + Begin, + Current, + End +}; + +enum class Endian +{ + LittleEndian, + BigEndian +}; + +namespace Sakura +{ + +template +class Vector2D +{ +public: + T x; + T y; + + Vector2D() + : x(0), + y(0) + { + } + + Vector2D(T x, T y) + : x(x), + y(y) + { + } +}; + +typedef Vector2D Vector2Di; +typedef Vector2D Vector2Df; +} // Sakura +} // Athena + +std::ostream& operator<<(std::ostream& os, const Athena::SeekOrigin& origin); +std::ostream& operator<<(std::ostream& os, const Athena::Endian& endian); +#endif // GLOBAL_HPP diff --git a/include/IOException.hpp b/include/Athena/IOException.hpp similarity index 68% rename from include/IOException.hpp rename to include/Athena/IOException.hpp index a6a5f2c..25c6d35 100644 --- a/include/IOException.hpp +++ b/include/Athena/IOException.hpp @@ -1,17 +1,17 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see #ifndef __IOEXCEPTION_HPP__ #define __IOEXCEPTION_HPP__ @@ -19,11 +19,10 @@ #include "Exception.hpp" -namespace zelda +namespace Athena { namespace error { - /*! \class IOException * \brief An excpeption thrown on inappropriate IO calls. * @@ -40,18 +39,15 @@ public: /*! \brief The constructor for an IOException * \param message The error message to throw */ - inline IOException(const std::string& message) : - Exception(message) + inline IOException(const std::string& message, const std::string& file, const std::string& function, const int line) : + Exception(message, file, function, line) {} }; } // error -} // zelda +} // Athena #define THROW_IO_EXCEPTION(msg) \ - do \ - { \ - throw zelda::error::IOException(__LINE_STRING__ " " __FILE__ " " msg); \ - } while(0) + do { throw Athena::error::IOException("IOException: " msg, __FILE__, __PRETTY_FUNCTION__, __LINE__); } while(0) #endif diff --git a/include/Athena/InvalidDataException.hpp b/include/Athena/InvalidDataException.hpp new file mode 100644 index 0000000..2b6727d --- /dev/null +++ b/include/Athena/InvalidDataException.hpp @@ -0,0 +1,49 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef INVALIDDATAEXCEPTION_HPP +#define INVALIDDATAEXCEPTION_HPP + +#include "Exception.hpp" +#include + +namespace Athena +{ +namespace error +{ +/*! \class InvalidDataException + * \brief An exception thrown on Invalid Data calls. + * + * This should only be thrown when the library tries to + * e.g pass a NULL pointer to a function which requires a valid pointer. + *
+ * It is NOT appropriate to use throw new so avoid doing so, + * keeping things on the stack as much as possible is very important for speed. + */ +class InvalidDataException : public Exception +{ +public: + inline InvalidDataException(const std::string& error, const std::string& file, const std::string& function, const int line) + : Exception(error, file, function, line) + { + } +}; +} // error +} // Athena + +#define THROW_INVALID_DATA_EXCEPTION(msg) \ + do { throw Athena::error::InvalidDataException("InvalidDataException: " msg, __FILE__, __PRETTY_FUNCTION__, __LINE__); } while(0) + +#endif // INVALIDDATAEXCEPTION_HPP diff --git a/include/InvalidOperationException.hpp b/include/Athena/InvalidOperationException.hpp similarity index 65% rename from include/InvalidOperationException.hpp rename to include/Athena/InvalidOperationException.hpp index 9e37d8b..c705c9a 100644 --- a/include/InvalidOperationException.hpp +++ b/include/Athena/InvalidOperationException.hpp @@ -1,17 +1,17 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see #ifndef __INVALID_OPERATION_EXCEPTION_HPP__ #define __INVALID_OPERATION_EXCEPTION_HPP__ @@ -19,11 +19,10 @@ #include #include "Exception.hpp" -namespace zelda +namespace Athena { namespace error { - /*! \class InvalidOperationException * \brief An excpeption thrown on Invalid Operations calls. * @@ -39,19 +38,15 @@ public: /*! \brief The constructor for an InvalidOperationException * \param error The error message to throw */ - inline InvalidOperationException(const std::string& error) - : Exception(error) + inline InvalidOperationException(const std::string& message, const std::string& file, const std::string& function, const int line) : + Exception(message, file, function, line) { } }; - } // error -} // zelda +} // Athena -#define THROW_INVALIDOPERATION_EXCEPTION(msg) \ - do \ - { \ - throw zelda::error::InvalidOperationException(__LINE_STRING__ " " __FILE__ " " msg); \ - } while(0) +#define THROW_INVALID_OPERATION_EXCEPTION(msg) \ + do { throw Athena::error::InvalidOperationException("InvalidOperationException: " msg, __FILE__, __PRETTY_FUNCTION__, __LINE__); } while(0) #endif // __INVALID_OPERATION_EXCEPTION_HPP__ diff --git a/include/MCFile.hpp b/include/Athena/MCFile.hpp similarity index 73% rename from include/MCFile.hpp rename to include/Athena/MCFile.hpp index ce32684..bdab882 100644 --- a/include/MCFile.hpp +++ b/include/Athena/MCFile.hpp @@ -1,22 +1,22 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see #ifndef __MCFILE_HPP__ #define __MCFILE_HPP__ -namespace zelda +namespace Athena { /*! \class MCFile diff --git a/include/MCFileReader.hpp b/include/Athena/MCFileReader.hpp similarity index 84% rename from include/MCFileReader.hpp rename to include/Athena/MCFileReader.hpp index 84fdab4..02b86b7 100644 --- a/include/MCFileReader.hpp +++ b/include/Athena/MCFileReader.hpp @@ -1,25 +1,24 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see #ifndef __MCFILEREADER_HPP__ #define __MCFILEREADER_HPP__ -#include "Types.hpp" #include "BinaryReader.hpp" -namespace zelda +namespace Athena { class MCFile; diff --git a/include/MCFileWriter.hpp b/include/Athena/MCFileWriter.hpp similarity index 87% rename from include/MCFileWriter.hpp rename to include/Athena/MCFileWriter.hpp index 4750072..f5f5f68 100644 --- a/include/MCFileWriter.hpp +++ b/include/Athena/MCFileWriter.hpp @@ -1,17 +1,17 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see #ifndef __MCFILEWRITER_HPP__ #define __MCFILEWRITER_HPP__ @@ -19,7 +19,7 @@ #include "Types.hpp" #include "BinaryWriter.hpp" -namespace zelda +namespace Athena { class MCFile; diff --git a/include/Athena/NotImplementedException.hpp b/include/Athena/NotImplementedException.hpp new file mode 100644 index 0000000..371a48e --- /dev/null +++ b/include/Athena/NotImplementedException.hpp @@ -0,0 +1,38 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef NOTIMPLEMENTEDEXCEPTION_HPP +#define NOTIMPLEMENTEDEXCEPTION_HPP + +#include "Athena/Exception.hpp" + +namespace Athena +{ +namespace error +{ +class NotImplementedException : public Exception +{ +public: + NotImplementedException(const std::string& message, const std::string& file, const std::string& function, const int line) : + Exception(message, file, function, line) + {} +}; +} // error +} // Athena + +#define THROW_NOT_IMPLEMENTED_EXCEPTION() \ + do { throw Athena::error::NotImplementedException("NotImplementedException", __FILE__, __PRETTY_FUNCTION__, __LINE__); } while(0) + +#endif // NOTIMPLEMENTEDEXCEPTION_HPP diff --git a/include/Athena/SkywardSwordFile.hpp b/include/Athena/SkywardSwordFile.hpp new file mode 100644 index 0000000..c1b420c --- /dev/null +++ b/include/Athena/SkywardSwordFile.hpp @@ -0,0 +1,63 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef __SSFILE_HPP__ +#define __SSFILE_HPP__ + +#include "Athena/Global.hpp" + +// standard lib +#include + +namespace Athena +{ +class SkywardSwordQuest; + +enum class Region +{ + NTSC, + NTSCJ, + PAL +}; + +class SkywardSwordFile +{ +public: + enum MagicNumbers + { + USMagic = 0x534F5545, + JAMagic = 0x534F554A, + EUMagic = 0x534F5550 + }; + + SkywardSwordFile(); + SkywardSwordFile(std::vector quests); + ~SkywardSwordFile(); + + void addQuest(SkywardSwordQuest* q); + SkywardSwordQuest* quest(Uint32 id); + std::vector questList() const; + + void setRegion(Region region); + Region region() const; +private: + Region m_region; + // A vector is a bit overkill + std::vector m_quests; + Uint32 m_numQuests; +}; + +} +#endif // __SSFILE_HPP__ diff --git a/include/Athena/SkywardSwordFileReader.hpp b/include/Athena/SkywardSwordFileReader.hpp new file mode 100644 index 0000000..643d873 --- /dev/null +++ b/include/Athena/SkywardSwordFileReader.hpp @@ -0,0 +1,39 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef __SSFILEREADER_HPP__ +#define __SSFILEREADER_HPP__ + +#include "BinaryReader.hpp" + +namespace Athena +{ +class SkywardSwordFile; +namespace io +{ +class SkywardSwordFileReader : public BinaryReader +{ + BINARYREADER_BASE +public: + + SkywardSwordFileReader(Uint8* data, Uint64 length); + SkywardSwordFileReader(const std::string& filename); + + SkywardSwordFile* read(); +}; +} // io +} // zelda + +#endif // __SSFILEREADER_HPP__ diff --git a/include/Athena/SkywardSwordFileWriter.hpp b/include/Athena/SkywardSwordFileWriter.hpp new file mode 100644 index 0000000..6ec6d22 --- /dev/null +++ b/include/Athena/SkywardSwordFileWriter.hpp @@ -0,0 +1,40 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef __SSFILEWRITER_HPP__ +#define __SSFILEWRITER_HPP__ + +#include "BinaryWriter.hpp" + +namespace Athena +{ +class SkywardSwordFile; + +namespace io +{ + +class SkywardSwordFileWriter : public BinaryWriter +{ + // Why does this fuck up my formatting in Qt Creator? + BINARYWRITER_BASE +public: + SkywardSwordFileWriter(Uint8* data, Uint64 len); + SkywardSwordFileWriter(const std::string& filename); + + void write(SkywardSwordFile* file); +}; +} +} +#endif // __SSFILEWRITER_HPP__ diff --git a/include/Athena/SkywardSwordQuest.hpp b/include/Athena/SkywardSwordQuest.hpp new file mode 100644 index 0000000..3e07175 --- /dev/null +++ b/include/Athena/SkywardSwordQuest.hpp @@ -0,0 +1,44 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef SKYWARDSWORDQUEST_HPP +#define SKYWARDSWORDQUEST_HPP + +#include "Athena/Global.hpp" +#include "ZQuestFile.hpp" + +namespace Athena +{ + +// TODO: Handle game specific data +class SkywardSwordQuest : public ZQuestFile +{ +public: + SkywardSwordQuest(Uint8* data, Uint32 len); + + // TODO: Is len really needed? + void setSkipData(const Uint8* data, Uint32 len = 0x24); + Uint8* skipData() const; + + Uint32 skipLength() const; + +private: + Uint8* m_skipData; + Uint32 m_skipLength; +}; + + +} // zelda +#endif // SSQUEST_HPP diff --git a/include/Sprite.hpp b/include/Athena/Sprite.hpp similarity index 81% rename from include/Sprite.hpp rename to include/Athena/Sprite.hpp index d6756f0..1992a66 100644 --- a/include/Sprite.hpp +++ b/include/Athena/Sprite.hpp @@ -1,3 +1,18 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + #ifndef SSPRITE_HPP #define SSPRITE_HPP @@ -10,9 +25,9 @@ #include #include #endif -#include +#include "Athena/Global.hpp" -namespace zelda +namespace Athena { namespace Sakura { diff --git a/include/SpriteFile.hpp b/include/Athena/SpriteFile.hpp similarity index 85% rename from include/SpriteFile.hpp rename to include/Athena/SpriteFile.hpp index 60f0755..8ed39ea 100644 --- a/include/SpriteFile.hpp +++ b/include/Athena/SpriteFile.hpp @@ -1,4 +1,19 @@ -#ifndef SSPRITEFILE_HPP +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef SSPRITEFILE_HPP #define SSPRITEFILE_HPP #ifndef LIBZELDA_USE_QT @@ -13,9 +28,9 @@ #endif #include -#include +#include "Athena/Global.hpp" -namespace zelda +namespace Athena { namespace Sakura { diff --git a/include/Athena/SpriteFileReader.hpp b/include/Athena/SpriteFileReader.hpp new file mode 100644 index 0000000..937245e --- /dev/null +++ b/include/Athena/SpriteFileReader.hpp @@ -0,0 +1,44 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef SSPRITEFILEREADER_HPP +#define SSPRITEFILEREADER_HPP + +#include "Athena/BinaryReader.hpp" + +namespace Athena +{ +namespace Sakura +{ +class SpriteFile; +} // Sakura + +namespace io +{ + +class SpriteFileReader : public BinaryReader +{ + BINARYREADER_BASE; +public: + SpriteFileReader(Uint8* data, Uint64 length); + SpriteFileReader(const std::string& filepath); + + Sakura::SpriteFile* readFile(); +}; +} // io +} // zelda + + +#endif // SSPRITEFILEREADER_HPP diff --git a/include/Athena/SpriteFileWriter.hpp b/include/Athena/SpriteFileWriter.hpp new file mode 100644 index 0000000..3aaa594 --- /dev/null +++ b/include/Athena/SpriteFileWriter.hpp @@ -0,0 +1,44 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef SSPRITEFILEWRITER_HPP +#define SSPRITEFILEWRITER_HPP + +#include "Athena/BinaryWriter.hpp" + +namespace Athena +{ +namespace Sakura +{ +class SpriteFile; +} // Sakura + +namespace io +{ + +class SpriteFileWriter : public BinaryWriter +{ + BINARYWRITER_BASE; +public: + SpriteFileWriter(Uint8* data, Uint64 length); + + SpriteFileWriter(const std::string& filepath); + + void writeFile(Sakura::SpriteFile* file); +}; + +} // io +} // zelda +#endif // SSPRITEFILEWRITER_HPP diff --git a/include/SpriteFrame.hpp b/include/Athena/SpriteFrame.hpp similarity index 65% rename from include/SpriteFrame.hpp rename to include/Athena/SpriteFrame.hpp index dd33564..752a7bb 100644 --- a/include/SpriteFrame.hpp +++ b/include/Athena/SpriteFrame.hpp @@ -1,8 +1,23 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + #ifndef SSPRITEFRAME_HPP #define SSPRITEFRAME_HPP -#include +#include "Athena/Global.hpp" #ifndef LIBZELDA_USE_QT #include @@ -11,7 +26,7 @@ #include #endif -namespace zelda +namespace Athena { namespace Sakura { diff --git a/include/SpritePart.hpp b/include/Athena/SpritePart.hpp similarity index 84% rename from include/SpritePart.hpp rename to include/Athena/SpritePart.hpp index a0f467a..11630d9 100644 --- a/include/SpritePart.hpp +++ b/include/Athena/SpritePart.hpp @@ -1,7 +1,22 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + #ifndef SSPRITEPART_HPP #define SSPRITEPART_HPP -#include +#include "Athena/Global.hpp" #ifndef LIBZELDA_USE_QT # include #else @@ -12,9 +27,8 @@ #endif #include -#include -namespace zelda +namespace Athena { namespace Sakura { diff --git a/include/Athena/Stream.hpp b/include/Athena/Stream.hpp new file mode 100644 index 0000000..bcbadd9 --- /dev/null +++ b/include/Athena/Stream.hpp @@ -0,0 +1,79 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#ifndef STREAM_HPP +#define STREAM_HPP + +#include "Global.hpp" +#include "Athena/NotImplementedException.hpp" + +namespace Athena +{ + +std::ostream& operator<<(std::ostream& os, Endian& endian); + +class Stream +{ +public: + + + virtual void setEndian(Endian) = 0; + virtual Endian endian() const= 0; + virtual bool isBigEndian() const= 0; + virtual bool isLittleEndian()const= 0; + virtual bool isOpen() const= 0; + virtual void seek(Int64, SeekOrigin)=0; + virtual bool atEnd() const= 0; + virtual Uint64 position() const= 0; + virtual Uint64 length() const= 0; +protected: + virtual void seekBit (int){THROW_NOT_IMPLEMENTED_EXCEPTION();} + // Reading + virtual bool readBit() {THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual Uint8 readUByte() {THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual Int8 readByte() {THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual Uint8* readUBytes(Uint64){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual Int8* readBytes(Uint64) {THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual Uint16 readUint16() {THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual Int16 readInt16() {THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual Uint32 readUint32() {THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual Int32 readInt32() {THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual Uint64 readUint64() {THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual Int64 readInt64() {THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual double readDouble() {THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual float readFloat() {THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual bool readBool() {THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual std::string readUnicode(){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual std::string readString() {THROW_NOT_IMPLEMENTED_EXCEPTION();} + // Writing + virtual void writeBit (bool){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeUByte (Uint8){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeByte (Int8){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeUBytes(Uint8*, Uint64){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeBytes (Int8*, Uint64){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeUint16(Uint16){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeInt16 (Int16){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeUint32(Uint32){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeInt32 (Int32){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeUint64(Uint64){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeInt64 (Int64){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeDouble(double){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeFloat (float){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeBool (bool){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeString(const std::string&){THROW_NOT_IMPLEMENTED_EXCEPTION();} + virtual void writeUnicode(const std::string&){THROW_NOT_IMPLEMENTED_EXCEPTION();} +}; +} +#endif // STREAM_HPP diff --git a/include/Types.hpp b/include/Athena/Types.hpp similarity index 64% rename from include/Types.hpp rename to include/Athena/Types.hpp index 88d69b9..4630242 100644 --- a/include/Types.hpp +++ b/include/Athena/Types.hpp @@ -1,72 +1,22 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see -#ifndef __TYPES_HPP__ -#define __TYPES_HPP__ +// along with libAthena. If not, see +#ifndef TYPES_HPP +#define TYPES_HPP #include -#ifdef __cplusplus -namespace zelda -{ -/*! \enum Endian - * \brief Allows the user to specify the Endianness of data.
- * The proper actions are automatically taken depending on platform and - * buffer settings - */ -enum Endian -{ - LittleEndian, //!< Specifies that the Stream is Little Endian (LSB) - BigEndian //!< Specifies that the Stream is Big Endian (MSB) -}; - -enum Region -{ - NTSCURegion, - NTSCJRegion, - PALRegion -}; - -namespace Sakura -{ - -template -class Vector2D -{ -public: - T x; - T y; - - Vector2D() - : x(0), - y(0) - { - } - - Vector2D(T x, T y) - : x(x), - y(y) - { - } -}; - -typedef Vector2D Vector2Di; -typedef Vector2D Vector2Df; -} // Sakura -} // zelda -#endif - // 8 bits integer types #if UCHAR_MAX == 0xFF typedef signed char Int8; @@ -127,4 +77,4 @@ typedef unsigned long long Uint64; #define DEPRECATED(func) func #endif -#endif +#endif // TYPES_HPP diff --git a/include/utility.hpp b/include/Athena/Utility.hpp similarity index 78% rename from include/utility.hpp rename to include/Athena/Utility.hpp index c9b8696..fb25fa3 100644 --- a/include/utility.hpp +++ b/include/Athena/Utility.hpp @@ -1,17 +1,18 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see + #ifndef __UTILITY_H__ #define __UTILITY_H__ @@ -20,11 +21,10 @@ #include #include "Types.hpp" -namespace zelda +namespace Athena { namespace utility { - bool isEmpty(Int8*, Uint32); Uint16 swapU16(Uint16 val ); @@ -45,12 +45,12 @@ std::vector split(const std::string &s, char delim); std::string join(const std::vector& elems, const std::string& delims); void tolower(std::string& str); void toupper(std::string& str); -std::string sprintf(const char* fmt, ...); +std::string stdsprintf(const char* fmt, ...); bool parseBool(const std::string& boolean, bool* valid = NULL); int countChar(const std::string& str, const char chr, int* lastOccur = NULL); +Uint64 fileSize(FILE* f); } // utility -} // zelda - +} // Athena #endif diff --git a/include/WiiBanner.hpp b/include/Athena/WiiBanner.hpp similarity index 88% rename from include/WiiBanner.hpp rename to include/Athena/WiiBanner.hpp index 6a5bc55..f1c83df 100644 --- a/include/WiiBanner.hpp +++ b/include/Athena/WiiBanner.hpp @@ -1,26 +1,27 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see + #ifndef WIIBANNER_H #define WIIBANNER_H #include #include -#include +#include "Athena/Global.hpp" -namespace zelda +namespace Athena { class WiiImage; /*! \class WiiBanner diff --git a/include/WiiFile.hpp b/include/Athena/WiiFile.hpp similarity index 79% rename from include/WiiFile.hpp rename to include/Athena/WiiFile.hpp index 927c07b..a3af946 100644 --- a/include/WiiFile.hpp +++ b/include/Athena/WiiFile.hpp @@ -1,27 +1,32 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see + #ifndef WIIFILE_H #define WIIFILE_H #include #include -#include +#include "Athena/Global.hpp" -namespace zelda +namespace Athena { +const Uint8 SD_KEY [16] = {0xab, 0x01, 0xb9, 0xd8, 0xe1, 0x62, 0x2b, 0x08, 0xaf, 0xba, 0xd8, 0x4d, 0xbf, 0xc2, 0xa5, 0x5d}; +const Uint8 SD_IV [16] = {0x21, 0x67, 0x12, 0xe6, 0xaa, 0x1f, 0x68, 0x9f, 0x95, 0xc5, 0xa2, 0x23, 0x24, 0xdc, 0x6a, 0x98}; +const Uint8 MD5_BLANKER[16] = {0x0e, 0x65, 0x37, 0x81, 0x99, 0xbe, 0x45, 0x17, 0xab, 0x06, 0xec, 0x22, 0x45, 0x1a, 0x57, 0x93}; + /*! \class WiiFile * \brief Wii file container class * diff --git a/include/WiiImage.hpp b/include/Athena/WiiImage.hpp similarity index 85% rename from include/WiiImage.hpp rename to include/Athena/WiiImage.hpp index a35c6fd..9a8ab21 100644 --- a/include/WiiImage.hpp +++ b/include/Athena/WiiImage.hpp @@ -1,23 +1,24 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see + #ifndef __WIIIMAGE_HPP__ #define __WIIIMAGE_HPP__ #include "Types.hpp" -namespace zelda +namespace Athena { /*! diff --git a/include/WiiSave.hpp b/include/Athena/WiiSave.hpp similarity index 82% rename from include/WiiSave.hpp rename to include/Athena/WiiSave.hpp index 97afd14..58208c7 100644 --- a/include/WiiSave.hpp +++ b/include/Athena/WiiSave.hpp @@ -1,25 +1,26 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see + #ifndef __WII__SAVE_HPP__ #define __WII__SAVE_HPP__ #include #include -#include +#include "Athena/Global.hpp" -namespace zelda +namespace Athena { class WiiFile; diff --git a/include/WiiSaveReader.hpp b/include/Athena/WiiSaveReader.hpp similarity index 83% rename from include/WiiSaveReader.hpp rename to include/Athena/WiiSaveReader.hpp index a926140..2342fc8 100644 --- a/include/WiiSaveReader.hpp +++ b/include/Athena/WiiSaveReader.hpp @@ -1,26 +1,25 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see #ifndef __WII_SAVE_READER_HPP__ #define __WII_SAVE_READER_HPP__ -#include "Types.hpp" -#include "utility.hpp" -#include "BinaryReader.hpp" +#include "Athena/Global.hpp" +#include "Athena/BinaryReader.hpp" -namespace zelda +namespace Athena { class WiiSave; class WiiBanner; diff --git a/include/WiiSaveWriter.hpp b/include/Athena/WiiSaveWriter.hpp similarity index 85% rename from include/WiiSaveWriter.hpp rename to include/Athena/WiiSaveWriter.hpp index de6e880..9efdcd7 100644 --- a/include/WiiSaveWriter.hpp +++ b/include/Athena/WiiSaveWriter.hpp @@ -1,26 +1,24 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see #ifndef __WII_SAVE_WRITER_HPP__ #define __WII_SAVE_WRITER_HPP__ -#include "Types.hpp" -#include "utility.hpp" #include "BinaryWriter.hpp" -namespace zelda +namespace Athena { class WiiSave; class WiiBanner; diff --git a/include/ZQuestFile.hpp b/include/Athena/ZQuestFile.hpp similarity index 92% rename from include/ZQuestFile.hpp rename to include/Athena/ZQuestFile.hpp index 590d44d..ce49264 100644 --- a/include/ZQuestFile.hpp +++ b/include/Athena/ZQuestFile.hpp @@ -1,29 +1,29 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see #ifndef ZQUEST_HPP #define ZQUEST_HPP -#include "Types.hpp" +#include "Athena/Global.hpp" #include #include #define ZQUEST_VERSION_CHECK(major, minor, revision) \ (major | (minor << 8) | (revision << 16)) -namespace zelda +namespace Athena { /*! * \brief ZQuestFile is an export format for save data. diff --git a/include/ZQuestFileReader.hpp b/include/Athena/ZQuestFileReader.hpp similarity index 81% rename from include/ZQuestFileReader.hpp rename to include/Athena/ZQuestFileReader.hpp index 48335f9..7b57b4d 100644 --- a/include/ZQuestFileReader.hpp +++ b/include/Athena/ZQuestFileReader.hpp @@ -1,24 +1,24 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see #ifndef __ZQUESTFILEREADER_HPP__ #define __ZQUESTFILEREADER_HPP__ #include "BinaryReader.hpp" -namespace zelda +namespace Athena { class ZQuestFile; diff --git a/include/ZQuestFileWriter.hpp b/include/Athena/ZQuestFileWriter.hpp similarity index 79% rename from include/ZQuestFileWriter.hpp rename to include/Athena/ZQuestFileWriter.hpp index 291b877..a8fa177 100644 --- a/include/ZQuestFileWriter.hpp +++ b/include/Athena/ZQuestFileWriter.hpp @@ -1,24 +1,24 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see #ifndef __ZQUESTFILEWRITER_HPP__ #define __ZQUESTFILEWRITER_HPP__ -#include +#include "Athena/BinaryWriter.hpp" -namespace zelda +namespace Athena { class ZQuestFile; diff --git a/include/BinaryWriter.hpp b/include/BinaryWriter.hpp deleted file mode 100644 index 3ecdfac..0000000 --- a/include/BinaryWriter.hpp +++ /dev/null @@ -1,176 +0,0 @@ -// This file is part of libZelda. -// -// libZelda is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// libZelda is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with libZelda. If not, see - -#ifndef __BINARYWRITER_HPP__ -#define __BINARYWRITER_HPP__ - -#include "Stream.hpp" -#include - -namespace zelda -{ -namespace io -{ - -/*! \class BinaryWriter - * \brief A Stream class for writing binary data - * - * A Class for writing binary data to a file or memory stream, - * all work is done using a memory buffer, and not written directly to the disk - * this allows for fast, flexible code as well as the ability to quickly modify data - * \sa Stream - */ -class BinaryWriter : public Stream -{ -public: - /*! \brief This constructor takes an existing buffer to write to. - * - * \param data The existing buffer - * \param length The length of the existing buffer - */ - BinaryWriter(const Uint8* data, Uint64 length); - - /*! \brief This constructor takes an existing Stream to write to. - * - * \param stream The stream to write data to - */ - BinaryWriter(const Stream& stream); - - /*! \brief This constructor creates an instance from a file on disk. - * - * \param filename The file to create the stream from - */ - BinaryWriter(const std::string& filename); - - /*! \brief Sets the target file - * - * \sa Endian - * \param filepath The path to write to. - */ - void setFilepath(const std::string& filepath); - - /*! \brief Returns the target file - * - */ - std::string filepath() const; - - /*! \brief Saves the file to the specified file. - * - * \param filename If not empty, the filename to save to - */ - void save(const std::string& filename=""); - - /*! \brief Writes an Int16 to the buffer and advances the buffer. - * It also swaps the bytes depending on the platform and Stream settings. - * - * \sa Endian - * \param val The value to write to the buffer - */ - void writeInt16(Int16 val); - - /*! \brief Writes an Uint16 to the buffer and advances the buffer. - * It also swaps the bytes depending on the platform and Stream settings - * - * \sa Endian - * \param val The value to write to the buffer - */ - void writeUInt16(Uint16); - - /*! \brief Writes an Int32 to the buffer and advances the buffer. - * It also swaps the bytes depending on the platform and Stream settings. - * - * \sa Endian - * \param val The value to write to the buffer - */ - void writeInt32(Int32); - - /*! \brief Writes an Uint32 to the buffer and advances the buffer. - * It also swaps the bytes depending on the platform and Stream settings. - * - * \sa Endian - * \param val The value to write to the buffer - */ - void writeUInt32(Uint32); - - /*! \brief Writes an Int64 to the buffer and advances the buffer. - * It also swaps the bytes depending on the platform and Stream settings. - * - * \sa Endian - * \param val The value to write to the buffer - */ - void writeInt64(Int64); - - /*! \brief Writes an Uint64 to the buffer and advances the buffer. - * It also swaps the bytes depending on the platform and Stream settings. - * - * \sa Endian - * \param val The value to write to the buffer - */ - void writeUInt64(Uint64); - - /*! \brief Writes an float to the buffer and advances the buffer. - * It also swaps the bytes depending on the platform and Stream settings. - * - * \sa Endian - * \param val The value to write to the buffer - */ - void writeFloat(float); - - /*! \brief Writes an double to the buffer and advances the buffer. - * It also swaps the bytes depending on the platform and Stream settings. - * - * \sa Endian - * \param val The value to write to the buffer - */ - void writeDouble(double); - - /*! \brief Writes an bool to the buffer and advances the buffer. - * It also swaps the bytes depending on the platform and Stream settings. - * - * \sa Endian - * \param val The value to write to the buffer - */ - void writeBool(bool); - - /*! \brief Writes an unicode string to 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 - */ - void writeUnicode(const std::string& str); - - /*! \brief Writes an string to the buffer and advances the buffer. - * - * \sa Endian - * \param str The string to write to the buffer - */ - void writeString(const std::string& str); - -protected: - Int8 readByte(); - Int8* readBytes(Int64); - bool isOpenForReading(); //!< Overridden from \sa Stream - std::string m_filepath; //!< Path to the target file -}; -} -} - -#ifndef BINARYWRITER_BASE -#define BINARYWRITER_BASE \ - private: \ - typedef zelda::io::BinaryWriter base; -#endif // BINARYWRITER_BASE -#endif // __BINARY_WRITER_HPP__ diff --git a/include/Checksums.hpp b/include/Checksums.hpp deleted file mode 100644 index 7282407..0000000 --- a/include/Checksums.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef CHECKSUMS_HPP -#define CHECKSUMS_HPP - -#include - -namespace zelda -{ -namespace Checksums -{ -Uint32 crc32(const Uint8* data, Uint64 length, Uint32 seed = 0xFFFFFFFF); -Uint16 crc16CCITT(const Uint8* data, Uint64 length, Uint16 seed = 0xFFFF, Uint16 final = 0); -Uint16 crc16(const Uint8* data, Uint64 length); -} -} -#endif // CHECKSUMS_HPP diff --git a/include/InvalidDataException.hpp b/include/InvalidDataException.hpp deleted file mode 100644 index d585a3f..0000000 --- a/include/InvalidDataException.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef INVALIDDATAEXCEPTION_HPP -#define INVALIDDATAEXCEPTION_HPP - -#include "Exception.hpp" -#include - -namespace zelda -{ -namespace error -{ -/*! \class InvalidDataException - * \brief An exception thrown on Invalid Data calls. - * - * This should only be thrown when the library tries to - * e.g pass a NULL pointer to a function which requires a valid pointer. - *
- * It is NOT appropriate to use throw new so avoid doing so, - * keeping things on the stack as much as possible is very important for speed. - */ -class InvalidDataException : public Exception -{ -public: - inline InvalidDataException(const std::string& error) - : Exception(error) - { - } -}; - -} -} - -#define THROW_INVALID_DATA(msg) \ - do \ - { \ - throw zelda::error::InvalidDataException(__LINE_STRING__ " " __FILE__ " " msg); \ - } while(0) -#endif // INVALIDDATAEXCEPTION_HPP diff --git a/include/Mainpage.hpp b/include/Mainpage.hpp deleted file mode 100644 index 29843e4..0000000 --- a/include/Mainpage.hpp +++ /dev/null @@ -1,85 +0,0 @@ -// This file is part of libZelda. -// -// libZelda is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// libZelda is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with libZelda. If not, see - -#ifndef __MAINPAGE_HPP__ -#define __MAINPAGE_HPP__ - -/*! \mainpage libZelda - * \section intro_sec Introduction to libZelda - * libZelda is an IO Library which is designed to be powerful, simple, - * and infinitely extensible.
- *
- * libZelda provides several basic classes that can be used to read from - * and write to files, and memory, classes such as Stream, BinaryReader, BinaryWriter, - * and TextStream. - * \section example_sec BinaryWriter example - * \code - * #include "BinaryWriter.hpp" - * #include "FileNotFoundException.hpp" - * #include "Exception.hpp" - * int main() - * { - * try - * { - * BinaryWriter writer("test.bin"); - * writer.writeByte('t'); - * writer.writeInt32(123454321); - * writer.save(); - * } - * catch (FileNotFoundException e) - * { - * std::cout << e.message() << std::endl; - * } - * catch (Exception e) - * { - * std::cout << e.message() << std::endl; - * } - * catch(...) - * { - * } - * return 0; - * } - * \endcode - * \section example_sec BinaryReader example - * \code - * #include "BinaryReader.hpp" - * #include "FileNotFoundException.hpp" - * #include "Exception.hpp" - * int main() - * { - * try - * { - * BinaryReader writer("test.bin"); - * std::cout << reader.readByte() << std::endl; - * std::cout << reader.readInt32() << std::endl; - * } - * catch (FileNotFoundException e) - * { - * std::cout << e.message() << std::endl; - * } - * catch (Exception e) - * { - * std::cout << e.message() << std::endl; - * } - * catch(...) - * { - * } - * return 0; - * } - * \endcode - * \section Credits - * Chibi Zelda: AnimeWaterFall on Deviantart - */ -#endif // __MAINPAGE_HPP__ diff --git a/include/SkywardSwordFile.hpp b/include/SkywardSwordFile.hpp deleted file mode 100644 index 660ae6e..0000000 --- a/include/SkywardSwordFile.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __SSFILE_HPP__ -#define __SSFILE_HPP__ - -#include "Types.hpp" - -// standard lib -#include - -namespace zelda -{ -class SkywardSwordQuest; - -class SkywardSwordFile -{ -public: - enum MagicNumbers - { - USMagic = 0x534F5545, - JAMagic = 0x534F554A, - EUMagic = 0x534F5550 - }; - - SkywardSwordFile(); - SkywardSwordFile(std::vector quests); - ~SkywardSwordFile(); - - void addQuest(SkywardSwordQuest* q); - SkywardSwordQuest* quest(Uint32 id); - std::vector questList() const; - - void setRegion(Region region); - Region region() const; -private: - Region m_region; - // A vector is a bit overkill - std::vector m_quests; - Uint32 m_numQuests; -}; - -} -#endif // __SSFILE_HPP__ diff --git a/include/SkywardSwordFileReader.hpp b/include/SkywardSwordFileReader.hpp deleted file mode 100644 index eee4c76..0000000 --- a/include/SkywardSwordFileReader.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __SSFILEREADER_HPP__ -#define __SSFILEREADER_HPP__ - -#include "BinaryReader.hpp" - -namespace zelda -{ -class SkywardSwordFile; -namespace io -{ -class SkywardSwordFileReader : public BinaryReader -{ - BINARYREADER_BASE -public: - - SkywardSwordFileReader(Uint8* data, Uint64 length); - SkywardSwordFileReader(const std::string& filename); - - SkywardSwordFile* read(); -}; -} // io -} // zelda - -#endif // __SSFILEREADER_HPP__ diff --git a/include/SkywardSwordFileWriter.hpp b/include/SkywardSwordFileWriter.hpp deleted file mode 100644 index 9e86821..0000000 --- a/include/SkywardSwordFileWriter.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __SSFILEWRITER_HPP__ -#define __SSFILEWRITER_HPP__ - -#include "BinaryWriter.hpp" - -namespace zelda -{ -class SkywardSwordFile; - -namespace io -{ - -class SkywardSwordFileWriter : public BinaryWriter -{ - // Why does this fuck up my formatting in Qt Creator? - BINARYWRITER_BASE -public: - SkywardSwordFileWriter(Uint8* data, Uint64 len); - SkywardSwordFileWriter(const std::string& filename); - - void write(SkywardSwordFile* file); -}; -} -} -#endif // __SSFILEWRITER_HPP__ diff --git a/include/SkywardSwordQuest.hpp b/include/SkywardSwordQuest.hpp deleted file mode 100644 index 00f9934..0000000 --- a/include/SkywardSwordQuest.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef SKYWARDSWORDQUEST_HPP -#define SKYWARDSWORDQUEST_HPP - -#include "ZQuestFile.hpp" - -namespace zelda -{ - -// TODO: Handle game specific data -class SkywardSwordQuest : public ZQuestFile -{ -public: - SkywardSwordQuest(Uint8* data, Uint32 len); - - // TODO: Is len really needed? - void setSkipData(const Uint8* data, Uint32 len = 0x24); - Uint8* skipData() const; - - Uint32 skipLength() const; - -private: - Uint8* m_skipData; - Uint32 m_skipLength; -}; - - -} // zelda -#endif // SSQUEST_HPP diff --git a/include/SpriteFileReader.hpp b/include/SpriteFileReader.hpp deleted file mode 100644 index 5e7b684..0000000 --- a/include/SpriteFileReader.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef SSPRITEFILEREADER_HPP -#define SSPRITEFILEREADER_HPP - -#include - -namespace zelda -{ -namespace Sakura -{ -class SpriteFile; -} // Sakura - -namespace io -{ - -class SpriteFileReader : public zelda::io::BinaryReader -{ - BINARYREADER_BASE; -public: - SpriteFileReader(Uint8* data, Uint64 length); - SpriteFileReader(const std::string& filepath); - - Sakura::SpriteFile* readFile(); -}; -} // io -} // zelda - - -#endif // SSPRITEFILEREADER_HPP diff --git a/include/SpriteFileWriter.hpp b/include/SpriteFileWriter.hpp deleted file mode 100644 index a375e5f..0000000 --- a/include/SpriteFileWriter.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef SSPRITEFILEWRITER_HPP -#define SSPRITEFILEWRITER_HPP - -#include - -namespace zelda -{ -namespace Sakura -{ -class SpriteFile; -} // Sakura - -namespace io -{ - -class SpriteFileWriter : public zelda::io::BinaryWriter -{ - BINARYWRITER_BASE; -public: - SpriteFileWriter(Uint8* data, Uint64 length); - - SpriteFileWriter(const std::string& filepath); - - void writeFile(Sakura::SpriteFile* file); -}; - -} // io -} // zelda -#endif // SSPRITEFILEWRITER_HPP diff --git a/include/Stream.hpp b/include/Stream.hpp deleted file mode 100644 index d7c23ec..0000000 --- a/include/Stream.hpp +++ /dev/null @@ -1,261 +0,0 @@ -// This file is part of libZelda. -// -// libZelda is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// libZelda is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with libZelda. If not, see -#ifndef __STREAM_HPP__ -#define __STREAM_HPP__ - -#include "Types.hpp" - -namespace zelda -{ -namespace io -{ - -/*! \class Stream - * \brief Stream is the main class all streams inherit from - * - * The Stream class contains the memory buffer, buffer size, and current position.
- * It provides basic functionality such as reading or writing bits and bytes - * The user has the ability to specify the Endianness of the Stream as well - * And all inheriting classes are required to take that into account to be accepted - * as a valid stream.
- *
- * Stream can also be used by itself though it's not advised as it's not feature filled.
- * It's highly suggested to use of the more advanced Streams such as BinaryReader. - */ -class Stream -{ -public: - //! \brief Default buffer block size. - static const Uint32 BLOCKSZ; - - /*! \enum SeekOrigin - * \brief Specifies how to seek in a stream. - */ - enum SeekOrigin - { - Beginning = 0, //!< Tells the Stream to seek from the Beginning of the buffer. - Current, //!< Tells the Stream to seek from the Current position of the buffer. - End //!< Tells the Stream to seek from the End of the buffer. - }; - - /*! \brief The default constructor - */ - Stream(); - /*! \brief This constructor takes an existing buffer to read from. - * - * \param bytes The existing buffer - * \param length The length of the existing buffer - */ - Stream(const Uint8* bytes, Uint64 length); - /*! \brief This constructor creates a buffer from the given length. - * - * \param length The length of the existing buffer - */ - Stream(Int64 length); - /*! \brief This constructor takes an existing Stream to read from. - * - * \param stream The stream to read data from - */ - Stream(Stream* stream); - - /*! \brief The destructor cleans up memory and sets everything back - * to the default settings. - */ - virtual ~Stream(); - - /*! \brief Writes a bit at the current position and advances the position by one bit. - * \param val the value to write - * \throw IOException - */ - virtual void writeBit(bool val); - - /*! \brief Writes a byte at the current position and advances the position by one byte. - * \param byte The value to write - * \throw IOException - */ - virtual void writeUByte(Uint8 byte); - /*! \brief Writes a byte at the current position and advances the position by one byte. - * \param byte The value to write - * \throw IOException - */ - virtual void writeByte(Int8 byte); - - /*! \brief 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. - * - * \param data The buffer to write - * \param length The amount to write - * \throw IOException - */ - virtual void writeUBytes(Uint8* data, Int64 length); - - /*! \brief 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. - * - * \param data The buffer to write - * \param length The amount to write - * \throw IOException - */ - virtual void writeBytes(Int8* data, Int64 length); - - /*! \brief Reads a bit at the current position and advances the current position - * - * \return bool The value at the current position - * \throw IOException - */ - virtual bool readBit(); - /*! \brief Reads a byte at the current position and advances the current position - * - * \return Int8 The value at the current position - * \throw IOException - */ - virtual Int8 readByte(); - - /*! \brief Reads a byte at the current position and advances the current position - * - * \return Uint8 The value at the current position - * \throw IOException - */ - virtual Uint8 readUByte(); - - /*! \brief Reads a byte at the current position and advances the current position. - * - * \return Uint8* The buffer at the current position from the given length. - * \throw IOException - */ - virtual Uint8* readUBytes(Int64 length); - - /*! \brief Reads a byte at the current position and advances the current position. - * - * \return Int8* The buffer at the current position from the given length. - * \throw IOException - */ - virtual Int8* readBytes(Int64 length); - - /*! \brief Sets the buffers position relative to the specified position.
- * It seeks relative to the current position by default. - * \param position where in the buffer to seek - * \param origin The Origin to seek \sa SeekOrigin - * \throw IOException - */ - void seek(Int64 position, SeekOrigin origin = Current); - - /*! \brief Resizes the buffer to the given length.
- * The new size must be greater than the current length to avoid loss of data. - * \param newSize The amount to resize by. - * \throw IOException - */ - void resize(Uint64 newSize); - - /*! \brief 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. - * \param data The new buffer. - * \param length The length of the new buffer. - * \throw IOException - */ - void setData(const Uint8* data, Uint64 length); - - - /*! \brief 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. - * \return Uint8* The copy of the buffer. - */ - Uint8* data() const; - - /*! \brief Returns the length of the Stream. - * - * \return Int64 The length of the stream. - */ - Int64 length() const; - - /*! \brief Returns the current position in the stream. - * - * \return Int64 The current position in the stream. - */ - Int64 position() const; - - /*! \brief Returns whether or not the stream is at the end. - * - * \return bool True if at end; False otherwise. - */ - bool atEnd() const; - - /*! \brief Sets whether the Stream resizes when the at the end of the buffer. - * - * \param val True for resizing; False for no resizing. - */ - void setAutoResizing(bool val); - - /*! \brief Retuns whether or not the Stream currenty autoresizes. - * - * \return True for resizing; False otherwise. - */ - bool autoResizing() const; - - - /*! \brief Retuns whether or not the Stream is open for reading. - * - * \return True if open for reading; False otherwise. - */ - virtual bool isOpenForReading() const; - - /*! \brief Retuns whether or not the Stream is open for writing - * - * \return True if open for writing; False otherwise. - */ - virtual bool isOpenForWriting() const; - - /*! \brief Sets the Endianss of the stream - * - * \param endian The Endianess to set \sa Endian - */ - void setEndianess(Endian endian); - - /*! \brief Returns the current Endianness of the stream - * - * \return Endian The current Stream Endianess - */ - Endian endian() const; - - - /*! \brief Returns whether the stream is BigEndian - * - * \return bool True for BigEndian; False for LittleEndian - */ - bool isBigEndian() const; - - /*! \brief Returns whether the stream is LittleEndian - * - * \return bool True for LittleEndian; False for BigEndian - */ - bool isLittleEndian() const; - -protected: - Uint32 m_bitPosition; //!< The current position in the current byte - Uint64 m_position; //!< The current position in the Stream - Uint64 m_length; //!< The length of the Stream - Endian m_endian; //!< The Endianess of the Stream - Uint8* m_data; //!< The Stream buffer - bool m_autoResize; //!< Whether the stream is autoresizing -}; -} // io -} // zelda -#endif // __STREAM_HPP__ diff --git a/include/TextStream.hpp b/include/TextStream.hpp deleted file mode 100644 index 094302f..0000000 --- a/include/TextStream.hpp +++ /dev/null @@ -1,170 +0,0 @@ -// This file is part of libZelda. -// -// libZelda is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// libZelda is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with libZelda. If not, see -#ifndef __TEXTSTREAM_HPP__ -#define __TEXTSTREAM_HPP__ - -#include "Stream.hpp" -#include -#include - - -namespace zelda -{ -namespace io -{ -// TODO (Phil#1#): Need to actually use AccessMode -/*! \class TextStream - * \brief A Class for reading or writing Text data. - * - * TextStream is a class for reading/writing TextData.
- * It is currently incomplete, but usable, so use with caution.
- * Since it's incomplete it may not behave exactly as expected. - */ -class TextStream : public Stream -{ -public: - /*! \enum TextMode - * \brief Specifies how the file is opened. - */ - enum TextMode - { - Open = 0x01, //!< The file is opened if it exists. - Create = 0x02, //!< Create the file if it does not exist. - OpenOrCreate = Open|Create, //!< If the file does not exist when opening the file it is created - Truncate = 0x04, //!< All the data currently that is in the file is erased. - Append = 0x08 //!< After opening the file the current line is set to the end of the buffer - }; - - /*! \enum AccessMode - * \brief Specifies how the Stream can be interacted with. - */ - enum AccessMode - { - ReadOnly, //!< The Stream can only be read from. - WriteOnly,//!< The Stream can only be written to. - ReadWrite //!< The Stream can be read from or written to. - }; - - TextStream(); - /*! \brief This constructor opens the file and loads all the lines. */ - TextStream(const std::string& filename, Uint32 fileMode = Open, AccessMode accessMode = ReadWrite); - - /*! \brief Creates a new buffer and saves all lines to the specified file. - * \param filename The file, including path to save to. - */ - void save(const std::string& filename = ""); - - /*! \brief Reads the line at the current address. - * - * \return std::string The line read. - */ - std::string readLine(); - - /*! \brief Writes a line to the buffer - * - * \param str The string to write. - */ - void writeLine(const std::string& str); - - /*! \brief Reads a given amount of lines relative to the current address - * - * \param numLines The amount of lines to read. - * \return std::vector The lines read. - */ - std::vector readLines(Uint32 numLines); - - /*! \brief Reads a given list of lines relative to the current address - * - * \param lines The lines to write. - */ - void writeLines(std::vector lines); - - /*! \brief Reads all the lines in the current buffer. - * - * \return The lines read. - */ - std::vector readAllLines(); - - /*! \brief Reads a line at the given address. - * - * \param line The line to read. - * \return std::string The lines read. - */ - std::string readLineAt(Uint32 line); - - /*! \brief Writes a line at the given address. - * - * \param line The address to write to. - * \param str The string to write. - */ - void writeLineAt(Uint32 line, const std::string& str); - - /*! \brief Sets the current line in the Stream. - * - * \param line The line to seek to. - */ - void setCurrentLine(Uint32 line); - - /*! \brief Returns the current line in the stream. - * - * \return Uint32 The current line in the stream. - */ - Uint32 currentLine() const; - - /*! \brief Sets the AccessMode of the Stream. - * - * \param mode The mode to set. - */ - void setAccessMode(AccessMode mode); - - /*! \brief Returns the AccessMode of the Stream. - * - * \return AccessModeThe mode to set. - */ - AccessMode accessMode() const; - - /*! \brief Sets the Textmode of the Stream. - * - * \param mode The mode to set. - */ - void setTextMode(TextMode mode); - - /*! \brief Returns the TextMode of the Stream. - * - * \return TextMode The mode to set. - */ - Uint32 textMode() const; - - - /*! \brief Empties the stream. - * - */ - void truncate(); - - bool isOpenForReading() const; - bool isOpenForWriting() const; -private: - void loadLines(); - std::string m_filename; - Uint32 m_textmode; - AccessMode m_accessmode; - - std::vector m_lines; - Uint32 m_currentLine; - Uint32 m_startLength; -}; -} // io -} // zelda -#endif diff --git a/include/aes.h b/include/aes.h index 4f78a97..a81d2df 100644 --- a/include/aes.h +++ b/include/aes.h @@ -1,7 +1,7 @@ #ifndef __AES_H_ #define __AES_H_ -#include +#include "Athena/Types.hpp" #ifdef __cplusplus extern "C" { diff --git a/include/bn.h b/include/bn.h index d977f6f..8b3429a 100644 --- a/include/bn.h +++ b/include/bn.h @@ -3,8 +3,7 @@ #ifndef __DOXYGEN_IGNORE__ -#include - +#include "Athena/Types.hpp" int bn_compare(Uint8 *a, Uint8 *b, Uint32 n); void bn_sub_modulus(Uint8 *a, Uint8 *N, Uint32 n); void bn_add(Uint8 *d, Uint8 *a, Uint8 *b, Uint8 *N, Uint32 n); diff --git a/include/ec.h b/include/ec.h index e39d889..37df017 100644 --- a/include/ec.h +++ b/include/ec.h @@ -1,6 +1,6 @@ #ifndef EC_H #define EC_H -#include +#include "Athena/Types.hpp" bool check_ec ( Uint8 *ng, Uint8 *ap, Uint8 *sig, Uint8 *sig_hash ); void make_ec_cert ( Uint8 *cert, Uint8 *sig, char *signer, char *name, Uint8 *priv, Uint32 key_id ); diff --git a/include/lzo.h b/include/lzo.h index c2dbedf..ab07a62 100644 --- a/include/lzo.h +++ b/include/lzo.h @@ -20,7 +20,7 @@ #ifndef _LZO_H #define LZO_H -#include "Types.hpp" +#include "Athena/Types.hpp" #define LZO_INPUT_DEPLETED 1 #define LZO_OUTPUT_FULL 2 diff --git a/include/sha1.h b/include/sha1.h index b802ace..b6bd088 100644 --- a/include/sha1.h +++ b/include/sha1.h @@ -1,7 +1,7 @@ #ifndef _SHA1_H_ #define _SHA1_H_ -#include +#include "Athena/Types.hpp" #ifndef __DOXYGEN_IGNORE__ #ifdef __cplusplus diff --git a/libzelda.cbp b/libzelda.cbp deleted file mode 100644 index 53298bd..0000000 --- a/libzelda.cbp +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - diff --git a/libzelda.conf b/libzelda.conf deleted file mode 100644 index 97e4298..0000000 --- a/libzelda.conf +++ /dev/null @@ -1,1869 +0,0 @@ -# Doxyfile 1.8.3.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" "). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or sequence of words) that should -# identify the project. Note that if you do not use Doxywizard you need -# to put quotes around the project name if it contains spaces. - -PROJECT_NAME = - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer -# a quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify an logo or icon that is -# included in the documentation. The maximum height of the logo should not -# exceed 55 pixels and the maximum width should not exceed 200 pixels. -# Doxygen will copy the logo to the output directory. - -PROJECT_LOGO = libzelda.png - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = doc - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = Yes - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. Note that you specify absolute paths here, but also -# relative paths, which will be relative from the directory where doxygen is -# started. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding -# "class=itcl::class" will allow you to use the command class in the -# itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, -# and language is one of the parsers supported by doxygen: IDL, Java, -# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, -# C++. For instance to make doxygen treat .inc files as Fortran files (default -# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note -# that for custom extensions you also need to set FILE_PATTERNS otherwise the -# files are not read by doxygen. - -EXTENSION_MAPPING = - -# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all -# comments according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you -# can mix doxygen, HTML, and XML commands with Markdown formatting. -# Disable only in case of backward compatibilities issues. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented classes, -# or namespaces to their corresponding documentation. Such a link can be -# prevented in individual cases by by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also makes the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES (the -# default) will make doxygen replace the get and set methods by a property in -# the documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and -# unions are shown inside the group in which they are included (e.g. using -# @ingroup) instead of on a separate page (for HTML and Man pages) or -# section (for LaTeX and RTF). - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and -# unions with only public data fields will be shown inline in the documentation -# of the scope in which they are defined (i.e. file, namespace, or group -# documentation), provided this scope is documented. If set to NO (the default), -# structs, classes, and unions are shown on a separate page (for HTML and Man -# pages) or section (for LaTeX and RTF). - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penalty. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will roughly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. - -SYMBOL_CACHE_SIZE = 0 - -# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be -# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given -# their name and scope. Since this can be an expensive process and often the -# same symbol appear multiple times in the code, doxygen keeps a cache of -# pre-resolved symbols. If the cache is too small doxygen will become slower. -# If the cache is too large, memory is wasted. The cache size is given by this -# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal -# scope will be included in the documentation. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to -# do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen -# will still accept a match between prototype and implementation in such cases. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if section-label ... \endif -# and \cond section-label ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or macro consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and macros in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. -# This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files -# containing the references data. This must be a list of .bib files. The -# .bib extension is automatically appended if omitted. Using this command -# requires the bibtex tool to be installed. See also -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style -# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this -# feature you need bibtex and perl available in the search path. Do not use -# file names with spaces, bibtex cannot handle them. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_NO_PARAMDOC option can be enabled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = ./src ./include - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.for *.vhd *.vhdl - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. -# If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. -# Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. -# The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty or if -# non of the patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) -# and it is also possible to disable source filtering for a specific pattern -# using *.ext= (so without naming a filter). This option only has effect when -# FILTER_SOURCE_FILES is enabled. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page (index.html). -# This can be useful if you have a project on for instance GitHub and want reuse -# the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C, C++ and Fortran comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen -# needs, which is dependent on the configuration options used. -# It is advised to generate a default header using "doxygen -w html -# header.html footer.html stylesheet.css YourConfigFile" and then modify -# that header. Note that the header is subject to change so you typically -# have to redo this when upgrading to a newer version of doxygen or when -# changing the value of configuration settings such as GENERATE_TREEVIEW! - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If left blank doxygen will -# generate a default style sheet. Note that it is recommended to use -# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this -# tag will in the future become obsolete. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional -# user-defined cascading style sheet that is included after the standard -# style sheets created by doxygen. Using this option one can overrule -# certain style aspects. This is preferred over using HTML_STYLESHEET -# since it does not replace the standard style sheet and is therefor more -# robust against future updates. Doxygen will copy the style sheet file to -# the output directory. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that -# the files will be copied as-is; there are no commands or markers available. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the style sheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of -# entries shown in the various tree structured indices initially; the user -# can expand and collapse entries dynamically later on. Doxygen will expand -# the tree to such a level that at most the specified number of entries are -# visible (unless a fully collapsed tree already exceeds this amount). -# So setting the number of entries 1 will produce a full collapsed tree by -# default. 0 is a special value representing an infinite number of entries -# and will result in a full expanded tree by default. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely -# identify the documentation publisher. This should be a reverse domain-name -# style string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) -# at top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. Since the tabs have the same information as the -# navigation tree you can set this option to NO if you already set -# GENERATE_TREEVIEW to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. -# Since the tree basically has the same information as the tab index you -# could consider to set DISABLE_INDEX to NO when enabling this option. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values -# (range [0,1..20]) that doxygen will group on one line in the generated HTML -# documentation. Note that a value of 0 will completely suppress the enum -# values from appearing in the overview section. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the -# rendering instead of using prerendered bitmaps. Use this if you do not -# have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you may also need to install MathJax separately and -# configure the path to it using the MATHJAX_RELPATH option. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and -# SVG. The default value is HTML-CSS, which is slower, but has the best -# compatibility. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the -# HTML output directory using the MATHJAX_RELPATH option. The destination -# directory should contain the MathJax.js script. For instance, if the mathjax -# directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to -# the MathJax Content Delivery Network so you can quickly see the result without -# installing MathJax. -# However, it is strongly recommended to install a local -# copy of MathJax from http://www.mathjax.org before deployment. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension -# names that should be enabled during MathJax rendering. - -MATHJAX_EXTENSIONS = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = YES - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. -# There are two flavours of web server based search depending on the -# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for -# searching and an index file used by the script. When EXTERNAL_SEARCH is -# enabled the indexing and searching needs to be provided by external tools. -# See the manual for details. - -SERVER_BASED_SEARCH = NO - -# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP -# script for searching. Instead the search results are written to an XML file -# which needs to be processed by an external indexer. Doxygen will invoke an -# external search engine pointed to by the SEARCHENGINE_URL option to obtain -# the search results. Doxygen ships with an example indexer (doxyindexer) and -# search engine (doxysearch.cgi) which are based on the open source search engine -# library Xapian. See the manual for configuration details. - -EXTERNAL_SEARCH = NO - -# The SEARCHENGINE_URL should point to a search engine hosted by a web server -# which will returned the search results when EXTERNAL_SEARCH is enabled. -# Doxygen ships with an example search engine (doxysearch) which is based on -# the open source search engine library Xapian. See the manual for configuration -# details. - -SEARCHENGINE_URL = - -# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed -# search data is written to a file for indexing by an external tool. With the -# SEARCHDATA_FILE tag the name of this file can be specified. - -SEARCHDATA_FILE = searchdata.xml - -# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the -# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is -# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple -# projects and redirect the results back to the right project. - -EXTERNAL_SEARCH_ID = - -# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen -# projects other than the one defined by this configuration file, but that are -# all added to the same external search index. Each project needs to have a -# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id -# of to a relative location where the documentation can be found. -# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... - -EXTRA_SEARCH_MAPPINGS = - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = YES - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = YES - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4 - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for -# the generated latex document. The footer should contain everything after -# the last chapter. If it is left blank doxygen will generate a -# standard footer. Notice: only use this tag if you know what you are doing! - -LATEX_FOOTER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -# The LATEX_BIB_STYLE tag can be used to specify the style to use for the -# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See -# http://en.wikipedia.org/wiki/BibTeX for more info. - -LATEX_BIB_STYLE = plain - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load style sheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. -# This is useful -# if you want to understand what is going on. -# On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# pointed to by INCLUDE_PATH will be searched when a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = __DOXYGEN_IGNORE__ - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition that -# overrules the definition found in the source code. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all references to function-like macros -# that are alone on a line, have an all uppercase name, and do not end with a -# semicolon, because these will confuse the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. For each -# tag file the location of the external documentation should be added. The -# format of a tag file without this location is as follows: -# -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths -# or URLs. Note that each tag file must have a unique name (where the name does -# NOT include the path). If a tag file is not located in the directory in which -# doxygen is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option also works with HAVE_DOT disabled, but it is recommended to -# install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will use the Helvetica font for all dot files that -# doxygen generates. When you want a differently looking font you can specify -# the font name using DOT_FONTNAME. You need to make sure dot is able to find -# the font, which can be done by putting it in a standard location or by setting -# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the -# directory containing the font. - -DOT_FONTNAME = Helvetica - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the Helvetica font. -# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to -# set the path where dot can find it. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If the UML_LOOK tag is enabled, the fields and methods are shown inside -# the class node. If there are many fields or methods and many nodes the -# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS -# threshold limits the number of items for each type to make the size more -# managable. Set this to 0 for no limit. Note that the threshold may be -# exceeded by 50% before the limit is enforced. - -UML_LIMIT_NUM_FIELDS = 10 - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will generate a graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are svg, png, jpg, or gif. -# If left blank png will be used. If you choose svg you need to set -# HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible in IE 9+ (other browsers do not have this requirement). - -DOT_IMAGE_FORMAT = png - -# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to -# enable generation of interactive SVG images that allow zooming and panning. -# Note that this requires a modern browser other than Internet Explorer. -# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you -# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible. Older versions of IE do not have SVG support. - -INTERACTIVE_SVG = NO - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the -# \mscfile command). - -MSCFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/libzelda.layout b/libzelda.layout deleted file mode 100644 index dbda020..0000000 --- a/libzelda.layout +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/libzelda.png b/libzelda.png deleted file mode 100644 index 6248b6e3123e94c10c4e7e7b43fe584992ae53ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 30406 zcmV)*K#9MJP)WFU8GbZ8()Nlj2>E@cM*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Hq1R=k8|vc$)CTE2r|rKBAIN#l++S{z}C($q1#IMX{9d!(Fxe=OzGjX zr%UJGv}~KVUI0x4T5WxLz%1XEZI;27Afrq&ESgP#Cddi9-NdqjBKOeBWcXQ|ub6rd;0$)1|uAb(f%zNS( z`q$Dz96H}DOo6<2#@!1}<``?I+C<_TA8p;wv$IY;uqW%y?<$V32Q@t50{_x!z8Dz) z`R`2{7EHnN&;@|s3;b)I#=5OIEoh-C3)w$h--g@8jAckfP$B;n{JG53epp{?UZd;y z`qFhO{@hCIY9mzXv1eR>w^<88@ghSo=J_@FkccN3LRkoUhGabha|e7%Q0M%`pI#bg z&;twq=+jv$2fpU)tYSmF#$j@ql%8>Lpaqxve$x(9LHmi}q^_!PS_ZWH>fwoZ}& diff --git a/libzelda.pri b/libzelda.pri deleted file mode 100644 index b3e0d2d..0000000 --- a/libzelda.pri +++ /dev/null @@ -1,100 +0,0 @@ -INCLUDEPATH += $$PWD/include - -QMAKE_CXXFLAGS = -std=c++0x - -unix:LIBS += -lz -win32:LIBS += -lzlib -HEADERS += \ - $$PWD/include/utility.hpp \ - $$PWD/include/utf8.h \ - $$PWD/include/utf8/unchecked.h \ - $$PWD/include/utf8/core.h \ - $$PWD/include/utf8/checked.h \ - $$PWD/include/Types.hpp \ - $$PWD/include/TextStream.hpp \ - $$PWD/include/Stream.hpp \ - $$PWD/include/Mainpage.hpp \ - $$PWD/include/InvalidOperationException.hpp \ - $$PWD/include/IOException.hpp \ - $$PWD/include/FileNotFoundException.hpp \ - $$PWD/include/Exception.hpp \ - $$PWD/include/BinaryWriter.hpp \ - $$PWD/include/BinaryReader.hpp \ - $$PWD/include/WiiBanner.hpp \ - $$PWD/include/WiiFile.hpp \ - $$PWD/include/WiiSave.hpp \ - $$PWD/include/WiiSaveReader.hpp \ - $$PWD/include/WiiSaveWriter.hpp \ - $$PWD/include/aes.h \ - $$PWD/include/bn.h \ - $$PWD/include/ec.h \ - $$PWD/include/md5.h \ - $$PWD/include/sha1.h \ - $$PWD/include/ALTTPStructs.hpp \ - $$PWD/include/ALTTPQuest.hpp \ - $$PWD/include/ALTTPFileWriter.hpp \ - $$PWD/include/ALTTPFileReader.hpp \ - $$PWD/include/ALTTPFile.hpp \ - $$PWD/include/ALTTPEnums.hpp \ - $$PWD/include/MCFileReader.hpp \ - $$PWD/include/MCFile.hpp \ - $$PWD/include/MCFileWriter.hpp \ - $$PWD/include/ZQuestFileWriter.hpp \ - $$PWD/include/ZQuestFileReader.hpp \ - $$PWD/include/Compression.hpp \ - $$PWD/include/lzo.h \ - $$PWD/include/WiiImage.hpp \ - $$PWD/include/ZQuestFile.hpp \ - $$PWD/include/Checksums.hpp \ - $$PWD/include/SkywardSwordFile.hpp \ - $$PWD/include/SkywardSwordFileReader.hpp \ - $$PWD/include/SkywardSwordFileWriter.hpp \ - $$PWD/include/SkywardSwordQuest.hpp \ - $$PWD/include/Sprite.hpp \ - $$PWD/include/SpriteFile.hpp \ - $$PWD/include/SpriteFileReader.hpp \ - $$PWD/include/SpriteFileWriter.hpp \ - $$PWD/include/SpriteFrame.hpp \ - $$PWD/include/SpritePart.hpp \ - $$PWD/include/InvalidDataException.hpp - -SOURCES += \ - $$PWD/src/utility.cpp \ - $$PWD/src/TextStream.cpp \ - $$PWD/src/Stream.cpp \ - $$PWD/src/BinaryWriter.cpp \ - $$PWD/src/BinaryReader.cpp \ - $$PWD/src/WiiBanner.cpp \ - $$PWD/src/WiiFile.cpp \ - $$PWD/src/WiiSave.cpp \ - $$PWD/src/WiiSaveReader.cpp \ - $$PWD/src/WiiSaveWriter.cpp \ - $$PWD/src/aes.c \ - $$PWD/src/bn.cpp \ - $$PWD/src/ec.cpp \ - $$PWD/src/md5.cpp \ - $$PWD/src/sha1.cpp \ - $$PWD/src/ALTTPQuest.cpp \ - $$PWD/src/ALTTPFileWriter.cpp \ - $$PWD/src/ALTTPFileReader.cpp \ - $$PWD/src/ALTTPFile.cpp \ - $$PWD/src/MCFileReader.cpp \ - $$PWD/src/MCFile.cpp \ - $$PWD/src/MCFileWriter.cpp \ - $$PWD/src/ZQuestFileWriter.cpp \ - $$PWD/src/ZQuestFileReader.cpp \ - $$PWD/src/Compression.cpp \ - $$PWD/src/lzo.c \ - $$PWD/src/WiiImage.cpp \ - $$PWD/src/ZQuestFile.cpp \ - $$PWD/src/Checksums.cpp \ - $$PWD/src/SkywardSwordFile.cpp \ - $$PWD/src/SkywardSwordFileReader.cpp \ - $$PWD/src/SkywardSwordFileWriter.cpp \ - $$PWD/src/SkywardSwordQuest.cpp \ - $$PWD/src/Sprite.cpp \ - $$PWD/src/SpriteFile.cpp \ - $$PWD/src/SpriteFileReader.cpp \ - $$PWD/src/SpriteFileWriter.cpp \ - $$PWD/src/SpriteFrame.cpp \ - $$PWD/src/SpritePart.cpp diff --git a/libzelda.pro b/libzelda.pro deleted file mode 100644 index 3d67865..0000000 --- a/libzelda.pro +++ /dev/null @@ -1,125 +0,0 @@ -CONFIG += staticlib -TEMPLATE= lib -DESTDIR = ./lib - -# Uncomment this if you wish to use Qt with libZelda -#DEFINES += LIBZELDA_USE_QT - -contains(DEFINES, LIBZELDA_USE_QT){ - QT += core -} - -CONFIG(debug, debug|release){ - DEFINES += DEBUG - TARGET=zelda-d - # We don't want the objects, - # in the project directory, so tell qmake - # where to put them - OBJECTS_DIR = obj/debug -} - -CONFIG(release, release|debug){ - DEFINES -= DEBUG - TARGET=zelda - # We don't want the objects, - # in the project directory, so tell qmake - # where to put them - OBJECTS_DIR = obj/release -} - -QMAKE_CXXFLAGS = -std=c++0x -INCLUDEPATH += include - -HEADERS += \ - include/utility.hpp \ - include/utf8.h \ - include/utf8/unchecked.h \ - include/utf8/core.h \ - include/utf8/checked.h \ - include/Types.hpp \ - include/TextStream.hpp \ - include/Stream.hpp \ - include/Mainpage.hpp \ - include/InvalidOperationException.hpp \ - include/IOException.hpp \ - include/FileNotFoundException.hpp \ - include/Exception.hpp \ - include/BinaryWriter.hpp \ - include/BinaryReader.hpp \ - include/WiiBanner.hpp \ - include/WiiFile.hpp \ - include/WiiSave.hpp \ - include/WiiSaveReader.hpp \ - include/WiiSaveWriter.hpp \ - include/aes.h \ - include/bn.h \ - include/ec.h \ - include/md5.h \ - include/sha1.h \ - include/ALTTPStructs.hpp \ - include/ALTTPQuest.hpp \ - include/ALTTPFileWriter.hpp \ - include/ALTTPFileReader.hpp \ - include/ALTTPFile.hpp \ - include/ALTTPEnums.hpp \ - include/MCFileReader.hpp \ - include/MCFile.hpp \ - include/MCFileWriter.hpp \ - include/ZQuestFileWriter.hpp \ - include/ZQuestFileReader.hpp \ - include/Compression.hpp \ - include/lzo.h \ - include/WiiImage.hpp \ - include/ZQuestFile.hpp \ - include/Checksums.hpp \ - include/SkywardSwordFile.hpp \ - include/SkywardSwordFileReader.hpp \ - include/SkywardSwordFileWriter.hpp \ - include/SkywardSwordQuest.hpp \ - include/Sprite.hpp \ - include/SpriteFile.hpp \ - include/SpriteFileReader.hpp \ - include/SpriteFileWriter.hpp \ - include/SpriteFrame.hpp \ - include/SpritePart.hpp - -SOURCES += \ - src/utility.cpp \ - src/TextStream.cpp \ - src/Stream.cpp \ - src/BinaryWriter.cpp \ - src/BinaryReader.cpp \ - src/WiiBanner.cpp \ - src/WiiFile.cpp \ - src/WiiSave.cpp \ - src/WiiSaveReader.cpp \ - src/WiiSaveWriter.cpp \ - src/aes.c \ - src/bn.cpp \ - src/ec.cpp \ - src/md5.cpp \ - src/sha1.cpp \ - src/ALTTPQuest.cpp \ - src/ALTTPFileWriter.cpp \ - src/ALTTPFileReader.cpp \ - src/ALTTPFile.cpp \ - src/MCFileReader.cpp \ - src/MCFile.cpp \ - src/MCFileWriter.cpp \ - src/ZQuestFileWriter.cpp \ - src/ZQuestFileReader.cpp \ - src/Compression.cpp \ - src/lzo.c \ - src/WiiImage.cpp \ - src/ZQuestFile.cpp \ - src/Checksums.cpp \ - src/SkywardSwordFile.cpp \ - src/SkywardSwordFileReader.cpp \ - src/SkywardSwordFileWriter.cpp \ - src/SkywardSwordQuest.cpp \ - src/Sprite.cpp \ - src/SpriteFile.cpp \ - src/SpriteFileReader.cpp \ - src/SpriteFileWriter.cpp \ - src/SpriteFrame.cpp \ - src/SpritePart.cpp diff --git a/libzelda.vcproj b/libzelda.vcproj deleted file mode 100644 index 8f14164..0000000 --- a/libzelda.vcproj +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libzelda_wii.cbp b/libzelda_wii.cbp deleted file mode 100644 index 4b1a528..0000000 --- a/libzelda_wii.cbp +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - diff --git a/license.txt b/license.txt deleted file mode 100644 index 94a9ed0..0000000 --- a/license.txt +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/src/ALTTPFile.cpp b/src/Athena/ALTTPFile.cpp similarity index 62% rename from src/ALTTPFile.cpp rename to src/Athena/ALTTPFile.cpp index 35d712f..2865975 100644 --- a/src/ALTTPFile.cpp +++ b/src/Athena/ALTTPFile.cpp @@ -1,24 +1,24 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "ALTTPFile.hpp" -#include "ALTTPQuest.hpp" +#include "Athena/ALTTPFile.hpp" +#include "Athena/ALTTPQuest.hpp" -#include "InvalidOperationException.hpp" +#include "Athena/InvalidOperationException.hpp" -namespace zelda +namespace Athena { ALTTPFile::ALTTPFile() {} @@ -32,7 +32,7 @@ ALTTPFile::ALTTPFile(std::vector quests, std::vector b void ALTTPFile::setQuest(Uint32 id, ALTTPQuest* val) { if (id > m_quests.size()) - throw error::InvalidOperationException("ALTTPFile::setQuest -> index out of range"); + THROW_INVALID_OPERATION_EXCEPTION("index out of range"); m_quests[id] = val; } @@ -44,7 +44,7 @@ std::vector ALTTPFile::questList() const ALTTPQuest* ALTTPFile::quest(Uint32 id) const { if (id > m_quests.size()) - throw error::InvalidOperationException("ALTTPFile::setQuest -> index out of range"); + THROW_INVALID_OPERATION_EXCEPTION("index out of range"); return m_quests[id]; } diff --git a/src/ALTTPFileReader.cpp b/src/Athena/ALTTPFileReader.cpp similarity index 86% rename from src/ALTTPFileReader.cpp rename to src/Athena/ALTTPFileReader.cpp index 4baaa34..bbf8bcc 100644 --- a/src/ALTTPFileReader.cpp +++ b/src/Athena/ALTTPFileReader.cpp @@ -1,24 +1,24 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "ALTTPFileReader.hpp" -#include "ALTTPFile.hpp" -#include "ALTTPQuest.hpp" +#include "Athena/ALTTPFileReader.hpp" +#include "Athena/ALTTPFile.hpp" +#include "Athena/ALTTPQuest.hpp" #include -namespace zelda +namespace Athena { namespace io { @@ -64,12 +64,12 @@ ALTTPFile* ALTTPFileReader::readFile() quest->setOverworldEvents(owEvents); quest->setInventory((ALTTPInventory*)base::readBytes(sizeof(ALTTPInventory))); - quest->setRupeeMax(base::readUInt16()); - quest->setRupeeCurrent(base::readUInt16()); + quest->setRupeeMax(base::readUint16()); + quest->setRupeeCurrent(base::readUint16()); quest->setCompasses(readDungeonFlags()); quest->setBigKeys(readDungeonFlags()); quest->setDungeonMaps(readDungeonFlags()); - quest->setWishingPond(base::readUInt16()); + quest->setWishingPond(base::readUint16()); quest->setHealthMax(base::readByte()); quest->setHealth(base::readByte()); quest->setMagicPower(base::readByte()); @@ -142,26 +142,26 @@ ALTTPFile* ALTTPFileReader::readFile() j = 6; while((j--) > 0) { - playerName.push_back(base::readUInt16()); + playerName.push_back(base::readUint16()); } quest->setPlayerName(playerName); - quest->setValid((base::readUInt16() == 0x55AA)); + quest->setValid((base::readUint16() == 0x55AA)); j = 0x0D; while((j--) > 0) { - dungeonDeaths.push_back(base::readUInt16()); + dungeonDeaths.push_back(base::readUint16()); } quest->setDungeonDeathTotals(dungeonDeaths); - quest->setUnknown2(base::readUInt16()); - quest->setDeathSaveCount(base::readUInt16()); + quest->setUnknown2(base::readUint16()); + quest->setDeathSaveCount(base::readUint16()); quest->setPostGameDeathCounter(base::readInt16()); base::seek(0xF7); - quest->setChecksum(base::readUInt16()); + quest->setChecksum(base::readUint16()); if (i < 3) quests.push_back(quest); diff --git a/src/ALTTPFileWriter.cpp b/src/Athena/ALTTPFileWriter.cpp similarity index 85% rename from src/ALTTPFileWriter.cpp rename to src/Athena/ALTTPFileWriter.cpp index cf07f80..4ac330d 100644 --- a/src/ALTTPFileWriter.cpp +++ b/src/Athena/ALTTPFileWriter.cpp @@ -1,24 +1,24 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "ALTTPFileWriter.hpp" -#include "ALTTPFile.hpp" -#include "ALTTPQuest.hpp" +#include "Athena/ALTTPFileWriter.hpp" +#include "Athena/ALTTPFile.hpp" +#include "Athena/ALTTPQuest.hpp" #include -namespace zelda +namespace Athena { namespace io @@ -55,12 +55,12 @@ void ALTTPFileWriter::writeFile(ALTTPFile* file) } base::writeBytes((Int8*)quest->inventory(), sizeof(ALTTPInventory)); - base::writeUInt16(quest->rupeeMax()); - base::writeUInt16(quest->rupeeCurrent()); + base::writeUint16(quest->rupeeMax()); + base::writeUint16(quest->rupeeCurrent()); writeDungeonItems(quest->compasses()); writeDungeonItems(quest->bigKeys()); writeDungeonItems(quest->dungeonMaps()); - base::writeUInt16(quest->wishingPond()); + base::writeUint16(quest->wishingPond()); base::writeByte(quest->healthMax()); base::writeByte(quest->health()); base::writeByte(quest->magicPower()); @@ -116,20 +116,20 @@ void ALTTPFileWriter::writeFile(ALTTPFile* file) base::writeByte(quest->unknown1(j)); for (int j = 0; j < 6; j++) - base::writeUInt16(quest->playerName()[j]); + base::writeUint16(quest->playerName()[j]); - base::writeUInt16((quest->valid() == true ? 0x55AA : 0)); + base::writeUint16((quest->valid() == true ? 0x55AA : 0)); for (int j = 0; j < 0x0D; j++) - base::writeUInt16(quest->dungeonDeathTotal(j)); + base::writeUint16(quest->dungeonDeathTotal(j)); - base::writeUInt16(quest->unknown2()); - base::writeUInt16(quest->deathSaveCount()); - base::writeUInt16(quest->postGameDeathCounter()); + base::writeUint16(quest->unknown2()); + base::writeUint16(quest->deathSaveCount()); + base::writeUint16(quest->postGameDeathCounter()); base::seek(0xF7); - base::writeUInt16(calculateChecksum(i)); + base::writeUint16(calculateChecksum(i)); } } diff --git a/src/ALTTPQuest.cpp b/src/Athena/ALTTPQuest.cpp similarity index 86% rename from src/ALTTPQuest.cpp rename to src/Athena/ALTTPQuest.cpp index 55e3a5f..ccc759a 100644 --- a/src/ALTTPQuest.cpp +++ b/src/Athena/ALTTPQuest.cpp @@ -1,23 +1,23 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "ALTTPQuest.hpp" -#include "InvalidOperationException.hpp" +#include "Athena/ALTTPQuest.hpp" +#include "Athena/InvalidOperationException.hpp" #include -namespace zelda +namespace Athena { ALTTPQuest::ALTTPQuest() @@ -71,7 +71,7 @@ std::vector ALTTPQuest::overworldEvents() const ALTTPOverworldEvent* ALTTPQuest::overworldEvent(Uint32 id) const { if (id > m_overworldEvents.size() - 1) - throw error::InvalidOperationException("ALTTPQuest::overworldEvents -> index out of range"); + THROW_INVALID_OPERATION_EXCEPTION("index out of range"); return m_overworldEvents[id]; } @@ -301,7 +301,7 @@ void ALTTPQuest::setDungeonKeys(std::vector val) void ALTTPQuest::setDungeonKeys(Uint32 id, Uint8 val) { if (id > m_dungeonKeys.size() - 1) - throw error::InvalidOperationException("ALTTPQuest::setDungeonKeys -> index out of range"); + THROW_INVALID_OPERATION_EXCEPTION("index out of range"); m_dungeonKeys[id] = val; } @@ -309,7 +309,7 @@ void ALTTPQuest::setDungeonKeys(Uint32 id, Uint8 val) Uint8 ALTTPQuest::dungeonKeys(Uint32 id) const { if (id > m_dungeonKeys.size() - 1) - throw error::InvalidOperationException("ALTTPQuest::dungeonKeys -> index out of range"); + THROW_INVALID_OPERATION_EXCEPTION("index out of range"); return m_dungeonKeys[id]; } @@ -398,7 +398,7 @@ void ALTTPQuest::setOldManFlags(std::vector flags) void ALTTPQuest::setOldManFlag(Uint32 id, Uint8 val) { if (id > m_oldManFlags.size() - 1) - throw error::InvalidOperationException("ALTTPQuest::setOldManFlag -> index out of range"); + THROW_INVALID_OPERATION_EXCEPTION("index out of range"); m_oldManFlags[id] = val; } @@ -406,7 +406,7 @@ void ALTTPQuest::setOldManFlag(Uint32 id, Uint8 val) Uint8 ALTTPQuest::oldManFlag(Uint32 id) { if (id > m_oldManFlags.size() - 1) - throw error::InvalidOperationException("ALTTPQuest::oldManFlag -> index out of range"); + THROW_INVALID_OPERATION_EXCEPTION("index out of range"); return m_oldManFlags[id]; } @@ -434,7 +434,7 @@ void ALTTPQuest::setUnknown1(std::vector flags) void ALTTPQuest::setUnknown1(Uint32 id, Uint8 val) { if (id > m_unknown1.size()) - throw error::InvalidOperationException("ALTTPQuest::setUnknown1) -> index out of range"); + THROW_INVALID_OPERATION_EXCEPTION("index out of range"); m_unknown1[id] = val; } @@ -442,7 +442,7 @@ void ALTTPQuest::setUnknown1(Uint32 id, Uint8 val) Uint8 ALTTPQuest::unknown1(Uint32 id) { if (id > m_unknown1.size()) - throw error::InvalidOperationException("ALTTPQuest::unknown1 -> index out of range"); + THROW_INVALID_OPERATION_EXCEPTION("index out of range"); return m_unknown1[id]; } @@ -460,7 +460,7 @@ void ALTTPQuest::setPlayerName(std::vector playerName) void ALTTPQuest::setPlayerName(const std::string& playerName) { if (playerName == std::string() || playerName.size() > 6) - throw error::InvalidOperationException("ALTTPQuest::setPlayerName -> playerName invalid"); + THROW_INVALID_OPERATION_EXCEPTION("index out of range"); m_playerName.clear(); @@ -623,7 +623,7 @@ void ALTTPQuest::setDungeonDeathTotals(std::vector val) void ALTTPQuest::setDungeonDeathTotal(Uint32 id, Uint16 val) { if (id > m_dungeonDeathTotals.size()) - throw error::InvalidOperationException("ALTTPQuest::setDungeonDeathTotal -> index out of range"); + THROW_INVALID_OPERATION_EXCEPTION("index out of range"); m_dungeonDeathTotals[id] = val; } @@ -631,7 +631,7 @@ void ALTTPQuest::setDungeonDeathTotal(Uint32 id, Uint16 val) Uint16 ALTTPQuest::dungeonDeathTotal(Uint32 id) const { if (id > m_dungeonDeathTotals.size()) - throw error::InvalidOperationException("ALTTPQuest::setDungeonDeathTotal -> index out of range"); + THROW_INVALID_OPERATION_EXCEPTION("index out of range"); return m_dungeonDeathTotals[id]; } diff --git a/src/Athena/BinaryReader.cpp b/src/Athena/BinaryReader.cpp new file mode 100644 index 0000000..43b9641 --- /dev/null +++ b/src/Athena/BinaryReader.cpp @@ -0,0 +1,506 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#include "Athena/BinaryReader.hpp" +#include "Athena/IOException.hpp" +#include "Athena/FileNotFoundException.hpp" +#include "Athena/InvalidDataException.hpp" +#include "Athena/InvalidOperationException.hpp" +#include "utf8.h" + +#include +#include +#include +#include +#include + +#ifdef HW_RVL +#include +#endif // HW_RVL + +namespace Athena +{ +namespace io +{ +BinaryReader::BinaryReader(const Uint8* data, Uint64 length) + : m_length(length), + m_position(0), + m_bitPosition(0), + m_endian(Endian::LittleEndian), + m_progressCallback(nullptr) +{ + if (!data) + THROW_INVALID_DATA_EXCEPTION("data cannot be NULL"); + if (length == 0) + THROW_INVALID_OPERATION_EXCEPTION("length cannot be 0"); + + m_data = new Uint8[m_length]; + memcpy(m_data, data, m_length); +} + +BinaryReader::BinaryReader(const std::string& filename, std::function progFun) + : m_data(NULL), + m_length(0), + m_filepath(filename), + m_position(0), + m_bitPosition(0), + m_endian(Endian::LittleEndian), + m_progressCallback(progFun) +{ + loadData(); +} + +BinaryReader::~BinaryReader() +{ + delete[] m_data; + m_data = NULL; +} + +void BinaryReader::setEndian(Endian endian) +{ + m_endian = endian; +} + +Endian BinaryReader::endian() const +{ + return m_endian; +} + +bool BinaryReader::isBigEndian() const +{ + return (m_endian == Endian::BigEndian); +} + +bool BinaryReader::isLittleEndian() const +{ + return (m_endian == Endian::LittleEndian); +} + +bool BinaryReader::isOpen() const +{ + return m_data != nullptr; +} + +void BinaryReader::seek(Int64 position, SeekOrigin origin) +{ + switch (origin) + { + case SeekOrigin::Begin: + if ((position < 0 || (Int64)position > (Int64)m_length)) + THROW_IO_EXCEPTION("Position outside stream bounds"); + m_position = position; + break; + case SeekOrigin::Current: + if ((((Int64)m_position + position) < 0 || (m_position + position) > m_length)) + THROW_IO_EXCEPTION("Position outside stream bounds"); + m_position += position; + break; + case SeekOrigin::End: + if ((((Int64)m_length - position < 0) || (m_length - position) > m_length)) + THROW_IO_EXCEPTION("Position outside stream bounds"); + m_position = m_length - position; + break; + } +} + +bool BinaryReader::atEnd() const +{ + return m_position >= m_length; +} + +Uint64 BinaryReader::position() const +{ + return m_position; +} + +Uint64 BinaryReader::length() const +{ + return m_length; +} + +void BinaryReader::setData(const Uint8* data, Uint64 length) +{ + if (m_data) +#ifdef HW_RVL + free(m_data); +#else + delete[] m_data; +#endif + + m_data = (Uint8*)data; + m_length = length; + m_position = 0; + m_bitPosition = 0; +} + +Uint8* BinaryReader::data() const +{ + Uint8* ret = new Uint8[m_length]; + memset(ret, 0, m_length); + memcpy(ret, m_data, m_length); + return ret; +} + +void BinaryReader::seekBit(int bit) +{ + if (!m_data) + loadData(); + + if (bit < 0 || bit > 7) + THROW_INVALID_OPERATION_EXCEPTION("bit out of range"); + + m_bitPosition = bit; +} + +bool BinaryReader::readBit() +{ + if (!m_data) + loadData(); + if (m_position > m_length) + THROW_IO_EXCEPTION("Position outside stream bounds"); + + bool ret = (*(Uint8*)(m_data + m_position) & (1 << m_bitPosition)); + + m_bitPosition++; + if (m_bitPosition > 7) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + + return ret; +} + +Int8 BinaryReader::readByte() +{ + if (!m_data) + loadData(); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + if (m_position + 1 > m_length) + THROW_IO_EXCEPTION("Stream::readByte -> Position passed stream bounds"); + + return *(Int8*)(m_data + m_position++); +} + +Uint8 BinaryReader::readUByte() +{ + if (!m_data) + loadData(); + + if (!m_data) + loadData(); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + if (m_position + 1 > m_length) + THROW_IO_EXCEPTION("Position passed stream bounds"); + + return *(Uint8*)(m_data + m_position++); +} + +Int8* BinaryReader::readBytes(Int64 length) +{ + return (Int8*)readUBytes(length); +} + +Uint8* BinaryReader::readUBytes(Int64 length) +{ + if (!m_data) + loadData(); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + + if (m_position + length > m_length) + THROW_IO_EXCEPTION("Position passed stream bounds"); + + Uint8* ret; +#ifdef HW_RVL + ret = (Uint8*)memalign(32, length); +#else + ret = new Uint8[length]; +#endif + + memcpy(ret, (const Uint8*)(m_data + m_position), length); + m_position += length; + return ret; +} + +Int16 BinaryReader::readInt16() +{ + if (!m_data) + loadData(); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + + if (m_position + sizeof(Int16) > m_length) + THROW_IO_EXCEPTION("Position outside stream bounds"); + Int16 ret = *(Int16*)(m_data + m_position); + m_position += sizeof(Int16); + + if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian())) + ret = utility::swap16(ret); + return ret; +} + +Uint16 BinaryReader::readUint16() +{ + return readInt16(); +} + +Int32 BinaryReader::readInt32() +{ + if (!m_data) + loadData(); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + + if (m_position + sizeof(Int32) > m_length) + THROW_IO_EXCEPTION("Position outside stream bounds"); + Int32 ret = *(Int32*)(m_data + m_position); + m_position += 4; + + if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian())) + ret = utility::swap32(ret); + return ret; +} + +Uint32 BinaryReader::readUint32() +{ + if (!m_data) + loadData(); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + if (m_position + sizeof(Uint32) > m_length) + THROW_IO_EXCEPTION("Position outside stream bounds"); + + Uint32 ret = *(Uint32*)(m_data + m_position); + m_position += 4; + + if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian())) + ret = utility::swapU32(ret); + return ret; +} + +Int64 BinaryReader::readInt64() +{ + if (!m_data) + loadData(); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + if (m_position + sizeof(Int64) > m_length) + THROW_IO_EXCEPTION("Position outside stream bounds"); + + Int64 ret = *(Int64*)(m_data + m_position); + m_position += 8; + + if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian())) + ret = utility::swap64(ret); + return ret; +} + +Uint64 BinaryReader::readUint64() +{ + if (!m_data) + loadData(); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + if (m_position + sizeof(Uint64) > m_length) + THROW_IO_EXCEPTION("Position outside stream bounds"); + Uint64 ret = *(Uint64*)(m_data + m_position); + m_position += 8; + + if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian())) + ret = utility::swapU64(ret); + return ret; +} + +float BinaryReader::readFloat() +{ + if (!m_data) + loadData(); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + if (m_position + sizeof(float) > m_length) + THROW_IO_EXCEPTION("Position outside stream bounds"); + + float ret = *(float*)(m_data + m_position); + m_position += 4; + + if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian())) + ret = utility::swapFloat(ret); + return ret; +} + +double BinaryReader::readDouble() +{ + if (!m_data) + loadData(); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + if (m_position + sizeof(double) > m_length) + THROW_IO_EXCEPTION("Position outside stream bounds"); + + double ret = *(double*)(m_data + m_position); + m_position += 8; + + if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian())) + ret = utility::swapDouble(ret); + + return ret; +} + +bool BinaryReader::readBool() +{ + if (!m_data) + loadData(); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + if (m_position + sizeof(bool) > m_length) + THROW_IO_EXCEPTION("Position outside stream bounds"); + + bool ret = *(bool*)(m_data + m_position); + m_position += 1; + return ret; +} + +std::string BinaryReader::readUnicode() +{ + if (!m_data) + loadData(); + std::string ret; + std::vector tmp; + Uint16 chr = readUint16(); + for(;;) + { + if (!chr) + break; + tmp.push_back(chr); + chr = readUint16(); + } + + utf8::utf16to8(tmp.begin(), tmp.end(), back_inserter(ret)); + return ret; +} + +std::string BinaryReader::readString() +{ + std::string ret = ""; + Uint8 chr = readByte(); + + while (chr != 0) + { + ret += chr; + chr = readByte(); + } + + return ret; +} + +void BinaryReader::setProgressCallback(std::function cb) +{ + m_progressCallback = cb; +} + +void BinaryReader::loadData() +{ + FILE* in; + Uint32 length; + in = fopen(m_filepath.c_str(), "rb"); + + if (!in) + THROW_FILE_NOT_FOUND_EXCEPTION(m_filepath); + + fseek(in, 0, SEEK_END); + length = ftell(in); + fseek(in, 0, SEEK_SET); +#ifdef HW_RVL + m_data = (Uint8*)memalign(32, length); +#else + m_data = new Uint8[length]; +#endif + + Uint32 done = 0; + Uint32 blocksize = BLOCKSZ; + do + { + if (blocksize > length - done) + blocksize = length - done; + + Int32 ret = fread(m_data + done, 1, blocksize, in); + + if (ret < 0) + THROW_IO_EXCEPTION("Error reading data from disk"); + else if (ret == 0) + break; + + done += ret; + + if (m_progressCallback) + m_progressCallback((int)((float)(done* 100.f)/length)); + + } while (done < length); + + fclose(in); + m_length = length; + m_position = 0; + m_bitPosition = 0; +} + +} +} diff --git a/src/Athena/BinaryWriter.cpp b/src/Athena/BinaryWriter.cpp new file mode 100644 index 0000000..b2e64f3 --- /dev/null +++ b/src/Athena/BinaryWriter.cpp @@ -0,0 +1,505 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#include "Athena/BinaryWriter.hpp" +#include "Athena/IOException.hpp" +#include "Athena/InvalidOperationException.hpp" +#include "Athena/InvalidDataException.hpp" +#include "Athena/FileNotFoundException.hpp" +#include "utf8.h" + +#include +#include +#include +#include + +#ifdef HW_RVL +#include +#endif // HW_RVL + +namespace Athena +{ +namespace io +{ + +BinaryWriter::BinaryWriter(Uint8* data, Uint64 length) + : m_data((Uint8*)data), + m_length(length), + m_position(0), + m_bitPosition(0), + m_endian(Endian::LittleEndian), + m_progressCallback(nullptr) +{} + +BinaryWriter::BinaryWriter(const std::string& filename, std::function progressFun) + : m_length(0), + m_filepath(filename), + m_position(0), + m_bitPosition(0), + m_endian(Endian::LittleEndian), + m_progressCallback(progressFun) +{ + m_length = 0x10; + m_bitPosition = 0; + m_position = 0; +#ifdef HW_RVL + m_data = (Uint8*)memalign(32, m_length); +#else + m_data = new Uint8[m_length]; +#endif + + if (!m_data) + THROW_IO_EXCEPTION("Could not allocate memory!"); + + memset(m_data, 0, m_length); +} + +BinaryWriter::~BinaryWriter() +{ + if (isOpen()) + save(); + delete[] m_data; + m_data = nullptr; +} + +void BinaryWriter::setEndian(Endian endian) +{ + m_endian = endian; +} + +Endian BinaryWriter::endian() const +{ + return m_endian; +} + +bool BinaryWriter::isBigEndian() const +{ + return (m_endian == Endian::BigEndian); +} + +bool BinaryWriter::isLittleEndian() const +{ + return (m_endian == Endian::LittleEndian); +} + +bool BinaryWriter::isOpen() const +{ + return m_data != nullptr; +} + +void BinaryWriter::seek(Int64 position, SeekOrigin origin) +{ + switch (origin) + { + case SeekOrigin::Begin: + if (position < 0) + THROW_IO_EXCEPTION("Position outside stream bounds"); + + if ((Uint64)position > m_length) + resize(position); + m_position = position; + break; + case SeekOrigin::Current: + if ((((Int64)m_position + position) < 0)) + THROW_IO_EXCEPTION("Position outside stream bounds"); + + if (m_position + position > m_length) + resize(m_position + position); + + m_position += position; + break; + case SeekOrigin::End: + if (((Int64)m_length - position) < 0) + THROW_IO_EXCEPTION("Position outside stream bounds"); + + if ((Uint64)position > m_length) + resize(position); + m_position = m_length - position; + break; + } +} + +bool BinaryWriter::atEnd() const +{ + return m_position >= m_length; +} + +Uint64 BinaryWriter::position() const +{ + return m_position; +} + +Uint64 BinaryWriter::length() const +{ + return m_length; +} + +void BinaryWriter::setFilepath(const std::string& filepath) +{ + m_filepath = filepath; +} + +std::string BinaryWriter::filepath() const +{ + return m_filepath; +} + +void BinaryWriter::setData(const Uint8* data, Uint64 length) +{ + if (m_data) +#ifdef HW_RVL + free(m_data); +#else + delete[] m_data; +#endif + + m_data = (Uint8*)data; + m_length = length; + m_position = 0; + m_bitPosition = 0; +} + +Uint8* BinaryWriter::data() const +{ + Uint8* ret = new Uint8[m_length]; + memset(ret, 0, m_length); + memcpy(ret, m_data, m_length); + return ret; +} + + +void BinaryWriter::save(const std::string& filename) +{ + if (filename.empty() && m_filepath.empty()) + THROW_INVALID_OPERATION_EXCEPTION("No file specified, cannot save."); + + if (!filename.empty()) + m_filepath = filename; + + FILE* out = fopen(m_filepath.c_str(), "wb"); + if (!out) + THROW_FILE_NOT_FOUND_EXCEPTION(m_filepath); + + Uint32 done = 0; + Uint32 blocksize = BLOCKSZ; + do + { + if (blocksize > m_length - done) + blocksize = m_length - done; + + Int32 ret = fwrite(m_data + done, 1, blocksize, out); + + if (ret < 0) + THROW_IO_EXCEPTION("Error writing data to disk"); + else if (ret == 0) + break; + + done += blocksize; + }while (done < m_length); + + fclose(out); +} + +void BinaryWriter::seekBit(int bit) +{ + if (bit < 0 || bit > 7) + THROW_INVALID_OPERATION_EXCEPTION("bit out of range"); + + m_bitPosition = bit; +} + +void BinaryWriter::writeBit(bool val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + if (m_position + sizeof(Uint8) > m_length) + resize(m_position + sizeof(Uint8)); + + if (val) + *(Uint8*)(m_data + m_position) |= (1 << m_bitPosition); + else + *(Uint8*)(m_data + m_position) &= ~(1 << m_bitPosition); + m_bitPosition++; + if (m_bitPosition > 7) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } +} + +void BinaryWriter::writeUByte(Uint8 val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + if (m_position + 1 > m_length) + resize(m_position + 1); + + *(Uint8*)(m_data + m_position) = val; + + m_position++; +} + +void BinaryWriter::writeByte(Int8 val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + writeUByte(val); +} + +void BinaryWriter::writeUBytes(Uint8* data, Uint64 length) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + + if (!data) + THROW_INVALID_DATA_EXCEPTION("data cannnot be NULL"); + if (m_position + length > m_length) + resize(m_position + length); + + memcpy((Int8*)(m_data + m_position), data, length); + + m_position += length; +} + +void BinaryWriter::writeBytes(Int8* data, Uint64 length) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + writeUBytes((Uint8*)data, length); +} + +void BinaryWriter::writeInt16(Int16 val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + + if (m_position + sizeof(Int16) > m_length) + resize(m_position + sizeof(Int16)); + + if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian())) + val = utility::swap16(val); + + *(Int16*)(m_data + m_position) = val; + m_position += sizeof(Int16); +} + +void BinaryWriter::writeUint16(Uint16 val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + writeInt16(val); +} + +void BinaryWriter::writeInt32(Int32 val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + + if (m_position + sizeof(Int32) > m_length) + resize(m_position + sizeof(Int32)); + + if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian())) + val = utility::swap32(val); + + *(Int32*)(m_data + m_position) = val; + m_position += sizeof(Int32); +} + +void BinaryWriter::writeUint32(Uint32 val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + writeInt32(val); +} + +void BinaryWriter::writeInt64(Int64 val) +{ + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + + if (m_position + sizeof(Int64) > m_length) + resize(m_position + sizeof(Int64)); + + + if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian())) + val = utility::swap64(val); + + *(Int64*)(m_data + m_position) = val; + m_position += sizeof(Int64); +} + +void BinaryWriter::writeUint64(Uint64 val) +{ + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + + if (m_position + sizeof(Uint64) > m_length) + resize(m_position + sizeof(Uint64)); + + if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian())) + val = utility::swapU64(val); + + *(Uint64*)(m_data + m_position) = val; + m_position += sizeof(Uint64); +} + +void BinaryWriter::writeFloat(float val) +{ + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + + if (m_position + sizeof(float) > m_length) + resize(m_position + sizeof(float)); + + if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian())) + val = utility::swapFloat(val); + + *(float*)(m_data + m_position) = val; + m_position += sizeof(float); +} + +void BinaryWriter::writeDouble(double val) +{ + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + + if (m_position + sizeof(double) > m_length) + resize(m_position + sizeof(double)); + + if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian())) + val = utility::swapDouble(val); + + *(double*)(m_data + m_position)= val; + m_position += sizeof(double); +} + +void BinaryWriter::writeBool(bool val) +{ + if (m_bitPosition > 0) + { + m_bitPosition = 0; + m_position += sizeof(Uint8); + } + + if (m_position + sizeof(bool) > m_length) + resize(m_position + sizeof(bool)); + + *(bool*)(m_data + m_position) = val; + m_position += sizeof(bool); +} + +void BinaryWriter::writeUnicode(const std::string& str) +{ + std::string tmpStr = "\xEF\xBB\xBF" + str; + + std::vector tmp; + + utf8::utf8to16(tmpStr.begin(), tmpStr.end(), back_inserter(tmp)); + + for (Uint16 chr : tmp) + { + if (chr != 0xFEFF) + writeInt16(chr); + } + writeInt16(0); +} + +void BinaryWriter::writeString(const std::string& str) +{ + for (Uint8 c : str) + { + writeUByte(c); + if (c == '\0') + break; + } + writeUByte(0); +} + +void BinaryWriter::setProgressCallback(std::function cb) +{ + m_progressCallback = cb; +} + +void BinaryWriter::resize(Uint64 newSize) +{ + if (newSize < m_length) + THROW_INVALID_OPERATION_EXCEPTION("Stream::resize() -> New size cannot be less to the old size."); + + // Allocate and copy new buffer +#ifdef HW_RVL + Uint8* newArray = (Uint8*)memalign(32, newSize); +#else + Uint8* newArray = new Uint8[newSize]; +#endif + + memset(newArray, 0, newSize); + + memcpy(newArray, m_data, m_length); + + // Delete the old one +#ifdef HW_RVL + free(m_data); +#else + delete[] m_data; +#endif + + // Swap the pointer and size out for the new ones. + m_data = newArray; + m_length = newSize; +} + +} // io +} // Athena diff --git a/src/Checksums.cpp b/src/Athena/Checksums.cpp similarity index 92% rename from src/Checksums.cpp rename to src/Athena/Checksums.cpp index 7dd2c22..d2c3310 100644 --- a/src/Checksums.cpp +++ b/src/Athena/Checksums.cpp @@ -1,9 +1,24 @@ -#include "Checksums.hpp" +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#include "Athena/Checksums.hpp" #include #include -namespace zelda +namespace Athena { namespace Checksums { diff --git a/src/Compression.cpp b/src/Athena/Compression.cpp similarity index 99% rename from src/Compression.cpp rename to src/Athena/Compression.cpp index 2d268bf..2bb284a 100644 --- a/src/Compression.cpp +++ b/src/Athena/Compression.cpp @@ -13,13 +13,13 @@ // You should have received a copy of the GNU General Public License // along with libZelda. If not, see -#include "Compression.hpp" -#include "Exception.hpp" +#include "Athena/Compression.hpp" +#include "Athena/Exception.hpp" #include "lzo.h" #include #include -namespace zelda +namespace Athena { namespace io { diff --git a/src/Athena/FileReader.cpp b/src/Athena/FileReader.cpp new file mode 100644 index 0000000..1bfc3e2 --- /dev/null +++ b/src/Athena/FileReader.cpp @@ -0,0 +1,333 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#include "Athena/FileReader.hpp" +#include "Athena/FileNotFoundException.hpp" +#include "Athena/InvalidDataException.hpp" +#include "Athena/InvalidOperationException.hpp" +#include "Athena/IOException.hpp" +#include "utf8.h" + +namespace Athena +{ +namespace io +{ +FileReader::FileReader(const std::string& filename) + : m_filename(filename), + m_fileHandle(NULL), + m_endian(Endian::LittleEndian), + m_bitValid(false) +{ + open(); +} + +FileReader::~FileReader() +{ + close(); +} + +std::string FileReader::filename() const +{ + return m_filename; +} + +void FileReader::setEndian(Endian endian) +{ + m_endian = endian; +} + +Endian FileReader::endian() const +{ + return m_endian; +} + +bool FileReader::isBigEndian() const +{ + return (m_endian == Endian::BigEndian); +} + +bool FileReader::isLittleEndian() const +{ + return (m_endian == Endian::LittleEndian); +} + +void FileReader::open() +{ + m_fileHandle = fopen(m_filename.c_str(), "rb"); + if (!m_fileHandle) + THROW_FILE_NOT_FOUND_EXCEPTION(m_filename); + + // ensure we're at the beginning of the file + rewind(m_fileHandle); +} + +void FileReader::close() +{ + if (!m_fileHandle) + THROW_INVALID_OPERATION_EXCEPTION("Cannot close an unopened stream"); + + fclose(m_fileHandle); + m_fileHandle = NULL; + return; +} + +bool FileReader::isOpen() const +{ + return m_fileHandle != NULL; +} + +void FileReader::seek(Int64 pos, SeekOrigin origin) +{ + if (fseeko64(m_fileHandle, pos, (int)origin) != 0) + THROW_INVALID_OPERATION_EXCEPTION("Unable to seek in file"); +} + +bool FileReader::atEnd() const +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open"); + + return feof(m_fileHandle) != 0; +} + +Uint64 FileReader::position() const +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open"); + + return ftello64(m_fileHandle); +} + +Uint64 FileReader::length() const +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open"); + + return utility::fileSize(m_fileHandle); +} + +void FileReader::seekBit(int bit) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open"); + + if (bit < 0 || bit > 7) + THROW_INVALID_OPERATION_EXCEPTION("bit out of range"); + + m_bitShift = bit; +} + +bool FileReader::readBit() +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File is not open for reading"); + + if (!m_bitValid) + { + int size = fread(&m_currentByte, 1, 1, m_fileHandle); + if (size != sizeof(Uint8)) + THROW_IO_EXCEPTION("Error reading from file."); + + m_bitShift = 0; + m_bitValid = true; + } + + Uint8 flag = (1 << m_bitShift); + m_bitShift++; + if (m_bitShift > 7) + m_bitValid = false; + + return ((m_currentByte & flag) == flag); +} + +Uint8 FileReader::readUByte() +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + + m_bitValid = false; + Uint8 val = 0; + fread(&val, 1, 1, m_fileHandle); + return val; +} + +Int8 FileReader::readByte() +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + return (Int8)readUByte(); +} + +Uint8* FileReader::readUBytes(Uint64 len) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + m_bitValid = false; + Uint8* val = new Uint8[len]; + fread(val, 1, len, m_fileHandle); + return val; +} + +Int8* FileReader::readBytes(Uint64 len) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + return (Int8*)readUBytes(len); +} + +Uint16 FileReader::readUint16() +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + + m_bitValid = false; + Uint16 val; + fread(&val, 1, sizeof(Uint16), m_fileHandle); + + if ((utility::isSystemBigEndian() && !isBigEndian()) || (!utility::isSystemBigEndian() && isBigEndian())) + utility::swapU16(val); + + return val; +} + +Int16 FileReader::readInt16() +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + + return (Int16)readUint16(); +} + +Uint32 FileReader::readUint32() +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + + m_bitValid = false; + Uint32 val; + fread(&val, 1, sizeof(Uint32), m_fileHandle); + + if ((utility::isSystemBigEndian() && !isBigEndian()) || (!utility::isSystemBigEndian() && isBigEndian())) + utility::swapU64(val); + + return val; +} + +Int32 FileReader::readInt32() +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + + return (Int32)readUint32(); +} + +Uint64 FileReader::readUint64() +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + + m_bitValid = false; + Uint64 val; + fread(&val, 1, sizeof(Uint64), m_fileHandle); + + if ((utility::isSystemBigEndian() && !isBigEndian()) || (!utility::isSystemBigEndian() && isBigEndian())) + utility::swapU64(val); + + return val; +} + +Int64 FileReader::readInt64() +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + + return (Int64)readUint64(); +} + +double FileReader::readDouble() +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + + m_bitValid = false; + double val; + fread(&val, 1, sizeof(double), m_fileHandle); + + if ((utility::isSystemBigEndian() && !isBigEndian()) || (!utility::isSystemBigEndian() && isBigEndian())) + utility::swapDouble(val); + + return val; +} + +float FileReader::readFloat() +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + + m_bitValid = false; + float val; + fread(&val, 1, sizeof(float), m_fileHandle); + + if ((utility::isSystemBigEndian() && !isBigEndian()) || (!utility::isSystemBigEndian() && isBigEndian())) + utility::swapFloat(val); + + return val; +} + +bool FileReader::readBool() +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + + return (readByte() != 0); +} + +std::string FileReader::readString() +{ + std::string ret = ""; + Uint8 chr = readByte(); + + while (chr != 0) + { + ret += chr; + chr = readByte(); + } + + return ret; +} + +std::string FileReader::readUnicode() +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for reading"); + + std::string ret; + std::vector tmp; + + for(;;) + { + short chr = readUint16(); + if (chr) + tmp.push_back(chr); + else + break; + }; + + utf8::utf16to8(tmp.begin(), tmp.end(), back_inserter(ret)); + return ret; +} + +} // io +} // Athena diff --git a/src/Athena/FileWriter.cpp b/src/Athena/FileWriter.cpp new file mode 100644 index 0000000..8066f96 --- /dev/null +++ b/src/Athena/FileWriter.cpp @@ -0,0 +1,298 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#include "Athena/FileWriter.hpp" +#include "Athena/FileNotFoundException.hpp" +#include "Athena/InvalidDataException.hpp" +#include "Athena/InvalidOperationException.hpp" +#include "Athena/IOException.hpp" +#include "utf8.h" + +namespace Athena +{ +namespace io +{ +FileWriter::FileWriter(const std::string& filename) + : m_filename(filename), + m_fileHandle(NULL), + m_endian(Endian::LittleEndian), + m_bytePosition(0), + m_bitShift(0), + m_bitValid(false) +{ + open(); +} + +FileWriter::~FileWriter() +{ + if (isOpen()) + close(); +} + +void FileWriter::setEndian(Endian endian) +{ + m_endian = endian; +} + +Endian FileWriter::endian() const +{ + return m_endian; +} + +bool FileWriter::isBigEndian() const +{ + return (m_endian == Endian::BigEndian); +} + +bool FileWriter::isLittleEndian() const +{ + return (m_endian == Endian::LittleEndian); +} + +void FileWriter::open() +{ + m_fileHandle = fopen(m_filename.c_str(), "w+b"); + if (!m_fileHandle) + THROW_FILE_NOT_FOUND_EXCEPTION(m_filename); + + // ensure we're at the beginning of the file + rewind(m_fileHandle); +} + +void FileWriter::close() +{ + if (!m_fileHandle) + THROW_INVALID_OPERATION_EXCEPTION("Cannot close an unopened stream"); + + fclose(m_fileHandle); + m_fileHandle = NULL; + return; +} + +bool FileWriter::isOpen() const +{ + return m_fileHandle != NULL; +} + +void FileWriter::seek(Int64 pos, SeekOrigin origin) +{ + if (fseeko64(m_fileHandle, pos, (int)origin) != 0) + THROW_IO_EXCEPTION("Unable to seek in file"); +} + +bool FileWriter::atEnd() const +{ + return feof(m_fileHandle) != 0; +} + +Uint64 FileWriter::position() const +{ + return ftello64(m_fileHandle); +} + +Uint64 FileWriter::length() const +{ + return utility::fileSize(m_fileHandle); +} + +void FileWriter::writeBit(bool val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + if (!m_bitValid) + { + m_bitValid = true; + m_bitShift = 0; + m_bytePosition = ftello64(m_fileHandle); + } + + + if (val) + m_currentByte |= (1 << m_bitShift++); + else + m_currentByte &= ~(1 << m_bitShift++); + + if (m_bitShift > 7) + m_bitValid = false; + + fseeko64(m_fileHandle, m_bytePosition, (int)SeekOrigin::Begin); + if (fwrite(&m_currentByte, 1, 1, m_fileHandle) != sizeof(Int8)) + THROW_IO_EXCEPTION("Unable to data to file"); +} + +void FileWriter::seekBit(int bit) +{ + if (bit < 0 || bit > 7) + THROW_INVALID_OPERATION_EXCEPTION("bit must be >= 0 and <= 7"); + m_bitShift = bit; + m_bitValid = true; +} + +void FileWriter::writeUByte(Uint8 val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + m_bitValid = false; + + if (fwrite(&val, 1, sizeof(Uint8), m_fileHandle) != sizeof(Uint8)) + THROW_IO_EXCEPTION("Unable to write to stream"); +} + +void FileWriter::writeByte(Int8 val) +{ + writeUByte(val); +} + +void FileWriter::writeUBytes(Uint8* data, Uint64 len) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + m_bitValid = false; + + if (fwrite(data, 1, len, m_fileHandle) != len) + THROW_IO_EXCEPTION("Unable to write to stream"); +} + +void FileWriter::writeBytes(Int8* data, Uint64 len) +{ + writeUBytes((Uint8*)data, len); +} + +void FileWriter::writeUint16(Uint16 val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + m_bitValid = false; + + if ((utility::isSystemBigEndian() && !isBigEndian()) || (!utility::isSystemBigEndian() && isBigEndian())) + utility::swapU16(val); + + if (fwrite(&val, 1, sizeof(Uint16), m_fileHandle) != sizeof(Uint16)) + THROW_IO_EXCEPTION("Unable to write to stream"); +} + +void FileWriter::writeInt16(Int16 val) +{ + writeUint16(val); +} + +void FileWriter::writeUint32(Uint32 val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + m_bitValid = false; + + if ((utility::isSystemBigEndian() && !isBigEndian()) || (!utility::isSystemBigEndian() && isBigEndian())) + utility::swapU32(val); + + if (fwrite(&val, 1, sizeof(Uint32), m_fileHandle) != sizeof(Uint32)) + THROW_IO_EXCEPTION("Unable to write to stream"); +} + +void FileWriter::writeInt32(Int32 val) +{ + writeUint32(val); +} + +void FileWriter::writeUint64(Uint64 val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + m_bitValid = false; + + if ((utility::isSystemBigEndian() && !isBigEndian()) || (!utility::isSystemBigEndian() && isBigEndian())) + utility::swapU32(val); + + if (fwrite(&val, 1, sizeof(Uint64), m_fileHandle) != sizeof(Uint64)) + THROW_IO_EXCEPTION("Unable to write to stream"); +} + +void FileWriter::writeInt64(Int64 val) +{ + writeUint64(val); +} + +void FileWriter::writeDouble(double val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + m_bitValid = false; + + if ((utility::isSystemBigEndian() && !isBigEndian()) || (!utility::isSystemBigEndian() && isBigEndian())) + utility::swapDouble(val); + + if (fwrite(&val, 1, sizeof(double), m_fileHandle) != sizeof(double)) + THROW_IO_EXCEPTION("Unable to write to stream"); +} + +void FileWriter::writeFloat(float val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + m_bitValid = false; + + if ((utility::isSystemBigEndian() && !isBigEndian()) || (!utility::isSystemBigEndian() && isBigEndian())) + utility::swapFloat(val); + + if (fwrite(&val, 1, sizeof(float), m_fileHandle) != sizeof(float)) + THROW_IO_EXCEPTION("Unable to write to stream"); +} + +void FileWriter::writeBool(bool val) +{ + writeByte(val); +} + +void FileWriter::writeString(const std::string& val) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + m_bitValid = false; + + char term = '\0'; + if (fwrite(val.c_str(), 1, val.length(), m_fileHandle) != val.length()) + THROW_IO_EXCEPTION("Unable to write to stream"); + if (fwrite(&term, 1, 1, m_fileHandle) != 1) + THROW_IO_EXCEPTION("Unable to write to stream"); +} + +void FileWriter::writeUnicode(const std::string& str) +{ + if (!isOpen()) + THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); + + std::string tmpStr = "\xEF\xBB\xBF" + str; + + std::vector tmp; + + utf8::utf8to16(tmpStr.begin(), tmpStr.end(), back_inserter(tmp)); + + for (Uint16 chr : tmp) + { + if (chr != 0xFEFF) + writeInt16(chr); + } +} +} +} // Athena diff --git a/src/Athena/Global.cpp b/src/Athena/Global.cpp new file mode 100644 index 0000000..570ec48 --- /dev/null +++ b/src/Athena/Global.cpp @@ -0,0 +1,48 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#include "Athena/Global.hpp" + +std::ostream& operator<<(std::ostream& os, const Athena::SeekOrigin& origin) +{ + switch(origin) + { + case Athena::SeekOrigin::Begin: + os << "Begin"; + break; + case Athena::SeekOrigin::Current: + os << "Current"; + break; + case Athena::SeekOrigin::End: + os << "End"; + break; + } + return os; +} + + +std::ostream& operator<<(std::ostream& os, const Athena::Endian& endian) +{ + switch(endian) + { + case Athena::Endian::LittleEndian: + os << "LittleEndian"; + break; + case Athena::Endian::BigEndian: + os << "BigEndian"; + break; + } + return os; +} diff --git a/src/MCFile.cpp b/src/Athena/MCFile.cpp similarity index 62% rename from src/MCFile.cpp rename to src/Athena/MCFile.cpp index 4329847..35f873f 100644 --- a/src/MCFile.cpp +++ b/src/Athena/MCFile.cpp @@ -1,21 +1,21 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "MCFile.hpp" +#include "Athena/MCFile.hpp" -namespace zelda +namespace Athena { MCFile::MCFile() diff --git a/src/MCFileReader.cpp b/src/Athena/MCFileReader.cpp similarity index 69% rename from src/MCFileReader.cpp rename to src/Athena/MCFileReader.cpp index ecc93b2..0a6b839 100644 --- a/src/MCFileReader.cpp +++ b/src/Athena/MCFileReader.cpp @@ -1,21 +1,21 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "MCFileReader.hpp" +#include "Athena/MCFileReader.hpp" -namespace zelda +namespace Athena { namespace io diff --git a/src/MCFileWriter.cpp b/src/Athena/MCFileWriter.cpp similarity index 88% rename from src/MCFileWriter.cpp rename to src/Athena/MCFileWriter.cpp index c9f48dd..3956eab 100644 --- a/src/MCFileWriter.cpp +++ b/src/Athena/MCFileWriter.cpp @@ -1,21 +1,21 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "MCFileWriter.hpp" +#include "Athena/MCFileWriter.hpp" -namespace zelda +namespace Athena { namespace io { diff --git a/src/Athena/SkywardSwordFile.cpp b/src/Athena/SkywardSwordFile.cpp new file mode 100644 index 0000000..134564b --- /dev/null +++ b/src/Athena/SkywardSwordFile.cpp @@ -0,0 +1,71 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#include "Athena/SkywardSwordFile.hpp" +#include "Athena/SkywardSwordQuest.hpp" +#include "Athena/InvalidOperationException.hpp" + +namespace Athena +{ + +SkywardSwordFile::SkywardSwordFile() + : m_numQuests(0) +{ +} + +SkywardSwordFile::SkywardSwordFile(std::vector quests) + : m_numQuests(0) +{ + m_quests = quests; +} + +SkywardSwordFile::~SkywardSwordFile() +{ +} + +void SkywardSwordFile::addQuest(Athena::SkywardSwordQuest *q) +{ + // Do not allow more than 3 quests + if (m_quests.size() >= 3) + return; + + m_quests.push_back(q); +} + +SkywardSwordQuest *SkywardSwordFile::quest(Uint32 id) +{ + if (id > m_quests.size() - 1) + THROW_INVALID_OPERATION_EXCEPTION("index out of range"); + + return m_quests[id]; +} + +std::vector SkywardSwordFile::questList() const +{ + return m_quests; +} + +void SkywardSwordFile::setRegion(Region region) +{ + m_region = region; +} + +Region SkywardSwordFile::region() const +{ + return m_region; +} + + +} // zelda diff --git a/src/Athena/SkywardSwordFileReader.cpp b/src/Athena/SkywardSwordFileReader.cpp new file mode 100644 index 0000000..bb0c46e --- /dev/null +++ b/src/Athena/SkywardSwordFileReader.cpp @@ -0,0 +1,84 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#include "Athena/SkywardSwordFileReader.hpp" +#include "Athena/SkywardSwordFile.hpp" +#include "Athena/SkywardSwordQuest.hpp" +#include "Athena/InvalidOperationException.hpp" +#include "Athena/InvalidDataException.hpp" +#include + +namespace Athena +{ +namespace io +{ + +SkywardSwordFileReader::SkywardSwordFileReader(Uint8* data, Uint64 length) + : base(data, length) +{ + base::setEndian(Endian::BigEndian); +} + +SkywardSwordFileReader::SkywardSwordFileReader(const std::string& filename) + : base(filename) +{ + base::setEndian(Endian::BigEndian); +} + +SkywardSwordFile* SkywardSwordFileReader::read() +{ + SkywardSwordFile* file = NULL; + try + { + if (base::length() != 0xFBE0) + THROW_INVALID_DATA_EXCEPTION("File not the expected size of 0xFBE0"); + + Uint32 magic = base::readUint32(); + + if (magic != SkywardSwordFile::USMagic && magic != SkywardSwordFile::JAMagic && magic != SkywardSwordFile::EUMagic) + THROW_INVALID_DATA_EXCEPTION("Not a valid Skyward Sword save file"); + + base::seek(0x01C, SeekOrigin::Begin); + Uint32 headerSize = base::readUint32(); // Seems to be (headerSize - 1) + + if (headerSize != 0x1D) + THROW_INVALID_DATA_EXCEPTION("Invalid header size, Corrupted data?"); + + // Time to read in each slot + file = new SkywardSwordFile; + file->setRegion((magic == SkywardSwordFile::USMagic ? Region::NTSC: (magic == SkywardSwordFile::JAMagic ? Region::NTSCJ: Region::PAL))); + for (int i = 0; i < 3; i++) + { + SkywardSwordQuest* q = new SkywardSwordQuest((Uint8*)base::readBytes(0x53C0), 0x53C0); + Uint64 pos = base::position(); + // seek to the skip data for this particular quest + base::seek(0xFB60 + (i * 0x24), SeekOrigin::Begin); + q->setSkipData(base::readUBytes(0x24)); + base::seek(pos, SeekOrigin::Begin); + file->addQuest(q); + } + } + catch(...) + { + delete file; + file = NULL; + throw; + } + + return file; +} + +} // io +} // zelda diff --git a/src/Athena/SkywardSwordFileWriter.cpp b/src/Athena/SkywardSwordFileWriter.cpp new file mode 100644 index 0000000..d8d3d52 --- /dev/null +++ b/src/Athena/SkywardSwordFileWriter.cpp @@ -0,0 +1,75 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#include "Athena/SkywardSwordFileWriter.hpp" +#include "Athena/SkywardSwordFile.hpp" +#include "Athena/SkywardSwordQuest.hpp" +#include "Athena/InvalidOperationException.hpp" +#include "Athena/InvalidDataException.hpp" + +namespace Athena +{ +namespace io +{ + +SkywardSwordFileWriter::SkywardSwordFileWriter(Uint8 *data, Uint64 len) + : base(data, len) +{ + base::setEndian(Endian::BigEndian); +} + +SkywardSwordFileWriter::SkywardSwordFileWriter(const std::string &filename) + : base(filename) +{ + base::setEndian(Endian::BigEndian); +} + +void SkywardSwordFileWriter::write(SkywardSwordFile *file) +{ + if (!file) + THROW_INVALID_OPERATION_EXCEPTION("file cannot be NULL"); + + Uint32 magic = (file->region() == Region::NTSC ? SkywardSwordFile::USMagic : + (file->region() == Region::NTSCJ ? SkywardSwordFile::JAMagic : SkywardSwordFile::EUMagic)); + + base::writeUint32(magic); + base::seek(0x1C, SeekOrigin::Begin); + base::writeUint32(0x1D); + + std::vector quests = file->questList(); + int i = 0; + for (SkywardSwordQuest* q : quests) + { + if (q->length() != 0x53C0) + THROW_INVALID_DATA_EXCEPTION("q->data() not 0x53C0 bytes in length"); + if (q->skipLength() != 0x24) + THROW_INVALID_DATA_EXCEPTION("q->skipData() not 0x24 bytes in length"); + // Write the save data + base::writeUBytes(q->data(), q->length()); + Uint64 pos = base::position(); + // Write the slots skip data + base::seek(0xFB60 + (i * 0x24), SeekOrigin::Begin); + base::writeUBytes(q->skipData(), q->skipLength()); + base::seek(pos, SeekOrigin::Begin); + i++; + } + + // write those padding bytes + base::seek(0xFBE0, SeekOrigin::Begin); + save(); +} + +} // io +} // zelda diff --git a/src/Athena/SkywardSwordQuest.cpp b/src/Athena/SkywardSwordQuest.cpp new file mode 100644 index 0000000..cfe20ba --- /dev/null +++ b/src/Athena/SkywardSwordQuest.cpp @@ -0,0 +1,49 @@ +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#include "Athena/SkywardSwordQuest.hpp" + +namespace Athena +{ +SkywardSwordQuest::SkywardSwordQuest(Uint8 *data, Uint32 len) + : ZQuestFile(ZQuestFile::SS, Endian::BigEndian, data, len), + m_skipData(nullptr), + m_skipLength(0) +{ +} + +void SkywardSwordQuest::setSkipData(const Uint8 *data, Uint32 len) +{ + if (m_skipData) + { + delete[] m_skipData; + m_skipData = nullptr; + } + + m_skipData = (Uint8*)data; + m_skipLength = len; +} + +Uint8 *SkywardSwordQuest::skipData() const +{ + return m_skipData; +} + +Uint32 SkywardSwordQuest::skipLength() const +{ + return m_skipLength; +} + +} // zelda diff --git a/src/Sprite.cpp b/src/Athena/Sprite.cpp similarity index 85% rename from src/Sprite.cpp rename to src/Athena/Sprite.cpp index d4f33a6..e220b8a 100644 --- a/src/Sprite.cpp +++ b/src/Athena/Sprite.cpp @@ -1,13 +1,28 @@ -#include "Sprite.hpp" -#include "SpriteFrame.hpp" -#include "SpriteFile.hpp" +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#include "Athena/Sprite.hpp" +#include "Athena/SpriteFrame.hpp" +#include "Athena/SpriteFile.hpp" #include #ifdef LIBZELDA_USE_QT #include #endif -namespace zelda +namespace Athena { namespace Sakura { diff --git a/src/SpriteFile.cpp b/src/Athena/SpriteFile.cpp similarity index 86% rename from src/SpriteFile.cpp rename to src/Athena/SpriteFile.cpp index 209f4bd..9589ab1 100644 --- a/src/SpriteFile.cpp +++ b/src/Athena/SpriteFile.cpp @@ -1,9 +1,24 @@ -#include "SpriteFile.hpp" -#include "Sprite.hpp" -#include "utility.hpp" +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#include "Athena/SpriteFile.hpp" +#include "Athena/Sprite.hpp" +#include "Athena/Utility.hpp" #include -namespace zelda +namespace Athena { namespace Sakura { @@ -190,7 +205,7 @@ void SpriteFile::addSprite(Sprite* sprite) { #ifndef LIBZELDA_USE_QT std::string name(sprite->name()); - zelda::utility::tolower(name); + Athena::utility::tolower(name); if (m_sprites.find(name) != m_sprites.end()) return; #else @@ -206,7 +221,7 @@ void SpriteFile::addSprite(Sprite* sprite) void SpriteFile::removeSprite(const std::string& name) { std::string tmpName(name); - zelda::utility::tolower(tmpName); + Athena::utility::tolower(tmpName); std::unordered_map::iterator iterator = m_sprites.find(tmpName); if (iterator != m_sprites.end()) m_sprites.erase(iterator); @@ -254,7 +269,7 @@ void SpriteFile::setSprites(QMap sprites) Sprite* SpriteFile::sprite(const std::string& name) { std::string nameLow(name); - zelda::utility::tolower(nameLow); + Athena::utility::tolower(nameLow); if (m_sprites.find(nameLow) == m_sprites.end()) return NULL; diff --git a/src/SpriteFileReader.cpp b/src/Athena/SpriteFileReader.cpp similarity index 75% rename from src/SpriteFileReader.cpp rename to src/Athena/SpriteFileReader.cpp index a3eb035..a2cb1c6 100644 --- a/src/SpriteFileReader.cpp +++ b/src/Athena/SpriteFileReader.cpp @@ -1,13 +1,29 @@ -#include "SpriteFileReader.hpp" -#include "SpriteFile.hpp" -#include "Sprite.hpp" -#include "SpritePart.hpp" -#include "SpriteFrame.hpp" -#include "InvalidOperationException.hpp" -#include "IOException.hpp" -#include "utility.hpp" +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see -namespace zelda +#include "Athena/SpriteFileReader.hpp" +#include "Athena/SpriteFile.hpp" +#include "Athena/Sprite.hpp" +#include "Athena/SpritePart.hpp" +#include "Athena/SpriteFrame.hpp" +#include "Athena/InvalidOperationException.hpp" +#include "Athena/InvalidDataException.hpp" +#include "Athena/IOException.hpp" +#include "Athena/Utility.hpp" + +namespace Athena { namespace io { @@ -27,29 +43,29 @@ Sakura::SpriteFile* SpriteFileReader::readFile() Sakura::SpriteFile* ret = NULL; try { - Uint32 magic = base::readUInt32(); + Uint32 magic = base::readUint32(); if (magic != Sakura::SpriteFile::Magic) - throw zelda::error::InvalidOperationException("Not a valid Sakura Sprite container"); + THROW_INVALID_DATA_EXCEPTION("Not a valid Sakura Sprite container"); - Uint32 version = base::readUInt32(); + Uint32 version = base::readUint32(); // TODO: Make this more verbose if (version != Sakura::SpriteFile::Version) - throw zelda::error::InvalidOperationException("Unsupported version"); + THROW_INVALID_DATA_EXCEPTION("Unsupported version"); // After reading in the magic and version we need to load some // metadata about the file. // Such as the texture count, it's dimensions, and it's origin. // After that we have the number of sprites contained in this // sprite container. - Uint16 textureCount = base::readUInt16(); // Having it as a Uint16 gives us the ability to have up to 65536 different states + Uint16 textureCount = base::readUint16(); // Having it as a Uint16 gives us the ability to have up to 65536 different states // This is probably overkill, but it's better safe than sorry. - Uint32 width = base::readUInt32(); - Uint32 height = base::readUInt32(); + Uint32 width = base::readUint32(); + Uint32 height = base::readUint32(); float originX = base::readFloat(); float originY = base::readFloat(); - Uint16 spriteCount = base::readUInt16(); + Uint16 spriteCount = base::readUint16(); // Lets go ahead and create or new container. ret = new Sakura::SpriteFile(width, height, originX, originY); @@ -59,7 +75,7 @@ Sakura::SpriteFile* SpriteFileReader::readFile() // to migrate this code to Big Endian based systems, such as the wii // which require data to be 32 byte aligned, or it causes some issues. // It's also convenient to have this, for later expansion. - Uint32 reserved = base::readUInt32(); + Uint32 reserved = base::readUint32(); UNUSED(reserved); // Next we have to load the textures @@ -104,13 +120,13 @@ Sakura::SpriteFile* SpriteFileReader::readFile() QString name = QString::fromStdString(base::readString()); #endif sprite->setName(name); - Uint16 frameCount = base::readUInt16(); - Uint16 stateCount = base::readUInt16(); + Uint16 frameCount = base::readUint16(); + Uint16 stateCount = base::readUint16(); // Each state id corresponds to a texture held in the parent class std::vector stateIds; for (int j = 0; j < stateCount; j++) - stateIds.push_back(base::readUInt16()); + stateIds.push_back(base::readUint16()); sprite->setStateIds(stateIds); @@ -132,7 +148,7 @@ Sakura::SpriteFile* SpriteFileReader::readFile() { Sakura::SpriteFrame* frame = new Sakura::SpriteFrame(sprite); frame->setFrameTime(base::readFloat()); - Uint16 partCount = base::readUInt16(); + Uint16 partCount = base::readUint16(); #ifndef LIBZELDA_USE_QT @@ -157,8 +173,8 @@ Sakura::SpriteFile* SpriteFileReader::readFile() float texXOff = base::readFloat(); float texYOff = base::readFloat(); part->setTextureOffset(texXOff, texYOff); - Uint32 width = base::readUInt32(); - Uint32 height = base::readUInt32(); + Uint32 width = base::readUint32(); + Uint32 height = base::readUint32(); part->setSize(width, height); bool flippedH = base::readBool(); part->setFlippedHorizontally(flippedH); @@ -176,7 +192,7 @@ Sakura::SpriteFile* SpriteFileReader::readFile() if (sprite->name() != std::string()) { std::string nameLow(sprite->name()); - zelda::utility::tolower(nameLow); + Athena::utility::tolower(nameLow); sprites[nameLow] = sprite; } #else @@ -184,7 +200,7 @@ Sakura::SpriteFile* SpriteFileReader::readFile() sprites[sprite->name().toLower()] = sprite; #endif else - throw zelda::error::IOException("SSpriteFileReader::readFile -> Sprite names cannot be empty"); + THROW_IO_EXCEPTION("Sprite names cannot be empty"); } ret->setSprites(sprites); diff --git a/src/SpriteFileWriter.cpp b/src/Athena/SpriteFileWriter.cpp similarity index 52% rename from src/SpriteFileWriter.cpp rename to src/Athena/SpriteFileWriter.cpp index 3faeda9..e34bf43 100644 --- a/src/SpriteFileWriter.cpp +++ b/src/Athena/SpriteFileWriter.cpp @@ -1,11 +1,27 @@ -#include "SpriteFileWriter.hpp" -#include "SpriteFile.hpp" -#include "Sprite.hpp" -#include "SpritePart.hpp" -#include "SpriteFrame.hpp" -#include "InvalidOperationException.hpp" +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see -namespace zelda +#include "Athena/SpriteFileWriter.hpp" +#include "Athena/SpriteFile.hpp" +#include "Athena/Sprite.hpp" +#include "Athena/SpritePart.hpp" +#include "Athena/SpriteFrame.hpp" +#include "Athena/InvalidOperationException.hpp" +#include "Athena/InvalidDataException.hpp" + +namespace Athena { namespace io { @@ -22,19 +38,19 @@ SpriteFileWriter::SpriteFileWriter(const std::string& filepath) void SpriteFileWriter::writeFile(Sakura::SpriteFile* file) { if (!file) - throw zelda::error::InvalidOperationException("SSpriteFileWriter::writeFile -> file cannot be NULL"); + THROW_INVALID_OPERATION_EXCEPTION("SSpriteFileWriter::writeFile -> file cannot be NULL"); - base::writeUInt32(Sakura::SpriteFile::Magic); - base::writeUInt32(Sakura::SpriteFile::Version); + base::writeUint32(Sakura::SpriteFile::Magic); + base::writeUint32(Sakura::SpriteFile::Version); - base::writeUInt16(file->textureCount()); - base::writeUInt32(file->width()); - base::writeUInt32(file->height()); + base::writeUint16(file->textureCount()); + base::writeUint32(file->width()); + base::writeUint32(file->height()); base::writeFloat(file->originX()); base::writeFloat(file->originY()); - base::writeUInt16(file->spriteCount()); + base::writeUint16(file->spriteCount()); - base::writeUInt32(0xFFFFFFFF); + base::writeUint32(0xFFFFFFFF); for (Sakura::STexture* texture : file->textures()) { @@ -53,16 +69,16 @@ void SpriteFileWriter::writeFile(Sakura::SpriteFile* file) base::writeString(sprite->name().toStdString()); #endif - base::writeUInt16(sprite->frameCount()); - base::writeUInt16(sprite->stateCount()); + base::writeUint16(sprite->frameCount()); + base::writeUint16(sprite->stateCount()); for (int id : sprite->stateIds()) - base::writeUInt16(id); + base::writeUint16(id); for (Sakura::SpriteFrame* frame : sprite->frames()) { base::writeFloat(frame->frameTime()); - base::writeUInt16(frame->partCount()); + base::writeUint16(frame->partCount()); for (Sakura::SpritePart* part: frame->parts()) { #ifndef LIBZELDA_USE_QT @@ -76,15 +92,15 @@ void SpriteFileWriter::writeFile(Sakura::SpriteFile* file) base::writeFloat(part->offset().y); base::writeFloat(part->textureOffset().x); base::writeFloat(part->textureOffset().y); - base::writeUInt32(part->size().x); - base::writeUInt32(part->size().y); + base::writeUint32(part->size().x); + base::writeUint32(part->size().y); #else base::writeFloat(part->offset().x()); base::writeFloat(part->offset().y()); base::writeFloat(part->textureOffset().x()); base::writeFloat(part->textureOffset().y()); - base::writeUInt32(part->size().width()); - base::writeUInt32(part->size().height()); + base::writeUint32(part->size().width()); + base::writeUint32(part->size().height()); #endif base::writeBool(part->flippedHorizontally()); base::writeBool(part->flippedVertically()); diff --git a/src/SpriteFrame.cpp b/src/Athena/SpriteFrame.cpp similarity index 53% rename from src/SpriteFrame.cpp rename to src/Athena/SpriteFrame.cpp index ecf49d9..97f89f7 100644 --- a/src/SpriteFrame.cpp +++ b/src/Athena/SpriteFrame.cpp @@ -1,8 +1,23 @@ -#include "SpriteFrame.hpp" -#include "SpritePart.hpp" -#include "Sprite.hpp" +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see -namespace zelda +#include "Athena/SpriteFrame.hpp" +#include "Athena/SpritePart.hpp" +#include "Athena/Sprite.hpp" + +namespace Athena { namespace Sakura { diff --git a/src/SpritePart.cpp b/src/Athena/SpritePart.cpp similarity index 79% rename from src/SpritePart.cpp rename to src/Athena/SpritePart.cpp index 1f76363..d77e0c0 100644 --- a/src/SpritePart.cpp +++ b/src/Athena/SpritePart.cpp @@ -1,9 +1,24 @@ -#include "SpritePart.hpp" -#include "SpritePart.hpp" -#include "Sprite.hpp" +// This file is part of libAthena. +// +// libAthena is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libAthena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libAthena. If not, see + +#include "Athena/SpritePart.hpp" +#include "Athena/SpritePart.hpp" +#include "Athena/Sprite.hpp" #include -namespace zelda +namespace Athena { namespace Sakura { diff --git a/src/utility.cpp b/src/Athena/Utility.cpp similarity index 82% rename from src/utility.cpp rename to src/Athena/Utility.cpp index 89d4ee0..fe061ba 100644 --- a/src/utility.cpp +++ b/src/Athena/Utility.cpp @@ -1,19 +1,19 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "utility.hpp" +#include "Athena/Utility.hpp" #include #include #include @@ -21,12 +21,12 @@ #include #include #include +#include -namespace zelda +namespace Athena { namespace utility { - bool isEmpty(Int8* buf, Uint32 size) { return buf[0] == 0 && !memcmp(buf, buf + 1, size - 1); @@ -62,13 +62,13 @@ Uint64 swapU64(Uint64 val) Int64 swap64(Int64 val) { return ((Int64)((((Int64)(val) & 0xFF00000000000000ULL) >> 56) | - (((Int64)(val) & 0x00FF000000000000ULL) >> 40) | - (((Int64)(val) & 0x0000FF0000000000ULL) >> 24) | - (((Int64)(val) & 0x000000FF00000000ULL) >> 8) | - (((Int64)(val) & 0x00000000FF000000ULL) << 8) | - (((Int64)(val) & 0x0000000000FF0000ULL) << 24) | - (((Int64)(val) & 0x000000000000FF00ULL) << 40) | - (((Int64)(val) & 0x00000000000000FFULL) << 56))); + (((Int64)(val) & 0x00FF000000000000ULL) >> 40) | + (((Int64)(val) & 0x0000FF0000000000ULL) >> 24) | + (((Int64)(val) & 0x000000FF00000000ULL) >> 8) | + (((Int64)(val) & 0x00000000FF000000ULL) << 8) | + (((Int64)(val) & 0x0000000000FF0000ULL) << 24) | + (((Int64)(val) & 0x000000000000FF00ULL) << 40) | + (((Int64)(val) & 0x00000000000000FFULL) << 56))); } bool isSystemBigEndian() @@ -223,6 +223,14 @@ int countChar(const std::string& str, const char chr, int* lastOccur) return ret; } +Uint64 fileSize(FILE* f) +{ + Uint64 oldPos = ftello64(f); + fseeko64(f, 0, SEEK_END); + Uint64 size = ftello64(f); + fseeko64(f, oldPos, SEEK_SET); + return size; +} } // utility -} // zelda +} // Athena diff --git a/src/WiiBanner.cpp b/src/Athena/WiiBanner.cpp similarity index 83% rename from src/WiiBanner.cpp rename to src/Athena/WiiBanner.cpp index 8457232..ec02021 100644 --- a/src/WiiBanner.cpp +++ b/src/Athena/WiiBanner.cpp @@ -1,25 +1,25 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "WiiBanner.hpp" -#include "WiiImage.hpp" +#include "Athena/WiiBanner.hpp" +#include "Athena/WiiImage.hpp" -#include +#include "Athena/Utility.hpp" #include -namespace zelda +namespace Athena { WiiBanner::WiiBanner() : diff --git a/src/WiiFile.cpp b/src/Athena/WiiFile.cpp similarity index 84% rename from src/WiiFile.cpp rename to src/Athena/WiiFile.cpp index 631d343..6795584 100644 --- a/src/WiiFile.cpp +++ b/src/Athena/WiiFile.cpp @@ -1,22 +1,22 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "WiiFile.hpp" +#include "Athena/WiiFile.hpp" -namespace zelda +namespace Athena { //! TODO: Remove this? diff --git a/src/WiiImage.cpp b/src/Athena/WiiImage.cpp similarity index 89% rename from src/WiiImage.cpp rename to src/Athena/WiiImage.cpp index e593570..1284242 100644 --- a/src/WiiImage.cpp +++ b/src/Athena/WiiImage.cpp @@ -1,24 +1,24 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "WiiImage.hpp" -#include "utility.hpp" +#include "Athena/WiiImage.hpp" +#include "Athena/Utility.hpp" #include #include -namespace zelda +namespace Athena { WiiImage::WiiImage(Uint32 width, Uint32 height, Uint8* data) : diff --git a/src/WiiSave.cpp b/src/Athena/WiiSave.cpp similarity index 81% rename from src/WiiSave.cpp rename to src/Athena/WiiSave.cpp index 65e17da..e704286 100644 --- a/src/WiiSave.cpp +++ b/src/Athena/WiiSave.cpp @@ -1,26 +1,26 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "WiiSave.hpp" -#include "WiiFile.hpp" -#include "WiiBanner.hpp" -#include "BinaryReader.hpp" -#include "BinaryWriter.hpp" +#include "Athena/WiiSave.hpp" +#include "Athena/WiiFile.hpp" +#include "Athena/WiiBanner.hpp" +#include "Athena/BinaryReader.hpp" +#include "Athena/BinaryWriter.hpp" +#include "Athena/Utility.hpp" #include "aes.h" #include "ec.h" -#include "utility.hpp" #include "md5.h" #include "sha1.h" @@ -32,7 +32,7 @@ #include -namespace zelda +namespace Athena { WiiSave::WiiSave() diff --git a/src/WiiSaveReader.cpp b/src/Athena/WiiSaveReader.cpp similarity index 75% rename from src/WiiSaveReader.cpp rename to src/Athena/WiiSaveReader.cpp index 77cb578..d538e1a 100644 --- a/src/WiiSaveReader.cpp +++ b/src/Athena/WiiSaveReader.cpp @@ -1,54 +1,51 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "WiiSaveReader.hpp" -#include "WiiSave.hpp" -#include "WiiFile.hpp" -#include "WiiImage.hpp" -#include "WiiBanner.hpp" +#include "Athena/WiiSaveReader.hpp" +#include "Athena/WiiSave.hpp" +#include "Athena/WiiFile.hpp" +#include "Athena/WiiImage.hpp" +#include "Athena/WiiBanner.hpp" +#include "Athena/Utility.hpp" +#include "Athena/IOException.hpp" +#include "Athena/InvalidOperationException.hpp" +#include "Athena/InvalidDataException.hpp" #include "md5.h" #include "aes.h" #include "ec.h" #include "sha1.h" #include #include -#include -#include -#include #include -namespace zelda +namespace Athena { namespace io { -const Uint8 SD_KEY[16] = {0xab, 0x01, 0xb9, 0xd8, 0xe1, 0x62, 0x2b, 0x08, 0xaf, 0xba, 0xd8, 0x4d, 0xbf, 0xc2, 0xa5, 0x5d}; -const Uint8 SD_IV[16] = {0x21, 0x67, 0x12, 0xe6, 0xaa, 0x1f, 0x68, 0x9f, 0x95, 0xc5, 0xa2, 0x23, 0x24, 0xdc, 0x6a, 0x98}; -const Uint8 MD5_BLANKER[16] = {0x0e, 0x65, 0x37, 0x81, 0x99, 0xbe, 0x45, 0x17, 0xab, 0x06, 0xec, 0x22, 0x45, 0x1a, 0x57, 0x93}; - WiiSaveReader::WiiSaveReader(const Uint8* data, Uint64 length) : base(data, length) { - setEndianess(BigEndian); + setEndian(Endian::BigEndian); } WiiSaveReader::WiiSaveReader(const std::string& filename) : base(filename) { - setEndianess(BigEndian); + setEndian(Endian::BigEndian); } WiiSave* WiiSaveReader::readSave() @@ -57,32 +54,32 @@ WiiSave* WiiSaveReader::readSave() try { if (length() < 0xF0C0) - throw error::InvalidOperationException("WiiSaveReader::readSave -> Not a valid WiiSave"); + THROW_INVALID_DATA_EXCEPTION("Not a valid WiiSave"); WiiBanner* banner = this->readBanner(); if (!banner) - throw error::InvalidOperationException("WiiSaveReader::readSave -> Invalid banner"); + THROW_INVALID_DATA_EXCEPTION("Invalid banner"); ret->setBanner(banner); - Uint32 bkVer = base::readUInt32(); + Uint32 bkVer = base::readUint32(); if (bkVer != 0x00000070) - throw error::InvalidOperationException("WiiSaveReader::readSave -> Invalid BacKup header size"); + THROW_INVALID_DATA_EXCEPTION("Invalid BacKup header size"); - Uint32 bkMagic = base::readUInt32(); + Uint32 bkMagic = base::readUint32(); bkMagic = bkMagic; if (bkMagic != 0x426B0001) - throw error::InvalidOperationException("WiiSaveReader::readSave -> Invalid BacKup header magic"); + THROW_INVALID_DATA_EXCEPTION("Invalid BacKup header magic"); - Uint32 ngId = base::readUInt32(); + Uint32 ngId = base::readUint32(); ngId = ngId; - Uint32 numFiles = base::readUInt32(); + Uint32 numFiles = base::readUint32(); - /*int fileSize =*/ base::readUInt32(); + /*int fileSize =*/ base::readUint32(); base::seek(8); // skip unknown data; - Uint32 totalSize = base::readUInt32(); + Uint32 totalSize = base::readUint32(); base::seek(64); // Unknown (Most likely padding) base::seek(8); base::seek(6); @@ -155,14 +152,14 @@ WiiBanner* WiiSaveReader::readBanner() std::cerr << std::hex << (int)(md5Calc[i]); std::cerr << std::endl; base::setData(oldData, oldLen); - base::seek(oldPos, Stream::Beginning); - throw error::InvalidOperationException("WiiSaveReader::readBanner -> MD5 Mismatch"); + base::seek(oldPos, SeekOrigin::Begin); + THROW_INVALID_DATA_EXCEPTION("MD5 Mismatch"); } // Set the binary reader buffer; base::setData(dec, 0xF0C0); // Start reading the header - gameId = base::readUInt64(); - bannerSize = base::readUInt32(); + gameId = base::readUint64(); + bannerSize = base::readUint32(); permissions = base::readByte(); /* unk =*/ base::readByte(); base::seek(0x10); @@ -175,28 +172,28 @@ WiiBanner* WiiSaveReader::readBanner() std::string gameTitle; std::string subTitle; - magic = base::readUInt32(); + magic = base::readUint32(); // Ensure that the header magic is valid. if (magic != 0x5749424E) { // Make sure to reset m_reader values back to the old ones. base::setData(oldData, oldLen); - base::seek(oldPos, Stream::Beginning); - throw error::InvalidOperationException("WiiSaveReader::readBanner -> Invalid Header Magic"); + base::seek(oldPos, SeekOrigin::Begin); + THROW_INVALID_DATA_EXCEPTION("Invalid Header Magic"); } - flags = base::readUInt32(); - animSpeed = base::readUInt16(); + flags = base::readUint32(); + animSpeed = base::readUint16(); base::seek(22); gameTitle = base::readUnicode(); if (base::position() != 0x0080) - base::seek(0x0080, Stream::Beginning); + base::seek(0x0080, SeekOrigin::Begin); subTitle = base::readUnicode(); if (base::position() != 0x00C0) - base::seek(0x00C0, Stream::Beginning); + base::seek(0x00C0, SeekOrigin::Begin); WiiBanner* banner = new WiiBanner; banner->setGameID(gameId); @@ -231,7 +228,7 @@ WiiBanner* WiiSaveReader::readBanner() } base::setData(oldData, oldLen); - base::seek(oldPos, Stream::Beginning); + base::seek(oldPos, SeekOrigin::Begin); return banner; } @@ -256,14 +253,14 @@ WiiFile* WiiSaveReader::readFile() Uint8* filedata; WiiFile* ret; - Uint32 magic = base::readUInt32(); + Uint32 magic = base::readUint32(); if (magic != 0x03adf17e) { std::cerr << "Not a valid File entry header: 0x" << std::hex << magic << std::endl; return NULL; } - fileLen = base::readUInt32(); + fileLen = base::readUint32(); permissions = base::readByte(); attributes = base::readByte(); type = (WiiFile::Type)base::readByte(); @@ -303,7 +300,7 @@ void WiiSaveReader::readCerts(Uint32 totalSize) Uint8* sig = (Uint8*)base::readBytes(0x40); Uint8* ngCert = (Uint8*)base::readBytes(0x180); Uint8* apCert = (Uint8*)base::readBytes(0x180); - base::seek(0xF0C0, Stream::Beginning); + base::seek(0xF0C0, SeekOrigin::Begin); Uint8* data = (Uint8*)base::readBytes(dataSize); Uint8* hash; diff --git a/src/WiiSaveWriter.cpp b/src/Athena/WiiSaveWriter.cpp similarity index 75% rename from src/WiiSaveWriter.cpp rename to src/Athena/WiiSaveWriter.cpp index 4b22d77..277d70a 100644 --- a/src/WiiSaveWriter.cpp +++ b/src/Athena/WiiSaveWriter.cpp @@ -1,30 +1,33 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see + +#include "Athena/WiiSaveWriter.hpp" +#include "Athena/WiiSave.hpp" +#include "Athena/WiiFile.hpp" +#include "Athena/WiiBanner.hpp" +#include "Athena/WiiImage.hpp" +#include "Athena/WiiSave.hpp" +#include "Athena/WiiFile.hpp" +#include "Athena/WiiBanner.hpp" +#include "Athena/BinaryWriter.hpp" +#include "Athena/Utility.hpp" +#include "Athena/InvalidOperationException.hpp" +#include "Athena/InvalidDataException.hpp" -#include "WiiSaveWriter.hpp" -#include "WiiSave.hpp" -#include "WiiFile.hpp" -#include "WiiBanner.hpp" -#include "WiiImage.hpp" -#include "WiiSave.hpp" -#include "WiiFile.hpp" -#include "WiiBanner.hpp" -#include "BinaryWriter.hpp" #include "aes.h" #include "ec.h" -#include "utility.hpp" #include "md5.h" #include "sha1.h" @@ -35,41 +38,37 @@ #include #include - -namespace zelda +namespace Athena { namespace io { -const Uint8 SD_KEY[16] = {0xab, 0x01, 0xb9, 0xd8, 0xe1, 0x62, 0x2b, 0x08, 0xaf, 0xba, 0xd8, 0x4d, 0xbf, 0xc2, 0xa5, 0x5d}; -const Uint8 SD_IV[16] = {0x21, 0x67, 0x12, 0xe6, 0xaa, 0x1f, 0x68, 0x9f, 0x95, 0xc5, 0xa2, 0x23, 0x24, 0xdc, 0x6a, 0x98}; -const Uint8 MD5_BLANKER[16] = {0x0e, 0x65, 0x37, 0x81, 0x99, 0xbe, 0x45, 0x17, 0xab, 0x06, 0xec, 0x22, 0x45, 0x1a, 0x57, 0x93}; - WiiSaveWriter::WiiSaveWriter(const std::string &filename) : base(filename) { - base::setAutoResizing(true); - base::setEndianess(BigEndian); + base::setEndian(Endian::BigEndian); } bool WiiSaveWriter::writeSave(WiiSave *save, Uint8 *macAddress, Uint32 ngId, Uint8 *ngPriv, Uint8 *ngSig, Uint32 ngKeyId,const std::string &filepath) { + if (!save) + THROW_INVALID_OPERATION_EXCEPTION("save cannot be NULL"); if (filepath != "") m_filepath = filepath; writeBanner(save->banner()); - base::writeUInt32(0x70); - base::writeUInt32(0x426B0001); - base::writeUInt32(ngId); // NG-ID - base::writeUInt32(save->fileList().size()); - base::writeUInt32(0); // Size of files; + base::writeUint32(0x70); + base::writeUint32(0x426B0001); + base::writeUint32(ngId); // NG-ID + base::writeUint32(save->fileList().size()); + base::writeUint32(0); // Size of files; base::seek(8); - base::writeUInt32(0); // totalSize + base::writeUint32(0); // totalSize base::seek(64); - base::writeUInt64(save->banner()->gameID()); + base::writeUint64(save->banner()->gameID()); base::writeBytes((Int8*)macAddress, 6); base::seek(2); // unknown; base::seek(0x10); // padding; @@ -80,11 +79,11 @@ bool WiiSaveWriter::writeSave(WiiSave *save, Uint8 *macAddress, Uint32 ngId, Uin } int pos = base::position(); // Write size data - base::seek(0xF0C0 + 0x10, Stream::Beginning); - base::writeUInt32(totalSize); - base::seek(0xF0C0 + 0x1C, Stream::Beginning); - base::writeUInt32(totalSize + 0x3c0); - base::seek(pos, Stream::Beginning); + base::seek(0xF0C0 + 0x10, SeekOrigin::Begin); + base::writeUint32(totalSize); + base::seek(0xF0C0 + 0x1C, SeekOrigin::Begin); + base::writeUint32(totalSize + 0x3c0); + base::seek(pos, SeekOrigin::Begin); writeCerts(totalSize, ngId, ngPriv, ngSig, ngKeyId); @@ -95,8 +94,7 @@ bool WiiSaveWriter::writeSave(WiiSave *save, Uint8 *macAddress, Uint32 ngId, Uin void WiiSaveWriter::writeBanner(WiiBanner *banner) { - base::setEndianess(BigEndian); - base::setAutoResizing(true); + base::setEndian(Endian::BigEndian); base::writeInt64(banner->gameID()); base::writeInt32((0x60a0+0x1200)*banner->icons().size()); base::writeByte((Int8)banner->permissions()); @@ -111,12 +109,12 @@ void WiiSaveWriter::writeBanner(WiiBanner *banner) base::writeUnicode(banner->title()); if (base::position() != 0x0080) - base::seek(0x0080, Stream::Beginning); + base::seek(0x0080, SeekOrigin::Begin); base::writeUnicode(banner->subtitle()); if (base::position() != 0x00C0) - base::seek(0x00C0, Stream::Beginning); + base::seek(0x00C0, SeekOrigin::Begin); WiiImage* bannerImage = banner->bannerImage(); base::writeBytes((Int8*)bannerImage->data(), bannerImage->width()*bannerImage->height()*2); @@ -140,7 +138,7 @@ void WiiSaveWriter::writeBanner(WiiBanner *banner) Uint8* hash = new Uint8[0x10]; MD5Hash::MD5(hash, (Uint8*)base::data(), 0xF0C0); - base::seek(0x0E, Stream::Beginning); + base::seek(0x0E, SeekOrigin::Begin); base::writeBytes((Int8*)hash, 0x10); aes_set_key(SD_KEY); @@ -150,9 +148,9 @@ void WiiSaveWriter::writeBanner(WiiBanner *banner) memcpy(tmpIV, SD_IV, 16); aes_encrypt(tmpIV, data, data, 0xF0C0); - base::seek(0, Stream::Beginning); + base::seek(0, SeekOrigin::Begin); base::writeBytes((Int8*)data, 0xF0C0); - base::seek(0xF0C0, Stream::Beginning); + base::seek(0xF0C0, SeekOrigin::Begin); } Uint32 WiiSaveWriter::writeFile(WiiFile *file) @@ -160,8 +158,8 @@ Uint32 WiiSaveWriter::writeFile(WiiFile *file) Uint32 ret = 0x80; // Write the File magic - base::writeUInt32(0x03ADF17E); - base::writeUInt32(file->length()); + base::writeUint32(0x03ADF17E); + base::writeUint32(file->length()); base::writeByte(file->permissions()); base::writeByte(file->attributes()); base::writeByte(file->type()); diff --git a/src/ZQuestFile.cpp b/src/Athena/ZQuestFile.cpp similarity index 91% rename from src/ZQuestFile.cpp rename to src/Athena/ZQuestFile.cpp index 954e854..8e61316 100644 --- a/src/ZQuestFile.cpp +++ b/src/Athena/ZQuestFile.cpp @@ -1,22 +1,22 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "ZQuestFile.hpp" +#include "Athena/ZQuestFile.hpp" #include -namespace zelda +namespace Athena { std::vector GameStrings; void initGameStrings() @@ -53,7 +53,7 @@ const Uint32 ZQuestFile::Magic = 'Z' | ('Q' << 8) | ('S' << 16) | (('0' + ZQue ZQuestFile::ZQuestFile() : m_game(NoGame), - m_endian(LittleEndian), + m_endian(Endian::LittleEndian), m_data(NULL), m_length(0) { diff --git a/src/ZQuestFileReader.cpp b/src/Athena/ZQuestFileReader.cpp similarity index 62% rename from src/ZQuestFileReader.cpp rename to src/Athena/ZQuestFileReader.cpp index f6ef93c..35c0e8e 100644 --- a/src/ZQuestFileReader.cpp +++ b/src/Athena/ZQuestFileReader.cpp @@ -1,29 +1,29 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "ZQuestFileReader.hpp" -#include "ZQuestFile.hpp" -#include "InvalidOperationException.hpp" -#include "Compression.hpp" -#include "InvalidDataException.hpp" -#include "Checksums.hpp" +#include "Athena/ZQuestFileReader.hpp" +#include "Athena/ZQuestFile.hpp" +#include "Athena/InvalidOperationException.hpp" +#include "Athena/Compression.hpp" +#include "Athena/InvalidDataException.hpp" +#include "Athena/Checksums.hpp" +#include "Athena/Utility.hpp" #include #include -#include -namespace zelda +namespace Athena { namespace io { @@ -47,18 +47,18 @@ ZQuestFile *ZQuestFileReader::read() Uint32 checksum; Uint8* data; - magic = base::readUInt32(); + magic = base::readUint32(); if ((magic & 0x00FFFFFF) != (ZQuestFile::Magic & 0x00FFFFFF)) - THROW_INVALID_DATA("Not a valid ZQuest file"); + THROW_INVALID_DATA_EXCEPTION("Not a valid ZQuest file"); - version = base::readUInt32(); + version = base::readUint32(); if (version > ZQuestFile::Version) - THROW_INVALID_DATA("Unsupported ZQuest version"); + THROW_INVALID_DATA_EXCEPTION("Unsupported ZQuest version"); - compressedLen = base::readUInt32(); - uncompressedLen = base::readUInt32(); + compressedLen = base::readUint32(); + uncompressedLen = base::readUint32(); if (version >= ZQUEST_VERSION_CHECK(2, 0, 0)) { @@ -72,13 +72,13 @@ ZQuestFile *ZQuestFileReader::read() } } - BOM = base::readUInt16(); - checksum = base::readUInt32(); + BOM = base::readUint16(); + checksum = base::readUint32(); } else { - game = (ZQuestFile::Game)base::readUInt32(); - BOM = base::readUInt16(); + game = (ZQuestFile::Game)base::readUint32(); + BOM = base::readUint16(); std::cerr << "Test" << std::endl; base::seek(0x0A); } @@ -87,15 +87,15 @@ ZQuestFile *ZQuestFileReader::read() if (version >= ZQUEST_VERSION_CHECK(2, 0, 0)) { - if (checksum != zelda::Checksums::crc32(data, compressedLen)) + if (checksum != Athena::Checksums::crc32(data, compressedLen)) { delete[] data; - THROW_INVALID_DATA("Checksum mismatch, data corrupt"); + THROW_INVALID_DATA_EXCEPTION("Checksum mismatch, data corrupt"); } } else { - std::clog << "ZQuest version 0x" << std::uppercase << std::setw(8) << std::setfill('0') << std::hex << zelda::utility::swapU32(version); + std::clog << "ZQuest version 0x" << std::uppercase << std::setw(8) << std::setfill('0') << std::hex << Athena::utility::swapU32(version); std::clog << " has no checksum field" << std::endl; } @@ -109,14 +109,14 @@ ZQuestFile *ZQuestFileReader::read() delete[] dst; delete[] data; // TODO: Make proper exception - THROW_INVALID_DATA("Error decompressing data"); + THROW_INVALID_DATA_EXCEPTION("Error decompressing data"); } delete[] data; data = dst; } - return new ZQuestFile(game, BOM == 0xFEFF ? BigEndian : LittleEndian, data, uncompressedLen, gameString); + return new ZQuestFile(game, BOM == 0xFEFF ? Endian::BigEndian : Endian::LittleEndian, data, uncompressedLen, gameString); } } // io diff --git a/src/ZQuestFileWriter.cpp b/src/Athena/ZQuestFileWriter.cpp similarity index 67% rename from src/ZQuestFileWriter.cpp rename to src/Athena/ZQuestFileWriter.cpp index e0f70e1..c1d0864 100644 --- a/src/ZQuestFileWriter.cpp +++ b/src/Athena/ZQuestFileWriter.cpp @@ -1,25 +1,25 @@ -// This file is part of libZelda. +// This file is part of libAthena. // -// libZelda is free software: you can redistribute it and/or modify +// libAthena is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// libZelda is distributed in the hope that it will be useful, +// libAthena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with libZelda. If not, see +// along with libAthena. If not, see -#include "ZQuestFileWriter.hpp" -#include "InvalidOperationException.hpp" -#include "ZQuestFile.hpp" -#include "Compression.hpp" -#include "Checksums.hpp" +#include "Athena/ZQuestFileWriter.hpp" +#include "Athena/InvalidOperationException.hpp" +#include "Athena/ZQuestFile.hpp" +#include "Athena/Compression.hpp" +#include "Athena/Checksums.hpp" -namespace zelda +namespace Athena { namespace io { @@ -37,10 +37,10 @@ ZQuestFileWriter::ZQuestFileWriter(const std::string& filename) void ZQuestFileWriter::write(ZQuestFile* quest, bool compress) { if (!quest) - THROW_INVALIDOPERATION_EXCEPTION("quest cannot be NULL"); + THROW_INVALID_OPERATION_EXCEPTION("quest cannot be NULL"); - base::writeUInt32(ZQuestFile::Magic); - base::writeUInt32(ZQuestFile::Version); + base::writeUint32(ZQuestFile::Magic); + base::writeUint32(ZQuestFile::Version); Uint8* questData = quest->data(); Uint32 compLen; if (compress) @@ -56,25 +56,25 @@ void ZQuestFileWriter::write(ZQuestFile* quest, bool compress) // Delete the compressed data since we won't be using it delete[] compData; compData = NULL; - base::writeUInt32(quest->length()); + base::writeUint32(quest->length()); } else { // Don't do delete on data questData = compData; - base::writeUInt32(compLen); + base::writeUint32(compLen); } } else { compLen = quest->length(); - base::writeUInt32(quest->length()); + base::writeUint32(quest->length()); } - base::writeUInt32(quest->length()); + base::writeUint32(quest->length()); base::writeBytes((Int8*)quest->gameString().substr(0, 0x0A).c_str(), 0x0A); - base::writeUInt16(quest->endian() == BigEndian ? 0xFFFE : 0xFEFF); - base::writeUInt32(zelda::Checksums::crc32(questData, compLen)); + base::writeUint16(quest->endian() == Endian::BigEndian ? 0xFFFE : 0xFEFF); + base::writeUint32(Athena::Checksums::crc32(questData, compLen)); base::writeUBytes(questData, compLen); base::save(); diff --git a/src/BinaryReader.cpp b/src/BinaryReader.cpp deleted file mode 100644 index cc9a18e..0000000 --- a/src/BinaryReader.cpp +++ /dev/null @@ -1,378 +0,0 @@ -// This file is part of libZelda. -// -// libZelda is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// libZelda is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with libZelda. If not, see - -#include "BinaryReader.hpp" -#include "IOException.hpp" -#include "FileNotFoundException.hpp" -#include "utility.hpp" -#include "utf8.h" - -#include -#include -#include -#include - -#ifdef HW_RVL -#include -#endif // HW_RVL - -namespace zelda -{ -namespace io -{ - -BinaryReader::BinaryReader(const Stream& stream) : - Stream(stream) -{ - Stream::setAutoResizing(false); -} - -BinaryReader::BinaryReader(const Uint8* data, Uint64 length) : - Stream(data, length) -{ - Stream::setAutoResizing(false); -} - -BinaryReader::BinaryReader(const std::string& filename) - : m_filepath(filename) -{ - Stream::setAutoResizing(false); -} - -bool BinaryReader::readBit() -{ - if (!m_data) - loadData(); - - return Stream::readBit(); -} - -Int8 BinaryReader::readByte() -{ - if (!m_data) - loadData(); - - return Stream::readByte(); -} - -Uint8 BinaryReader::readUByte() -{ - if (!m_data) - loadData(); - - return Stream::readUByte(); -} - -Int8* BinaryReader::readBytes(Int64 length) -{ - if (!m_data) - loadData(); - - return Stream::readBytes(length); -} - -Uint8* BinaryReader::readUBytes(Int64 length) -{ - if (!m_data) - loadData(); - - return Stream::readUBytes(length); -} - -void BinaryReader::writeByte(Int8) -{ - throw error::IOException("BinaryReader::writeByte -> Stream not open for writing"); -} - -void BinaryReader::writeBytes(Int8*, Int64) -{ - throw error::IOException("BinaryReader::writeBytes -> Stream not open for writing"); -} - -Int16 BinaryReader::readInt16() -{ - if (!m_data) - loadData(); - - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - - if (m_position + sizeof(Int16) > m_length) - throw error::IOException("BinaryReader::readInt16 -> Position outside stream bounds"); - Int16 ret = *(Int16*)(m_data + m_position); - m_position += sizeof(Int16); - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - ret = utility::swap16(ret); - return ret; -} - -Uint16 BinaryReader::readUInt16() -{ - if (!m_data) - loadData(); - - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - if (m_position + sizeof(Uint16) > m_length) - throw error::IOException("BinaryReader::readUint16 -> Position outside stream bounds"); - Uint16 ret = *(Uint16*)(m_data + m_position); - m_position += sizeof(Uint16); - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - ret = utility::swapU16(ret); - - return ret; -} - -Int32 BinaryReader::readInt32() -{ - if (!m_data) - loadData(); - - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - if (m_position + sizeof(Int32) > m_length) - throw error::IOException("BinaryReader::readUint32 -> Position outside stream bounds"); - Int32 ret = *(Int32*)(m_data + m_position); - m_position += 4; - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - ret = utility::swap32(ret); - return ret; -} - -Uint32 BinaryReader::readUInt32() -{ - if (!m_data) - loadData(); - - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - if (m_position + sizeof(Uint32) > m_length) - throw error::IOException("BinaryReader::readUint32 -> Position outside stream bounds"); - - Uint32 ret = *(Uint32*)(m_data + m_position); - m_position += 4; - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - ret = utility::swapU32(ret); - return ret; -} - -Int64 BinaryReader::readInt64() -{ - if (!m_data) - loadData(); - - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - if (m_position + sizeof(Int64) > m_length) - throw error::IOException("BinaryReader::readInt64 -> Position outside stream bounds"); - - Int64 ret = *(Int64*)(m_data + m_position); - m_position += 8; - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - ret = utility::swap64(ret); - return ret; -} - -Uint64 BinaryReader::readUInt64() -{ - if (!m_data) - loadData(); - - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - if (m_position + sizeof(Uint64) > m_length) - throw error::IOException("BinaryReader::readUInt64 -> Position outside stream bounds"); - Uint64 ret = *(Uint64*)(m_data + m_position); - m_position += 8; - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - ret = utility::swapU64(ret); - return ret; -} - -float BinaryReader::readFloat() -{ - if (!m_data) - loadData(); - - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - if (m_position + sizeof(float) > m_length) - throw error::IOException("BinaryReader::readFloat -> Position outside stream bounds"); - - float ret = *(float*)(m_data + m_position); - m_position += 4; - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - ret = utility::swapFloat(ret); - return ret; -} - -double BinaryReader::readDouble() -{ - if (!m_data) - loadData(); - - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - if (m_position + sizeof(double) > m_length) - throw error::IOException("BinaryReader::readDouble -> Position outside stream bounds"); - - double ret = *(double*)(m_data + m_position); - m_position += 8; - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - ret = utility::swapDouble(ret); - - return ret; -} - -bool BinaryReader::readBool() -{ - if (!m_data) - loadData(); - - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - if (m_position + sizeof(bool) > m_length) - throw error::IOException("BinaryReader::readBool -> Position outside stream bounds"); - - bool ret = *(bool*)(m_data + m_position); - m_position += 1; - return ret; -} - -std::string BinaryReader::readUnicode() -{ - if (!m_data) - loadData(); - std::string ret; - std::vector tmp; - - for(;;) - { - short chr = readUInt16(); - if (chr) - tmp.push_back(chr); - else - break; - }; - - utf8::utf16to8(tmp.begin(), tmp.end(), back_inserter(ret)); - return ret; -} - -std::string BinaryReader::readString() -{ - std::string ret = ""; - Uint8 chr = readByte(); - - while (chr != 0) - { - ret += chr; - chr = readByte(); - } - - return ret; -} - -void BinaryReader::setProgressCallback(std::function cb) -{ - m_progressCallback = cb; -} - -void BinaryReader::loadData() -{ - FILE* in; - Uint32 length; - in = fopen(m_filepath.c_str(), "rb"); - - if (!in) - throw error::FileNotFoundException(m_filepath); - - fseek(in, 0, SEEK_END); - length = ftell(in); - fseek(in, 0, SEEK_SET); -#ifdef HW_RVL - m_data = (Uint8*)memalign(32, length); -#else - m_data = new Uint8[length]; -#endif - - Uint32 done = 0; - Uint32 blocksize = BLOCKSZ; - do - { - if (blocksize > length - done) - blocksize = length - done; - - Int32 ret = fread(m_data + done, 1, blocksize, in); - - if (ret < 0) - throw error::IOException("BinaryReader::BinaryReader -> reading data from disk"); - else if (ret == 0) - break; - - done += ret; - - if (m_progressCallback) - m_progressCallback((int)((float)(done* 100.f)/length)); - - } while (done < length); - - fclose(in); - m_length = length; - m_position = 0; - m_bitPosition = 0; -} - -bool BinaryReader::isOpenForWriting() -{ - return false; -} -} -} diff --git a/src/BinaryWriter.cpp b/src/BinaryWriter.cpp deleted file mode 100644 index ab16c9e..0000000 --- a/src/BinaryWriter.cpp +++ /dev/null @@ -1,324 +0,0 @@ -// This file is part of libZelda. -// -// libZelda is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// libZelda is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with libZelda. If not, see - -#include "BinaryWriter.hpp" -#include "IOException.hpp" -#include "InvalidOperationException.hpp" -#include "FileNotFoundException.hpp" -#include "utility.hpp" -#include "utf8.h" - -#include -#include -#include -#include - -#ifdef HW_RVL -#include -#endif // HW_RVL - -namespace zelda -{ -namespace io -{ - -BinaryWriter::BinaryWriter(const Uint8* data, Uint64 length) - : Stream(data, length) -{} - -BinaryWriter::BinaryWriter(const Stream& stream) : - Stream(stream) -{} - -BinaryWriter::BinaryWriter(const std::string& filename) - : m_filepath(filename) -{ - m_length = 0x10; - m_bitPosition = 0; - m_position = 0; -#ifdef HW_RVL - m_data = (Uint8*)memalign(32, m_length); -#else - m_data = new Uint8[m_length]; -#endif - - if (!m_data) - throw error::IOException("BinaryWriter::BinaryWriter -> Could not allocate memory!"); - memset(m_data, 0, m_length); -} - -void BinaryWriter::setFilepath(const std::string& filepath) -{ - m_filepath = filepath; -} - -std::string BinaryWriter::filepath() const -{ - return m_filepath; -} - -void BinaryWriter::save(const std::string& filename) -{ - if (filename.empty() && m_filepath.empty()) - throw error::InvalidOperationException("BinaryWriter::save -> No file specified, cannot save."); - - if (!filename.empty()) - m_filepath = filename; - - FILE* out = fopen(m_filepath.c_str(), "wb"); - if (!out) - throw error::FileNotFoundException(m_filepath); - - Uint32 done = 0; - Uint32 blocksize = BLOCKSZ; - do - { - if (blocksize > m_length - done) - blocksize = m_length - done; - - Int32 ret = fwrite(m_data + done, 1, blocksize, out); - - if (ret < 0) - throw error::IOException("BinaryWriter::save Error writing data to disk"); - else if (ret == 0) - break; - - done += blocksize; - }while (done < m_length); - - fclose(out); -} - -Int8 BinaryWriter::readByte() -{ - throw error::IOException("BinaryWriter::readByte -> Stream not open for reading"); -} - -Int8* BinaryWriter::readBytes(Int64) -{ - throw error::IOException("BinaryWriter::readBytes -> Stream not open for reading"); -} - -void BinaryWriter::writeInt16(Int16 val) -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - - if (m_position + sizeof(Int16) > m_length && m_autoResize) - resize(m_position + sizeof(Int16)); - else if (m_position > m_length) - throw error::IOException("BinaryWriter::WriteInt16 -> Position outside stream bounds"); - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - val = utility::swap16(val); - - *(Int16*)(m_data + m_position) = val; - m_position += sizeof(Int16); -} - -void BinaryWriter::writeUInt16(Uint16 val) -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - - if (m_position + sizeof(Uint16) > m_length && m_autoResize) - resize(m_position + sizeof(Uint16)); - else if (m_position > m_length) - throw error::IOException("BinaryWriter::WriteUInt16 -> Position outside stream bounds"); - - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - val = utility::swapU16(val); - - *(Uint16*)(m_data + m_position) = val; - m_position += sizeof(Uint16); -} - -void BinaryWriter::writeInt32(Int32 val) -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - - if (m_position + sizeof(Int32) > m_length && m_autoResize) - resize(m_position + sizeof(Int32)); - else if (m_position > m_length) - throw error::IOException("BinaryWriter::WriteInt32 -> Position outside stream bounds"); - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - val = utility::swap32(val); - - *(Int32*)(m_data + m_position) = val; - m_position += sizeof(Int32); -} - -void BinaryWriter::writeUInt32(Uint32 val) -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - - if (m_position + sizeof(Uint32) > m_length && m_autoResize) - resize(m_position + sizeof(Uint32)); - else if (m_position > m_length) - throw error::IOException("BinaryWriter::WriteUInt32 -> Position outside stream bounds"); - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - val = utility::swapU32(val); - - *(Uint32*)(m_data + m_position) = val; - m_position += sizeof(Uint32); -} - -void BinaryWriter::writeInt64(Int64 val) -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - - if (m_position + sizeof(Int64) > m_length && m_autoResize) - resize(m_position + sizeof(Int64)); - else if (m_position > m_length) - throw error::IOException("BinaryWriter::WriteInt64 -> Position outside stream bounds"); - - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - val = utility::swap64(val); - - *(Int64*)(m_data + m_position) = val; - m_position += sizeof(Int64); -} - -void BinaryWriter::writeUInt64(Uint64 val) -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - - if (m_position + sizeof(Uint64) > m_length && m_autoResize) - resize(m_position + sizeof(Uint64)); - else if (m_position > m_length) - throw error::IOException("BinaryWriter::WriteUInt64 -> Position outside stream bounds"); - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - val = utility::swapU64(val); - - *(Uint64*)(m_data + m_position) = val; - m_position += sizeof(Uint64); -} - -void BinaryWriter::writeFloat(float val) -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - - if (m_position + sizeof(float) > m_length && m_autoResize) - resize(m_position + sizeof(float)); - else if (m_position > m_length) - throw error::IOException("BinaryWriter::WriteFloat -> Position outside stream bounds"); - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - val = utility::swapFloat(val); - - *(float*)(m_data + m_position) = val; - m_position += sizeof(float); -} - -void BinaryWriter::writeDouble(double val) -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - - if (m_position + sizeof(double) > m_length && m_autoResize) - resize(m_position + sizeof(double)); - else if (m_position > m_length) - throw error::IOException("BinaryWriter::WriteDouble -> Position outside stream bounds"); - - if ((!utility::isSystemBigEndian() && m_endian == BigEndian) || (utility::isSystemBigEndian() && m_endian == LittleEndian)) - val = utility::swapDouble(val); - - *(double*)(m_data + m_position)= val; - m_position += sizeof(double); -} - -void BinaryWriter::writeBool(bool val) -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - - if (m_position + sizeof(bool) > m_length && m_autoResize) - resize(m_position + sizeof(bool)); - else if (m_position > m_length) - throw error::IOException("BinaryWriter::WriteBool -> Position outside stream bounds"); - - - *(bool*)(m_data + m_position) = val; - m_position += sizeof(bool); -} - -void BinaryWriter::writeUnicode(const std::string& str) -{ - std::string tmpStr = "\xEF\xBB\xBF" + str; - - std::vector tmp; - - utf8::utf8to16(tmpStr.begin(), tmpStr.end(), back_inserter(tmp)); - - for (Uint16 chr : tmp) - { - if (chr != 0xFEFF) - writeInt16(chr); - } -} - -void BinaryWriter::writeString(const std::string& str) -{ - for (Uint8 c : str) - { - if (c != '\0') - writeUByte(c); - } - writeUByte(0); -} - -bool BinaryWriter::isOpenForReading() -{ - return false; -} -} // io -} // zelda diff --git a/src/SkywardSwordFile.cpp b/src/SkywardSwordFile.cpp deleted file mode 100644 index 4d8a90b..0000000 --- a/src/SkywardSwordFile.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "SkywardSwordFile.hpp" -#include "SkywardSwordQuest.hpp" -#include "InvalidOperationException.hpp" - -namespace zelda -{ - -SkywardSwordFile::SkywardSwordFile() - : m_numQuests(0) -{ -} - -SkywardSwordFile::SkywardSwordFile(std::vector quests) - : m_numQuests(0) -{ - m_quests = quests; -} - -SkywardSwordFile::~SkywardSwordFile() -{ -} - -void SkywardSwordFile::addQuest(zelda::SkywardSwordQuest *q) -{ - // Do not allow more than 3 quests - if (m_quests.size() >= 3) - return; - - m_quests.push_back(q); -} - -SkywardSwordQuest *SkywardSwordFile::quest(Uint32 id) -{ - if (id > m_quests.size() - 1) - throw zelda::error::InvalidOperationException("SSFile::quest -> id cannot be " - "greater than the number of quests"); - - return m_quests[id]; -} - -std::vector SkywardSwordFile::questList() const -{ - return m_quests; -} - -void SkywardSwordFile::setRegion(Region region) -{ - m_region = region; -} - -Region SkywardSwordFile::region() const -{ - return m_region; -} - - -} // zelda diff --git a/src/SkywardSwordFileReader.cpp b/src/SkywardSwordFileReader.cpp deleted file mode 100644 index afc2886..0000000 --- a/src/SkywardSwordFileReader.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "SkywardSwordFileReader.hpp" -#include "SkywardSwordFile.hpp" -#include "SkywardSwordQuest.hpp" -#include "InvalidOperationException.hpp" -#include - -namespace zelda -{ -namespace io -{ - -SkywardSwordFileReader::SkywardSwordFileReader(Uint8* data, Uint64 length) - : base(data, length) -{ - base::setEndianess(BigEndian); -} - -SkywardSwordFileReader::SkywardSwordFileReader(const std::string& filename) - : base(filename) -{ - base::setEndianess(BigEndian); -} - -SkywardSwordFile* SkywardSwordFileReader::read() -{ - SkywardSwordFile* file = NULL; - try - { - if (base::length() != 0xFBE0) - throw zelda::error::InvalidOperationException("SSFileReader::read -> File not the expected size of 0xFBE0"); - - Uint32 magic = base::readUInt32(); - - if (magic != SkywardSwordFile::USMagic && magic != SkywardSwordFile::JAMagic && magic != SkywardSwordFile::EUMagic) - throw zelda::error::InvalidOperationException("SSFileReader::read -> Not a valid Skyward Sword save file"); - - base::seek(0x01C, base::Beginning); - Uint32 headerSize = base::readUInt32(); // Seems to be (headerSize - 1) - - if (headerSize != 0x1D) - throw zelda::error::InvalidOperationException("SSFileHeader::read -> Invalid header size, Corrupted data?"); - - // Time to read in each slot - file = new SkywardSwordFile; - file->setRegion((magic == SkywardSwordFile::USMagic ? NTSCURegion : (magic == SkywardSwordFile::JAMagic ? NTSCJRegion : PALRegion))); - for (int i = 0; i < 3; i++) - { - SkywardSwordQuest* q = new SkywardSwordQuest((Uint8*)base::readBytes(0x53C0), 0x53C0); - Uint64 pos = base::position(); - // seek to the skip data for this particular quest - base::seek(0xFB60 + (i * 0x24), base::Beginning); - q->setSkipData(base::readUBytes(0x24)); - base::seek(pos, base::Beginning); - file->addQuest(q); - } - } - catch(...) - { - delete file; - file = NULL; - throw; - } - - return file; -} - -} // io -} // zelda diff --git a/src/SkywardSwordFileWriter.cpp b/src/SkywardSwordFileWriter.cpp deleted file mode 100644 index 0336f9f..0000000 --- a/src/SkywardSwordFileWriter.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "SkywardSwordFileWriter.hpp" -#include "SkywardSwordFile.hpp" -#include "SkywardSwordQuest.hpp" - -namespace zelda -{ -namespace io -{ - -SkywardSwordFileWriter::SkywardSwordFileWriter(Uint8 *data, Uint64 len) - : base(data, len) -{ - base::setEndianess(BigEndian); -} - -SkywardSwordFileWriter::SkywardSwordFileWriter(const std::string &filename) - : base(filename) -{ - base::setEndianess(BigEndian); -} - -void SkywardSwordFileWriter::write(SkywardSwordFile *file) -{ - Uint32 magic = (file->region() == NTSCURegion ? SkywardSwordFile::USMagic : - (file->region() == NTSCJRegion ? SkywardSwordFile::JAMagic : SkywardSwordFile::EUMagic)); - - base::writeUInt32(magic); - base::seek(0x1C, base::Beginning); - base::writeUInt32(0x1D); - - std::vector quests = file->questList(); - int i = 0; - for (SkywardSwordQuest* q : quests) - { - // Write the save data - base::writeUBytes(q->data(), q->length()); - Uint64 pos = base::position(); - // Write the slots skip data - base::seek(0xFB60 + (i * 0x24), base::Beginning); - base::writeUBytes(q->skipData(), q->skipLength()); - base::seek(pos, base::Beginning); - i++; - } - - // write those padding bytes - base::seek(0xFBE0, base::Beginning); - save(); -} - -} // io -} // zelda diff --git a/src/SkywardSwordQuest.cpp b/src/SkywardSwordQuest.cpp deleted file mode 100644 index 0c75f86..0000000 --- a/src/SkywardSwordQuest.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "SkywardSwordQuest.hpp" - -namespace zelda -{ -SkywardSwordQuest::SkywardSwordQuest(Uint8 *data, Uint32 len) - : ZQuestFile(ZQuestFile::SS, BigEndian, data, len), - m_skipData(NULL), - m_skipLength(0) -{ -} - -void SkywardSwordQuest::setSkipData(const Uint8 *data, Uint32 len) -{ - if (m_skipData) - { - delete[] m_skipData; - m_skipData = NULL; - } - - m_skipData = (Uint8*)data; - m_skipLength = len; -} - -Uint8 *SkywardSwordQuest::skipData() const -{ - return m_skipData; -} - -Uint32 SkywardSwordQuest::skipLength() const -{ - return m_skipLength; -} - -} // zelda diff --git a/src/Stream.cpp b/src/Stream.cpp deleted file mode 100644 index 0be7544..0000000 --- a/src/Stream.cpp +++ /dev/null @@ -1,383 +0,0 @@ -// This file is part of libZelda. -// -// libZelda is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// libZelda is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with libZelda. If not, see - -#include "Stream.hpp" -#include "IOException.hpp" -#include "InvalidOperationException.hpp" -#include -#include - -#ifdef HW_RVL -#include -#endif // HW_RVL - -namespace zelda -{ -namespace io -{ - -const Uint32 Stream::BLOCKSZ = (32*1024); - -Stream::Stream() : - m_bitPosition(0), - m_position(0), - m_length(0), - m_endian(LittleEndian), - m_data(NULL), - m_autoResize(true) -{} - -Stream::Stream(const Uint8* data, Uint64 length) : - m_bitPosition(0), - m_position(0), - m_endian(LittleEndian), - m_autoResize(true) -{ - if (length <= 0) - throw error::InvalidOperationException("Stream::Stream -> Length cannot be <= to 0"); - - m_length = length; - if (data) - m_data = (Uint8*)data; - else - { -#ifdef HW_RVL - m_data = (Uint8*)memalign(32, m_length); -#else - m_data = new Uint8[m_length]; -#endif - - memset(m_data, 0, m_length); - } -} - -Stream::Stream(Int64 length) : - m_bitPosition(0), - m_position(0), - m_length(length) -{ -#ifdef HW_RVL - m_data = (Uint8*)memalign(32, m_length); -#else - m_data = new Uint8[m_length]; -#endif - memset(m_data, 0, m_length); -} - -Stream::Stream(Stream* stream) -{ - if (m_data) - delete[] m_data; - - m_data = NULL; - m_data = stream->m_data; - m_position = stream->m_position; - m_length = stream->m_length; -} - -Stream::~Stream() -{ - if (m_data) -#ifdef HW_RVL - free(m_data); -#else - delete[] m_data; -#endif - - m_data = NULL; - m_position = 0; - m_length = 0; - m_endian = LittleEndian; - m_autoResize = false; -} - -void Stream::writeBit(bool val) -{ - if (m_position + sizeof(Uint8) > m_length && m_autoResize) - resize(m_position + sizeof(Uint8)); - else if (m_position > m_length) - throw error::IOException("Stream::writeBit() -> Position outside stream bounds"); - - if (val) - *(Uint8*)(m_data + m_position) |= (1 << m_bitPosition); - else - *(Uint8*)(m_data + m_position) &= ~(1 << m_bitPosition); - m_bitPosition++; - if (m_bitPosition > 7) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } -} - -void Stream::writeUByte(Uint8 byte) -{ - writeByte((Int8)byte); -} - -void Stream::writeByte(Int8 byte) -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - if (m_position + 1 > m_length && m_autoResize) - resize(m_position + 1); - else if (m_position > m_length) - throw error::IOException("Stream::writeByte() -> Position outside stream bounds"); - - *(Int8*)(m_data + m_position) = byte; - m_position++; -} - -void Stream::writeUBytes(Uint8* data, Int64 length) -{ - writeBytes((Int8*)data, length); -} - -void Stream::writeBytes(Int8* data, Int64 length) -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - - if (!data) - throw error::InvalidOperationException("Stream::writeBytes -> data cannnot be NULL"); - if (m_position + length > m_length && m_autoResize) - resize(m_position + length); - else if (m_position > m_length) - throw error::IOException("Stream::writeBytes -> Position outside stream bounds"); - - - memcpy((Int8*)(m_data + m_position), data, length); - - m_position += length; -} - -bool Stream::readBit() -{ - if (m_position + sizeof(Uint8) > m_length && m_autoResize) - resize(m_position + sizeof(Uint8)); - else if (m_position > m_length) - throw error::IOException("Stream::writeInt16 -> Position outside stream bounds"); - - bool ret = (*(Uint8*)(m_data + m_position) & (1 << m_bitPosition)); - - m_bitPosition++; - if (m_bitPosition > 7) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - - return ret; -} - -Int8 Stream::readByte() -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - if (m_position + 1 > m_length) - throw error::IOException("Stream::readByte -> Position passed stream bounds"); - - return *(Int8*)(m_data + m_position++); -} - -Uint8 Stream::readUByte() -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - if (m_position + 1 > m_length) - throw error::IOException("Stream::readUByte -> Position passed stream bounds"); - - return *(Uint8*)(m_data + m_position++); -} - -Uint8 *Stream::readUBytes(Int64 length) -{ - return (Uint8*)readBytes(length); -} - -Int8* Stream::readBytes(Int64 length) -{ - if (m_bitPosition > 0) - { - m_bitPosition = 0; - m_position += sizeof(Uint8); - } - - if (m_position + length > m_length) - throw error::IOException("Stream::readBytes -> Position passed stream bounds: " + m_position); - - Int8* ret; -#ifdef HW_RVL - ret = (Int8*)memalign(32, length); -#else - ret = new Int8[length]; -#endif - - memcpy(ret, (const Int8*)(m_data + m_position), length); - m_position += length; - return ret; -} - -void Stream::seek(Int64 position, SeekOrigin origin) -{ - switch (origin) - { - case Beginning: - if ((position < 0 || (Int64)position > (Int64)m_length) && !m_autoResize) - { - std::stringstream ss; - ss << position; - throw error::IOException("Stream::seek() Beginnning -> Position outside stream bounds: " + ss.str()); - } - if ((Uint64)position > m_length) - this->resize(position); - m_position = position; - break; - case Current: - if ((((Int64)m_position + position) < 0 || (m_position + position) > m_length) && !m_autoResize) - { - std::stringstream ss; - ss << (m_position + position); - throw error::IOException("Stream::seek() Current -> Position outside stream bounds: " + ss.str()); - } - else if ((m_position + position) > m_length) - this->resize(m_position + position); - - m_position += position; - break; - case End: - if ((((Int64)m_length - position < 0) || (m_length - position) > m_length) && !m_autoResize) - { - std::stringstream ss; - ss << std::hex << "0x" << (m_length - position); - throw error::IOException("Stream::seek() End -> Position outside stream bounds " + ss.str()); - } - else if ((m_length - position) > m_length) - this->resize(m_length - position); - - m_position = m_length - position; - break; - } -} - -void Stream::resize(Uint64 newSize) -{ - if (newSize < m_length) - throw error::InvalidOperationException("Stream::resize() -> New size cannot be less to the old size."); - - // Allocate and copy new buffer -#ifdef HW_RVL - Uint8* newArray = (Uint8*)memalign(32, newSize); -#else - Uint8* newArray = new Uint8[newSize]; -#endif - - memset(newArray, 0, newSize); - - memcpy(newArray, m_data, m_length); - - // Delete the old one -#ifdef HW_RVL - free(m_data); -#else - delete[] m_data; -#endif - - // Swap the pointer and size out for the new ones. - m_data = newArray; - m_length = newSize; -} - -void Stream::setData(const Uint8* data, Uint64 length) -{ - if (m_data) -#ifdef HW_RVL - free(m_data); -#else - delete[] m_data; -#endif - - m_data = (Uint8*)data; - m_length = length; - m_position = 0; -} - -Uint8* Stream::data() const -{ - Uint8* ret = new Uint8[m_length]; - memset(ret, 0, m_length); - memcpy(ret, m_data, m_length); - return ret; -} - -Int64 Stream::length() const -{ - return m_length; -} - -Int64 Stream::position() const -{ - return m_position; -} - -bool Stream::atEnd() const -{ - return m_position >= m_length; -} - -void Stream::setAutoResizing(bool val) -{ - m_autoResize = val; -} - -bool Stream::autoResizing() const -{ - return m_autoResize; -} - -bool Stream::isOpenForReading() const -{ - return true; -} - -bool Stream::isOpenForWriting() const -{ - return true; -} - -void Stream::setEndianess(Endian endian) -{ - m_endian = endian; -} - -Endian Stream::endian() const -{ - return m_endian; -} - -} // io -} // zelda diff --git a/src/TextStream.cpp b/src/TextStream.cpp deleted file mode 100644 index 94f1b9d..0000000 --- a/src/TextStream.cpp +++ /dev/null @@ -1,288 +0,0 @@ -// This file is part of libZelda. -// -// libZelda is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// libZelda is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with libZelda. If not, see - -#include "TextStream.hpp" -#include -#include "FileNotFoundException.hpp" -#include "InvalidOperationException.hpp" -#include "IOException.hpp" - -namespace zelda -{ -namespace io -{ -TextStream::TextStream(const std::string& filename, Uint32 fileMode, AccessMode accessMode) : - m_filename(filename), - m_textmode(fileMode), - m_accessmode(accessMode), - m_currentLine(0) -{ - setAutoResizing(true); - - FILE* in; - int length; - in = fopen(filename.c_str(), "rb"); - - if (!in) - { - if((fileMode & Create) != Create) - throw error::FileNotFoundException(filename.c_str()); - - in = fopen(filename.c_str(), "w+b"); - } - - if ((fileMode & Truncate) != Truncate) - { - fseek(in, 0, SEEK_END); - length = ftell(in); - fseek(in, 0, SEEK_SET); - m_data = new Uint8[length]; - fread(m_data, 1, length, in); - fclose(in); - } - else - { - length = 1; - m_data = new Uint8[1]; - } - - if ((fileMode & Append) == Append) - m_position = length; - else - m_position = 0; - - m_length = length; - m_startLength = length; - - loadLines(); -} - -TextStream::TextStream() - : Stream() -{} - -void TextStream::save(const std::string& filename) -{ - if (m_accessmode != WriteOnly && m_accessmode != ReadWrite) - throw error::InvalidOperationException("TextStream::save -> Stream not open for writing"); - if (filename != std::string()) - m_filename = filename; - - // We need a new buffer to write the new lines - if (m_data) - { - delete[] m_data; - m_data = NULL; - } - - m_position = 0; - m_length = 1; - - // Set the new buffer - m_data = new Uint8[m_length]; - - // Now write all the strings to the new buffer - for (std::string s : m_lines) - writeBytes((Int8*)s.c_str(), s.size()); - - writeByte('\n'); - - FILE* out = fopen(m_filename.c_str(), "wb"); - - if(out) - { - fwrite(m_data, 1, m_length, out); - fclose(out); - } - else - throw error::FileNotFoundException(m_filename); -} - -std::string TextStream::readLine() -{ - if (m_accessmode != ReadOnly && m_accessmode != ReadWrite) - throw error::InvalidOperationException("TextStream::readLine -> Stream not open for reading"); - - if (m_currentLine > m_lines.size()) - throw error::IOException("TextStream::readLine -> Position past stream bounds"); - - return m_lines[m_currentLine++]; -} - - -void TextStream::writeLine(const std::string& str) -{ - if (m_accessmode != WriteOnly && m_accessmode != ReadWrite) - throw error::InvalidOperationException("TextStream::writeLine -> Stream not open for writing"); - else if (m_currentLine >= m_lines.size()) - { - m_lines.push_back(str + "\n"); - m_currentLine++; - return; - } - - m_lines[m_currentLine++] = str + "\n"; -} - -void TextStream::writeLines(std::vector strings) -{ - if (m_accessmode != WriteOnly && m_accessmode != ReadWrite) - throw error::InvalidOperationException("TextStream::writeLines -> Stream not open for writing"); - - for (std::string s: strings) - writeLine(s); -} - -std::vector TextStream::readLines(Uint32 numLines) -{ - if (m_accessmode != ReadOnly && m_accessmode != ReadWrite) - throw error::InvalidOperationException("TextStream::readLines -> Stream not open for reading"); - - if (numLines > m_lines.size()) - throw error::InvalidOperationException("TextStream::readLines -> numLines exceeds the number of stored strings."); - - Uint32 currentLine = m_currentLine; - std::vector ret; - - while ((m_currentLine++) <= currentLine + numLines) - ret.push_back(m_lines[m_currentLine]); - - return ret; -} - -std::string TextStream::readLineAt(Uint32 line) -{ - if (m_accessmode != ReadOnly && m_accessmode != ReadWrite) - throw error::InvalidOperationException("TextStream::readLineAt -> Stream not open for reading"); - if (line <= 0) - throw error::InvalidOperationException("TextStream::readLineAt -> A line cannot be zero indexed"); - - if ((line - 1) >= m_lines.size()) - throw error::IOException("TextStream::readLineAt -> Line index out of range"); - return m_lines[line - 1]; -} - -void TextStream::writeLineAt(Uint32 line, const std::string& str) -{ - if (m_accessmode != WriteOnly && m_accessmode != ReadWrite) - throw error::InvalidOperationException("TextStream::writeLineAt -> Stream not open for reading"); - if (line <= 0) - throw error::InvalidOperationException("TextStream::writeLineAt -> A line cannot be zero indexed"); - - m_currentLine = line; - writeLine(str); -} - -std::vector TextStream::readAllLines() -{ - if (m_accessmode != ReadOnly && m_accessmode != ReadWrite) - throw error::InvalidOperationException("TextWriter::readAllLines -> Stream not open for reading"); - - return m_lines; -} - -void TextStream::setCurrentLine(Uint32 line) -{ - if (line <= 0) - throw error::InvalidOperationException("TextWriter::setCurrentLine -> A line cannot be zero indexed"); - m_currentLine = line - 1; -} - -Uint32 TextStream::currentLine() const -{ - return m_currentLine + 1; -} - -void TextStream::setAccessMode(AccessMode mode) -{ - m_accessmode = mode; -} - -TextStream::AccessMode TextStream::accessMode() const -{ - return m_accessmode; -} - -void TextStream::setTextMode(TextMode mode) -{ - m_textmode = mode; -} - -Uint32 TextStream::textMode() const -{ - return m_textmode; -} - -void TextStream::truncate() -{ - m_lines.clear(); -} - -bool TextStream::isOpenForReading() const -{ - return ((m_accessmode == ReadOnly || m_accessmode == ReadWrite) && m_accessmode != WriteOnly); -} - -bool TextStream::isOpenForWriting() const -{ - return ((m_accessmode == WriteOnly || m_accessmode == ReadWrite) && m_accessmode != ReadOnly); -} - -// PRIVATE FUNCTIONS -void TextStream::loadLines() -{ - try - { - - while (!atEnd()) - { - std::string line; - Uint8 c; - for (;;) - { - c = readByte(); - - if (c == '\r' || c == '\n') - { - m_currentLine++; - line.push_back(c); - if (*(Uint8*)(m_data + m_position + 1) == '\n') - { - line.push_back('\n'); - m_position++; // advance position past the new line character - } - break; - } - - if (c == '\0') - { - line.push_back('\n'); - break; - } - line.push_back(c); - } - - m_lines.push_back(line); - } - } - catch(...) - { - // The stream MAY throw an out of range error but we're not concerned with it - } -} - -} // io -} // zelda - diff --git a/src/ec.cpp b/src/ec.cpp index 5270d61..d73faed 100644 --- a/src/ec.cpp +++ b/src/ec.cpp @@ -8,7 +8,7 @@ // Not all of these headers are necessary, figure out which ones are actually used and prune those that are irrelevant. #include -#include +#include "Athena/Utility.hpp" #include "bn.h" #include "ec.h" @@ -330,7 +330,7 @@ void generate_ecdsa(Uint8 *R, Uint8 *S, Uint8 *k, Uint8 *hash) elt_zero(e); memcpy(e + 10, hash, 20); - zelda::utility::fillRandom(m, sizeof(m)); + Athena::utility::fillRandom(m, sizeof(m)); m[0] = 0; // R = (mG).x @@ -405,11 +405,11 @@ bool check_ec(Uint8 *ng, Uint8 *ap, Uint8 *sig, Uint8 *sig_hash) void make_ec_cert(Uint8 *cert, Uint8 *sig, char *signer, char *name, Uint8 *priv, Uint32 key_id ) { memset(cert, 0, 0x180); - *(Uint32*)(cert) = zelda::utility::swapU32(0x10002); + *(Uint32*)(cert) = Athena::utility::swapU32(0x10002); memcpy((char*)cert + 4, sig, 60); strcpy((char*)cert + 0x80, signer); - *(Uint32*)(cert + 0xc0) = zelda::utility::swapU32(2); + *(Uint32*)(cert + 0xc0) = Athena::utility::swapU32(2); strcpy((char*)cert + 0xc4, name); - *(Uint32*)(cert + 0x104) = zelda::utility::swapU32(key_id); + *(Uint32*)(cert + 0x104) = Athena::utility::swapU32(key_id); ec_priv_to_pub(priv, cert + 0x108); } diff --git a/src/sha1.cpp b/src/sha1.cpp index d629f2a..0584a90 100644 --- a/src/sha1.cpp +++ b/src/sha1.cpp @@ -40,7 +40,7 @@ #include "sha1.h" #include -#include +#include "Athena/Utility.hpp" /* * Define the circular shift macro @@ -386,8 +386,8 @@ Uint8* getSha1( Uint8 * stuff, Uint32 stuff_size ) for( int i = 0; i < 5 ; i++ ) { int val = sha.Message_Digest[ i ]; - if (!zelda::utility::isSystemBigEndian()) - val = zelda::utility::swap32(val); + if (!Athena::utility::isSystemBigEndian()) + val = Athena::utility::swap32(val); memcpy( (char*)ret + ( i * 4 ), &val, 4 ); }