mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
let host os set lseek errors
This commit is contained in:
parent
27aa629ebb
commit
4fa9d8e18b
@ -377,20 +377,6 @@ bool IOFile::Seek(s64 offset, SeekOrigin origin) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (False(file_access_mode & (FileAccessMode::Write | FileAccessMode::Append))) {
|
|
||||||
u64 size = GetSize();
|
|
||||||
if (origin == SeekOrigin::CurrentPosition && Tell() + offset > size) {
|
|
||||||
LOG_ERROR(Common_Filesystem, "Seeking past the end of the file");
|
|
||||||
return false;
|
|
||||||
} else if (origin == SeekOrigin::SetOrigin && (u64)offset > size) {
|
|
||||||
LOG_ERROR(Common_Filesystem, "Seeking past the end of the file");
|
|
||||||
return false;
|
|
||||||
} else if (origin == SeekOrigin::End && offset > 0) {
|
|
||||||
LOG_ERROR(Common_Filesystem, "Seeking past the end of the file");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
const auto seek_result = fseeko(file, offset, ToSeekOrigin(origin)) == 0;
|
const auto seek_result = fseeko(file, offset, ToSeekOrigin(origin)) == 0;
|
||||||
|
@ -289,6 +289,7 @@ size_t PS4_SYSV_ABI _writev(int fd, const SceKernelIovec* iov, int iovcn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
s64 PS4_SYSV_ABI sceKernelLseek(int d, s64 offset, int whence) {
|
s64 PS4_SYSV_ABI sceKernelLseek(int d, s64 offset, int whence) {
|
||||||
|
LOG_TRACE(Kernel_Fs, "called: offset {} whence {}", offset, whence);
|
||||||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||||
auto* file = h->GetFile(d);
|
auto* file = h->GetFile(d);
|
||||||
if (file == nullptr) {
|
if (file == nullptr) {
|
||||||
@ -321,10 +322,6 @@ s64 PS4_SYSV_ABI posix_lseek(int d, s64 offset, int whence) {
|
|||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
LOG_ERROR(Kernel_Pthread, "posix_lseek: error = {}", result);
|
LOG_ERROR(Kernel_Pthread, "posix_lseek: error = {}", result);
|
||||||
ErrSceToPosix(result);
|
ErrSceToPosix(result);
|
||||||
// Workaround for XNA AudioEngine
|
|
||||||
if (whence == SEEK_SET && (s32)offset == -1) {
|
|
||||||
return offset;
|
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user