libtwrpgui: convert gui to use new ziparchive library

Change-Id: Iea94855257c6d02c2f663c25d390cb1cfb91a727
diff --git a/gui/Android.bp b/gui/Android.bp
index aa2bbc4..e5b97d8 100644
--- a/gui/Android.bp
+++ b/gui/Android.bp
@@ -31,16 +31,19 @@
         "system/core/libziparchive/include",
         "bootable/recovery/recovery_ui/include",
         "bootable/recovery/fuse_sideload/include",
+        "bootable/recovery/gui/include",
         "bootable/recovery/twrpinstall",
         "bootable/recovery/twrpinstall/include",
         "bootable/recovery/libpixelflinger/include",
+        "bootable/recovery/minuitwrp/include",
         "bionic",
         "system/core/base/include",
         "system/core/include",
-        "external/freetype/include"
+        "external/freetype/include",
+        "external/libpng"
 
     ],
-    srcs: [ 
+    srcs: [
         "gui.cpp",
         "resources.cpp",
         "pages.cpp",
@@ -78,6 +81,7 @@
         "libziparchive"
     ],
     static_libs: [
-        "libotautil"
+        "libotautil",
+        "libpng"
     ]
 }
\ No newline at end of file
diff --git a/gui/action.cpp b/gui/action.cpp
index 52981f2..58211d3 100755
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -55,7 +55,7 @@
 #include "twinstall/adb_install.h"
 };
 #include "set_metadata.h"
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
@@ -221,9 +221,6 @@
 		ADD_ACTION(fixpermissions);
 		ADD_ACTION(dd);
 		ADD_ACTION(partitionsd);
-		ADD_ACTION(installhtcdumlock);
-		ADD_ACTION(htcdumlockrestoreboot);
-		ADD_ACTION(htcdumlockreflashrecovery);
 		ADD_ACTION(cmd);
 		ADD_ACTION(terminalcommand);
 		ADD_ACTION(reinjecttwrp);
@@ -1362,42 +1359,6 @@
 
 }
 
-int GUIAction::installhtcdumlock(std::string arg __unused)
-{
-	operation_start("Install HTC Dumlock");
-	if (simulate) {
-		simulate_progress_bar();
-	} else
-		TWFunc::install_htc_dumlock();
-
-	operation_end(0);
-	return 0;
-}
-
-int GUIAction::htcdumlockrestoreboot(std::string arg __unused)
-{
-	operation_start("HTC Dumlock Restore Boot");
-	if (simulate) {
-		simulate_progress_bar();
-	} else
-		TWFunc::htc_dumlock_restore_original_boot();
-
-	operation_end(0);
-	return 0;
-}
-
-int GUIAction::htcdumlockreflashrecovery(std::string arg __unused)
-{
-	operation_start("HTC Dumlock Reflash Recovery");
-	if (simulate) {
-		simulate_progress_bar();
-	} else
-		TWFunc::htc_dumlock_reflash_recovery_to_boot();
-
-	operation_end(0);
-	return 0;
-}
-
 int GUIAction::cmd(std::string arg)
 {
 	int op_status = 0;
diff --git a/gui/animation.cpp b/gui/animation.cpp
index 2244503..ed32da4 100644
--- a/gui/animation.cpp
+++ b/gui/animation.cpp
@@ -38,7 +38,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/blanktimer.cpp b/gui/blanktimer.cpp
index a9573ad..61356d3 100755
--- a/gui/blanktimer.cpp
+++ b/gui/blanktimer.cpp
@@ -27,7 +27,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 #include "../twrp-functions.hpp"
 #include "../variables.h"
 
diff --git a/gui/button.cpp b/gui/button.cpp
index 7c7f69f..4ce595b 100755
--- a/gui/button.cpp
+++ b/gui/button.cpp
@@ -37,7 +37,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/checkbox.cpp b/gui/checkbox.cpp
index ad16f24..8bacd8f 100755
--- a/gui/checkbox.cpp
+++ b/gui/checkbox.cpp
@@ -38,7 +38,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/console.cpp b/gui/console.cpp
index 77fdd96..7872344 100755
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -32,7 +32,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/fileselector.cpp b/gui/fileselector.cpp
index a32743a..5835e90 100644
--- a/gui/fileselector.cpp
+++ b/gui/fileselector.cpp
@@ -32,7 +32,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/fill.cpp b/gui/fill.cpp
index 3cfbe6e..f813bf3 100644
--- a/gui/fill.cpp
+++ b/gui/fill.cpp
@@ -38,7 +38,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/gui.cpp b/gui/gui.cpp
index da35d23..00aab7f 100755
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -39,7 +39,7 @@
 #include "../twcommon.h"
 #include <pixelflinger/pixelflinger.h>
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/image.cpp b/gui/image.cpp
index 2b5c541..84eac8c 100644
--- a/gui/image.cpp
+++ b/gui/image.cpp
@@ -38,7 +38,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/placement.h b/gui/include/gui/placement.h
similarity index 100%
rename from gui/placement.h
rename to gui/include/gui/placement.h
diff --git a/gui/input.cpp b/gui/input.cpp
index 458eb55..a3c074a 100755
--- a/gui/input.cpp
+++ b/gui/input.cpp
@@ -40,8 +40,8 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
-#include "../minuitwrp/truetype.hpp"
+#include "minuitwrp/minui.h"
+#include "minuitwrp/truetype.hpp"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp
index 026984c..13fd779 100755
--- a/gui/keyboard.cpp
+++ b/gui/keyboard.cpp
@@ -27,8 +27,8 @@
 #include "../twcommon.h"
 #include "gui.h"
 }
