add code for calculating games size, stubbed for now as the ns calls are too slow to be usable.
This commit is contained in:
@@ -20,6 +20,7 @@ enum class NacpLoadStatus {
|
|||||||
|
|
||||||
struct Entry {
|
struct Entry {
|
||||||
u64 app_id{};
|
u64 app_id{};
|
||||||
|
s64 size{};
|
||||||
char display_version[0x10]{};
|
char display_version[0x10]{};
|
||||||
NacpLanguageEntry lang{};
|
NacpLanguageEntry lang{};
|
||||||
int image{};
|
int image{};
|
||||||
|
|||||||
@@ -18,6 +18,21 @@
|
|||||||
namespace sphaira::ui::menu::game {
|
namespace sphaira::ui::menu::game {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
// thank you Shchmue ^^
|
||||||
|
struct ApplicationOccupiedSizeEntry {
|
||||||
|
u8 storageId;
|
||||||
|
u8 padding[0x7];
|
||||||
|
u64 sizeApplication;
|
||||||
|
u64 sizePatch;
|
||||||
|
u64 sizeAddOnContent;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ApplicationOccupiedSize {
|
||||||
|
ApplicationOccupiedSizeEntry entry[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
static_assert(sizeof(ApplicationOccupiedSize) == sizeof(NsApplicationOccupiedSize));
|
||||||
|
|
||||||
using MetaEntries = std::vector<NsApplicationContentMetaStatus>;
|
using MetaEntries = std::vector<NsApplicationContentMetaStatus>;
|
||||||
|
|
||||||
Result Notify(Result rc, const std::string& error_message) {
|
Result Notify(Result rc, const std::string& error_message) {
|
||||||
@@ -357,7 +372,20 @@ void Menu::ScanHomebrew() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_entries.emplace_back(e.application_id);
|
s64 size{};
|
||||||
|
// code for sorting by size, it's too slow however...
|
||||||
|
#if 0
|
||||||
|
ApplicationOccupiedSize occupied_size;
|
||||||
|
if (R_SUCCEEDED(nsCalculateApplicationOccupiedSize(e.application_id, (NsApplicationOccupiedSize*)&occupied_size))) {
|
||||||
|
for (auto& s : occupied_size.entry) {
|
||||||
|
size += s.sizeApplication;
|
||||||
|
size += s.sizePatch;
|
||||||
|
size += s.sizeAddOnContent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_entries.emplace_back(e.application_id, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += record_count;
|
offset += record_count;
|
||||||
|
|||||||
Reference in New Issue
Block a user