diff options
author | Ethan Yonker <dees_troy@teamw.in> | 2016-01-15 05:21:49 +0100 |
---|---|---|
committer | Ethan Yonker <dees_troy@teamw.in> | 2016-01-16 15:19:51 +0100 |
commit | 1308d53e248d0c9e5ae416ddff5f07b290e4711e (patch) | |
tree | 54a168327c85f68b5d27cb95d29cc9390200e917 /gui/pages.cpp | |
parent | Add toybox getprop and setprop for M trees (diff) | |
download | android_bootable_recovery-1308d53e248d0c9e5ae416ddff5f07b290e4711e.tar android_bootable_recovery-1308d53e248d0c9e5ae416ddff5f07b290e4711e.tar.gz android_bootable_recovery-1308d53e248d0c9e5ae416ddff5f07b290e4711e.tar.bz2 android_bootable_recovery-1308d53e248d0c9e5ae416ddff5f07b290e4711e.tar.lz android_bootable_recovery-1308d53e248d0c9e5ae416ddff5f07b290e4711e.tar.xz android_bootable_recovery-1308d53e248d0c9e5ae416ddff5f07b290e4711e.tar.zst android_bootable_recovery-1308d53e248d0c9e5ae416ddff5f07b290e4711e.zip |
Diffstat (limited to 'gui/pages.cpp')
-rw-r--r-- | gui/pages.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/gui/pages.cpp b/gui/pages.cpp index bd7c79959..250fb4c4d 100644 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -49,6 +49,8 @@ extern "C" { #include "objects.hpp" #include "blanktimer.hpp" +#define TW_THEME_VERSION 1 + extern int gGuiRunning; // From ../twrp.cpp @@ -735,11 +737,28 @@ int PageSet::Load(ZipArchive* package, char* xmlFile, char* languageFile) set_scale_values(1, 1); // Reset any previous scaling values // Now, let's parse the XML - LOGINFO("Checking resolution...\n"); child = parent->first_node("details"); if (child) { + int theme_ver = 0; + xml_node<>* themeversion = child->first_node("themeversion"); + if (themeversion && themeversion->value()) { + theme_ver = atoi(themeversion->value()); + } else { + LOGINFO("No themeversion in theme.\n"); + } + if (theme_ver != TW_THEME_VERSION) { + LOGINFO("theme version from xml: %i, expected %i\n", theme_ver, TW_THEME_VERSION); + if (package) { + gui_err("theme_ver_err=Custom theme version does not match TWRP version. Using stock theme."); + mDoc.clear(); + return -1; + } else { + gui_print_color("warning", "Stock theme version does not match TWRP version.\n"); + } + } xml_node<>* resolution = child->first_node("resolution"); if (resolution) { + LOGINFO("Checking resolution...\n"); xml_attribute<>* width_attr = resolution->first_attribute("width"); xml_attribute<>* height_attr = resolution->first_attribute("height"); xml_attribute<>* noscale_attr = resolution->first_attribute("noscaling"); @@ -1558,7 +1577,7 @@ int PageManager::ChangeOverlay(std::string name) return mCurrentSet->SetOverlay(NULL); else { - Page* page = mBaseSet ? mBaseSet->FindPage(name) : NULL; + Page* page = mCurrentSet ? mCurrentSet->FindPage(name) : NULL; return mCurrentSet->SetOverlay(page); } } |