* Remove *.autosave

This commit is contained in:
Antidote 2014-04-20 02:24:23 -07:00 committed by Phillip Stephens
parent ec4167abca
commit 0429eb57b8
8 changed files with 1 additions and 1531 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
# File types
**/*.o
**/*.a
**/*.autosave
**/*.zip
**/*.html
**/*.tar

View File

@ -1,113 +0,0 @@
// 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 <http://www.gnu.org/licenses/>
#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__

View File

@ -1,91 +0,0 @@
// 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 <http://www.gnu.org/licenses/>
#ifndef __ALTTP_FILE_HPP__
#define __ALTTP_FILE_HPP__
#include "Athena/Types.hpp"
#include <vector>
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<ALTTPQuest*>::iterator QuestIter;
/*! \brief Default constructor
*
*
*/
ALTTPFile();
/*! \brief Constructor
*
* \param questList The primary quest list
* \param backupList The backup quest list
*/
ALTTPFile(std::vector<ALTTPQuest*> questList, std::vector<ALTTPQuest*> 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<ALTTPQuest*> 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<ALTTPQuest*> m_quests;
std::vector<ALTTPQuest*> m_backup;
};
} // zelda
#endif // __ALTTP_FILE_HPP__

View File

@ -1,68 +0,0 @@
// 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 <http://www.gnu.org/licenses/>
#ifndef __ALTTP_FILE_READER_HPP__
#define __ALTTP_FILE_READER_HPP__
#include <string>
#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__

View File

@ -1,70 +0,0 @@
// 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 <http://www.gnu.org/licenses/>
#ifndef __ALTTP_FILE_WRITER_HPP__
#define __ALTTP_FILE_WRITER_HPP__
#include <string>
#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__

View File

@ -1,685 +0,0 @@
// 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 <http://www.gnu.org/licenses/>
#ifndef __ALTTP_QUEST_HPP__
#define __ALTTP_QUEST_HPP__
#include "Types.hpp"
#include <string>
#include <vector>
#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<ALTTPRoomFlags*> flags);
/*!
* \brief setRoomFlags
* \param rf
* \param id
*/
void setRoomFlags(ALTTPRoomFlags* rf, Uint32 id);
/*!
* \brief roomFlags
* \return
*/
std::vector<ALTTPRoomFlags*> roomFlags();
/*!
* \brief roomFlags
* \param id
* \return
*/
ALTTPRoomFlags* roomFlags(Uint32 id);
/*!
* \brief setOverworldEvents
* \param events
*/
void setOverworldEvents(std::vector<ALTTPOverworldEvent*> events);
/*!
* \brief setOverworldEvents
* \param ow
* \param id
*/
void setOverworldEvents(ALTTPOverworldEvent* ow, Uint32 id);
/*!
* \brief overworldEvents
* \return
*/
std::vector<ALTTPOverworldEvent*> 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<Uint8> 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<Uint8> 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<Uint8> 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<Uint16> playerName);
/*!
* \brief setPlayerName
* \param playerName
*/
void setPlayerName(const std::string& playerName);
/*!
* \brief playerName
* \return
*/
std::vector<Uint16> 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<Uint16> 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<ALTTPRoomFlags*> m_roomFlags;
std::vector<ALTTPOverworldEvent*> 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<Uint8> 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<Uint8> m_oldManFlags;
Uint8 m_bombFlag;
std::vector<Uint8> m_unknown1;
std::vector<Uint16> m_playerName;
Uint16 m_valid;
std::vector<Uint16> m_dungeonDeathTotals;
Uint16 m_unknown2;
Uint16 m_deathSaveCount;
Int16 m_postGameDeathCounter;
Uint16 m_checksum;
};
} // zelda
#endif // __ALTTP_QUEST_HPP__

View File

@ -1,203 +0,0 @@
// 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 <http://www.gnu.org/licenses/>
#ifndef __ALTTP_STRUCTS_HPP__
#define __ALTTP_STRUCTS_HPP__
#ifndef __DOXYGEN_IGNORE__
#include <string>
#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__

View File

@ -1,301 +0,0 @@
// 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 <http://www.gnu.org/licenses/>
#ifndef __BINARYREADER_HPP__
#define __BINARYREADER_HPP__
#include "Stream.hpp"
#include <string>
#include <functional>
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<void(int)> 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.<br />
* 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.<br />
* <b>BEWARE:</b> As this deletes the current buffer it WILL cause a loss of data
* if that was not the intent.<br />
* Once you pass the data to setData <b>DO NOT</b> 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.<br />
* 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.<br />
* However once you pass the data to setData <b>DO NOT</b> 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<void(int)> 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<void(int)> m_progressCallback;
};
} // io
} // Athena
#ifndef BINARYREADER_BASE
#define BINARYREADER_BASE \
private: \
typedef Athena::io::BinaryReader base;
#endif // BINARYREADER_BASE
#endif // __BINARYREADER_HPP__