diff --git a/rpcs3/Emu/Cell/lv2/lv2.cpp b/rpcs3/Emu/Cell/lv2/lv2.cpp index 24e57b4a8c..65777722ae 100644 --- a/rpcs3/Emu/Cell/lv2/lv2.cpp +++ b/rpcs3/Emu/Cell/lv2/lv2.cpp @@ -746,7 +746,7 @@ const std::array s_ppu_syscall_table null_func,//BIND_FUNC(sys_fs_mount), //837 (0x345) null_func,//BIND_FUNC(sys_fs_unmount), //838 (0x346) null_func,//BIND_FUNC(sys_fs_sync), //839 (0x347) - null_func,//BIND_FUNC(sys_fs_disk_free), //840 (0x348) + BIND_FUNC(sys_fs_disk_free), //840 (0x348) null_func,//BIND_FUNC(sys_fs_get_mount_info_size), //841 (0x349) null_func,//BIND_FUNC(sys_fs_get_mount_info), //842 (0x34A) null_func,//BIND_FUNC(sys_fs_get_fs_info_size), //843 (0x34B) diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.cpp b/rpcs3/Emu/Cell/lv2/sys_fs.cpp index 205a20765f..4b53ce8dba 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_fs.cpp @@ -1166,6 +1166,28 @@ error_code sys_fs_chown(vm::cptr path, s32 uid, s32 gid) return CELL_OK; } +error_code sys_fs_disk_free(vm::ps3::cptr path, vm::ptr total_free, vm::ptr avail_free) +{ + sys_fs.warning("sys_fs_disk_free(path=%s total_free=*0x%x avail_free=*0x%x)", path, total_free, avail_free); + + fs::device_stat info; + if (!fs::statfs(vfs::get(path.get_ptr()), info)) + { + switch (auto error = fs::g_tls_error) + { + case fs::error::noent: return CELL_ENOENT; + default: sys_fs.error("sys_fs_disk_free(): unknown error %s", error); + } + + return CELL_EIO; // ??? + } + + *total_free = info.total_free; + *avail_free = info.avail_free; //Only value used by cellFsGetFreeSize + + return CELL_OK; +} + error_code sys_fs_utime(vm::ps3::cptr path, vm::ps3::cptr timep) { sys_fs.warning("sys_fs_utime(path=%s, timep=*0x%x)", path, timep); diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.h b/rpcs3/Emu/Cell/lv2/sys_fs.h index ae596ccea9..d4d1a070d3 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.h +++ b/rpcs3/Emu/Cell/lv2/sys_fs.h @@ -368,6 +368,7 @@ error_code sys_fs_ftruncate(u32 fd, u64 size); error_code sys_fs_symbolic_link(vm::ps3::cptr target, vm::ps3::cptr linkpath); error_code sys_fs_chmod(vm::ps3::cptr path, s32 mode); error_code sys_fs_chown(vm::ps3::cptr path, s32 uid, s32 gid); +error_code sys_fs_disk_free(vm::ps3::cptr path, vm::ps3::ptr total_free, vm::ps3::ptr avail_free); error_code sys_fs_utime(vm::ps3::cptr path, vm::ps3::cptr timep); error_code sys_fs_acl_read(vm::ps3::cptr path, vm::ps3::ptr); error_code sys_fs_acl_write(vm::ps3::cptr path, vm::ps3::ptr);