mirror of https://github.com/libAthena/athena.git
* Add windows specific wrappers
This commit is contained in:
parent
c0974d511a
commit
a19520ea1e
|
@ -45,6 +45,7 @@ SOURCES += \
|
|||
$$PWD/src/sha1.cpp \
|
||||
$$PWD/src/aes.c \
|
||||
$$PWD/src/lzo.c
|
||||
win32:SOURCES += $$PWD/src/win32_largefilewrapper.c
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/include/Athena/Stream.hpp \
|
||||
|
@ -102,6 +103,9 @@ HEADERS += \
|
|||
$$PWD/include/Athena/ZQuestFileReader.hpp \
|
||||
$$PWD/include/Athena/ZQuestFileWriter.hpp
|
||||
|
||||
win32:HEADERS += \
|
||||
$$PWD/Athena/include/win32_largefilewrapper.h
|
||||
|
||||
OTHER_FILES += \
|
||||
.travis.yml
|
||||
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
#include "Athena/Utility.hpp"
|
||||
#include <iostream>
|
||||
|
||||
#if !defined(__PRETTY_FUNCTION__) && defined(_WIN32)
|
||||
#define __PRETTY_FUNCTION__ __FUNCSIG__
|
||||
#endif
|
||||
|
||||
#ifndef aDebug
|
||||
#define aDebug() \
|
||||
std::cout << __FILE__ << "(" << __LINE__ << ") " << __PRETTY_FUNCTION__ << ": "
|
||||
|
@ -59,7 +63,7 @@ namespace Sakura
|
|||
|
||||
template <typename T>
|
||||
class Vector2D
|
||||
{
|
||||
{ifndef
|
||||
public:
|
||||
T x;
|
||||
T y;
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef WIN32_LARGEFILEWRAPPER_H
|
||||
#define WIN32_LARGEFILEWRAPPER_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <stdio.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int fseeko64(FILE* fp, off64_t offset, int whence);
|
||||
int ftello64(FILE* fp);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // WIN32_LARGEFILEWRAPPER_H
|
|
@ -54,11 +54,7 @@ BinaryWriter::BinaryWriter(const std::string& filename, std::function<void(int)>
|
|||
m_length = 0x10;
|
||||
m_bitPosition = 0;
|
||||
m_position = 0;
|
||||
#ifdef HW_RVL
|
||||
m_data = (Uint8*)memalign(32, m_length);
|
||||
#else
|
||||
m_data = new Uint8[m_length];
|
||||
#endif
|
||||
|
||||
if (!m_data)
|
||||
THROW_IO_EXCEPTION("Could not allocate memory!");
|
||||
|
@ -159,11 +155,7 @@ std::string BinaryWriter::filepath() const
|
|||
void BinaryWriter::setData(const Uint8* data, Uint64 length)
|
||||
{
|
||||
if (m_data)
|
||||
#ifdef HW_RVL
|
||||
free(m_data);
|
||||
#else
|
||||
delete[] m_data;
|
||||
#endif
|
||||
|
||||
m_data = (Uint8*)data;
|
||||
m_length = length;
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
#include "Athena/IOException.hpp"
|
||||
#include "utf8.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "win32_largefilewrapper.h"
|
||||
#endif
|
||||
|
||||
namespace Athena
|
||||
{
|
||||
namespace io
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#include "win32_largefilewrapper.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
int fseeko64(FILE* fp, off64_t offset, int whence)
|
||||
{
|
||||
return _fseeki64(fp, offset, whence);
|
||||
}
|
||||
|
||||
int ftello64(FILE* fp)
|
||||
{
|
||||
return _ftelli64(fp);
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue