diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.cpp b/rpcs3/Emu/Cell/lv2/sys_fs.cpp index 151586df90..baeefd5a4f 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_fs.cpp @@ -1330,6 +1330,18 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 switch (op) { + case 0x80000004: // Unknown + { + if (_size > 4) + { + return CELL_EINVAL; + } + + const auto arg = vm::static_ptr_cast(_arg); + *arg = 0; + break; + } + case 0x80000006: // cellFsAllocateFileAreaByFdWithInitialData { break; @@ -2326,6 +2338,13 @@ error_code sys_fs_get_mount_info_size(ppu_thread&, vm::ptr len) { sys_fs.todo("sys_fs_get_mount_info_size(len=*0x%x)", len); + if (!len) + { + return CELL_EFAULT; + } + + *len = 0x8; + return CELL_OK; } @@ -2333,6 +2352,46 @@ error_code sys_fs_get_mount_info(ppu_thread&, vm::ptr info, u32 { sys_fs.todo("sys_fs_get_mount_info(info=*0x%x, len=0x%x, out_len=*0x%x)", info, len, out_len); + if (!out_len) + { + return CELL_EFAULT; + } + + // TODO there is a case where 'something' happens if !info or len == 0 + if (!info || len == 0) + { + sys_fs.todo("sys_fs_get_mount_info special case TODO"); + } + + const u32 max_len = std::min(len, 8); + *out_len = max_len; + + struct mount_info + { + std::string_view path, filesystem, dev_name; + be_t unk1 = 0, unk2 = 0, unk3 = 0, unk4 = 0, unk5 = 0; + }; + + static constexpr std::array data + { + mount_info{.path = "/", .filesystem = "CELL_FS_ADMINFS", .dev_name = "CELL_FS_ADMINFS:", .unk5 = 0x10000000}, + mount_info{.path = "/app_home", .filesystem = "CELL_FS_DUMMY", .dev_name = "CELL_FS_DUMMY:"}, + mount_info{.path = "/host_root", .filesystem = "CELL_FS_DUMMY", .dev_name = "CELL_FS_DUMMY:"}, + mount_info{.path = "/dev_flash", .filesystem = "CELL_FS_FAT", .dev_name = "CELL_FS_IOS:BUILTIN_FLSH1:", .unk5 = 0x10000000}, + mount_info{.path = "/dev_flash2", .filesystem = "CELL_FS_FAT", .dev_name = "CELL_FS_IOS:BUILTIN_FLSH2:"}, + mount_info{.path = "/dev_flash3", .filesystem = "CELL_FS_FAT", .dev_name = "CELL_FS_IOS:BUILTIN_FLSH3:"}, + mount_info{.path = "/dev_hdd0", .filesystem = "CELL_FS_UFS", .dev_name = "CELL_FS_UTILITY:HDD0:"}, + mount_info{.path = "/dev_bdvd", .filesystem = "CELL_FS_ISO9660", .dev_name = "CELL_FS_IOS:PATA0_BDVD_DRIVE"}, + }; + + for (u32 i = 0; i < max_len; info++, i++) + { + strcpy_trunc(info->mount_path, data[i].path); + strcpy_trunc(info->filesystem, data[i].filesystem); + strcpy_trunc(info->dev_name, data[i].dev_name); + std::memcpy(&info->unk1, &data[i].unk1, sizeof(be_t) * 5); + } + return CELL_OK; }