summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2015-12-28 16:03:09 +0100
committerSubv <subv2112@gmail.com>2016-03-20 20:28:17 +0100
commit96f0e32f836b19edb3d14ce4f87a7aed1ac6a8e1 (patch)
tree9eed35100efe7714f7ef5a39ff2c3bbf897f3dae /src/core/hle
parentHLE/FS: Corrected the error codes for DeleteFile (diff)
downloadyuzu-96f0e32f836b19edb3d14ce4f87a7aed1ac6a8e1.tar
yuzu-96f0e32f836b19edb3d14ce4f87a7aed1ac6a8e1.tar.gz
yuzu-96f0e32f836b19edb3d14ce4f87a7aed1ac6a8e1.tar.bz2
yuzu-96f0e32f836b19edb3d14ce4f87a7aed1ac6a8e1.tar.lz
yuzu-96f0e32f836b19edb3d14ce4f87a7aed1ac6a8e1.tar.xz
yuzu-96f0e32f836b19edb3d14ce4f87a7aed1ac6a8e1.tar.zst
yuzu-96f0e32f836b19edb3d14ce4f87a7aed1ac6a8e1.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/result.h1
-rw-r--r--src/core/hle/service/fs/archive.cpp17
2 files changed, 16 insertions, 2 deletions
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index b9ee5f7d9..b68c0ff0d 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -21,6 +21,7 @@ enum class ErrorDescription : u32 {
WrongAddress = 53,
FS_NotFound = 120,
FS_AlreadyExists = 190,
+ FS_InvalidOpenFlags = 230,
FS_NotAFile = 250,
FS_NotFormatted = 340, ///< This is used by the FS service when creating a SaveData archive
InvalidSection = 1000,
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index cb98fa7aa..8c38c3ba4 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -103,7 +103,14 @@ ResultVal<bool> File::SyncRequest() {
u32 address = cmd_buff[5];
LOG_TRACE(Service_FS, "Read %s %s: offset=0x%llx length=%d address=0x%x",
GetTypeName().c_str(), GetName().c_str(), offset, length, address);
- cmd_buff[2] = static_cast<u32>(backend->Read(offset, length, Memory::GetPointer(address)));
+ if (offset + length > backend->GetSize())
+ LOG_ERROR(Service_FS, "Reading from out of bounds offset=0x%llX length=0x%08X file_size=0x%llX", offset, length, backend->GetSize());
+ ResultVal<size_t> read = backend->Read(offset, length, Memory::GetPointer(address));
+ if (read.Failed()) {
+ cmd_buff[1] = read.Code().raw;
+ return read.Code();
+ }
+ cmd_buff[2] = static_cast<u32>(read.MoveFrom());
break;
}
@@ -116,7 +123,13 @@ ResultVal<bool> File::SyncRequest() {
u32 address = cmd_buff[6];
LOG_TRACE(Service_FS, "Write %s %s: offset=0x%llx length=%d address=0x%x, flush=0x%x",
GetTypeName().c_str(), GetName().c_str(), offset, length, address, flush);
- cmd_buff[2] = static_cast<u32>(backend->Write(offset, length, flush != 0, Memory::GetPointer(address)));
+
+ ResultVal<size_t> written = backend->Write(offset, length, flush != 0, Memory::GetPointer(address));
+ if (written.Failed()) {
+ cmd_buff[1] = written.Code().raw;
+ return written.Code();
+ }
+ cmd_buff[2] = static_cast<u32>(written.MoveFrom());
break;
}