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/pages.cpp | |
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 '')
-rw-r--r-- | gui/pages.cpp | 22 |
1 files changed, 13 insertions, 9 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 |