mirror of https://github.com/AxioDL/nod.git
devkitA64 compilation fixes
This commit is contained in:
parent
9a10e58f8d
commit
bad0f06254
|
@ -265,7 +265,7 @@ static inline FILE* Fopen(const SystemChar* path, const SystemChar* mode, FileLo
|
||||||
OVERLAPPED ov = {};
|
OVERLAPPED ov = {};
|
||||||
LockFileEx((HANDLE)(uintptr_t)_fileno(fp), (lock == FileLockType::Write) ? LOCKFILE_EXCLUSIVE_LOCK : 0, 0, 0, 1,
|
LockFileEx((HANDLE)(uintptr_t)_fileno(fp), (lock == FileLockType::Write) ? LOCKFILE_EXCLUSIVE_LOCK : 0, 0, 0, 1,
|
||||||
&ov);
|
&ov);
|
||||||
#else
|
#elif !defined(__SWITCH__)
|
||||||
if (flock(fileno(fp), ((lock == FileLockType::Write) ? LOCK_EX : LOCK_SH) | LOCK_NB))
|
if (flock(fileno(fp), ((lock == FileLockType::Write) ? LOCK_EX : LOCK_SH) | LOCK_NB))
|
||||||
LogModule.report(logvisor::Error, FMT_STRING("flock {}: {}"), path, strerror(errno));
|
LogModule.report(logvisor::Error, FMT_STRING("flock {}: {}"), path, strerror(errno));
|
||||||
#endif
|
#endif
|
||||||
|
@ -277,7 +277,7 @@ static inline FILE* Fopen(const SystemChar* path, const SystemChar* mode, FileLo
|
||||||
static inline int FSeek(FILE* fp, int64_t offset, int whence) {
|
static inline int FSeek(FILE* fp, int64_t offset, int whence) {
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
return _fseeki64(fp, offset, whence);
|
return _fseeki64(fp, offset, whence);
|
||||||
#elif __APPLE__ || __FreeBSD__
|
#elif __APPLE__ || __FreeBSD__ || __SWITCH__
|
||||||
return fseeko(fp, offset, whence);
|
return fseeko(fp, offset, whence);
|
||||||
#else
|
#else
|
||||||
return fseeko64(fp, offset, whence);
|
return fseeko64(fp, offset, whence);
|
||||||
|
@ -287,7 +287,7 @@ static inline int FSeek(FILE* fp, int64_t offset, int whence) {
|
||||||
static inline int64_t FTell(FILE* fp) {
|
static inline int64_t FTell(FILE* fp) {
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
return _ftelli64(fp);
|
return _ftelli64(fp);
|
||||||
#elif __APPLE__ || __FreeBSD__
|
#elif __APPLE__ || __FreeBSD__ || __SWITCH__
|
||||||
return ftello(fp);
|
return ftello(fp);
|
||||||
#else
|
#else
|
||||||
return ftello64(fp);
|
return ftello64(fp);
|
||||||
|
|
|
@ -284,6 +284,7 @@ static bool IsSystemFile(SystemStringView name, bool& isDol) {
|
||||||
* This is required for multi-DOL games, but doesn't harm functionality otherwise */
|
* This is required for multi-DOL games, but doesn't harm functionality otherwise */
|
||||||
static void PatchDOL(std::unique_ptr<uint8_t[]>& buf, size_t sz, bool& patched) {
|
static void PatchDOL(std::unique_ptr<uint8_t[]>& buf, size_t sz, bool& patched) {
|
||||||
patched = false;
|
patched = false;
|
||||||
|
#ifndef __SWITCH__
|
||||||
uint8_t* found = static_cast<uint8_t*>(memmem(buf.get(), sz,
|
uint8_t* found = static_cast<uint8_t*>(memmem(buf.get(), sz,
|
||||||
"\x3C\x03\xF8\x00\x28\x00\x00\x00\x40\x82\x00\x0C"
|
"\x3C\x03\xF8\x00\x28\x00\x00\x00\x40\x82\x00\x0C"
|
||||||
"\x38\x60\x00\x01\x48\x00\x02\x44\x38\x61\x00\x18\x48",
|
"\x38\x60\x00\x01\x48\x00\x02\x44\x38\x61\x00\x18\x48",
|
||||||
|
@ -292,6 +293,7 @@ static void PatchDOL(std::unique_ptr<uint8_t[]>& buf, size_t sz, bool& patched)
|
||||||
found[11] = '\x04';
|
found[11] = '\x04';
|
||||||
patched = true;
|
patched = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t PatchDOL(IFileIO::IReadStream& in, IPartWriteStream& out, size_t sz, bool& patched) {
|
static size_t PatchDOL(IFileIO::IReadStream& in, IPartWriteStream& out, size_t sz, bool& patched) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#else
|
#elif __x86_64__
|
||||||
#include <cpuid.h>
|
#include <cpuid.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
# endif
|
# endif
|
||||||
#else // ! defined __LITTLE_ENDIAN__
|
#else // ! defined __LITTLE_ENDIAN__
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
# include <endian.h> // machine/endian.h
|
# include <machine/endian.h>
|
||||||
#endif
|
#endif
|
||||||
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||||
# define SHA_BIG_ENDIAN
|
# define SHA_BIG_ENDIAN
|
||||||
|
|
Loading…
Reference in New Issue