summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--gui/Android.mk19
-rw-r--r--gui/action.cpp2
-rw-r--r--gui/gui.cpp12
-rw-r--r--gui/pages.cpp7
-rw-r--r--gui/resources.cpp2
5 files changed, 23 insertions, 19 deletions
diff --git a/gui/Android.mk b/gui/Android.mk
index e75c5214a..fca5e0787 100644
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -82,6 +82,7 @@ ifeq ($(TW_CUSTOM_THEME),)
endif
LOCAL_C_INCLUDES += bionic external/stlport/stlport $(commands_recovery_local_path)/gui/devices/$(DEVICE_RESOLUTION)
+LOCAL_CFLAGS += -DTWRES=\"$(TWRES_PATH)\"
include $(BUILD_STATIC_LIBRARY)
@@ -90,7 +91,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE := twrp
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
-LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/res
+LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
TWRP_RES_LOC := $(commands_recovery_local_path)/gui/devices/common/res
TWRP_COMMON_XML := $(hide) echo "No common TWRP XML resources"
@@ -100,20 +101,20 @@ ifeq ($(TW_CUSTOM_THEME),)
WATCH := 240x240 280x280 320x320
TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/$(DEVICE_RESOLUTION)/res
ifneq ($(filter $(DEVICE_RESOLUTION), $(PORTRAIT)),)
- TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/portrait/res/* $(TARGET_RECOVERY_ROOT_OUT)/res/
+ TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/portrait/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
else ifneq ($(filter $(DEVICE_RESOLUTION), $(LANDSCAPE)),)
- TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/landscape/res/* $(TARGET_RECOVERY_ROOT_OUT)/res/
+ TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/landscape/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
else ifneq ($(filter $(DEVICE_RESOLUTION), $(WATCH)),)
- TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/watch/res/* $(TARGET_RECOVERY_ROOT_OUT)/res/
+ TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/watch/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
endif
else
TWRP_THEME_LOC := $(TW_CUSTOM_THEME)
endif
ifeq ($(TW_DISABLE_TTF), true)
- TWRP_REMOVE_FONT := rm -f $(TARGET_RECOVERY_ROOT_OUT)/res/fonts/*.ttf
+ TWRP_REMOVE_FONT := rm -f $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)fonts/*.ttf
else
- TWRP_REMOVE_FONT := rm -f $(TARGET_RECOVERY_ROOT_OUT)/res/fonts/*.dat
+ TWRP_REMOVE_FONT := rm -f $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)fonts/*.dat
endif
TWRP_RES_GEN := $(intermediates)/twrp
@@ -124,9 +125,9 @@ else
endif
$(TWRP_RES_GEN):
- mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res/
- cp -fr $(TWRP_RES_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)/res/
- cp -fr $(TWRP_THEME_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)/res/
+ mkdir -p $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
+ cp -fr $(TWRP_RES_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
+ cp -fr $(TWRP_THEME_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
$(TWRP_COMMON_XML)
$(TWRP_REMOVE_FONT)
mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sbin/
diff --git a/gui/action.cpp b/gui/action.cpp
index a3cf22ef2..d75843044 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -496,7 +496,7 @@ int GUIAction::reload(std::string arg)
{
// Loading the custom theme failed - try loading the stock theme
LOGINFO("Attempting to reload stock theme...\n");
- if (PageManager::ReloadPackage("TWRP", "/res/ui.xml"))
+ if (PageManager::ReloadPackage("TWRP", TWRES "ui.xml"))
{
LOGERR("Failed to load base packages.\n");
ret_val = 1;
diff --git a/gui/gui.cpp b/gui/gui.cpp
index 9b918f0e7..fecc03278 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -715,11 +715,12 @@ std::string gui_parse_text(string inText)
extern "C" int gui_init(void)
{
gr_init();
+ std::string curtain_path = TWRES "images/curtain.jpg";
- if (res_create_surface("/res/images/curtain.jpg", &gCurtain))
+ if (res_create_surface(curtain_path.c_str(), &gCurtain))
{
printf
- ("Unable to locate '/res/images/curtain.jpg'\nDid you set a DEVICE_RESOLUTION in your config files?\n");
+ ("Unable to locate '%s'\nDid you set a DEVICE_RESOLUTION in your config files?\n", curtain_path.c_str());
return -1;
}
@@ -734,9 +735,10 @@ extern "C" int gui_loadResources(void)
#ifndef TW_OEM_BUILD
int check = 0;
DataManager::GetValue(TW_IS_ENCRYPTED, check);
+
if (check)
{
- if (PageManager::LoadPackage("TWRP", "/res/ui.xml", "decrypt"))
+ if (PageManager::LoadPackage("TWRP", TWRES "ui.xml", "decrypt"))
{
LOGERR("Failed to load base packages.\n");
goto error;
@@ -771,7 +773,7 @@ extern "C" int gui_loadResources(void)
if (check || PageManager::LoadPackage("TWRP", theme_path, "main"))
{
#endif // ifndef TW_OEM_BUILD
- if (PageManager::LoadPackage("TWRP", "/res/ui.xml", "main"))
+ if (PageManager::LoadPackage("TWRP", TWRES "ui.xml", "main"))
{
LOGERR("Failed to load base packages.\n");
goto error;
@@ -807,7 +809,7 @@ extern "C" int gui_loadCustomResources(void)
// There is a custom theme, try to load it
if (PageManager::ReloadPackage("TWRP", theme_path)) {
// Custom theme failed to load, try to load stock theme
- if (PageManager::ReloadPackage("TWRP", "/res/ui.xml")) {
+ if (PageManager::ReloadPackage("TWRP", TWRES "ui.xml")) {
LOGERR("Failed to load base packages.\n");
goto error;
}
diff --git a/gui/pages.cpp b/gui/pages.cpp
index 94c351be2..8fef7b4c8 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -644,11 +644,11 @@ int PageSet::CheckInclude(ZipArchive* package, xml_document<> *parentDoc)
if (!attr)
break;
- LOGINFO("PageSet::CheckInclude loading filename: '%s'\n", filename.c_str());
if (!package) {
// We can try to load the XML directly...
- filename = "/res/";
+ filename = TWRES;
filename += attr->value();
+ LOGINFO("PageSet::CheckInclude loading filename: '%s'\n", filename.c_str());
struct stat st;
if(stat(filename.c_str(),&st) != 0) {
LOGERR("Unable to locate '%s'\n", filename.c_str());
@@ -668,6 +668,7 @@ int PageSet::CheckInclude(ZipArchive* package, xml_document<> *parentDoc)
close(fd);
} else {
filename += attr->value();
+ LOGINFO("PageSet::CheckInclude loading filename: '%s'\n", filename.c_str());
const ZipEntry* ui_xml = mzFindZipEntry(package, filename.c_str());
if (ui_xml == NULL)
{
@@ -1094,7 +1095,7 @@ int PageManager::ReloadPackage(std::string name, std::string package)
if (LoadPackage(name, package, "main") != 0)
{
- LOGERR("Failed to load package.\n");
+ LOGERR("Failed to load package '%s'.\n", package.c_str());
mPageSets.insert(std::pair<std::string, PageSet*>(name, set));
return -1;
}
diff --git a/gui/resources.cpp b/gui/resources.cpp
index 0d32ceee0..d769c17eb 100644
--- a/gui/resources.cpp
+++ b/gui/resources.cpp
@@ -100,7 +100,7 @@ FontResource::FontResource(xml_node<>* node, ZipArchive* pZip)
}
else
{
- file = std::string("/res/fonts/") + file;
+ file = std::string(TWRES "fonts/") + file;
mFont = gr_ttf_loadFont(file.c_str(), size, dpi);
}
}