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

Method tickets_DefaultKey

Goldleaf/source/ui/ui_TicketsLayout.cpp:106–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104 }
105
106 void TicketsLayout::tickets_DefaultKey(const cnt::Ticket tik) {
107 const auto tik_app_id = esGetRightsIdApplicationId(&tik.rights_id);
108 const auto used_title = tik.IsUsed();
109 const auto tik_used = used_title.has_value();
110
111 auto info = cfg::Strings.GetString(201) + "\n\n\n";
112
113 info += cfg::Strings.GetString(90) + " " + util::FormatApplicationId(tik_app_id);
114 if(tik_used) {
115 info += " (" + used_title->get().cache.display_name + ")";
116 }
117
118 const auto key_gen = esGetRightsIdKeyGeneration(&tik.rights_id);
119 info += "\n" + cfg::Strings.GetString(95) + " " + std::to_string(key_gen) + " (" + hos::GetKeyGenerationRange(key_gen) + ")";
120 info += "\n" + cfg::Strings.GetString(447) + " " + FormatTicketType(tik.type);
121 info += "\n\n";
122 info += tik_used ? cfg::Strings.GetString(202) : cfg::Strings.GetString(203);
123
124 const auto opt_1 = g_MainApplication->DisplayDialog(cfg::Strings.GetString(200), info, { cfg::Strings.GetString(245), cfg::Strings.GetString(244), cfg::Strings.GetString(438), cfg::Strings.GetString(18) }, true);
125 if(opt_1 == 0) {
126 if(tik_used) {
127 g_MainApplication->DisplayDialog(cfg::Strings.GetString(200), cfg::Strings.GetString(440), { cfg::Strings.GetString(234) }, true);
128 }
129 else {
130 const auto opt_2 = g_MainApplication->DisplayDialog(cfg::Strings.GetString(200), cfg::Strings.GetString(204), { cfg::Strings.GetString(111), cfg::Strings.GetString(18) }, true);
131 if(opt_2 == 0) {
132 const auto rc = cnt::RemoveTicket(tik);
133 if(R_SUCCEEDED(rc)) {
134 g_MainApplication->ShowNotification(cfg::Strings.GetString(206));
135 this->UpdateElements();
136 }
137 else {
138 HandleResult(rc, cfg::Strings.GetString(207));
139 }
140 }
141 }
142 }
143 else if((opt_1 == 1) || (opt_1 == 2)) {
144 const auto export_cert = (opt_1 == 2);
145
146 const auto expt_tik_path = expt::ExportTicketCert(tik_app_id, export_cert);
147 g_MainApplication->ShowNotification(cfg::Strings.GetString(439) + " '" + fs::GetSdCardExplorer()->FullPresentablePathFor(expt_tik_path) + "'");
148 }
149 }
150
151}

Callers

nothing calls this directly

Calls 12

UpdateElementsMethod · 0.95
GetKeyGenerationRangeFunction · 0.85
FormatTicketTypeFunction · 0.85
RemoveTicketFunction · 0.85
HandleResultFunction · 0.85
ExportTicketCertFunction · 0.85
GetSdCardExplorerFunction · 0.85
IsUsedMethod · 0.80
DisplayDialogMethod · 0.80
ShowNotificationMethod · 0.80
FormatApplicationIdFunction · 0.50

Tested by

no test coverage detected