From b6fff2fe69d08ca6abcb5287635152db35c96eec Mon Sep 17 00:00:00 2001 From: Huntereb Date: Tue, 22 Sep 2020 14:29:09 -0400 Subject: [PATCH] "Hide Anime" now actually hides all anime, and disables sounds. Sounds can now be customized. --- include/ui/instPage.hpp | 4 ++-- include/ui/mainPage.hpp | 4 ++-- include/ui/netInstPage.hpp | 4 ++-- include/ui/optionsPage.hpp | 4 ++-- include/ui/sdInstPage.hpp | 4 ++-- include/ui/usbInstPage.hpp | 4 ++-- source/install/install_nsp.cpp | 5 ++++- source/install/install_xci.cpp | 5 ++++- source/netInstall.cpp | 10 ++++++++-- source/sdInstall.cpp | 10 ++++++++-- source/ui/instPage.cpp | 10 ++++++++-- source/ui/mainPage.cpp | 10 ++++++++-- source/ui/netInstPage.cpp | 10 ++++++++-- source/ui/optionsPage.cpp | 34 ++++++++++++++++++++++++++++++++-- source/ui/sdInstPage.cpp | 10 ++++++++-- source/ui/usbInstPage.cpp | 10 ++++++++-- source/usbInstall.cpp | 10 ++++++++-- 17 files changed, 116 insertions(+), 32 deletions(-) diff --git a/include/ui/instPage.hpp b/include/ui/instPage.hpp index f920687..3707772 100755 --- a/include/ui/instPage.hpp +++ b/include/ui/instPage.hpp @@ -13,6 +13,8 @@ namespace inst::ui { TextBlock::Ref installInfoText; pu::ui::elm::ProgressBar::Ref installBar; Image::Ref awooImage; + Image::Ref titleImage; + TextBlock::Ref appVersionText; static void setTopInstInfoText(std::string ourText); static void setInstInfoText(std::string ourText); static void setInstBarPerc(double ourPercent); @@ -21,7 +23,5 @@ namespace inst::ui { private: Rectangle::Ref infoRect; Rectangle::Ref topRect; - Image::Ref titleImage; - TextBlock::Ref appVersionText; }; } \ No newline at end of file diff --git a/include/ui/mainPage.hpp b/include/ui/mainPage.hpp index 612ab1d..4a2932c 100755 --- a/include/ui/mainPage.hpp +++ b/include/ui/mainPage.hpp @@ -16,14 +16,14 @@ namespace inst::ui { void exitMenuItem_Click(); void onInput(u64 Down, u64 Up, u64 Held, pu::ui::Touch Pos); Image::Ref awooImage; + Image::Ref titleImage; + TextBlock::Ref appVersionText; private: bool appletFinished; bool updateFinished; TextBlock::Ref butText; Rectangle::Ref topRect; Rectangle::Ref botRect; - Image::Ref titleImage; - TextBlock::Ref appVersionText; pu::ui::elm::Menu::Ref optionMenu; pu::ui::elm::MenuItem::Ref installMenuItem; pu::ui::elm::MenuItem::Ref netInstallMenuItem; diff --git a/include/ui/netInstPage.hpp b/include/ui/netInstPage.hpp index a078149..daad190 100755 --- a/include/ui/netInstPage.hpp +++ b/include/ui/netInstPage.hpp @@ -12,6 +12,8 @@ namespace inst::ui { void startNetwork(); void onInput(u64 Down, u64 Up, u64 Held, pu::ui::Touch Pos); TextBlock::Ref pageInfoText; + Image::Ref titleImage; + TextBlock::Ref appVersionText; private: std::vector ourUrls; std::vector selectedUrls; @@ -20,8 +22,6 @@ namespace inst::ui { Rectangle::Ref topRect; Rectangle::Ref infoRect; Rectangle::Ref botRect; - Image::Ref titleImage; - TextBlock::Ref appVersionText; pu::ui::elm::Menu::Ref menu; Image::Ref infoImage; void drawMenuItems(bool clearItems); diff --git a/include/ui/optionsPage.hpp b/include/ui/optionsPage.hpp index 31c2e51..dd43762 100755 --- a/include/ui/optionsPage.hpp +++ b/include/ui/optionsPage.hpp @@ -10,13 +10,13 @@ namespace inst::ui { PU_SMART_CTOR(optionsPage) void onInput(u64 Down, u64 Up, u64 Held, pu::ui::Touch Pos); static void askToUpdate(std::vector updateInfo); + Image::Ref titleImage; + TextBlock::Ref appVersionText; private: TextBlock::Ref butText; Rectangle::Ref topRect; Rectangle::Ref infoRect; Rectangle::Ref botRect; - Image::Ref titleImage; - TextBlock::Ref appVersionText; TextBlock::Ref pageInfoText; pu::ui::elm::Menu::Ref menu; void setMenuText(); diff --git a/include/ui/sdInstPage.hpp b/include/ui/sdInstPage.hpp index 4e49109..1413c3d 100755 --- a/include/ui/sdInstPage.hpp +++ b/include/ui/sdInstPage.hpp @@ -14,6 +14,8 @@ namespace inst::ui { void onInput(u64 Down, u64 Up, u64 Held, pu::ui::Touch Pos); TextBlock::Ref pageInfoText; void drawMenuItems(bool clearItems, std::filesystem::path ourPath); + Image::Ref titleImage; + TextBlock::Ref appVersionText; private: std::vector ourDirectories; std::vector ourFiles; @@ -23,8 +25,6 @@ namespace inst::ui { Rectangle::Ref topRect; Rectangle::Ref infoRect; Rectangle::Ref botRect; - Image::Ref titleImage; - TextBlock::Ref appVersionText; void followDirectory(); void selectNsp(int selectedIndex); }; diff --git a/include/ui/usbInstPage.hpp b/include/ui/usbInstPage.hpp index 883043c..b4b65d7 100755 --- a/include/ui/usbInstPage.hpp +++ b/include/ui/usbInstPage.hpp @@ -12,6 +12,8 @@ namespace inst::ui { void startUsb(); void onInput(u64 Down, u64 Up, u64 Held, pu::ui::Touch Pos); TextBlock::Ref pageInfoText; + Image::Ref titleImage; + TextBlock::Ref appVersionText; private: std::vector ourTitles; std::vector selectedTitles; @@ -21,8 +23,6 @@ namespace inst::ui { Rectangle::Ref topRect; Rectangle::Ref infoRect; Rectangle::Ref botRect; - Image::Ref titleImage; - TextBlock::Ref appVersionText; pu::ui::elm::Menu::Ref menu; Image::Ref infoImage; void drawMenuItems(bool clearItems); diff --git a/source/install/install_nsp.cpp b/source/install/install_nsp.cpp index 93b343e..5fd44aa 100755 --- a/source/install/install_nsp.cpp +++ b/source/install/install_nsp.cpp @@ -116,7 +116,10 @@ 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"); + std::string audioPath = "romfs:/audio/bark.wav"; + if (inst::config::gayMode) audioPath = ""; + if (std::filesystem::exists(inst::config::appDir + "/bark.wav")) audioPath = inst::config::appDir + "/bark.wav"; + std::thread audioThread(inst::util::playAudio,audioPath); 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); audioThread.join(); if (rc != 1) diff --git a/source/install/install_xci.cpp b/source/install/install_xci.cpp index 61d0341..a491d71 100755 --- a/source/install/install_xci.cpp +++ b/source/install/install_xci.cpp @@ -112,7 +112,10 @@ 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"); + std::string audioPath = "romfs:/audio/bark.wav"; + if (inst::config::gayMode) audioPath = ""; + if (std::filesystem::exists(inst::config::appDir + "/bark.wav")) audioPath = inst::config::appDir + "/bark.wav"; + std::thread audioThread(inst::util::playAudio,audioPath); 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); audioThread.join(); if (rc != 1) diff --git a/source/netInstall.cpp b/source/netInstall.cpp index 0eb6fd7..a19fcf6 100755 --- a/source/netInstall.cpp +++ b/source/netInstall.cpp @@ -163,7 +163,10 @@ namespace netInstStuff{ fprintf(stdout, "%s", e.what()); inst::ui::instPage::setInstInfoText("inst.info_page.failed"_lang + urlNames[urlItr]); inst::ui::instPage::setInstBarPerc(0); - std::thread audioThread(inst::util::playAudio,"romfs:/audio/bark.wav"); + std::string audioPath = "romfs:/audio/bark.wav"; + if (inst::config::gayMode) audioPath = ""; + if (std::filesystem::exists(inst::config::appDir + "/bark.wav")) audioPath = inst::config::appDir + "/bark.wav"; + std::thread audioThread(inst::util::playAudio,audioPath); inst::ui::mainApp->CreateShowDialog("inst.info_page.failed"_lang + urlNames[urlItr] + "!", "inst.info_page.failed_desc"_lang + "\n\n" + (std::string)e.what(), {"common.ok"_lang}, true); audioThread.join(); nspInstalled = false; @@ -183,7 +186,10 @@ namespace netInstStuff{ if(nspInstalled) { inst::ui::instPage::setInstInfoText("inst.info_page.complete"_lang); inst::ui::instPage::setInstBarPerc(100); - std::thread audioThread(inst::util::playAudio,"romfs:/audio/awoo.wav"); + std::string audioPath = "romfs:/audio/awoo.wav"; + if (inst::config::gayMode) audioPath = ""; + if (std::filesystem::exists(inst::config::appDir + "/awoo.wav")) audioPath = inst::config::appDir + "/awoo.wav"; + std::thread audioThread(inst::util::playAudio,audioPath); if (ourUrlList.size() > 1) inst::ui::mainApp->CreateShowDialog(std::to_string(ourUrlList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), {"common.ok"_lang}, true); else inst::ui::mainApp->CreateShowDialog(urlNames[0] + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), {"common.ok"_lang}, true); audioThread.join(); diff --git a/source/sdInstall.cpp b/source/sdInstall.cpp index 840839b..7fe2fcc 100755 --- a/source/sdInstall.cpp +++ b/source/sdInstall.cpp @@ -92,7 +92,10 @@ namespace nspInstStuff { fprintf(stdout, "%s", e.what()); inst::ui::instPage::setInstInfoText("inst.info_page.failed"_lang + inst::util::shortenString(ourTitleList[titleItr].filename().string(), 42, true)); inst::ui::instPage::setInstBarPerc(0); - std::thread audioThread(inst::util::playAudio,"romfs:/audio/bark.wav"); + std::string audioPath = "romfs:/audio/bark.wav"; + if (inst::config::gayMode) audioPath = ""; + if (std::filesystem::exists(inst::config::appDir + "/bark.wav")) audioPath = inst::config::appDir + "/bark.wav"; + std::thread audioThread(inst::util::playAudio,audioPath); inst::ui::mainApp->CreateShowDialog("inst.info_page.failed"_lang + inst::util::shortenString(ourTitleList[titleItr].filename().string(), 42, true) + "!", "inst.info_page.failed_desc"_lang + "\n\n" + (std::string)e.what(), {"common.ok"_lang}, true); audioThread.join(); nspInstalled = false; @@ -107,7 +110,10 @@ namespace nspInstStuff { if(nspInstalled) { inst::ui::instPage::setInstInfoText("inst.info_page.complete"_lang); inst::ui::instPage::setInstBarPerc(100); - std::thread audioThread(inst::util::playAudio,"romfs:/audio/awoo.wav"); + std::string audioPath = "romfs:/audio/awoo.wav"; + if (inst::config::gayMode) audioPath = ""; + if (std::filesystem::exists(inst::config::appDir + "/awoo.wav")) audioPath = inst::config::appDir + "/awoo.wav"; + std::thread audioThread(inst::util::playAudio,audioPath); if (ourTitleList.size() > 1) { if (inst::config::deletePrompt) { if(inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.sd.delete_info_multi"_lang, "inst.sd.delete_desc"_lang, {"common.no"_lang,"common.yes"_lang}, false) == 1) { diff --git a/source/ui/instPage.cpp b/source/ui/instPage.cpp index d2a2d01..4d976be 100755 --- a/source/ui/instPage.cpp +++ b/source/ui/instPage.cpp @@ -14,8 +14,14 @@ namespace inst::ui { else this->SetBackgroundImage("romfs:/images/background.jpg"); this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#170909FF")); this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#17090980")); - this->titleImage = Image::New(0, 0, "romfs:/images/logo.png"); - this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22); + if (inst::config::gayMode) { + this->titleImage = Image::New(-113, 0, "romfs:/images/logo.png"); + this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion, 22); + } + else { + this->titleImage = Image::New(0, 0, "romfs:/images/logo.png"); + this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22); + } this->appVersionText->SetColor(COLOR("#FFFFFFFF")); this->pageInfoText = TextBlock::New(10, 109, "", 30); this->pageInfoText->SetColor(COLOR("#FFFFFFFF")); diff --git a/source/ui/mainPage.cpp b/source/ui/mainPage.cpp index b755c72..64db11a 100755 --- a/source/ui/mainPage.cpp +++ b/source/ui/mainPage.cpp @@ -40,8 +40,14 @@ namespace inst::ui { else this->SetBackgroundImage("romfs:/images/background.jpg"); this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#170909FF")); this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR("#17090980")); - this->titleImage = Image::New(0, 0, "romfs:/images/logo.png"); - this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22); + if (inst::config::gayMode) { + this->titleImage = Image::New(-113, 0, "romfs:/images/logo.png"); + this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion, 22); + } + else { + this->titleImage = Image::New(0, 0, "romfs:/images/logo.png"); + this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22); + } this->appVersionText->SetColor(COLOR("#FFFFFFFF")); this->butText = TextBlock::New(10, 678, "main.buttons"_lang, 24); this->butText->SetColor(COLOR("#FFFFFFFF")); diff --git a/source/ui/netInstPage.cpp b/source/ui/netInstPage.cpp index 24bfec7..63cb23b 100755 --- a/source/ui/netInstPage.cpp +++ b/source/ui/netInstPage.cpp @@ -24,8 +24,14 @@ namespace inst::ui { this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#170909FF")); this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#17090980")); this->botRect = Rectangle::New(0, 660, 1280, 60, COLOR("#17090980")); - this->titleImage = Image::New(0, 0, "romfs:/images/logo.png"); - this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22); + if (inst::config::gayMode) { + this->titleImage = Image::New(-113, 0, "romfs:/images/logo.png"); + this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion, 22); + } + else { + this->titleImage = Image::New(0, 0, "romfs:/images/logo.png"); + this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22); + } this->appVersionText->SetColor(COLOR("#FFFFFFFF")); this->pageInfoText = TextBlock::New(10, 109, "", 30); this->pageInfoText->SetColor(COLOR("#FFFFFFFF")); diff --git a/source/ui/optionsPage.cpp b/source/ui/optionsPage.cpp index 3ab9450..000f9b9 100755 --- a/source/ui/optionsPage.cpp +++ b/source/ui/optionsPage.cpp @@ -25,8 +25,14 @@ namespace inst::ui { this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#170909FF")); this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#17090980")); this->botRect = Rectangle::New(0, 660, 1280, 60, COLOR("#17090980")); - this->titleImage = Image::New(0, 0, "romfs:/images/logo.png"); - this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22); + if (inst::config::gayMode) { + this->titleImage = Image::New(-113, 0, "romfs:/images/logo.png"); + this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion, 22); + } + else { + this->titleImage = Image::New(0, 0, "romfs:/images/logo.png"); + this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22); + } this->appVersionText->SetColor(COLOR("#FFFFFFFF")); this->pageInfoText = TextBlock::New(10, 109, "options.title"_lang, 30); this->pageInfoText->SetColor(COLOR("#FFFFFFFF")); @@ -186,11 +192,35 @@ namespace inst::ui { inst::config::gayMode = false; mainApp->mainPage->awooImage->SetVisible(true); mainApp->instpage->awooImage->SetVisible(true); + mainApp->instpage->titleImage->SetX(0); + mainApp->instpage->appVersionText->SetX(480); + mainApp->mainPage->titleImage->SetX(0); + mainApp->mainPage->appVersionText->SetX(480); + mainApp->netinstPage->titleImage->SetX(0); + mainApp->netinstPage->appVersionText->SetX(480); + mainApp->optionspage->titleImage->SetX(0); + mainApp->optionspage->appVersionText->SetX(480); + mainApp->sdinstPage->titleImage->SetX(0); + mainApp->sdinstPage->appVersionText->SetX(480); + mainApp->usbinstPage->titleImage->SetX(0); + mainApp->usbinstPage->appVersionText->SetX(480); } else { inst::config::gayMode = true; mainApp->mainPage->awooImage->SetVisible(false); mainApp->instpage->awooImage->SetVisible(false); + mainApp->instpage->titleImage->SetX(-113); + mainApp->instpage->appVersionText->SetX(367); + mainApp->mainPage->titleImage->SetX(-113); + mainApp->mainPage->appVersionText->SetX(367); + mainApp->netinstPage->titleImage->SetX(-113); + mainApp->netinstPage->appVersionText->SetX(367); + mainApp->optionspage->titleImage->SetX(-113); + mainApp->optionspage->appVersionText->SetX(367); + mainApp->sdinstPage->titleImage->SetX(-113); + mainApp->sdinstPage->appVersionText->SetX(367); + mainApp->usbinstPage->titleImage->SetX(-113); + mainApp->usbinstPage->appVersionText->SetX(367); } inst::config::setConfig(); this->setMenuText(); diff --git a/source/ui/sdInstPage.cpp b/source/ui/sdInstPage.cpp index 4d737d4..a83d978 100755 --- a/source/ui/sdInstPage.cpp +++ b/source/ui/sdInstPage.cpp @@ -19,8 +19,14 @@ namespace inst::ui { this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#170909FF")); this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#17090980")); this->botRect = Rectangle::New(0, 660, 1280, 60, COLOR("#17090980")); - this->titleImage = Image::New(0, 0, "romfs:/images/logo.png"); - this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22); + if (inst::config::gayMode) { + this->titleImage = Image::New(-113, 0, "romfs:/images/logo.png"); + this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion, 22); + } + else { + this->titleImage = Image::New(0, 0, "romfs:/images/logo.png"); + this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22); + } this->appVersionText->SetColor(COLOR("#FFFFFFFF")); this->pageInfoText = TextBlock::New(10, 109, "inst.sd.top_info"_lang, 30); this->pageInfoText->SetColor(COLOR("#FFFFFFFF")); diff --git a/source/ui/usbInstPage.cpp b/source/ui/usbInstPage.cpp index cb45c16..dac8f45 100755 --- a/source/ui/usbInstPage.cpp +++ b/source/ui/usbInstPage.cpp @@ -19,8 +19,14 @@ namespace inst::ui { this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#170909FF")); this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#17090980")); this->botRect = Rectangle::New(0, 660, 1280, 60, COLOR("#17090980")); - this->titleImage = Image::New(0, 0, "romfs:/images/logo.png"); - this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22); + if (inst::config::gayMode) { + this->titleImage = Image::New(-113, 0, "romfs:/images/logo.png"); + this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion, 22); + } + else { + this->titleImage = Image::New(0, 0, "romfs:/images/logo.png"); + this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22); + } this->appVersionText->SetColor(COLOR("#FFFFFFFF")); this->pageInfoText = TextBlock::New(10, 109, "", 30); this->pageInfoText->SetColor(COLOR("#FFFFFFFF")); diff --git a/source/usbInstall.cpp b/source/usbInstall.cpp index a8e557b..0fbccba 100755 --- a/source/usbInstall.cpp +++ b/source/usbInstall.cpp @@ -136,7 +136,10 @@ namespace usbInstStuff { fprintf(stdout, "%s", e.what()); inst::ui::instPage::setInstInfoText("inst.info_page.failed"_lang + fileNames[fileItr]); inst::ui::instPage::setInstBarPerc(0); - std::thread audioThread(inst::util::playAudio,"romfs:/audio/bark.wav"); + std::string audioPath = "romfs:/audio/bark.wav"; + if (inst::config::gayMode) audioPath = ""; + if (std::filesystem::exists(inst::config::appDir + "/bark.wav")) audioPath = inst::config::appDir + "/bark.wav"; + std::thread audioThread(inst::util::playAudio,audioPath); inst::ui::mainApp->CreateShowDialog("inst.info_page.failed"_lang + fileNames[fileItr] + "!", "inst.info_page.failed_desc"_lang + "\n\n" + (std::string)e.what(), {"common.ok"_lang}, true); audioThread.join(); nspInstalled = false; @@ -152,7 +155,10 @@ namespace usbInstStuff { tin::util::USBCmdManager::SendExitCmd(); inst::ui::instPage::setInstInfoText("inst.info_page.complete"_lang); inst::ui::instPage::setInstBarPerc(100); - std::thread audioThread(inst::util::playAudio,"romfs:/audio/awoo.wav"); + std::string audioPath = "romfs:/audio/awoo.wav"; + if (inst::config::gayMode) audioPath = ""; + if (std::filesystem::exists(inst::config::appDir + "/awoo.wav")) audioPath = inst::config::appDir + "/awoo.wav"; + std::thread audioThread(inst::util::playAudio,audioPath); if (ourTitleList.size() > 1) inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), {"common.ok"_lang}, true); else inst::ui::mainApp->CreateShowDialog(fileNames[0] + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), {"common.ok"_lang}, true); audioThread.join();