split screen mode for fs. fix game dump. scrolling text for fs, progress, menu base. display icon when dumping.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -129,6 +129,8 @@ struct NspEntry {
|
||||
s64 nsp_size{};
|
||||
// copy of ncm cs, it is not closed.
|
||||
NcmContentStorage cs{};
|
||||
// copy of the icon, if invalid, it will use the default icon.
|
||||
int icon{};
|
||||
|
||||
// todo: benchmark manual sdcard read and decryption vs ncm.
|
||||
Result Read(void* buf, s64 off, s64 size, u64* bytes_read) {
|
||||
@@ -185,7 +187,7 @@ struct NspSource final : dump::BaseSource {
|
||||
|
||||
Result Read(const std::string& path, void* buf, s64 off, s64 size, u64* bytes_read) override {
|
||||
const auto it = std::ranges::find_if(m_entries, [&path](auto& e){
|
||||
return path == e.path;
|
||||
return path.find(e.path.s) != path.npos;
|
||||
});
|
||||
R_UNLESS(it != m_entries.end(), 0x1);
|
||||
|
||||
@@ -194,7 +196,7 @@ struct NspSource final : dump::BaseSource {
|
||||
|
||||
auto GetName(const std::string& path) const -> std::string {
|
||||
const auto it = std::ranges::find_if(m_entries, [&path](auto& e){
|
||||
return path == e.path;
|
||||
return path.find(e.path.s) != path.npos;
|
||||
});
|
||||
|
||||
if (it != m_entries.end()) {
|
||||
@@ -206,7 +208,7 @@ struct NspSource final : dump::BaseSource {
|
||||
|
||||
auto GetSize(const std::string& path) const -> s64 {
|
||||
const auto it = std::ranges::find_if(m_entries, [&path](auto& e){
|
||||
return path == e.path;
|
||||
return path.find(e.path.s) != path.npos;
|
||||
});
|
||||
|
||||
if (it != m_entries.end()) {
|
||||
@@ -216,6 +218,18 @@ struct NspSource final : dump::BaseSource {
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto GetIcon(const std::string& path) const -> int override {
|
||||
const auto it = std::ranges::find_if(m_entries, [&path](auto& e){
|
||||
return path.find(e.path.s) != path.npos;
|
||||
});
|
||||
|
||||
if (it != m_entries.end()) {
|
||||
return it->icon;
|
||||
}
|
||||
|
||||
return App::GetDefaultImage();
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<NspEntry> m_entries{};
|
||||
};
|
||||
@@ -568,7 +582,7 @@ Result BuildNspEntries(Entry& e, u32 flags, std::vector<NspEntry>& out) {
|
||||
|
||||
NspEntry nsp;
|
||||
R_TRY(BuildNspEntry(e, info, nsp));
|
||||
out.emplace_back(nsp);
|
||||
out.emplace_back(nsp).icon = e.image;
|
||||
}
|
||||
|
||||
R_UNLESS(!out.empty(), 0x1);
|
||||
|
||||
@@ -171,6 +171,7 @@ struct XciSource final : dump::BaseSource {
|
||||
// size of the entire xci.
|
||||
s64 xci_size{};
|
||||
Menu* menu{};
|
||||
int icon{};
|
||||
|
||||
Result Read(const std::string& path, void* buf, s64 off, s64 size, u64* bytes_read) override {
|
||||
if (path.ends_with(GetDumpTypeStr(DumpFileType_XCI))) {
|
||||
@@ -218,6 +219,10 @@ struct XciSource final : dump::BaseSource {
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto GetIcon(const std::string& path) const -> int override {
|
||||
return icon;
|
||||
}
|
||||
|
||||
private:
|
||||
static auto InRange(s64 off, s64 offset, s64 size) -> bool {
|
||||
return off < offset + size && off >= offset;
|
||||
@@ -944,6 +949,7 @@ Result Menu::DumpGames(u32 flags) {
|
||||
auto source = std::make_shared<XciSource>();
|
||||
source->menu = this;
|
||||
source->application_name = m_entries[m_entry_index].lang_entry.name;
|
||||
source->icon = m_icon;
|
||||
|
||||
std::vector<fs::FsPath> paths;
|
||||
if (flags & DumpFileFlag_XCI) {
|
||||
|
||||
@@ -70,10 +70,13 @@ void MenuBase::Draw(NVGcontext* vg, Theme* theme) {
|
||||
|
||||
nvgFontSize(vg, 28);
|
||||
gfx::textBounds(vg, 0, 0, bounds, m_title.c_str());
|
||||
gfx::drawTextArgs(vg, 80, start_y, 28.f, NVG_ALIGN_LEFT | NVG_ALIGN_BOTTOM, theme->GetColour(ThemeEntryID_TEXT), m_title.c_str());
|
||||
gfx::drawTextArgs(vg, 80 + (bounds[2] - bounds[0]) + 10, start_y, 16, NVG_ALIGN_LEFT | NVG_ALIGN_BOTTOM, theme->GetColour(ThemeEntryID_TEXT_INFO), m_title_sub_heading.c_str());
|
||||
|
||||
gfx::drawTextArgs(vg, 80, 685.f, 18, NVG_ALIGN_LEFT, theme->GetColour(ThemeEntryID_TEXT), "%s", m_sub_heading.c_str());
|
||||
const auto text_w = SCREEN_WIDTH / 2 - 30;
|
||||
const auto title_sub_x = 80 + (bounds[2] - bounds[0]) + 10;
|
||||
|
||||
gfx::drawTextArgs(vg, 80, start_y, 28.f, NVG_ALIGN_LEFT | NVG_ALIGN_BOTTOM, theme->GetColour(ThemeEntryID_TEXT), m_title.c_str());
|
||||
m_scroll_title_sub_heading.Draw(vg, true, title_sub_x, start_y, text_w - title_sub_x, 16, NVG_ALIGN_LEFT | NVG_ALIGN_BOTTOM, theme->GetColour(ThemeEntryID_TEXT_INFO), m_title_sub_heading.c_str());
|
||||
m_scroll_sub_heading.Draw(vg, true, 80, 685, text_w - 80, 18, NVG_ALIGN_LEFT, theme->GetColour(ThemeEntryID_TEXT), m_sub_heading.c_str());
|
||||
}
|
||||
|
||||
void MenuBase::SetTitle(std::string title) {
|
||||
|
||||
Reference in New Issue
Block a user