mirror of
https://github.com/hax4dazy/TinWoo.git
synced 2025-02-09 19:25:05 +01:00
finish theme code mods
This commit is contained in:
parent
ee053e32d8
commit
23e5000c21
@ -27,7 +27,6 @@ namespace inst::ui {
|
||||
pu::ui::elm::Menu::Ref menu;
|
||||
Image::Ref infoImage;
|
||||
void drawMenuItems(bool clearItems);
|
||||
void drawMenuItems_withext(bool clearItems);
|
||||
void selectTitle(int selectedIndex);
|
||||
};
|
||||
}
|
@ -59,6 +59,19 @@ namespace nspInstStuff_B {
|
||||
if (whereToInstall) m_destStorageId = NcmStorageId_BuiltInUser;
|
||||
unsigned int titleItr;
|
||||
|
||||
std::string bin = "romfs:/images/icons/bin.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.bin"_theme)) {
|
||||
bin = inst::config::appDir + "icons_others.bin"_theme;
|
||||
}
|
||||
std::string info = "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)) {
|
||||
info = inst::config::appDir + "icons_others.information"_theme;
|
||||
}
|
||||
std::string fail = "romfs:/images/icons/fail.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
|
||||
fail = inst::config::appDir + "icons_others.fail"_theme;
|
||||
}
|
||||
|
||||
std::vector<int> previousClockValues;
|
||||
if (inst::config::overClock) {
|
||||
previousClockValues.push_back(inst::util::setClockSpeed(0, 1785000000)[0]);
|
||||
@ -116,7 +129,7 @@ namespace nspInstStuff_B {
|
||||
audioThread.join();
|
||||
}
|
||||
|
||||
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, "romfs:/images/icons/fail.png");
|
||||
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, fail);
|
||||
nspInstalled = false;
|
||||
}
|
||||
|
||||
@ -145,19 +158,19 @@ namespace nspInstStuff_B {
|
||||
|
||||
if (ourTitleList.size() > 1) {
|
||||
if (inst::config::deletePrompt) {
|
||||
if (inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.hd.delete_info_multi"_lang, "inst.hd.delete_desc"_lang, { "common.no"_lang,"common.yes"_lang }, false, "romfs:/images/icons/bin.png") == 1) {
|
||||
if (inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.hd.delete_info_multi"_lang, "inst.hd.delete_desc"_lang, { "common.no"_lang,"common.yes"_lang }, false, bin) == 1) {
|
||||
for (long unsigned int i = 0; i < ourTitleList.size(); i++) {
|
||||
if (std::filesystem::exists(ourTitleList[i])) std::filesystem::remove(ourTitleList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, "romfs:/images/icons/information.png");
|
||||
else inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, info);
|
||||
}
|
||||
else {
|
||||
if (inst::config::deletePrompt) {
|
||||
if (inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 32, true) + "inst.hd.delete_info"_lang, "inst.hd.delete_desc"_lang, { "common.no"_lang,"common.yes"_lang }, false, "romfs:/images/icons/bin.png") == 1) if (std::filesystem::exists(ourTitleList[0])) std::filesystem::remove(ourTitleList[0]);
|
||||
if (inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 32, true) + "inst.hd.delete_info"_lang, "inst.hd.delete_desc"_lang, { "common.no"_lang,"common.yes"_lang }, false, bin) == 1) if (std::filesystem::exists(ourTitleList[0])) std::filesystem::remove(ourTitleList[0]);
|
||||
}
|
||||
else inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 42, true) + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, "romfs:/images/icons/bin.png");
|
||||
else inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 42, true) + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, bin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ SOFTWARE.
|
||||
#include "util/curl.hpp"
|
||||
#include "util/lang.hpp"
|
||||
#include "ui/MainApplication.hpp"
|
||||
#include "util/theme.hpp"
|
||||
|
||||
bool netConnected2 = false;
|
||||
|
||||
@ -125,6 +126,19 @@ namespace ThemeInstStuff {
|
||||
u64 startTime = armGetSystemTick();
|
||||
OnUnwound();
|
||||
|
||||
std::string info = "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)) {
|
||||
info = inst::config::appDir + "icons_others.information"_theme;
|
||||
}
|
||||
std::string fail = "romfs:/images/icons/fail.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
|
||||
fail = inst::config::appDir + "icons_others.fail"_theme;
|
||||
}
|
||||
std::string wait = "romfs:/images/icons/wait.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.wait"_theme)) {
|
||||
wait = inst::config::appDir + "icons_others.wait"_theme;
|
||||
}
|
||||
|
||||
try {
|
||||
ASSERT_OK(curl_global_init(CURL_GLOBAL_ALL), "Curl failed to initialized");
|
||||
|
||||
@ -173,7 +187,7 @@ namespace ThemeInstStuff {
|
||||
|
||||
if (url == "") {
|
||||
url = ("http://127.0.0.1");
|
||||
inst::ui::mainApp->CreateShowDialog("theme.theme_fail"_lang, "inst.net.help.blank"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/information.png");
|
||||
inst::ui::mainApp->CreateShowDialog("theme.theme_fail"_lang, "inst.net.help.blank"_lang, { "common.ok"_lang }, true, info);
|
||||
inst::config::httplastUrl2 = url;
|
||||
inst::config::setConfig();
|
||||
//refresh options page
|
||||
@ -184,7 +198,7 @@ namespace ThemeInstStuff {
|
||||
else {
|
||||
std::string response;
|
||||
if (inst::util::formatUrlString(url) == "" || url == "https://" || url == "http://" || url == "HTTP://" || url == "HTTPS://") {
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.url.invalid"_lang, "", { "common.ok"_lang }, false, "romfs:/images/icons/fail.png");
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.url.invalid"_lang, "", { "common.ok"_lang }, false, fail);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
@ -197,7 +211,7 @@ namespace ThemeInstStuff {
|
||||
if (response.empty()) {
|
||||
response = inst::curl::html_to_buffer(url);
|
||||
if (response.empty()) {
|
||||
inst::ui::mainApp->CreateShowDialog("theme.theme_error"_lang, "theme.theme_error_info"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/fail.png");
|
||||
inst::ui::mainApp->CreateShowDialog("theme.theme_error"_lang, "theme.theme_error_info"_lang, { "common.ok"_lang }, true, fail);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -221,7 +235,7 @@ namespace ThemeInstStuff {
|
||||
else if (!response.empty()) {
|
||||
std::size_t index = 0;
|
||||
if (!inst::config::listoveride) {
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.url.listwait"_lang + std::to_string(maxlist) + "inst.net.url.listwait2"_lang, "", { "common.ok"_lang }, false, "romfs:/images/icons/wait.png");
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.url.listwait"_lang + std::to_string(maxlist) + "inst.net.url.listwait2"_lang, "", { "common.ok"_lang }, false, wait);
|
||||
}
|
||||
while (index < response.size()) {
|
||||
std::string link;
|
||||
@ -282,7 +296,7 @@ namespace ThemeInstStuff {
|
||||
}
|
||||
|
||||
else {
|
||||
inst::ui::mainApp->CreateShowDialog("theme.no_themes"_lang, "", { "common.ok"_lang }, false, "romfs:/images/icons/fail.png");
|
||||
inst::ui::mainApp->CreateShowDialog("theme.no_themes"_lang, "", { "common.ok"_lang }, false, fail);
|
||||
LOG_DEBUG("Failed to parse themes from HTML\n");
|
||||
break;
|
||||
}
|
||||
@ -290,14 +304,14 @@ namespace ThemeInstStuff {
|
||||
}
|
||||
|
||||
else {
|
||||
inst::ui::mainApp->CreateShowDialog("theme.theme_error"_lang, "theme.theme_error_info"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/fail.png");
|
||||
inst::ui::mainApp->CreateShowDialog("theme.theme_error"_lang, "theme.theme_error_info"_lang, { "common.ok"_lang }, true, fail);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
LOG_DEBUG("Failed to fetch theme list\n");
|
||||
inst::ui::mainApp->CreateShowDialog("theme.theme_error"_lang, "theme.theme_error_info"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/fail.png");
|
||||
inst::ui::mainApp->CreateShowDialog("theme.theme_error"_lang, "theme.theme_error_info"_lang, { "common.ok"_lang }, true, fail);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -308,7 +322,7 @@ namespace ThemeInstStuff {
|
||||
LOG_DEBUG("Failed to perform remote install!\n");
|
||||
LOG_DEBUG("%s", e.what());
|
||||
fprintf(stdout, "%s", e.what());
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.failed"_lang, (std::string)e.what(), { "common.ok"_lang }, true, "romfs:/images/icons/fail.png");
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.failed"_lang, (std::string)e.what(), { "common.ok"_lang }, true, fail);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ SOFTWARE.
|
||||
#include "util/util.hpp"
|
||||
#include "util/lang.hpp"
|
||||
#include "ui/MainApplication.hpp"
|
||||
#include "util/theme.hpp"
|
||||
|
||||
namespace inst::ui {
|
||||
extern MainApplication* mainApp;
|
||||
@ -165,7 +166,11 @@ namespace tin::install::nsp
|
||||
ss << *it;
|
||||
}
|
||||
if (ss.str().length() == 0) {
|
||||
inst::ui::mainApp->CreateShowDialog("main.usb.warn.title"_lang, "inst.nca_verify.ticket_missing"_lang, { "common.ok"_lang }, false, "romfs:/images/icons/information.png");
|
||||
std::string info = "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)) {
|
||||
info = inst::config::appDir + "icons_others.information"_theme;
|
||||
}
|
||||
inst::ui::mainApp->CreateShowDialog("main.usb.warn.title"_lang, "inst.nca_verify.ticket_missing"_lang, { "common.ok"_lang }, false, info);
|
||||
return; //don't bother trying to install the ticket or cert if it doesn't exist.
|
||||
}
|
||||
// end of ticket check
|
||||
|
@ -164,7 +164,12 @@ namespace netInstStuff {
|
||||
close(m_serverSocket);
|
||||
m_serverSocket = 0;
|
||||
}
|
||||
inst::ui::mainApp->CreateShowDialog("Failed to initialize server socket!", (std::string)e.what(), { "OK" }, true, "romfs:/images/icons/fail.png");
|
||||
std::string fail = "romfs:/images/icons/fail.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
|
||||
fail = inst::config::appDir + "icons_others.fail"_theme;
|
||||
}
|
||||
|
||||
inst::ui::mainApp->CreateShowDialog("Failed to initialize server socket!", (std::string)e.what(), { "OK" }, true, fail);
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,7 +258,12 @@ namespace netInstStuff {
|
||||
audioThread.join();
|
||||
}
|
||||
|
||||
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, "romfs:/images/icons/fail.png");
|
||||
std::string fail = "romfs:/images/icons/fail.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
|
||||
fail = inst::config::appDir + "icons_others.fail"_theme;
|
||||
}
|
||||
|
||||
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, fail);
|
||||
nspInstalled = false;
|
||||
}
|
||||
|
||||
@ -285,11 +295,16 @@ namespace netInstStuff {
|
||||
audioThread.join();
|
||||
}
|
||||
|
||||
std::string good = "romfs:/images/icons/good.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.good"_theme)) {
|
||||
good = inst::config::appDir + "icons_others.good"_theme;
|
||||
}
|
||||
|
||||
if (ourUrlList.size() > 1) {
|
||||
inst::ui::mainApp->CreateShowDialog(std::to_string(ourUrlList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, "romfs:/images/icons/good.png");
|
||||
inst::ui::mainApp->CreateShowDialog(std::to_string(ourUrlList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, good);
|
||||
}
|
||||
else {
|
||||
inst::ui::mainApp->CreateShowDialog(urlNames[0] + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, "romfs:/images/icons/good.png");
|
||||
inst::ui::mainApp->CreateShowDialog(urlNames[0] + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, good);
|
||||
}
|
||||
}
|
||||
|
||||
@ -332,6 +347,19 @@ namespace netInstStuff {
|
||||
std::vector<std::string> urls;
|
||||
std::vector<std::string> tmp_array;
|
||||
|
||||
std::string info = "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)) {
|
||||
info = inst::config::appDir + "icons_others.information"_theme;
|
||||
}
|
||||
std::string fail = "romfs:/images/icons/fail.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
|
||||
fail = inst::config::appDir + "icons_others.fail"_theme;
|
||||
}
|
||||
std::string wait = "romfs:/images/icons/wait.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.wait"_theme)) {
|
||||
wait = inst::config::appDir + "icons_others.wait"_theme;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
padUpdate(&pad);
|
||||
|
||||
@ -356,7 +384,7 @@ namespace netInstStuff {
|
||||
}
|
||||
if (kDown & HidNpadButton_X)
|
||||
{
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.help.title"_lang, "inst.net.help.desc"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/information.png");
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.help.title"_lang, "inst.net.help.desc"_lang, { "common.ok"_lang }, true, info);
|
||||
}
|
||||
|
||||
if (kDown & HidNpadButton_Minus) {
|
||||
@ -378,7 +406,7 @@ namespace netInstStuff {
|
||||
|
||||
if (url == "") {
|
||||
url = ("http://127.0.0.1");
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.help.title"_lang, "inst.net.help.blank"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/information.png");
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.help.title"_lang, "inst.net.help.blank"_lang, { "common.ok"_lang }, true, info);
|
||||
inst::config::httpIndexUrl = url;
|
||||
inst::config::setConfig();
|
||||
//refresh options page
|
||||
@ -389,7 +417,7 @@ namespace netInstStuff {
|
||||
else {
|
||||
std::string response;
|
||||
if (inst::util::formatUrlString(url) == "" || url == "https://" || url == "http://" || url == "HTTP://" || url == "HTTPS://") {
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.url.invalid"_lang, "", { "common.ok"_lang }, false, "romfs:/images/icons/fail.png");
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.url.invalid"_lang, "", { "common.ok"_lang }, false, fail);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
@ -402,7 +430,7 @@ namespace netInstStuff {
|
||||
if (response.empty()) {
|
||||
response = inst::curl::html_to_buffer(url);
|
||||
if (response.empty()) {
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.index_error"_lang, "inst.net.index_error_info"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/fail.png");
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.index_error"_lang, "inst.net.index_error_info"_lang, { "common.ok"_lang }, true, fail);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -426,7 +454,7 @@ namespace netInstStuff {
|
||||
else if (!response.empty()) {
|
||||
std::size_t index = 0;
|
||||
if (!inst::config::listoveride) {
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.url.listwait"_lang + std::to_string(maxlist) + "inst.net.url.listwait2"_lang, "", { "common.ok"_lang }, false, "romfs:/images/icons/wait.png");
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.url.listwait"_lang + std::to_string(maxlist) + "inst.net.url.listwait2"_lang, "", { "common.ok"_lang }, false, wait);
|
||||
}
|
||||
while (index < response.size()) {
|
||||
std::string link;
|
||||
@ -508,7 +536,7 @@ namespace netInstStuff {
|
||||
}
|
||||
|
||||
else {
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.url.nolinks"_lang, "", { "common.ok"_lang }, false, "romfs:/images/icons/fail.png");
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.url.nolinks"_lang, "", { "common.ok"_lang }, false, fail);
|
||||
LOG_DEBUG("Failed to parse games from HTML\n");
|
||||
break;
|
||||
}
|
||||
@ -516,7 +544,7 @@ namespace netInstStuff {
|
||||
}
|
||||
|
||||
else {
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.index_error"_lang, "inst.net.index_error_info"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/fail.png");
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.index_error"_lang, "inst.net.index_error_info"_lang, { "common.ok"_lang }, true, fail);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -575,7 +603,11 @@ namespace netInstStuff {
|
||||
LOG_DEBUG("Failed to perform remote install!\n");
|
||||
LOG_DEBUG("%s", e.what());
|
||||
fprintf(stdout, "%s", e.what());
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.failed"_lang, (std::string)e.what(), { "common.ok"_lang }, true, "romfs:/images/icons/fail.png");
|
||||
std::string fail = "romfs:/images/icons/fail.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
|
||||
fail = inst::config::appDir + "icons_others.fail"_theme;
|
||||
}
|
||||
inst::ui::mainApp->CreateShowDialog("inst.net.failed"_lang, (std::string)e.what(), { "common.ok"_lang }, true, fail);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,12 @@ namespace nspInstStuff {
|
||||
audioThread.join();
|
||||
}
|
||||
|
||||
inst::ui::mainApp->CreateShowDialog("inst.info_page.failed"_lang + inst::util::shortenString(ourTitleList[titleItr].filename().string(), 42, true) + "!\n", "inst.info_page.failed_desc"_lang + "\n\n" + (std::string)e.what(), { "common.ok"_lang }, true);
|
||||
std::string fail = "romfs:/images/icons/fail.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
|
||||
fail = inst::config::appDir + "icons_others.fail"_theme;
|
||||
}
|
||||
|
||||
inst::ui::mainApp->CreateShowDialog("inst.info_page.failed"_lang + inst::util::shortenString(ourTitleList[titleItr].filename().string(), 42, true) + "!\n", "inst.info_page.failed_desc"_lang + "\n\n" + (std::string)e.what(), { "common.ok"_lang }, true, fail);
|
||||
nspInstalled = false;
|
||||
}
|
||||
|
||||
@ -126,6 +131,19 @@ namespace nspInstStuff {
|
||||
inst::ui::instPage::setInstInfoText("inst.info_page.complete"_lang);
|
||||
inst::ui::instPage::setInstBarPerc(100);
|
||||
|
||||
std::string bin = "romfs:/images/icons/bin.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.bin"_theme)) {
|
||||
bin = inst::config::appDir + "icons_others.bin"_theme;
|
||||
}
|
||||
std::string info = "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)) {
|
||||
info = inst::config::appDir + "icons_others.information"_theme;
|
||||
}
|
||||
std::string good = "romfs:/images/icons/good.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.good"_theme)) {
|
||||
good = inst::config::appDir + "icons_others.good"_theme;
|
||||
}
|
||||
|
||||
if (inst::config::useSound) {
|
||||
std::string audioPath = "";
|
||||
std::string pass = inst::config::appDir + "audio.pass"_theme;
|
||||
@ -141,7 +159,7 @@ namespace nspInstStuff {
|
||||
|
||||
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, "romfs:/images/icons/bin.png") == 1) {
|
||||
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, bin) == 1) {
|
||||
for (long unsigned int i = 0; i < ourTitleList.size(); i++) {
|
||||
if (std::filesystem::exists(ourTitleList[i])) {
|
||||
std::filesystem::remove(ourTitleList[i]);
|
||||
@ -150,14 +168,14 @@ namespace nspInstStuff {
|
||||
}
|
||||
}
|
||||
else {
|
||||
inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, "romfs:/images/icons/good.png");
|
||||
inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, good);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (inst::config::deletePrompt) {
|
||||
if (inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 32, true) + "inst.sd.delete_info"_lang, "inst.sd.delete_desc"_lang, { "common.no"_lang,"common.yes"_lang }, false, "romfs:/images/icons/bin.png") == 1) if (std::filesystem::exists(ourTitleList[0])) std::filesystem::remove(ourTitleList[0]);
|
||||
if (inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 32, true) + "inst.sd.delete_info"_lang, "inst.sd.delete_desc"_lang, { "common.no"_lang,"common.yes"_lang }, false, bin) == 1) if (std::filesystem::exists(ourTitleList[0])) std::filesystem::remove(ourTitleList[0]);
|
||||
}
|
||||
else inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 42, true) + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, "romfs:/images/icons/information.png");
|
||||
else inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 42, true) + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, info);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "util/unzip.hpp"
|
||||
#include "util/config.hpp"
|
||||
#include "util/lang.hpp"
|
||||
#include "util/theme.hpp"
|
||||
|
||||
namespace inst::ui {
|
||||
extern MainApplication* mainApp;
|
||||
@ -14,6 +15,23 @@ namespace inst::ui {
|
||||
namespace sig {
|
||||
void installSigPatches() {
|
||||
bpcInitialize();
|
||||
std::string fail = "romfs:/images/icons/fail.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
|
||||
fail = inst::config::appDir + "icons_others.fail"_theme;
|
||||
}
|
||||
std::string patches = "romfs:/images/icons/patches.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.patches"_theme)) {
|
||||
patches = inst::config::appDir + "icons_others.patches"_theme;
|
||||
}
|
||||
std::string update = "romfs:/images/icons/update.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.update"_theme)) {
|
||||
update = inst::config::appDir + "icons_others.update"_theme;
|
||||
}
|
||||
std::string good = "romfs:/images/icons/good.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.good"_theme)) {
|
||||
good = inst::config::appDir + "icons_others.good"_theme;
|
||||
}
|
||||
|
||||
try {
|
||||
std::string patchesVersion = inst::util::readTextFromFile("sdmc:/atmosphere/exefs_patches/es_patches/patches.txt");
|
||||
std::string versionText = "";
|
||||
@ -22,21 +40,21 @@ namespace sig {
|
||||
versionText = "\n\n" + "sig.version_text"_lang + patchesVersion + ".";
|
||||
installButtonText = "sig.update"_lang;
|
||||
}
|
||||
int ourResult = inst::ui::mainApp->CreateShowDialog("sig.title0"_lang, "sig.desc0"_lang + versionText, { installButtonText, "sig.uninstall"_lang, "common.cancel"_lang }, true, "romfs:/images/icons/patches.png");
|
||||
int ourResult = inst::ui::mainApp->CreateShowDialog("sig.title0"_lang, "sig.desc0"_lang + versionText, { installButtonText, "sig.uninstall"_lang, "common.cancel"_lang }, true, patches);
|
||||
if (ourResult == 0) {
|
||||
if (inst::util::getIPAddress() == "1.0.0.127") {
|
||||
inst::ui::mainApp->CreateShowDialog("main.net.title"_lang, "main.net.desc"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/update.png");
|
||||
inst::ui::mainApp->CreateShowDialog("main.net.title"_lang, "main.net.desc"_lang, { "common.ok"_lang }, true, update);
|
||||
return;
|
||||
}
|
||||
if (!inst::util::copyFile("sdmc:/bootloader/patches.ini", inst::config::appDir + "/patches.ini.old")) {
|
||||
if (inst::ui::mainApp->CreateShowDialog("sig.backup_failed"_lang, "sig.backup_failed_desc"_lang, { "common.yes"_lang, "common.no"_lang }, false, "romfs:/images/icons/fail.png")) return;
|
||||
if (inst::ui::mainApp->CreateShowDialog("sig.backup_failed"_lang, "sig.backup_failed_desc"_lang, { "common.yes"_lang, "common.no"_lang }, false, fail)) return;
|
||||
}
|
||||
std::string ourPath = inst::config::appDir + "/patches.zip";
|
||||
bool didDownload = inst::curl::downloadFile(inst::config::sigPatchesUrl, ourPath.c_str());
|
||||
bool didExtract = false;
|
||||
if (didDownload) didExtract = inst::zip::extractFile(ourPath, "sdmc:/");
|
||||
else {
|
||||
inst::ui::mainApp->CreateShowDialog("sig.download_failed"_lang, "sig.download_failed_desc"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/fail.png");
|
||||
inst::ui::mainApp->CreateShowDialog("sig.download_failed"_lang, "sig.download_failed_desc"_lang, { "common.ok"_lang }, true, fail);
|
||||
return;
|
||||
}
|
||||
std::filesystem::remove(ourPath);
|
||||
@ -44,23 +62,23 @@ namespace sig {
|
||||
patchesVersion = inst::util::readTextFromFile("sdmc:/atmosphere/exefs_patches/es_patches/patches.txt");
|
||||
versionText = "";
|
||||
if (patchesVersion != "") versionText = "sig.version_text2"_lang + patchesVersion + "! ";
|
||||
if (inst::ui::mainApp->CreateShowDialog("sig.install_complete"_lang, versionText + "\n\n" + "sig.complete_desc"_lang, { "sig.restart"_lang, "sig.later"_lang }, false, "romfs:/images/icons/good.png") == 0) bpcRebootSystem();
|
||||
if (inst::ui::mainApp->CreateShowDialog("sig.install_complete"_lang, versionText + "\n\n" + "sig.complete_desc"_lang, { "sig.restart"_lang, "sig.later"_lang }, false, good) == 0) bpcRebootSystem();
|
||||
}
|
||||
else {
|
||||
inst::ui::mainApp->CreateShowDialog("sig.extract_failed"_lang, "", { "common.ok"_lang }, true, "romfs:/images/icons/fail.png");
|
||||
inst::ui::mainApp->CreateShowDialog("sig.extract_failed"_lang, "", { "common.ok"_lang }, true, fail);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (ourResult == 1) {
|
||||
if (!inst::util::copyFile(inst::config::appDir + "/patches.ini.old", "sdmc:/bootloader/patches.ini")) {
|
||||
if (inst::ui::mainApp->CreateShowDialog("sig.restore_failed"_lang, "", { "common.yes"_lang, "common.no"_lang }, false, "romfs:/images/icons/fail.png")) return;
|
||||
if (inst::ui::mainApp->CreateShowDialog("sig.restore_failed"_lang, "", { "common.yes"_lang, "common.no"_lang }, false, fail)) return;
|
||||
}
|
||||
else std::filesystem::remove(inst::config::appDir + "/patches.ini.old");
|
||||
if (inst::util::removeDirectory("sdmc:/atmosphere/exefs_patches/es_patches")) {
|
||||
if (inst::ui::mainApp->CreateShowDialog("sig.uninstall_complete"_lang, "sig.complete_desc"_lang, { "sig.restart"_lang, "sig.later"_lang }, false, "romfs:/images/icons/good.png") == 0) bpcRebootSystem();
|
||||
if (inst::ui::mainApp->CreateShowDialog("sig.uninstall_complete"_lang, "sig.complete_desc"_lang, { "sig.restart"_lang, "sig.later"_lang }, false, good) == 0) bpcRebootSystem();
|
||||
}
|
||||
else inst::ui::mainApp->CreateShowDialog("sig.remove_failed"_lang, "sig.remove_failed_desc"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/fail.png");
|
||||
else inst::ui::mainApp->CreateShowDialog("sig.remove_failed"_lang, "sig.remove_failed_desc"_lang, { "common.ok"_lang }, true, fail);
|
||||
}
|
||||
else return;
|
||||
}
|
||||
@ -69,7 +87,11 @@ namespace sig {
|
||||
LOG_DEBUG("Failed to install Signature Patches");
|
||||
LOG_DEBUG("%s", e.what());
|
||||
fprintf(stdout, "%s", e.what());
|
||||
inst::ui::mainApp->CreateShowDialog("sig.generic_error"_lang, (std::string)e.what(), { "common.ok"_lang }, true, "romfs:/images/icons/information.png");
|
||||
std::string fail = "romfs:/images/icons/fail.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
|
||||
fail = inst::config::appDir + "icons_others.fail"_theme;
|
||||
}
|
||||
inst::ui::mainApp->CreateShowDialog("sig.generic_error"_lang, (std::string)e.what(), { "common.ok"_lang }, true, fail);
|
||||
}
|
||||
bpcExit();
|
||||
}
|
||||
|
@ -15,6 +15,18 @@ namespace inst::ui {
|
||||
s32 zzz = 0; //touchscreen variable
|
||||
bool show_file_ext;
|
||||
|
||||
std::string checked_hdd = "romfs:/images/icons/check-box-outline.png";
|
||||
std::string unchecked_hdd = "romfs:/images/icons/checkbox-blank-outline.png";
|
||||
|
||||
void checkbox_hdd() {
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.checkbox-checked"_theme)) {
|
||||
checked_hdd = inst::config::appDir + "icons_others.checkbox-checked"_theme;
|
||||
}
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.checkbox-empty"_theme)) {
|
||||
unchecked_hdd = inst::config::appDir + "icons_others.checkbox-empty"_theme;
|
||||
}
|
||||
}
|
||||
|
||||
HDInstPage::HDInstPage() : Layout::Layout() {
|
||||
std::string infoRect_colour = "colour.inforect"_theme;
|
||||
std::string bg_colour = "colour.background"_theme;
|
||||
@ -72,6 +84,7 @@ namespace inst::ui {
|
||||
this->Add(this->butText);
|
||||
this->Add(this->pageInfoText);
|
||||
this->Add(this->menu);
|
||||
checkbox_hdd();
|
||||
}
|
||||
|
||||
void HDInstPage::drawMenuItems(bool clearItems, std::filesystem::path ourPath) {
|
||||
@ -137,10 +150,10 @@ namespace inst::ui {
|
||||
auto ourEntry = pu::ui::elm::MenuItem::New(itm);
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
|
||||
else ourEntry->SetColor(COLOR("#FFFFFFFF"));
|
||||
ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png");
|
||||
ourEntry->SetIcon(unchecked_hdd);
|
||||
for (long unsigned int i = 0; i < this->selectedTitles.size(); i++) {
|
||||
if (this->selectedTitles[i] == file) {
|
||||
ourEntry->SetIcon("romfs:/images/icons/check-box-outline.png");
|
||||
ourEntry->SetIcon(checked_hdd);
|
||||
}
|
||||
}
|
||||
this->menu->AddItem(ourEntry);
|
||||
@ -170,12 +183,12 @@ namespace inst::ui {
|
||||
int dirListSize = this->ourDirectories.size();
|
||||
dirListSize++;
|
||||
|
||||
if (this->menu->GetItems()[selectedIndex]->GetIconPath() == "romfs:/images/icons/check-box-outline.png") {
|
||||
if (this->menu->GetItems()[selectedIndex]->GetIconPath() == checked_hdd) {
|
||||
for (long unsigned int i = 0; i < this->selectedTitles.size(); i++) {
|
||||
if (this->selectedTitles[i] == this->ourFiles[selectedIndex - dirListSize]) this->selectedTitles.erase(this->selectedTitles.begin() + i);
|
||||
}
|
||||
}
|
||||
else if (this->menu->GetItems()[selectedIndex]->GetIconPath() == "romfs:/images/icons/checkbox-blank-outline.png") this->selectedTitles.push_back(this->ourFiles[selectedIndex - dirListSize]);
|
||||
else if (this->menu->GetItems()[selectedIndex]->GetIconPath() == unchecked_hdd) this->selectedTitles.push_back(this->ourFiles[selectedIndex - dirListSize]);
|
||||
else {
|
||||
this->followDirectory();
|
||||
return;
|
||||
@ -226,7 +239,7 @@ namespace inst::ui {
|
||||
int topDir = 0;
|
||||
topDir++;
|
||||
for (long unsigned int i = this->ourDirectories.size() + topDir; i < this->menu->GetItems().size(); i++) {
|
||||
if (this->menu->GetItems()[i]->GetIconPath() == "romfs:/images/icons/check-box-outline.png") continue;
|
||||
if (this->menu->GetItems()[i]->GetIconPath() == checked_hdd) continue;
|
||||
else this->selectNsp(i);
|
||||
}
|
||||
this->drawMenuItems(false, currentDir);
|
||||
@ -242,7 +255,7 @@ namespace inst::ui {
|
||||
}
|
||||
|
||||
if (Down & HidNpadButton_Plus) {
|
||||
if (this->selectedTitles.size() == 0 && this->menu->GetItems()[this->menu->GetSelectedIndex()]->GetIconPath() == "romfs:/images/icons/checkbox-blank-outline.png") {
|
||||
if (this->selectedTitles.size() == 0 && this->menu->GetItems()[this->menu->GetSelectedIndex()]->GetIconPath() == unchecked_hdd) {
|
||||
this->selectNsp(this->menu->GetSelectedIndex());
|
||||
}
|
||||
if (this->selectedTitles.size() > 0) this->startInstall();
|
||||
|
@ -23,6 +23,18 @@ namespace inst::ui {
|
||||
int myindex;
|
||||
int installing = 0;
|
||||
|
||||
std::string checked_theme = "romfs:/images/icons/check-box-outline.png";
|
||||
std::string unchecked_theme = "romfs:/images/icons/checkbox-blank-outline.png";
|
||||
|
||||
void checkbox_theme() {
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.checkbox-checked"_theme)) {
|
||||
checked_theme = inst::config::appDir + "icons_others.checkbox-checked"_theme;
|
||||
}
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.checkbox-empty"_theme)) {
|
||||
unchecked_theme = inst::config::appDir + "icons_others.checkbox-empty"_theme;
|
||||
}
|
||||
}
|
||||
|
||||
std::string httplastUrl2 = "http://";
|
||||
std::string lastFileID2 = "";
|
||||
std::string sourceString2 = "";
|
||||
@ -102,33 +114,7 @@ namespace inst::ui {
|
||||
else this->installBar->SetProgressColor(COLOR("#565759FF"));
|
||||
|
||||
this->Add(this->installBar);
|
||||
}
|
||||
|
||||
void ThemeInstPage::drawMenuItems_withext(bool clearItems) {
|
||||
myindex = this->menu->GetSelectedIndex(); //store index so when page redraws we can get the last item we checked.
|
||||
if (clearItems) this->selectedUrls = {};
|
||||
if (clearItems) this->alternativeNames = {};
|
||||
mainApp->ThemeinstPage->installBar->SetProgress(0);
|
||||
mainApp->ThemeinstPage->installBar->SetVisible(false);
|
||||
std::string itm;
|
||||
std::string text_colour = "colour.main_text"_theme;
|
||||
|
||||
this->menu->ClearItems();
|
||||
for (auto& urls : this->ourUrls) {
|
||||
itm = inst::util::shortenString(inst::util::formatUrlString(urls), 56, true);
|
||||
auto ourEntry = pu::ui::elm::MenuItem::New(itm);
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
|
||||
else ourEntry->SetColor(COLOR("#FFFFFFFF"));
|
||||
ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png");
|
||||
long unsigned int i;
|
||||
for (i = 0; i < this->selectedUrls.size(); i++) {
|
||||
if (this->selectedUrls[i] == urls) {
|
||||
ourEntry->SetIcon("romfs:/images/icons/check-box-outline.png");
|
||||
}
|
||||
}
|
||||
this->menu->AddItem(ourEntry);
|
||||
this->menu->SetSelectedIndex(myindex); //jump to the index we saved from above
|
||||
}
|
||||
checkbox_theme();
|
||||
}
|
||||
|
||||
void ThemeInstPage::drawMenuItems(bool clearItems) {
|
||||
@ -151,12 +137,12 @@ namespace inst::ui {
|
||||
auto ourEntry = pu::ui::elm::MenuItem::New(itm);
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
|
||||
else ourEntry->SetColor(COLOR("#FFFFFFFF"));
|
||||
ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png");
|
||||
ourEntry->SetIcon(unchecked_theme);
|
||||
|
||||
long unsigned int i;
|
||||
for (i = 0; i < this->selectedUrls.size(); i++) {
|
||||
if (this->selectedUrls[i] == urls) {
|
||||
ourEntry->SetIcon("romfs:/images/icons/check-box-outline.png");
|
||||
ourEntry->SetIcon(checked_theme);
|
||||
}
|
||||
}
|
||||
this->menu->AddItem(ourEntry);
|
||||
@ -316,7 +302,7 @@ namespace inst::ui {
|
||||
auto s = std::to_string(var);
|
||||
if (s != "0") {
|
||||
myindex = this->menu->GetSelectedIndex(); //store index so when page redraws we can get the last item we checked.
|
||||
if (this->menu->GetItems()[myindex]->GetIconPath() == "romfs:/images/icons/check-box-outline.png") {
|
||||
if (this->menu->GetItems()[myindex]->GetIconPath() == checked_theme) {
|
||||
}
|
||||
this->selectedUrls.push_back(this->ourUrls[myindex]);
|
||||
this->drawMenuItems(false);
|
||||
@ -350,17 +336,16 @@ namespace inst::ui {
|
||||
this->menu->SetSelectedIndex(std::min((s32)this->menu->GetItems().size() - 1, this->menu->GetSelectedIndex() + x));
|
||||
}
|
||||
|
||||
//don't show file extensions
|
||||
//refresh/redraw the items in the list
|
||||
if (Down & HidNpadButton_Left) {
|
||||
if (installing != 1) {
|
||||
this->drawMenuItems(true);
|
||||
}
|
||||
}
|
||||
|
||||
//show file extensions
|
||||
if (Down & HidNpadButton_Right) {
|
||||
if (installing != 1) {
|
||||
this->drawMenuItems_withext(true);
|
||||
this->drawMenuItems(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,17 @@
|
||||
namespace inst::ui {
|
||||
extern MainApplication* mainApp;
|
||||
s32 xxx = 0;
|
||||
std::string checked_net = "romfs:/images/icons/check-box-outline.png";
|
||||
std::string unchecked_net = "romfs:/images/icons/checkbox-blank-outline.png";
|
||||
|
||||
void checkbox_net() {
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.checkbox-checked"_theme)) {
|
||||
checked_net = inst::config::appDir + "icons_others.checkbox-checked"_theme;
|
||||
}
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.checkbox-empty"_theme)) {
|
||||
unchecked_net = inst::config::appDir + "icons_others.checkbox-empty"_theme;
|
||||
}
|
||||
}
|
||||
|
||||
std::string httplastUrl = "http://";
|
||||
std::string lastFileID = "";
|
||||
@ -86,6 +97,7 @@ namespace inst::ui {
|
||||
this->Add(this->pageInfoText);
|
||||
this->Add(this->menu);
|
||||
this->Add(this->infoImage);
|
||||
checkbox_net();
|
||||
}
|
||||
|
||||
void netInstPage::drawMenuItems_withext(bool clearItems) {
|
||||
@ -103,11 +115,11 @@ namespace inst::ui {
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
|
||||
else ourEntry->SetColor(COLOR("#FFFFFFFF"));
|
||||
|
||||
ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png");
|
||||
ourEntry->SetIcon(unchecked_net);
|
||||
long unsigned int i;
|
||||
for (i = 0; i < this->selectedUrls.size(); i++) {
|
||||
if (this->selectedUrls[i] == urls) {
|
||||
ourEntry->SetIcon("romfs:/images/icons/check-box-outline.png");
|
||||
ourEntry->SetIcon(checked_net);
|
||||
}
|
||||
}
|
||||
this->menu->AddItem(ourEntry);
|
||||
@ -155,11 +167,11 @@ namespace inst::ui {
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
|
||||
else ourEntry->SetColor(COLOR("#FFFFFFFF"));
|
||||
|
||||
ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png");
|
||||
ourEntry->SetIcon(unchecked_net);
|
||||
long unsigned int i;
|
||||
for (i = 0; i < this->selectedUrls.size(); i++) {
|
||||
if (this->selectedUrls[i] == urls) {
|
||||
ourEntry->SetIcon("romfs:/images/icons/check-box-outline.png");
|
||||
ourEntry->SetIcon(checked_net);
|
||||
}
|
||||
}
|
||||
this->menu->AddItem(ourEntry);
|
||||
@ -168,7 +180,7 @@ namespace inst::ui {
|
||||
}
|
||||
|
||||
void netInstPage::selectTitle(int selectedIndex) {
|
||||
if (this->menu->GetItems()[selectedIndex]->GetIconPath() == "romfs:/images/icons/check-box-outline.png") {
|
||||
if (this->menu->GetItems()[selectedIndex]->GetIconPath() == checked_net) {
|
||||
for (long unsigned int i = 0; i < this->selectedUrls.size(); i++) {
|
||||
if (this->selectedUrls[i] == this->ourUrls[selectedIndex]) this->selectedUrls.erase(this->selectedUrls.begin() + i);
|
||||
}
|
||||
@ -333,7 +345,7 @@ namespace inst::ui {
|
||||
if (this->selectedUrls.size() == this->menu->GetItems().size()) this->drawMenuItems(true);
|
||||
else {
|
||||
for (long unsigned int i = 0; i < this->menu->GetItems().size(); i++) {
|
||||
if (this->menu->GetItems()[i]->GetIconPath() == "romfs:/images/icons/check-box-outline.png") continue;
|
||||
if (this->menu->GetItems()[i]->GetIconPath() == checked_net) continue;
|
||||
else this->selectTitle(i);
|
||||
}
|
||||
this->drawMenuItems(false);
|
||||
|
@ -16,6 +16,17 @@ namespace inst::ui {
|
||||
extern MainApplication* mainApp;
|
||||
s32 yyy = 0;
|
||||
bool show_ext;
|
||||
std::string checked = "romfs:/images/icons/check-box-outline.png";
|
||||
std::string unchecked = "romfs:/images/icons/checkbox-blank-outline.png";
|
||||
|
||||
void checkbox_sd() {
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.checkbox-checked"_theme)) {
|
||||
checked = inst::config::appDir + "icons_others.checkbox-checked"_theme;
|
||||
}
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.checkbox-empty"_theme)) {
|
||||
unchecked = inst::config::appDir + "icons_others.checkbox-empty"_theme;
|
||||
}
|
||||
}
|
||||
|
||||
sdInstPage::sdInstPage() : Layout::Layout() {
|
||||
std::string default_background = inst::config::appDir + "bg_images.default_background"_theme;
|
||||
@ -75,6 +86,7 @@ namespace inst::ui {
|
||||
this->Add(this->butText);
|
||||
this->Add(this->pageInfoText);
|
||||
this->Add(this->menu);
|
||||
checkbox_sd();
|
||||
}
|
||||
|
||||
void sdInstPage::drawMenuItems(bool clearItems, std::filesystem::path ourPath) {
|
||||
@ -143,11 +155,11 @@ namespace inst::ui {
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
|
||||
else ourEntry->SetColor(COLOR("#FFFFFFFF"));
|
||||
|
||||
ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png");
|
||||
ourEntry->SetIcon(unchecked);
|
||||
|
||||
for (long unsigned int i = 0; i < this->selectedTitles.size(); i++) {
|
||||
if (this->selectedTitles[i] == file) {
|
||||
ourEntry->SetIcon("romfs:/images/icons/check-box-outline.png");
|
||||
ourEntry->SetIcon(checked);
|
||||
}
|
||||
}
|
||||
this->menu->AddItem(ourEntry);
|
||||
@ -177,12 +189,12 @@ namespace inst::ui {
|
||||
int dirListSize = this->ourDirectories.size();
|
||||
dirListSize++;
|
||||
|
||||
if (this->menu->GetItems()[selectedIndex]->GetIconPath() == "romfs:/images/icons/check-box-outline.png") {
|
||||
if (this->menu->GetItems()[selectedIndex]->GetIconPath() == checked) {
|
||||
for (long unsigned int i = 0; i < this->selectedTitles.size(); i++) {
|
||||
if (this->selectedTitles[i] == this->ourFiles[selectedIndex - dirListSize]) this->selectedTitles.erase(this->selectedTitles.begin() + i);
|
||||
}
|
||||
}
|
||||
else if (this->menu->GetItems()[selectedIndex]->GetIconPath() == "romfs:/images/icons/checkbox-blank-outline.png") this->selectedTitles.push_back(this->ourFiles[selectedIndex - dirListSize]);
|
||||
else if (this->menu->GetItems()[selectedIndex]->GetIconPath() == unchecked) this->selectedTitles.push_back(this->ourFiles[selectedIndex - dirListSize]);
|
||||
else {
|
||||
this->followDirectory();
|
||||
return;
|
||||
@ -239,7 +251,7 @@ namespace inst::ui {
|
||||
int topDir = 0;
|
||||
topDir++;
|
||||
for (long unsigned int i = this->ourDirectories.size() + topDir; i < this->menu->GetItems().size(); i++) {
|
||||
if (this->menu->GetItems()[i]->GetIconPath() == "romfs:/images/icons/check-box-outline.png") continue;
|
||||
if (this->menu->GetItems()[i]->GetIconPath() == checked) continue;
|
||||
else this->selectNsp(i);
|
||||
}
|
||||
this->drawMenuItems(false, currentDir);
|
||||
@ -259,7 +271,7 @@ namespace inst::ui {
|
||||
auto s = std::to_string(var);
|
||||
|
||||
if (s != "0") {
|
||||
if (this->selectedTitles.size() == 0 && this->menu->GetItems()[this->menu->GetSelectedIndex()]->GetIconPath() == "romfs:/images/icons/checkbox-blank-outline.png") {
|
||||
if (this->selectedTitles.size() == 0 && this->menu->GetItems()[this->menu->GetSelectedIndex()]->GetIconPath() == unchecked) {
|
||||
this->selectNsp(this->menu->GetSelectedIndex());
|
||||
}
|
||||
if (this->selectedTitles.size() > 0) this->startInstall();
|
||||
|
@ -13,6 +13,18 @@ namespace inst::ui {
|
||||
extern MainApplication* mainApp;
|
||||
s32 www = 0; //touchscreen variable
|
||||
|
||||
std::string checked_usb = "romfs:/images/icons/check-box-outline.png";
|
||||
std::string unchecked_usb = "romfs:/images/icons/checkbox-blank-outline.png";
|
||||
|
||||
void checkbox_usb() {
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.checkbox-checked"_theme)) {
|
||||
checked_usb = inst::config::appDir + "icons_others.checkbox-checked"_theme;
|
||||
}
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.checkbox-empty"_theme)) {
|
||||
unchecked_usb = inst::config::appDir + "icons_others.checkbox-empty"_theme;
|
||||
}
|
||||
}
|
||||
|
||||
usbInstPage::usbInstPage() : Layout::Layout() {
|
||||
std::string infoRect_colour = "colour.inforect"_theme;
|
||||
std::string bg_colour = "colour.background"_theme;
|
||||
@ -78,6 +90,7 @@ namespace inst::ui {
|
||||
this->Add(this->pageInfoText);
|
||||
this->Add(this->menu);
|
||||
this->Add(this->infoImage);
|
||||
checkbox_usb();
|
||||
}
|
||||
|
||||
void usbInstPage::drawMenuItems_withext(bool clearItems) {
|
||||
@ -92,10 +105,10 @@ namespace inst::ui {
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
|
||||
else ourEntry->SetColor(COLOR("#FFFFFFFF"));
|
||||
|
||||
ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png");
|
||||
ourEntry->SetIcon(unchecked_usb);
|
||||
for (long unsigned int i = 0; i < this->selectedTitles.size(); i++) {
|
||||
if (this->selectedTitles[i] == url) {
|
||||
ourEntry->SetIcon("romfs:/images/icons/check-box-outline.png");
|
||||
ourEntry->SetIcon(checked_usb);
|
||||
}
|
||||
}
|
||||
this->menu->AddItem(ourEntry);
|
||||
@ -120,11 +133,11 @@ namespace inst::ui {
|
||||
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
|
||||
else ourEntry->SetColor(COLOR("#FFFFFFFF"));
|
||||
ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png");
|
||||
ourEntry->SetIcon(unchecked_usb);
|
||||
|
||||
for (long unsigned int i = 0; i < this->selectedTitles.size(); i++) {
|
||||
if (this->selectedTitles[i] == url) {
|
||||
ourEntry->SetIcon("romfs:/images/icons/check-box-outline.png");
|
||||
ourEntry->SetIcon(checked_usb);
|
||||
}
|
||||
}
|
||||
this->menu->AddItem(ourEntry);
|
||||
@ -133,7 +146,7 @@ namespace inst::ui {
|
||||
}
|
||||
|
||||
void usbInstPage::selectTitle(int selectedIndex) {
|
||||
if (this->menu->GetItems()[selectedIndex]->GetIconPath() == "romfs:/images/icons/check-box-outline.png") {
|
||||
if (this->menu->GetItems()[selectedIndex]->GetIconPath() == checked_usb) {
|
||||
for (long unsigned int i = 0; i < this->selectedTitles.size(); i++) {
|
||||
if (this->selectedTitles[i] == this->ourTitles[selectedIndex]) this->selectedTitles.erase(this->selectedTitles.begin() + i);
|
||||
}
|
||||
@ -219,7 +232,7 @@ namespace inst::ui {
|
||||
if (this->selectedTitles.size() == this->menu->GetItems().size()) this->drawMenuItems(true);
|
||||
else {
|
||||
for (long unsigned int i = 0; i < this->menu->GetItems().size(); i++) {
|
||||
if (this->menu->GetItems()[i]->GetIconPath() == "romfs:/images/icons/check-box-outline.png") continue;
|
||||
if (this->menu->GetItems()[i]->GetIconPath() == checked_usb) continue;
|
||||
else this->selectTitle(i);
|
||||
}
|
||||
this->drawMenuItems(false);
|
||||
|
@ -65,6 +65,10 @@ namespace usbInstStuff {
|
||||
padConfigureInput(8, HidNpadStyleSet_NpadStandard);
|
||||
PadState pad;
|
||||
padInitializeAny(&pad);
|
||||
std::string info = "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)) {
|
||||
info = inst::config::appDir + "icons_others.information"_theme;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if (bufferData(&header, sizeof(TUSHeader), 500000000) != 0) break;
|
||||
@ -73,7 +77,7 @@ namespace usbInstStuff {
|
||||
u64 kDown = padGetButtonsDown(&pad);
|
||||
|
||||
if (kDown & HidNpadButton_B) return {};
|
||||
if (kDown & HidNpadButton_X) inst::ui::mainApp->CreateShowDialog("inst.usb.help.title"_lang, "inst.usb.help.desc"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/information.png");
|
||||
if (kDown & HidNpadButton_X) inst::ui::mainApp->CreateShowDialog("inst.usb.help.title"_lang, "inst.usb.help.desc"_lang, { "common.ok"_lang }, true, info);
|
||||
if (inst::util::getUsbState() != 5) return {};
|
||||
}
|
||||
|
||||
@ -102,6 +106,15 @@ namespace usbInstStuff {
|
||||
bool nspInstalled = true;
|
||||
NcmStorageId m_destStorageId = NcmStorageId_SdCard;
|
||||
|
||||
std::string good = "romfs:/images/icons/good.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.good"_theme)) {
|
||||
good = inst::config::appDir + "icons_others.good"_theme;
|
||||
}
|
||||
std::string fail = "romfs:/images/icons/fail.png";
|
||||
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
|
||||
fail = inst::config::appDir + "icons_others.fail"_theme;
|
||||
}
|
||||
|
||||
if (ourStorage) m_destStorageId = NcmStorageId_BuiltInUser;
|
||||
unsigned int fileItr;
|
||||
|
||||
@ -165,7 +178,7 @@ namespace usbInstStuff {
|
||||
audioThread.join();
|
||||
}
|
||||
|
||||
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, "romfs:/images/icons/fail.png");
|
||||
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, fail);
|
||||
nspInstalled = false;
|
||||
}
|
||||
|
||||
@ -193,8 +206,8 @@ namespace usbInstStuff {
|
||||
audioThread.join();
|
||||
}
|
||||
|
||||
if (ourTitleList.size() > 1) inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, "romfs:/images/icons/good.png");
|
||||
else inst::ui::mainApp->CreateShowDialog(fileNames[0] + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, "romfs:/images/icons/good.png");
|
||||
if (ourTitleList.size() > 1) inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, good);
|
||||
else inst::ui::mainApp->CreateShowDialog(fileNames[0] + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true, good);
|
||||
}
|
||||
|
||||
LOG_DEBUG("Done");
|
||||
|
Loading…
x
Reference in New Issue
Block a user