diff --git a/Makefile b/Makefile index 5c8f244..4952464 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ DATA := data INCLUDES := include include/ui include/data include/install include/nx include/nx/ipc include/util $(CURDIR)/include/Plutonium/Plutonium/include APP_TITLE := TinWoo Installer APP_AUTHOR := MrDude -APP_VERSION := 1.0.18 +APP_VERSION := 1.0.19 ROMFS := romfs APP_ICON := icon.jpg diff --git a/include/util/config.hpp b/include/util/config.hpp index 385c502..78ebc69 100644 --- a/include/util/config.hpp +++ b/include/util/config.hpp @@ -5,7 +5,7 @@ namespace inst::config { static const std::string appDir = "sdmc:/switch/tinwoo"; static const std::string configPath = appDir + "/config.json"; - static const std::string appVersion = "1.0.18"; + static const std::string appVersion = "1.0.19"; extern std::string gAuthKey; extern std::string sigPatchesUrl; diff --git a/source/netInstall.cpp b/source/netInstall.cpp index e4360cd..416a23b 100644 --- a/source/netInstall.cpp +++ b/source/netInstall.cpp @@ -357,7 +357,7 @@ namespace netInstStuff { } if (kDown & HidNpadButton_Minus) { - if (std::filesystem::remove("temp.html")); + std::remove("temp.html"); std::string url; unsigned short maxlist = 50; unsigned short nowlist = 0; @@ -398,6 +398,10 @@ namespace netInstStuff { //If the above fails we probably have an html page - try to download it instead. 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"); + break; + } } } diff --git a/source/nx/nca_writer.cpp b/source/nx/nca_writer.cpp index dbbfa15..410b4a4 100644 --- a/source/nx/nca_writer.cpp +++ b/source/nx/nca_writer.cpp @@ -20,6 +20,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include +#include +#include #include "nx/nca_writer.h" #include "util/error.hpp" #include @@ -29,6 +32,11 @@ SOFTWARE. #include "util/title_util.hpp" #include "install/nca.hpp" +//added for debugging messages on screen +#include "util/lang.hpp" +#include "ui/MainApplication.hpp" +// + void append(std::vector& buffer, const u8* ptr, u64 sz) { u64 offset = buffer.size(); @@ -68,6 +76,10 @@ bool NcaBodyWriter::isOpen() const //https://github.com/nicoboss/nsz/blob/master/nsz/BlockDecompressorReader.py //https://switchbrew.org/wiki/NCA +namespace inst::ui { + extern MainApplication* mainApp; +} + class NczHeader { public: @@ -249,7 +261,7 @@ public: { const size_t readChunkSz = std::min(sz, buffInSize); ZSTD_inBuffer input = { ptr, readChunkSz, 0 }; - + while (input.pos < input.size) { ZSTD_outBuffer output = { buffOut, buffOutSize, 0 }; @@ -300,6 +312,21 @@ public: } auto header = (NczHeader*)m_buffer.data(); + + //debug code -- ignore.... + /* + int x =0; + if (x == 0) { + char aByte = m_buffer.data()[0]; + //aByte = 0x10+(aByte*0x40); + int one = sizeof(NczHeader); + std::ostringstream ss; + ss << "0x" << std::hex << one; + std::string result = ss.str(); + inst::ui::mainApp->CreateShowDialog("Debug info", result, { "common.ok"_lang }, true, "romfs:/images/icons/information.png"); + x++; + } + */ if (m_buffer.size() + sz > header->size()) { @@ -491,4 +518,4 @@ void NcaWriter::flushHeader() { m_contentStorage->WritePlaceholder(*(NcmPlaceHolderId*)&m_ncaId, 0, m_buffer.data(), m_buffer.size()); } -} +} \ No newline at end of file diff --git a/source/ui/optionsPage.cpp b/source/ui/optionsPage.cpp index b46a762..2017861 100644 --- a/source/ui/optionsPage.cpp +++ b/source/ui/optionsPage.cpp @@ -103,7 +103,8 @@ namespace inst::ui { return languageStrings[ourLangCode]; } else { - return "options.language.system_language"_lang; + flag = "romfs:/images/flags/en.png"; + return languageStrings[0]; } } @@ -356,7 +357,6 @@ namespace inst::ui { break; case 13: 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, flag ); if (rc == -1) break; switch (rc) { diff --git a/source/util/lang.cpp b/source/util/lang.cpp index 22fd534..c7d5758 100644 --- a/source/util/lang.cpp +++ b/source/util/lang.cpp @@ -11,18 +11,14 @@ namespace Language { std::ifstream ifs; std::string languagePath; int langInt = inst::config::languageSetting; - if (langInt == 0) { - SetLanguage ourLang; - u64 lcode = 0; - setInitialize(); - setGetSystemLanguage(&lcode); - setMakeLanguage(lcode, &ourLang); - setExit(); - langInt = (int)ourLang; - } switch (langInt) { case 0: - languagePath = "romfs:/lang/en.json"; + if (std::filesystem::exists(inst::config::appDir + "/lang/custom.json")) { + languagePath = (inst::config::appDir + "/lang/custom.json"); + } + else { + languagePath = "romfs:/lang/en.json"; + } break; case 1: languagePath = "romfs:/lang/jp.json"; @@ -46,12 +42,8 @@ namespace Language { languagePath = "romfs:/lang/tw.json"; break; default: - if (std::filesystem::exists(inst::config::appDir + "/lang/custom.json")) { - languagePath = (inst::config::appDir + "/lang/custom.json"); - } - else { - languagePath = "romfs:/lang/en.json"; - } + languagePath = "romfs:/lang/en.json"; + break; } if (std::filesystem::exists(languagePath)) ifs = std::ifstream(languagePath); else ifs = std::ifstream("romfs:/lang/en.json");