diff --git a/Common/CommonFuncs.h b/Common/CommonFuncs.h index 4d18e2c84f..76d960226e 100644 --- a/Common/CommonFuncs.h +++ b/Common/CommonFuncs.h @@ -59,10 +59,6 @@ inline u64 __rotr64(u64 x, unsigned int shift){ return (x >> n) | (x << (64 - n)); } -#ifndef linux -#define pread64 pread -#endif - #else // WIN32 // Function Cross-Compatibility diff --git a/Core/FileLoaders/LocalFileLoader.cpp b/Core/FileLoaders/LocalFileLoader.cpp index a06e79b825..588d2c944e 100644 --- a/Core/FileLoaders/LocalFileLoader.cpp +++ b/Core/FileLoaders/LocalFileLoader.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include #include "ppsspp_config.h" #include "util/text/utf8.h" #include "file/file_util.h" @@ -36,9 +37,15 @@ LocalFileLoader::LocalFileLoader(const std::string &filename) if (fd_ == -1) { return; } +#if defined(__ANDROID__) || (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS < 64) off64_t off = lseek64(fd_, 0, SEEK_END); filesize_ = off; lseek64(fd_, 0, SEEK_SET); +#else + off_t off = lseek(fd_, 0, SEEK_END); + filesize_ = off; + lseek(fd_, 0, SEEK_SET); +#endif #else // !_WIN32 @@ -104,7 +111,11 @@ std::string LocalFileLoader::Path() const { size_t LocalFileLoader::ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data, Flags flags) { #ifndef _WIN32 +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS < 64 return pread64(fd_, data, bytes * count, absolutePos) / bytes; +#else + return pread(fd_, data, bytes * count, absolutePos) / bytes; +#endif #else DWORD read = -1; OVERLAPPED offset = { 0 };