mirror of
https://github.com/libAthena/athena.git
synced 2025-12-16 00:17:05 +00:00
* Fix merge
This commit is contained in:
@@ -337,7 +337,8 @@ public:
|
||||
* \brief setCrystals
|
||||
* \param val
|
||||
*/
|
||||
void setCrystals(ALTTPCrystals val);\
|
||||
void setCrystals(ALTTPCrystals val);
|
||||
\
|
||||
|
||||
/*!
|
||||
* \brief crystals
|
||||
|
||||
@@ -26,34 +26,34 @@ namespace Athena
|
||||
|
||||
struct ALTTPRoomFlags
|
||||
{
|
||||
bool Chest1:1;
|
||||
bool Chest2:1;
|
||||
bool Chest3:1;
|
||||
bool Chest4:1;
|
||||
bool Quadrant1:1;
|
||||
bool Quadrant2:1;
|
||||
bool Quadrant3:1;
|
||||
bool Quadrant4:1;
|
||||
bool Door1:1;
|
||||
bool Door2:1;
|
||||
bool Door3:1;
|
||||
bool Door4:1;
|
||||
bool BossBattleWon:1;
|
||||
bool Key:1;
|
||||
bool KeyOrChest:1;
|
||||
bool ChestOrTile:1;
|
||||
bool Chest1: 1;
|
||||
bool Chest2: 1;
|
||||
bool Chest3: 1;
|
||||
bool Chest4: 1;
|
||||
bool Quadrant1: 1;
|
||||
bool Quadrant2: 1;
|
||||
bool Quadrant3: 1;
|
||||
bool Quadrant4: 1;
|
||||
bool Door1: 1;
|
||||
bool Door2: 1;
|
||||
bool Door3: 1;
|
||||
bool Door4: 1;
|
||||
bool BossBattleWon: 1;
|
||||
bool Key: 1;
|
||||
bool KeyOrChest: 1;
|
||||
bool ChestOrTile: 1;
|
||||
};
|
||||
|
||||
struct ALTTPOverworldEvent
|
||||
{
|
||||
bool Unused1:1;
|
||||
bool HeartPiece:1;
|
||||
bool Overlay:1;
|
||||
bool Unused2:1;
|
||||
bool Unused3:1;
|
||||
bool Unused4:1;
|
||||
bool Set:1;
|
||||
bool Unused5:1;
|
||||
bool Unused1: 1;
|
||||
bool HeartPiece: 1;
|
||||
bool Overlay: 1;
|
||||
bool Unused2: 1;
|
||||
bool Unused3: 1;
|
||||
bool Unused4: 1;
|
||||
bool Set: 1;
|
||||
bool Unused5: 1;
|
||||
};
|
||||
|
||||
struct ALTTPInventory
|
||||
@@ -93,14 +93,14 @@ struct ALTTPInventory
|
||||
*/
|
||||
struct ALTTPLightDarkWorldIndicator
|
||||
{
|
||||
bool Unused1:1;
|
||||
bool Unused2:1;
|
||||
bool Unused3:1;
|
||||
bool Unused4:1;
|
||||
bool Unused5:1;
|
||||
bool Unused6:1;
|
||||
bool IsDarkWorld:1;
|
||||
bool Unused7:1;
|
||||
bool Unused1: 1;
|
||||
bool Unused2: 1;
|
||||
bool Unused3: 1;
|
||||
bool Unused4: 1;
|
||||
bool Unused5: 1;
|
||||
bool Unused6: 1;
|
||||
bool IsDarkWorld: 1;
|
||||
bool Unused7: 1;
|
||||
};
|
||||
|
||||
|
||||
@@ -110,14 +110,14 @@ struct ALTTPDungeonItemFlags
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool Unused1:1;
|
||||
bool Unused2:1;
|
||||
bool GanonsTower:1;
|
||||
bool TurtleRock:1;
|
||||
bool GargoylesDomain:1;
|
||||
bool TowerOfHera:1;
|
||||
bool IcePalace:1;
|
||||
bool SkullWoods:1;
|
||||
bool Unused1: 1;
|
||||
bool Unused2: 1;
|
||||
bool GanonsTower: 1;
|
||||
bool TurtleRock: 1;
|
||||
bool GargoylesDomain: 1;
|
||||
bool TowerOfHera: 1;
|
||||
bool IcePalace: 1;
|
||||
bool SkullWoods: 1;
|
||||
};
|
||||
atUint8 flags1;
|
||||
};
|
||||
@@ -126,14 +126,14 @@ struct ALTTPDungeonItemFlags
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool MiseryMire:1;
|
||||
bool DarkPalace:1;
|
||||
bool SwampPalace:1;
|
||||
bool HyruleCastle2:1; // unused in orignal game
|
||||
bool DesertPalace:1;
|
||||
bool EasternPalace:1;
|
||||
bool HyruleCastle:1; // unused exist in original game
|
||||
bool SewerPassage:1; // unused exist in original game
|
||||
bool MiseryMire: 1;
|
||||
bool DarkPalace: 1;
|
||||
bool SwampPalace: 1;
|
||||
bool HyruleCastle2: 1; // unused in orignal game
|
||||
bool DesertPalace: 1;
|
||||
bool EasternPalace: 1;
|
||||
bool HyruleCastle: 1; // unused exist in original game
|
||||
bool SewerPassage: 1; // unused exist in original game
|
||||
};
|
||||
atUint8 flags2;
|
||||
};
|
||||
@@ -141,75 +141,75 @@ struct ALTTPDungeonItemFlags
|
||||
|
||||
struct ALTTPPendants
|
||||
{
|
||||
bool Courage:1;
|
||||
bool Wisdom:1;
|
||||
bool Power:1;
|
||||
bool Unused1:1;
|
||||
bool Unused2:1;
|
||||
bool Unused3:1;
|
||||
bool Unused4:1;
|
||||
bool Unused5:1;
|
||||
bool Courage: 1;
|
||||
bool Wisdom: 1;
|
||||
bool Power: 1;
|
||||
bool Unused1: 1;
|
||||
bool Unused2: 1;
|
||||
bool Unused3: 1;
|
||||
bool Unused4: 1;
|
||||
bool Unused5: 1;
|
||||
};
|
||||
|
||||
struct ALTTPAbilities
|
||||
{
|
||||
bool Nothing:1; //?
|
||||
bool Swim:1;
|
||||
bool Dash:1;
|
||||
bool Pull:1;
|
||||
bool Unknown1:1; //---
|
||||
bool Talk:1;
|
||||
bool Read:1;
|
||||
bool Unknown2:1; //---
|
||||
bool Nothing: 1; //?
|
||||
bool Swim: 1;
|
||||
bool Dash: 1;
|
||||
bool Pull: 1;
|
||||
bool Unknown1: 1; //---
|
||||
bool Talk: 1;
|
||||
bool Read: 1;
|
||||
bool Unknown2: 1; //---
|
||||
};
|
||||
|
||||
struct ALTTPCrystals
|
||||
{
|
||||
bool MiseryMire:1;
|
||||
bool DarkPalace:1;
|
||||
bool IcePalace:1;
|
||||
bool TurtleRock:1;
|
||||
bool SwampPalace:1;
|
||||
bool GargoyleDomain:1;
|
||||
bool SkullWoods:1;
|
||||
bool MiseryMire: 1;
|
||||
bool DarkPalace: 1;
|
||||
bool IcePalace: 1;
|
||||
bool TurtleRock: 1;
|
||||
bool SwampPalace: 1;
|
||||
bool GargoyleDomain: 1;
|
||||
bool SkullWoods: 1;
|
||||
};
|
||||
|
||||
struct ALTTPMagicUsage
|
||||
{
|
||||
bool Normal:1;
|
||||
bool Half:1;
|
||||
bool Quarter:1;
|
||||
bool Unused1:1;
|
||||
bool Unused2:1;
|
||||
bool Unused3:1;
|
||||
bool Unused4:1;
|
||||
bool Unused5:1;
|
||||
bool Normal: 1;
|
||||
bool Half: 1;
|
||||
bool Quarter: 1;
|
||||
bool Unused1: 1;
|
||||
bool Unused2: 1;
|
||||
bool Unused3: 1;
|
||||
bool Unused4: 1;
|
||||
bool Unused5: 1;
|
||||
};
|
||||
|
||||
|
||||
struct ALTTPProgressFlags1
|
||||
{
|
||||
bool UncleSecretPassage:1;
|
||||
bool DyingPriest:1; //?
|
||||
bool ZeldaSanctuary:1; //?
|
||||
bool Unused1:1;
|
||||
bool UncleLeftHouse:1;
|
||||
bool BookOfMudora:1;//? Math says it's a guess need to investigate
|
||||
bool DwarfPartner:1; //?
|
||||
bool Unused2:1;
|
||||
bool UncleSecretPassage: 1;
|
||||
bool DyingPriest: 1; //?
|
||||
bool ZeldaSanctuary: 1; //?
|
||||
bool Unused1: 1;
|
||||
bool UncleLeftHouse: 1;
|
||||
bool BookOfMudora: 1; //? Math says it's a guess need to investigate
|
||||
bool DwarfPartner: 1; //?
|
||||
bool Unused2: 1;
|
||||
};
|
||||
|
||||
|
||||
struct ALTTPProgressFlags2
|
||||
{
|
||||
bool BottleFromBum:1;
|
||||
bool BottleFromSalesMen:1;
|
||||
bool Unused1:1; //?
|
||||
bool FluteBoy:1;
|
||||
bool ThiefsChest:1;
|
||||
bool SavedSmithPartner:1;
|
||||
bool Unused2:1; //?
|
||||
bool SmithsHaveSword:1;
|
||||
bool BottleFromBum: 1;
|
||||
bool BottleFromSalesMen: 1;
|
||||
bool Unused1: 1; //?
|
||||
bool FluteBoy: 1;
|
||||
bool ThiefsChest: 1;
|
||||
bool SavedSmithPartner: 1;
|
||||
bool Unused2: 1; //?
|
||||
bool SmithsHaveSword: 1;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ public:
|
||||
m_message(message),
|
||||
m_file(file),
|
||||
m_function(function),
|
||||
m_line(line)
|
||||
m_line(line),
|
||||
m_exceptionName("Exception")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -54,7 +55,7 @@ public:
|
||||
*/
|
||||
inline std::string message() const
|
||||
{
|
||||
return m_message;
|
||||
return m_exceptionName + (m_message.empty() ? "" : ": " + m_message);
|
||||
}
|
||||
|
||||
inline std::string file() const
|
||||
@@ -74,28 +75,57 @@ public:
|
||||
|
||||
inline std::string formattedMessage() const
|
||||
{
|
||||
return Athena::utility::sprintf("%s : %s (%i) %s", m_file.c_str(), m_function.c_str(), m_line, m_message.c_str());
|
||||
return Athena::utility::sprintf("%s : %s (%i) %s", m_file.c_str(), m_function.c_str(), m_line, message().c_str());
|
||||
}
|
||||
protected:
|
||||
std::string m_message; //!< The error message string
|
||||
std::string m_file;
|
||||
std::string m_function;
|
||||
int m_line;
|
||||
std::string m_exceptionName;
|
||||
};
|
||||
} // error
|
||||
} // Athena
|
||||
#ifdef _MSC_VER
|
||||
#define THROW_EXCEPTION(args,...) \
|
||||
do { \
|
||||
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__); \
|
||||
do { \
|
||||
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); return; \
|
||||
} else { std::string msg = Athena::utility::sprintf(__VA_ARGS__); \
|
||||
throw Athena::error::Exception(std::string("Exception: ")+msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} while(0)
|
||||
} \
|
||||
} while(0)
|
||||
#elif defined(__GNUC__)
|
||||
#define THROW_EXCEPTION(args...) \
|
||||
do { \
|
||||
do { \
|
||||
if (atGetExceptionHandler()) { atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args); return; \
|
||||
} else { \
|
||||
std::string msg = Athena::utility::sprintf(args); \
|
||||
throw Athena::error::Exception(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define THROW_EXCEPTION_RETURN(ret, args,...) \
|
||||
do { \
|
||||
if (atGetExceptionHandler()) \
|
||||
{ \
|
||||
atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); \
|
||||
return ret; \
|
||||
} else { \
|
||||
std::string msg = Athena::utility::sprintf(__VA_ARGS__); \
|
||||
throw Athena::error::Exception(std::string("Exception: ")+msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} while(0)
|
||||
} \
|
||||
} while(0)
|
||||
#elif defined(__GNUC__)
|
||||
#define THROW_EXCEPTION_RETURN(ret, args...) \
|
||||
do { \
|
||||
if (atGetExceptionHandler()) { atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args); return ret; \
|
||||
} else { \
|
||||
std::string msg = Athena::utility::sprintf(args); \
|
||||
throw Athena::error::Exception(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#endif // EXCEPTION_HPP
|
||||
|
||||
@@ -39,7 +39,9 @@ public:
|
||||
inline FileNotFoundException(const std::string& filename, const std::string& file, const std::string& function, const int line) :
|
||||
Exception(std::string("FileNotFoundException: Could not find file \"") + filename + std::string("\", please check that it exists."), file, function, line),
|
||||
m_filename(filename)
|
||||
{}
|
||||
{
|
||||
m_exceptionName = "FileNotFoundException";
|
||||
}
|
||||
|
||||
/*! \brief Returns the path of the offending file.
|
||||
* \return std::string The filename of the file including the path.
|
||||
@@ -51,7 +53,31 @@ private:
|
||||
} // error
|
||||
} // Athena
|
||||
|
||||
#ifndef THROW_FILE_NOT_FOUND_EXCEPTION
|
||||
#define THROW_FILE_NOT_FOUND_EXCEPTION(msg) \
|
||||
do { throw Athena::error::FileNotFoundException(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); } while(0)
|
||||
do { \
|
||||
if (atGetExceptionHandler()) \
|
||||
{ \
|
||||
atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, msg); \
|
||||
return; \
|
||||
} \
|
||||
else \
|
||||
throw Athena::error::FileNotFoundException(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THROW_FILE_NOT_FOUND_EXCEPTION_RETURN
|
||||
#define THROW_FILE_NOT_FOUND_EXCEPTION_RETURN(ret, msg) \
|
||||
do { \
|
||||
if (atGetExceptionHandler()) \
|
||||
{ \
|
||||
atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, msg); \
|
||||
return ret; \
|
||||
} \
|
||||
else \
|
||||
throw Athena::error::FileNotFoundException(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
|
||||
#endif // FILENOTFOUNDEXCEPTION_HPP
|
||||
|
||||
@@ -42,21 +42,21 @@ public:
|
||||
atUint64 position() const;
|
||||
atUint64 length() const;
|
||||
|
||||
void writeBit (bool val);
|
||||
void seekBit (int bit);
|
||||
void writeUByte (atUint8 val);
|
||||
void writeByte (atInt8 val);
|
||||
void writeBit(bool val);
|
||||
void seekBit(int bit);
|
||||
void writeUByte(atUint8 val);
|
||||
void writeByte(atInt8 val);
|
||||
void writeUBytes(atUint8* data, atUint64 len);
|
||||
void writeBytes (atInt8* data, atUint64 len);
|
||||
void writeBytes(atInt8* data, atUint64 len);
|
||||
void writeUint16(atUint16 val);
|
||||
void writeInt16 (atInt16 val);
|
||||
void writeInt16(atInt16 val);
|
||||
void writeUint32(atUint32 val);
|
||||
void writeInt32 (atInt32 val);
|
||||
void writeInt32(atInt32 val);
|
||||
void writeUint64(atUint64 val);
|
||||
void writeInt64 (atInt64 val);
|
||||
void writeInt64(atInt64 val);
|
||||
void writeDouble(double val);
|
||||
void writeFloat (float val);
|
||||
void writeBool (bool val);
|
||||
void writeFloat(float val);
|
||||
void writeBool(bool val);
|
||||
void writeString(const std::string& val);
|
||||
void writeUnicode(const std::string& str);
|
||||
void fill(atInt8 byte, atUint64 len);
|
||||
|
||||
@@ -107,6 +107,11 @@ typedef Vector2D<float> Vector2Df;
|
||||
#endif // ATHENA_NO_SAKURA
|
||||
} // Athena
|
||||
|
||||
typedef void (*atEXCEPTION_HANDLER)(const std::string& file, const std::string& function, int line, const std::string&, ...);
|
||||
|
||||
atEXCEPTION_HANDLER atGetExceptionHandler();
|
||||
void atSetExceptionHandler(atEXCEPTION_HANDLER func);
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Athena::SeekOrigin& origin);
|
||||
std::ostream& operator<<(std::ostream& os, const Athena::Endian& endian);
|
||||
#endif // GLOBAL_HPP
|
||||
|
||||
@@ -41,7 +41,9 @@ public:
|
||||
*/
|
||||
inline IOException(const std::string& message, const std::string& file, const std::string& function, const int line) :
|
||||
Exception(message, file, function, line)
|
||||
{}
|
||||
{
|
||||
m_exceptionName = "IOException";
|
||||
}
|
||||
};
|
||||
|
||||
} // error
|
||||
@@ -50,14 +52,45 @@ public:
|
||||
#ifdef _MSC_VER
|
||||
#define THROW_IO_EXCEPTION(args, ...) \
|
||||
do { \
|
||||
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__); \
|
||||
throw Athena::error::IOException(std::string("IOException: ")+msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} while(0)
|
||||
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); return; \
|
||||
} else {
|
||||
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__);
|
||||
\
|
||||
throw Athena::error::IOException(std::string("IOException: ") + msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__);
|
||||
\
|
||||
} \
|
||||
|
||||
} while (0)
|
||||
#elif defined(__GNUC__)
|
||||
#define THROW_IO_EXCEPTION(args...) \
|
||||
do { \
|
||||
std::string msg = Athena::utility::sprintf(args); \
|
||||
throw Athena::error::IOException(std::string("IOException: ")+msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args); return; \
|
||||
} else { std::string msg = Athena::utility::sprintf(args); \
|
||||
throw Athena::error::IOException(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define THROW_IO_EXCEPTION_RETURN(ret, args, ...) \
|
||||
do { \
|
||||
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); return ret; \
|
||||
} else {
|
||||
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__);
|
||||
|
||||
\
|
||||
throw Athena::error::IOException(std::string("IOException: ") + msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__);
|
||||
\
|
||||
} \
|
||||
|
||||
} while (0)
|
||||
#elif defined(__GNUC__)
|
||||
#define THROW_IO_EXCEPTION_RETURN(ret, args...) \
|
||||
do { \
|
||||
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args); return ret; \
|
||||
} else { std::string msg = Athena::utility::sprintf(args); \
|
||||
throw Athena::error::IOException(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,15 +31,15 @@ public:
|
||||
virtual ~IStream() {}
|
||||
|
||||
virtual void setEndian(Endian) = 0;
|
||||
virtual Endian endian() const= 0;
|
||||
virtual bool isBigEndian() const= 0;
|
||||
virtual bool isLittleEndian()const= 0;
|
||||
virtual bool isOpen() const= 0;
|
||||
virtual void seek(atInt64, SeekOrigin)=0;
|
||||
virtual bool atEnd() const= 0;
|
||||
virtual atUint64 position() const= 0;
|
||||
virtual atUint64 length() const= 0;
|
||||
virtual void seekBit (int)=0;
|
||||
virtual Endian endian() const = 0;
|
||||
virtual bool isBigEndian() const = 0;
|
||||
virtual bool isLittleEndian()const = 0;
|
||||
virtual bool isOpen() const = 0;
|
||||
virtual void seek(atInt64, SeekOrigin) = 0;
|
||||
virtual bool atEnd() const = 0;
|
||||
virtual atUint64 position() const = 0;
|
||||
virtual atUint64 length() const = 0;
|
||||
virtual void seekBit(int) = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,34 +12,34 @@ class IStreamReader : public IStream
|
||||
public:
|
||||
virtual ~IStreamReader() {}
|
||||
virtual void setEndian(Endian) = 0;
|
||||
virtual Endian endian() const= 0;
|
||||
virtual bool isBigEndian() const= 0;
|
||||
virtual bool isLittleEndian()const= 0;
|
||||
virtual bool isOpen() const= 0;
|
||||
virtual void seek(atInt64, SeekOrigin)=0;
|
||||
virtual void seekAlign32()=0;
|
||||
virtual bool atEnd() const= 0;
|
||||
virtual atUint64 position() const= 0;
|
||||
virtual atUint64 length() const= 0;
|
||||
virtual void seekBit (int)=0;
|
||||
virtual bool readBit()=0;
|
||||
virtual atUint8 readUByte()=0;
|
||||
virtual atInt8 readByte()=0;
|
||||
virtual atUint8* readUBytes(atUint64)=0;
|
||||
virtual atInt8* readBytes(atUint64)=0;
|
||||
virtual atUint64 readUBytesToBuf(void*, atUint64)=0;
|
||||
virtual atUint64 readBytesToBuf(void*, atUint64)=0;
|
||||
virtual atUint16 readUint16()=0;
|
||||
virtual atInt16 readInt16()=0;
|
||||
virtual atUint32 readUint32()=0;
|
||||
virtual atInt32 readInt32()=0;
|
||||
virtual atUint64 readUint64()=0;
|
||||
virtual atInt64 readInt64()=0;
|
||||
virtual double readDouble()=0;
|
||||
virtual float readFloat()=0;
|
||||
virtual bool readBool()=0;
|
||||
virtual std::string readUnicode(atInt32=-1)=0;
|
||||
virtual std::string readString(atInt32=-1)=0;
|
||||
virtual Endian endian() const = 0;
|
||||
virtual bool isBigEndian() const = 0;
|
||||
virtual bool isLittleEndian()const = 0;
|
||||
virtual bool isOpen() const = 0;
|
||||
virtual void seek(atInt64, SeekOrigin) = 0;
|
||||
virtual void seekAlign32() = 0;
|
||||
virtual bool atEnd() const = 0;
|
||||
virtual atUint64 position() const = 0;
|
||||
virtual atUint64 length() const = 0;
|
||||
virtual void seekBit(int) = 0;
|
||||
virtual bool readBit() = 0;
|
||||
virtual atUint8 readUByte() = 0;
|
||||
virtual atInt8 readByte() = 0;
|
||||
virtual atUint8* readUBytes(atUint64) = 0;
|
||||
virtual atInt8* readBytes(atUint64) = 0;
|
||||
virtual atUint64 readUBytesToBuf(void*, atUint64) = 0;
|
||||
virtual atUint64 readBytesToBuf(void*, atUint64) = 0;
|
||||
virtual atUint16 readUint16() = 0;
|
||||
virtual atInt16 readInt16() = 0;
|
||||
virtual atUint32 readUint32() = 0;
|
||||
virtual atInt32 readInt32() = 0;
|
||||
virtual atUint64 readUint64() = 0;
|
||||
virtual atInt64 readInt64() = 0;
|
||||
virtual double readDouble() = 0;
|
||||
virtual float readFloat() = 0;
|
||||
virtual bool readBool() = 0;
|
||||
virtual std::string readUnicode(atInt32 = -1) = 0;
|
||||
virtual std::string readString(atInt32 = -1) = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,34 +12,34 @@ class IStreamWriter : public IStream
|
||||
public:
|
||||
virtual ~IStreamWriter() {}
|
||||
virtual void setEndian(Endian) = 0;
|
||||
virtual Endian endian() const= 0;
|
||||
virtual bool isBigEndian() const= 0;
|
||||
virtual bool isLittleEndian()const= 0;
|
||||
virtual bool isOpen() const= 0;
|
||||
virtual void seek(atInt64, SeekOrigin)=0;
|
||||
virtual void seekAlign32()=0;
|
||||
virtual bool atEnd() const= 0;
|
||||
virtual atUint64 position() const= 0;
|
||||
virtual atUint64 length() const= 0;
|
||||
virtual void seekBit (int)=0;
|
||||
virtual void writeBit (bool)=0;
|
||||
virtual void writeUByte (atUint8)=0;
|
||||
virtual void writeByte (atInt8)=0;
|
||||
virtual void writeUBytes(atUint8*, atUint64)=0;
|
||||
virtual void writeBytes (atInt8*, atUint64)=0;
|
||||
virtual void writeUint16(atUint16)=0;
|
||||
virtual void writeInt16 (atInt16)=0;
|
||||
virtual void writeUint32(atUint32)=0;
|
||||
virtual void writeInt32 (atInt32)=0;
|
||||
virtual void writeUint64(atUint64)=0;
|
||||
virtual void writeInt64 (atInt64)=0;
|
||||
virtual void writeDouble(double)=0;
|
||||
virtual void writeFloat (float)=0;
|
||||
virtual void writeBool (bool)=0;
|
||||
virtual void writeString(const std::string&)=0;
|
||||
virtual void writeUnicode(const std::string&)=0;
|
||||
virtual void fill(atUint8, atUint64)=0;
|
||||
virtual void fill(atInt8, atUint64)=0;
|
||||
virtual Endian endian() const = 0;
|
||||
virtual bool isBigEndian() const = 0;
|
||||
virtual bool isLittleEndian()const = 0;
|
||||
virtual bool isOpen() const = 0;
|
||||
virtual void seek(atInt64, SeekOrigin) = 0;
|
||||
virtual void seekAlign32() = 0;
|
||||
virtual bool atEnd() const = 0;
|
||||
virtual atUint64 position() const = 0;
|
||||
virtual atUint64 length() const = 0;
|
||||
virtual void seekBit(int) = 0;
|
||||
virtual void writeBit(bool) = 0;
|
||||
virtual void writeUByte(atUint8) = 0;
|
||||
virtual void writeByte(atInt8) = 0;
|
||||
virtual void writeUBytes(atUint8*, atUint64) = 0;
|
||||
virtual void writeBytes(atInt8*, atUint64) = 0;
|
||||
virtual void writeUint16(atUint16) = 0;
|
||||
virtual void writeInt16(atInt16) = 0;
|
||||
virtual void writeUint32(atUint32) = 0;
|
||||
virtual void writeInt32(atInt32) = 0;
|
||||
virtual void writeUint64(atUint64) = 0;
|
||||
virtual void writeInt64(atInt64) = 0;
|
||||
virtual void writeDouble(double) = 0;
|
||||
virtual void writeFloat(float) = 0;
|
||||
virtual void writeBool(bool) = 0;
|
||||
virtual void writeString(const std::string&) = 0;
|
||||
virtual void writeUnicode(const std::string&) = 0;
|
||||
virtual void fill(atUint8, atUint64) = 0;
|
||||
virtual void fill(atInt8, atUint64) = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,9 @@ class InvalidDataException : public Exception
|
||||
{
|
||||
public:
|
||||
inline InvalidDataException(const std::string& error, const std::string& file, const std::string& function, const int line)
|
||||
: Exception(error, file, function, line)
|
||||
: Exception(("InvalidDataException") + error, file, function, line)
|
||||
{
|
||||
m_exceptionName = "InvalidDataException";
|
||||
}
|
||||
};
|
||||
} // error
|
||||
@@ -46,14 +47,34 @@ public:
|
||||
#ifdef _MSC_VER
|
||||
#define THROW_INVALID_DATA_EXCEPTION(args, ...) \
|
||||
do { \
|
||||
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__); \
|
||||
throw Athena::error::InvalidDataException(std::string("InvalidDataException: ")+msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); return; } \
|
||||
else { std::string msg = Athena::utility::sprintf(args, __VA_ARGS__); \
|
||||
throw Athena::error::InvalidDataException(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} \
|
||||
} while(0)
|
||||
#elif defined(__GNUC__)
|
||||
#define THROW_INVALID_DATA_EXCEPTION(args...) \
|
||||
do { if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args); return; } \
|
||||
else { std::string msg = Athena::utility::sprintf(args); \
|
||||
throw Athena::error::InvalidDataException(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define THROW_INVALID_DATA_EXCEPTION(args, ...) \
|
||||
do { \
|
||||
std::string msg = Athena::utility::sprintf(args); \
|
||||
throw Athena::error::InvalidDataException(std::string("InvalidDataException: ")+msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); return; } \
|
||||
else { std::string msg = Athena::utility::sprintf(args, __VA_ARGS__); \
|
||||
throw Athena::error::InvalidDataException(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} \
|
||||
} while(0)
|
||||
#elif defined(__GNUC__)
|
||||
#define THROW_INVALID_DATA_EXCEPTION_RETURN(ret, args...) \
|
||||
do { if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args); return ret; } \
|
||||
else { std::string msg = Athena::utility::sprintf(args); \
|
||||
throw Athena::error::InvalidDataException(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
#endif // INVALIDDATAEXCEPTION_HPP
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
inline InvalidOperationException(const std::string& message, const std::string& file, const std::string& function, const int line) :
|
||||
Exception(message, file, function, line)
|
||||
{
|
||||
m_exceptionName = "InvalidOperationException";
|
||||
}
|
||||
};
|
||||
} // error
|
||||
@@ -50,14 +51,45 @@ public:
|
||||
#ifdef _MSC_VER
|
||||
#define THROW_INVALID_OPERATION_EXCEPTION(args, ...) \
|
||||
do { \
|
||||
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__); \
|
||||
throw Athena::error::InvalidOperationException(std::string("InvalidOperationException: ")+msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} while(0)
|
||||
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); return; \
|
||||
} else {
|
||||
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__);
|
||||
\
|
||||
throw Athena::error::InvalidOperationException(std::string("InvalidOperationException: ") + msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__);
|
||||
\
|
||||
} \
|
||||
|
||||
} while (0)
|
||||
#elif defined (__GNUC__)
|
||||
#define THROW_INVALID_OPERATION_EXCEPTION(args...) \
|
||||
do { \
|
||||
std::string msg = Athena::utility::sprintf(args); \
|
||||
throw Athena::error::InvalidOperationException(std::string("InvalidOperationException: ")+msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args); return; \
|
||||
} else { std::string msg = Athena::utility::sprintf(args); \
|
||||
throw Athena::error::InvalidOperationException(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define THROW_INVALID_OPERATION_EXCEPTIONRETURN(ret, args, ...) \
|
||||
do { \
|
||||
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); return ret; \
|
||||
} else {
|
||||
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__);
|
||||
|
||||
\
|
||||
throw Athena::error::InvalidOperationException(std::string("InvalidOperationException: ") + msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__);
|
||||
\
|
||||
} \
|
||||
|
||||
} while (0)
|
||||
#elif defined(__GNUC__)
|
||||
#define THROW_INVALID_OPERATION_EXCEPTION_RETURN(ret, args...) \
|
||||
do { \
|
||||
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args); return ret; \
|
||||
} else { std::string msg = Athena::utility::sprintf(args); \
|
||||
throw Athena::error::InvalidOperationException(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
#endif // INVALID_OPERATION_EXCEPTION_HPP
|
||||
|
||||
@@ -177,7 +177,7 @@ public:
|
||||
* \return Int8* The buffer at the current position from the given length.
|
||||
*/
|
||||
atUint8* readUBytes(atUint64 length);
|
||||
|
||||
|
||||
atUint64 readBytesToBuf(void* buf, atUint64 len) {return readUBytesToBuf(buf, len);}
|
||||
atUint64 readUBytesToBuf(void* buf, atUint64 len);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
* \param data The existing buffer
|
||||
* \param length The length of the existing buffer
|
||||
*/
|
||||
explicit MemoryWriter(atUint8* data = nullptr, atUint64 length=0x10);
|
||||
explicit MemoryWriter(atUint8* data = nullptr, atUint64 length = 0x10);
|
||||
|
||||
/*! \brief This constructor creates an instance from a file on disk.
|
||||
*
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
* \param origin The Origin to seek \sa SeekOrigin
|
||||
*/
|
||||
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
|
||||
|
||||
|
||||
/*! \brief Sets the buffers position relative to the next 32-byte aligned position.<br />
|
||||
*/
|
||||
inline void seekAlign32() {seek(ROUND_UP_32(m_position), SeekOrigin::Begin);}
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
*
|
||||
* \param filename If not empty, the filename to save to
|
||||
*/
|
||||
void save(const std::string& filename="");
|
||||
void save(const std::string& filename = "");
|
||||
|
||||
/*!
|
||||
* \brief Seeks to the specified bit within the current byte
|
||||
|
||||
@@ -27,12 +27,26 @@ class NotImplementedException : public Exception
|
||||
public:
|
||||
NotImplementedException(const std::string& message, const std::string& file, const std::string& function, const int line) :
|
||||
Exception(message, file, function, line)
|
||||
{}
|
||||
{
|
||||
m_exceptionName = "NotImplementedException";
|
||||
}
|
||||
};
|
||||
} // error
|
||||
} // Athena
|
||||
|
||||
#define THROW_NOT_IMPLEMENTED_EXCEPTION() \
|
||||
do { throw Athena::error::NotImplementedException("NotImplementedException", __FILE__, AT_PRETTY_FUNCTION, __LINE__); } while(0)
|
||||
do { \
|
||||
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, "NotImplementedException"); return; \
|
||||
} else { \
|
||||
throw Athena::error::NotImplementedException(std::string(), __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define THROW_NOT_IMPLEMENTED_EXCEPTION_RETURN(ret) \
|
||||
do { \
|
||||
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, "NotImplementedException"); return ret; \
|
||||
} else { \
|
||||
throw Athena::error::NotImplementedException(std::string(), __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif // NOTIMPLEMENTEDEXCEPTION_HPP
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#if !defined(ATHENA_NO_SAVES) && !defined(ATHENA_NO_ZQUEST)
|
||||
// This file is part of libAthena.
|
||||
//
|
||||
// libAthena is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libAthena is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with libAthena. If not, see <http://www.gnu.org/licenses/>
|
||||
// This file is part of libAthena.
|
||||
//
|
||||
// libAthena is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// libAthena is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with libAthena. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
#ifndef SKYWARDSWORDQUEST_HPP
|
||||
#define SKYWARDSWORDQUEST_HPP
|
||||
@@ -20,57 +20,57 @@
|
||||
#include "Athena/Global.hpp"
|
||||
#include "Athena/ZQuestFile.hpp"
|
||||
|
||||
namespace Athena
|
||||
{
|
||||
|
||||
// TODO: Handle game specific data
|
||||
class SkywardSwordQuest : public ZQuestFile
|
||||
{
|
||||
public:
|
||||
enum AmmoType
|
||||
namespace Athena
|
||||
{
|
||||
Arrows,
|
||||
Bombs,
|
||||
Seeds
|
||||
|
||||
// TODO: Handle game specific data
|
||||
class SkywardSwordQuest : public ZQuestFile
|
||||
{
|
||||
public:
|
||||
enum AmmoType
|
||||
{
|
||||
Arrows,
|
||||
Bombs,
|
||||
Seeds
|
||||
};
|
||||
|
||||
SkywardSwordQuest(atUint8* data, atUint32 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();
|
||||
float maxHearts();
|
||||
void setSpawnHP(atUint16 val);
|
||||
atUint16 spawnHP();
|
||||
float spawnHearts();
|
||||
void setCurrentHP(atUint16 val);
|
||||
atUint16 currentHP();
|
||||
float currentHearts();
|
||||
std::string currentLocation();
|
||||
std::string currentArea();
|
||||
std::string currentLocationCopy();
|
||||
|
||||
void setSkipData(const atUint8* data);
|
||||
atUint8* skipData() const;
|
||||
|
||||
|
||||
atUint32 slotChecksum();
|
||||
atUint32 skipChecksum();
|
||||
void fixChecksums();
|
||||
|
||||
void setNew(bool isNew);
|
||||
bool isNew() const;
|
||||
private:
|
||||
atUint8* m_skipData;
|
||||
};
|
||||
|
||||
SkywardSwordQuest(atUint8* data, atUint32 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();
|
||||
float maxHearts();
|
||||
void setSpawnHP(atUint16 val);
|
||||
atUint16 spawnHP();
|
||||
float spawnHearts();
|
||||
void setCurrentHP(atUint16 val);
|
||||
atUint16 currentHP();
|
||||
float currentHearts();
|
||||
std::string currentLocation();
|
||||
std::string currentArea();
|
||||
std::string currentLocationCopy();
|
||||
|
||||
void setSkipData(const atUint8* data);
|
||||
atUint8* skipData() const;
|
||||
|
||||
|
||||
atUint32 slotChecksum();
|
||||
atUint32 skipChecksum();
|
||||
void fixChecksums();
|
||||
|
||||
void setNew(bool isNew);
|
||||
bool isNew() const;
|
||||
private:
|
||||
atUint8* m_skipData;
|
||||
};
|
||||
|
||||
|
||||
} // zelda
|
||||
} // zelda
|
||||
#endif // SSQUEST_HPP
|
||||
#endif // ATHENA_NO_SAVES
|
||||
|
||||
@@ -258,9 +258,9 @@ signals:
|
||||
void originChanged(QPoint);
|
||||
void sizeChanged(QSize);
|
||||
#endif
|
||||
private:
|
||||
#ifndef ATHENA_USE_QT
|
||||
std::vector<STexture*> m_textures;
|
||||
private:
|
||||
#ifndef ATHENA_USE_QT
|
||||
std::vector<STexture*> m_textures;
|
||||
Vector2Di m_size;
|
||||
Vector2Df m_origin;
|
||||
std::unordered_map<std::string, Sprite*> m_sprites;
|
||||
|
||||
@@ -178,7 +178,7 @@ public:
|
||||
#ifdef ATHENA_USE_QT
|
||||
signals:
|
||||
void nameChanged(QString);
|
||||
void orientationChanged(bool,bool);
|
||||
void orientationChanged(bool, bool);
|
||||
void offsetChanged(QPoint);
|
||||
void textureOffsetChanged(QPoint);
|
||||
void sizeChanged(QSize);
|
||||
|
||||
@@ -19,38 +19,38 @@
|
||||
|
||||
// 8 bits integer types
|
||||
#if UCHAR_MAX == 0xFF
|
||||
typedef signed char atInt8;
|
||||
typedef unsigned char atUint8;
|
||||
typedef signed char atInt8;
|
||||
typedef unsigned char atUint8;
|
||||
#else
|
||||
#error No 8 bits integer type for this platform
|
||||
#error No 8 bits integer type for this platform
|
||||
#endif
|
||||
|
||||
// 16 bits integer types
|
||||
#if USHRT_MAX == 0xFFFF
|
||||
typedef signed short atInt16;
|
||||
typedef unsigned short atUint16;
|
||||
typedef signed short atInt16;
|
||||
typedef unsigned short atUint16;
|
||||
#elif UINT_MAX == 0xFFFF
|
||||
typedef signed int atInt16;
|
||||
typedef unsigned int atUint16;
|
||||
typedef signed int atInt16;
|
||||
typedef unsigned int atUint16;
|
||||
#elif ULONG_MAX == 0xFFFF
|
||||
typedef signed long atInt16;
|
||||
typedef unsigned long atUint16;
|
||||
typedef signed long atInt16;
|
||||
typedef unsigned long atUint16;
|
||||
#else
|
||||
#error No 16 bits integer type for this platform
|
||||
#error No 16 bits integer type for this platform
|
||||
#endif
|
||||
|
||||
// 32 bits integer types
|
||||
#if USHRT_MAX == 0xFFFFFFFF
|
||||
typedef signed short atInt32;
|
||||
typedef unsigned short atUint32;
|
||||
typedef signed short atInt32;
|
||||
typedef unsigned short atUint32;
|
||||
#elif UINT_MAX == 0xFFFFFFFF
|
||||
typedef signed int atInt32;
|
||||
typedef unsigned int atUint32;
|
||||
typedef signed int atInt32;
|
||||
typedef unsigned int atUint32;
|
||||
#elif ULONG_MAX == 0xFFFFFFFF
|
||||
typedef signed long atInt32;
|
||||
typedef unsigned long atUint32;
|
||||
typedef signed long atInt32;
|
||||
typedef unsigned long atUint32;
|
||||
#else
|
||||
#error No 32 bits integer type for this platform
|
||||
#error No 32 bits integer type for this platform
|
||||
#endif
|
||||
|
||||
typedef signed long long atInt64;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace utility
|
||||
inline bool isEmpty(atInt8* buf, atUint32 size) {return !memcmp(buf, buf + 1, size - 1);}
|
||||
bool isSystemBigEndian();
|
||||
|
||||
inline atInt16 swap16 (atInt16 val)
|
||||
inline atInt16 swap16(atInt16 val)
|
||||
{
|
||||
#if __GNUC__
|
||||
return __builtin_bswap16(val);
|
||||
@@ -42,7 +42,7 @@ inline atInt16 swap16 (atInt16 val)
|
||||
#endif
|
||||
}
|
||||
inline atUint16 swapU16(atUint16 val) {return (atUint16)swap16(val);}
|
||||
inline atInt32 swap32 (atInt32 val)
|
||||
inline atInt32 swap32(atInt32 val)
|
||||
{
|
||||
#if __GNUC__
|
||||
return __builtin_bswap32(val);
|
||||
@@ -55,7 +55,7 @@ inline atInt32 swap32 (atInt32 val)
|
||||
#endif
|
||||
}
|
||||
inline atUint32 swapU32(atUint32 val) {return (atUint32)swap32(val);}
|
||||
inline atInt64 swap64 (atInt64 val)
|
||||
inline atInt64 swap64(atInt64 val)
|
||||
{
|
||||
#if __GNUC__
|
||||
return __builtin_bswap64(val);
|
||||
@@ -87,7 +87,7 @@ inline atInt16 LittleInt16(atInt16& val)
|
||||
{
|
||||
if (Athena::utility::isSystemBigEndian())
|
||||
val = Athena::utility::swap16(val);
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline atUint16 LittleUint16(atUint16& val)
|
||||
@@ -95,14 +95,14 @@ inline atUint16 LittleUint16(atUint16& val)
|
||||
atInt16 ret = val;
|
||||
LittleInt16(ret);
|
||||
val = ret;
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline atInt16 BigInt16(atInt16& val)
|
||||
{
|
||||
if (!Athena::utility::isSystemBigEndian())
|
||||
val = Athena::utility::swap16(val);
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline atUint16 BigUint16(atUint16& val)
|
||||
@@ -110,14 +110,14 @@ inline atUint16 BigUint16(atUint16& val)
|
||||
atInt16 ret = val;
|
||||
BigInt16(ret);
|
||||
val = ret;
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline atInt32 LittleInt32(atInt32& val)
|
||||
{
|
||||
if (Athena::utility::isSystemBigEndian())
|
||||
val = Athena::utility::swap32(val);
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline atUint32 LittleUint32(atUint32& val)
|
||||
@@ -125,14 +125,14 @@ inline atUint32 LittleUint32(atUint32& val)
|
||||
atInt32 ret = val;
|
||||
LittleInt32(ret);
|
||||
val = ret;
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline atInt32 BigInt32(atInt32& val)
|
||||
{
|
||||
if (!Athena::utility::isSystemBigEndian())
|
||||
val = Athena::utility::swap32(val);
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline atUint32 BigUint32(atUint32& val)
|
||||
@@ -140,14 +140,14 @@ inline atUint32 BigUint32(atUint32& val)
|
||||
atInt32 ret = val;
|
||||
BigInt32(ret);
|
||||
val = ret;
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline atInt64 LittleInt64(atInt64& val)
|
||||
{
|
||||
if (Athena::utility::isSystemBigEndian())
|
||||
val = Athena::utility::swap64(val);
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline atUint64 LittleUint64(atUint64& val)
|
||||
@@ -155,14 +155,14 @@ inline atUint64 LittleUint64(atUint64& val)
|
||||
atInt64 ret = val;
|
||||
LittleInt64(ret);
|
||||
val = ret;
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline atInt64 BigInt64(atInt64& val)
|
||||
{
|
||||
if (!Athena::utility::isSystemBigEndian())
|
||||
val = Athena::utility::swap64(val);
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline atUint64 BigUint64(atUint64& val)
|
||||
@@ -170,7 +170,7 @@ inline atUint64 BigUint64(atUint64& val)
|
||||
atInt64 ret = val;
|
||||
BigInt64(ret);
|
||||
val = ret;
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
@@ -178,33 +178,33 @@ inline float LittleFloat(float& val)
|
||||
{
|
||||
if (Athena::utility::isSystemBigEndian())
|
||||
val = Athena::utility::swapFloat(val);
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline float BigFloat(float& val)
|
||||
{
|
||||
if (!Athena::utility::isSystemBigEndian())
|
||||
val = Athena::utility::swapFloat(val);
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline double LittleDouble(double& val)
|
||||
{
|
||||
if (Athena::utility::isSystemBigEndian())
|
||||
val = Athena::utility::swapDouble(val);
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
inline double BigDouble(double& val)
|
||||
{
|
||||
if (!Athena::utility::isSystemBigEndian())
|
||||
val = Athena::utility::swapDouble(val);
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
void fillRandom(atUint8 * rndArea, atUint64 count);
|
||||
std::vector<std::string> split(const std::string &s, char delim);
|
||||
void fillRandom(atUint8* rndArea, atUint64 count);
|
||||
std::vector<std::string> split(const std::string& s, char delim);
|
||||
std::string join(const std::vector<std::string>& elems, const std::string& delims);
|
||||
void tolower(std::string& str);
|
||||
void toupper(std::string& str);
|
||||
@@ -215,13 +215,13 @@ bool parseBool(const std::string& boolean, bool* valid = NULL);
|
||||
int countChar(const std::string& str, const char chr, int* lastOccur = NULL);
|
||||
|
||||
// trim from start
|
||||
std::string <rim(std::string &s);
|
||||
std::string& ltrim(std::string& s);
|
||||
|
||||
// trim from end
|
||||
std::string &rtrim(std::string &s);
|
||||
std::string& rtrim(std::string& s);
|
||||
|
||||
// trim from both ends
|
||||
std::string &trim(std::string &s);
|
||||
std::string& trim(std::string& s);
|
||||
atUint64 fileSize(const std::string& filename);
|
||||
} // utility
|
||||
} // Athena
|
||||
|
||||
@@ -51,9 +51,9 @@ public:
|
||||
OwnerWrite = 0x20,
|
||||
|
||||
// Mask values;
|
||||
OtherRW = (OtherRead|OtherWrite), //!< Mask to get the Other group permissions
|
||||
GroupRW = (GroupRead|GroupWrite),
|
||||
OwnerRW = (OwnerRead|OwnerWrite)
|
||||
OtherRW = (OtherRead | OtherWrite), //!< Mask to get the Other group permissions
|
||||
GroupRW = (GroupRead | GroupWrite),
|
||||
OwnerRW = (OwnerRead | OwnerWrite)
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
void removeChild(WiiFile* file);
|
||||
|
||||
WiiFile* parent();
|
||||
void setParent(WiiFile *parent);
|
||||
void setParent(WiiFile* parent);
|
||||
|
||||
atUint32 fileCount();
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class ZQuestFileReader : protected MemoryReader
|
||||
{
|
||||
MEMORYREADER_BASE();
|
||||
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
* \brief ZQuestFileReader
|
||||
* \param data
|
||||
|
||||
Reference in New Issue
Block a user