mirror of
https://github.com/libAthena/athena.git
synced 2025-12-08 13:15:05 +00:00
Use standard integer types
This commit is contained in:
@@ -4,31 +4,31 @@
|
||||
|
||||
class LZBase {
|
||||
public:
|
||||
explicit LZBase(atInt32 minimumOffset = 1, atInt32 slidingWindow = 4096, atInt32 minimumMatch = 3,
|
||||
atInt32 blockSize = 8);
|
||||
explicit LZBase(int32_t minimumOffset = 1, int32_t slidingWindow = 4096, int32_t minimumMatch = 3,
|
||||
int32_t blockSize = 8);
|
||||
virtual ~LZBase();
|
||||
|
||||
virtual atUint32 compress(const atUint8* src, atUint8** dest, atUint32 srcLength) = 0;
|
||||
virtual atUint32 decompress(const atUint8* src, atUint8** dest, atUint32 srcLength) = 0;
|
||||
virtual uint32_t compress(const uint8_t* src, uint8_t** dest, uint32_t srcLength) = 0;
|
||||
virtual uint32_t decompress(const uint8_t* src, uint8_t** dest, uint32_t srcLength) = 0;
|
||||
|
||||
void setSlidingWindow(atInt32 SlidingWindow);
|
||||
atInt32 slidingWindow() const;
|
||||
void setReadAheadBuffer(atInt32 ReadAheadBuffer);
|
||||
atInt32 readAheadBuffer() const;
|
||||
void setMinMatch(atInt32 minimumMatch);
|
||||
atInt32 minMatch() const;
|
||||
void setBlockSize(atInt32 BlockSize);
|
||||
atInt32 blockSize() const;
|
||||
void setMinimumOffset(atUint32 minimumOffset);
|
||||
atUint32 minimumOffset() const;
|
||||
void setSlidingWindow(int32_t SlidingWindow);
|
||||
int32_t slidingWindow() const;
|
||||
void setReadAheadBuffer(int32_t ReadAheadBuffer);
|
||||
int32_t readAheadBuffer() const;
|
||||
void setMinMatch(int32_t minimumMatch);
|
||||
int32_t minMatch() const;
|
||||
void setBlockSize(int32_t BlockSize);
|
||||
int32_t blockSize() const;
|
||||
void setMinimumOffset(uint32_t minimumOffset);
|
||||
uint32_t minimumOffset() const;
|
||||
|
||||
protected:
|
||||
LZLengthOffset search(const atUint8* posPtr, const atUint8* dataBegin, const atUint8* dataEnd) const;
|
||||
LZLengthOffset search(const uint8_t* posPtr, const uint8_t* dataBegin, const uint8_t* dataEnd) const;
|
||||
|
||||
atInt32 m_slidingWindow;
|
||||
atInt32 m_readAheadBuffer;
|
||||
atInt32 m_minMatch; // Minimum number of bytes that have to matched to go through with compression
|
||||
atInt32 m_blockSize;
|
||||
atUint32 m_minOffset;
|
||||
int32_t m_slidingWindow;
|
||||
int32_t m_readAheadBuffer;
|
||||
int32_t m_minMatch; // Minimum number of bytes that have to matched to go through with compression
|
||||
int32_t m_blockSize;
|
||||
uint32_t m_minOffset;
|
||||
LZLookupTable m_lookupTable;
|
||||
};
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include <athena/Types.hpp>
|
||||
|
||||
struct LZLengthOffset {
|
||||
atUint32 length; // The number of bytes compressed
|
||||
atUint16 offset; // How far back in sliding window where bytes that match the lookAheadBuffer is located
|
||||
uint32_t length; // The number of bytes compressed
|
||||
uint16_t offset; // How far back in sliding window where bytes that match the lookAheadBuffer is located
|
||||
bool operator==(const LZLengthOffset& lo_pair) const { return length == lo_pair.length && offset == lo_pair.offset; }
|
||||
bool operator!=(const LZLengthOffset& lo_pair) const { return !operator==(lo_pair); }
|
||||
};
|
||||
@@ -15,16 +15,16 @@ struct LZLengthOffset {
|
||||
class LZLookupTable {
|
||||
public:
|
||||
LZLookupTable();
|
||||
explicit LZLookupTable(atInt32 minimumMatch, atInt32 slidingWindow = 4096, atInt32 lookAheadWindow = 18);
|
||||
explicit LZLookupTable(int32_t minimumMatch, int32_t slidingWindow = 4096, int32_t lookAheadWindow = 18);
|
||||
~LZLookupTable();
|
||||
LZLengthOffset search(const atUint8* curPos, const atUint8* dataBegin, const atUint8* dataEnd);
|
||||
void setLookAheadWindow(atInt32 lookAheadWindow);
|
||||
LZLengthOffset search(const uint8_t* curPos, const uint8_t* dataBegin, const uint8_t* dataEnd);
|
||||
void setLookAheadWindow(int32_t lookAheadWindow);
|
||||
|
||||
private:
|
||||
using LookupTable = std::multimap<std::vector<uint8_t>, int32_t>;
|
||||
LookupTable table;
|
||||
atInt32 m_minimumMatch = 3;
|
||||
atInt32 m_slidingWindow = 4096;
|
||||
atInt32 m_lookAheadWindow = 18;
|
||||
int32_t m_minimumMatch = 3;
|
||||
int32_t m_slidingWindow = 4096;
|
||||
int32_t m_lookAheadWindow = 18;
|
||||
std::vector<uint8_t> m_buffer;
|
||||
};
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
class LZType10 : public LZBase {
|
||||
public:
|
||||
explicit LZType10(atInt32 minimumOffset = 1, atInt32 SlidingWindow = 4096, atInt32 MinimumMatch = 3,
|
||||
atInt32 BlockSize = 8);
|
||||
atUint32 compress(const atUint8* src, atUint8** dstBuf, atUint32 srcLength) override;
|
||||
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLen) override;
|
||||
explicit LZType10(int32_t minimumOffset = 1, int32_t SlidingWindow = 4096, int32_t MinimumMatch = 3,
|
||||
int32_t BlockSize = 8);
|
||||
uint32_t compress(const uint8_t* src, uint8_t** dstBuf, uint32_t srcLength) override;
|
||||
uint32_t decompress(const uint8_t* src, uint8_t** dst, uint32_t srcLen) override;
|
||||
};
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
class LZType11 : public LZBase {
|
||||
public:
|
||||
explicit LZType11(atInt32 MinimumOffset = 1, atInt32 SlidingWindow = 4096, atInt32 MinimumMatch = 3,
|
||||
atInt32 BlockSize = 8);
|
||||
atUint32 compress(const atUint8* src, atUint8** dst, atUint32 srcLength) override;
|
||||
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLength) override;
|
||||
explicit LZType11(int32_t MinimumOffset = 1, int32_t SlidingWindow = 4096, int32_t MinimumMatch = 3,
|
||||
int32_t BlockSize = 8);
|
||||
uint32_t compress(const uint8_t* src, uint8_t** dst, uint32_t srcLength) override;
|
||||
uint32_t decompress(const uint8_t* src, uint8_t** dst, uint32_t srcLength) override;
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
* \param val The new quest to assign to the given index
|
||||
* \throw InvalidOperationException on index out of range
|
||||
*/
|
||||
void setQuest(atUint32 id, ALTTPQuest* val);
|
||||
void setQuest(uint32_t id, ALTTPQuest* val);
|
||||
/*! \brief Returns the primary quest list
|
||||
*
|
||||
* \return The primary quest list
|
||||
@@ -54,13 +54,13 @@ public:
|
||||
* \return ALTTPQuest*
|
||||
* \throw InvalidOperationException on index out of range
|
||||
*/
|
||||
ALTTPQuest* quest(atUint32 id) const;
|
||||
ALTTPQuest* quest(uint32_t id) const;
|
||||
|
||||
/*! \brief Returns the number of primary quests
|
||||
*
|
||||
* \return The number of quests
|
||||
*/
|
||||
atUint32 questCount() const;
|
||||
uint32_t questCount() const;
|
||||
|
||||
private:
|
||||
std::vector<ALTTPQuest*> m_quests;
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
* \param data The existing buffer
|
||||
* \param length The length of the existing buffer
|
||||
*/
|
||||
ALTTPFileReader(atUint8*, atUint64);
|
||||
ALTTPFileReader(uint8_t*, uint64_t);
|
||||
|
||||
/*! \brief This constructor creates an instance from a file on disk.
|
||||
*
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
* \param data The existing buffer
|
||||
* \param length The length of the existing buffer
|
||||
*/
|
||||
ALTTPFileWriter(atUint8*, atUint64);
|
||||
ALTTPFileWriter(uint8_t*, uint64_t);
|
||||
|
||||
/*! \brief This constructor creates an instance from a file on disk.
|
||||
*
|
||||
@@ -40,7 +40,7 @@ private:
|
||||
void writeRoomFlags(ALTTPRoomFlags*);
|
||||
void writeOverworldEvent(ALTTPOverworldEvent*);
|
||||
void writeDungeonItems(ALTTPDungeonItemFlags);
|
||||
atUint16 calculateChecksum(atUint32 game);
|
||||
uint16_t calculateChecksum(uint32_t game);
|
||||
};
|
||||
|
||||
} // namespace io
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
* \param rf
|
||||
* \param id
|
||||
*/
|
||||
void setRoomFlags(ALTTPRoomFlags* rf, atUint32 id);
|
||||
void setRoomFlags(ALTTPRoomFlags* rf, uint32_t id);
|
||||
|
||||
/*!
|
||||
* \brief roomFlags
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
* \param id
|
||||
* \return
|
||||
*/
|
||||
ALTTPRoomFlags* roomFlags(atUint32 id);
|
||||
ALTTPRoomFlags* roomFlags(uint32_t id);
|
||||
|
||||
/*!
|
||||
* \brief setOverworldEvents
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
* \param ow
|
||||
* \param id
|
||||
*/
|
||||
void setOverworldEvents(ALTTPOverworldEvent* ow, atUint32 id);
|
||||
void setOverworldEvents(ALTTPOverworldEvent* ow, uint32_t id);
|
||||
|
||||
/*!
|
||||
* \brief overworldEvents
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
* \param id
|
||||
* \return
|
||||
*/
|
||||
ALTTPOverworldEvent* overworldEvent(atUint32 id) const;
|
||||
ALTTPOverworldEvent* overworldEvent(uint32_t id) const;
|
||||
|
||||
/*!
|
||||
* \brief setInventory
|
||||
@@ -90,25 +90,25 @@ public:
|
||||
* \brief setRupeeMax
|
||||
* \param val
|
||||
*/
|
||||
void setRupeeMax(atUint16 val);
|
||||
void setRupeeMax(uint16_t val);
|
||||
|
||||
/*!
|
||||
* \brief rupeeMax
|
||||
* \return
|
||||
*/
|
||||
atUint16 rupeeMax() const;
|
||||
uint16_t rupeeMax() const;
|
||||
|
||||
/*!
|
||||
* \brief setRupeeCurrent
|
||||
* \param val
|
||||
*/
|
||||
void setRupeeCurrent(atUint16 val);
|
||||
void setRupeeCurrent(uint16_t val);
|
||||
|
||||
/*!
|
||||
* \brief rupeeCurrent
|
||||
* \return
|
||||
*/
|
||||
atUint16 rupeeCurrent() const;
|
||||
uint16_t rupeeCurrent() const;
|
||||
|
||||
/*!
|
||||
* \brief setCompasses
|
||||
@@ -150,109 +150,109 @@ public:
|
||||
* \brief setWishingPond
|
||||
* \param val
|
||||
*/
|
||||
void setWishingPond(atUint16 val);
|
||||
void setWishingPond(uint16_t val);
|
||||
|
||||
/*!
|
||||
* \brief wishingPond
|
||||
* \return
|
||||
*/
|
||||
atUint16 wishingPond() const;
|
||||
uint16_t wishingPond() const;
|
||||
|
||||
/*!
|
||||
* \brief setHealthMax
|
||||
* \param val
|
||||
*/
|
||||
void setHealthMax(atUint8 val);
|
||||
void setHealthMax(uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief healthMax
|
||||
* \return
|
||||
*/
|
||||
atUint8 healthMax() const;
|
||||
uint8_t healthMax() const;
|
||||
|
||||
/*!
|
||||
* \brief setHealth
|
||||
* \param val
|
||||
*/
|
||||
void setHealth(atUint8 val);
|
||||
void setHealth(uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief health
|
||||
* \return
|
||||
*/
|
||||
atUint8 health() const;
|
||||
uint8_t health() const;
|
||||
|
||||
/*!
|
||||
* \brief setMagicPower
|
||||
* \param val
|
||||
*/
|
||||
void setMagicPower(atUint8 val);
|
||||
void setMagicPower(uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief magicPower
|
||||
* \return
|
||||
*/
|
||||
atUint8 magicPower() const;
|
||||
uint8_t magicPower() const;
|
||||
|
||||
/*!
|
||||
* \brief setKeys
|
||||
* \param val
|
||||
*/
|
||||
void setKeys(atUint8 val);
|
||||
void setKeys(uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief keys
|
||||
* \return
|
||||
*/
|
||||
atUint8 keys() const;
|
||||
uint8_t keys() const;
|
||||
|
||||
/*!
|
||||
* \brief setBombUpgrades
|
||||
* \param val
|
||||
*/
|
||||
void setBombUpgrades(atUint8 val);
|
||||
void setBombUpgrades(uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief bombUpgrades
|
||||
* \return
|
||||
*/
|
||||
atUint8 bombUpgrades() const;
|
||||
uint8_t bombUpgrades() const;
|
||||
|
||||
/*!
|
||||
* \brief setArrowUpgrades
|
||||
* \param val
|
||||
*/
|
||||
void setArrowUpgrades(atUint8 val);
|
||||
void setArrowUpgrades(uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief arrowUpgrades
|
||||
* \return
|
||||
*/
|
||||
atUint8 arrowUpgrades() const;
|
||||
uint8_t arrowUpgrades() const;
|
||||
|
||||
/*!
|
||||
* \brief setHealthFiller
|
||||
* \param val
|
||||
*/
|
||||
void setHealthFiller(atUint8 val);
|
||||
void setHealthFiller(uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief healthFiller
|
||||
* \return
|
||||
*/
|
||||
atUint8 healthFiller() const;
|
||||
uint8_t healthFiller() const;
|
||||
|
||||
/*!
|
||||
* \brief setMagicFiller
|
||||
* \param val
|
||||
*/
|
||||
void setMagicFiller(atUint8 val);
|
||||
void setMagicFiller(uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief magicFiller
|
||||
* \return
|
||||
*/
|
||||
atUint8 magicFiller() const;
|
||||
uint8_t magicFiller() const;
|
||||
|
||||
/*!
|
||||
* \brief setPendants
|
||||
@@ -270,37 +270,37 @@ public:
|
||||
* \brief setBombFiller
|
||||
* \param val
|
||||
*/
|
||||
void setBombFiller(atUint8 val);
|
||||
void setBombFiller(uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief bombFiller
|
||||
* \return
|
||||
*/
|
||||
atUint8 bombFiller() const;
|
||||
uint8_t bombFiller() const;
|
||||
|
||||
/*!
|
||||
* \brief setArrowFiller
|
||||
* \param val
|
||||
*/
|
||||
void setArrowFiller(atUint8 val);
|
||||
void setArrowFiller(uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief arrowFiller
|
||||
* \return
|
||||
*/
|
||||
atUint8 arrowFiller() const;
|
||||
uint8_t arrowFiller() const;
|
||||
|
||||
/*!
|
||||
* \brief setArrows
|
||||
* \param val
|
||||
*/
|
||||
void setArrows(atUint8 val);
|
||||
void setArrows(uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief arrows
|
||||
* \return
|
||||
*/
|
||||
atUint8 arrows() const;
|
||||
uint8_t arrows() const;
|
||||
|
||||
/*!
|
||||
* \brief setAbilityFlags
|
||||
@@ -342,27 +342,27 @@ public:
|
||||
* \brief setDungeonKeys
|
||||
* \param val
|
||||
*/
|
||||
void setDungeonKeys(std::vector<atUint8> val);
|
||||
void setDungeonKeys(std::vector<uint8_t> val);
|
||||
|
||||
/*!
|
||||
* \brief setDungeonKeys
|
||||
* \param id
|
||||
* \param val
|
||||
*/
|
||||
void setDungeonKeys(atUint32 id, atUint8 val);
|
||||
void setDungeonKeys(uint32_t id, uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief dungeonKeys
|
||||
* \param id
|
||||
* \return
|
||||
*/
|
||||
atUint8 dungeonKeys(atUint32 id) const;
|
||||
uint8_t dungeonKeys(uint32_t id) const;
|
||||
|
||||
/*!
|
||||
* \brief dungeonCount
|
||||
* \return
|
||||
*/
|
||||
atUint32 dungeonCount() const;
|
||||
uint32_t dungeonCount() const;
|
||||
|
||||
/*!
|
||||
* \brief setProgressIndicator
|
||||
@@ -452,71 +452,71 @@ public:
|
||||
* \brief setOldManFlags
|
||||
* \param flags
|
||||
*/
|
||||
void setOldManFlags(std::vector<atUint8> flags);
|
||||
void setOldManFlags(std::vector<uint8_t> flags);
|
||||
|
||||
/*!
|
||||
* \brief setOldManFlag
|
||||
* \param id
|
||||
* \param val
|
||||
*/
|
||||
void setOldManFlag(atUint32 id, atUint8 val);
|
||||
void setOldManFlag(uint32_t id, uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief oldManFlag
|
||||
* \param id
|
||||
* \return
|
||||
*/
|
||||
atUint8 oldManFlag(atUint32 id);
|
||||
uint8_t oldManFlag(uint32_t id);
|
||||
|
||||
/*!
|
||||
* \brief oldManFlagCount
|
||||
* \return
|
||||
*/
|
||||
atUint32 oldManFlagCount() const;
|
||||
uint32_t oldManFlagCount() const;
|
||||
|
||||
/*!
|
||||
* \brief setBombFlag
|
||||
* \param flag
|
||||
*/
|
||||
void setBombFlag(atUint8 flag);
|
||||
void setBombFlag(uint8_t flag);
|
||||
|
||||
/*!
|
||||
* \brief bombFlag
|
||||
* \return
|
||||
*/
|
||||
atUint8 bombFlag() const;
|
||||
uint8_t bombFlag() const;
|
||||
|
||||
/*!
|
||||
* \brief setUnknown1
|
||||
* \param flags
|
||||
*/
|
||||
void setUnknown1(std::vector<atUint8> flags);
|
||||
void setUnknown1(std::vector<uint8_t> flags);
|
||||
|
||||
/*!
|
||||
* \brief setUnknown1
|
||||
* \param id
|
||||
* \param val
|
||||
*/
|
||||
void setUnknown1(atUint32 id, atUint8 val);
|
||||
void setUnknown1(uint32_t id, uint8_t val);
|
||||
|
||||
/*!
|
||||
* \brief unknown1
|
||||
* \param id
|
||||
* \return
|
||||
*/
|
||||
atUint8 unknown1(atUint32 id);
|
||||
uint8_t unknown1(uint32_t id);
|
||||
|
||||
/*!
|
||||
* \brief unknown1Count
|
||||
* \return
|
||||
*/
|
||||
atUint32 unknown1Count() const;
|
||||
uint32_t unknown1Count() const;
|
||||
|
||||
/*!
|
||||
* \brief setPlayerName
|
||||
* \param playerName
|
||||
*/
|
||||
void setPlayerName(std::vector<atUint16> playerName);
|
||||
void setPlayerName(std::vector<uint16_t> playerName);
|
||||
/*!
|
||||
* \brief setPlayerName
|
||||
* \param playerName
|
||||
@@ -526,7 +526,7 @@ public:
|
||||
* \brief playerName
|
||||
* \return
|
||||
*/
|
||||
std::vector<atUint16> playerName() const;
|
||||
std::vector<uint16_t> playerName() const;
|
||||
/*!
|
||||
* \brief playerNameToString
|
||||
* \return
|
||||
@@ -549,102 +549,102 @@ public:
|
||||
* \brief setDungeonDeathTotals
|
||||
* \param val
|
||||
*/
|
||||
void setDungeonDeathTotals(std::vector<atUint16> val);
|
||||
void setDungeonDeathTotals(std::vector<uint16_t> val);
|
||||
|
||||
/*!
|
||||
* \brief setDungeonDeathTotal
|
||||
* \param id
|
||||
* \param val
|
||||
*/
|
||||
void setDungeonDeathTotal(atUint32 id, atUint16 val);
|
||||
void setDungeonDeathTotal(uint32_t id, uint16_t val);
|
||||
|
||||
/*!
|
||||
* \brief dungeonDeathTotal
|
||||
* \param id
|
||||
* \return
|
||||
*/
|
||||
atUint16 dungeonDeathTotal(atUint32 id) const;
|
||||
uint16_t dungeonDeathTotal(uint32_t id) const;
|
||||
|
||||
/*!
|
||||
* \brief dungeonDeathTotalCount
|
||||
* \return
|
||||
*/
|
||||
atUint16 dungeonDeathTotalCount() const;
|
||||
uint16_t dungeonDeathTotalCount() const;
|
||||
|
||||
/*!
|
||||
* \brief setUnknown2
|
||||
* \param val
|
||||
*/
|
||||
void setUnknown2(atUint16 val);
|
||||
void setUnknown2(uint16_t val);
|
||||
|
||||
/*!
|
||||
* \brief unknown2
|
||||
* \return
|
||||
*/
|
||||
atUint16 unknown2() const;
|
||||
uint16_t unknown2() const;
|
||||
|
||||
/*!
|
||||
* \brief setDeathSaveCount
|
||||
* \param val
|
||||
*/
|
||||
void setDeathSaveCount(atUint16 val);
|
||||
void setDeathSaveCount(uint16_t val);
|
||||
|
||||
/*!
|
||||
* \brief deathSaveCount
|
||||
* \return
|
||||
*/
|
||||
atUint16 deathSaveCount() const;
|
||||
uint16_t deathSaveCount() const;
|
||||
|
||||
/*!
|
||||
* \brief setPostGameDeathCounter
|
||||
* \param val
|
||||
*/
|
||||
void setPostGameDeathCounter(atInt16 val);
|
||||
void setPostGameDeathCounter(int16_t val);
|
||||
|
||||
/*!
|
||||
* \brief postGameDeathCounter
|
||||
* \return
|
||||
*/
|
||||
atInt16 postGameDeathCounter() const;
|
||||
int16_t postGameDeathCounter() const;
|
||||
|
||||
/*!
|
||||
* \brief setChecksum
|
||||
* \param checksum
|
||||
*/
|
||||
void setChecksum(atUint16 checksum);
|
||||
void setChecksum(uint16_t checksum);
|
||||
|
||||
/*!
|
||||
* \brief checksum
|
||||
* \return
|
||||
*/
|
||||
atUint16 checksum() const;
|
||||
uint16_t checksum() const;
|
||||
|
||||
private:
|
||||
std::vector<ALTTPRoomFlags*> m_roomFlags;
|
||||
std::vector<ALTTPOverworldEvent*> m_overworldEvents;
|
||||
ALTTPInventory m_inventory;
|
||||
atUint16 m_rupeeMax;
|
||||
atUint16 m_rupeeCurrent;
|
||||
uint16_t m_rupeeMax;
|
||||
uint16_t m_rupeeCurrent;
|
||||
ALTTPDungeonItemFlags m_compasses;
|
||||
ALTTPDungeonItemFlags m_bigKeys;
|
||||
ALTTPDungeonItemFlags m_dungeonMaps;
|
||||
atUint16 m_wishingPond;
|
||||
atUint8 m_healthMax;
|
||||
atUint8 m_health;
|
||||
atUint8 m_magicPower;
|
||||
atUint8 m_keys;
|
||||
atUint8 m_bombUpgrades;
|
||||
atUint8 m_arrowUpgrades;
|
||||
atUint8 m_heartFiller;
|
||||
atUint8 m_magicFiller;
|
||||
uint16_t m_wishingPond;
|
||||
uint8_t m_healthMax;
|
||||
uint8_t m_health;
|
||||
uint8_t m_magicPower;
|
||||
uint8_t m_keys;
|
||||
uint8_t m_bombUpgrades;
|
||||
uint8_t m_arrowUpgrades;
|
||||
uint8_t m_heartFiller;
|
||||
uint8_t m_magicFiller;
|
||||
ALTTPPendants m_pendants;
|
||||
atUint8 m_bombFiller;
|
||||
atUint8 m_arrowFiller;
|
||||
atUint8 m_arrows;
|
||||
uint8_t m_bombFiller;
|
||||
uint8_t m_arrowFiller;
|
||||
uint8_t m_arrows;
|
||||
ALTTPAbilities m_abilityFlags;
|
||||
ALTTPCrystals m_crystals;
|
||||
ALTTPMagicUsage m_magicUsage;
|
||||
std::vector<atUint8> m_dungeonKeys;
|
||||
std::vector<uint8_t> m_dungeonKeys;
|
||||
ALTTPProgressIndicator m_progressIndicator;
|
||||
ALTTPProgressFlags1 m_progressFlags1;
|
||||
ALTTPMapIcon m_mapIcon;
|
||||
@@ -652,16 +652,16 @@ private:
|
||||
ALTTPProgressFlags2 m_progressFlags2;
|
||||
ALTTPLightDarkWorldIndicator m_lightDarkWorldIndicator;
|
||||
ALTTPTagAlong m_tagAlong;
|
||||
std::vector<atUint8> m_oldManFlags;
|
||||
atUint8 m_bombFlag;
|
||||
std::vector<atUint8> m_unknown1;
|
||||
std::vector<atUint16> m_playerName;
|
||||
std::vector<uint8_t> m_oldManFlags;
|
||||
uint8_t m_bombFlag;
|
||||
std::vector<uint8_t> m_unknown1;
|
||||
std::vector<uint16_t> m_playerName;
|
||||
bool m_valid;
|
||||
std::vector<atUint16> m_dungeonDeathTotals;
|
||||
atUint16 m_unknown2;
|
||||
atUint16 m_deathSaveCount;
|
||||
atInt16 m_postGameDeathCounter;
|
||||
atUint16 m_checksum;
|
||||
std::vector<uint16_t> m_dungeonDeathTotals;
|
||||
uint16_t m_unknown2;
|
||||
uint16_t m_deathSaveCount;
|
||||
int16_t m_postGameDeathCounter;
|
||||
uint16_t m_checksum;
|
||||
};
|
||||
|
||||
} // namespace athena
|
||||
|
||||
@@ -92,7 +92,7 @@ struct ALTTPDungeonItemFlags {
|
||||
bool IcePalace : 1;
|
||||
bool SkullWoods : 1;
|
||||
};
|
||||
atUint8 flags1;
|
||||
uint8_t flags1;
|
||||
};
|
||||
|
||||
union {
|
||||
@@ -106,7 +106,7 @@ struct ALTTPDungeonItemFlags {
|
||||
bool HyruleCastle : 1; // unused exist in original game
|
||||
bool SewerPassage : 1; // unused exist in original game
|
||||
};
|
||||
atUint8 flags2;
|
||||
uint8_t flags2;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
#include "athena/Types.hpp"
|
||||
|
||||
namespace athena::checksums {
|
||||
atUint64 crc64(const atUint8* data, atUint64 length, atUint64 seed = 0xFFFFFFFFFFFFFFFF,
|
||||
atUint64 final = 0xFFFFFFFFFFFFFFFF);
|
||||
atUint32 crc32(const atUint8* data, atUint64 length, atUint32 seed = 0xFFFFFFFF, atUint32 final = 0xFFFFFFFF);
|
||||
atUint16 crc16CCITT(const atUint8* data, atUint64 length, atUint16 seed = 0xFFFF, atUint16 final = 0);
|
||||
atUint16 crc16(const atUint8* data, atUint64 length, atUint16 seed = 0, atUint16 final = 0);
|
||||
uint64_t crc64(const uint8_t* data, uint64_t length, uint64_t seed = 0xFFFFFFFFFFFFFFFF,
|
||||
uint64_t final = 0xFFFFFFFFFFFFFFFF);
|
||||
uint32_t crc32(const uint8_t* data, uint64_t length, uint32_t seed = 0xFFFFFFFF, uint32_t final = 0xFFFFFFFF);
|
||||
uint16_t crc16CCITT(const uint8_t* data, uint64_t length, uint16_t seed = 0xFFFF, uint16_t final = 0);
|
||||
uint16_t crc16(const uint8_t* data, uint64_t length, uint16_t seed = 0, uint16_t final = 0);
|
||||
} // namespace athena::checksums
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
namespace athena::io::Compression {
|
||||
// Zlib compression
|
||||
atInt32 decompressZlib(const atUint8* src, atUint32 srcLen, atUint8* dst, atUint32 dstLen);
|
||||
atInt32 compressZlib(const atUint8* src, atUint32 srcLen, atUint8* dst, atUint32 dstLen);
|
||||
int32_t decompressZlib(const uint8_t* src, uint32_t srcLen, uint8_t* dst, uint32_t dstLen);
|
||||
int32_t compressZlib(const uint8_t* src, uint32_t srcLen, uint8_t* dst, uint32_t dstLen);
|
||||
|
||||
#if AT_LZOKAY
|
||||
// lzo compression
|
||||
@@ -13,9 +13,9 @@ atInt32 decompressLZO(const atUint8* source, atInt32 sourceSize, atUint8* dst, a
|
||||
#endif
|
||||
|
||||
// Yaz0 encoding
|
||||
atUint32 yaz0Decode(const atUint8* src, atUint8* dst, atUint32 uncompressedSize);
|
||||
atUint32 yaz0Encode(const atUint8* src, atUint32 srcSize, atUint8* data);
|
||||
uint32_t yaz0Decode(const uint8_t* src, uint8_t* dst, uint32_t uncompressedSize);
|
||||
uint32_t yaz0Encode(const uint8_t* src, uint32_t srcSize, uint8_t* data);
|
||||
|
||||
atUint32 decompressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst);
|
||||
atUint32 compressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst, bool extended = false);
|
||||
uint32_t decompressLZ77(const uint8_t* src, uint32_t srcLen, uint8_t** dst);
|
||||
uint32_t compressLZ77(const uint8_t* src, uint32_t srcLen, uint8_t** dst, bool extended = false);
|
||||
} // namespace athena::io::Compression
|
||||
|
||||
@@ -24,8 +24,8 @@ public:
|
||||
std::string extension() const;
|
||||
static std::string extension(std::string_view path) { return FileInfo(path).extension(); }
|
||||
|
||||
atUint64 size() const;
|
||||
static atUint64 size(std::string_view path) { return FileInfo(path).size(); }
|
||||
uint64_t size() const;
|
||||
static uint64_t size(std::string_view path) { return FileInfo(path).size(); }
|
||||
|
||||
bool exists() const;
|
||||
static bool exists(std::string_view path) { return FileInfo(path).exists(); }
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
namespace athena::io {
|
||||
class FileReader : public IStreamReader {
|
||||
public:
|
||||
explicit FileReader(std::string_view filename, atInt32 cacheSize = (32 * 1024), bool globalErr = true);
|
||||
explicit FileReader(std::wstring_view filename, atInt32 cacheSize = (32 * 1024), bool globalErr = true);
|
||||
explicit FileReader(std::string_view filename, int32_t cacheSize = (32 * 1024), bool globalErr = true);
|
||||
explicit FileReader(std::wstring_view filename, int32_t cacheSize = (32 * 1024), bool globalErr = true);
|
||||
~FileReader() override;
|
||||
|
||||
std::string filename() const {
|
||||
@@ -33,12 +33,12 @@ public:
|
||||
void open();
|
||||
void close();
|
||||
bool isOpen() const { return m_fileHandle != nullptr; }
|
||||
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
atUint64 position() const override;
|
||||
atUint64 length() const override;
|
||||
atUint64 readUBytesToBuf(void* buf, atUint64 len) override;
|
||||
void seek(int64_t pos, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
uint64_t position() const override;
|
||||
uint64_t length() const override;
|
||||
uint64_t readUBytesToBuf(void* buf, uint64_t len) override;
|
||||
|
||||
void setCacheSize(const atInt32 blockSize);
|
||||
void setCacheSize(const int32_t blockSize);
|
||||
|
||||
#if _WIN32
|
||||
using HandleType = void*;
|
||||
@@ -55,11 +55,11 @@ protected:
|
||||
std::string m_filename;
|
||||
#endif
|
||||
HandleType m_fileHandle;
|
||||
atUint64 m_fileSize;
|
||||
std::unique_ptr<atUint8[]> m_cacheData;
|
||||
atInt32 m_blockSize;
|
||||
atInt32 m_curBlock;
|
||||
atUint64 m_offset;
|
||||
uint64_t m_fileSize;
|
||||
std::unique_ptr<uint8_t[]> m_cacheData;
|
||||
int32_t m_blockSize;
|
||||
int32_t m_curBlock;
|
||||
uint64_t m_offset;
|
||||
bool m_globalErr;
|
||||
};
|
||||
} // namespace athena::io
|
||||
|
||||
@@ -30,10 +30,10 @@ public:
|
||||
void open(bool overwrite = true);
|
||||
void close();
|
||||
bool isOpen() const { return m_fileHandle != nullptr; }
|
||||
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
atUint64 position() const override;
|
||||
atUint64 length() const override;
|
||||
void writeUBytes(const atUint8* data, atUint64 len) override;
|
||||
void seek(int64_t pos, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
uint64_t position() const override;
|
||||
uint64_t length() const override;
|
||||
void writeUBytes(const uint8_t* data, uint64_t len) override;
|
||||
|
||||
#ifdef _WIN32
|
||||
using HandleType = void*;
|
||||
@@ -61,7 +61,7 @@ class TransactionalFileWriter : public IStreamWriter {
|
||||
#endif
|
||||
bool m_overwrite, m_globalErr;
|
||||
std::vector<uint8_t> m_deferredBuffer;
|
||||
atUint64 m_position = 0;
|
||||
uint64_t m_position = 0;
|
||||
|
||||
public:
|
||||
explicit TransactionalFileWriter(std::string_view filename, bool overwrite = true, bool globalErr = true)
|
||||
@@ -94,10 +94,10 @@ public:
|
||||
m_position = 0;
|
||||
}
|
||||
|
||||
atUint64 position() const override { return m_position; }
|
||||
atUint64 length() const override { return m_deferredBuffer.size(); }
|
||||
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
void writeUBytes(const atUint8* data, atUint64 len) override;
|
||||
uint64_t position() const override { return m_position; }
|
||||
uint64_t length() const override { return m_deferredBuffer.size(); }
|
||||
void seek(int64_t pos, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
void writeUBytes(const uint8_t* data, uint64_t len) override;
|
||||
|
||||
~TransactionalFileWriter() override { flush(); }
|
||||
};
|
||||
|
||||
@@ -12,10 +12,10 @@ public:
|
||||
Endian endian() const { return m_endian; }
|
||||
bool isBigEndian() const { return (m_endian == Endian::Big); }
|
||||
bool isLittleEndian() const { return (m_endian == Endian::Little); }
|
||||
virtual void seek(atInt64, SeekOrigin) = 0;
|
||||
virtual void seek(int64_t, SeekOrigin) = 0;
|
||||
virtual bool atEnd() const = 0;
|
||||
virtual atUint64 position() const = 0;
|
||||
virtual atUint64 length() const = 0;
|
||||
virtual uint64_t position() const = 0;
|
||||
virtual uint64_t length() const = 0;
|
||||
bool hasError() const { return m_hasError; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
* @param position where in the buffer to seek
|
||||
* @param origin The Origin to seek relative to
|
||||
*/
|
||||
void seek(atInt64 position, SeekOrigin origin = SeekOrigin::Current) override = 0;
|
||||
void seek(int64_t position, SeekOrigin origin = SeekOrigin::Current) override = 0;
|
||||
|
||||
/** @brief Sets the buffer's position relative to the next 64-byte aligned position.<br />
|
||||
*/
|
||||
@@ -52,33 +52,33 @@ public:
|
||||
*
|
||||
* @return The current position in the stream.
|
||||
*/
|
||||
atUint64 position() const override = 0;
|
||||
uint64_t position() const override = 0;
|
||||
|
||||
/** @brief Returns the length of the file.
|
||||
*
|
||||
* @return True length of the file.
|
||||
*/
|
||||
atUint64 length() const override = 0;
|
||||
uint64_t length() const override = 0;
|
||||
|
||||
/** @brief Reads a byte at the current position and advances the current position
|
||||
*
|
||||
* @return The value at the current position
|
||||
*/
|
||||
atInt8 readByte() {
|
||||
atInt8 val = 0;
|
||||
int8_t readByte() {
|
||||
int8_t val = 0;
|
||||
readUBytesToBuf(&val, 1);
|
||||
return val;
|
||||
}
|
||||
template <class T>
|
||||
atInt8 readVal(std::enable_if_t<std::is_same_v<T, atInt8>>* = nullptr) {
|
||||
int8_t readVal(std::enable_if_t<std::is_same_v<T, int8_t>>* = nullptr) {
|
||||
return readByte();
|
||||
}
|
||||
template <class T>
|
||||
atInt8 readValLittle(std::enable_if_t<std::is_same_v<T, atInt8>>* = nullptr) {
|
||||
int8_t readValLittle(std::enable_if_t<std::is_same_v<T, int8_t>>* = nullptr) {
|
||||
return readByte();
|
||||
}
|
||||
template <class T>
|
||||
atInt8 readValBig(std::enable_if_t<std::is_same_v<T, atInt8>>* = nullptr) {
|
||||
int8_t readValBig(std::enable_if_t<std::is_same_v<T, int8_t>>* = nullptr) {
|
||||
return readByte();
|
||||
}
|
||||
|
||||
@@ -86,17 +86,17 @@ public:
|
||||
*
|
||||
* @return The value at the current position
|
||||
*/
|
||||
atUint8 readUByte() { return readByte(); }
|
||||
uint8_t readUByte() { return readByte(); }
|
||||
template <class T>
|
||||
atUint8 readVal(std::enable_if_t<std::is_same_v<T, atUint8>>* = nullptr) {
|
||||
uint8_t readVal(std::enable_if_t<std::is_same_v<T, uint8_t>>* = nullptr) {
|
||||
return readUByte();
|
||||
}
|
||||
template <class T>
|
||||
atUint8 readValLittle(std::enable_if_t<std::is_same_v<T, atUint8>>* = nullptr) {
|
||||
uint8_t readValLittle(std::enable_if_t<std::is_same_v<T, uint8_t>>* = nullptr) {
|
||||
return readUByte();
|
||||
}
|
||||
template <class T>
|
||||
atUint8 readValBig(std::enable_if_t<std::is_same_v<T, atUint8>>* = nullptr) {
|
||||
uint8_t readValBig(std::enable_if_t<std::is_same_v<T, uint8_t>>* = nullptr) {
|
||||
return readUByte();
|
||||
}
|
||||
|
||||
@@ -104,8 +104,8 @@ public:
|
||||
*
|
||||
* @return The buffer at the current position from the given length.
|
||||
*/
|
||||
std::unique_ptr<atInt8[]> readBytes(atUint64 length) {
|
||||
auto buf = std::make_unique<atInt8[]>(length);
|
||||
std::unique_ptr<int8_t[]> readBytes(uint64_t length) {
|
||||
auto buf = std::make_unique<int8_t[]>(length);
|
||||
readUBytesToBuf(buf.get(), length);
|
||||
return buf;
|
||||
}
|
||||
@@ -114,8 +114,8 @@ public:
|
||||
*
|
||||
* @return The buffer at the current position from the given length.
|
||||
*/
|
||||
std::unique_ptr<atUint8[]> readUBytes(atUint64 length) {
|
||||
auto buf = std::make_unique<atUint8[]>(length);
|
||||
std::unique_ptr<uint8_t[]> readUBytes(uint64_t length) {
|
||||
auto buf = std::make_unique<uint8_t[]>(length);
|
||||
readUBytesToBuf(buf.get(), length);
|
||||
return buf;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
* @param len The length of the buffer
|
||||
* @return How much data was actually read, useful for detecting read errors.
|
||||
*/
|
||||
atUint64 readBytesToBuf(void* buf, atUint64 len) { return readUBytesToBuf(buf, len); }
|
||||
uint64_t readBytesToBuf(void* buf, uint64_t len) { return readUBytesToBuf(buf, len); }
|
||||
|
||||
/** @brief Attempts to read a fixed length of data into a pre-allocated buffer, this function is client defined
|
||||
* and must be implemented.
|
||||
@@ -133,20 +133,20 @@ public:
|
||||
* @param len The length of the buffer
|
||||
* @return How much data was actually read, useful for detecting read errors.
|
||||
*/
|
||||
virtual atUint64 readUBytesToBuf(void* buf, atUint64 len) = 0;
|
||||
virtual uint64_t readUBytesToBuf(void* buf, uint64_t len) = 0;
|
||||
|
||||
/** @brief Reads a Int16 and swaps to endianness specified by setEndian depending on platform
|
||||
* and advances the current position
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atInt16 readInt16() {
|
||||
atInt16 val = 0;
|
||||
int16_t readInt16() {
|
||||
int16_t val = 0;
|
||||
readUBytesToBuf(&val, 2);
|
||||
return m_endian == Endian::Big ? utility::BigInt16(val) : utility::LittleInt16(val);
|
||||
}
|
||||
template <class T>
|
||||
atInt16 readVal(std::enable_if_t<std::is_same_v<T, atInt16>>* = nullptr) {
|
||||
int16_t readVal(std::enable_if_t<std::is_same_v<T, int16_t>>* = nullptr) {
|
||||
return readInt16();
|
||||
}
|
||||
|
||||
@@ -155,13 +155,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atInt16 readInt16Little() {
|
||||
atInt16 val = 0;
|
||||
int16_t readInt16Little() {
|
||||
int16_t val = 0;
|
||||
readUBytesToBuf(&val, 2);
|
||||
return utility::LittleInt16(val);
|
||||
}
|
||||
template <class T>
|
||||
atInt16 readValLittle(std::enable_if_t<std::is_same_v<T, atInt16>>* = nullptr) {
|
||||
int16_t readValLittle(std::enable_if_t<std::is_same_v<T, int16_t>>* = nullptr) {
|
||||
return readInt16Little();
|
||||
}
|
||||
|
||||
@@ -170,13 +170,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atInt16 readInt16Big() {
|
||||
atInt16 val = 0;
|
||||
int16_t readInt16Big() {
|
||||
int16_t val = 0;
|
||||
readUBytesToBuf(&val, 2);
|
||||
return utility::BigInt16(val);
|
||||
}
|
||||
template <class T>
|
||||
atInt16 readValBig(std::enable_if_t<std::is_same_v<T, atInt16>>* = nullptr) {
|
||||
int16_t readValBig(std::enable_if_t<std::is_same_v<T, int16_t>>* = nullptr) {
|
||||
return readInt16Big();
|
||||
}
|
||||
|
||||
@@ -185,9 +185,9 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atUint16 readUint16() { return readInt16(); }
|
||||
uint16_t readUint16() { return readInt16(); }
|
||||
template <class T>
|
||||
atUint16 readVal(std::enable_if_t<std::is_same_v<T, atUint16>>* = 0) {
|
||||
uint16_t readVal(std::enable_if_t<std::is_same_v<T, uint16_t>>* = 0) {
|
||||
return readUint16();
|
||||
}
|
||||
|
||||
@@ -196,13 +196,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atUint16 readUint16Little() {
|
||||
atUint16 val = 0;
|
||||
uint16_t readUint16Little() {
|
||||
uint16_t val = 0;
|
||||
readUBytesToBuf(&val, 2);
|
||||
return utility::LittleUint16(val);
|
||||
}
|
||||
template <class T>
|
||||
atUint16 readValLittle(std::enable_if_t<std::is_same_v<T, atUint16>>* = nullptr) {
|
||||
uint16_t readValLittle(std::enable_if_t<std::is_same_v<T, uint16_t>>* = nullptr) {
|
||||
return readUint16Little();
|
||||
}
|
||||
|
||||
@@ -211,13 +211,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atUint16 readUint16Big() {
|
||||
atUint16 val = 0;
|
||||
uint16_t readUint16Big() {
|
||||
uint16_t val = 0;
|
||||
readUBytesToBuf(&val, 2);
|
||||
return utility::BigUint16(val);
|
||||
}
|
||||
template <class T>
|
||||
atUint16 readValBig(std::enable_if_t<std::is_same_v<T, atUint16>>* = nullptr) {
|
||||
uint16_t readValBig(std::enable_if_t<std::is_same_v<T, uint16_t>>* = nullptr) {
|
||||
return readUint16Big();
|
||||
}
|
||||
|
||||
@@ -226,13 +226,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atInt32 readInt32() {
|
||||
atInt32 val = 0;
|
||||
int32_t readInt32() {
|
||||
int32_t val = 0;
|
||||
readUBytesToBuf(&val, 4);
|
||||
return m_endian == Endian::Big ? utility::BigInt32(val) : utility::LittleInt32(val);
|
||||
}
|
||||
template <class T>
|
||||
atInt32 readVal(std::enable_if_t<std::is_same_v<T, atInt32>>* = nullptr) {
|
||||
int32_t readVal(std::enable_if_t<std::is_same_v<T, int32_t>>* = nullptr) {
|
||||
return readInt32();
|
||||
}
|
||||
|
||||
@@ -241,13 +241,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atInt32 readInt32Little() {
|
||||
atInt32 val = 0;
|
||||
int32_t readInt32Little() {
|
||||
int32_t val = 0;
|
||||
readUBytesToBuf(&val, 4);
|
||||
return utility::LittleInt32(val);
|
||||
}
|
||||
template <class T>
|
||||
atInt32 readValLittle(std::enable_if_t<std::is_same_v<T, atInt32>>* = nullptr) {
|
||||
int32_t readValLittle(std::enable_if_t<std::is_same_v<T, int32_t>>* = nullptr) {
|
||||
return readInt32Little();
|
||||
}
|
||||
|
||||
@@ -256,13 +256,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atInt32 readInt32Big() {
|
||||
atInt32 val = 0;
|
||||
int32_t readInt32Big() {
|
||||
int32_t val = 0;
|
||||
readUBytesToBuf(&val, 4);
|
||||
return utility::BigInt32(val);
|
||||
}
|
||||
template <class T>
|
||||
atInt32 readValBig(std::enable_if_t<std::is_same_v<T, atInt32>>* = nullptr) {
|
||||
int32_t readValBig(std::enable_if_t<std::is_same_v<T, int32_t>>* = nullptr) {
|
||||
return readInt32Big();
|
||||
}
|
||||
|
||||
@@ -271,9 +271,9 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atUint32 readUint32() { return readInt32(); }
|
||||
uint32_t readUint32() { return readInt32(); }
|
||||
template <class T>
|
||||
atUint32 readVal(std::enable_if_t<std::is_same_v<T, atUint32>>* = nullptr) {
|
||||
uint32_t readVal(std::enable_if_t<std::is_same_v<T, uint32_t>>* = nullptr) {
|
||||
return readUint32();
|
||||
}
|
||||
|
||||
@@ -282,13 +282,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atUint32 readUint32Little() {
|
||||
atUint32 val = 0;
|
||||
uint32_t readUint32Little() {
|
||||
uint32_t val = 0;
|
||||
readUBytesToBuf(&val, 4);
|
||||
return utility::LittleUint32(val);
|
||||
}
|
||||
template <class T>
|
||||
atInt32 readValLittle(std::enable_if_t<std::is_same_v<T, atUint32>>* = nullptr) {
|
||||
int32_t readValLittle(std::enable_if_t<std::is_same_v<T, uint32_t>>* = nullptr) {
|
||||
return readUint32Little();
|
||||
}
|
||||
|
||||
@@ -297,13 +297,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atUint32 readUint32Big() {
|
||||
atUint32 val = 0;
|
||||
uint32_t readUint32Big() {
|
||||
uint32_t val = 0;
|
||||
readUBytesToBuf(&val, 4);
|
||||
return utility::BigUint32(val);
|
||||
}
|
||||
template <class T>
|
||||
atUint32 readValBig(std::enable_if_t<std::is_same_v<T, atUint32>>* = nullptr) {
|
||||
uint32_t readValBig(std::enable_if_t<std::is_same_v<T, uint32_t>>* = nullptr) {
|
||||
return readUint32Big();
|
||||
}
|
||||
|
||||
@@ -312,13 +312,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atInt64 readInt64() {
|
||||
atInt64 val = 0;
|
||||
int64_t readInt64() {
|
||||
int64_t val = 0;
|
||||
readUBytesToBuf(&val, 8);
|
||||
return m_endian == Endian::Big ? utility::BigInt64(val) : utility::LittleInt64(val);
|
||||
}
|
||||
template <class T>
|
||||
atInt64 readVal(std::enable_if_t<std::is_same_v<T, atInt64>>* = nullptr) {
|
||||
int64_t readVal(std::enable_if_t<std::is_same_v<T, int64_t>>* = nullptr) {
|
||||
return readInt64();
|
||||
}
|
||||
|
||||
@@ -327,13 +327,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atInt64 readInt64Little() {
|
||||
atInt64 val = 0;
|
||||
int64_t readInt64Little() {
|
||||
int64_t val = 0;
|
||||
readUBytesToBuf(&val, 8);
|
||||
return utility::LittleInt64(val);
|
||||
}
|
||||
template <class T>
|
||||
atInt64 readValLittle(std::enable_if_t<std::is_same_v<T, atInt64>>* = nullptr) {
|
||||
int64_t readValLittle(std::enable_if_t<std::is_same_v<T, int64_t>>* = nullptr) {
|
||||
return readInt64Little();
|
||||
}
|
||||
|
||||
@@ -342,13 +342,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atInt64 readInt64Big() {
|
||||
atInt64 val = 0;
|
||||
int64_t readInt64Big() {
|
||||
int64_t val = 0;
|
||||
readUBytesToBuf(&val, 8);
|
||||
return utility::BigInt64(val);
|
||||
}
|
||||
template <class T>
|
||||
atInt64 readValBig(std::enable_if_t<std::is_same_v<T, atInt64>>* = nullptr) {
|
||||
int64_t readValBig(std::enable_if_t<std::is_same_v<T, int64_t>>* = nullptr) {
|
||||
return readInt64Big();
|
||||
}
|
||||
|
||||
@@ -357,9 +357,9 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atUint64 readUint64() { return readInt64(); }
|
||||
uint64_t readUint64() { return readInt64(); }
|
||||
template <class T>
|
||||
atUint64 readVal(std::enable_if_t<std::is_same_v<T, atUint64>>* = nullptr) {
|
||||
uint64_t readVal(std::enable_if_t<std::is_same_v<T, uint64_t>>* = nullptr) {
|
||||
return readUint64();
|
||||
}
|
||||
|
||||
@@ -368,13 +368,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atUint64 readUint64Little() {
|
||||
atUint64 val = 0;
|
||||
uint64_t readUint64Little() {
|
||||
uint64_t val = 0;
|
||||
readUBytesToBuf(&val, 8);
|
||||
return utility::LittleUint64(val);
|
||||
}
|
||||
template <class T>
|
||||
atUint64 readValLittle(std::enable_if_t<std::is_same_v<T, atUint64>>* = nullptr) {
|
||||
uint64_t readValLittle(std::enable_if_t<std::is_same_v<T, uint64_t>>* = nullptr) {
|
||||
return readUint64Little();
|
||||
}
|
||||
|
||||
@@ -383,13 +383,13 @@ public:
|
||||
*
|
||||
* @return The value at the current address
|
||||
*/
|
||||
atUint64 readUint64Big() {
|
||||
atUint64 val = 0;
|
||||
uint64_t readUint64Big() {
|
||||
uint64_t val = 0;
|
||||
readUBytesToBuf(&val, 8);
|
||||
return utility::BigUint64(val);
|
||||
}
|
||||
template <class T>
|
||||
atUint64 readValBig(std::enable_if_t<std::is_same_v<T, atUint64>>* = nullptr) {
|
||||
uint64_t readValBig(std::enable_if_t<std::is_same_v<T, uint64_t>>* = nullptr) {
|
||||
return readUint64Big();
|
||||
}
|
||||
|
||||
@@ -488,7 +488,7 @@ public:
|
||||
* @return The value at the current address
|
||||
*/
|
||||
bool readBool() {
|
||||
atUint8 val = false;
|
||||
uint8_t val = false;
|
||||
readUBytesToBuf(&val, 1);
|
||||
return val != 0;
|
||||
}
|
||||
@@ -927,13 +927,13 @@ public:
|
||||
*
|
||||
* @return The read string
|
||||
*/
|
||||
std::string readString(atInt32 fixedLen = -1, bool doSeek = true) {
|
||||
std::string readString(int32_t fixedLen = -1, bool doSeek = true) {
|
||||
if (fixedLen == 0)
|
||||
return std::string();
|
||||
std::string ret;
|
||||
atUint8 chr = readByte();
|
||||
uint8_t chr = readByte();
|
||||
|
||||
atInt32 i;
|
||||
int32_t i;
|
||||
for (i = 1; chr != 0; ++i) {
|
||||
ret += chr;
|
||||
|
||||
@@ -961,14 +961,14 @@ public:
|
||||
*
|
||||
* @return The read wstring
|
||||
*/
|
||||
std::wstring readWString(atInt32 fixedLen = -1, bool doSeek = true) {
|
||||
std::wstring readWString(int32_t fixedLen = -1, bool doSeek = true) {
|
||||
if (fixedLen == 0)
|
||||
return std::wstring();
|
||||
|
||||
std::wstring ret;
|
||||
atUint16 chr = readUint16();
|
||||
uint16_t chr = readUint16();
|
||||
|
||||
atInt32 i;
|
||||
int32_t i;
|
||||
for (i = 1; chr != 0; ++i) {
|
||||
ret += chr;
|
||||
|
||||
@@ -997,14 +997,14 @@ public:
|
||||
*
|
||||
* @return The read wstring
|
||||
*/
|
||||
std::wstring readWStringLittle(atInt32 fixedLen = -1, bool doSeek = true) {
|
||||
std::wstring readWStringLittle(int32_t fixedLen = -1, bool doSeek = true) {
|
||||
if (fixedLen == 0)
|
||||
return std::wstring();
|
||||
|
||||
std::wstring ret;
|
||||
atUint16 chr = readUint16Little();
|
||||
uint16_t chr = readUint16Little();
|
||||
|
||||
atInt32 i;
|
||||
int32_t i;
|
||||
for (i = 1; chr != 0; ++i) {
|
||||
ret += chr;
|
||||
|
||||
@@ -1033,13 +1033,13 @@ public:
|
||||
*
|
||||
* @return The read wstring
|
||||
*/
|
||||
std::wstring readWStringBig(atInt32 fixedLen = -1, bool doSeek = true) {
|
||||
std::wstring readWStringBig(int32_t fixedLen = -1, bool doSeek = true) {
|
||||
if (fixedLen == 0)
|
||||
return std::wstring();
|
||||
std::wstring ret;
|
||||
atUint16 chr = readUint16Big();
|
||||
uint16_t chr = readUint16Big();
|
||||
|
||||
atInt32 i;
|
||||
int32_t i;
|
||||
for (i = 1; chr != 0; ++i) {
|
||||
ret += chr;
|
||||
|
||||
@@ -1068,13 +1068,13 @@ public:
|
||||
*
|
||||
* @return The read wstring
|
||||
*/
|
||||
std::u16string readU16StringBig(atInt32 fixedLen = -1, bool doSeek = true) {
|
||||
std::u16string readU16StringBig(int32_t fixedLen = -1, bool doSeek = true) {
|
||||
if (fixedLen == 0)
|
||||
return std::u16string();
|
||||
std::u16string ret;
|
||||
char16_t chr = readUint16Big();
|
||||
|
||||
atInt32 i;
|
||||
int32_t i;
|
||||
for (i = 1; chr != 0; ++i) {
|
||||
ret += chr;
|
||||
|
||||
@@ -1103,13 +1103,13 @@ public:
|
||||
*
|
||||
* @return The read wstring
|
||||
*/
|
||||
std::u32string readU32StringBig(atInt32 fixedLen = -1, bool doSeek = true) {
|
||||
std::u32string readU32StringBig(int32_t fixedLen = -1, bool doSeek = true) {
|
||||
if (fixedLen == 0)
|
||||
return std::u32string();
|
||||
std::u32string ret;
|
||||
char32_t chr = readUint32Big();
|
||||
|
||||
atInt32 i;
|
||||
int32_t i;
|
||||
for (i = 1; chr != 0; ++i) {
|
||||
ret += chr;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
* @param position where in the buffer to seek
|
||||
* @param origin The location to seek relative to
|
||||
*/
|
||||
void seek(atInt64 position, SeekOrigin origin = SeekOrigin::Current) override = 0;
|
||||
void seek(int64_t position, SeekOrigin origin = SeekOrigin::Current) override = 0;
|
||||
|
||||
/** @brief Sets the buffers position relative to the next 32-byte aligned position.<br />
|
||||
*/
|
||||
@@ -27,11 +27,11 @@ public:
|
||||
|
||||
/** @brief Writes zero up to specified absolute offset.<br />
|
||||
*/
|
||||
void writeZeroTo(atInt64 pos) {
|
||||
atInt64 delta = pos - position();
|
||||
void writeZeroTo(int64_t pos) {
|
||||
int64_t delta = pos - position();
|
||||
if (delta <= 0)
|
||||
return;
|
||||
for (atInt64 i = 0; i < delta; ++i)
|
||||
for (int64_t i = 0; i < delta; ++i)
|
||||
writeUByte(0);
|
||||
}
|
||||
|
||||
@@ -45,29 +45,29 @@ public:
|
||||
*
|
||||
* @return The current position in the stream.
|
||||
*/
|
||||
atUint64 position() const override = 0;
|
||||
uint64_t position() const override = 0;
|
||||
|
||||
/** @brief Returns whether or not the stream is at the end.
|
||||
*
|
||||
* @return True if at end; False otherwise.
|
||||
*/
|
||||
atUint64 length() const override = 0;
|
||||
uint64_t length() const override = 0;
|
||||
|
||||
/** @brief Writes a byte at the current position and advances the position by one byte.
|
||||
* @param val The value to write
|
||||
*/
|
||||
void writeUByte(atUint8 val) { writeUBytes(&val, 1); }
|
||||
void writeVal(atUint8 val) { writeUByte(val); }
|
||||
void writeValLittle(atUint8 val) { writeUByte(val); }
|
||||
void writeValBig(atUint8 val) { writeUByte(val); }
|
||||
void writeUByte(uint8_t val) { writeUBytes(&val, 1); }
|
||||
void writeVal(uint8_t val) { writeUByte(val); }
|
||||
void writeValLittle(uint8_t val) { writeUByte(val); }
|
||||
void writeValBig(uint8_t val) { writeUByte(val); }
|
||||
|
||||
/** @brief Writes a byte at the current position and advances the position by one byte.
|
||||
* @param val The value to write
|
||||
*/
|
||||
void writeByte(atInt8 val) { writeUByte(val); }
|
||||
void writeVal(atInt8 val) { writeByte(val); }
|
||||
void writeValLittle(atInt8 val) { writeByte(val); }
|
||||
void writeValBig(atInt8 val) { writeByte(val); }
|
||||
void writeByte(int8_t val) { writeUByte(val); }
|
||||
void writeVal(int8_t val) { writeByte(val); }
|
||||
void writeValLittle(int8_t val) { writeByte(val); }
|
||||
void writeValBig(int8_t val) { writeByte(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.
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
* @param data The buffer to write
|
||||
* @param length The amount to write
|
||||
*/
|
||||
virtual void writeUBytes(const atUint8* data, atUint64 length) = 0;
|
||||
virtual void writeUBytes(const uint8_t* data, uint64_t length) = 0;
|
||||
|
||||
/** @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.
|
||||
@@ -83,14 +83,14 @@ public:
|
||||
* @param data The buffer to write
|
||||
* @param length The amount to write
|
||||
*/
|
||||
void writeBytes(const void* data, atUint64 length) { writeUBytes(reinterpret_cast<const atUint8*>(data), length); }
|
||||
void writeBytes(const void* data, uint64_t length) { writeUBytes(reinterpret_cast<const uint8_t*>(data), length); }
|
||||
|
||||
/** @brief Writes an Int16 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes depending on the platform and Stream settings.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeInt16(atInt16 val) {
|
||||
void writeInt16(int16_t val) {
|
||||
if (m_endian == Endian::Big) {
|
||||
utility::BigInt16(val);
|
||||
} else {
|
||||
@@ -98,60 +98,60 @@ public:
|
||||
}
|
||||
writeBytes(&val, sizeof(val));
|
||||
}
|
||||
void writeVal(atInt16 val) { writeInt16(val); }
|
||||
void writeVal(int16_t val) { writeInt16(val); }
|
||||
|
||||
/** @brief Writes an Int16 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes against little depending on the platform.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeInt16Little(atInt16 val) {
|
||||
void writeInt16Little(int16_t val) {
|
||||
utility::LittleInt16(val);
|
||||
writeBytes(&val, sizeof(val));
|
||||
}
|
||||
void writeValLittle(atInt16 val) { writeInt16Little(val); }
|
||||
void writeValLittle(int16_t val) { writeInt16Little(val); }
|
||||
|
||||
/** @brief Writes an Int16 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes against big depending on the platform.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeInt16Big(atInt16 val) {
|
||||
void writeInt16Big(int16_t val) {
|
||||
utility::BigInt16(val);
|
||||
writeBytes(&val, sizeof(val));
|
||||
}
|
||||
void writeValBig(atInt16 val) { writeInt16Big(val); }
|
||||
void writeValBig(int16_t val) { writeInt16Big(val); }
|
||||
|
||||
/** @brief Writes an Uint16 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes depending on the platform and Stream settings
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeUint16(atUint16 val) { writeInt16(val); }
|
||||
void writeVal(atUint16 val) { writeUint16(val); }
|
||||
void writeUint16(uint16_t val) { writeInt16(val); }
|
||||
void writeVal(uint16_t val) { writeUint16(val); }
|
||||
|
||||
/** @brief Writes an Uint16 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes against little depending on the platform
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeUint16Little(atUint16 val) { writeInt16Little(val); }
|
||||
void writeValLittle(atUint16 val) { writeUint16Little(val); }
|
||||
void writeUint16Little(uint16_t val) { writeInt16Little(val); }
|
||||
void writeValLittle(uint16_t val) { writeUint16Little(val); }
|
||||
|
||||
/** @brief Writes an Uint16 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes against big depending on the platform
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeUint16Big(atUint16 val) { writeInt16Big(val); }
|
||||
void writeValBig(atUint16 val) { writeUint16Big(val); }
|
||||
void writeUint16Big(uint16_t val) { writeInt16Big(val); }
|
||||
void writeValBig(uint16_t val) { writeUint16Big(val); }
|
||||
|
||||
/** @brief Writes an Int32 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes depending on the platform and Stream settings.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeInt32(atInt32 val) {
|
||||
void writeInt32(int32_t val) {
|
||||
if (m_endian == Endian::Big) {
|
||||
utility::BigInt32(val);
|
||||
} else {
|
||||
@@ -159,60 +159,60 @@ public:
|
||||
}
|
||||
writeBytes(&val, sizeof(val));
|
||||
}
|
||||
void writeVal(atInt32 val) { writeInt32(val); }
|
||||
void writeVal(int32_t val) { writeInt32(val); }
|
||||
|
||||
/** @brief Writes an Int32 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes against little depending on the platform.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeInt32Little(atInt32 val) {
|
||||
void writeInt32Little(int32_t val) {
|
||||
utility::LittleInt32(val);
|
||||
writeBytes(&val, sizeof(val));
|
||||
}
|
||||
void writeValLittle(atInt32 val) { writeInt32Little(val); }
|
||||
void writeValLittle(int32_t val) { writeInt32Little(val); }
|
||||
|
||||
/** @brief Writes an Int32 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes against big depending on the platform.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeInt32Big(atInt32 val) {
|
||||
void writeInt32Big(int32_t val) {
|
||||
utility::BigInt32(val);
|
||||
writeBytes(&val, sizeof(val));
|
||||
}
|
||||
void writeValBig(atInt32 val) { writeInt32Big(val); }
|
||||
void writeValBig(int32_t val) { writeInt32Big(val); }
|
||||
|
||||
/** @brief Writes an Uint32 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes depending on the platform and Stream settings.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeUint32(atUint32 val) { writeInt32(val); }
|
||||
void writeVal(atUint32 val) { writeUint32(val); }
|
||||
void writeUint32(uint32_t val) { writeInt32(val); }
|
||||
void writeVal(uint32_t val) { writeUint32(val); }
|
||||
|
||||
/** @brief Writes an Uint32 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes against little depending on the platform.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeUint32Little(atUint32 val) { writeInt32Little(val); }
|
||||
void writeValLittle(atUint32 val) { writeUint32Little(val); }
|
||||
void writeUint32Little(uint32_t val) { writeInt32Little(val); }
|
||||
void writeValLittle(uint32_t val) { writeUint32Little(val); }
|
||||
|
||||
/** @brief Writes an Uint32 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes against big depending on the platform.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeUint32Big(atUint32 val) { writeInt32Big(val); }
|
||||
void writeValBig(atUint32 val) { writeUint32Big(val); }
|
||||
void writeUint32Big(uint32_t val) { writeInt32Big(val); }
|
||||
void writeValBig(uint32_t val) { writeUint32Big(val); }
|
||||
|
||||
/** @brief Writes an Int64 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes depending on the platform and Stream settings.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeInt64(atInt64 val) {
|
||||
void writeInt64(int64_t val) {
|
||||
if (m_endian == Endian::Big) {
|
||||
utility::BigInt64(val);
|
||||
} else {
|
||||
@@ -220,53 +220,53 @@ public:
|
||||
}
|
||||
writeBytes(&val, sizeof(val));
|
||||
}
|
||||
void writeVal(atInt64 val) { writeInt64(val); }
|
||||
void writeVal(int64_t val) { writeInt64(val); }
|
||||
|
||||
/** @brief Writes an Int64 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes against little depending on the platform.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeInt64Little(atInt64 val) {
|
||||
void writeInt64Little(int64_t val) {
|
||||
utility::LittleInt64(val);
|
||||
writeBytes(&val, sizeof(val));
|
||||
}
|
||||
void writeValLittle(atInt64 val) { writeInt64Little(val); }
|
||||
void writeValLittle(int64_t val) { writeInt64Little(val); }
|
||||
|
||||
/** @brief Writes an Int64 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes against big depending on the platform.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeInt64Big(atInt64 val) {
|
||||
void writeInt64Big(int64_t val) {
|
||||
utility::BigInt64(val);
|
||||
writeBytes(&val, sizeof(val));
|
||||
}
|
||||
void writeValBig(atInt64 val) { writeInt64Big(val); }
|
||||
void writeValBig(int64_t val) { writeInt64Big(val); }
|
||||
|
||||
/** @brief Writes an Uint64 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes depending on the platform and Stream settings.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeUint64(atUint64 val) { writeInt64(val); }
|
||||
void writeVal(atUint64 val) { writeUint64(val); }
|
||||
void writeUint64(uint64_t val) { writeInt64(val); }
|
||||
void writeVal(uint64_t val) { writeUint64(val); }
|
||||
|
||||
/** @brief Writes an Uint64 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes against little depending on the platform.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeUint64Little(atUint64 val) { writeInt64Little(val); }
|
||||
void writeValLittle(atUint64 val) { writeUint64Little(val); }
|
||||
void writeUint64Little(uint64_t val) { writeInt64Little(val); }
|
||||
void writeValLittle(uint64_t val) { writeUint64Little(val); }
|
||||
|
||||
/** @brief Writes an Uint64 to the buffer and advances the buffer.
|
||||
* It also swaps the bytes against big depending on the platform.
|
||||
*
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeUint64Big(atUint64 val) { writeInt64Big(val); }
|
||||
void writeValBig(atUint64 val) { writeUint64Big(val); }
|
||||
void writeUint64Big(uint64_t val) { writeInt64Big(val); }
|
||||
void writeValBig(uint64_t val) { writeUint64Big(val); }
|
||||
|
||||
/** @brief Writes an float to the buffer and advances the buffer.
|
||||
* It also swaps the bytes depending on the platform and Stream settings.
|
||||
@@ -348,7 +348,7 @@ public:
|
||||
* @param val The value to write to the buffer
|
||||
*/
|
||||
void writeBool(bool val) {
|
||||
const auto u8Value = atUint8(val);
|
||||
const auto u8Value = uint8_t(val);
|
||||
writeUBytes(&u8Value, sizeof(u8Value));
|
||||
}
|
||||
void writeVal(bool val) { writeBool(val); }
|
||||
@@ -651,7 +651,7 @@ public:
|
||||
*
|
||||
* Endianness is set with setEndian
|
||||
*/
|
||||
void writeStringAsWString(std::string_view str, atInt32 fixedLen = -1) {
|
||||
void writeStringAsWString(std::string_view str, int32_t fixedLen = -1) {
|
||||
if (fixedLen == 0)
|
||||
return;
|
||||
std::string tmpStr = std::string("\xEF\xBB\xBF") + str.data();
|
||||
@@ -666,11 +666,11 @@ public:
|
||||
}
|
||||
buf += len;
|
||||
if (wc != 0xFEFF)
|
||||
writeUint16(atUint16(wc));
|
||||
writeUint16(uint16_t(wc));
|
||||
}
|
||||
writeUint16(0);
|
||||
} else {
|
||||
for (atInt32 i = 0; i < fixedLen; ++i) {
|
||||
for (int32_t i = 0; i < fixedLen; ++i) {
|
||||
utf8proc_int32_t wc = 0;
|
||||
if (*buf) {
|
||||
utf8proc_ssize_t len = utf8proc_iterate(buf, -1, &wc);
|
||||
@@ -686,7 +686,7 @@ public:
|
||||
continue;
|
||||
}
|
||||
|
||||
writeUint16(atUint16(wc));
|
||||
writeUint16(uint16_t(wc));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -699,7 +699,7 @@ public:
|
||||
*
|
||||
* Endianness is little
|
||||
*/
|
||||
void writeStringAsWStringLittle(std::string_view str, atInt32 fixedLen = -1) {
|
||||
void writeStringAsWStringLittle(std::string_view str, int32_t fixedLen = -1) {
|
||||
if (fixedLen == 0)
|
||||
return;
|
||||
std::string tmpStr = std::string("\xEF\xBB\xBF") + str.data();
|
||||
@@ -714,11 +714,11 @@ public:
|
||||
}
|
||||
buf += len;
|
||||
if (wc != 0xFEFF)
|
||||
writeUint16Little(atUint16(wc));
|
||||
writeUint16Little(uint16_t(wc));
|
||||
}
|
||||
writeUint16Little(0);
|
||||
} else {
|
||||
for (atInt32 i = 0; i < fixedLen; ++i) {
|
||||
for (int32_t i = 0; i < fixedLen; ++i) {
|
||||
utf8proc_int32_t wc = 0;
|
||||
if (*buf) {
|
||||
utf8proc_ssize_t len = utf8proc_iterate(buf, -1, &wc);
|
||||
@@ -734,7 +734,7 @@ public:
|
||||
continue;
|
||||
}
|
||||
|
||||
writeUint16Little(atUint16(wc));
|
||||
writeUint16Little(uint16_t(wc));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -747,7 +747,7 @@ public:
|
||||
*
|
||||
* Endianness is big
|
||||
*/
|
||||
void writeStringAsWStringBig(std::string_view str, atInt32 fixedLen = -1) {
|
||||
void writeStringAsWStringBig(std::string_view str, int32_t fixedLen = -1) {
|
||||
if (fixedLen == 0)
|
||||
return;
|
||||
|
||||
@@ -763,11 +763,11 @@ public:
|
||||
}
|
||||
buf += len;
|
||||
if (wc != 0xFEFF)
|
||||
writeUint16Big(atUint16(wc));
|
||||
writeUint16Big(uint16_t(wc));
|
||||
}
|
||||
writeUint16Big(0);
|
||||
} else {
|
||||
for (atInt32 i = 0; i < fixedLen; ++i) {
|
||||
for (int32_t i = 0; i < fixedLen; ++i) {
|
||||
utf8proc_int32_t wc = 0;
|
||||
if (*buf) {
|
||||
utf8proc_ssize_t len = utf8proc_iterate(buf, -1, &wc);
|
||||
@@ -783,7 +783,7 @@ public:
|
||||
continue;
|
||||
}
|
||||
|
||||
writeUint16Big(atUint16(wc));
|
||||
writeUint16Big(uint16_t(wc));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -793,12 +793,12 @@ public:
|
||||
* @param str The string to write to the buffer
|
||||
* @param fixedLen If not -1, the number of characters to zero-fill string to
|
||||
*/
|
||||
void writeString(std::string_view str, atInt32 fixedLen = -1) {
|
||||
void writeString(std::string_view str, int32_t fixedLen = -1) {
|
||||
if (fixedLen == 0)
|
||||
return;
|
||||
|
||||
if (fixedLen < 0) {
|
||||
for (atUint8 c : str) {
|
||||
for (uint8_t c : str) {
|
||||
writeUByte(c);
|
||||
|
||||
if (c == '\0')
|
||||
@@ -807,8 +807,8 @@ public:
|
||||
writeUByte(0);
|
||||
} else {
|
||||
auto it = str.begin();
|
||||
for (atInt32 i = 0; i < fixedLen; ++i) {
|
||||
atUint8 chr;
|
||||
for (int32_t i = 0; i < fixedLen; ++i) {
|
||||
uint8_t chr;
|
||||
if (it == str.end())
|
||||
chr = 0;
|
||||
else
|
||||
@@ -826,12 +826,12 @@ public:
|
||||
*
|
||||
* Endianness is set with setEndian
|
||||
*/
|
||||
void writeWString(std::wstring_view str, atInt32 fixedLen = -1) {
|
||||
void writeWString(std::wstring_view str, int32_t fixedLen = -1) {
|
||||
if (fixedLen == 0)
|
||||
return;
|
||||
|
||||
if (fixedLen < 0) {
|
||||
for (atUint16 c : str) {
|
||||
for (uint16_t c : str) {
|
||||
writeUint16(c);
|
||||
|
||||
if (c == L'\0')
|
||||
@@ -840,8 +840,8 @@ public:
|
||||
writeUint16(0);
|
||||
} else {
|
||||
auto it = str.begin();
|
||||
for (atInt32 i = 0; i < fixedLen; ++i) {
|
||||
atUint16 chr;
|
||||
for (int32_t i = 0; i < fixedLen; ++i) {
|
||||
uint16_t chr;
|
||||
if (it == str.end())
|
||||
chr = 0;
|
||||
else
|
||||
@@ -859,12 +859,12 @@ public:
|
||||
*
|
||||
* Endianness is little
|
||||
*/
|
||||
void writeWStringLittle(std::wstring_view str, atInt32 fixedLen = -1) {
|
||||
void writeWStringLittle(std::wstring_view str, int32_t fixedLen = -1) {
|
||||
if (fixedLen == 0)
|
||||
return;
|
||||
|
||||
if (fixedLen < 0) {
|
||||
for (atUint16 c : str) {
|
||||
for (uint16_t c : str) {
|
||||
writeUint16Little(c);
|
||||
|
||||
if (c == L'\0')
|
||||
@@ -873,8 +873,8 @@ public:
|
||||
writeUint16Little(0);
|
||||
} else {
|
||||
auto it = str.begin();
|
||||
for (atInt32 i = 0; i < fixedLen; ++i) {
|
||||
atUint16 chr;
|
||||
for (int32_t i = 0; i < fixedLen; ++i) {
|
||||
uint16_t chr;
|
||||
if (it == str.end())
|
||||
chr = 0;
|
||||
else
|
||||
@@ -892,7 +892,7 @@ public:
|
||||
*
|
||||
* Endianness is big
|
||||
*/
|
||||
void writeWStringBig(std::wstring_view str, atInt32 fixedLen = -1) {
|
||||
void writeWStringBig(std::wstring_view str, int32_t fixedLen = -1) {
|
||||
if (fixedLen == 0)
|
||||
return;
|
||||
|
||||
@@ -906,7 +906,7 @@ public:
|
||||
writeUint16Big(0);
|
||||
} else {
|
||||
auto it = str.begin();
|
||||
for (atInt32 i = 0; i < fixedLen; ++i) {
|
||||
for (int32_t i = 0; i < fixedLen; ++i) {
|
||||
wchar_t chr;
|
||||
if (it == str.end())
|
||||
chr = 0;
|
||||
@@ -925,7 +925,7 @@ public:
|
||||
*
|
||||
* Endianness is big
|
||||
*/
|
||||
void writeU16StringBig(std::u16string_view str, atInt32 fixedLen = -1) {
|
||||
void writeU16StringBig(std::u16string_view str, int32_t fixedLen = -1) {
|
||||
if (fixedLen == 0)
|
||||
return;
|
||||
|
||||
@@ -939,7 +939,7 @@ public:
|
||||
writeUint16Big(0);
|
||||
} else {
|
||||
auto it = str.begin();
|
||||
for (atInt32 i = 0; i < fixedLen; ++i) {
|
||||
for (int32_t i = 0; i < fixedLen; ++i) {
|
||||
char16_t chr;
|
||||
if (it == str.end())
|
||||
chr = 0;
|
||||
@@ -958,7 +958,7 @@ public:
|
||||
*
|
||||
* Endianness is big
|
||||
*/
|
||||
void writeU32StringBig(std::u32string_view str, atInt32 fixedLen = -1) {
|
||||
void writeU32StringBig(std::u32string_view str, int32_t fixedLen = -1) {
|
||||
if (fixedLen == 0)
|
||||
return;
|
||||
|
||||
@@ -972,7 +972,7 @@ public:
|
||||
writeUint32Big(0);
|
||||
} else {
|
||||
auto it = str.begin();
|
||||
for (atInt32 i = 0; i < fixedLen; ++i) {
|
||||
for (int32_t i = 0; i < fixedLen; ++i) {
|
||||
char32_t chr;
|
||||
if (it == str.end())
|
||||
chr = 0;
|
||||
@@ -984,15 +984,15 @@ public:
|
||||
}
|
||||
void writeValBig(std::u32string_view val) { writeU32StringBig(val); }
|
||||
|
||||
void fill(atUint8 val, atUint64 length) {
|
||||
void fill(uint8_t val, uint64_t length) {
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
const std::vector<atUint8> tmp(length, val);
|
||||
const std::vector<uint8_t> tmp(length, val);
|
||||
writeUBytes(tmp.data(), length);
|
||||
}
|
||||
|
||||
void fill(atInt8 val, atUint64 length) { fill((atUint8)val, length); }
|
||||
void fill(int8_t val, uint64_t length) { fill((uint8_t)val, length); }
|
||||
|
||||
/** @brief Performs automatic std::vector enumeration writes using numeric type T
|
||||
* @param vector The std::vector read from when writing data
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
|
||||
MCFile();
|
||||
|
||||
static atUint8* unscramble(atUint8* data, atUint64 length);
|
||||
static uint8_t* unscramble(uint8_t* data, uint64_t length);
|
||||
|
||||
private:
|
||||
MCSlot* m_slots[3];
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
* \param data The existing buffer
|
||||
* \param length The length of the existing buffer
|
||||
*/
|
||||
MCFileReader(atUint8*, atUint64);
|
||||
MCFileReader(uint8_t*, uint64_t);
|
||||
|
||||
/*!
|
||||
* \brief This constructor creates an instance from a file on disk.
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
* \param data The existing buffer
|
||||
* \param length The length of the existing buffer
|
||||
*/
|
||||
MCFileWriter(atUint8*, atUint64);
|
||||
MCFileWriter(uint8_t*, uint64_t);
|
||||
|
||||
/*!
|
||||
* \brief This constructor creates an instance from a file on disk.
|
||||
@@ -40,10 +40,10 @@ public:
|
||||
*/
|
||||
void writeFile(MCFile* file);
|
||||
|
||||
static atUint16 calculateChecksum(atUint8* data, atUint32 length);
|
||||
static uint16_t calculateChecksum(uint8_t* data, uint32_t length);
|
||||
|
||||
private:
|
||||
atUint16 calculateSlotChecksum(atUint32 game);
|
||||
uint16_t calculateSlotChecksum(uint32_t game);
|
||||
};
|
||||
|
||||
} // namespace io
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace athena {
|
||||
class MCSlot : public ZQuestFile {
|
||||
public:
|
||||
MCSlot(std::unique_ptr<atUint8[]>&& data, atUint32 length);
|
||||
MCSlot(std::unique_ptr<uint8_t[]>&& data, uint32_t length);
|
||||
};
|
||||
|
||||
} // namespace athena
|
||||
|
||||
@@ -28,26 +28,26 @@ public:
|
||||
* \param takeOwnership Memory will be freed with the reader if set.
|
||||
* \param globalErr Whether or not global errors are enabled.
|
||||
*/
|
||||
explicit MemoryReader(const void* data, atUint64 length, bool takeOwnership = false, bool globalErr = true);
|
||||
explicit MemoryReader(const void* data, uint64_t length, bool takeOwnership = false, bool globalErr = true);
|
||||
|
||||
/*! \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(atInt64 position, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
void seek(int64_t position, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
|
||||
/*! \brief Returns the current position in the stream.
|
||||
*
|
||||
* \return Int64 The current position in the stream.
|
||||
*/
|
||||
atUint64 position() const override { return m_position; }
|
||||
uint64_t position() const override { return m_position; }
|
||||
|
||||
/*! \brief Returns whether or not the stream is at the end.
|
||||
*
|
||||
* \return bool True if at end; False otherwise.
|
||||
*/
|
||||
atUint64 length() const override { return m_length; }
|
||||
uint64_t length() const override { return m_length; }
|
||||
|
||||
/*! \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
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
* \param takeOwnership Memory will be freed with the reader if set
|
||||
* \throw IOException
|
||||
*/
|
||||
void setData(const atUint8* data, atUint64 length, bool takeOwnership = false);
|
||||
void setData(const uint8_t* data, uint64_t length, bool takeOwnership = false);
|
||||
|
||||
/*! \brief Returns a copy of the current buffer.<br />
|
||||
* Changes to the copy do not affect the buffer so it's perfectly safe to
|
||||
@@ -68,19 +68,19 @@ public:
|
||||
* as Stream now owns the address, this is done to keep memory usage down.
|
||||
* \return Uint8* The copy of the buffer.
|
||||
*/
|
||||
atUint8* data() const;
|
||||
uint8_t* data() const;
|
||||
|
||||
/*! \brief Reads a specified number of bytes to user-allocated buffer
|
||||
* \param buf User-allocated buffer pointer
|
||||
* \param len Length to read
|
||||
* \return Number of bytes read
|
||||
*/
|
||||
atUint64 readUBytesToBuf(void* buf, atUint64 len) override;
|
||||
uint64_t readUBytesToBuf(void* buf, uint64_t len) override;
|
||||
|
||||
protected:
|
||||
const void* m_data = nullptr;
|
||||
atUint64 m_length = 0;
|
||||
atUint64 m_position = 0;
|
||||
uint64_t m_length = 0;
|
||||
uint64_t m_position = 0;
|
||||
bool m_owns = false;
|
||||
bool m_globalErr = true;
|
||||
};
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
* \param data The existing buffer
|
||||
* \param length The length of the existing buffer
|
||||
*/
|
||||
explicit MemoryCopyReader(const void* data, atUint64 length);
|
||||
explicit MemoryCopyReader(const void* data, uint64_t length);
|
||||
|
||||
/*! \brief This constructor creates an instance from a file on disk.
|
||||
*
|
||||
@@ -100,11 +100,11 @@ public:
|
||||
*/
|
||||
explicit MemoryCopyReader(const std::string& filename) : m_filepath(filename) { loadData(); }
|
||||
|
||||
void setData(const atUint8* data, atUint64 length);
|
||||
void setData(const uint8_t* data, uint64_t length);
|
||||
|
||||
protected:
|
||||
void loadData();
|
||||
std::unique_ptr<atUint8[]> m_dataCopy;
|
||||
std::unique_ptr<uint8_t[]> m_dataCopy;
|
||||
std::string m_filepath; //!< Path to the target file
|
||||
};
|
||||
|
||||
|
||||
@@ -26,26 +26,26 @@ public:
|
||||
* @param takeOwnership Whether or not this writer takes ownership of the supplied data buffer.
|
||||
* If true, the buffer will be deleted by this when the destructor executes.
|
||||
*/
|
||||
explicit MemoryWriter(atUint8* data, atUint64 length, bool takeOwnership = false);
|
||||
explicit MemoryWriter(uint8_t* data, uint64_t length, bool takeOwnership = false);
|
||||
|
||||
/*! @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(atInt64 position, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
void seek(int64_t position, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
|
||||
/*! @brief Returns the current position in the stream.
|
||||
*
|
||||
* @return Int64 The current position in the stream.
|
||||
*/
|
||||
atUint64 position() const override { return m_position; }
|
||||
uint64_t position() const override { return m_position; }
|
||||
|
||||
/*! @brief Returns the length of the stream.
|
||||
*
|
||||
* @return Int64 The length of the stream.
|
||||
*/
|
||||
atUint64 length() const override { return m_length; }
|
||||
uint64_t length() const override { return m_length; }
|
||||
|
||||
bool isOpen() const { return true; }
|
||||
|
||||
@@ -54,14 +54,14 @@ public:
|
||||
* @param length The length of the new buffer.
|
||||
* @param takeOwnership Whether the Stream now owns the buffer.
|
||||
*/
|
||||
void setData(atUint8* data, atUint64 length, bool takeOwnership = false);
|
||||
void setData(uint8_t* data, uint64_t length, bool takeOwnership = false);
|
||||
|
||||
/*! @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 />
|
||||
* @return Uint8* The copy of the buffer.
|
||||
*/
|
||||
atUint8* data() const;
|
||||
uint8_t* data() const;
|
||||
|
||||
/*! @brief Sets the target file
|
||||
*
|
||||
@@ -87,13 +87,13 @@ public:
|
||||
* @param data The buffer to write
|
||||
* @param length The amount to write
|
||||
*/
|
||||
void writeUBytes(const atUint8* data, atUint64 length) override;
|
||||
void writeUBytes(const uint8_t* data, uint64_t length) override;
|
||||
|
||||
protected:
|
||||
MemoryWriter() = default;
|
||||
atUint8* m_data = nullptr;
|
||||
atUint64 m_length = 0;
|
||||
atUint64 m_position = 0;
|
||||
uint8_t* m_data = nullptr;
|
||||
uint64_t m_length = 0;
|
||||
uint64_t m_position = 0;
|
||||
bool m_bufferOwned = false;
|
||||
std::string m_filepath; //!< Path to the target file
|
||||
};
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
* @param data The existing buffer
|
||||
* @param length The length of the existing buffer
|
||||
*/
|
||||
explicit MemoryCopyWriter(atUint8* data = nullptr, atUint64 length = 0x10);
|
||||
explicit MemoryCopyWriter(uint8_t* data = nullptr, uint64_t length = 0x10);
|
||||
|
||||
/*! @brief This constructor creates an instance from a file on disk.
|
||||
*
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
* @param position where in the buffer to seek
|
||||
* @param origin The Origin to seek @sa SeekOrigin
|
||||
*/
|
||||
void seek(atInt64 position, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
void seek(int64_t position, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
|
||||
/*! @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
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
* @param length The length of the new buffer.
|
||||
* @throw IOException
|
||||
*/
|
||||
void setData(const atUint8* data, atUint64 length);
|
||||
void setData(const uint8_t* data, uint64_t 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.
|
||||
@@ -137,13 +137,13 @@ public:
|
||||
* @param data The buffer to write
|
||||
* @param length The amount to write
|
||||
*/
|
||||
void writeUBytes(const atUint8* data, atUint64 length) override;
|
||||
void writeUBytes(const uint8_t* data, uint64_t length) override;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<atUint8[]> m_dataCopy;
|
||||
std::unique_ptr<uint8_t[]> m_dataCopy;
|
||||
|
||||
private:
|
||||
void resize(atUint64 newSize);
|
||||
void resize(uint64_t newSize);
|
||||
};
|
||||
|
||||
} // namespace athena::io
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
~SkywardSwordFile();
|
||||
|
||||
void addQuest(SkywardSwordQuest* q);
|
||||
SkywardSwordQuest* quest(atUint32 id);
|
||||
SkywardSwordQuest* quest(uint32_t id);
|
||||
std::vector<SkywardSwordQuest*> questList() const;
|
||||
|
||||
void setRegion(Region region);
|
||||
@@ -29,7 +29,7 @@ private:
|
||||
Region m_region;
|
||||
// A vector is a bit overkill
|
||||
std::vector<SkywardSwordQuest*> m_quests;
|
||||
atUint32 m_numQuests;
|
||||
uint32_t m_numQuests;
|
||||
};
|
||||
|
||||
} // namespace athena
|
||||
|
||||
@@ -7,7 +7,7 @@ class SkywardSwordFile;
|
||||
namespace io {
|
||||
class SkywardSwordFileReader : public MemoryCopyReader {
|
||||
public:
|
||||
SkywardSwordFileReader(atUint8* data, atUint64 length);
|
||||
SkywardSwordFileReader(uint8_t* data, uint64_t length);
|
||||
SkywardSwordFileReader(const std::string& filename);
|
||||
|
||||
SkywardSwordFile* read();
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace io {
|
||||
|
||||
class SkywardSwordFileWriter : public MemoryCopyWriter {
|
||||
public:
|
||||
SkywardSwordFileWriter(atUint8* data, atUint64 len);
|
||||
SkywardSwordFileWriter(uint8_t* data, uint64_t len);
|
||||
SkywardSwordFileWriter(const std::string& filename);
|
||||
|
||||
void write(SkywardSwordFile* file);
|
||||
|
||||
@@ -11,40 +11,40 @@ class SkywardSwordQuest : public ZQuestFile {
|
||||
public:
|
||||
enum AmmoType { Arrows, Bombs, Seeds };
|
||||
|
||||
SkywardSwordQuest(std::unique_ptr<atUint8[]>&& data, atUint32 len);
|
||||
SkywardSwordQuest(std::unique_ptr<uint8_t[]>&& data, uint32_t len);
|
||||
|
||||
void setPlayerName(const std::string& name);
|
||||
std::string playerName() const;
|
||||
|
||||
void setRupeeCount(atUint16 value);
|
||||
atUint16 rupeeCount();
|
||||
void setAmmoCount(AmmoType type, atUint32 count);
|
||||
atUint32 ammoCount(AmmoType type);
|
||||
void setMaxHP(atUint16 val);
|
||||
atUint16 maxHP();
|
||||
void setRupeeCount(uint16_t value);
|
||||
uint16_t rupeeCount();
|
||||
void setAmmoCount(AmmoType type, uint32_t count);
|
||||
uint32_t ammoCount(AmmoType type);
|
||||
void setMaxHP(uint16_t val);
|
||||
uint16_t maxHP();
|
||||
float maxHearts();
|
||||
void setSpawnHP(atUint16 val);
|
||||
atUint16 spawnHP();
|
||||
void setSpawnHP(uint16_t val);
|
||||
uint16_t spawnHP();
|
||||
float spawnHearts();
|
||||
void setCurrentHP(atUint16 val);
|
||||
atUint16 currentHP();
|
||||
void setCurrentHP(uint16_t val);
|
||||
uint16_t currentHP();
|
||||
float currentHearts();
|
||||
std::string currentLocation();
|
||||
std::string currentArea();
|
||||
std::string currentLocationCopy();
|
||||
|
||||
void setSkipData(std::unique_ptr<atUint8[]>&& data);
|
||||
atUint8* skipData() const;
|
||||
void setSkipData(std::unique_ptr<uint8_t[]>&& data);
|
||||
uint8_t* skipData() const;
|
||||
|
||||
atUint32 slotChecksum();
|
||||
atUint32 skipChecksum();
|
||||
uint32_t slotChecksum();
|
||||
uint32_t skipChecksum();
|
||||
void fixChecksums();
|
||||
|
||||
void setNew(bool isNew);
|
||||
bool isNew() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<atUint8[]> m_skipData;
|
||||
std::unique_ptr<uint8_t[]> m_skipData;
|
||||
};
|
||||
|
||||
} // namespace athena
|
||||
|
||||
@@ -30,23 +30,23 @@ public:
|
||||
int stateId(int index) const;
|
||||
void setStateIds(std::vector<int> ids);
|
||||
std::vector<int> stateIds() const;
|
||||
atUint32 stateCount() const;
|
||||
void setCurrentState(atUint32 id);
|
||||
atUint32 currentState() const;
|
||||
uint32_t stateCount() const;
|
||||
void setCurrentState(uint32_t id);
|
||||
uint32_t currentState() const;
|
||||
|
||||
bool addFrame(SpriteFrame* Frame);
|
||||
bool removeFrame(SpriteFrame* Frame);
|
||||
SpriteFrame* Frame(atUint32 id);
|
||||
void setFrame(atUint32 id);
|
||||
SpriteFrame* Frame(uint32_t id);
|
||||
void setFrame(uint32_t id);
|
||||
void setFrames(std::vector<SpriteFrame*> frames);
|
||||
atUint32 frameCount() const;
|
||||
uint32_t frameCount() const;
|
||||
|
||||
std::vector<SpriteFrame*> frames() const;
|
||||
|
||||
SpriteFile* container() const;
|
||||
|
||||
void setCurrentFrame(SpriteFrame* frame);
|
||||
void setCurrentFrame(atUint32 id);
|
||||
void setCurrentFrame(uint32_t id);
|
||||
SpriteFrame* currentFrame() const;
|
||||
|
||||
void advanceFrame();
|
||||
@@ -61,8 +61,8 @@ private:
|
||||
Vector2Df m_position;
|
||||
std::vector<int> m_stateIds; //!< Stores the texture id's for each state.
|
||||
std::vector<SpriteFrame*> m_frames;
|
||||
atUint32 m_currentState;
|
||||
atUint32 m_currentFrame;
|
||||
uint32_t m_currentState;
|
||||
uint32_t m_currentFrame;
|
||||
};
|
||||
|
||||
} // namespace athena::Sakura
|
||||
|
||||
@@ -19,32 +19,32 @@ public:
|
||||
/*!
|
||||
* \brief Major
|
||||
*/
|
||||
static const atUint32 Major;
|
||||
static const uint32_t Major;
|
||||
|
||||
/*!
|
||||
* \brief Minor
|
||||
*/
|
||||
static const atUint32 Minor;
|
||||
static const uint32_t Minor;
|
||||
|
||||
/*!
|
||||
* \brief Revision
|
||||
*/
|
||||
static const atUint32 Revision;
|
||||
static const uint32_t Revision;
|
||||
|
||||
/*!
|
||||
* \brief Patch
|
||||
*/
|
||||
static const atUint32 Build;
|
||||
static const uint32_t Build;
|
||||
|
||||
/*!
|
||||
* \brief Version
|
||||
*/
|
||||
static const atUint32 Version;
|
||||
static const uint32_t Version;
|
||||
|
||||
/*!
|
||||
* \brief Magic
|
||||
*/
|
||||
static const atUint32 Magic;
|
||||
static const uint32_t Magic;
|
||||
|
||||
/*!
|
||||
* \brief SSprite
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
* \param originX
|
||||
* \param originY
|
||||
*/
|
||||
SpriteFile(atUint32 width, atUint32 height, float originX, float originY);
|
||||
SpriteFile(uint32_t width, uint32_t height, float originX, float originY);
|
||||
|
||||
/*!
|
||||
* \brief SSpriteFile
|
||||
@@ -84,7 +84,7 @@ public slots:
|
||||
* \param width
|
||||
* \param height
|
||||
*/
|
||||
void setSize(atUint32 width, atUint32 height);
|
||||
void setSize(uint32_t width, uint32_t height);
|
||||
|
||||
/*!
|
||||
* \brief setSize
|
||||
@@ -102,13 +102,13 @@ public slots:
|
||||
* \brief width
|
||||
* \return
|
||||
*/
|
||||
atUint32 width() const;
|
||||
uint32_t width() const;
|
||||
|
||||
/*!
|
||||
* \brief height
|
||||
* \return
|
||||
*/
|
||||
atUint32 height() const;
|
||||
uint32_t height() const;
|
||||
|
||||
/*!
|
||||
* \brief setOrigin
|
||||
@@ -158,10 +158,10 @@ public slots:
|
||||
* \param id
|
||||
* \return
|
||||
*/
|
||||
STexture* texture(atUint32 id);
|
||||
STexture* texture(uint32_t id);
|
||||
std::vector<STexture*> textures() const;
|
||||
|
||||
atUint32 textureCount() const;
|
||||
uint32_t textureCount() const;
|
||||
/*!
|
||||
* \brief setTextures
|
||||
* \param textures
|
||||
@@ -177,7 +177,7 @@ public slots:
|
||||
Sprite* sprite(const std::string& name);
|
||||
std::unordered_map<std::string, Sprite*> sprites() const;
|
||||
|
||||
atUint32 spriteCount() const;
|
||||
uint32_t spriteCount() const;
|
||||
|
||||
private:
|
||||
std::vector<STexture*> m_textures;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace io {
|
||||
|
||||
class SpriteFileReader : public MemoryCopyReader {
|
||||
public:
|
||||
SpriteFileReader(atUint8* data, atUint64 length);
|
||||
SpriteFileReader(uint8_t* data, uint64_t length);
|
||||
SpriteFileReader(const std::string& filepath);
|
||||
|
||||
Sakura::SpriteFile* readFile();
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace io {
|
||||
|
||||
class SpriteFileWriter : public MemoryCopyWriter {
|
||||
public:
|
||||
SpriteFileWriter(atUint8* data, atUint64 length);
|
||||
SpriteFileWriter(uint8_t* data, uint64_t length);
|
||||
|
||||
SpriteFileWriter(std::string_view filepath);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
void setParts(std::vector<SpritePart*> parts);
|
||||
std::vector<SpritePart*> parts() const;
|
||||
|
||||
atUint32 partCount() const;
|
||||
uint32_t partCount() const;
|
||||
|
||||
void setRoot(Sprite* root);
|
||||
Sprite* root() const;
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
* \param width
|
||||
* \param height
|
||||
*/
|
||||
void setSize(atUint32 width, atUint32 height);
|
||||
void setSize(uint32_t width, uint32_t height);
|
||||
|
||||
/*!
|
||||
* \brief setSize
|
||||
@@ -105,6 +105,6 @@ private:
|
||||
Vector2Di m_size;
|
||||
bool m_flippedH;
|
||||
bool m_flippedV;
|
||||
atUint32 m_frameIndex;
|
||||
uint32_t m_frameIndex;
|
||||
};
|
||||
} // namespace athena::Sakura
|
||||
|
||||
@@ -3,15 +3,6 @@
|
||||
#include <cinttypes>
|
||||
#include <cstdint>
|
||||
|
||||
using atInt8 = std::int8_t;
|
||||
using atUint8 = std::uint8_t;
|
||||
using atInt16 = std::int16_t;
|
||||
using atUint16 = std::uint16_t;
|
||||
using atInt32 = std::int32_t;
|
||||
using atUint32 = std::uint32_t;
|
||||
using atInt64 = std::int64_t;
|
||||
using atUint64 = std::uint64_t;
|
||||
|
||||
// Vector types
|
||||
#include "simd/simd.hpp"
|
||||
struct atVec2f {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "athena/Types.hpp"
|
||||
|
||||
namespace athena::utility {
|
||||
inline bool isEmpty(atInt8* buf, atUint32 size) { return !std::memcmp(buf, buf + 1, size - 1); }
|
||||
inline bool isEmpty(int8_t* buf, uint32_t size) { return !std::memcmp(buf, buf + 1, size - 1); }
|
||||
#if _WIN32
|
||||
constexpr bool isSystemBigEndian() { return false; }
|
||||
#else
|
||||
@@ -25,7 +25,7 @@ constexpr ::athena::Endian NotSystemEndian = isSystemBigEndian() ? ::athena::End
|
||||
#define BSWAP_CONSTEXPR constexpr
|
||||
#endif
|
||||
|
||||
BSWAP_CONSTEXPR atInt16 swap16(atInt16 val) {
|
||||
BSWAP_CONSTEXPR int16_t swap16(int16_t val) {
|
||||
#if __GNUC__
|
||||
return __builtin_bswap16(val);
|
||||
#elif _MSC_VER
|
||||
@@ -34,8 +34,8 @@ BSWAP_CONSTEXPR atInt16 swap16(atInt16 val) {
|
||||
return (val = (val << 8) | ((val >> 8) & 0xFF));
|
||||
#endif
|
||||
}
|
||||
BSWAP_CONSTEXPR atUint16 swapU16(atUint16 val) { return (atUint16)swap16(val); }
|
||||
BSWAP_CONSTEXPR atInt32 swap32(atInt32 val) {
|
||||
BSWAP_CONSTEXPR uint16_t swapU16(uint16_t val) { return (uint16_t)swap16(val); }
|
||||
BSWAP_CONSTEXPR int32_t swap32(int32_t val) {
|
||||
#if __GNUC__
|
||||
return __builtin_bswap32(val);
|
||||
#elif _MSC_VER
|
||||
@@ -46,8 +46,8 @@ BSWAP_CONSTEXPR atInt32 swap32(atInt32 val) {
|
||||
return val;
|
||||
#endif
|
||||
}
|
||||
BSWAP_CONSTEXPR atUint32 swapU32(atUint32 val) { return (atUint32)swap32(val); }
|
||||
BSWAP_CONSTEXPR atInt64 swap64(atInt64 val) {
|
||||
BSWAP_CONSTEXPR uint32_t swapU32(uint32_t val) { return (uint32_t)swap32(val); }
|
||||
BSWAP_CONSTEXPR int64_t swap64(int64_t val) {
|
||||
#if __GNUC__
|
||||
return __builtin_bswap64(val);
|
||||
#elif _MSC_VER
|
||||
@@ -60,90 +60,90 @@ BSWAP_CONSTEXPR atInt64 swap64(atInt64 val) {
|
||||
(((atInt64)(val)&0x000000000000FF00ULL) << 40) | (((atInt64)(val)&0x00000000000000FFULL) << 56))));
|
||||
#endif
|
||||
}
|
||||
BSWAP_CONSTEXPR atUint64 swapU64(atUint64 val) { return (atUint64)swap64(val); }
|
||||
BSWAP_CONSTEXPR uint64_t swapU64(uint64_t val) { return (uint64_t)swap64(val); }
|
||||
BSWAP_CONSTEXPR float swapFloat(float val) {
|
||||
union { float f; atInt32 i; } uval1 = {val};
|
||||
union { atInt32 i; float f; } uval2 = {swap32(uval1.i)};
|
||||
union { float f; int32_t i; } uval1 = {val};
|
||||
union { int32_t i; float f; } uval2 = {swap32(uval1.i)};
|
||||
return uval2.f;
|
||||
}
|
||||
BSWAP_CONSTEXPR double swapDouble(double val) {
|
||||
union { double f; atInt64 i; } uval1 = {val};
|
||||
union { atInt64 i; double f; } uval2 = {swap64(uval1.i)};
|
||||
union { double f; int64_t i; } uval1 = {val};
|
||||
union { int64_t i; double f; } uval2 = {swap64(uval1.i)};
|
||||
return uval2.f;
|
||||
}
|
||||
BSWAP_CONSTEXPR atInt16 LittleInt16(atInt16& val) {
|
||||
BSWAP_CONSTEXPR int16_t LittleInt16(int16_t& val) {
|
||||
if constexpr (athena::utility::isSystemBigEndian())
|
||||
val = athena::utility::swap16(val);
|
||||
|
||||
return val;
|
||||
}
|
||||
BSWAP_CONSTEXPR atUint16 LittleUint16(atUint16& val) {
|
||||
atInt16 ret = val;
|
||||
BSWAP_CONSTEXPR uint16_t LittleUint16(uint16_t& val) {
|
||||
int16_t ret = val;
|
||||
LittleInt16(ret);
|
||||
val = ret;
|
||||
|
||||
return val;
|
||||
}
|
||||
BSWAP_CONSTEXPR atInt16 BigInt16(atInt16& val) {
|
||||
BSWAP_CONSTEXPR int16_t BigInt16(int16_t& val) {
|
||||
if constexpr (!athena::utility::isSystemBigEndian())
|
||||
val = athena::utility::swap16(val);
|
||||
|
||||
return val;
|
||||
}
|
||||
BSWAP_CONSTEXPR atUint16 BigUint16(atUint16& val) {
|
||||
atInt16 ret = val;
|
||||
BSWAP_CONSTEXPR uint16_t BigUint16(uint16_t& val) {
|
||||
int16_t ret = val;
|
||||
BigInt16(ret);
|
||||
val = ret;
|
||||
|
||||
return val;
|
||||
}
|
||||
BSWAP_CONSTEXPR atInt32 LittleInt32(atInt32& val) {
|
||||
BSWAP_CONSTEXPR int32_t LittleInt32(int32_t& val) {
|
||||
if constexpr (athena::utility::isSystemBigEndian())
|
||||
val = athena::utility::swap32(val);
|
||||
|
||||
return val;
|
||||
}
|
||||
BSWAP_CONSTEXPR atUint32 LittleUint32(atUint32& val) {
|
||||
atInt32 ret = val;
|
||||
BSWAP_CONSTEXPR uint32_t LittleUint32(uint32_t& val) {
|
||||
int32_t ret = val;
|
||||
LittleInt32(ret);
|
||||
val = ret;
|
||||
|
||||
return val;
|
||||
}
|
||||
BSWAP_CONSTEXPR atInt32 BigInt32(atInt32& val) {
|
||||
BSWAP_CONSTEXPR int32_t BigInt32(int32_t& val) {
|
||||
if constexpr (!athena::utility::isSystemBigEndian())
|
||||
val = athena::utility::swap32(val);
|
||||
|
||||
return val;
|
||||
}
|
||||
BSWAP_CONSTEXPR atUint32 BigUint32(atUint32& val) {
|
||||
atInt32 ret = val;
|
||||
BSWAP_CONSTEXPR uint32_t BigUint32(uint32_t& val) {
|
||||
int32_t ret = val;
|
||||
BigInt32(ret);
|
||||
val = ret;
|
||||
|
||||
return val;
|
||||
}
|
||||
BSWAP_CONSTEXPR atInt64 LittleInt64(atInt64& val) {
|
||||
BSWAP_CONSTEXPR int64_t LittleInt64(int64_t& val) {
|
||||
if constexpr (athena::utility::isSystemBigEndian())
|
||||
val = athena::utility::swap64(val);
|
||||
|
||||
return val;
|
||||
}
|
||||
BSWAP_CONSTEXPR atUint64 LittleUint64(atUint64& val) {
|
||||
atInt64 ret = val;
|
||||
BSWAP_CONSTEXPR uint64_t LittleUint64(uint64_t& val) {
|
||||
int64_t ret = val;
|
||||
LittleInt64(ret);
|
||||
val = ret;
|
||||
|
||||
return val;
|
||||
}
|
||||
BSWAP_CONSTEXPR atInt64 BigInt64(atInt64& val) {
|
||||
BSWAP_CONSTEXPR int64_t BigInt64(int64_t& val) {
|
||||
if constexpr (!athena::utility::isSystemBigEndian())
|
||||
val = athena::utility::swap64(val);
|
||||
|
||||
return val;
|
||||
}
|
||||
BSWAP_CONSTEXPR atUint64 BigUint64(atUint64& val) {
|
||||
atInt64 ret = val;
|
||||
BSWAP_CONSTEXPR uint64_t BigUint64(uint64_t& val) {
|
||||
int64_t ret = val;
|
||||
BigInt64(ret);
|
||||
val = ret;
|
||||
|
||||
@@ -175,9 +175,9 @@ BSWAP_CONSTEXPR double BigDouble(double val) {
|
||||
return val;
|
||||
}
|
||||
|
||||
void fillRandom(atUint8* rndArea, atUint64 count);
|
||||
void fillRandom(uint8_t* rndArea, uint64_t count);
|
||||
std::vector<std::string> split(std::string_view s, char delim);
|
||||
atUint64 rand64();
|
||||
uint64_t rand64();
|
||||
std::string join(const std::vector<std::string>& elems, std::string_view delims);
|
||||
void tolower(std::string& str);
|
||||
void toupper(std::string& str);
|
||||
@@ -193,9 +193,9 @@ std::string& rtrim(std::string& s);
|
||||
|
||||
// trim from both ends
|
||||
std::string& trim(std::string& s);
|
||||
atUint64 fileSize(std::string_view filename);
|
||||
uint64_t fileSize(std::string_view filename);
|
||||
#ifdef _WIN32
|
||||
atUint64 fileSize(std::wstring_view filename);
|
||||
uint64_t fileSize(std::wstring_view filename);
|
||||
#endif
|
||||
|
||||
std::string wideToUtf8(std::wstring_view src);
|
||||
|
||||
@@ -22,19 +22,19 @@ public:
|
||||
* @param position where in the buffer to seek
|
||||
* @param origin The Origin to seek @sa SeekOrigin
|
||||
*/
|
||||
void seek(atInt64 position, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
void seek(int64_t position, SeekOrigin origin = SeekOrigin::Current) override;
|
||||
|
||||
/*! @brief Returns the current position in the stream.
|
||||
*
|
||||
* @return Int64 The current position in the stream.
|
||||
*/
|
||||
atUint64 position() const override { return m_position; }
|
||||
uint64_t position() const override { return m_position; }
|
||||
|
||||
/*! @brief Returns the length of the stream.
|
||||
*
|
||||
* @return Int64 The length of the stream.
|
||||
*/
|
||||
atUint64 length() const override { return m_data.size(); }
|
||||
uint64_t length() const override { return m_data.size(); }
|
||||
|
||||
bool isOpen() const { return true; }
|
||||
|
||||
@@ -48,11 +48,11 @@ public:
|
||||
* @param data The buffer to write
|
||||
* @param length The amount to write
|
||||
*/
|
||||
void writeUBytes(const atUint8* data, atUint64 length) override;
|
||||
void writeUBytes(const uint8_t* data, uint64_t length) override;
|
||||
|
||||
protected:
|
||||
std::vector<uint8_t> m_data;
|
||||
atUint64 m_position = 0;
|
||||
uint64_t m_position = 0;
|
||||
};
|
||||
|
||||
} // namespace athena::io
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
* \param m_banner
|
||||
* \param icons
|
||||
*/
|
||||
WiiBanner(atUint32 gameId, const std::u16string& title, const std::u16string& subtitle, WiiImage* m_banner,
|
||||
WiiBanner(uint32_t gameId, const std::u16string& title, const std::u16string& subtitle, WiiImage* m_banner,
|
||||
std::vector<WiiImage*> icons);
|
||||
virtual ~WiiBanner();
|
||||
|
||||
@@ -35,13 +35,13 @@ public:
|
||||
* \brief setGameID
|
||||
* \param id
|
||||
*/
|
||||
void setGameID(atUint64 id);
|
||||
void setGameID(uint64_t id);
|
||||
|
||||
/*!
|
||||
* \brief gameID
|
||||
* \return
|
||||
*/
|
||||
atUint64 gameID() const;
|
||||
uint64_t gameID() const;
|
||||
|
||||
/*!
|
||||
* \brief setBannerImage
|
||||
@@ -59,13 +59,13 @@ public:
|
||||
* \brief setBannerSize
|
||||
* \param size
|
||||
*/
|
||||
void setBannerSize(atUint32 size);
|
||||
void setBannerSize(uint32_t size);
|
||||
|
||||
/*!
|
||||
* \brief bannerSize
|
||||
* \return
|
||||
*/
|
||||
atUint32 bannerSize() const;
|
||||
uint32_t bannerSize() const;
|
||||
|
||||
/*!
|
||||
* \brief setTitle
|
||||
@@ -102,14 +102,14 @@ public:
|
||||
* \param id
|
||||
* \param icon
|
||||
*/
|
||||
void setIcon(atUint32 id, WiiImage* icon);
|
||||
void setIcon(uint32_t id, WiiImage* icon);
|
||||
|
||||
/*!
|
||||
* \brief getIcon
|
||||
* \param id
|
||||
* \return
|
||||
*/
|
||||
WiiImage* getIcon(atUint32 id) const;
|
||||
WiiImage* getIcon(uint32_t id) const;
|
||||
|
||||
/*!
|
||||
* \brief icons
|
||||
@@ -121,46 +121,46 @@ public:
|
||||
* \brief setAnimationSpeed
|
||||
* \param animSpeed
|
||||
*/
|
||||
void setAnimationSpeed(atUint16 animSpeed);
|
||||
void setAnimationSpeed(uint16_t animSpeed);
|
||||
|
||||
/*!
|
||||
* \brief animationSpeed
|
||||
* \return
|
||||
*/
|
||||
atUint16 animationSpeed() const;
|
||||
uint16_t animationSpeed() const;
|
||||
|
||||
/*!
|
||||
* \brief setPermissions
|
||||
* \param permissions
|
||||
*/
|
||||
void setPermissions(atUint8 permissions);
|
||||
void setPermissions(uint8_t permissions);
|
||||
|
||||
/*!
|
||||
* \brief permissions
|
||||
* \return
|
||||
*/
|
||||
atUint8 permissions() const;
|
||||
uint8_t permissions() const;
|
||||
|
||||
/*!
|
||||
* \brief setFlags
|
||||
* \param flags
|
||||
*/
|
||||
void setFlags(atUint32 flags);
|
||||
void setFlags(uint32_t flags);
|
||||
|
||||
/*!
|
||||
* \brief flags
|
||||
* \return
|
||||
*/
|
||||
atUint32 flags() const;
|
||||
uint32_t flags() const;
|
||||
|
||||
protected:
|
||||
private:
|
||||
atUint64 m_gameId;
|
||||
uint64_t m_gameId;
|
||||
WiiImage* m_banner;
|
||||
atUint32 m_animSpeed;
|
||||
atUint8 m_permissions;
|
||||
atUint32 m_flags;
|
||||
atUint32 m_bannerSize;
|
||||
uint32_t m_animSpeed;
|
||||
uint8_t m_permissions;
|
||||
uint32_t m_flags;
|
||||
uint32_t m_bannerSize;
|
||||
std::vector<WiiImage*> m_icons;
|
||||
std::u16string m_title;
|
||||
std::u16string m_subtitle;
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
|
||||
namespace athena {
|
||||
|
||||
const atUint8 SD_KEY[16] = {0xab, 0x01, 0xb9, 0xd8, 0xe1, 0x62, 0x2b, 0x08,
|
||||
const uint8_t SD_KEY[16] = {0xab, 0x01, 0xb9, 0xd8, 0xe1, 0x62, 0x2b, 0x08,
|
||||
0xaf, 0xba, 0xd8, 0x4d, 0xbf, 0xc2, 0xa5, 0x5d};
|
||||
const atUint8 SD_IV[16] = {0x21, 0x67, 0x12, 0xe6, 0xaa, 0x1f, 0x68, 0x9f,
|
||||
const uint8_t SD_IV[16] = {0x21, 0x67, 0x12, 0xe6, 0xaa, 0x1f, 0x68, 0x9f,
|
||||
0x95, 0xc5, 0xa2, 0x23, 0x24, 0xdc, 0x6a, 0x98};
|
||||
const atUint8 MD5_BLANKER[16] = {0x0e, 0x65, 0x37, 0x81, 0x99, 0xbe, 0x45, 0x17,
|
||||
const uint8_t MD5_BLANKER[16] = {0x0e, 0x65, 0x37, 0x81, 0x99, 0xbe, 0x45, 0x17,
|
||||
0xab, 0x06, 0xec, 0x22, 0x45, 0x1a, 0x57, 0x93};
|
||||
|
||||
/*! \class WiiFile
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
* \param data
|
||||
* \param length
|
||||
*/
|
||||
WiiFile(const std::string& filename, atUint8 permissions, const atUint8* data, atUint32 length);
|
||||
WiiFile(const std::string& filename, uint8_t permissions, const uint8_t* data, uint32_t length);
|
||||
virtual ~WiiFile();
|
||||
|
||||
/*!
|
||||
@@ -78,12 +78,12 @@ public:
|
||||
* \brief setData
|
||||
* \param data
|
||||
*/
|
||||
void setData(const atUint8* data);
|
||||
void setData(const uint8_t* data);
|
||||
/*!
|
||||
* \brief data
|
||||
* \return
|
||||
*/
|
||||
atUint8* data() const;
|
||||
uint8_t* data() const;
|
||||
|
||||
/*!
|
||||
* \brief setLength
|
||||
@@ -101,25 +101,25 @@ public:
|
||||
* \brief setPermissions
|
||||
* \param permissions
|
||||
*/
|
||||
void setPermissions(const atUint8 permissions);
|
||||
void setPermissions(const uint8_t permissions);
|
||||
|
||||
/*!
|
||||
* \brief permissions
|
||||
* \return
|
||||
*/
|
||||
atUint8 permissions() const;
|
||||
uint8_t permissions() const;
|
||||
|
||||
/*!
|
||||
* \brief setAttributes
|
||||
* \param attr
|
||||
*/
|
||||
void setAttributes(const atUint8 attr);
|
||||
void setAttributes(const uint8_t attr);
|
||||
|
||||
/*!
|
||||
* \brief attributes
|
||||
* \return
|
||||
*/
|
||||
atUint8 attributes() const;
|
||||
uint8_t attributes() const;
|
||||
|
||||
/*!
|
||||
* \brief setType
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
* \brief fileCount
|
||||
* \return
|
||||
*/
|
||||
atUint32 fileCount();
|
||||
uint32_t fileCount();
|
||||
|
||||
/*!
|
||||
* \brief allChildren
|
||||
@@ -204,12 +204,12 @@ public:
|
||||
|
||||
protected:
|
||||
private:
|
||||
atUint8 m_permissions;
|
||||
atUint8 m_attributes;
|
||||
uint8_t m_permissions;
|
||||
uint8_t m_attributes;
|
||||
Type m_type;
|
||||
std::string m_filename;
|
||||
int m_fileLen;
|
||||
atUint8* m_fileData;
|
||||
uint8_t* m_fileData;
|
||||
WiiFile* m_parent;
|
||||
std::vector<WiiFile*> m_children;
|
||||
};
|
||||
|
||||
@@ -20,54 +20,54 @@ public:
|
||||
* \param height
|
||||
* \param data
|
||||
*/
|
||||
WiiImage(atUint32 width, atUint32 height, std::unique_ptr<atUint8[]>&& data);
|
||||
WiiImage(uint32_t width, uint32_t height, std::unique_ptr<uint8_t[]>&& data);
|
||||
|
||||
/*!
|
||||
* \brief setWidth
|
||||
* \param width
|
||||
*/
|
||||
void setWidth(const atUint32 width);
|
||||
void setWidth(const uint32_t width);
|
||||
|
||||
/*!
|
||||
* \brief width
|
||||
* \return
|
||||
*/
|
||||
atUint32 width() const;
|
||||
uint32_t width() const;
|
||||
|
||||
/*!
|
||||
* \brief setHeight
|
||||
* \param height
|
||||
*/
|
||||
void setHeight(const atUint32 height);
|
||||
void setHeight(const uint32_t height);
|
||||
|
||||
/*!
|
||||
* \brief height
|
||||
* \return
|
||||
*/
|
||||
atUint32 height() const;
|
||||
uint32_t height() const;
|
||||
|
||||
/*!
|
||||
* \brief setData
|
||||
* \param data
|
||||
*/
|
||||
void setData(const atUint8* data);
|
||||
void setData(const uint8_t* data);
|
||||
|
||||
/*!
|
||||
* \brief data
|
||||
* \return
|
||||
*/
|
||||
atUint8* data();
|
||||
uint8_t* data();
|
||||
|
||||
/*!
|
||||
* \brief toRGBA
|
||||
* \return
|
||||
*/
|
||||
atUint8* toRGBA();
|
||||
uint8_t* toRGBA();
|
||||
|
||||
private:
|
||||
atUint32 m_width;
|
||||
atUint32 m_height;
|
||||
std::unique_ptr<atUint8[]> m_data;
|
||||
uint32_t m_width;
|
||||
uint32_t m_height;
|
||||
std::unique_ptr<uint8_t[]> m_data;
|
||||
};
|
||||
|
||||
} // namespace athena
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
*/
|
||||
WiiFile* file(const std::string& filename);
|
||||
|
||||
atUint32 fileCount() const;
|
||||
uint32_t fileCount() const;
|
||||
/*!
|
||||
* \brief fileList
|
||||
* \return
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
* \param data The existing buffer
|
||||
* \param length The length of the existing buffer
|
||||
*/
|
||||
WiiSaveReader(const atUint8*, atUint64);
|
||||
WiiSaveReader(const uint8_t*, uint64_t);
|
||||
|
||||
/*! \brief This constructor creates an instance from a file on disk.
|
||||
*
|
||||
@@ -42,8 +42,8 @@ public:
|
||||
private:
|
||||
WiiBanner* readBanner();
|
||||
WiiFile* readFile();
|
||||
WiiImage* readImage(atUint32 width, atUint32 height);
|
||||
void readCerts(atUint32 totalSize);
|
||||
WiiImage* readImage(uint32_t width, uint32_t height);
|
||||
void readCerts(uint32_t totalSize);
|
||||
WiiFile* buildTree(std::vector<WiiFile*> files);
|
||||
};
|
||||
|
||||
|
||||
@@ -36,14 +36,14 @@ public:
|
||||
* \param filepath
|
||||
* \return
|
||||
*/
|
||||
bool writeSave(WiiSave* save, atUint8* macAddress, atUint32 ngId, atUint8* ngPriv, atUint8* ngSig, atUint32 ngKeyId,
|
||||
bool writeSave(WiiSave* save, uint8_t* macAddress, uint32_t ngId, uint8_t* ngPriv, uint8_t* ngSig, uint32_t ngKeyId,
|
||||
const std::string& filepath = "");
|
||||
|
||||
private:
|
||||
void writeBanner(WiiBanner* banner);
|
||||
atUint32 writeFile(WiiFile* file);
|
||||
uint32_t writeFile(WiiFile* file);
|
||||
void writeImage(WiiImage* image);
|
||||
void writeCerts(atUint32 filesSize, atUint32 ngId, atUint8* ngPriv, atUint8* ngSig, atUint32 ngKeyId);
|
||||
void writeCerts(uint32_t filesSize, uint32_t ngId, uint8_t* ngPriv, uint8_t* ngSig, uint32_t ngKeyId);
|
||||
};
|
||||
|
||||
} // namespace io
|
||||
|
||||
@@ -18,24 +18,24 @@ public:
|
||||
/*!
|
||||
* \brief The current major version of the ZQuest format
|
||||
*/
|
||||
static const atUint32 Major;
|
||||
static const uint32_t Major;
|
||||
/*!
|
||||
* \brief The current minor version of the ZQuest format
|
||||
*/
|
||||
static const atUint32 Minor;
|
||||
static const uint32_t Minor;
|
||||
/*!
|
||||
* \brief The current revision of the ZQuest format
|
||||
*/
|
||||
static const atUint32 Revision;
|
||||
static const uint32_t Revision;
|
||||
/*!
|
||||
* \brief The current version of the ZQuest format
|
||||
*/
|
||||
static const atUint32 Version;
|
||||
static const uint32_t Version;
|
||||
|
||||
/*!
|
||||
* \brief The magic number used to identify the file e.g. "ZQS1"
|
||||
*/
|
||||
static const atUint32 Magic;
|
||||
static const uint32_t Magic;
|
||||
|
||||
/*!
|
||||
* \enum Game
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
* \param data
|
||||
* \param length
|
||||
*/
|
||||
ZQuestFile(Game game, Endian endian, std::unique_ptr<atUint8[]>&& data, atUint32 length,
|
||||
ZQuestFile(Game game, Endian endian, std::unique_ptr<uint8_t[]>&& data, uint32_t length,
|
||||
const std::string& gameString = std::string());
|
||||
|
||||
/*!
|
||||
@@ -111,19 +111,19 @@ public:
|
||||
* \param data The data to assign
|
||||
* \param length The length of the data
|
||||
*/
|
||||
void setData(std::unique_ptr<atUint8[]>&& data, atUint32 length);
|
||||
void setData(std::unique_ptr<uint8_t[]>&& data, uint32_t length);
|
||||
|
||||
/*!
|
||||
* \brief data
|
||||
* \return
|
||||
*/
|
||||
atUint8* data() const;
|
||||
uint8_t* data() const;
|
||||
|
||||
/*!
|
||||
* \brief length
|
||||
* \return
|
||||
*/
|
||||
atUint32 length() const;
|
||||
uint32_t length() const;
|
||||
|
||||
void setGameString(const std::string& gameString);
|
||||
/*!
|
||||
@@ -138,8 +138,8 @@ protected:
|
||||
Game m_game;
|
||||
std::string m_gameString;
|
||||
Endian m_endian;
|
||||
std::unique_ptr<atUint8[]> m_data;
|
||||
atUint32 m_length;
|
||||
std::unique_ptr<uint8_t[]> m_data;
|
||||
uint32_t m_length;
|
||||
|
||||
// Game strings support
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
* \param data
|
||||
* \param length
|
||||
*/
|
||||
ZQuestFileReader(atUint8* data, atUint64 length);
|
||||
ZQuestFileReader(uint8_t* data, uint64_t length);
|
||||
|
||||
/*!
|
||||
* \brief ZQuestFileReader
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
* \param data
|
||||
* \param length
|
||||
*/
|
||||
ZQuestFileWriter(atUint8* data, atUint64 length);
|
||||
ZQuestFileWriter(uint8_t* data, uint64_t length);
|
||||
|
||||
/*!
|
||||
* \brief ZQuestFileWriter
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
#include "athena/Types.hpp"
|
||||
namespace bignum {
|
||||
int compare(const atUint8* a, const atUint8* b, atUint32 n);
|
||||
void subModulus(atUint8* a, const atUint8* N, atUint32 n);
|
||||
void add(atUint8* d, atUint8* a, const atUint8* b, const atUint8* N, atUint32 n);
|
||||
void mul(atUint8* d, atUint8* a, const atUint8* b, const atUint8* N, atUint32 n);
|
||||
void exp(atUint8* d, const atUint8* a, const atUint8* N, atUint32 n, atUint8* e, atUint32 en);
|
||||
void inv(atUint8* d, atUint8* a, const atUint8* N, atUint32 n);
|
||||
int compare(const uint8_t* a, const uint8_t* b, uint32_t n);
|
||||
void subModulus(uint8_t* a, const uint8_t* N, uint32_t n);
|
||||
void add(uint8_t* d, uint8_t* a, const uint8_t* b, const uint8_t* N, uint32_t n);
|
||||
void mul(uint8_t* d, uint8_t* a, const uint8_t* b, const uint8_t* N, uint32_t n);
|
||||
void exp(uint8_t* d, const uint8_t* a, const uint8_t* N, uint32_t n, uint8_t* e, uint32_t en);
|
||||
void inv(uint8_t* d, uint8_t* a, const uint8_t* N, uint32_t n);
|
||||
} // namespace bignum
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "athena/Types.hpp"
|
||||
|
||||
namespace ecc {
|
||||
void checkEC(atUint8* ng, atUint8* ap, atUint8* sig, atUint8* sigHash, bool& apValid, bool& ngValid);
|
||||
void makeECCert(atUint8* cert, atUint8* sig, const char* signer, const char* name, atUint8* priv, atUint32 keyId);
|
||||
void createECDSA(atUint8* R, atUint8* S, atUint8* k, atUint8* hash);
|
||||
void checkEC(uint8_t* ng, uint8_t* ap, uint8_t* sig, uint8_t* sigHash, bool& apValid, bool& ngValid);
|
||||
void makeECCert(uint8_t* cert, uint8_t* sig, const char* signer, const char* name, uint8_t* priv, uint32_t keyId);
|
||||
void createECDSA(uint8_t* R, uint8_t* S, uint8_t* k, uint8_t* hash);
|
||||
} // namespace ecc
|
||||
|
||||
@@ -37,7 +37,7 @@ void SHA1Input(SHA1Context*,
|
||||
|
||||
|
||||
|
||||
atUint8* getSha1(atUint8* stuff, atUint32 stuff_size);
|
||||
uint8_t* getSha1(uint8_t* stuff, uint32_t stuff_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user