add missing sound and icon for nca verify

This commit is contained in:
mrdude2478 2023-10-07 04:08:53 +01:00
parent 7509bd8092
commit f127ddd7dc
7 changed files with 34 additions and 47 deletions

View File

@ -117,14 +117,9 @@ namespace nspInstStuff_B {
inst::ui::instPage::setInstBarPerc(0); inst::ui::instPage::setInstBarPerc(0);
if (inst::config::useSound) { if (inst::config::useSound) {
std::string audioPath = ""; std::string audioPath = "romfs:/audio/fail.mp3";
std::string fail = inst::config::appDir + "audio.fail"_theme; std::string fail = inst::config::appDir + "audio.fail"_theme;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(fail)) { if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(fail)) audioPath = (fail);
audioPath = (fail);
}
else {
audioPath = "romfs:/audio/ohno.wav";
}
std::thread audioThread(inst::util::playAudio, audioPath); std::thread audioThread(inst::util::playAudio, audioPath);
audioThread.join(); audioThread.join();
} }
@ -144,14 +139,9 @@ namespace nspInstStuff_B {
inst::ui::instPage::setInstBarPerc(100); inst::ui::instPage::setInstBarPerc(100);
if (inst::config::useSound) { if (inst::config::useSound) {
std::string audioPath = ""; std::string audioPath = "romfs:/audio/pass.mp3";
std::string pass = inst::config::appDir + "audio.pass"_theme; std::string pass = inst::config::appDir + "audio.pass"_theme;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(pass)) { if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(pass)) audioPath = (pass);
audioPath = (pass);
}
else {
audioPath = "romfs:/audio/yipee.wav";
}
std::thread audioThread(inst::util::playAudio, audioPath); std::thread audioThread(inst::util::playAudio, audioPath);
audioThread.join(); audioThread.join();
} }

View File

@ -121,8 +121,15 @@ namespace tin::install::nsp
if (!Crypto::rsa2048PssVerify(&header->magic, 0x200, header->fixed_key_sig, Crypto::NCAHeaderSignature)) if (!Crypto::rsa2048PssVerify(&header->magic, 0x200, header->fixed_key_sig, Crypto::NCAHeaderSignature))
{ {
std::thread audioThread(inst::util::playAudio, "romfs:/audio/bark.wav"); std::string audioPath = "romfs:/audio/infobeep.mp3";
int rc = inst::ui::mainApp->CreateShowDialog("inst.nca_verify.title"_lang, "inst.nca_verify.desc"_lang, { "common.cancel"_lang, "inst.nca_verify.opt1"_lang }, false); std::string beep = inst::config::appDir + "audio.infobeep"_theme;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(beep)) audioPath = (beep);
std::thread audioThread(inst::util::playAudio, audioPath);
std::string information = "romfs:/images/icons/information.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.information"_theme)) {
information = inst::config::appDir + "icons_others.good"_theme;
}
int rc = inst::ui::mainApp->CreateShowDialog("inst.nca_verify.title"_lang, "inst.nca_verify.desc"_lang, { "common.cancel"_lang, "inst.nca_verify.opt1"_lang }, false, information);
audioThread.join(); audioThread.join();
if (rc != 1) if (rc != 1)
THROW_FORMAT(("inst.nca_verify.error"_lang + tin::util::GetNcaIdString(ncaId)).c_str()); THROW_FORMAT(("inst.nca_verify.error"_lang + tin::util::GetNcaIdString(ncaId)).c_str());

View File

@ -33,6 +33,7 @@ SOFTWARE.
#include "util/lang.hpp" #include "util/lang.hpp"
#include "install/nca.hpp" #include "install/nca.hpp"
#include "ui/MainApplication.hpp" #include "ui/MainApplication.hpp"
#include "util/theme.hpp"
namespace inst::ui { namespace inst::ui {
extern MainApplication* mainApp; extern MainApplication* mainApp;
@ -113,8 +114,15 @@ namespace tin::install::xci
if (!Crypto::rsa2048PssVerify(&header->magic, 0x200, header->fixed_key_sig, Crypto::NCAHeaderSignature)) if (!Crypto::rsa2048PssVerify(&header->magic, 0x200, header->fixed_key_sig, Crypto::NCAHeaderSignature))
{ {
std::thread audioThread(inst::util::playAudio, "romfs:/audio/bark.wav"); std::string audioPath = "romfs:/audio/infobeep.mp3";
int rc = inst::ui::mainApp->CreateShowDialog("inst.nca_verify.title"_lang, "inst.nca_verify.desc"_lang, { "common.cancel"_lang, "inst.nca_verify.opt1"_lang }, false); std::string beep = inst::config::appDir + "audio.infobeep"_theme;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(beep)) audioPath = (beep);
std::thread audioThread(inst::util::playAudio, audioPath);
std::string information = "romfs:/images/icons/information.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.information"_theme)) {
information = inst::config::appDir + "icons_others.good"_theme;
}
int rc = inst::ui::mainApp->CreateShowDialog("inst.nca_verify.title"_lang, "inst.nca_verify.desc"_lang, { "common.cancel"_lang, "inst.nca_verify.opt1"_lang }, false, information);
audioThread.join(); audioThread.join();
if (rc != 1) if (rc != 1)
THROW_FORMAT(("inst.nca_verify.error"_lang + tin::util::GetNcaIdString(ncaId)).c_str()); THROW_FORMAT(("inst.nca_verify.error"_lang + tin::util::GetNcaIdString(ncaId)).c_str());

View File

@ -250,10 +250,9 @@ namespace netInstStuff {
inst::ui::instPage::setInstBarPerc(0); inst::ui::instPage::setInstBarPerc(0);
if (inst::config::useSound) { if (inst::config::useSound) {
std::string audioPath = ""; std::string audioPath = "romfs:/audio/fail.mp3";
std::string fail = inst::config::appDir + "audio.fail"_theme; std::string fail = inst::config::appDir + "audio.fail"_theme;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(fail)) audioPath = (fail); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(fail)) audioPath = (fail);
else audioPath = "romfs:/audio/ohno.wav";
std::thread audioThread(inst::util::playAudio, audioPath); std::thread audioThread(inst::util::playAudio, audioPath);
audioThread.join(); audioThread.join();
} }
@ -283,14 +282,9 @@ namespace netInstStuff {
inst::ui::instPage::setInstBarPerc(100); inst::ui::instPage::setInstBarPerc(100);
if (inst::config::useSound) { if (inst::config::useSound) {
std::string audioPath = ""; std::string audioPath = "romfs:/audio/pass.mp3";
std::string pass = inst::config::appDir + "audio.pass"_theme; std::string pass = inst::config::appDir + "audio.pass"_theme;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(pass)) { if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(pass)) audioPath = (pass);
audioPath = (pass);
}
else {
audioPath = "romfs:/audio/yipee.wav";
}
std::thread audioThread(inst::util::playAudio, audioPath); std::thread audioThread(inst::util::playAudio, audioPath);
audioThread.join(); audioThread.join();
} }

