* Added SkywardSword classes

* Added missing readUBytes function in zelda::io::Stream
This commit is contained in:
2013-07-27 18:42:11 -07:00
parent 162d2753dc
commit baf16a6fbd
16 changed files with 357 additions and 5 deletions

View File

@@ -177,6 +177,7 @@ protected:
#define BINARYREADER_BASE \
private: \
typedef zelda::io::BinaryReader base;
#endif // BINARYREADER_BASE
#endif // __BINARYREADER_HPP__

41
include/SSFile.hpp Normal file
View File

@@ -0,0 +1,41 @@
#ifndef __SSFILE_HPP__
#define __SSFILE_HPP__
#include "Types.hpp"
// standard lib
#include <vector>
namespace zelda
{
class SSQuest;
class SSFile
{
public:
enum MagicNumbers
{
USMagic = 0x534F5545,
JAMagic = 0x534F554A,
EUMagic = 0x534F5550
};
SSFile();
SSFile(std::vector<SSQuest*> quests);
~SSFile();
void addQuest(SSQuest* q);
SSQuest* quest(Uint32 id);
std::vector<SSQuest*> questList() const;
void setRegion(Region region);
Region region() const;
private:
Region m_region;
// A vector is a bit overkill
std::vector<SSQuest*> m_quests;
Uint32 m_numQuests;
};
}
#endif // __SSFILE_HPP__

24
include/SSFileReader.hpp Normal file
View File

@@ -0,0 +1,24 @@
#ifndef __SSFILEREADER_HPP__
#define __SSFILEREADER_HPP__
#include "BinaryReader.hpp"
namespace zelda
{
class SSFile;
namespace io
{
class SSFileReader : public BinaryReader
{
BINARYREADER_BASE
public:
SSFileReader(Uint8* data, Uint64 length);
SSFileReader(const std::string& filename);
SSFile* read();
};
} // io
} // zelda
#endif // __SSFILEREADER_HPP__

25
include/SSFileWriter.hpp Normal file
View File

@@ -0,0 +1,25 @@
#ifndef __SSFILEWRITER_HPP__
#define __SSFILEWRITER_HPP__
#include "BinaryWriter.hpp"
namespace zelda
{
class SSFile;
namespace io
{
class SSFileWriter : public BinaryWriter
{
// Why does this fuck up my formatting in Qt Creator?
BINARYWRITER_BASE
public:
SSFileWriter(Uint8* data, Uint64 len);
SSFileWriter(const std::string& filename);
void write(SSFile* file);
};
}
}
#endif // __SSFILEWRITER_HPP__

28
include/SSQuest.hpp Normal file
View File

@@ -0,0 +1,28 @@
#ifndef SSQUEST_HPP
#define SSQUEST_HPP
#include "ZQuestFile.hpp"
namespace zelda
{
// TODO: Handle game specific data
class SSQuest : public ZQuestFile
{
public:
SSQuest(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

View File

@@ -122,6 +122,12 @@ public:
* \throw IOException
*/
virtual Int8 readByte();
/*! \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.
*

View File

@@ -30,6 +30,13 @@ 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
};
} // zelda
#endif