fix(kernel): return 64-bit offsets from sceKernelLseek

The SCE ABI returns off_t; offsets above INT_MAX threw instead of being returned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
QDarkRex
2026-09-27 12:38:59 +07:00
parent 76b7f998f5
commit 15b749c2ba
2 changed files with 3 additions and 6 deletions
@@ -13,7 +13,7 @@ int APS5_VABI sceKernelOpen(const char* path, int flags, std::uint16_t mode);
int APS5_VABI sceKernelClose(int d);
std::int64_t APS5_VABI sceKernelRead(int d, void* buf, std::size_t nbytes);
std::int64_t APS5_VABI sceKernelWrite(int d, const void* buf, std::size_t nbytes);
int APS5_VABI sceKernelLseek(int d, std::int64_t offset, int whence);
std::int64_t APS5_VABI sceKernelLseek(int d, std::int64_t offset, int whence);
int APS5_VABI sceKernelStat(const char* path, FileStat* sb);
int APS5_VABI sceKernelUnlink(const char* path);
+2 -5
View File
@@ -132,7 +132,7 @@ std::int64_t APS5_VABI sceKernelWrite(int d, const void* buf, std::size_t nbytes
return static_cast<std::int64_t>(n);
}
int APS5_VABI sceKernelLseek(int d, std::int64_t offset, int whence) {
std::int64_t APS5_VABI sceKernelLseek(int d, std::int64_t offset, int whence) {
if (whence < 0 || whence > 2) {
throw std::invalid_argument(std::string(__func__) + ": invalid whence=" + std::to_string(whence));
}
@@ -140,10 +140,7 @@ int APS5_VABI sceKernelLseek(int d, std::int64_t offset, int whence) {
if (result < 0) {
throw std::runtime_error(std::string(__func__) + ": lseek failed, fd=" + std::to_string(d) + ", errno=" + std::to_string(errno));
}
if (result > static_cast<std::int64_t>(std::numeric_limits<int>::max())) {
throw std::overflow_error(std::string(__func__) + ": result " + std::to_string(result) + " overflows int return type");
}
return static_cast<int>(result);
return result;
}
int APS5_VABI sceKernelStat(const char* path, FileStat* sb) {