diff --git a/include/ALTTPEnums.hpp b/include/ALTTPEnums.hpp
new file mode 100644
index 0000000..8505bc8
--- /dev/null
+++ b/include/ALTTPEnums.hpp
@@ -0,0 +1,106 @@
+// 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 __ALTTP_ENUMS_HPP__
+#define __ALTTP_ENUMS_HPP__
+
+#include "Types.hpp"
+
+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
+};
+
+#endif // __ALTTP_ENUMS_HPP__
diff --git a/include/ALTTPFile.hpp b/include/ALTTPFile.hpp
new file mode 100644
index 0000000..33f5902
--- /dev/null
+++ b/include/ALTTPFile.hpp
@@ -0,0 +1,87 @@
+// 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 __ALTTP_FILE_HPP__
+#define __ALTTP_FILE_HPP__
+
+#include
+#include
+
+class ALTTPQuest;
+
+/*! \class ALTTPFile
+ * \brief A Link to the Past data container 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;
+};
+
+#endif // __ALTTP_FILE_HPP__
diff --git a/include/ALTTPFileReader.hpp b/include/ALTTPFileReader.hpp
new file mode 100644
index 0000000..5048b69
--- /dev/null
+++ b/include/ALTTPFileReader.hpp
@@ -0,0 +1,39 @@
+// 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 __ALTTP_FILE_READER_HPP__
+#define __ALTTP_FILE_READER_HPP__
+
+#include
+#include "Types.hpp"
+#include "BinaryReader.hpp"
+#include "ALTTPQuest.hpp"
+
+class ALTTPFile;
+
+class ALTTPFileReader : public BinaryReader
+{
+public:
+ ALTTPFileReader(Uint8*, Uint64);
+ ALTTPFileReader(const std::string&);
+
+ ALTTPFile* readFile();
+private:
+ ALTTPRoomFlags* readRoomFlags();
+ ALTTPOverworldEvent* readOverworldEvent();
+ ALTTPDungeonItemFlags readDungeonFlags();
+};
+
+#endif // __ALTTP_FILE_READER_HPP__
diff --git a/include/ALTTPFileWriter.hpp b/include/ALTTPFileWriter.hpp
new file mode 100644
index 0000000..f1ad9d1
--- /dev/null
+++ b/include/ALTTPFileWriter.hpp
@@ -0,0 +1,40 @@
+// 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 __ALTTP_FILE_WRITER_HPP__
+#define __ALTTP_FILE_WRITER_HPP__
+
+#include
+#include
+#include
+#include "ALTTPQuest.hpp"
+
+class ALTTPFile;
+
+class ALTTPFileWriter : public BinaryWriter
+{
+public:
+ ALTTPFileWriter(Uint8*, Uint64);
+ ALTTPFileWriter(const std::string&);
+
+ void writeFile(ALTTPFile* file);
+private:
+ void writeRoomFlags(ALTTPRoomFlags*);
+ void writeOverworldEvent(ALTTPOverworldEvent*);
+ void writeDungeonItems(ALTTPDungeonItemFlags);
+ Uint16 calculateChecksum(Uint32 game);
+};
+
+#endif // __ALTTP_FILE_WRITER_HPP__
diff --git a/include/ALTTPQuest.hpp b/include/ALTTPQuest.hpp
new file mode 100644
index 0000000..b01344e
--- /dev/null
+++ b/include/ALTTPQuest.hpp
@@ -0,0 +1,221 @@
+// 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 __ALTTP_QUEST_HPP__
+#define __ALTTP_QUEST_HPP__
+
+#include "Types.hpp"
+#include
+#include
+#include "ALTTPStructs.hpp"
+#include "ALTTPEnums.hpp"
+
+/*! \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:
+ ALTTPQuest();
+ ~ALTTPQuest();
+
+ void setRoomFlags(std::vector flags);
+ void setRoomFlags(ALTTPRoomFlags* rf, Uint32 id);
+ std::vector roomFlags();
+ ALTTPRoomFlags* roomFlags(Uint32 id);
+
+ void setOverworldEvents(std::vector events);
+ void setOverworldEvents(ALTTPOverworldEvent* ow, Uint32 id);
+ std::vector overworldEvents() const;
+ ALTTPOverworldEvent* overworldEvent(Uint32 id) const;
+
+ void setInventory(ALTTPInventory* inv);
+ ALTTPInventory* inventory() const;
+
+ void setRupeeMax(Uint16 val);
+ Uint16 rupeeMax() const;
+
+ void setRupeeCurrent(Uint16 val);
+ Uint16 rupeeCurrent() const;
+
+ void setCompasses(ALTTPDungeonItemFlags flags);
+ ALTTPDungeonItemFlags compasses() const;
+
+ void setBigKeys(ALTTPDungeonItemFlags flags);
+ ALTTPDungeonItemFlags bigKeys() const;
+
+ void setDungeonMaps(ALTTPDungeonItemFlags flags);
+ ALTTPDungeonItemFlags dungeonMaps() const;
+
+ void setWishingPond(Uint16 val);
+ Uint16 wishingPond() const;
+
+ void setHealthMax(Uint8 val);
+ Uint8 healthMax() const;
+
+ void setHealth(Uint8 val);
+ Uint8 health() const;
+
+ void setMagicPower(Uint8 val);
+ Uint8 magicPower() const;
+
+ void setKeys(Uint8 val);
+ Uint8 keys() const;
+
+ void setBombUpgrades(Uint8 val);
+ Uint8 bombUpgrades() const;
+
+ void setArrowUpgrades(Uint8 val);
+ Uint8 arrowUpgrades() const;
+
+ void setHealthFiller(Uint8 val);
+ Uint8 healthFiller() const;
+
+ void setMagicFiller(Uint8 val);
+ Uint8 magicFiller() const;
+
+ void setPendants(ALTTPPendants val);
+ ALTTPPendants pendants() const;
+
+ void setBombFiller(Uint8 val);
+ Uint8 bombFiller() const;
+
+ void setArrowFiller(Uint8 val);
+ Uint8 arrowFiller() const;
+ void setArrows(Uint8 val);
+ Uint8 arrows() const;
+
+ void setAbilityFlags(ALTTPAbilities val);
+ ALTTPAbilities abilityFlags() const;
+
+ void setCrystals(ALTTPCrystals val);
+ ALTTPCrystals crystals() const;
+
+ void setMagicUsage(ALTTPMagicUsage val);
+ ALTTPMagicUsage magicUsage() const;
+
+ void setDungeonKeys(std::vector val);
+ void setDungeonKeys(Uint32 id, Uint8 val);
+ Uint8 dungeonKeys(Uint32 id) const;
+ Uint32 dungeonCount() const;
+
+ void setProgressIndicator(ALTTPProgressIndicator val);
+ ALTTPProgressIndicator progressIndicator() const;
+
+ void setProgressFlags1(ALTTPProgressFlags1 val);
+ ALTTPProgressFlags1 progressFlags1() const;
+
+ void setMapIcon(ALTTPMapIcon val);
+ ALTTPMapIcon mapIcon() const;
+
+ void setStartLocation(ALTTPStartLocation val);
+ ALTTPStartLocation startLocation() const;
+
+ void setProgressFlags2(ALTTPProgressFlags2 val);
+ ALTTPProgressFlags2 progressFlags2() const;
+
+ void setLightDarkWorldIndicator(ALTTPLightDarkWorldIndicator val);
+ ALTTPLightDarkWorldIndicator lightDarkWorldIndicator() const;
+
+ void setTagAlong(ALTTPTagAlong val);
+ ALTTPTagAlong tagAlong() const;
+
+ void setOldManFlags(std::vector flags);
+ void setOldManFlag(Uint32 id, Uint8 val);
+ Uint8 oldManFlag(Uint32 id);
+ Uint32 oldManFlagCount() const;
+
+ void setBombFlag(Uint8 flag);
+ Uint8 bombFlag() const;
+
+ void setUnknown1(std::vector flags);
+ void setUnknown1(Uint32 id, Uint8 val);
+ Uint8 unknown1(Uint32 id);
+ Uint32 unknown1Count() const;
+
+ void setPlayerName(std::vector playerName);
+ void setPlayerName(const std::string& playerName);
+ std::vector playerName() const;
+ std::string playerNameToString() const;
+
+ void setValid(bool val);
+ bool valid();
+
+ void setDungeonDeathTotals(std::vector val);
+ void setDungeonDeathTotal(Uint32 id, Uint16 val);
+ Uint16 dungeonDeathTotal(Uint32 id) const;
+ Uint16 dungeonDeathTotalCount() const;
+
+ void setUnknown2(Uint16 val);
+ Uint16 unknown2() const;
+
+ void setDeathSaveCount(Uint16 val);
+ Uint16 deathSaveCount() const;
+
+ void setPostGameDeathCounter(Int16 val);
+ Int16 postGameDeathCounter() const;
+
+ void setChecksum(Uint16 checksum);
+ 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;
+};
+
+
+#endif // __ALTTP_QUEST_HPP__
diff --git a/include/ALTTPStructs.hpp b/include/ALTTPStructs.hpp
new file mode 100644
index 0000000..9ceba38
--- /dev/null
+++ b/include/ALTTPStructs.hpp
@@ -0,0 +1,207 @@
+// 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 __ALTTP_STRUCTS_HPP__
+#define __ALTTP_STRUCTS_HPP__
+
+#include
+#include "Types.hpp"
+
+/*! \struct ALTTPRoomFlags
+ */
+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
+ */
+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
+ */
+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];
+
+ std::string bowType();
+ std::string boomerangType();
+ std::string magicType();
+ std::string armorType();
+ std::string bottleType(Uint32);
+};
+
+/*! \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 // __ALTTP_STRUCTS_HPP__
diff --git a/include/BinaryReader.hpp b/include/BinaryReader.hpp
index ff782f6..4d941bd 100644
--- a/include/BinaryReader.hpp
+++ b/include/BinaryReader.hpp
@@ -155,7 +155,7 @@ protected:
* \throw IOException
*/
void writeBytes(Int8*, Int64);
- std::string m_filename;
+ std::string m_filepath;
};
#endif
diff --git a/include/BinaryWriter.hpp b/include/BinaryWriter.hpp
index 8709b9e..4ecb32b 100644
--- a/include/BinaryWriter.hpp
+++ b/include/BinaryWriter.hpp
@@ -12,6 +12,7 @@
//
// You should have received a copy of the GNU General Public License
// along with libZelda. If not, see
+
#ifndef __BINARYWRITER_HPP__
#define __BINARYWRITER_HPP__
diff --git a/include/Mainpage.hpp b/include/Mainpage.hpp
index 7a6f930..b3138fd 100644
--- a/include/Mainpage.hpp
+++ b/include/Mainpage.hpp
@@ -1,3 +1,17 @@
+// 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__
diff --git a/include/TextStream.hpp b/include/TextStream.hpp
index ed1c554..e42e076 100644
--- a/include/TextStream.hpp
+++ b/include/TextStream.hpp
@@ -1,143 +1,157 @@
+// 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
-
-
-// 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.
- */
+#include
+
+
+// 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.
+public:
+ /*! \enum TextMode
+ * \brief Specifies how the file is opened.
*/
- enum TextMode
- {
- Open, //!< The file is opened if it exists.
- Create, //!< 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, //!< All the data currently that is in the file is erased.
- Append //!< 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 TextMode
+ {
+ Open, //!< The file is opened if it exists.
+ Create, //!< 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, //!< All the data currently that is in the file is erased.
+ Append //!< 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.
- };
-
- /*! \brief This constructor opens the file and loads all the lines. */
- TextStream(const std::string& filename, TextMode 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.
- */
- TextMode textMode() const;
-
- bool isOpenForReading() const;
+ 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.
+ };
+
+ /*! \brief This constructor opens the file and loads all the lines. */
+ TextStream(const std::string& filename, TextMode 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.
+ */
+ TextMode textMode() const;
+
+ bool isOpenForReading() const;
bool isOpenForWriting() const;
-private:
+private:
void loadLines();
std::string m_filename;
TextMode m_textmode;
- AccessMode m_accessmode;
-
- std::vector m_lines;
- Uint32 m_currentLine;
+ AccessMode m_accessmode;
+
+ std::vector m_lines;
+ Uint32 m_currentLine;
Uint32 m_startLength;
};
diff --git a/include/WiiBanner.h b/include/WiiBanner.h
deleted file mode 100644
index c38fdf6..0000000
--- a/include/WiiBanner.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef WIIBANNER_H
-#define WIIBANNER_H
-
-
-#include
-#include
-#include
-
-class WiiImage
-{
-public:
- WiiImage();
- WiiImage(Uint32 width, Uint32 height, Uint8* data);
- ~WiiImage();
-
- void setWidth(const Uint32 width);
- Uint32 width() const;
-
- void setHeight(const Uint32 height);
- Uint32 height() const;
-
- void setData(const Uint8* data);
- Uint8* data();
-
- Uint8* toRGBA32();
-
-private:
- Uint32 m_width;
- Uint32 m_height;
- Uint8* m_data;
-};
-
-class WiiBanner
-{
-public:
- enum { NoCopy = 0x00000001, Bounce = 0x00000010, NoCopyBounce = NoCopy | Bounce };
- WiiBanner();
- WiiBanner(Uint32 gameId, const std::string& title, const std::string& subtitle, WiiImage* m_banner, std::vector icons);
- virtual ~WiiBanner();
-
- void setGameID(Uint64 id);
- Uint64 gameID() const;
-
- void setBannerImage(WiiImage* banner);
- WiiImage* bannerImage() const;
-
- void setBannerSize(Uint32 size);
- Uint32 bannerSize() const;
-
- void setTitle(const std::string& title);
- std::string title() const;
-
- void setSubtitle(const std::string& subtitle);
- std::string subtitle() const;
-
- void addIcon(WiiImage* icon);
- void setIcon(Uint32 id, WiiImage* icon);
- WiiImage* getIcon(Uint32 id) const;
- std::vector icons() const;
-
- void setAnimationSpeed(Uint16 animSpeed);
- Uint16 animationSpeed() const;
-
- void setPermissions(Uint8 permissions);
- Uint8 permissions() const;
-
- void setFlags(Uint32 flags);
- Uint32 flags() const;
-protected:
-private:
- Uint64 m_gameId;
- WiiImage* m_banner;
- Uint32 m_animSpeed;
- Uint8 m_permissions;
- Uint32 m_flags;
- Uint32 m_bannerSize;
- std::vector m_icons;
- std::string m_title;
- std::string m_subtitle;
-};
-
-#endif // WIIBANNER_H
diff --git a/include/WiiBanner.hpp b/include/WiiBanner.hpp
index c38fdf6..8d2827c 100644
--- a/include/WiiBanner.hpp
+++ b/include/WiiBanner.hpp
@@ -1,3 +1,17 @@
+// 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 WIIBANNER_H
#define WIIBANNER_H
diff --git a/include/WiiFile.h b/include/WiiFile.h
deleted file mode 100644
index c98b348..0000000
--- a/include/WiiFile.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef WIIFILE_H
-#define WIIFILE_H
-
-#include
-#include