From ea92214ff572c8dd32b1bbc10cf1e68e287133c4 Mon Sep 17 00:00:00 2001 From: Stephen Miller Date: Fri, 13 Jun 2025 23:22:03 -0500 Subject: [PATCH] sceKernelWrite hack Seems like std::fwrite has some weird edge cases we aren't handling properly. Until we get to the bottom of this issue, here's a hack that bypasses it. This fixes saves in DRAGON BALL XENOVERSE (CUSA01341) --- src/core/libraries/kernel/file_system.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/libraries/kernel/file_system.cpp b/src/core/libraries/kernel/file_system.cpp index 2e9e2ee07..74b79d462 100644 --- a/src/core/libraries/kernel/file_system.cpp +++ b/src/core/libraries/kernel/file_system.cpp @@ -293,7 +293,12 @@ s64 PS4_SYSV_ABI write(s32 fd, const void* buf, size_t nbytes) { } return result; } - return file->f.WriteRaw(buf, nbytes); + auto written_bytes = file->f.WriteRaw(buf, nbytes); + auto file_size = file->f.GetSize(); + if (file_size != written_bytes) { + file->f.SetSize(written_bytes); + } + return written_bytes; } s64 PS4_SYSV_ABI posix_write(s32 fd, const void* buf, size_t nbytes) {