MCPcopy Create free account
hub / github.com/XorTroll/Goldleaf / DisplayContentInfo

Method DisplayContentInfo

Goldleaf/source/ui/ui_ApplicationContentsLayout.cpp:56–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 }
55
56 void ApplicationContentsLayout::DisplayContentInfo(const u32 cnt_idx) {
57 std::string info;
58
59 const auto &app = cnt::GetApplications().at(this->app_idx);
60 const auto &cnt_status = app.meta_status_list.at(cnt_idx);
61
62 info += cfg::Strings.GetString(503) + ": " + cnt::GetContentMetaTypeName(static_cast<NcmContentMetaType>(cnt_status.meta_type)) + "\n";
63 info += cfg::Strings.GetString(504) + ": " + cnt::GetStorageIdName(static_cast<NcmStorageId>(cnt_status.storageID)) + "\n";
64
65 switch(cnt_status.meta_type) {
66 case NcmContentMetaType_AddOnContent: {
67 info += cfg::Strings.GetString(490) + " " + util::FormatApplicationId(cnt_status.application_id) + "\n";
68 info += cfg::Strings.GetString(263) + " " + std::to_string(cnt::GetAddOnContentId(cnt_status.application_id)) + "\n";
69 break;
70 }
71 case NcmContentMetaType_Patch: {
72 info += cfg::Strings.GetString(491) + " " + util::FormatApplicationId(cnt_status.application_id) + "\n";
73 break;
74 }
75 case NcmContentMetaType_Application: {
76 info += cfg::Strings.GetString(90) + " " + util::FormatApplicationId(cnt_status.application_id) + "\n";
77 break;
78 }
79 }
80
81 info += cfg::Strings.GetString(178) + " " + std::to_string(cnt_status.version) + "\n";
82 info += cfg::Strings.GetString(93);
83
84 bool any_content = false;
85 for(u32 i = 0; i < cnt::MaxContentCount; i++) {
86 if(app.contents.at(cnt_idx).cnt_ids[i].has_value()) {
87 info += "\n";
88 const auto is_meta = (i == static_cast<u32>(NcmContentType_Meta));
89 info += " " + cnt::GetContentTypeName(static_cast<NcmContentType>(i)) + ": " + util::FormatContentId(app.contents.at(cnt_idx).cnt_ids[i].value()) + (is_meta ? ".cnmt.nca" : ".nca");
90 any_content = true;
91 }
92 }
93 if(!any_content) {
94 info += " " + cfg::Strings.GetString(442);
95 }
96 info += "\n\n";
97
98 cnt::Ticket tik;
99 const auto has_tik = cnt::TryFindApplicationTicket(cnt_status.application_id, tik);
100 if(has_tik) {
101 const auto key_gen = esGetRightsIdKeyGeneration(&tik.rights_id);
102 info += cfg::Strings.GetString(201) + " " + std::string((tik.type == cnt::TicketType::Common) ? cfg::Strings.GetString(448) : cfg::Strings.GetString(449)) + "\n";
103 info += cfg::Strings.GetString(95) + " " + std::to_string(key_gen) + " (" + hos::GetKeyGenerationRange(key_gen) + ")\n";
104 info += "\n";
105 }
106
107 std::vector<std::string> options = { cfg::Strings.GetString(234) };
108 const auto has_contents = (cnt_status.storageID == NcmStorageId_SdCard) || (cnt_status.storageID == NcmStorageId_BuiltInUser) || (cnt_status.storageID == NcmStorageId_GameCard);
109 if(has_contents) {
110 options.push_back(cfg::Strings.GetString(245));
111 options.push_back(cfg::Strings.GetString(244));
112 }
113 if(has_tik) {

Callers

nothing calls this directly

Calls 15

LoadApplicationMethod · 0.95
GetContentMetaTypeNameFunction · 0.85
GetStorageIdNameFunction · 0.85
GetAddOnContentIdFunction · 0.85
GetContentTypeNameFunction · 0.85
FormatContentIdFunction · 0.85
TryFindApplicationTicketFunction · 0.85
GetKeyGenerationRangeFunction · 0.85
RemoveTicketFunction · 0.85
NotifyTicketsChangedFunction · 0.85
HandleResultFunction · 0.85

Tested by

no test coverage detected