From 0eb7fb20e8ec47eea3c9ed47a2b91a4923050d1a Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Tue, 3 Jan 2017 10:32:56 -0800 Subject: [PATCH] More code cleanup --- AthenaConfig.cmake.in | 2 +- include/athena/Global.hpp | 187 ++++++++++++---------- include/athena/SkywardSwordFileReader.hpp | 1 - include/athena/SkywardSwordQuest.hpp | 3 +- include/athena/Sprite.hpp | 67 +------- include/athena/SpriteFile.hpp | 70 +------- include/athena/SpriteFileWriter.hpp | 1 - include/athena/SpriteFrame.hpp | 30 ---- include/athena/SpritePart.hpp | 125 +++------------ libAthena.pc.in | 2 +- src/athena/ALTTPFileReader.cpp | 4 +- src/athena/ALTTPFileWriter.cpp | 4 +- src/athena/MCFileReader.cpp | 4 +- src/athena/MCFileWriter.cpp | 4 +- src/athena/SkywardSwordFileReader.cpp | 4 +- src/athena/SkywardSwordFileWriter.cpp | 4 +- src/athena/Sprite.cpp | 67 -------- src/athena/SpriteFile.cpp | 108 ------------- src/athena/SpriteFileReader.cpp | 4 +- src/athena/SpriteFileWriter.cpp | 80 ++++----- src/athena/SpriteFrame.cpp | 11 -- src/athena/SpritePart.cpp | 69 -------- src/athena/ZQuestFileReader.cpp | 4 +- src/athena/ZQuestFileWriter.cpp | 4 +- 24 files changed, 183 insertions(+), 676 deletions(-) diff --git a/AthenaConfig.cmake.in b/AthenaConfig.cmake.in index 7792c5e..6647cef 100644 --- a/AthenaConfig.cmake.in +++ b/AthenaConfig.cmake.in @@ -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) diff --git a/include/athena/Global.hpp b/include/athena/Global.hpp index bad8cc2..be1a7f1 100644 --- a/include/athena/Global.hpp +++ b/include/athena/Global.hpp @@ -11,11 +11,11 @@ #include #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 "" # endif #endif - +// clang-format on #ifdef GEKKO #include "gekko_support.h" @@ -76,34 +76,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;\ - return type(static_cast(a) | static_cast(b));\ -}\ -constexpr type operator&(type a, type b)\ -{\ - using T = std::underlying_type_t;\ - return type(static_cast(a) & static_cast(b));\ -}\ -inline type& operator|=(type& a, const type& b)\ -{\ - using T = std::underlying_type_t;\ - a = type(static_cast(a) | static_cast(b));\ - return a;\ -}\ -inline type& operator&=(type& a, const type& b)\ -{\ - using T = std::underlying_type_t;\ - a = type(static_cast(a) & static_cast(b));\ - return a;\ -}\ -inline type operator~(const type& key)\ -{\ - using T = std::underlying_type_t;\ - return type(~static_cast(key));\ -} +#define ENABLE_BITWISE_ENUM(type) \ + constexpr type operator|(type a, type b) \ + { \ + using T = std::underlying_type_t; \ + return type(static_cast(a) | static_cast(b)); \ + } \ + constexpr type operator&(type a, type b) \ + { \ + using T = std::underlying_type_t; \ + return type(static_cast(a) & static_cast(b)); \ + } \ + inline type& operator|=(type& a, const type& b) \ + { \ + using T = std::underlying_type_t; \ + a = type(static_cast(a) | static_cast(b)); \ + return a; \ + } \ + inline type& operator&=(type& a, const type& b) \ + { \ + using T = std::underlying_type_t; \ + a = type(static_cast(a) & static_cast(b)); \ + return a; \ + } \ + inline type operator~(const type& key) \ + { \ + using T = std::underlying_type_t; \ + return type(~static_cast(key)); \ + } #endif namespace athena @@ -132,7 +132,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(); /** @@ -146,73 +147,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 diff --git a/include/athena/SkywardSwordFileReader.hpp b/include/athena/SkywardSwordFileReader.hpp index b7b7fd8..f1c906e 100644 --- a/include/athena/SkywardSwordFileReader.hpp +++ b/include/athena/SkywardSwordFileReader.hpp @@ -11,7 +11,6 @@ namespace io class SkywardSwordFileReader : public MemoryCopyReader { public: - SkywardSwordFileReader(atUint8* data, atUint64 length); SkywardSwordFileReader(const std::string& filename); diff --git a/include/athena/SkywardSwordQuest.hpp b/include/athena/SkywardSwordQuest.hpp index c415834..618e69e 100644 --- a/include/athena/SkywardSwordQuest.hpp +++ b/include/athena/SkywardSwordQuest.hpp @@ -43,17 +43,16 @@ public: void setSkipData(std::unique_ptr&& data); atUint8* skipData() const; - atUint32 slotChecksum(); atUint32 skipChecksum(); void fixChecksums(); void setNew(bool isNew); bool isNew() const; + private: std::unique_ptr m_skipData; }; - } // Athena #endif // SSQUEST_HPP diff --git a/include/athena/Sprite.hpp b/include/athena/Sprite.hpp index a9e9d57..fa494fd 100644 --- a/include/athena/Sprite.hpp +++ b/include/athena/Sprite.hpp @@ -1,15 +1,8 @@ #ifndef SSPRITE_HPP #define SSPRITE_HPP -#ifndef ATHENA_USE_QT #include #include -#else -#include -#include -#include -#include -#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 ids); -#ifndef ATHENA_USE_QT std::vector stateIds() const; -#else - QList 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 frames); -#else - void setFrames(QList frames); -#endif atUint32 frameCount() const; -#ifndef ATHENA_USE_QT std::vector frames() const; -#else - QList 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 m_stateIds; //!< Stores the texture id's for each state. + SpriteFile* m_root; + std::string m_name; + Vector2Df m_position; + std::vector m_stateIds; //!< Stores the texture id's for each state. std::vector m_frames; -#else - QString m_name; - QPoint m_position; - QList m_stateIds; - QList 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 diff --git a/include/athena/SpriteFile.hpp b/include/athena/SpriteFile.hpp index b383152..bf8ffe7 100644 --- a/include/athena/SpriteFile.hpp +++ b/include/athena/SpriteFile.hpp @@ -1,16 +1,8 @@ #ifndef SSPRITEFILE_HPP #define SSPRITEFILE_HPP -#ifndef ATHENA_USE_QT #include #include -#else -#include -#include -#include -#include -#include -#endif #include #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 textures() const; -#else - QList textures() const; -#endif + atUint32 textureCount() const; /*! * \brief setTextures * \param textures */ - -#ifndef ATHENA_USE_QT void setTextures(std::vector textures); -#else - void setTextures(QList 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 sprites); -#else - void setSprites(QMap sprites); -#endif -#ifndef ATHENA_USE_QT Sprite* sprite(const std::string& name); std::unordered_map sprites() const; -#else - Sprite* sprite(const QString& name); - QMap 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 m_textures; Vector2Di m_size; Vector2Df m_origin; std::unordered_map m_sprites; -#else - QList m_textures; - QSize m_size; - QPoint m_origin; - QMap 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 diff --git a/include/athena/SpriteFileWriter.hpp b/include/athena/SpriteFileWriter.hpp index 9f174bd..db8c3cd 100644 --- a/include/athena/SpriteFileWriter.hpp +++ b/include/athena/SpriteFileWriter.hpp @@ -15,7 +15,6 @@ namespace io class SpriteFileWriter : public MemoryCopyWriter { - MEMORYCOPYWRITER_BASE(); public: SpriteFileWriter(atUint8* data, atUint64 length); diff --git a/include/athena/SpriteFrame.hpp b/include/athena/SpriteFrame.hpp index 965741e..c22d605 100644 --- a/include/athena/SpriteFrame.hpp +++ b/include/athena/SpriteFrame.hpp @@ -4,13 +4,7 @@ #include "athena/SakuraGlobal.hpp" -#ifndef ATHENA_USE_QT #include -#else -#include -#include -#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 parts); std::vector parts() const; -#else - void setParts(QList parts); - QList 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 m_parts; -#else - QList m_parts; -#endif }; } // Sakura } // zelda -#ifdef ATHENA_USE_QT -Q_DECLARE_METATYPE(athena::Sakura::SpriteFrame*); -#endif - #endif // SSPRITEFRAME_HPP diff --git a/include/athena/SpritePart.hpp b/include/athena/SpritePart.hpp index 0b84d54..93aa34a 100644 --- a/include/athena/SpritePart.hpp +++ b/include/athena/SpritePart.hpp @@ -2,14 +2,7 @@ #define SSPRITEPART_HPP #include "athena/SakuraGlobal.hpp" -#ifndef ATHENA_USE_QT -# include -#else -# include -# include -# include -# include -#endif +#include #include @@ -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 diff --git a/libAthena.pc.in b/libAthena.pc.in index ec5d727..97704ca 100644 --- a/libAthena.pc.in +++ b/libAthena.pc.in @@ -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 diff --git a/src/athena/ALTTPFileReader.cpp b/src/athena/ALTTPFileReader.cpp index 720cab7..f8a1cc8 100644 --- a/src/athena/ALTTPFileReader.cpp +++ b/src/athena/ALTTPFileReader.cpp @@ -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) { } diff --git a/src/athena/ALTTPFileWriter.cpp b/src/athena/ALTTPFileWriter.cpp index e6728ac..10f68d1 100644 --- a/src/athena/ALTTPFileWriter.cpp +++ b/src/athena/ALTTPFileWriter.cpp @@ -10,12 +10,12 @@ namespace io { ALTTPFileWriter::ALTTPFileWriter(atUint8* data, atUint64 length) - : base(data, length) + : MemoryCopyWriter(data, length) { } ALTTPFileWriter::ALTTPFileWriter(const std::string& filename) - : base(filename) + : MemoryCopyWriter(filename) { } diff --git a/src/athena/MCFileReader.cpp b/src/athena/MCFileReader.cpp index 52b6cdc..b8f93ea 100644 --- a/src/athena/MCFileReader.cpp +++ b/src/athena/MCFileReader.cpp @@ -8,12 +8,12 @@ namespace io static const atUint32 SCRAMBLE_VALUE = 0x5A424741; MCFileReader::MCFileReader(atUint8* data, atUint64 length) - : base(data, length) + : MemoryCopyReader(data, length) { } MCFileReader::MCFileReader(const std::string& filename) - : base(filename) + : MemoryCopyReader(filename) { } diff --git a/src/athena/MCFileWriter.cpp b/src/athena/MCFileWriter.cpp index 968084f..d579daa 100644 --- a/src/athena/MCFileWriter.cpp +++ b/src/athena/MCFileWriter.cpp @@ -6,12 +6,12 @@ namespace io { MCFileWriter::MCFileWriter(atUint8* data, atUint64 length) - : base(data, length) + : MemoryCopyWriter(data, length) { } MCFileWriter::MCFileWriter(const std::string& filename) - : base(filename) + : MemoryCopyWriter(filename) { } diff --git a/src/athena/SkywardSwordFileReader.cpp b/src/athena/SkywardSwordFileReader.cpp index 81fe5c1..1727ae3 100644 --- a/src/athena/SkywardSwordFileReader.cpp +++ b/src/athena/SkywardSwordFileReader.cpp @@ -9,13 +9,13 @@ namespace io { SkywardSwordFileReader::SkywardSwordFileReader(atUint8* data, atUint64 length) - : base(data, length) + : MemoryCopyReader(data, length) { setEndian(Endian::BigEndian); } SkywardSwordFileReader::SkywardSwordFileReader(const std::string& filename) - : base(filename) + : MemoryCopyReader(filename) { setEndian(Endian::BigEndian); } diff --git a/src/athena/SkywardSwordFileWriter.cpp b/src/athena/SkywardSwordFileWriter.cpp index c3aa707..aefdf09 100644 --- a/src/athena/SkywardSwordFileWriter.cpp +++ b/src/athena/SkywardSwordFileWriter.cpp @@ -8,13 +8,13 @@ namespace io { SkywardSwordFileWriter::SkywardSwordFileWriter(atUint8* data, atUint64 len) - : base(data, len) + : MemoryCopyWriter(data, len) { setEndian(Endian::BigEndian); } SkywardSwordFileWriter::SkywardSwordFileWriter(const std::string& filename) - : base(filename) + : MemoryCopyWriter(filename) { setEndian(Endian::BigEndian); } diff --git a/src/athena/Sprite.cpp b/src/athena/Sprite.cpp index 697aec2..d48844f 100644 --- a/src/athena/Sprite.cpp +++ b/src/athena/Sprite.cpp @@ -22,21 +22,12 @@ Sprite::Sprite(SpriteFile* root, const std::string& name) : m_root(root), m_currentState(0) { -#ifdef ATHENA_USE_QT - m_name = QString::fromStdString(name); -#else m_name = name; -#endif } Sprite::~Sprite() { -#ifndef ATHENA_USE_QT - for (SpriteFrame* frame : m_frames) -#else - foreach (SpriteFrame* frame, m_frames) -#endif { delete frame; frame = NULL; @@ -47,49 +38,25 @@ Sprite::~Sprite() void Sprite::setPosition(const float x, const float y) { -#ifndef ATHENA_USE_QT setPosition(Vector2Df(x, y)); -#else - setPosition(QPoint(x, y)); -#endif } -#ifndef ATHENA_USE_QT void Sprite::setPosition(const Vector2Df& pos) -#else -void Sprite::setPosition(const QPoint& pos) -#endif { m_position = pos; } -#ifndef ATHENA_USE_QT Vector2Df Sprite::position() const -#else -QPoint Sprite::position() const -#endif { return m_position; } -#ifndef ATHENA_USE_QT void Sprite::setName(const std::string& name) -#else -void Sprite::setName(const QString& name) -#endif { m_name = name; - -#ifdef ATHENA_USE_QT - emit nameChanged(name); -#endif } -#ifndef ATHENA_USE_QT std::string Sprite::name() const -#else -QString Sprite::name() const -#endif { return m_name; } @@ -116,18 +83,10 @@ void Sprite::setStateIds(std::vector ids) if (ids.size() == 0) return; -#ifndef ATHENA_USE_QT m_stateIds = ids; -#else - m_stateIds = QList::fromVector(QVector::fromStdVector(ids)); -#endif } -#ifndef ATHENA_USE_QT std::vector Sprite::stateIds() const -#else -QList Sprite::stateIds() const -#endif { return m_stateIds; } @@ -143,9 +102,6 @@ void Sprite::setCurrentState(const atUint32 id) return; m_currentState = id; -#ifdef ATHENA_USE_QT - emit stateChanged(id); -#endif } atUint32 Sprite::currentState() const @@ -170,7 +126,6 @@ bool Sprite::addFrame(SpriteFrame* part) bool Sprite::removeFrame(SpriteFrame* frame) { -#ifndef ATHENA_USE_QT std::vector::iterator iter = std::find(m_frames.begin(), m_frames.end(), frame); if (iter != m_frames.end()) @@ -178,13 +133,6 @@ bool Sprite::removeFrame(SpriteFrame* frame) m_frames.erase(iter); return true; } - -#else - - if (m_frames.removeOne(frame)) - return true; - -#endif return false; } @@ -194,7 +142,6 @@ void Sprite::setFrame(atUint32 id) return; } -#ifndef ATHENA_USE_QT void Sprite::setFrames(std::vector frames) { if (frames.size() == 0) @@ -213,13 +160,6 @@ void Sprite::setFrames(std::vector frames) m_frames = frames; } -#else -void Sprite::setFrames(QList frames) -{ - m_frames.clear(); - m_frames = frames; -} -#endif atUint32 Sprite::frameCount() const @@ -227,11 +167,7 @@ atUint32 Sprite::frameCount() const return (atUint32)m_frames.size(); } -#ifndef ATHENA_USE_QT std::vector Sprite::frames() const -#else -QList Sprite::frames() const -#endif { return m_frames; } @@ -263,9 +199,6 @@ void Sprite::setCurrentFrame(atUint32 id) return; m_currentFrame = id; -#ifdef ATHENA_USE_QT - emit frameChanged(currentFrame()); -#endif } SpriteFrame* Sprite::currentFrame() const diff --git a/src/athena/SpriteFile.cpp b/src/athena/SpriteFile.cpp index 5b0f59b..8df907c 100644 --- a/src/athena/SpriteFile.cpp +++ b/src/athena/SpriteFile.cpp @@ -26,11 +26,7 @@ SpriteFile::SpriteFile(atUint32 width, atUint32 height, float originX, float ori { } -#ifndef ATHENA_USE_QT SpriteFile::SpriteFile(const Vector2Di& size, const Vector2Df& origin) -#else -SpriteFile::SpriteFile(const QSize& size, const QPoint& origin) -#endif : m_size(size), m_origin(origin) { @@ -38,113 +34,64 @@ SpriteFile::SpriteFile(const QSize& size, const QPoint& origin) SpriteFile::~SpriteFile() { -#ifndef ATHENA_USE_QT - for (std::pair sprite : m_sprites) { delete sprite.second; sprite.second = NULL; } -#endif m_sprites.clear(); } void SpriteFile::setSize(atUint32 width, atUint32 height) { -#ifndef ATHENA_USE_QT setSize(Vector2Di(width, height)); -#else - setSize(QSize(width, height)); -#endif } -#ifndef ATHENA_USE_QT void SpriteFile::setSize(const Vector2Di& size) -#else -void SpriteFile::setSize(const QSize& size) -#endif { m_size = size; -#ifdef ATHENA_USE_QT - emit sizeChanged(size); -#endif } -#ifndef ATHENA_USE_QT Vector2Di SpriteFile::size() const -#else -QSize SpriteFile::size() const -#endif { return m_size; } atUint32 SpriteFile::width() const { -#ifndef ATHENA_USE_QT return m_size.x; -#else - return m_size.width(); -#endif } atUint32 SpriteFile::height() const { -#ifndef ATHENA_USE_QT return m_size.y; -#else - return m_size.height(); -#endif } void SpriteFile::setOrigin(const float x, const float y) { -#ifndef ATHENA_USE_QT setOrigin(Vector2Df(x, y)); -#else - setOrigin(QPoint(x, y)); -#endif } -#ifndef ATHENA_USE_QT void SpriteFile::setOrigin(const Vector2Df& origin) -#else -void SpriteFile::setOrigin(const QPoint& origin) -#endif { m_origin = origin; -#ifdef ATHENA_USE_QT - emit originChanged(origin); -#endif } -#ifndef ATHENA_USE_QT Vector2Df SpriteFile::origin() const -#else -QPoint SpriteFile::origin() const -#endif { return m_origin; } float SpriteFile::originX() const { -#ifndef ATHENA_USE_QT return m_origin.x; -#else - return m_origin.x(); -#endif } float SpriteFile::originY() const { -#ifndef ATHENA_USE_QT return m_origin.y; -#else - return m_origin.y(); -#endif } bool SpriteFile::addTexture(STexture* texture) @@ -174,11 +121,7 @@ STexture* SpriteFile::texture(atUint32 id) return m_textures[id]; } -#ifndef ATHENA_USE_QT std::vector SpriteFile::textures() const -#else -QList SpriteFile::textures() const -#endif { return m_textures; } @@ -190,25 +133,15 @@ atUint32 SpriteFile::textureCount() const void SpriteFile::addSprite(Sprite* sprite) { -#ifndef ATHENA_USE_QT std::string name(sprite->name()); athena::utility::tolower(name); if (m_sprites.find(name) != m_sprites.end()) return; -#else - QString name = sprite->name().toLower(); - - if (m_sprites.contains(name)) - return; - -#endif - m_sprites[name] = sprite; } -#ifndef ATHENA_USE_QT void SpriteFile::removeSprite(const std::string& name) { std::string tmpName(name); @@ -218,19 +151,12 @@ void SpriteFile::removeSprite(const std::string& name) if (iterator != m_sprites.end()) m_sprites.erase(iterator); } -#else -void SpriteFile::removeSprite(const QString& name) -{ - m_sprites.remove(name.toLower()); -} -#endif void SpriteFile::removeSprite(Sprite* sprite) { removeSprite(sprite->name()); } -#ifndef ATHENA_USE_QT void SpriteFile::setSprites(std::unordered_map sprites) { if (sprites.size() == 0) @@ -249,18 +175,7 @@ void SpriteFile::setSprites(std::unordered_map sprites) m_sprites = sprites; } -#else -void SpriteFile::setSprites(QMap sprites) -{ - if (sprites.size() == 0) - return; - m_sprites.clear(); - m_sprites = sprites; -} -#endif - -#ifndef ATHENA_USE_QT Sprite* SpriteFile::sprite(const std::string& name) { std::string nameLow(name); @@ -271,21 +186,8 @@ Sprite* SpriteFile::sprite(const std::string& name) return m_sprites[nameLow]; } -#else -Sprite* SpriteFile::sprite(const QString& name) -{ - if (!m_sprites.contains(name.toLower())) - return NULL; - return m_sprites[name.toLower()]; -} -#endif - -#ifndef ATHENA_USE_QT std::unordered_map SpriteFile::sprites() const -#else -QMap SpriteFile::sprites() const -#endif { return m_sprites; } @@ -295,7 +197,6 @@ atUint32 SpriteFile::spriteCount() const return (atUint32)m_sprites.size(); } -#ifndef ATHENA_USE_QT void SpriteFile::setTextures(std::vector textures) { if (textures.size() == 0) @@ -314,15 +215,6 @@ void SpriteFile::setTextures(std::vector textures) m_textures = textures; } -#else -void SpriteFile::setTextures(QList textures) -{ - if (textures.size() == 0) - return; - m_textures.clear(); - m_textures = textures; -} -#endif } // Sakura } // zelda diff --git a/src/athena/SpriteFileReader.cpp b/src/athena/SpriteFileReader.cpp index f041a1b..d88f2c5 100644 --- a/src/athena/SpriteFileReader.cpp +++ b/src/athena/SpriteFileReader.cpp @@ -10,12 +10,12 @@ namespace athena namespace io { SpriteFileReader::SpriteFileReader(atUint8* data, atUint64 length) - : base(data, length) + : MemoryCopyReader(data, length) { } SpriteFileReader::SpriteFileReader(const std::string& filepath) - : base(filepath) + : MemoryCopyReader(filepath) { } diff --git a/src/athena/SpriteFileWriter.cpp b/src/athena/SpriteFileWriter.cpp index d5c380e..fdf034e 100644 --- a/src/athena/SpriteFileWriter.cpp +++ b/src/athena/SpriteFileWriter.cpp @@ -9,12 +9,12 @@ namespace athena namespace io { SpriteFileWriter::SpriteFileWriter(atUint8* data, atUint64 length) - : base(data, length) + : MemoryCopyWriter(data, length) { } SpriteFileWriter::SpriteFileWriter(const std::string& filepath) - : base(filepath) + : MemoryCopyWriter(filepath) { } @@ -26,73 +26,51 @@ void SpriteFileWriter::writeFile(Sakura::SpriteFile* file) return; } - base::writeUint32(Sakura::SpriteFile::Magic); - base::writeUint32(Sakura::SpriteFile::Version); + writeUint32(Sakura::SpriteFile::Magic); + writeUint32(Sakura::SpriteFile::Version); - base::writeUint16(file->textureCount()); - base::writeUint32(file->width()); - base::writeUint32(file->height()); - base::writeFloat(file->originX()); - base::writeFloat(file->originY()); - base::writeUint16(file->spriteCount()); + writeUint16(file->textureCount()); + writeUint32(file->width()); + writeUint32(file->height()); + writeFloat(file->originX()); + writeFloat(file->originY()); + writeUint16(file->spriteCount()); - base::writeUint32(0xFFFFFFFF); + writeUint32(0xFFFFFFFF); for (Sakura::STexture* texture : file->textures()) { - base::writeString(texture->Filepath); - base::writeBool(texture->Preload); + writeString(texture->Filepath); + writeBool(texture->Preload); } -#ifndef ATHENA_USE_QT - for (std::pair spritePair : file->sprites()) { Sakura::Sprite* sprite = spritePair.second; - base::writeString(sprite->name()); -#else - - foreach (Sakura::Sprite* sprite, file->sprites().values()) - { - - base::writeString(sprite->name().toStdString()); -#endif - base::writeUint16(sprite->frameCount()); - base::writeUint16(sprite->stateCount()); + writeString(sprite->name()); + writeUint16(sprite->frameCount()); + writeUint16(sprite->stateCount()); for (int id : sprite->stateIds()) - base::writeUint16(id); + writeUint16(id); for (Sakura::SpriteFrame* frame : sprite->frames()) { - base::writeFloat(frame->frameTime()); - base::writeUint16(frame->partCount()); + writeFloat(frame->frameTime()); + writeUint16(frame->partCount()); for (Sakura::SpritePart* part : frame->parts()) { -#ifndef ATHENA_USE_QT - base::writeString(part->name()); -#else - base::writeString(part->name().toStdString()); -#endif - base::writeBool(part->hasCollision()); -#ifndef ATHENA_USE_QT - base::writeFloat(part->offset().x); - base::writeFloat(part->offset().y); - base::writeFloat(part->textureOffset().x); - base::writeFloat(part->textureOffset().y); - base::writeUint32(part->size().x); - base::writeUint32(part->size().y); -#else - base::writeFloat(part->offset().x()); - base::writeFloat(part->offset().y()); - base::writeFloat(part->textureOffset().x()); - base::writeFloat(part->textureOffset().y()); - base::writeUint32(part->size().width()); - base::writeUint32(part->size().height()); -#endif - base::writeBool(part->flippedHorizontally()); - base::writeBool(part->flippedVertically()); + writeString(part->name()); + writeBool(part->hasCollision()); + writeFloat(part->offset().x); + writeFloat(part->offset().y); + writeFloat(part->textureOffset().x); + writeFloat(part->textureOffset().y); + writeUint32(part->size().x); + writeUint32(part->size().y); + writeBool(part->flippedHorizontally()); + writeBool(part->flippedVertically()); } } } diff --git a/src/athena/SpriteFrame.cpp b/src/athena/SpriteFrame.cpp index adfd244..1b2e4c3 100644 --- a/src/athena/SpriteFrame.cpp +++ b/src/athena/SpriteFrame.cpp @@ -19,25 +19,14 @@ SpriteFrame::SpriteFrame(Sprite* root) void SpriteFrame::setFrameTime(float frameTime) { m_frameTime = frameTime; -#ifdef ATHENA_USE_QT - emit frameTimeChanged(frameTime); -#endif } -#ifndef ATHENA_USE_QT void SpriteFrame::setParts(std::vector parts) -#else -void SpriteFrame::setParts(QList parts) -#endif { m_parts = parts; } -#ifndef ATHENA_USE_QT std::vector SpriteFrame::parts() const -#else -QList SpriteFrame::parts() const -#endif { return m_parts; } diff --git a/src/athena/SpritePart.cpp b/src/athena/SpritePart.cpp index 508aaa4..f9a2e04 100644 --- a/src/athena/SpritePart.cpp +++ b/src/athena/SpritePart.cpp @@ -18,34 +18,19 @@ SpritePart::SpritePart(SpriteFrame* root, const std::string& name, bool hasColli : m_root(root), m_hasCollision(hasCollision) { -#ifdef ATHENA_USE_QT - m_name = QString::fromStdString(name); -#else m_name = name; -#endif } SpritePart::~SpritePart() { } -#ifndef ATHENA_USE_QT void SpritePart::setName(const std::string& name) -#else -void SpritePart::setName(const QString& name) -#endif { m_name = name; -#ifdef ATHENA_USE_QT - emit nameChanged(name); -#endif } -#ifndef ATHENA_USE_QT std::string SpritePart::name() const -#else -QString SpritePart::name() const -#endif { return m_name; } @@ -53,9 +38,6 @@ QString SpritePart::name() const void SpritePart::setCollision(bool col) { m_hasCollision = col; -#ifdef ATHENA_USE_QT - emit collisionChanged(col); -#endif } bool SpritePart::hasCollision() const @@ -65,90 +47,45 @@ bool SpritePart::hasCollision() const void SpritePart::setOffset(float x, float y) { -#ifndef ATHENA_USE_QT setOffset(Vector2Df(x, y)); -#else - setOffset(QPoint(x, y)); -#endif } -#ifndef ATHENA_USE_QT void SpritePart::setOffset(const Vector2Df& offset) -#else -void SpritePart::setOffset(const QPoint& offset) -#endif { m_offset = offset; -#ifdef ATHENA_USE_QT - emit offsetChanged(offset); -#endif } -#ifndef ATHENA_USE_QT Vector2Df SpritePart::offset() const -#else -QPoint SpritePart::offset() const -#endif { return m_offset; } void SpritePart::setTextureOffset(float x, float y) { -#ifndef ATHENA_USE_QT setTextureOffset(Vector2Df(x, y)); -#else - setTextureOffset(QPoint(x, y)); -#endif } -#ifndef ATHENA_USE_QT void SpritePart::setTextureOffset(const Vector2Df& offset) -#else -void SpritePart::setTextureOffset(const QPoint& offset) -#endif { m_textureOffset = offset; -#ifdef ATHENA_USE_QT - emit textureOffsetChanged(offset); -#endif } -#ifndef ATHENA_USE_QT Vector2Df SpritePart::textureOffset() const -#else -QPoint SpritePart::textureOffset() const -#endif { return m_textureOffset; } void SpritePart::setSize(atUint32 width, atUint32 height) { -#ifndef ATHENA_USE_QT setSize(Vector2Di(width, height)); -#else - setSize(QSize(width, height)); -#endif } -#ifndef ATHENA_USE_QT void SpritePart::setSize(const Vector2Di& size) -#else -void SpritePart::setSize(const QSize& size) -#endif { m_size = size; -#ifdef ATHENA_USE_QT - emit sizeChanged(size); -#endif } -#ifndef ATHENA_USE_QT Vector2Di SpritePart::size() const -#else -QSize SpritePart::size() const -#endif { return m_size; } @@ -156,9 +93,6 @@ QSize SpritePart::size() const void SpritePart::setFlippedHorizontally(const bool val) { m_flippedH = val; -#ifdef ATHENA_USE_QT - emit orientationChanged(val, flippedVertically()); -#endif } bool SpritePart::flippedHorizontally() const @@ -169,9 +103,6 @@ bool SpritePart::flippedHorizontally() const void SpritePart::setFlippedVertically(const bool val) { m_flippedV = val; -#ifdef ATHENA_USE_QT - emit orientationChanged(flippedHorizontally(), val); -#endif } bool SpritePart::flippedVertically() const diff --git a/src/athena/ZQuestFileReader.cpp b/src/athena/ZQuestFileReader.cpp index 60492a9..47fb1f9 100644 --- a/src/athena/ZQuestFileReader.cpp +++ b/src/athena/ZQuestFileReader.cpp @@ -13,12 +13,12 @@ namespace io { ZQuestFileReader::ZQuestFileReader(atUint8* data, atUint64 length) - : base(data, length) + : MemoryCopyReader(data, length) { } ZQuestFileReader::ZQuestFileReader(const std::string& filename) - : base(filename) + : MemoryCopyReader(filename) { } diff --git a/src/athena/ZQuestFileWriter.cpp b/src/athena/ZQuestFileWriter.cpp index 1634fa2..212d3c1 100644 --- a/src/athena/ZQuestFileWriter.cpp +++ b/src/athena/ZQuestFileWriter.cpp @@ -9,12 +9,12 @@ namespace io { ZQuestFileWriter::ZQuestFileWriter(atUint8* data, atUint64 length) - : base(data, length) + : MemoryCopyWriter(data, length) { } ZQuestFileWriter::ZQuestFileWriter(const std::string& filename) - : base(filename) + : MemoryCopyWriter(filename) { }