-#include "../minuitwrp/minui.h"
-#include "../minuitwrp/truetype.hpp"
+#include "minuitwrp/minui.h"
+#include "minuitwrp/truetype.hpp"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/listbox.cpp b/gui/listbox.cpp
index 3386465..91cb7a7 100644
--- a/gui/listbox.cpp
+++ b/gui/listbox.cpp
@@ -21,7 +21,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/mousecursor.cpp b/gui/mousecursor.cpp
index 93c635a..8c0d438 100644
--- a/gui/mousecursor.cpp
+++ b/gui/mousecursor.cpp
@@ -36,7 +36,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/objects.hpp b/gui/objects.hpp
index d4b42c2..3948fb2 100755
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -34,7 +34,7 @@
 #include "resources.hpp"
 #include "pages.hpp"
 #include "../partitions.hpp"
-#include "placement.h"
+#include "gui/placement.h"
 
 #ifndef TW_X_OFFSET
 #define TW_X_OFFSET 0
diff --git a/gui/pages.cpp b/gui/pages.cpp
index 0dc80ad..3145c15 100755
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -47,7 +47,7 @@
 #include "../twcommon.h"
 #include "gui.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/partitionlist.cpp b/gui/partitionlist.cpp
index 19153c5..406dbbb 100755
--- a/gui/partitionlist.cpp
+++ b/gui/partitionlist.cpp
@@ -23,7 +23,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/patternpassword.cpp b/gui/patternpassword.cpp
index a75ed15..cedfda3 100755
--- a/gui/patternpassword.cpp
+++ b/gui/patternpassword.cpp
@@ -32,7 +32,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 #include "../twrp-functions.hpp"
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/progressbar.cpp b/gui/progressbar.cpp
index defd951..62ce7ce 100644
--- a/gui/progressbar.cpp
+++ b/gui/progressbar.cpp
@@ -38,7 +38,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/resources.cpp b/gui/resources.cpp
index 9c4eec1..cf677f6 100755
--- a/gui/resources.cpp
+++ b/gui/resources.cpp
@@ -37,8 +37,8 @@
 #include "gui.h"
 }
 
-#include "../minuitwrp/truetype.hpp"
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/truetype.hpp"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
@@ -100,7 +100,7 @@
 void Resource::CheckAndScaleImage(gr_surface source, gr_surface* destination, int retain_aspect)
 {
 	if (!source) {
-		*destination = NULL;
+		*destination = nullptr;
 		return;
 	}
 	if (get_scale_w() != 0 && get_scale_h() != 0) {
@@ -214,7 +214,7 @@
  : Resource(node, pZip)
 {
 	std::string file;
-	gr_surface temp_surface = NULL;
+	gr_surface temp_surface = nullptr;
 
 	mSurface = NULL;
 	if (!node) {
@@ -264,7 +264,8 @@
 		std::ostringstream fileName;
 		fileName << file << std::setfill ('0') << std::setw (3) << fileNum;
 
-		gr_surface surface, temp_surface = NULL;
+		gr_surface surface = nullptr;
+		gr_surface temp_surface = nullptr;
 		LoadImage(pZip, fileName.str(), &temp_surface);
 		CheckAndScaleImage(temp_surface, &surface, retain_aspect);
 		if (surface) {
diff --git a/gui/resources.hpp b/gui/resources.hpp
index aeacd19..8c12276 100755
--- a/gui/resources.hpp
+++ b/gui/resources.hpp
@@ -26,10 +26,10 @@
 #include <map>
 #include "rapidxml.hpp"
 #include "ziparchive/zip_archive.h"
-#include "../minuitwrp/truetype.hpp"
+#include "minuitwrp/truetype.hpp"
 
 extern "C" {
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 }
 
 // Base Objects
diff --git a/gui/scrolllist.cpp b/gui/scrolllist.cpp
index 0a4eed8..cdc6c9e 100755
--- a/gui/scrolllist.cpp
+++ b/gui/scrolllist.cpp
@@ -21,8 +21,8 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
-#include "../minuitwrp/truetype.hpp"
+#include "minuitwrp/minui.h"
+#include "minuitwrp/truetype.hpp"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/slider.cpp b/gui/slider.cpp
index 3c5f652..a183d28 100755
--- a/gui/slider.cpp
+++ b/gui/slider.cpp
@@ -40,7 +40,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/slidervalue.cpp b/gui/slidervalue.cpp
index 5ed9c4f..8deb9e0 100755
--- a/gui/slidervalue.cpp
+++ b/gui/slidervalue.cpp
@@ -38,8 +38,8 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
-#include "../minuitwrp/truetype.hpp"
+#include "minuitwrp/minui.h"
+#include "minuitwrp/truetype.hpp"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/terminal.cpp b/gui/terminal.cpp
index d7037e1..7ce8154 100755
--- a/gui/terminal.cpp
+++ b/gui/terminal.cpp
@@ -33,8 +33,8 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
-#include "../minuitwrp/truetype.hpp"
+#include "minuitwrp/minui.h"
+#include "minuitwrp/truetype.hpp"
 
 #include "gui.hpp"
 
diff --git a/gui/text.cpp b/gui/text.cpp
index b72dd04..d081e0d 100755
--- a/gui/text.cpp
+++ b/gui/text.cpp
@@ -38,8 +38,8 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
-#include "../minuitwrp/truetype.hpp"
+#include "minuitwrp/minui.h"
+#include "minuitwrp/truetype.hpp"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"
diff --git a/gui/textbox.cpp b/gui/textbox.cpp
index 824daf3..c0620ee 100644
--- a/gui/textbox.cpp
+++ b/gui/textbox.cpp
@@ -23,7 +23,7 @@
 extern "C" {
 #include "../twcommon.h"
 }
-#include "../minuitwrp/minui.h"
+#include "minuitwrp/minui.h"
 
 #include "rapidxml.hpp"
 #include "objects.hpp"