diff options
author | Ethan Yonker <dees_troy@teamw.in> | 2016-01-21 18:21:06 +0100 |
---|---|---|
committer | Ethan Yonker <dees_troy@teamw.in> | 2016-01-21 18:21:12 +0100 |
commit | 8e5692ffe00ea982da5c548af7b29cbe1b2af934 (patch) | |
tree | 842de44ca323f936b356328ec15066674d3de2ee /gui | |
parent | Fix SuperSU local dependencies (diff) | |
download | android_bootable_recovery-8e5692ffe00ea982da5c548af7b29cbe1b2af934.tar android_bootable_recovery-8e5692ffe00ea982da5c548af7b29cbe1b2af934.tar.gz android_bootable_recovery-8e5692ffe00ea982da5c548af7b29cbe1b2af934.tar.bz2 android_bootable_recovery-8e5692ffe00ea982da5c548af7b29cbe1b2af934.tar.lz android_bootable_recovery-8e5692ffe00ea982da5c548af7b29cbe1b2af934.tar.xz android_bootable_recovery-8e5692ffe00ea982da5c548af7b29cbe1b2af934.tar.zst android_bootable_recovery-8e5692ffe00ea982da5c548af7b29cbe1b2af934.zip |
Diffstat (limited to 'gui')
-rw-r--r-- | gui/pages.cpp | 22 | ||||
-rw-r--r-- | gui/pages.hpp | 2 |
2 files changed, 14 insertions, 10 deletions
diff --git a/gui/pages.cpp b/gui/pages.cpp index 250fb4c4d..932be6b32 100644 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -50,6 +50,7 @@ extern "C" { #include "blanktimer.hpp" #define TW_THEME_VERSION 1 +#define TW_THEME_VER_ERR -2 extern int gGuiRunning; @@ -721,7 +722,7 @@ int PageSet::LoadLanguage(char* languageFile, ZipArchive* package) return 0; } -int PageSet::Load(ZipArchive* package, char* xmlFile, char* languageFile) +int PageSet::Load(ZipArchive* package, char* xmlFile, char* languageFile, char* baseLanguageFile) { xml_document<> mDoc; xml_node<>* parent; @@ -736,6 +737,9 @@ int PageSet::Load(ZipArchive* package, char* xmlFile, char* languageFile) set_scale_values(1, 1); // Reset any previous scaling values + if (baseLanguageFile) + LoadLanguage(baseLanguageFile, NULL); + // Now, let's parse the XML child = parent->first_node("details"); if (child) { @@ -751,7 +755,7 @@ int PageSet::Load(ZipArchive* package, char* xmlFile, char* languageFile) if (package) { gui_err("theme_ver_err=Custom theme version does not match TWRP version. Using stock theme."); mDoc.clear(); - return -1; + return TW_THEME_VER_ERR; } else { gui_print_color("warning", "Stock theme version does not match TWRP version.\n"); } @@ -1353,6 +1357,7 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string long len; char* xmlFile = NULL; char* languageFile = NULL; + char* baseLanguageFile = NULL; PageSet* pageSet = NULL; int ret; MemMapping map; @@ -1390,6 +1395,7 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string package = "ui.xml"; LoadLanguageList(pZip); languageFile = LoadFileToBuffer("languages/en.xml", pZip); + baseLanguageFile = LoadFileToBuffer(TWRES "languages/en.xml", NULL); } xmlFile = LoadFileToBuffer(package, pZip); @@ -1400,19 +1406,17 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string // Before loading, mCurrentSet must be the loading package so we can find resources pageSet = mCurrentSet; mCurrentSet = new PageSet(xmlFile); - ret = mCurrentSet->Load(pZip, xmlFile, languageFile); + ret = mCurrentSet->Load(pZip, xmlFile, languageFile, baseLanguageFile); if (languageFile) { free(languageFile); languageFile = NULL; } - if (ret == 0) - { + if (ret == 0) { mCurrentSet->SetPage(startpage); mPageSets.insert(std::pair<std::string, PageSet*>(name, mCurrentSet)); - } - else - { - LOGERR("Package %s failed to load.\n", name.c_str()); + } else { + if (ret != TW_THEME_VER_ERR) + LOGERR("Package %s failed to load.\n", name.c_str()); } // The first successful package we loaded is the base diff --git a/gui/pages.hpp b/gui/pages.hpp index 87e1fb527..b2f25801f 100644 --- a/gui/pages.hpp +++ b/gui/pages.hpp @@ -91,7 +91,7 @@ public: public: int LoadLanguage(char* languageFile, ZipArchive* package); - int Load(ZipArchive* package, char* xmlFile, char* languageFile); + int Load(ZipArchive* package, char* xmlFile, char* languageFile, char* baseLanguageFile); int CheckInclude(ZipArchive* package, xml_document<> *parentDoc); Page* FindPage(std::string name); |