diff --git a/CMakeLists.txt b/CMakeLists.txt index feb0a97..3f1075e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,8 @@ if(WIN32) list(APPEND CORE_EXTRA src/win32_largefilewrapper.c) elseif(APPLE) list(APPEND CORE_EXTRA src/osx_largefilewrapper.c) +elseif(GEKKO) +list(APPEND CORE_EXTRA src/gekko_support.c) endif() add_library(AthenaCore @@ -41,7 +43,6 @@ add_library(AthenaCore src/LZ77/LZBase.cpp src/Athena/FileInfo.cpp src/Athena/Dir.cpp - src/gekko_support.c ${CORE_EXTRA} include/Athena/IStream.hpp diff --git a/include/Athena/IStreamReader.hpp b/include/Athena/IStreamReader.hpp index 43d041f..a6b27d8 100644 --- a/include/Athena/IStreamReader.hpp +++ b/include/Athena/IStreamReader.hpp @@ -221,6 +221,28 @@ public: return val != 0; } + /*! \brief Reads an atVec2f (8 bytes) and advances the current position + * + * \return atVec2f The value at the current address + * \throw IOException when address is out of range + */ + inline atVec2f readVec3f() + { + atVec2f val; + readUBytesToBuf(&val, 8); + if (m_endian == BigEndian) + { + utility::BigFloat(val.vec[0]); + utility::BigFloat(val.vec[1]); + } + else + { + utility::LittleFloat(val.vec[0]); + utility::LittleFloat(val.vec[1]); + } + return val; + } + /*! \brief Reads an atVec3f (12 bytes) and advances the current position * * \return atVec3f The value at the current address diff --git a/include/Athena/IStreamWriter.hpp b/include/Athena/IStreamWriter.hpp index b3edc55..2dff6f2 100644 --- a/include/Athena/IStreamWriter.hpp +++ b/include/Athena/IStreamWriter.hpp @@ -204,6 +204,27 @@ public: */ inline void writeBool(bool val) {writeUBytes((atUint8*)&val, 1);} + /*! \brief Writes an atVec2f (8 bytes) to the buffer and advances the buffer. + * It also swaps the bytes depending on the platform and Stream settings. + * + * \sa Endian + * \param vec The value to write to the buffer + */ + inline void writeVec2f(atVec2f vec) + { + if (m_endian == BigEndian) + { + utility::BigFloat(vec.vec[0]); + utility::BigFloat(vec.vec[1]); + } + else + { + utility::LittleFloat(vec.vec[0]); + utility::LittleFloat(vec.vec[1]); + } + writeUBytes((atUint8*)&vec, 8); + } + /*! \brief Writes an atVec3f (12 bytes) to the buffer and advances the buffer. * It also swaps the bytes depending on the platform and Stream settings. * diff --git a/include/Athena/Types.hpp b/include/Athena/Types.hpp index 765e19a..8cef4d2 100644 --- a/include/Athena/Types.hpp +++ b/include/Athena/Types.hpp @@ -46,6 +46,17 @@ typedef unsigned long long atUint64; #include #endif +typedef union +{ +#if __clang__ + float clangVec __attribute__((__vector_size__(8))); +#endif +#if __SSE__ + __m128 mVec128; +#endif + float vec[2]; +} atVec2f; + typedef union { #if __clang__