Core: Bring over some file related Switch changes.

Reducing the distance from the Switch port code.
This commit is contained in:
Unknown W. Brackets 2020-03-03 22:53:03 -08:00
parent 051a84e9bd
commit cb1b7b1e43
10 changed files with 40 additions and 13 deletions

View file

@ -117,7 +117,12 @@ std::string LocalFileLoader::Path() const {
}
size_t LocalFileLoader::ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data, Flags flags) {
#if PPSSPP_PLATFORM(ANDROID)
#if PPSSPP_PLATFORM(SWITCH)
// Toolchain has no fancy IO API. We must lock.
std::lock_guard<std::mutex> guard(readLock_);
lseek(fd_, absolutePos, SEEK_SET);
return read(fd_, data, bytes * count) / bytes;
#elif PPSSPP_PLATFORM(ANDROID)
// pread64 doesn't appear to actually be 64-bit safe, though such ISOs are uncommon. See #10862.
if (absolutePos <= 0x7FFFFFFF) {
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS < 64