Skip to content

Commit

Permalink
kernel-explorer: Implement Filesystem Destcriptors information
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 authored and pull[bot] committed Oct 31, 2020
1 parent 9169a7b commit 1305336
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions rpcs3/Emu/Cell/lv2/sys_fs.h
Expand Up @@ -190,6 +190,8 @@ struct lv2_fs_object
name[filename.size()] = 0;
return name;
}

virtual std::string to_string() const { return {}; }
};

struct lv2_file final : lv2_fs_object
Expand Down Expand Up @@ -271,6 +273,19 @@ struct lv2_file final : lv2_fs_object

// Make file view from lv2_file object (for MSELF support)
static fs::file make_view(const std::shared_ptr<lv2_file>& _file, u64 offset);

virtual std::string to_string() const override
{
std::string_view type_s;
switch (type)
{
case lv2_file_type::regular: type_s = "Regular file"; break;
case lv2_file_type::sdata: type_s = "SDATA"; break;
case lv2_file_type::edata: type_s = "EDATA"; break;
}

return fmt::format(u8"%s, “%s”, Mode: 0x%x, Flags: 0x%x", type_s, name.data(), mode, flags);
}
};

struct lv2_dir final : lv2_fs_object
Expand All @@ -296,6 +311,11 @@ struct lv2_dir final : lv2_fs_object

return nullptr;
}

virtual std::string to_string() const override
{
return fmt::format(u8"Directory, “%s”, Entries: %u/%u", name.data(), std::min<u64>(pos, entries.size()), entries.size());
}
};

// sys_fs_fcntl arg base class (left empty for PODness)
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/rpcs3qt/kernel_explorer.cpp
Expand Up @@ -592,7 +592,7 @@ void kernel_explorer::Update()

idm::select<lv2_fs_object>([&](u32 id, lv2_fs_object& fo)
{
add_leaf(find_node(m_tree, additional_nodes::file_descriptors), qstr(fmt::format(u8"FD %u: “%s”", id, fo.name.data())));
add_leaf(find_node(m_tree, additional_nodes::file_descriptors), qstr(fmt::format("FD %u: %s", id, fo.to_string())));
});

// RawSPU Threads (TODO)
Expand Down

0 comments on commit 1305336

Please sign in to comment.