optimise game menu for fw 20

- loading the control data is ran on its own thread, it does not block the main thread. allows for smooth scrolling like nintendos home menu.
- on fw20+, sphaira manually parses the control data, rather than using ns. manually parsing takes 20-40ms, which is faster than ms which can take 50-500ms.
- on fw19 and below, if the control data is not in ns cache, sphaira will manually parse the data as its twice as fast as ns. You can see how fast this is by loading the gamecard menu as that manually parses everything, and it loads the gamecard faster than the home menu
This commit is contained in:
ITotalJustice
2025-05-13 23:51:06 +01:00
parent b98ccb927e
commit 97d3fd396e
7 changed files with 363 additions and 124 deletions

View File

@@ -320,7 +320,7 @@ Result Menu::GcMount() {
std::vector<u8> extended_header;
std::vector<NcmPackagedContentInfo> infos;
const auto path = BuildGcPath(e.name, &m_handle);
R_TRY(yati::ParseCnmtNca(path, 0, header, extended_header, infos));
R_TRY(nca::ParseCnmt(path, 0, header, extended_header, infos));
u8 key_gen;
FsRightsId rights_id;
@@ -511,7 +511,10 @@ void Menu::OnChangeIndex(s64 new_index) {
fsGetProgramId(&program_id, path, FsContentAttributes_All);
}
if (R_SUCCEEDED(yati::ParseControlNca(path, program_id, &nacp, sizeof(nacp), &icon))) {
TimeStamp ts;
if (R_SUCCEEDED(nca::ParseControl(path, program_id, &nacp, sizeof(nacp), &icon))) {
log_write("\t\tnca::ParseControl(): %.2fs %zums\n", ts.GetSecondsD(), ts.GetMs());
log_write("managed to parse control nca %s\n", path.s);
NacpLanguageEntry* lang_entry{};
nacpGetLanguageEntry(&nacp, &lang_entry);