From 6f8300fb32f3699fd654368a02076898ca29b6b9 Mon Sep 17 00:00:00 2001 From: ITotalJustice <47043333+ITotalJustice@users.noreply.github.com> Date: Wed, 25 Jun 2025 01:39:46 +0100 Subject: [PATCH] filter out some apps (hbmenu, retroarch core) if replaced via another app, or false positive. remove uneeded file.close() and commit calls. --- sphaira/source/fs.cpp | 6 ------ sphaira/source/ui/menus/appstore.cpp | 23 ++++++++++++++++++++++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/sphaira/source/fs.cpp b/sphaira/source/fs.cpp index 8f6d4ea..6b67109 100644 --- a/sphaira/source/fs.cpp +++ b/sphaira/source/fs.cpp @@ -260,7 +260,6 @@ Result read_entire_file(FsFileSystem* _fs, const FsPath& path, std::vector& File f; R_TRY(fs.OpenFile(path, FsOpenMode_Read, &f)); - ON_SCOPE_EXIT(f.Close()); s64 size; R_TRY(f.GetSize(&size)); @@ -278,7 +277,6 @@ Result write_entire_file(FsFileSystem* _fs, const FsPath& path, const std::vecto FsNative fs{_fs, false, ignore_read_only}; R_TRY(fs.GetFsOpenResult()); - ON_SCOPE_EXIT(fs.Commit()); if (auto rc = fs.CreateFile(path, in.size(), 0); R_FAILED(rc) && rc != FsError_PathAlreadyExists) { return rc; @@ -286,8 +284,6 @@ Result write_entire_file(FsFileSystem* _fs, const FsPath& path, const std::vecto File f; R_TRY(fs.OpenFile(path, FsOpenMode_Write, &f)); - ON_SCOPE_EXIT(f.Close()); - R_TRY(f.SetSize(in.size())); R_TRY(f.Write(0, in.data(), in.size(), FsWriteOption_None)); @@ -824,8 +820,6 @@ Result FileGetSizeAndTimestamp(fs::Fs* m_fs, const FsPath& path, FsTimeStampRaw* File f; R_TRY(m_fs->OpenFile(path, FsOpenMode_Read, &f)); - ON_SCOPE_EXIT(f.Close()); - R_TRY(f.GetSize(size)); } else { struct stat st; diff --git a/sphaira/source/ui/menus/appstore.cpp b/sphaira/source/ui/menus/appstore.cpp index d9a705f..0e6cacc 100644 --- a/sphaira/source/ui/menus/appstore.cpp +++ b/sphaira/source/ui/menus/appstore.cpp @@ -1225,7 +1225,28 @@ void Menu::ScanHomebrew() { // if we get here, this means that we have the file, but not the .info file // report the file as locally installed to match hb-appstore. if (e.status == EntryStatus::Get) { - e.status = EntryStatus::Local; + // filter out some apps. + bool filtered{}; + + // ignore hbmenu if it was replaced with sphaira. + if (e.name == "hbmenu") { + NacpStruct nacp; + if (R_SUCCEEDED(nro_get_nacp(e.binary, nacp))) { + filtered = std::strcmp(nacp.lang[0].name, "nx-hbmenu"); + } + } + // ignore single retroarch core. + else if (e.name == "snes9x_2010") { + filtered = true; + } + // todo: filter + // - sys-clk + + if (!filtered) { + e.status = EntryStatus::Local; + } else { + log_write("filtered: %s path: %s\n", e.name.c_str(), e.binary.c_str()); + } } } }