View File

@ -107,7 +107,7 @@ namespace nspInstStuff {
std::string audioPath = ""; std::string audioPath = "";
std::string fail = inst::config::appDir + "audio.fail"_theme; std::string fail = inst::config::appDir + "audio.fail"_theme;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(fail)) audioPath = (fail); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(fail)) audioPath = (fail);
else audioPath = "romfs:/audio/ohno.wav"; else audioPath = "romfs:/audio/fail.mp3";
std::thread audioThread(inst::util::playAudio, audioPath); std::thread audioThread(inst::util::playAudio, audioPath);
audioThread.join(); audioThread.join();
} }
@ -151,7 +151,7 @@ namespace nspInstStuff {
audioPath = (pass); audioPath = (pass);
} }
else { else {
audioPath = "romfs:/audio/yipee.wav"; audioPath = "romfs:/audio/pass.mp3";
} }
std::thread audioThread(inst::util::playAudio, audioPath); std::thread audioThread(inst::util::playAudio, audioPath);
audioThread.join(); audioThread.join();

View File

@ -225,10 +225,9 @@ namespace inst::ui {
} }
else { else {
if (inst::config::useSound) { if (inst::config::useSound) {
std::string audioPath = ""; std::string audioPath = "romfs:/audio/fail.mp3";
std::string fail = inst::config::appDir + "audio.fail"_theme; std::string fail = inst::config::appDir + "audio.fail"_theme;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(fail)) audioPath = (fail); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(fail)) audioPath = (fail);
else audioPath = "romfs:/audio/ohno.wav";
std::thread audioThread(inst::util::playAudio, audioPath); std::thread audioThread(inst::util::playAudio, audioPath);
audioThread.join(); audioThread.join();
} }
@ -247,10 +246,9 @@ namespace inst::ui {
std::filesystem::remove(ourPath); std::filesystem::remove(ourPath);
if (didExtract) { if (didExtract) {
if (inst::config::useSound) { if (inst::config::useSound) {
std::string audioPath = ""; std::string audioPath = "romfs:/audio/pass.mp3";
std::string pass = inst::config::appDir + "audio.pass"_theme; std::string pass = inst::config::appDir + "audio.pass"_theme;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(pass)) audioPath = (pass); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(pass)) audioPath = (pass);
else audioPath = "romfs:/audio/yipee.wav";
std::thread audioThread(inst::util::playAudio, audioPath); std::thread audioThread(inst::util::playAudio, audioPath);
audioThread.join(); audioThread.join();
} }

View File

@ -166,14 +166,9 @@ namespace usbInstStuff {
inst::ui::instPage::setInstBarPerc(0); inst::ui::instPage::setInstBarPerc(0);
if (inst::config::useSound) { if (inst::config::useSound) {
std::string audioPath = ""; std::string audioPath = "romfs:/audio/fail.mp3";
std::string fail = inst::config::appDir + "audio.fail"_theme; std::string fail = inst::config::appDir + "audio.fail"_theme;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(fail)) { if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(fail)) audioPath = (fail);
audioPath = (fail);
}
else {
audioPath = "romfs:/audio/ohno.wav";
}
std::thread audioThread(inst::util::playAudio, audioPath); std::thread audioThread(inst::util::playAudio, audioPath);
audioThread.join(); audioThread.join();
} }
@ -194,14 +189,9 @@ namespace usbInstStuff {
inst::ui::instPage::setInstBarPerc(100); inst::ui::instPage::setInstBarPerc(100);
if (inst::config::useSound) { if (inst::config::useSound) {
std::string audioPath = ""; std::string audioPath = "romfs:/audio/pass.mp3";
std::string pass = inst::config::appDir + "audio.pass"_theme; std::string pass = inst::config::appDir + "audio.pass"_theme;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(pass)) { if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(pass)) audioPath = (pass);
audioPath = (pass);
}
else {
audioPath = "romfs:/audio/yipee.wav";
}
std::thread audioThread(inst::util::playAudio, audioPath); std::thread audioThread(inst::util::playAudio, audioPath);
audioThread.join(); audioThread.join();
} }