From addf739e96f027ae1e781944d949b5c932bf45df Mon Sep 17 00:00:00 2001 From: mrdude2478 Date: Thu, 5 May 2022 16:43:16 +0100 Subject: [PATCH] php options added to config page --- include/util/config.hpp | 1 + romfs/lang/de.json | 1 + romfs/lang/en.json | 1 + romfs/lang/fr.json | 1 + romfs/lang/it.json | 1 + romfs/lang/jp.json | 1 + romfs/lang/ru.json | 1 + romfs/lang/zh-rTW.json | 5 +++-- source/netInstall.cpp | 10 ++++++++-- source/ui/optionsPage.cpp | 28 +++++++++++++++++++++++----- source/util/config.cpp | 6 +++++- 11 files changed, 46 insertions(+), 10 deletions(-) diff --git a/include/util/config.hpp b/include/util/config.hpp index c6074fb..953c4c8 100644 --- a/include/util/config.hpp +++ b/include/util/config.hpp @@ -21,6 +21,7 @@ namespace inst::config { extern bool usbAck; extern bool gayMode; extern bool useSound; + extern bool useoldphp; void setConfig(); void parseConfig(); diff --git a/romfs/lang/de.json b/romfs/lang/de.json index 9058008..ae230ed 100644 --- a/romfs/lang/de.json +++ b/romfs/lang/de.json @@ -172,6 +172,7 @@ "auto_update": "Suche automatisch nach Updates für TinWoo", "gay_option": "Design verwenden", "useSound": "Nutzen von Benachrichtungstönen während Installation", + "useoldphp": "Use old php files for http server installs", "sig_url": "Signatur Patches URL: ", "language": "Sprache: ", "check_update": "Suche nach Updates für TinWoo Installer", diff --git a/romfs/lang/en.json b/romfs/lang/en.json index a2750d7..bcc100b 100644 --- a/romfs/lang/en.json +++ b/romfs/lang/en.json @@ -172,6 +172,7 @@ "auto_update": "Check for updates to TinWoo Installer automatically", "gay_option": "Use Theme", "useSound": "Use sound notifications during installs", + "useoldphp": "Use old php files for http server installs", "sig_url": "Signature patches source URL: ", "language": "Language: ", "check_update": "Check for updates to TinWoo Installer", diff --git a/romfs/lang/fr.json b/romfs/lang/fr.json index 671dc9f..388b2f6 100644 --- a/romfs/lang/fr.json +++ b/romfs/lang/fr.json @@ -172,6 +172,7 @@ "auto_update": "Vérifier les mises à jour de l'installateur TinWoo automatiquement", "gay_option": "Utiliser le thème", "useSound": "Use sound notifications during installs", + "useoldphp": "Use old php files for http server installs", "sig_url": "Patchs de signatures URL: ", "language": "Langage: ", "check_update": "Vérifiez les mises à jour de l'installateur TinWoo", diff --git a/romfs/lang/it.json b/romfs/lang/it.json index 617d76a..967e742 100644 --- a/romfs/lang/it.json +++ b/romfs/lang/it.json @@ -172,6 +172,7 @@ "auto_update": "Controlla aggiornamenti di TinWoo Installer automaticamente", "gay_option": "Usa tema", "useSound": "Use sound notifications during installs", + "useoldphp": "Use old php files for http server installs", "sig_url": "Fonte URL SigPatches: ", "language": "Lingua: ", "check_update": "Controlla aggiornamenti di TinWoo Installer ora", diff --git a/romfs/lang/jp.json b/romfs/lang/jp.json index 35cccf3..b1b935d 100644 --- a/romfs/lang/jp.json +++ b/romfs/lang/jp.json @@ -172,6 +172,7 @@ "auto_update": "TinWooのアップデートを自動的に確認する", "gay_option": "テーマを使用する", "useSound": "インストール時にサウンドで通知する", + "useoldphp": "Use old php files for http server installs", "sig_url": "署名パッチのソースURL: ", "language": "言語: ", "check_update": "TinWoo Installerのアップデートを確認", diff --git a/romfs/lang/ru.json b/romfs/lang/ru.json index 5a2609e..2837b31 100644 --- a/romfs/lang/ru.json +++ b/romfs/lang/ru.json @@ -172,6 +172,7 @@ "auto_update": "Автоматически проверять наличие обновлений", "gay_option": "Использовать тему", "useSound": "Use sound notifications during installs", + "useoldphp": "Use old php files for http server installs", "sig_url": "URL для скачивания Signature patches: ", "language": "Язык: ", "check_update": "Проверить наличие обновлений TinWoo Installer", diff --git a/romfs/lang/zh-rTW.json b/romfs/lang/zh-rTW.json index 6f9f469..89ce28a 100644 --- a/romfs/lang/zh-rTW.json +++ b/romfs/lang/zh-rTW.json @@ -170,8 +170,9 @@ "boost_mode": "在進行安裝時啟用\"超頻\"模式", "ask_delete": "在安裝完成後,詢問是否刪除原始檔案", "auto_update": "自動檢查Tinwoo Installer的更新版本", - "gay_option": "套用主題", - "useSound": "在安裝過程中使用音效提醒進度", + "gay_option": "套用主題", + "useSound": "在安裝過程中使用音效提醒進度", + "useoldphp": "Use old php files for http server installs", "sig_url": "簽名修補程式來源URL: ", "language": "介面語系: ", "check_update": "檢查Tinwoo Installer的更新版本", diff --git a/source/netInstall.cpp b/source/netInstall.cpp index 6be4ee2..f9884a0 100644 --- a/source/netInstall.cpp +++ b/source/netInstall.cpp @@ -334,8 +334,14 @@ namespace netInstStuff{ while (index < response.size()) { if (response[index] == '"') { if (link.find("../") == std::string::npos) - if (link.find(".nsp") != std::string::npos || link.find(".nsz") != std::string::npos || link.find(".xci") != std::string::npos || link.find(".xcz") != std::string::npos) - urls.push_back(link); + if (link.find(".nsp") != std::string::npos || link.find(".nsz") != std::string::npos || link.find(".xci") != std::string::npos || link.find(".xcz") != std::string::npos){ + if (inst::config::useoldphp) { + urls.push_back(url + link); + } + else { + urls.push_back(link); + } + } break; } link += response[index++]; diff --git a/source/ui/optionsPage.cpp b/source/ui/optionsPage.cpp index 761b15a..e579e46 100644 --- a/source/ui/optionsPage.cpp +++ b/source/ui/optionsPage.cpp @@ -143,6 +143,11 @@ namespace inst::ui { useSoundOption->SetIcon(this->getMenuOptionIcon(inst::config::useSound)); this->menu->AddItem(useSoundOption); + auto useoldphp = pu::ui::elm::MenuItem::New("options.menu_items.useoldphp"_lang); + useoldphp->SetColor(COLOR("#FFFFFFFF")); + useoldphp->SetIcon(this->getMenuOptionIcon(inst::config::useoldphp)); + this->menu->AddItem(useoldphp); + auto SigPatch = pu::ui::elm::MenuItem::New("main.menu.sig"_lang); SigPatch->SetColor(COLOR("#FFFFFFFF")); this->menu->AddItem(SigPatch); @@ -250,11 +255,24 @@ namespace inst::ui { this->menu->SetSelectedIndex(index); inst::config::setConfig(); break; + + case 7: + if (inst::config::useoldphp) { + inst::config::useoldphp = false; + } + else { + inst::config::useoldphp = true; + } + this->setMenuText(); + this->menu->SetSelectedIndex(index); + inst::config::setConfig(); + break; - case 7: + case 8: sigPatchesMenuItem_Click(); break; - case 8: + + case 9: keyboardResult = inst::util::softwareKeyboard("options.sig_hint"_lang, inst::config::sigPatchesUrl.c_str(), 500); if (keyboardResult.size() > 0) { inst::config::sigPatchesUrl = keyboardResult; @@ -263,7 +281,7 @@ namespace inst::ui { this->menu->SetSelectedIndex(index); } break; - case 9: + case 10: languageList = languageStrings; languageList.push_back("options.language.system_language"_lang); rc = inst::ui::mainApp->CreateShowDialog("options.language.title"_lang, "options.language.desc"_lang, languageList, false); @@ -297,7 +315,7 @@ namespace inst::ui { mainApp->FadeOut(); mainApp->Close(); break; - case 10: + case 11: if (inst::util::getIPAddress() == "1.0.0.127") { inst::ui::mainApp->CreateShowDialog("main.net.title"_lang, "main.net.desc"_lang, {"common.ok"_lang}, true); break; @@ -309,7 +327,7 @@ namespace inst::ui { } this->askToUpdate(downloadUrl); break; - case 11: + case 12: inst::ui::mainApp->CreateShowDialog("options.credits.title"_lang, "options.credits.desc"_lang, {"common.close"_lang}, true); break; default: diff --git a/source/util/config.cpp b/source/util/config.cpp index d273c23..0987686 100644 --- a/source/util/config.cpp +++ b/source/util/config.cpp @@ -18,6 +18,7 @@ namespace inst::config { bool useSound; bool usbAck; bool validateNCAs; + bool useoldphp; void setConfig() { nlohmann::json j = { @@ -33,7 +34,8 @@ namespace inst::config { {"usbAck", usbAck}, {"validateNCAs", validateNCAs}, {"httpIndexUrl", httpIndexUrl}, - {"httplastUrl", httplastUrl} + {"httplastUrl", httplastUrl}, + {"httpoldphp", useoldphp} }; std::ofstream file(inst::config::configPath); file << std::setw(4) << j << std::endl; @@ -45,6 +47,7 @@ namespace inst::config { nlohmann::json j; file >> j; autoUpdate = j["autoUpdate"].get(); + useoldphp = j["httpoldphp"].get(); deletePrompt = j["deletePrompt"].get(); gAuthKey = j["gAuthKey"].get(); gayMode = j["gayMode"].get(); @@ -69,6 +72,7 @@ namespace inst::config { deletePrompt = true; gayMode = false; useSound = false; + useoldphp = false; ignoreReqVers = true; overClock = false; usbAck = false;