From f127ddd7dce6f7b67abc592fd8a64524591bb1e2 Mon Sep 17 00:00:00 2001 From: mrdude2478 Date: Sat, 7 Oct 2023 04:08:53 +0100 Subject: [PATCH] add missing sound and icon for nca verify --- source/HDInstall.cpp | 18 ++++-------------- source/install/install_nsp.cpp | 11 +++++++++-- source/install/install_xci.cpp | 12 ++++++++++-- source/netInstall.cpp | 12 +++--------- source/sdInstall.cpp | 4 ++-- source/ui/ThemeInstPage.cpp | 6 ++---- source/usbInstall.cpp | 18 ++++-------------- 7 files changed, 34 insertions(+), 47 deletions(-) diff --git a/source/HDInstall.cpp b/source/HDInstall.cpp index aaed5f5..6f07291 100644 --- a/source/HDInstall.cpp +++ b/source/HDInstall.cpp @@ -117,14 +117,9 @@ namespace nspInstStuff_B { inst::ui::instPage::setInstBarPerc(0); if (inst::config::useSound) { - std::string audioPath = ""; + std::string audioPath = "romfs:/audio/fail.mp3"; 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); - } - else { - audioPath = "romfs:/audio/ohno.wav"; - } + if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(fail)) audioPath = (fail); std::thread audioThread(inst::util::playAudio, audioPath); audioThread.join(); } @@ -144,14 +139,9 @@ namespace nspInstStuff_B { inst::ui::instPage::setInstBarPerc(100); if (inst::config::useSound) { - std::string audioPath = ""; + std::string audioPath = "romfs:/audio/pass.mp3"; 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); - } - else { - audioPath = "romfs:/audio/yipee.wav"; - } + if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(pass)) audioPath = (pass); std::thread audioThread(inst::util::playAudio, audioPath); audioThread.join(); } diff --git a/source/install/install_nsp.cpp b/source/install/install_nsp.cpp index a3651d9..c8705f0 100644 --- a/source/install/install_nsp.cpp +++ b/source/install/install_nsp.cpp @@ -121,8 +121,15 @@ namespace tin::install::nsp if (!Crypto::rsa2048PssVerify(&header->magic, 0x200, header->fixed_key_sig, Crypto::NCAHeaderSignature)) { - std::thread audioThread(inst::util::playAudio, "romfs:/audio/bark.wav"); - 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 audioPath = "romfs:/audio/infobeep.mp3"; + 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(); if (rc != 1) THROW_FORMAT(("inst.nca_verify.error"_lang + tin::util::GetNcaIdString(ncaId)).c_str()); diff --git a/source/install/install_xci.cpp b/source/install/install_xci.cpp index f4fa930..9c359b0 100644 --- a/source/install/install_xci.cpp +++ b/source/install/install_xci.cpp @@ -33,6 +33,7 @@ SOFTWARE. #include "util/lang.hpp" #include "install/nca.hpp" #include "ui/MainApplication.hpp" +#include "util/theme.hpp" namespace inst::ui { extern MainApplication* mainApp; @@ -113,8 +114,15 @@ namespace tin::install::xci if (!Crypto::rsa2048PssVerify(&header->magic, 0x200, header->fixed_key_sig, Crypto::NCAHeaderSignature)) { - std::thread audioThread(inst::util::playAudio, "romfs:/audio/bark.wav"); - 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 audioPath = "romfs:/audio/infobeep.mp3"; + 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(); if (rc != 1) THROW_FORMAT(("inst.nca_verify.error"_lang + tin::util::GetNcaIdString(ncaId)).c_str()); diff --git a/source/netInstall.cpp b/source/netInstall.cpp index fea3618..a3028f3 100644 --- a/source/netInstall.cpp +++ b/source/netInstall.cpp @@ -250,10 +250,9 @@ namespace netInstStuff { inst::ui::instPage::setInstBarPerc(0); if (inst::config::useSound) { - std::string audioPath = ""; + std::string audioPath = "romfs:/audio/fail.mp3"; 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); - else audioPath = "romfs:/audio/ohno.wav"; std::thread audioThread(inst::util::playAudio, audioPath); audioThread.join(); } @@ -283,14 +282,9 @@ namespace netInstStuff { inst::ui::instPage::setInstBarPerc(100); if (inst::config::useSound) { - std::string audioPath = ""; + std::string audioPath = "romfs:/audio/pass.mp3"; 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); - } - else { - audioPath = "romfs:/audio/yipee.wav"; - } + if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(pass)) audioPath = (pass); std::thread audioThread(inst::util::playAudio, audioPath); audioThread.join(); } diff --git a/source/sdInstall.cpp b/source/sdInstall.cpp index df1e808..59115c4 100644 --- a/source/sdInstall.cpp +++ b/source/sdInstall.cpp @@ -107,7 +107,7 @@ namespace nspInstStuff { std::string audioPath = ""; 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); - else audioPath = "romfs:/audio/ohno.wav"; + else audioPath = "romfs:/audio/fail.mp3"; std::thread audioThread(inst::util::playAudio, audioPath); audioThread.join(); } @@ -151,7 +151,7 @@ namespace nspInstStuff { audioPath = (pass); } else { - audioPath = "romfs:/audio/yipee.wav"; + audioPath = "romfs:/audio/pass.mp3"; } std::thread audioThread(inst::util::playAudio, audioPath); audioThread.join(); diff --git a/source/ui/ThemeInstPage.cpp b/source/ui/ThemeInstPage.cpp index f577b37..ce1f886 100644 --- a/source/ui/ThemeInstPage.cpp +++ b/source/ui/ThemeInstPage.cpp @@ -225,10 +225,9 @@ namespace inst::ui { } else { if (inst::config::useSound) { - std::string audioPath = ""; + std::string audioPath = "romfs:/audio/fail.mp3"; 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); - else audioPath = "romfs:/audio/ohno.wav"; std::thread audioThread(inst::util::playAudio, audioPath); audioThread.join(); } @@ -247,10 +246,9 @@ namespace inst::ui { std::filesystem::remove(ourPath); if (didExtract) { if (inst::config::useSound) { - std::string audioPath = ""; + std::string audioPath = "romfs:/audio/pass.mp3"; 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); - else audioPath = "romfs:/audio/yipee.wav"; std::thread audioThread(inst::util::playAudio, audioPath); audioThread.join(); } diff --git a/source/usbInstall.cpp b/source/usbInstall.cpp index 22805a5..a9db492 100644 --- a/source/usbInstall.cpp +++ b/source/usbInstall.cpp @@ -166,14 +166,9 @@ namespace usbInstStuff { inst::ui::instPage::setInstBarPerc(0); if (inst::config::useSound) { - std::string audioPath = ""; + std::string audioPath = "romfs:/audio/fail.mp3"; 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); - } - else { - audioPath = "romfs:/audio/ohno.wav"; - } + if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(fail)) audioPath = (fail); std::thread audioThread(inst::util::playAudio, audioPath); audioThread.join(); } @@ -194,14 +189,9 @@ namespace usbInstStuff { inst::ui::instPage::setInstBarPerc(100); if (inst::config::useSound) { - std::string audioPath = ""; + std::string audioPath = "romfs:/audio/pass.mp3"; 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); - } - else { - audioPath = "romfs:/audio/yipee.wav"; - } + if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(pass)) audioPath = (pass); std::thread audioThread(inst::util::playAudio, audioPath); audioThread.join(); }