mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 14:01:25 +12:00
parent
48ad959697
commit
cfe08de951
2 changed files with 17 additions and 24 deletions
|
@ -936,7 +936,7 @@ bool EDATADecrypter::ReadHeader()
|
|||
// Try decrypting the first block instead
|
||||
u8 data_sample[1];
|
||||
|
||||
if (!ReadData(0, data_sample, 1))
|
||||
if (file_size && !ReadData(0, data_sample, 1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -51,16 +51,15 @@ void fmt_class_string<lv2_file>::format(std::string& out, u64 arg)
|
|||
return "N/A";
|
||||
}
|
||||
|
||||
std::string size_str = fmt::format("0x%05x ", size);
|
||||
std::string size_str;
|
||||
switch (std::bit_width(size) / 10 * 10)
|
||||
{
|
||||
case 64: size_str = "0"s; break;
|
||||
case 0: fmt::append(size_str, "(%u)", size); break;
|
||||
case 10: fmt::append(size_str, "(%gKB)", size / 1024.); break;
|
||||
case 20: fmt::append(size_str, "(%gMB)", size / (1024. * 1024)); break;
|
||||
case 0: fmt::append(size_str, "%u", size); break;
|
||||
case 10: fmt::append(size_str, "%gKB", size / 1024.); break;
|
||||
case 20: fmt::append(size_str, "%gMB", size / (1024. * 1024)); break;
|
||||
|
||||
default:
|
||||
case 30: fmt::append(size_str, "(%gGB)", size / (1024. * 1024 * 1024)); break;
|
||||
case 30: fmt::append(size_str, "%gGB", size / (1024. * 1024 * 1024)); break;
|
||||
}
|
||||
|
||||
return size_str;
|
||||
|
@ -69,7 +68,7 @@ void fmt_class_string<lv2_file>::format(std::string& out, u64 arg)
|
|||
const usz pos = file.file ? file.file.pos() : umax;
|
||||
const usz size = file.file ? file.file.size() : umax;
|
||||
|
||||
fmt::append(out, u8"%s, “%s”, Mode: 0x%x, Flags: 0x%x, Pos: %s, Size: %s", file.type, file.name.data(), file.mode, file.flags, get_size(pos), get_size(size));
|
||||
fmt::append(out, u8"%s, “%s”, Mode: 0x%x, Flags: 0x%x, Pos/Size: %s/%s (0x%x/0x%x)", file.type, file.name.data(), file.mode, file.flags, get_size(pos), get_size(size), pos, size);
|
||||
}
|
||||
|
||||
template<>
|
||||
|
@ -616,25 +615,19 @@ error_code sys_fs_open(ppu_thread& ppu, vm::cptr<char> path, s32 flags, vm::ptr<
|
|||
return {error, path};
|
||||
}
|
||||
|
||||
if (type >= lv2_file_type::sdata)
|
||||
if (const u32 id = idm::import<lv2_fs_object, lv2_file>([&ppath = ppath, &file = file, mode, flags, &real = real, &type = type]() -> std::shared_ptr<lv2_file>
|
||||
{
|
||||
sys_fs.warning("sys_fs_open(): NPDRM detected");
|
||||
std::shared_ptr<lv2_file> result;
|
||||
|
||||
if (const u32 id = idm::import<lv2_fs_object, lv2_file>([&ppath = ppath, &file = file, mode, flags, &real = real, &type = type]() -> std::shared_ptr<lv2_file>
|
||||
if (type >= lv2_file_type::sdata && !g_fxo->get<loaded_npdrm_keys>().npdrm_fds.try_inc(16))
|
||||
{
|
||||
if (!g_fxo->get<loaded_npdrm_keys>().npdrm_fds.try_inc(16))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return std::make_shared<lv2_file>(ppath, std::move(file), mode, flags, real, type);
|
||||
}))
|
||||
{
|
||||
*fd = id;
|
||||
return CELL_OK;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if (const u32 id = idm::make<lv2_fs_object, lv2_file>(ppath, std::move(file), mode, flags, real))
|
||||
|
||||
result = std::make_shared<lv2_file>(ppath, std::move(file), mode, flags, real, type);
|
||||
sys_fs.warning("sys_fs_open(): fd=%u, %s", idm::last_id(), *result);
|
||||
return result;
|
||||
}))
|
||||
{
|
||||
*fd = id;
|
||||
return CELL_OK;
|
||||
|
@ -839,7 +832,7 @@ error_code sys_fs_close(ppu_thread& ppu, u32 fd)
|
|||
return {CELL_EBADF, fd};
|
||||
}
|
||||
|
||||
sys_fs.warning("sys_fs_close(fd=%u): path='%s'", fd, file->name.data());
|
||||
sys_fs.warning("sys_fs_close(fd=%u): %s", fd, *file);
|
||||
|
||||
if (file->lock == 1)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue