mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
IOFile: removes seek limit checks when file is writable
This commit is contained in:
parent
c70a4965c2
commit
f884b6d208
@ -377,16 +377,18 @@ bool IOFile::Seek(s64 offset, SeekOrigin origin) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 size = GetSize();
|
if (False(file_access_mode & (FileAccessMode::Write | FileAccessMode::Append))) {
|
||||||
if (origin == SeekOrigin::CurrentPosition && Tell() + offset > size) {
|
u64 size = GetSize();
|
||||||
LOG_ERROR(Common_Filesystem, "Seeking past the end of the file");
|
if (origin == SeekOrigin::CurrentPosition && Tell() + offset > size) {
|
||||||
return false;
|
LOG_ERROR(Common_Filesystem, "Seeking past the end of the file");
|
||||||
} else if (origin == SeekOrigin::SetOrigin && (u64)offset > size) {
|
return false;
|
||||||
LOG_ERROR(Common_Filesystem, "Seeking past the end of the file");
|
} else if (origin == SeekOrigin::SetOrigin && (u64)offset > size) {
|
||||||
return false;
|
LOG_ERROR(Common_Filesystem, "Seeking past the end of the file");
|
||||||
} else if (origin == SeekOrigin::End && offset > 0) {
|
return false;
|
||||||
LOG_ERROR(Common_Filesystem, "Seeking past the end of the file");
|
} else if (origin == SeekOrigin::End && offset > 0) {
|
||||||
return false;
|
LOG_ERROR(Common_Filesystem, "Seeking past the end of the file");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "common/concepts.h"
|
#include "common/concepts.h"
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
#include "enum.h"
|
||||||
|
|
||||||
namespace Common::FS {
|
namespace Common::FS {
|
||||||
|
|
||||||
@ -42,6 +43,7 @@ enum class FileAccessMode {
|
|||||||
*/
|
*/
|
||||||
ReadAppend = Read | Append,
|
ReadAppend = Read | Append,
|
||||||
};
|
};
|
||||||
|
DECLARE_ENUM_FLAG_OPERATORS(FileAccessMode);
|
||||||
|
|
||||||
enum class FileType {
|
enum class FileType {
|
||||||
BinaryFile,
|
BinaryFile,
|
||||||
|
Loading…
Reference in New Issue
Block a user