Athena IO Library
ZQuestFile.hpp
1 #ifndef ATHENA_NO_ZQUEST
2 // This file is part of libAthena.
3 //
4 // libAthena is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // libAthena is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with libAthena. If not, see <http://www.gnu.org/licenses/>
16 
17 #ifndef ZQUEST_HPP
18 #define ZQUEST_HPP
19 
20 
21 #include "athena/Global.hpp"
22 #include <string>
23 #include <vector>
24 #include <memory>
25 
26 #define ZQUEST_VERSION_CHECK(major, minor, revision) \
27  (major | (minor << 8) | (revision << 16))
28 
29 namespace athena
30 {
35 {
36 public:
40  static const atUint32 Major;
44  static const atUint32 Minor;
48  static const atUint32 Revision;
52  static const atUint32 Version;
53 
57  static const atUint32 Magic;
58 
63  enum Game
64  {
66  LoZ,
67  AoL,
69  LA,
70  OoT,
72  MM,
73  OoS,
74  OoA,
75  FS,
76  WW,
77  FSA,
78  MC,
79  TP,
80  PH,
81  ST,
82  SS,
83  ALBW,
84  // Add more games here
85 
86  // This must always be last
88  };
89 
93  ZQuestFile();
94 
102  ZQuestFile(Game game, Endian endian, std::unique_ptr<atUint8[]>&& data, atUint32 length, const std::string& gameString = std::string());
103 
108  void setGame(Game game);
109 
114  Game game() const;
115 
120  void setEndian(Endian endian);
121 
126  Endian endian() const;
127 
133  void setData(std::unique_ptr<atUint8[]>&& data, atUint32 length);
134 
139  atUint8* data() const;
140 
145  atUint32 length() const;
146 
147  void setGameString(const std::string& gameString);
152  std::string gameString() const;
153 
154  static const std::vector<std::string> gameStringList();
155 protected:
156  Game m_game;
157  std::string m_gameString;
158  Endian m_endian;
159  std::unique_ptr<atUint8[]> m_data;
160  atUint32 m_length;
161 
162  // Game strings support
163 };
164 } // zelda
165 
166 #endif // ZQUEST_HPP
167 #endif // ATHENA_NO_ZQUEST
A Link Between Worlds.
Definition: ZQuestFile.hpp:83
static const atUint32 Minor
The current minor version of the ZQuest format.
Definition: ZQuestFile.hpp:44
void setData(std::unique_ptr< atUint8[]> &&data, atUint32 length)
setData
Game
The list of games currently supported by ZQuest.
Definition: ZQuestFile.hpp:63
void setGame(Game game)
setGame
ZQuestFile is an export format for save data.
Definition: ZQuestFile.hpp:34
Spirit Tracks.
Definition: ZQuestFile.hpp:81
Phantom Hourglass.
Definition: ZQuestFile.hpp:80
std::string gameString() const
gameString
Legend of Zelda.
Definition: ZQuestFile.hpp:66
A Link to the Past.
Definition: ZQuestFile.hpp:68
Twilight Princess.
Definition: ZQuestFile.hpp:79
static const atUint32 Major
The current major version of the ZQuest format.
Definition: ZQuestFile.hpp:40
Skyward Sword.
Definition: ZQuestFile.hpp:82
static const atUint32 Magic
The magic number used to identify the file e.g. "ZQS1".
Definition: ZQuestFile.hpp:57
static const atUint32 Revision
The current revision of the ZQuest format.
Definition: ZQuestFile.hpp:48
Ocarina of Time 3D.
Definition: ZQuestFile.hpp:71
Endian endian() const
endian
ZQuestFile()
ZQuest.
Links Awakening.
Definition: ZQuestFile.hpp:69
Ocarin of Time.
Definition: ZQuestFile.hpp:70
static const atUint32 Version
The current version of the ZQuest format.
Definition: ZQuestFile.hpp:52
atUint8 * data() const
data
Adventure of Link.
Definition: ZQuestFile.hpp:67
Oracle of Ages.
Definition: ZQuestFile.hpp:74
Total number of supported games.
Definition: ZQuestFile.hpp:87
Oracle of Season.
Definition: ZQuestFile.hpp:73
Game game() const
game
Four Swords Adventures.
Definition: ZQuestFile.hpp:77
None or Unsupported.
Definition: ZQuestFile.hpp:65
void setEndian(Endian endian)
setEndian
Majora&#39;s Mask.
Definition: ZQuestFile.hpp:72
atUint32 length() const
length