diff --git a/Makefile b/Makefile index cbd96a4..ea72f73 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DATA := data INCLUDES := include lib/zipper/include APP_TITLE := All-in-One Switch Updater APP_AUTHOR := HamletDuFromage -APP_VERSION := 2.1.2 +APP_VERSION := 2.2.0 TARGET := $(notdir $(CURDIR)) ROMFS := resources diff --git a/include/JC_color_swapper.hpp b/include/JC_color_swapper.hpp index b6d68ab..c81e721 100644 --- a/include/JC_color_swapper.hpp +++ b/include/JC_color_swapper.hpp @@ -1,16 +1,5 @@ #pragma once -#include -#include -#include -#include -#include -#include - -#include -#include "constants.hpp" -#include "progress_event.hpp" -#include "utils.hpp" #include "json.hpp" int hexToBGR(std::string hex); diff --git a/include/JC_page.hpp b/include/JC_page.hpp index ffc716a..00dee94 100644 --- a/include/JC_page.hpp +++ b/include/JC_page.hpp @@ -1,8 +1,6 @@ #pragma once -#include "JC_color_swapper.hpp" -#include "confirm_page.hpp" -#include "worker_page.hpp" +#include class JCPage : public brls::AppletFrame { diff --git a/include/PC_color_swapper.hpp b/include/PC_color_swapper.hpp index dfc9d03..257d953 100644 --- a/include/PC_color_swapper.hpp +++ b/include/PC_color_swapper.hpp @@ -1,16 +1,5 @@ #pragma once -#include -#include -#include -#include -#include -#include - -#include -#include "constants.hpp" -#include "progress_event.hpp" -#include "utils.hpp" #include "json.hpp" namespace pc{ diff --git a/include/PC_page.hpp b/include/PC_page.hpp index 587674e..dabb5a6 100644 --- a/include/PC_page.hpp +++ b/include/PC_page.hpp @@ -1,8 +1,6 @@ #pragma once -#include "PC_color_swapper.hpp" -#include "confirm_page.hpp" -#include "worker_page.hpp" +#include class PCPage : public brls::AppletFrame { diff --git a/include/ams_tab.hpp b/include/ams_tab.hpp index 12f61ec..db3c963 100644 --- a/include/ams_tab.hpp +++ b/include/ams_tab.hpp @@ -1,12 +1,6 @@ #pragma once #include -#include -#include "download.hpp" -#include "extract.hpp" -#include "confirm_page.hpp" -#include "dialogue_page.hpp" -#include "worker_page.hpp" class AmsTab : public brls::List { diff --git a/include/app_page.hpp b/include/app_page.hpp index 6fbc9c5..446d4f3 100644 --- a/include/app_page.hpp +++ b/include/app_page.hpp @@ -1,15 +1,8 @@ #pragma once #include -#include -#include "utils.hpp" -#include -#include #include - -#include "worker_page.hpp" -#include "confirm_page.hpp" -#include "download_cheats_page.hpp" +#include typedef struct app App; diff --git a/include/cheats_page.hpp b/include/cheats_page.hpp index 49416eb..5dcb2cc 100644 --- a/include/cheats_page.hpp +++ b/include/cheats_page.hpp @@ -1,8 +1,6 @@ #pragma once #include -#include "app_page.hpp" -#include "exclude_page.hpp" class CheatsPage : public brls::AppletFrame { diff --git a/include/confirm_page.hpp b/include/confirm_page.hpp index 5276c4a..ef7dbe7 100644 --- a/include/confirm_page.hpp +++ b/include/confirm_page.hpp @@ -2,11 +2,6 @@ #include #include -#include - -#include "utils.hpp" -#include "main_frame.hpp" -#include "reboot_payload.h" class ConfirmPage : public brls::View { diff --git a/include/current_cfw.hpp b/include/current_cfw.hpp new file mode 100644 index 0000000..7b1db7b --- /dev/null +++ b/include/current_cfw.hpp @@ -0,0 +1,7 @@ +#pragma once + +#include "constants.hpp" + +bool isServiceRunning(const char *serviceName); +CFW getCFW(); +static CFW running_cfw = ams; \ No newline at end of file diff --git a/include/dialogue_page.hpp b/include/dialogue_page.hpp index 818eddb..4fa75ff 100644 --- a/include/dialogue_page.hpp +++ b/include/dialogue_page.hpp @@ -2,10 +2,6 @@ #include -#include -#include "reboot_payload.h" - - class DialoguePage : public brls::View { private: diff --git a/include/download.hpp b/include/download.hpp index 4a28a2e..7f890b2 100644 --- a/include/download.hpp +++ b/include/download.hpp @@ -3,15 +3,6 @@ #define ON 1 #define OFF 0 -#include -#include -#include - -#include -#include -#include - -#include "progress_event.hpp" #include "json.hpp" void downloadFile(const char *url, const char *output, int api); diff --git a/include/download_cheats_page.hpp b/include/download_cheats_page.hpp index bc94dc4..c30964e 100644 --- a/include/download_cheats_page.hpp +++ b/include/download_cheats_page.hpp @@ -2,8 +2,6 @@ #include #include -#include "download.hpp" -#include "utils.hpp" #include "json.hpp" class DownloadCheatsPage : public brls::AppletFrame diff --git a/include/download_payload_page.hpp b/include/download_payload_page.hpp index 0976164..7f14876 100644 --- a/include/download_payload_page.hpp +++ b/include/download_payload_page.hpp @@ -1,8 +1,6 @@ #pragma once -#include "utils.hpp" -#include "confirm_page.hpp" -#include "worker_page.hpp" +#include class DownloadPayloadPage : public brls::AppletFrame { diff --git a/include/exclude_page.hpp b/include/exclude_page.hpp index b68b06d..70e6fae 100644 --- a/include/exclude_page.hpp +++ b/include/exclude_page.hpp @@ -1,14 +1,8 @@ #pragma once #include -#include -#include "utils.hpp" -#include -#include -#include #include -#include -#include +#include typedef struct app App; diff --git a/include/extract.hpp b/include/extract.hpp index 50a3d5d..9ea9dd5 100644 --- a/include/extract.hpp +++ b/include/extract.hpp @@ -1,22 +1,10 @@ #pragma once +#include "constants.hpp" +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "progress_event.hpp" -#include "constants.hpp" static constexpr u32 MaxTitleCount = 64000; diff --git a/include/hide_tabs_page.hpp b/include/hide_tabs_page.hpp index 8264e9c..a9edc06 100644 --- a/include/hide_tabs_page.hpp +++ b/include/hide_tabs_page.hpp @@ -1,9 +1,6 @@ #pragma once #include -#include "json.hpp" -#include "constants.hpp" -#include class HideTabsPage : public brls::AppletFrame { diff --git a/include/language_option_page.hpp b/include/language_option_page.hpp deleted file mode 100644 index f04e379..0000000 --- a/include/language_option_page.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include -#include "app_page.hpp" -#include "exclude_page.hpp" - -class LanguageOptionPage : public brls::AppletFrame -{ - private: - brls::List* list; - brls::ListItem* English; - brls::ListItem* Chinese; - brls::ListItem* French; - - brls::StagedAppletFrame* stagedFrame; - - public: - LanguageOptionPage(); -}; \ No newline at end of file diff --git a/include/list_download_tab.hpp b/include/list_download_tab.hpp index 357e8c7..318102f 100644 --- a/include/list_download_tab.hpp +++ b/include/list_download_tab.hpp @@ -1,11 +1,7 @@ #pragma once #include -#include -#include "download.hpp" -#include "extract.hpp" -#include "confirm_page.hpp" -#include "worker_page.hpp" +#include "constants.hpp" class ListDownloadTab : public brls::List { diff --git a/include/main_frame.hpp b/include/main_frame.hpp index e4367c1..8bf9b23 100644 --- a/include/main_frame.hpp +++ b/include/main_frame.hpp @@ -2,12 +2,6 @@ #include -#include "about_tab.hpp" -#include "list_download_tab.hpp" -#include "ams_tab.hpp" -#include "tools_tab.hpp" -#include "json.hpp" - class MainFrame : public brls::TabFrame { private: diff --git a/include/net_page.hpp b/include/net_page.hpp index f74b9b5..cb0323e 100644 --- a/include/net_page.hpp +++ b/include/net_page.hpp @@ -1,14 +1,6 @@ #pragma once #include -#include -#include -#include "constants.hpp" -#include "main_frame.hpp" -#include -#include -#include -#include #define AF_INET 2 @@ -22,7 +14,7 @@ class NetPage : public brls::AppletFrame public: NetPage(); - std::string ipToString(u8* ip); - int stringToIp(std::string ip, u8* out); + std::string ipToString(unsigned char* ip); + int stringToIp(std::string ip, unsigned char* out); }; \ No newline at end of file diff --git a/include/payload_page.hpp b/include/payload_page.hpp index ab73337..d2b87fb 100644 --- a/include/payload_page.hpp +++ b/include/payload_page.hpp @@ -1,7 +1,6 @@ #pragma once -#include "utils.hpp" -#include "reboot_payload.h" +#include class PayloadPage : public brls::AppletFrame { diff --git a/include/tools_tab.hpp b/include/tools_tab.hpp index 8817549..efaf9e5 100644 --- a/include/tools_tab.hpp +++ b/include/tools_tab.hpp @@ -1,19 +1,6 @@ #pragma once #include -#include "confirm_page.hpp" -#include "worker_page.hpp" -#include "cheats_page.hpp" -#include "payload_page.hpp" -#include "download_payload_page.hpp" -#include "changelog_page.hpp" -#include "language_option_page.hpp" -#include "JC_page.hpp" -#include "PC_page.hpp" -#include "net_page.hpp" -#include "extract.hpp" -#include "utils.hpp" -#include "hide_tabs_page.hpp" //#include "ntcp.hpp" class ToolsTab : public brls::List diff --git a/include/utils.hpp b/include/utils.hpp index aa97482..24bbccc 100644 --- a/include/utils.hpp +++ b/include/utils.hpp @@ -3,12 +3,9 @@ #include #include #include -#include "download.hpp" -#include "extract.hpp" #include "constants.hpp" -#include "progress_event.hpp" -#include "json.hpp" -#include "main_frame.hpp" +#include + typedef char NsApplicationName[0x201]; typedef uint8_t NsApplicationIcon[0x20000]; @@ -21,8 +18,6 @@ struct app brls::ListItem* listItem; }; -CFW getCFW(); -bool isServiceRunning(const char *serviceName); std::vector htmlProcess(std::string s, std::regex rgx); void createTree(std::string path); void clearConsole(); diff --git a/include/worker_page.hpp b/include/worker_page.hpp index 1c9687c..3779292 100644 --- a/include/worker_page.hpp +++ b/include/worker_page.hpp @@ -2,14 +2,7 @@ #include #include -#include -#include -#include "utils.hpp" -#include "download.hpp" -#include "extract.hpp" -#include "constants.hpp" -#include "progress_event.hpp" typedef std::function worker_func_t; diff --git a/source/JC_color_swapper.cpp b/source/JC_color_swapper.cpp index e63e777..3ccf8fb 100644 --- a/source/JC_color_swapper.cpp +++ b/source/JC_color_swapper.cpp @@ -1,4 +1,14 @@ #include "JC_color_swapper.hpp" +#include +#include +#include +#include +#include +#include + +#include "constants.hpp" +#include "progress_event.hpp" +#include "utils.hpp" using json = nlohmann::json; diff --git a/source/JC_page.cpp b/source/JC_page.cpp index fa12cb5..9d76a45 100644 --- a/source/JC_page.cpp +++ b/source/JC_page.cpp @@ -1,4 +1,8 @@ #include "JC_page.hpp" +#include "JC_color_swapper.hpp" +#include "confirm_page.hpp" +#include "worker_page.hpp" +#include "constants.hpp" namespace i18n = brls::i18n; using namespace i18n::literals; diff --git a/source/PC_color_swapper.cpp b/source/PC_color_swapper.cpp index e3545bb..10cd5e7 100644 --- a/source/PC_color_swapper.cpp +++ b/source/PC_color_swapper.cpp @@ -1,4 +1,15 @@ #include "PC_color_swapper.hpp" +#include +#include +#include +#include +#include +#include + +#include +#include "constants.hpp" +#include "progress_event.hpp" +#include "utils.hpp" using json = nlohmann::json; diff --git a/source/PC_page.cpp b/source/PC_page.cpp index 8074b06..e7c876b 100644 --- a/source/PC_page.cpp +++ b/source/PC_page.cpp @@ -1,4 +1,8 @@ #include "PC_page.hpp" +#include "PC_color_swapper.hpp" +#include "confirm_page.hpp" +#include "worker_page.hpp" +#include "constants.hpp" namespace i18n = brls::i18n; using namespace i18n::literals; diff --git a/source/ams_tab.cpp b/source/ams_tab.cpp index d2beb7c..3b61b63 100644 --- a/source/ams_tab.cpp +++ b/source/ams_tab.cpp @@ -1,4 +1,11 @@ #include "ams_tab.hpp" +#include +#include "download.hpp" +#include "extract.hpp" +#include "confirm_page.hpp" +#include "dialogue_page.hpp" +#include "worker_page.hpp" +#include "utils.hpp" namespace i18n = brls::i18n; using namespace i18n::literals; diff --git a/source/app_page.cpp b/source/app_page.cpp index 50570db..4dc73ef 100644 --- a/source/app_page.cpp +++ b/source/app_page.cpp @@ -1,4 +1,12 @@ #include "app_page.hpp" +#include +#include "utils.hpp" +#include +#include +#include "current_cfw.hpp" +#include "worker_page.hpp" +#include "confirm_page.hpp" +#include "download_cheats_page.hpp" namespace i18n = brls::i18n; using namespace i18n::literals; @@ -61,7 +69,7 @@ AppPage::AppPage(bool cheatSlips) : AppletFrame(true, true) } std::string text("menus/text_download"_i18n); std::string url = ""; - switch(getCFW()){ + switch(running_cfw){ case ams: url += CHEATS_URL_CONTENTS; break; diff --git a/source/cheats_page.cpp b/source/cheats_page.cpp index 9259049..9c3a7d5 100644 --- a/source/cheats_page.cpp +++ b/source/cheats_page.cpp @@ -1,4 +1,10 @@ #include "cheats_page.hpp" +#include "app_page.hpp" +#include "exclude_page.hpp" +#include "worker_page.hpp" +#include "confirm_page.hpp" +#include "current_cfw.hpp" +#include "extract.hpp" namespace i18n = brls::i18n; using namespace i18n::literals; @@ -25,7 +31,7 @@ CheatsPage::CheatsPage() : AppletFrame(true, true) stagedFrame = new brls::StagedAppletFrame(); stagedFrame->setTitle("menus/cheat_delete_all_cheat"_i18n ); stagedFrame->addStage( - new WorkerPage(stagedFrame, "menus/cheat_Deleting"_i18n , [](){removeCheats(getCFW());}) + new WorkerPage(stagedFrame, "menus/cheat_Deleting"_i18n , [](){removeCheats(running_cfw);}) ); stagedFrame->addStage( new ConfirmPage(stagedFrame, "menus/cheat_All_done"_i18n , true) diff --git a/source/confirm_page.cpp b/source/confirm_page.cpp index 2f38aed..49ef455 100644 --- a/source/confirm_page.cpp +++ b/source/confirm_page.cpp @@ -1,4 +1,8 @@ #include "confirm_page.hpp" +#include "utils.hpp" +#include "main_frame.hpp" +#include "reboot_payload.h" +#include namespace i18n = brls::i18n; using namespace i18n::literals; diff --git a/source/current_cfw.cpp b/source/current_cfw.cpp new file mode 100644 index 0000000..6e9f334 --- /dev/null +++ b/source/current_cfw.cpp @@ -0,0 +1,19 @@ +#include "current_cfw.hpp" +#include + +bool isServiceRunning(const char *serviceName) { + Handle handle; + SmServiceName service_name = smEncodeName(serviceName); + bool running = R_FAILED(smRegisterService(&handle, service_name, false, 1)); + svcCloseHandle(handle); + if (!running) + smUnregisterService(service_name); + + return running; +}; + +CFW getCFW(){ + if(isServiceRunning("rnx")) return rnx; + else if(isServiceRunning("tx")) return sxos; + else return ams; +}; \ No newline at end of file diff --git a/source/dialogue_page.cpp b/source/dialogue_page.cpp index 690ea78..d7bc565 100644 --- a/source/dialogue_page.cpp +++ b/source/dialogue_page.cpp @@ -1,4 +1,7 @@ #include "dialogue_page.hpp" +#include "utils.hpp" +#include "reboot_payload.h" +#include "main_frame.hpp" namespace i18n = brls::i18n; using namespace i18n::literals; diff --git a/source/download.cpp b/source/download.cpp index 0751333..80631ae 100644 --- a/source/download.cpp +++ b/source/download.cpp @@ -1,6 +1,15 @@ #include "download.hpp" #include "utils.hpp" #include +#include +#include +#include + +#include +#include +#include + +#include "progress_event.hpp" #define API_AGENT "HamletDuFromage" #define _1MiB 0x100000 diff --git a/source/download_cheats_page.cpp b/source/download_cheats_page.cpp index 4e2dc12..d15b4d6 100644 --- a/source/download_cheats_page.cpp +++ b/source/download_cheats_page.cpp @@ -1,5 +1,10 @@ #include "download_cheats_page.hpp" #include "constants.hpp" +#include "download.hpp" +#include "utils.hpp" +#include "current_cfw.hpp" +#include +#include namespace i18n = brls::i18n; using namespace i18n::literals; @@ -151,7 +156,7 @@ std::string DownloadCheatsPage::GetCheatsTitle(json cheat) { void DownloadCheatsPage::WriteCheats(uint64_t tid, std::string bid, std::string cheatContent) { std::string path; std::string tidstr = formatApplicationId(tid); - switch(getCFW()){ + switch(running_cfw){ case ams: path = std::string(AMS_PATH) + std::string(CONTENTS_PATH); break; @@ -175,7 +180,7 @@ void DownloadCheatsPage::WriteCheats(uint64_t tid, std::string bid, std::string void DownloadCheatsPage::DeleteCheats(uint64_t tid, std::string bid) { std::string path; - switch(getCFW()){ + switch(running_cfw){ case ams: path = std::string(AMS_PATH) + std::string(CONTENTS_PATH); break; diff --git a/source/download_payload_page.cpp b/source/download_payload_page.cpp index 3cab531..118e6e8 100644 --- a/source/download_payload_page.cpp +++ b/source/download_payload_page.cpp @@ -1,4 +1,8 @@ #include "download_payload_page.hpp" +#include "utils.hpp" +#include "confirm_page.hpp" +#include "worker_page.hpp" +#include "download.hpp" namespace i18n = brls::i18n; using namespace i18n::literals; diff --git a/source/exclude_page.cpp b/source/exclude_page.cpp index a49c7e0..01af0f3 100644 --- a/source/exclude_page.cpp +++ b/source/exclude_page.cpp @@ -1,4 +1,10 @@ #include "exclude_page.hpp" +#include +#include "utils.hpp" +#include "extract.hpp" +#include +#include +#include namespace i18n = brls::i18n; using namespace i18n::literals; diff --git a/source/extract.cpp b/source/extract.cpp index 845f541..463ce11 100644 --- a/source/extract.cpp +++ b/source/extract.cpp @@ -1,6 +1,19 @@ #include "extract.hpp" #include "utils.hpp" #include "download.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "progress_event.hpp" +#include "current_cfw.hpp" namespace i18n = brls::i18n; using namespace i18n::literals; diff --git a/source/hide_tabs_page.cpp b/source/hide_tabs_page.cpp index ae47b0a..e10b63a 100644 --- a/source/hide_tabs_page.cpp +++ b/source/hide_tabs_page.cpp @@ -1,4 +1,7 @@ #include "hide_tabs_page.hpp" +#include "json.hpp" +#include "constants.hpp" +#include namespace i18n = brls::i18n; using namespace i18n::literals; diff --git a/source/language_option_page.cpp b/source/language_option_page.cpp deleted file mode 100644 index 9d0f07b..0000000 --- a/source/language_option_page.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "language_option_page.hpp" - -#include -namespace i18n = brls::i18n; -using namespace i18n::literals; - -//this page is for language page - -LanguageOptionPage::LanguageOptionPage() : AppletFrame(true, true) -{ - /* this->setTitle("menus/Language_Option"_i18n ); - list = new brls::List(); - - English = new brls::ListItem("English"); - English->getClickEvent()->subscribe([&](brls::View* view){ - - nlohmann::json json_file; - json_file["language"]=(int)lang::Language::English; - std::ofstream o(APP_LANG); - o<addStage( - new ConfirmPage(stagedFrame, "menus/reset_machine"_i18n , true) - ); - brls::Application::pushView(stagedFrame); - - }); - list->addView(English); - Chinese = new brls::ListItem("中文"); - Chinese->getClickEvent()->subscribe([&](brls::View* view){ - nlohmann::json json_file; - json_file["language"]=(int)lang::Language::Chinese; - std::ofstream o(APP_LANG); - o<addStage( - new ConfirmPage(stagedFrame, "menus/reset_machine"_i18n , true) - ); - brls::Application::pushView(stagedFrame); - }); - list->addView(Chinese); - - French = new brls::ListItem("Français"); - French->getClickEvent()->subscribe([&](brls::View* view){ - nlohmann::json json_file; - json_file["language"]=(int)lang::Language::French; - std::ofstream o(APP_LANG); - o<addStage( - new ConfirmPage(stagedFrame, "menus/reset_machine"_i18n , true) - ); - brls::Application::pushView(stagedFrame); - }); - list->addView(French); - this->setContentView(list); */ -} \ No newline at end of file diff --git a/source/list_download_tab.cpp b/source/list_download_tab.cpp index d7aceae..85662be 100644 --- a/source/list_download_tab.cpp +++ b/source/list_download_tab.cpp @@ -1,4 +1,14 @@ #include "list_download_tab.hpp" +#include +#include "download.hpp" +#include "extract.hpp" +#include "confirm_page.hpp" +#include "worker_page.hpp" +#include "current_cfw.hpp" +#include "utils.hpp" +#include "app_page.hpp" +#include +#include namespace i18n = brls::i18n; using namespace i18n::literals; @@ -47,7 +57,7 @@ ListDownloadTab::ListDownloadTab(archiveType type) : case cheats: std::string cheatsVer = fetchTitle(CHEATS_RELEASE_URL); if(cheatsVer != "-1"){ - switch(getCFW()){ + switch(running_cfw){ case sxos: links.push_back(std::make_pair("menus/list_latest_ver"_i18n + cheatsVer + ")", CHEATS_URL_TITLES)); break; diff --git a/source/main.cpp b/source/main.cpp index 057c8ba..02e4d25 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -2,9 +2,7 @@ //#include #include #include - #include - #include "main_frame.hpp" #include "constants.hpp" #include "utils.hpp" diff --git a/source/main_frame.cpp b/source/main_frame.cpp index 5318ffa..51ee794 100644 --- a/source/main_frame.cpp +++ b/source/main_frame.cpp @@ -1,4 +1,12 @@ #include "main_frame.hpp" +#include "current_cfw.hpp" +#include "about_tab.hpp" +#include "list_download_tab.hpp" +#include "ams_tab.hpp" +#include "tools_tab.hpp" +#include "json.hpp" +#include +#include "utils.hpp" namespace i18n = brls::i18n; using namespace i18n::literals; @@ -15,6 +23,8 @@ MainFrame::MainFrame() : TabFrame() else this->setFooterText("v" + std::string(APP_VERSION)); + static CFW running_cfw = getCFW(); + json hideStatus; std::ifstream hideFile(HIDE_TABS_JSON); diff --git a/source/net_page.cpp b/source/net_page.cpp index 731928b..9f40ef5 100644 --- a/source/net_page.cpp +++ b/source/net_page.cpp @@ -1,5 +1,13 @@ #include "net_page.hpp" #include +#include +#include +#include "constants.hpp" +#include "main_frame.hpp" +#include +#include +#include +#include namespace i18n = brls::i18n; using namespace i18n::literals; diff --git a/source/payload_page.cpp b/source/payload_page.cpp index 197f091..8d39ade 100644 --- a/source/payload_page.cpp +++ b/source/payload_page.cpp @@ -1,10 +1,13 @@ #include "payload_page.hpp" +#include "utils.hpp" +#include "reboot_payload.h" +#include "current_cfw.hpp" +#include "utils.hpp" namespace i18n = brls::i18n; using namespace i18n::literals; PayloadPage::PayloadPage() : AppletFrame(true, true) { - CFW cfw = getCFW(); this->setTitle("menus/payload_reboot"_i18n ); list = new brls::List(); label = new brls::Label( @@ -23,7 +26,7 @@ PayloadPage::PayloadPage() : AppletFrame(true, true) reboot_to_payload(payload.c_str()); brls::Application::popView(); }); - if(cfw == ams){ + if(running_cfw == ams){ items[i]->registerAction("menus/payload_set"_i18n , brls::Key::X, [this, payload] { std::string res1; if(R_SUCCEEDED(CopyFile(payload.c_str(), REBOOT_PAYLOAD_PATH))){ diff --git a/source/tools_tab.cpp b/source/tools_tab.cpp index bb82d64..f93c66f 100644 --- a/source/tools_tab.cpp +++ b/source/tools_tab.cpp @@ -1,4 +1,17 @@ #include "tools_tab.hpp" +#include "confirm_page.hpp" +#include "worker_page.hpp" +#include "cheats_page.hpp" +#include "payload_page.hpp" +#include "download_payload_page.hpp" +#include "changelog_page.hpp" +#include "JC_page.hpp" +#include "PC_page.hpp" +#include "net_page.hpp" +#include "extract.hpp" +#include "utils.hpp" +#include "hide_tabs_page.hpp" +#include namespace i18n = brls::i18n; using namespace i18n::literals; diff --git a/source/utils.cpp b/source/utils.cpp index 4ec7457..ad91e3c 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -1,23 +1,16 @@ #include "utils.hpp" - +#include "current_cfw.hpp" +#include +#include "download.hpp" +#include "extract.hpp" +#include "progress_event.hpp" +#include "json.hpp" +#include "main_frame.hpp" +#include +#include + namespace i18n = brls::i18n; using namespace i18n::literals; -bool isServiceRunning(const char *serviceName) { - Handle handle; - SmServiceName service_name = smEncodeName(serviceName); - bool running = R_FAILED(smRegisterService(&handle, service_name, false, 1)); - svcCloseHandle(handle); - if (!running) - smUnregisterService(service_name); - - return running; -} - -CFW getCFW(){ - if(isServiceRunning("rnx")) return rnx; - else if(isServiceRunning("tx")) return sxos; - else return ams; -} std::vector htmlProcess(std::string s, std::regex rgx){ //std::vector rgx = {std::regex(">(?:(?!>).)*?"), std::regex(">(?:(?!>).)*?")}; @@ -159,7 +152,7 @@ void extractArchive(archiveType type, std::string tag){ case cheats: titles = getInstalledTitlesNs(); titles = excludeTitles(CHEATS_EXCLUDE, titles); - extractCheats(CHEATS_FILENAME, titles, getCFW()); + extractCheats(CHEATS_FILENAME, titles, running_cfw); break; case fw: if(std::filesystem::file_size(FIRMWARE_FILENAME) < 200000){ diff --git a/source/worker_page.cpp b/source/worker_page.cpp index 6f9f1ee..7e2b33a 100644 --- a/source/worker_page.cpp +++ b/source/worker_page.cpp @@ -1,4 +1,12 @@ #include "worker_page.hpp" +#include +#include + +#include "utils.hpp" +#include "download.hpp" +#include "extract.hpp" +#include "constants.hpp" +#include "progress_event.hpp" WorkerPage::WorkerPage(brls::StagedAppletFrame* frame, const std::string& text, worker_func_t worker_func): frame(frame), workerFunc(worker_func) {