mirror of https://github.com/libAthena/athena.git
Merge branch 'master' of https://github.com/libAthena/athena
This commit is contained in:
commit
1ae2b844de
|
@ -1,3 +0,0 @@
|
|||
[submodule "easy-ecc"]
|
||||
path = extern/easy-ecc
|
||||
url = https://github.com/libAthena/easy-ecc.git
|
|
@ -14,7 +14,7 @@ if(NOT TARGET AthenaCore AND NOT Athena_BINARY_DIR)
|
|||
endif()
|
||||
|
||||
# These are IMPORTED targets created by AthenaTargets.cmake
|
||||
set(ATHENA_LIBRARIES AthenaCore AthenaSakura AthenaZelda AthenaWiiSave)
|
||||
set(ATHENA_LIBRARIES athena-core athena-wiisave athena-sakura athena-zelda)
|
||||
|
||||
# Set icon location if on windows
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
|
|
|
@ -19,7 +19,7 @@ set(ATHENA_VERSION
|
|||
|
||||
add_subdirectory(extern)
|
||||
|
||||
include_directories(include ${LZO_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${EASYECC_INCLUDE_DIR})
|
||||
include_directories(include ${LZO_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||
|
||||
if (NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
||||
|
@ -103,8 +103,8 @@ add_library(athena-wiisave EXCLUDE_FROM_ALL
|
|||
src/athena/WiiSave.cpp
|
||||
src/athena/WiiSaveReader.cpp
|
||||
src/athena/WiiSaveWriter.cpp
|
||||
# src/bn.cpp
|
||||
# src/ec.cpp
|
||||
src/bn.cpp
|
||||
src/ec.cpp
|
||||
src/md5.cpp
|
||||
src/sha1.cpp
|
||||
src/aes.cpp
|
||||
|
@ -116,8 +116,8 @@ add_library(athena-wiisave EXCLUDE_FROM_ALL
|
|||
include/athena/WiiSaveReader.hpp
|
||||
include/athena/WiiSaveWriter.hpp
|
||||
include/aes.hpp
|
||||
# include/bn.h
|
||||
# include/ec.h
|
||||
include/bn.hpp
|
||||
include/ec.hpp
|
||||
include/md5.h
|
||||
include/sha1.h
|
||||
)
|
||||
|
@ -156,6 +156,9 @@ add_library(athena-zelda EXCLUDE_FROM_ALL
|
|||
include/athena/SkywardSwordFileReader.hpp
|
||||
include/athena/SkywardSwordFileWriter.hpp
|
||||
include/athena/SkywardSwordQuest.hpp
|
||||
include/athena/ZQuestFile.hpp
|
||||
include/athena/ZQuestFileReader.hpp
|
||||
include/athena/ZQuestFileWriter.hpp
|
||||
)
|
||||
|
||||
# Icon
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
add_subdirectory(lzo)
|
||||
add_subdirectory(zlib)
|
||||
add_subdirectory(yaml)
|
||||
add_subdirectory(easy-ecc)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit da2748507cbe429d3e1be918c54cfba3be06d4b2
|
|
@ -21,8 +21,6 @@ namespace io
|
|||
*/
|
||||
class ALTTPFileReader : protected MemoryCopyReader
|
||||
{
|
||||
MEMORYCOPYREADER_BASE();
|
||||
|
||||
public:
|
||||
/*! \brief This constructor takes an existing buffer to read from.
|
||||
*
|
||||
|
|
|
@ -20,8 +20,6 @@ namespace io
|
|||
*/
|
||||
class ALTTPFileWriter : protected MemoryCopyWriter
|
||||
{
|
||||
MEMORYCOPYWRITER_BASE();
|
||||
|
||||
public:
|
||||
/*! \brief This constructor takes an existing buffer to write to.
|
||||
*
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
#include <sys/stat.h>
|
||||
|
||||
#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
|
||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
|
||||
#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
#if !defined(S_ISLNK)
|
||||
|
@ -29,7 +29,7 @@
|
|||
#define PRISize "zu"
|
||||
|
||||
#endif
|
||||
|
||||
// clang-format off
|
||||
#ifndef AT_PRETTY_FUNCTION
|
||||
# if defined(__PRETTY_FUNCTION__) || defined(__GNUC__)
|
||||
# define AT_PRETTY_FUNCTION __PRETTY_FUNCTION__
|
||||
|
@ -45,7 +45,7 @@
|
|||
# define AT_PRETTY_FUNCTION "<unknown>"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// clang-format on
|
||||
|
||||
#ifdef GEKKO
|
||||
#include "gekko_support.h"
|
||||
|
@ -77,34 +77,34 @@ typedef struct stat64 atStat64_t;
|
|||
#define _STR(s) #s
|
||||
|
||||
#ifndef ENABLE_BITWISE_ENUM
|
||||
#define ENABLE_BITWISE_ENUM(type)\
|
||||
constexpr type operator|(type a, type b)\
|
||||
{\
|
||||
using T = std::underlying_type_t<type>;\
|
||||
return type(static_cast<T>(a) | static_cast<T>(b));\
|
||||
}\
|
||||
constexpr type operator&(type a, type b)\
|
||||
{\
|
||||
using T = std::underlying_type_t<type>;\
|
||||
return type(static_cast<T>(a) & static_cast<T>(b));\
|
||||
}\
|
||||
inline type& operator|=(type& a, const type& b)\
|
||||
{\
|
||||
using T = std::underlying_type_t<type>;\
|
||||
a = type(static_cast<T>(a) | static_cast<T>(b));\
|
||||
return a;\
|
||||
}\
|
||||
inline type& operator&=(type& a, const type& b)\
|
||||
{\
|
||||
using T = std::underlying_type_t<type>;\
|
||||
a = type(static_cast<T>(a) & static_cast<T>(b));\
|
||||
return a;\
|
||||
}\
|
||||
inline type operator~(const type& key)\
|
||||
{\
|
||||
using T = std::underlying_type_t<type>;\
|
||||
return type(~static_cast<T>(key));\
|
||||
}
|
||||
#define ENABLE_BITWISE_ENUM(type) \
|
||||
constexpr type operator|(type a, type b) \
|
||||
{ \
|
||||
using T = std::underlying_type_t<type>; \
|
||||
return type(static_cast<T>(a) | static_cast<T>(b)); \
|
||||
} \
|
||||
constexpr type operator&(type a, type b) \
|
||||
{ \
|
||||
using T = std::underlying_type_t<type>; \
|
||||
return type(static_cast<T>(a) & static_cast<T>(b)); \
|
||||
} \
|
||||
inline type& operator|=(type& a, const type& b) \
|
||||
{ \
|
||||
using T = std::underlying_type_t<type>; \
|
||||
a = type(static_cast<T>(a) | static_cast<T>(b)); \
|
||||
return a; \
|
||||
} \
|
||||
inline type& operator&=(type& a, const type& b) \
|
||||
{ \
|
||||
using T = std::underlying_type_t<type>; \
|
||||
a = type(static_cast<T>(a) & static_cast<T>(b)); \
|
||||
return a; \
|
||||
} \
|
||||
inline type operator~(const type& key) \
|
||||
{ \
|
||||
using T = std::underlying_type_t<type>; \
|
||||
return type(~static_cast<T>(key)); \
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace athena
|
||||
|
@ -133,7 +133,8 @@ enum Endian
|
|||
};
|
||||
} // Athena
|
||||
|
||||
typedef void (*atEXCEPTION_HANDLER)(athena::error::Level level, const char* file, const char* function, int line, const char* fmt, ...);
|
||||
typedef void (*atEXCEPTION_HANDLER)(athena::error::Level level, const char* file, const char* function, int line,
|
||||
const char* fmt, ...);
|
||||
|
||||
atEXCEPTION_HANDLER atGetExceptionHandler();
|
||||
/**
|
||||
|
@ -147,73 +148,93 @@ std::ostream& operator<<(std::ostream& os, const athena::Endian& endian);
|
|||
|
||||
#ifdef _MSC_VER
|
||||
#ifndef NDEBUG
|
||||
#define atDebug(fmt, ...) \
|
||||
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
#define atDebug(fmt, ...) \
|
||||
do \
|
||||
{ \
|
||||
atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define atDebug(fmt, ...)
|
||||
#endif
|
||||
|
||||
#define atMessage(fmt, ...) \
|
||||
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
#define atMessage(fmt, ...) \
|
||||
do \
|
||||
{ \
|
||||
atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define atWarning(fmt, ...) \
|
||||
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Warning, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
#define atWarning(fmt, ...) \
|
||||
do \
|
||||
{ \
|
||||
atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Warning, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define atError(fmt, ...) \
|
||||
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Error, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
#define atError(fmt, ...) \
|
||||
do \
|
||||
{ \
|
||||
atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Error, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define atFatal(fmt, ...) \
|
||||
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Fatal, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
#define atFatal(fmt, ...) \
|
||||
do \
|
||||
{ \
|
||||
atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Fatal, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define atDebug(fmt...) \
|
||||
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
|
||||
} while(0)
|
||||
#define atDebug(fmt...) \
|
||||
do \
|
||||
{ \
|
||||
atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
|
||||
} while (0)
|
||||
#else // _MSC_VER
|
||||
#define atDebug(fmt, ...)
|
||||
#endif // NDEBUG
|
||||
|
||||
#define atMessage(fmt...) \
|
||||
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
|
||||
} while(0)
|
||||
#define atMessage(fmt...) \
|
||||
do \
|
||||
{ \
|
||||
atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
|
||||
} while (0)
|
||||
|
||||
#define atWarning(fmt...) \
|
||||
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Warning, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
|
||||
} while(0)
|
||||
#define atWarning(fmt...) \
|
||||
do \
|
||||
{ \
|
||||
atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Warning, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
|
||||
} while (0)
|
||||
|
||||
#define atError(fmt...) \
|
||||
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Error, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
|
||||
} while(0)
|
||||
#define atError(fmt...) \
|
||||
do \
|
||||
{ \
|
||||
atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Error, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
|
||||
} while (0)
|
||||
|
||||
#define atFatal(fmt...) \
|
||||
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Fatal, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
|
||||
} while(0)
|
||||
#define atFatal(fmt...) \
|
||||
do \
|
||||
{ \
|
||||
atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
|
||||
if (__handler) \
|
||||
__handler(athena::error::Level::Fatal, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
|
||||
} while (0)
|
||||
#endif // defined(__GNUC__)
|
||||
|
||||
#endif // GLOBAL_HPP
|
||||
|
|
|
@ -20,7 +20,6 @@ namespace io
|
|||
*/
|
||||
class MCFileReader : public MemoryCopyReader
|
||||
{
|
||||
MEMORYCOPYREADER_BASE();
|
||||
public:
|
||||
/*!
|
||||
* \brief This constructor takes an existing buffer to read from.
|
||||
|
|
|
@ -21,7 +21,6 @@ namespace io
|
|||
*/
|
||||
class MCFileWriter : protected MemoryCopyWriter
|
||||
{
|
||||
MEMORYCOPYWRITER_BASE();
|
||||
public:
|
||||
/*!
|
||||
* \brief This constructor takes an existing buffer to write to.
|
||||
|
|
|
@ -121,18 +121,5 @@ protected:
|
|||
} // io
|
||||
} // Athena
|
||||
|
||||
#ifndef MEMORYREADER_BASE
|
||||
#define MEMORYREADER_BASE() \
|
||||
private: \
|
||||
typedef athena::io::MemoryReader base
|
||||
|
||||
#endif // MEMORYREADER_BASE
|
||||
|
||||
#ifndef MEMORYCOPYREADER_BASE
|
||||
#define MEMORYCOPYREADER_BASE() \
|
||||
private: \
|
||||
typedef athena::io::MemoryCopyReader base
|
||||
|
||||
#endif // MEMORYCOPYREADER_BASE
|
||||
|
||||
#endif // MEMORYREADER_HPP
|
||||
|
|
|
@ -161,16 +161,4 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef MEMORYWRITER_BASE
|
||||
#define MEMORYWRITER_BASE() \
|
||||
private: \
|
||||
typedef athena::io::MemoryWriter base
|
||||
#endif // BINARYWRITER_BASE
|
||||
|
||||
#ifndef MEMORYCOPYWRITER_BASE
|
||||
#define MEMORYCOPYWRITER_BASE() \
|
||||
private: \
|
||||
typedef athena::io::MemoryCopyWriter base
|
||||
#endif // BINARYWRITER_BASE
|
||||
|
||||
#endif // MEMORYWRITER_HPP
|
||||
|
|
|
@ -10,9 +10,7 @@ namespace io
|
|||
{
|
||||
class SkywardSwordFileReader : public MemoryCopyReader
|
||||
{
|
||||
MEMORYCOPYREADER_BASE();
|
||||
public:
|
||||
|
||||
SkywardSwordFileReader(atUint8* data, atUint64 length);
|
||||
SkywardSwordFileReader(const std::string& filename);
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ namespace io
|
|||
|
||||
class SkywardSwordFileWriter : public MemoryCopyWriter
|
||||
{
|
||||
MEMORYCOPYWRITER_BASE();
|
||||
public:
|
||||
SkywardSwordFileWriter(atUint8* data, atUint64 len);
|
||||
SkywardSwordFileWriter(const std::string& filename);
|
||||
|
|
|
@ -43,17 +43,16 @@ public:
|
|||
void setSkipData(std::unique_ptr<atUint8[]>&& data);
|
||||
atUint8* skipData() const;
|
||||
|
||||
|
||||
atUint32 slotChecksum();
|
||||
atUint32 skipChecksum();
|
||||
void fixChecksums();
|
||||
|
||||
void setNew(bool isNew);
|
||||
bool isNew() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<atUint8[]> m_skipData;
|
||||
};
|
||||
|
||||
|
||||
} // Athena
|
||||
#endif // SSQUEST_HPP
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
#ifndef SSPRITE_HPP
|
||||
#define SSPRITE_HPP
|
||||
|
||||
#ifndef ATHENA_USE_QT
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#else
|
||||
#include <QObject>
|
||||
#include <QPoint>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#endif
|
||||
#include "athena/SakuraGlobal.hpp"
|
||||
|
||||
namespace athena
|
||||
|
@ -19,35 +12,18 @@ namespace Sakura
|
|||
class SpriteFile;
|
||||
class SpriteFrame;
|
||||
|
||||
#ifndef ATHENA_USE_QT
|
||||
class Sprite
|
||||
{
|
||||
#else
|
||||
class Sprite : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
Q_PROPERTY(qreal currentState READ currentState WRITE setCurrentState)
|
||||
Q_PROPERTY(qreal stateCount READ stateCount CONSTANT)
|
||||
#endif
|
||||
|
||||
public:
|
||||
Sprite(SpriteFile* root);
|
||||
Sprite(SpriteFile* root, const std::string& name);
|
||||
virtual ~Sprite();
|
||||
|
||||
virtual void setPosition(const float x, const float y);
|
||||
#ifndef ATHENA_USE_QT
|
||||
virtual void setPosition(const Vector2Df& pos);
|
||||
virtual Vector2Df position() const;
|
||||
void setName(const std::string& name);
|
||||
std::string name() const;
|
||||
#else
|
||||
virtual void setPosition(const QPoint& pos);
|
||||
virtual QPoint position() const;
|
||||
void setName(const QString& name);
|
||||
QString name() const;
|
||||
#endif
|
||||
|
||||
void addStateId(int id);
|
||||
|
||||
|
@ -58,11 +34,7 @@ public:
|
|||
*/
|
||||
int stateId(int index) const;
|
||||
void setStateIds(std::vector<int> ids);
|
||||
#ifndef ATHENA_USE_QT
|
||||
std::vector<int> stateIds() const;
|
||||
#else
|
||||
QList<int> stateIds() const;
|
||||
#endif
|
||||
atUint32 stateCount() const;
|
||||
void setCurrentState(atUint32 id);
|
||||
atUint32 currentState() const;
|
||||
|
@ -71,18 +43,10 @@ public:
|
|||
bool removeFrame(SpriteFrame* Frame);
|
||||
SpriteFrame* Frame(atUint32 id);
|
||||
void setFrame(atUint32 id);
|
||||
#ifndef ATHENA_USE_QT
|
||||
void setFrames(std::vector<SpriteFrame*> frames);
|
||||
#else
|
||||
void setFrames(QList<SpriteFrame*> frames);
|
||||
#endif
|
||||
atUint32 frameCount() const;
|
||||
|
||||
#ifndef ATHENA_USE_QT
|
||||
std::vector<SpriteFrame*> frames() const;
|
||||
#else
|
||||
QList<SpriteFrame*> frames() const;
|
||||
#endif
|
||||
|
||||
SpriteFile* container() const;
|
||||
|
||||
|
@ -95,36 +59,17 @@ public:
|
|||
|
||||
void setRoot(SpriteFile* root);
|
||||
SpriteFile* root() const;
|
||||
#ifdef ATHENA_USE_QT
|
||||
signals:
|
||||
void frameChanged(SpriteFrame* frame);
|
||||
void nameChanged(QString);
|
||||
void stateChanged(quint32);
|
||||
#endif
|
||||
private:
|
||||
SpriteFile* m_root;
|
||||
#ifndef ATHENA_USE_QT
|
||||
std::string m_name;
|
||||
Vector2Df m_position;
|
||||
std::vector<int> m_stateIds; //!< Stores the texture id's for each state.
|
||||
SpriteFile* m_root;
|
||||
std::string m_name;
|
||||
Vector2Df m_position;
|
||||
std::vector<int> m_stateIds; //!< Stores the texture id's for each state.
|
||||
std::vector<SpriteFrame*> m_frames;
|
||||
#else
|
||||
QString m_name;
|
||||
QPoint m_position;
|
||||
QList<int> m_stateIds;
|
||||
QList<SpriteFrame*> m_frames;
|
||||
#endif
|
||||
atUint32 m_currentState;
|
||||
atUint32 m_currentFrame;
|
||||
atUint32 m_currentState;
|
||||
atUint32 m_currentFrame;
|
||||
};
|
||||
|
||||
|
||||
} // Sakura
|
||||
} // zelda
|
||||
|
||||
#ifdef ATHENA_USE_QT
|
||||
Q_DECLARE_METATYPE(Uint32)
|
||||
Q_DECLARE_METATYPE(athena::Sakura::Sprite*)
|
||||
#endif
|
||||
|
||||
#endif // SSPRITE_HPP
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
#ifndef SSPRITEFILE_HPP
|
||||
#define SSPRITEFILE_HPP
|
||||
|
||||
#ifndef ATHENA_USE_QT
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#else
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
#include <QList>
|
||||
#include <QSize>
|
||||
#include <QPoint>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include "athena/SakuraGlobal.hpp"
|
||||
|
@ -26,14 +18,8 @@ struct STexture
|
|||
};
|
||||
|
||||
class Sprite;
|
||||
#ifndef ATHENA_USE_QT
|
||||
class SpriteFile
|
||||
{
|
||||
#else
|
||||
class SpriteFile : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
#endif
|
||||
public:
|
||||
/*!
|
||||
* \brief Major
|
||||
|
@ -109,21 +95,13 @@ public slots:
|
|||
* \brief setSize
|
||||
* \param size
|
||||
*/
|
||||
#ifndef ATHENA_USE_QT
|
||||
void setSize(const Vector2Di& size);
|
||||
#else
|
||||
void setSize(const QSize& size);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief size
|
||||
* \return
|
||||
*/
|
||||
#ifndef ATHENA_USE_QT
|
||||
Vector2Di size() const;
|
||||
#else
|
||||
QSize size() const;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief width
|
||||
|
@ -148,21 +126,13 @@ public slots:
|
|||
* \brief setOrigin
|
||||
* \param origin
|
||||
*/
|
||||
#ifndef ATHENA_USE_QT
|
||||
void setOrigin(const Vector2Df& origin);
|
||||
#else
|
||||
void setOrigin(const QPoint& origin);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief origin
|
||||
* \return
|
||||
*/
|
||||
#ifndef ATHENA_USE_QT
|
||||
Vector2Df origin() const;
|
||||
#else
|
||||
QPoint origin() const;
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -195,71 +165,33 @@ public slots:
|
|||
* \return
|
||||
*/
|
||||
STexture* texture(atUint32 id);
|
||||
|
||||
#ifndef ATHENA_USE_QT
|
||||
std::vector<STexture*> textures() const;
|
||||
#else
|
||||
QList<STexture*> textures() const;
|
||||
#endif
|
||||
|
||||
atUint32 textureCount() const;
|
||||
/*!
|
||||
* \brief setTextures
|
||||
* \param textures
|
||||
*/
|
||||
|
||||
#ifndef ATHENA_USE_QT
|
||||
void setTextures(std::vector<STexture*> textures);
|
||||
#else
|
||||
void setTextures(QList<STexture*> textures);
|
||||
#endif
|
||||
|
||||
void addSprite(Sprite* sprite);
|
||||
|
||||
#ifndef ATHENA_USE_QT
|
||||
void removeSprite(const std::string& name);
|
||||
#else
|
||||
void removeSprite(const QString& name);
|
||||
#endif
|
||||
void removeSprite(Sprite* sprite);
|
||||
|
||||
#ifndef ATHENA_USE_QT
|
||||
void setSprites(std::unordered_map<std::string, Sprite*> sprites);
|
||||
#else
|
||||
void setSprites(QMap<QString, Sprite*> sprites);
|
||||
#endif
|
||||
#ifndef ATHENA_USE_QT
|
||||
Sprite* sprite(const std::string& name);
|
||||
std::unordered_map<std::string, Sprite*> sprites() const;
|
||||
#else
|
||||
Sprite* sprite(const QString& name);
|
||||
QMap<QString, Sprite*> sprites() const;
|
||||
#endif
|
||||
|
||||
atUint32 spriteCount() const;
|
||||
|
||||
#ifdef ATHENA_USE_QT
|
||||
signals:
|
||||
void originChanged(QPoint);
|
||||
void sizeChanged(QSize);
|
||||
#endif
|
||||
private:
|
||||
#ifndef ATHENA_USE_QT
|
||||
std::vector<STexture*> m_textures;
|
||||
Vector2Di m_size;
|
||||
Vector2Df m_origin;
|
||||
std::unordered_map<std::string, Sprite*> m_sprites;
|
||||
#else
|
||||
QList<STexture*> m_textures;
|
||||
QSize m_size;
|
||||
QPoint m_origin;
|
||||
QMap<QString, Sprite*> m_sprites;
|
||||
#endif
|
||||
};
|
||||
} // Sakura
|
||||
} // Zelda
|
||||
|
||||
#ifdef ATHENA_USE_QT
|
||||
Q_DECLARE_METATYPE(athena::Sakura::SpriteFile*)
|
||||
Q_DECLARE_METATYPE(athena::Sakura::STexture*)
|
||||
#endif
|
||||
#endif // SSPRITE_HPP
|
||||
|
|
|
@ -15,7 +15,6 @@ namespace io
|
|||
|
||||
class SpriteFileReader : public MemoryCopyReader
|
||||
{
|
||||
MEMORYCOPYREADER_BASE();
|
||||
public:
|
||||
SpriteFileReader(atUint8* data, atUint64 length);
|
||||
SpriteFileReader(const std::string& filepath);
|
||||
|
|
|
@ -15,7 +15,6 @@ namespace io
|
|||
|
||||
class SpriteFileWriter : public MemoryCopyWriter
|
||||
{
|
||||
MEMORYCOPYWRITER_BASE();
|
||||
public:
|
||||
SpriteFileWriter(atUint8* data, atUint64 length);
|
||||
|
||||
|
|
|
@ -4,13 +4,7 @@
|
|||
|
||||
#include "athena/SakuraGlobal.hpp"
|
||||
|
||||
#ifndef ATHENA_USE_QT
|
||||
#include <vector>
|
||||
#else
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#endif
|
||||
|
||||
namespace athena
|
||||
{
|
||||
namespace Sakura
|
||||
|
@ -19,15 +13,8 @@ namespace Sakura
|
|||
class Sprite;
|
||||
class SpritePart;
|
||||
|
||||
#ifndef ATHENA_USE_QT
|
||||
class SpriteFrame
|
||||
{
|
||||
#else
|
||||
class SpriteFrame : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(qreal frameTime READ frameTime WRITE setFrameTime)
|
||||
#endif
|
||||
public:
|
||||
/*!
|
||||
* \brief SSpriteFrame
|
||||
|
@ -48,37 +35,20 @@ public:
|
|||
*/
|
||||
float frameTime() const;
|
||||
|
||||
#ifndef ATHENA_USE_QT
|
||||
void setParts(std::vector<SpritePart*> parts);
|
||||
std::vector<SpritePart*> parts() const;
|
||||
#else
|
||||
void setParts(QList<SpritePart*> parts);
|
||||
QList<SpritePart*> parts() const;
|
||||
#endif
|
||||
|
||||
atUint32 partCount() const;
|
||||
|
||||
void setRoot(Sprite* root);
|
||||
Sprite* root() const;
|
||||
#ifdef ATHENA_USE_QT
|
||||
signals:
|
||||
void frameTimeChanged(float);
|
||||
#endif
|
||||
private:
|
||||
Sprite* m_root;
|
||||
float m_frameTime;
|
||||
#ifndef ATHENA_USE_QT
|
||||
std::vector<SpritePart*> m_parts;
|
||||
#else
|
||||
QList<SpritePart*> m_parts;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // Sakura
|
||||
} // zelda
|
||||
|
||||
#ifdef ATHENA_USE_QT
|
||||
Q_DECLARE_METATYPE(athena::Sakura::SpriteFrame*);
|
||||
#endif
|
||||
|
||||
#endif // SSPRITEFRAME_HPP
|
||||
|
|
|
@ -2,14 +2,7 @@
|
|||
#define SSPRITEPART_HPP
|
||||
|
||||
#include "athena/SakuraGlobal.hpp"
|
||||
#ifndef ATHENA_USE_QT
|
||||
# include <vector>
|
||||
#else
|
||||
# include <QObject>
|
||||
# include <QPoint>
|
||||
# include <QSize>
|
||||
# include <QString>
|
||||
#endif
|
||||
#include <vector>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -19,35 +12,15 @@ namespace Sakura
|
|||
{
|
||||
class SpriteFrame;
|
||||
|
||||
#ifndef ATHENA_USE_QT
|
||||
class SpritePart
|
||||
{
|
||||
#else
|
||||
class SpritePart : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
Q_PROPERTY(bool hasCollision READ hasCollision WRITE setCollision)
|
||||
Q_PROPERTY(bool flippedHorizontally READ flippedHorizontally WRITE setFlippedHorizontally)
|
||||
Q_PROPERTY(bool flippedVertically READ flippedVertically WRITE setFlippedVertically)
|
||||
Q_PROPERTY(QPoint offset READ offset WRITE setOffset)
|
||||
Q_PROPERTY(QPoint textureOffset READ textureOffset WRITE setTextureOffset)
|
||||
Q_PROPERTY(QSize size READ size WRITE setSize)
|
||||
#endif
|
||||
public:
|
||||
SpritePart(SpriteFrame* root);
|
||||
SpritePart(SpriteFrame* root, const std::string& name, bool hasCollision = false);
|
||||
virtual ~SpritePart();
|
||||
|
||||
|
||||
#ifndef ATHENA_USE_QT
|
||||
void setName(const std::string& name);
|
||||
std::string name() const;
|
||||
#else
|
||||
void setName(const QString& name);
|
||||
QString name() const;
|
||||
#endif
|
||||
|
||||
void setCollision(bool col);
|
||||
bool hasCollision() const;
|
||||
|
||||
|
@ -57,26 +30,13 @@ public:
|
|||
* \param y
|
||||
*/
|
||||
void setOffset(float x, float y);
|
||||
|
||||
/*!
|
||||
* \brief setOffset
|
||||
* \param offset
|
||||
*/
|
||||
#ifndef ATHENA_USE_QT
|
||||
void setOffset(const Vector2Df& offset);
|
||||
#else
|
||||
void setOffset(const QPoint& offset);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief offset
|
||||
* \return
|
||||
*/
|
||||
#ifndef ATHENA_USE_QT
|
||||
Vector2Df offset() const;
|
||||
#else
|
||||
QPoint offset() const;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief setTextureOffset
|
||||
|
@ -89,22 +49,13 @@ public:
|
|||
* \brief setTextureOffset
|
||||
* \param texOff
|
||||
*/
|
||||
#ifndef ATHENA_USE_QT
|
||||
void setTextureOffset(const Vector2Df& offset);
|
||||
#else
|
||||
void setTextureOffset(const QPoint& offset);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief textureOffset
|
||||
* \return
|
||||
*/
|
||||
#ifndef ATHENA_USE_QT
|
||||
/*!
|
||||
* \brief textureOffset
|
||||
* \return
|
||||
*/
|
||||
Vector2Df textureOffset() const;
|
||||
#else
|
||||
QPoint textureOffset() const;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief setSize
|
||||
* \param width
|
||||
|
@ -112,25 +63,16 @@ public:
|
|||
*/
|
||||
void setSize(atUint32 width, atUint32 height);
|
||||
|
||||
/*!
|
||||
* \brief setSize
|
||||
* \param size
|
||||
*/
|
||||
#ifndef ATHENA_USE_QT
|
||||
/*!
|
||||
* \brief setSize
|
||||
* \param size
|
||||
*/
|
||||
void setSize(const Vector2Di& size);
|
||||
#else
|
||||
void setSize(const QSize& size);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief size
|
||||
* \return
|
||||
*/
|
||||
#ifndef ATHENA_USE_QT
|
||||
/*!
|
||||
* \brief size
|
||||
* \return
|
||||
*/
|
||||
Vector2Di size() const;
|
||||
#else
|
||||
QSize size() const;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief setFlippedHorizontally
|
||||
|
@ -159,42 +101,19 @@ public:
|
|||
void setRoot(SpriteFrame* root);
|
||||
SpriteFrame* root() const;
|
||||
|
||||
#ifdef ATHENA_USE_QT
|
||||
signals:
|
||||
void nameChanged(QString);
|
||||
void orientationChanged(bool, bool);
|
||||
void offsetChanged(QPoint);
|
||||
void textureOffsetChanged(QPoint);
|
||||
void sizeChanged(QSize);
|
||||
void collisionChanged(bool);
|
||||
#endif
|
||||
|
||||
private:
|
||||
SpriteFrame* m_root;
|
||||
#ifndef ATHENA_USE_QT
|
||||
std::string m_name;
|
||||
#else
|
||||
QString m_name;
|
||||
#endif
|
||||
bool m_hasCollision;
|
||||
#ifndef ATHENA_USE_QT
|
||||
Vector2Df m_offset;
|
||||
Vector2Df m_textureOffset;
|
||||
Vector2Di m_size;
|
||||
#else
|
||||
QPoint m_offset;
|
||||
QPoint m_textureOffset;
|
||||
QSize m_size;
|
||||
#endif
|
||||
bool m_flippedH;
|
||||
bool m_flippedV;
|
||||
atUint32 m_frameIndex;
|
||||
SpriteFrame* m_root;
|
||||
std::string m_name;
|
||||
bool m_hasCollision;
|
||||
Vector2Df m_offset;
|
||||
Vector2Df m_textureOffset;
|
||||
Vector2Di m_size;
|
||||
bool m_flippedH;
|
||||
bool m_flippedV;
|
||||
atUint32 m_frameIndex;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
#ifdef ATHENA_USE_QT
|
||||
Q_DECLARE_METATYPE(athena::Sakura::SpritePart*)
|
||||
#endif
|
||||
|
||||
#endif // SSPRITEPART_HPP
|
||||
|
|
|
@ -21,9 +21,8 @@ namespace io
|
|||
* all work is done using a memory buffer, and not read directly from the disk.
|
||||
* \sa BinaryReader
|
||||
*/
|
||||
class WiiSaveReader : protected MemoryCopyReader
|
||||
class WiiSaveReader : public MemoryCopyReader
|
||||
{
|
||||
MEMORYCOPYREADER_BASE();
|
||||
public:
|
||||
/*! \brief This constructor takes an existing buffer to read from.
|
||||
*
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace io
|
|||
*/
|
||||
class WiiSaveWriter : protected MemoryCopyWriter
|
||||
{
|
||||
MEMORYCOPYWRITER_BASE();
|
||||
public:
|
||||
/*! \brief This constructor creates an instance from a file on disk.
|
||||
*
|
||||
|
|
|
@ -1,19 +1,4 @@
|
|||
#ifndef 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/>
|
||||
|
||||
#ifndef ZQUEST_HPP
|
||||
#define ZQUEST_HPP
|
||||
|
||||
|
|
|
@ -1,19 +1,4 @@
|
|||
#ifndef 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/>
|
||||
|
||||
#ifndef __ZQUESTFILEREADER_HPP__
|
||||
#define __ZQUESTFILEREADER_HPP__
|
||||
|
||||
|
@ -31,7 +16,6 @@ namespace io
|
|||
*/
|
||||
class ZQuestFileReader : protected MemoryCopyReader
|
||||
{
|
||||
MEMORYCOPYREADER_BASE();
|
||||
|
||||
public:
|
||||
/*!
|
||||
|
|
|
@ -1,19 +1,4 @@
|
|||
#ifndef 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/>
|
||||
|
||||
#ifndef __ZQUESTFILEWRITER_HPP__
|
||||
#define __ZQUESTFILEWRITER_HPP__
|
||||
|
||||
|
@ -31,8 +16,6 @@ namespace io
|
|||
*/
|
||||
class ZQuestFileWriter : protected MemoryCopyWriter
|
||||
{
|
||||
MEMORYCOPYWRITER_BASE();
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief ZQuestFileWriter
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef BN_H
|
||||
#define BN_H
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
#endif // BN_H
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef EC_H
|
||||
#define EC_H
|
||||
#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);
|
||||
}
|
||||
|
||||
#endif // EC_H
|
||||
|
|
@ -6,5 +6,5 @@ Name: libAthena
|
|||
Description: Basic cross platform IO library
|
||||
Version: @ATHENA_VERSION@
|
||||
Cflags: -I${includedir}/Athena -std=c++11
|
||||
Libs: -L${libdir} -lAthenaCore -lAthenaSakura -lAthenaZelda -lAthenaWiiSave
|
||||
Libs: -L${libdir} -lathena-core -lathena-sakura -lathena-zelda -lathena-wiiSave
|
||||
Requires: zlib
|
||||
|
|
|
@ -10,12 +10,12 @@ namespace io
|
|||
{
|
||||
|
||||
ALTTPFileReader::ALTTPFileReader(atUint8* data, atUint64 length)
|
||||
: base(data, length)
|
||||
: MemoryCopyReader(data, length)
|
||||
{
|
||||
}
|
||||
|
||||
ALTTPFileReader::ALTTPFileReader(const std::string& filename)
|
||||
: base(filename)
|
||||
: MemoryCopyReader(filename)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -52,22 +52,22 @@ ALTTPFile* ALTTPFileReader::readFile()
|
|||
|
||||
quest->setOverworldEvents(owEvents);
|
||||
|
||||
quest->setInventory(*(ALTTPInventory*)base::readBytes(sizeof(ALTTPInventory)).get());
|
||||
quest->setRupeeMax(base::readUint16());
|
||||
quest->setRupeeCurrent(base::readUint16());
|
||||
quest->setInventory(*(ALTTPInventory*)readBytes(sizeof(ALTTPInventory)).get());
|
||||
quest->setRupeeMax(readUint16());
|
||||
quest->setRupeeCurrent(readUint16());
|
||||
quest->setCompasses(readDungeonFlags());
|
||||
quest->setBigKeys(readDungeonFlags());
|
||||
quest->setDungeonMaps(readDungeonFlags());
|
||||
quest->setWishingPond(base::readUint16());
|
||||
quest->setHealthMax(base::readByte());
|
||||
quest->setHealth(base::readByte());
|
||||
quest->setMagicPower(base::readByte());
|
||||
quest->setKeys(base::readByte());
|
||||
quest->setBombUpgrades(base::readByte());
|
||||
quest->setArrowUpgrades(base::readByte());
|
||||
quest->setHealthFiller(base::readByte());
|
||||
quest->setMagicFiller(base::readByte());
|
||||
atUint8 pendantsByte = base::readUByte();
|
||||
quest->setWishingPond(readUint16());
|
||||
quest->setHealthMax(readByte());
|
||||
quest->setHealth(readByte());
|
||||
quest->setMagicPower(readByte());
|
||||
quest->setKeys(readByte());
|
||||
quest->setBombUpgrades(readByte());
|
||||
quest->setArrowUpgrades(readByte());
|
||||
quest->setHealthFiller(readByte());
|
||||
quest->setMagicFiller(readByte());
|
||||
atUint8 pendantsByte = readUByte();
|
||||
ALTTPPendants pendants;
|
||||
pendants.Courage = pendantsByte & 1;
|
||||
pendants.Wisdom = (pendantsByte >> 1) & 1;
|
||||
|
@ -78,11 +78,11 @@ ALTTPFile* ALTTPFileReader::readFile()
|
|||
pendants.Unused4 = false;
|
||||
pendants.Unused5 = false;
|
||||
quest->setPendants(pendants);
|
||||
quest->setBombFiller(base::readByte());
|
||||
quest->setArrowFiller(base::readByte());
|
||||
quest->setArrows(base::readByte());
|
||||
base::seek(1);
|
||||
atUint8 abilitiesByte = base::readUByte();
|
||||
quest->setBombFiller(readByte());
|
||||
quest->setArrowFiller(readByte());
|
||||
quest->setArrows(readByte());
|
||||
seek(1);
|
||||
atUint8 abilitiesByte = readUByte();
|
||||
ALTTPAbilities abilities;
|
||||
abilities.Nothing = abilitiesByte & 1;
|
||||
abilities.Swim = (abilitiesByte >> 1) & 1;
|
||||
|
@ -93,42 +93,42 @@ ALTTPFile* ALTTPFileReader::readFile()
|
|||
abilities.Read = (abilitiesByte >> 6) & 1;
|
||||
abilities.Unknown2 = (abilitiesByte >> 7) & 1;
|
||||
quest->setAbilityFlags(abilities);
|
||||
quest->setCrystals(*(ALTTPCrystals*)base::readBytes(sizeof(ALTTPCrystals)).get());
|
||||
quest->setMagicUsage(*(ALTTPMagicUsage*)base::readBytes(sizeof(ALTTPMagicUsage)).get());
|
||||
quest->setCrystals(*(ALTTPCrystals*)readBytes(sizeof(ALTTPCrystals)).get());
|
||||
quest->setMagicUsage(*(ALTTPMagicUsage*)readBytes(sizeof(ALTTPMagicUsage)).get());
|
||||
|
||||
j = 0x10;
|
||||
|
||||
while ((j--) > 0)
|
||||
{
|
||||
dungeonKeys.push_back(base::readByte());
|
||||
dungeonKeys.push_back(readByte());
|
||||
}
|
||||
|
||||
quest->setDungeonKeys(dungeonKeys);
|
||||
base::seek(0x039);
|
||||
quest->setProgressIndicator((ALTTPProgressIndicator)base::readByte());
|
||||
quest->setProgressFlags1(*(ALTTPProgressFlags1*)base::readBytes(sizeof(ALTTPProgressFlags1)).get());
|
||||
quest->setMapIcon((ALTTPMapIcon)base::readByte());
|
||||
quest->setStartLocation((ALTTPStartLocation)base::readByte());
|
||||
quest->setProgressFlags2(*(ALTTPProgressFlags2*)base::readBytes(sizeof(ALTTPProgressFlags2)).get());
|
||||
quest->setLightDarkWorldIndicator(*(ALTTPLightDarkWorldIndicator*)base::readBytes(1).get());
|
||||
base::seek(1);
|
||||
quest->setTagAlong((ALTTPTagAlong)base::readByte());
|
||||
seek(0x039);
|
||||
quest->setProgressIndicator((ALTTPProgressIndicator)readByte());
|
||||
quest->setProgressFlags1(*(ALTTPProgressFlags1*)readBytes(sizeof(ALTTPProgressFlags1)).get());
|
||||
quest->setMapIcon((ALTTPMapIcon)readByte());
|
||||
quest->setStartLocation((ALTTPStartLocation)readByte());
|
||||
quest->setProgressFlags2(*(ALTTPProgressFlags2*)readBytes(sizeof(ALTTPProgressFlags2)).get());
|
||||
quest->setLightDarkWorldIndicator(*(ALTTPLightDarkWorldIndicator*)readBytes(1).get());
|
||||
seek(1);
|
||||
quest->setTagAlong((ALTTPTagAlong)readByte());
|
||||
|
||||
j = 6;
|
||||
|
||||
while ((j--) > 0)
|
||||
{
|
||||
oldmanFlags.push_back(base::readByte());
|
||||
oldmanFlags.push_back(readByte());
|
||||
}
|
||||
|
||||
quest->setOldManFlags(oldmanFlags);
|
||||
quest->setBombFlag(base::readByte());
|
||||
quest->setBombFlag(readByte());
|
||||
|
||||
j = 5;
|
||||
|
||||
while ((j--) > 0)
|
||||
{
|
||||
unknown1.push_back(base::readByte());
|
||||
unknown1.push_back(readByte());
|
||||
}
|
||||
|
||||
quest->setUnknown1(unknown1);
|
||||
|
@ -137,28 +137,28 @@ ALTTPFile* ALTTPFileReader::readFile()
|
|||
|
||||
while ((j--) > 0)
|
||||
{
|
||||
playerName.push_back(base::readUint16());
|
||||
playerName.push_back(readUint16());
|
||||
}
|
||||
|
||||
quest->setPlayerName(playerName);
|
||||
quest->setValid((base::readUint16() == 0x55AA));
|
||||
quest->setValid((readUint16() == 0x55AA));
|
||||
|
||||
j = 0x0D;
|
||||
|
||||
while ((j--) > 0)
|
||||
{
|
||||
dungeonDeaths.push_back(base::readUint16());
|
||||
dungeonDeaths.push_back(readUint16());
|
||||