mirror of
https://github.com/hax4dazy/TinWoo.git
synced 2025-02-09 19:25:05 +01:00
fix region bug for language
This commit is contained in:
parent
f50baa532a
commit
785bae2b75
2
Makefile
2
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
|
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_TITLE := TinWoo Installer
|
||||||
APP_AUTHOR := MrDude
|
APP_AUTHOR := MrDude
|
||||||
APP_VERSION := 1.0.18
|
APP_VERSION := 1.0.19
|
||||||
ROMFS := romfs
|
ROMFS := romfs
|
||||||
APP_ICON := icon.jpg
|
APP_ICON := icon.jpg
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
namespace inst::config {
|
namespace inst::config {
|
||||||
static const std::string appDir = "sdmc:/switch/tinwoo";
|
static const std::string appDir = "sdmc:/switch/tinwoo";
|
||||||
static const std::string configPath = appDir + "/config.json";
|
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 gAuthKey;
|
||||||
extern std::string sigPatchesUrl;
|
extern std::string sigPatchesUrl;
|
||||||
|
@ -357,7 +357,7 @@ namespace netInstStuff {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (kDown & HidNpadButton_Minus) {
|
if (kDown & HidNpadButton_Minus) {
|
||||||
if (std::filesystem::remove("temp.html"));
|
std::remove("temp.html");
|
||||||
std::string url;
|
std::string url;
|
||||||
unsigned short maxlist = 50;
|
unsigned short maxlist = 50;
|
||||||
unsigned short nowlist = 0;
|
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 the above fails we probably have an html page - try to download it instead.
|
||||||
if (response.empty()) {
|
if (response.empty()) {
|
||||||
response = inst::curl::html_to_buffer(url);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
#include <sstream>
|
||||||
|
#include <switch.h>
|
||||||
#include "nx/nca_writer.h"
|
#include "nx/nca_writer.h"
|
||||||
#include "util/error.hpp"
|
#include "util/error.hpp"
|
||||||
#include <zstd.h>
|
#include <zstd.h>
|
||||||
@ -29,6 +32,11 @@ SOFTWARE.
|
|||||||
#include "util/title_util.hpp"
|
#include "util/title_util.hpp"
|
||||||
#include "install/nca.hpp"
|
#include "install/nca.hpp"
|
||||||
|
|
||||||
|
//added for debugging messages on screen
|
||||||
|
#include "util/lang.hpp"
|
||||||
|
#include "ui/MainApplication.hpp"
|
||||||
|
//
|
||||||
|
|
||||||
void append(std::vector<u8>& buffer, const u8* ptr, u64 sz)
|
void append(std::vector<u8>& buffer, const u8* ptr, u64 sz)
|
||||||
{
|
{
|
||||||
u64 offset = buffer.size();
|
u64 offset = buffer.size();
|
||||||
@ -68,6 +76,10 @@ bool NcaBodyWriter::isOpen() const
|
|||||||
//https://github.com/nicoboss/nsz/blob/master/nsz/BlockDecompressorReader.py
|
//https://github.com/nicoboss/nsz/blob/master/nsz/BlockDecompressorReader.py
|
||||||
//https://switchbrew.org/wiki/NCA
|
//https://switchbrew.org/wiki/NCA
|
||||||
|
|
||||||
|
namespace inst::ui {
|
||||||
|
extern MainApplication* mainApp;
|
||||||
|
}
|
||||||
|
|
||||||
class NczHeader
|
class NczHeader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -301,6 +313,21 @@ public:
|
|||||||
|
|
||||||
auto header = (NczHeader*)m_buffer.data();
|
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())
|
if (m_buffer.size() + sz > header->size())
|
||||||
{
|
{
|
||||||
u64 remainder = header->size() - m_buffer.size();
|
u64 remainder = header->size() - m_buffer.size();
|
||||||
|
@ -103,7 +103,8 @@ namespace inst::ui {
|
|||||||
return languageStrings[ourLangCode];
|
return languageStrings[ourLangCode];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "options.language.system_language"_lang;
|
flag = "romfs:/images/flags/en.png";
|
||||||
|
return languageStrings[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,7 +357,6 @@ namespace inst::ui {
|
|||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
languageList = languageStrings;
|
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 );
|
rc = inst::ui::mainApp->CreateShowDialog("options.language.title"_lang, "options.language.desc"_lang, languageList, false, flag );
|
||||||
if (rc == -1) break;
|
if (rc == -1) break;
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
|
@ -11,18 +11,14 @@ namespace Language {
|
|||||||
std::ifstream ifs;
|
std::ifstream ifs;
|
||||||
std::string languagePath;
|
std::string languagePath;
|
||||||
int langInt = inst::config::languageSetting;
|
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) {
|
switch (langInt) {
|
||||||
case 0:
|
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;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
languagePath = "romfs:/lang/jp.json";
|
languagePath = "romfs:/lang/jp.json";
|
||||||
@ -46,12 +42,8 @@ namespace Language {
|
|||||||
languagePath = "romfs:/lang/tw.json";
|
languagePath = "romfs:/lang/tw.json";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (std::filesystem::exists(inst::config::appDir + "/lang/custom.json")) {
|
languagePath = "romfs:/lang/en.json";
|
||||||
languagePath = (inst::config::appDir + "/lang/custom.json");
|
break;
|
||||||
}
|
|
||||||
else {
|
|
||||||
languagePath = "romfs:/lang/en.json";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (std::filesystem::exists(languagePath)) ifs = std::ifstream(languagePath);
|
if (std::filesystem::exists(languagePath)) ifs = std::ifstream(languagePath);
|
||||||
else ifs = std::ifstream("romfs:/lang/en.json");
|
else ifs = std::ifstream("romfs:/lang/en.json");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user