mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 23:41:26 +12:00
sys_fs_stat: support split files
Was forgotten after sys_fs_open
This commit is contained in:
parent
f933947a27
commit
c49c7de427
1 changed files with 34 additions and 4 deletions
|
@ -578,12 +578,42 @@ error_code sys_fs_stat(vm::cptr<char> path, vm::ptr<CellFsStat> sb)
|
||||||
{
|
{
|
||||||
switch (auto error = fs::g_tls_error)
|
switch (auto error = fs::g_tls_error)
|
||||||
{
|
{
|
||||||
case fs::error::noent: return {CELL_ENOENT, path};
|
case fs::error::noent:
|
||||||
default: sys_fs.error("sys_fs_stat(): unknown error %s", error);
|
{
|
||||||
|
// Try to analyse split file (TODO)
|
||||||
|
u64 total_size = 0;
|
||||||
|
u32 total_count = 0;
|
||||||
|
|
||||||
|
for (u32 i = 66600; i <= 66699; i++)
|
||||||
|
{
|
||||||
|
if (fs::stat(fmt::format("%s.%u", local_path, i), info) && !info.is_directory)
|
||||||
|
{
|
||||||
|
total_size += info.size;
|
||||||
|
total_count++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use attributes from the first fragment (consistently with sys_fs_open+fstat)
|
||||||
|
if (total_count > 1 && fs::stat(local_path + ".66600", info) && !info.is_directory)
|
||||||
|
{
|
||||||
|
// Success
|
||||||
|
info.size = total_size;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {CELL_ENOENT, path};
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
sys_fs.error("sys_fs_stat(): unknown error %s", error);
|
||||||
return {CELL_EIO, path};
|
return {CELL_EIO, path};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sb->mode = info.is_directory ? CELL_FS_S_IFDIR | 0777 : CELL_FS_S_IFREG | 0666;
|
sb->mode = info.is_directory ? CELL_FS_S_IFDIR | 0777 : CELL_FS_S_IFREG | 0666;
|
||||||
sb->uid = 0; // Always zero
|
sb->uid = 0; // Always zero
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue