Merge "Ignore bma150 in event handler" into jb-wip
diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml
index 1a25036..4bed850 100755
--- a/gui/devices/1024x600/res/ui.xml
+++ b/gui/devices/1024x600/res/ui.xml
@@ -2061,6 +2061,18 @@
 				</actions>
 			</object>
 
+			<object type="button">
+				<conditions>
+					<condition var1="tw_is_encrypted" var2="1" />
+					<condition var1="tw_is_decrypted" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row3_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Decrypt Data</text>
+				<image resource="main_button" />
+				<action function="page">decrypt</action>
+			</object>
+
 			<object type="action">
 				<touch key="home" />
 				<action function="page">main</action>
diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml
index b6da352..1cdd77a 100644
--- a/gui/devices/1024x768/res/ui.xml
+++ b/gui/devices/1024x768/res/ui.xml
@@ -2061,6 +2061,18 @@
 				</actions>
 			</object>
 
+			<object type="button">
+				<conditions>
+					<condition var1="tw_is_encrypted" var2="1" />
+					<condition var1="tw_is_decrypted" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row3_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Decrypt Data</text>
+				<image resource="main_button" />
+				<action function="page">decrypt</action>
+			</object>
+
 			<object type="action">
 				<touch key="home" />
 				<action function="page">main</action>
diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml
index 9904b5a..11fa7dc 100644
--- a/gui/devices/1280x800/res/ui.xml
+++ b/gui/devices/1280x800/res/ui.xml
@@ -2061,6 +2061,18 @@
 				</actions>
 			</object>
 
+			<object type="button">
+				<conditions>
+					<condition var1="tw_is_encrypted" var2="1" />
+					<condition var1="tw_is_decrypted" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row3_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Decrypt Data</text>
+				<image resource="main_button" />
+				<action function="page">decrypt</action>
+			</object>
+
 			<object type="action">
 				<touch key="home" />
 				<action function="page">main</action>
diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml
index c0dd0b6..c829e9b 100644
--- a/gui/devices/1920x1200/res/ui.xml
+++ b/gui/devices/1920x1200/res/ui.xml
@@ -2061,6 +2061,18 @@
 				</actions>
 			</object>
 
+			<object type="button">
+				<conditions>
+					<condition var1="tw_is_encrypted" var2="1" />
+					<condition var1="tw_is_decrypted" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row3_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Decrypt Data</text>
+				<image resource="main_button" />
+				<action function="page">decrypt</action>
+			</object>
+
 			<object type="action">
 				<touch key="home" />
 				<action function="page">main</action>
diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml
index debe1b2..ac00dee 100644
--- a/gui/devices/2560x1600/res/ui.xml
+++ b/gui/devices/2560x1600/res/ui.xml
@@ -2061,6 +2061,18 @@
 				</actions>
 			</object>
 
+			<object type="button">
+				<conditions>
+					<condition var1="tw_is_encrypted" var2="1" />
+					<condition var1="tw_is_decrypted" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row3_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Decrypt Data</text>
+				<image resource="main_button" />
+				<action function="page">decrypt</action>
+			</object>
+
 			<object type="action">
 				<touch key="home" />
 				<action function="page">main</action>
diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml
index 64764d8..778d49f 100644
--- a/gui/devices/320x480/res/ui.xml
+++ b/gui/devices/320x480/res/ui.xml
@@ -2117,6 +2117,18 @@
 				<action function="page">usb_mount</action>
 			</object>
 
+			<object type="button">
+				<conditions>
+					<condition var1="tw_is_encrypted" var2="1" />
+					<condition var1="tw_is_decrypted" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row3_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Decrypt Data</text>
+				<image resource="main_button" />
+				<action function="page">decrypt</action>
+			</object>
+
 			<object type="action">
 				<touch key="home" />
 				<action function="page">main</action>
diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml
index 798e9b9..0c2c03f 100644
--- a/gui/devices/480x800/res/ui.xml
+++ b/gui/devices/480x800/res/ui.xml
@@ -2116,6 +2116,18 @@
 				<action function="page">usb_mount</action>
 			</object>
 
+			<object type="button">
+				<conditions>
+					<condition var1="tw_is_encrypted" var2="1" />
+					<condition var1="tw_is_decrypted" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row3_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Decrypt Data</text>
+				<image resource="main_button" />
+				<action function="page">decrypt</action>
+			</object>
+
 			<object type="action">
 				<touch key="home" />
 				<action function="page">main</action>
diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml
index 62fb909..b1cf00c 100644
--- a/gui/devices/480x854/res/ui.xml
+++ b/gui/devices/480x854/res/ui.xml
@@ -2115,6 +2115,18 @@
 				<action function="page">usb_mount</action>
 			</object>
 
+			<object type="button">
+				<conditions>
+					<condition var1="tw_is_encrypted" var2="1" />
+					<condition var1="tw_is_decrypted" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row3_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Decrypt Data</text>
+				<image resource="main_button" />
+				<action function="page">decrypt</action>
+			</object>
+
 			<object type="action">
 				<touch key="home" />
 				<action function="page">main</action>
diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml
index 5e90ae0..481beca 100644
--- a/gui/devices/540x960/res/ui.xml
+++ b/gui/devices/540x960/res/ui.xml
@@ -2116,6 +2116,18 @@
 				<action function="page">usb_mount</action>
 			</object>
 
+			<object type="button">
+				<conditions>
+					<condition var1="tw_is_encrypted" var2="1" />
+					<condition var1="tw_is_decrypted" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row3_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Decrypt Data</text>
+				<image resource="main_button" />
+				<action function="page">decrypt</action>
+			</object>
+
 			<object type="action">
 				<touch key="home" />
 				<action function="page">main</action>
diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml
index 9be4086..4e6ba9f 100644
--- a/gui/devices/720x1280/res/ui.xml
+++ b/gui/devices/720x1280/res/ui.xml
@@ -2121,6 +2121,18 @@
 				<action function="page">usb_mount</action>
 			</object>
 
+			<object type="button">
+				<conditions>
+					<condition var1="tw_is_encrypted" var2="1" />
+					<condition var1="tw_is_decrypted" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row3_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Decrypt Data</text>
+				<image resource="main_button" />
+				<action function="page">decrypt</action>
+			</object>
+
 			<object type="action">
 				<touch key="home" />
 				<action function="page">main</action>
diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml
index c435cf9..dd86e23 100755
--- a/gui/devices/800x1280/res/ui.xml
+++ b/gui/devices/800x1280/res/ui.xml
@@ -2117,6 +2117,18 @@
 				<action function="page">usb_mount</action>
 			</object>
 
+			<object type="button">
+				<conditions>
+					<condition var1="tw_is_encrypted" var2="1" />
+					<condition var1="tw_is_decrypted" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row3_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Decrypt Data</text>
+				<image resource="main_button" />
+				<action function="page">decrypt</action>
+			</object>
+
 			<object type="action">
 				<touch key="home" />
 				<action function="page">main</action>
diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml
index 3241e99..6096c57 100755
--- a/gui/devices/800x480/res/ui.xml
+++ b/gui/devices/800x480/res/ui.xml
@@ -2061,6 +2061,18 @@
 				</actions>
 			</object>
 
+			<object type="button">
+				<conditions>
+					<condition var1="tw_is_encrypted" var2="1" />
+					<condition var1="tw_is_decrypted" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row3_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Decrypt Data</text>
+				<image resource="main_button" />
+				<action function="page">decrypt</action>
+			</object>
+
 			<object type="action">
 				<touch key="home" />
 				<action function="page">main</action>
diff --git a/minuitwrp/graphics.c b/minuitwrp/graphics.c
index b30a92e..dc79db8 100644
--- a/minuitwrp/graphics.c
+++ b/minuitwrp/graphics.c
@@ -51,6 +51,8 @@
 #define PIXEL_SIZE 2
 #endif
 
+#define NUM_BUFFERS 2
+
 // #define PRINT_SCREENINFO 1 // Enables printing of screen info to log
 
 typedef struct {
@@ -63,9 +65,10 @@
 static GRFont *gr_font = 0;
 static GGLContext *gr_context = 0;
 static GGLSurface gr_font_texture;
-static GGLSurface gr_framebuffer[2];
+static GGLSurface gr_framebuffer[NUM_BUFFERS];
 static GGLSurface gr_mem_surface;
 static unsigned gr_active_fb = 0;
+static unsigned double_buffering = 0;
 
 static int gr_fb_fd = -1;
 static int gr_vt_fd = -1;
@@ -199,6 +202,12 @@
 
     fb++;
 
+    /* check if we can use double buffering */
+    if (vi.yres * fi.line_length * 2 > fi.smem_len)
+        return fd;
+
+    double_buffering = 1;
+
     fb->version = sizeof(*fb);
     fb->width = vi.xres;
     fb->height = vi.yres;
@@ -230,8 +239,8 @@
 
 static void set_active_framebuffer(unsigned n)
 {
-    if (n > 1) return;
-    vi.yres_virtual = vi.yres * 2;
+    if (n > 1  || !double_buffering) return;
+    vi.yres_virtual = vi.yres * NUM_BUFFERS;
     vi.yoffset = n * vi.yres;
 //    vi.bits_per_pixel = PIXEL_SIZE * 8;
     if (ioctl(gr_fb_fd, FBIOPUT_VSCREENINFO, &vi) < 0) {
@@ -244,7 +253,8 @@
     GGLContext *gl = gr_context;
 
     /* swap front and back buffers */
-    gr_active_fb = (gr_active_fb + 1) & 1;
+    if (double_buffering)
+        gr_active_fb = (gr_active_fb + 1) & 1;
 
 #ifdef BOARD_HAS_FLIPPED_SCREEN
     /* flip buffer 180 degrees for devices with physicaly inverted screens */
diff --git a/partition.cpp b/partition.cpp
index 8aa7f0a..32376c1 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -82,6 +82,7 @@
 	Current_File_System = "";
 	Fstab_File_System = "";
 	Format_Block_Size = 0;
+	Ignore_Blkid = false;
 }
 
 TWPartition::~TWPartition(void) {
@@ -152,6 +153,7 @@
 				// Custom flags, save for later so that new values aren't overwritten by defaults
 				ptr += 6;
 				Flags = ptr;
+				Process_Flags(Flags, Display_Error);
 			} else if (strlen(ptr) == 4 && (strncmp(ptr, "NULL", 4) == 0 || strncmp(ptr, "null", 4) == 0 || strncmp(ptr, "null", 4) == 0)) {
 				// Do nothing
 			} else {
@@ -333,6 +335,8 @@
 			ptr += 13;
 			Is_SubPartition = true;
 			SubPartition_Of = ptr;
+		} else if (strcmp(ptr, "ignoreblkid") == 0) {
+			Ignore_Blkid = true;
 		} else if (strlen(ptr) > 8 && strncmp(ptr, "symlink=", 8) == 0) {
 			ptr += 8;
 			Symlink_Path = ptr;
@@ -698,7 +702,7 @@
 	}
 }
 
-bool TWPartition::Wipe() {
+bool TWPartition::Wipe(string New_File_System) {
 	if (!Can_Be_Wiped) {
 		LOGE("Partition '%s' cannot be wiped.\n", Mount_Point.c_str());
 		return false;
@@ -715,22 +719,26 @@
 	if (check)
 		return Wipe_RMRF();
 
-	if (Current_File_System == "ext4")
+	if (New_File_System == "ext4")
 		return Wipe_EXT4();
 
-	if (Current_File_System == "ext2" || Current_File_System == "ext3")
-		return Wipe_EXT23();
+	if (New_File_System == "ext2" || New_File_System == "ext3")
+		return Wipe_EXT23(New_File_System);
 
-	if (Current_File_System == "vfat")
+	if (New_File_System == "vfat")
 		return Wipe_FAT();
 
-	if (Current_File_System == "yaffs2")
+	if (New_File_System == "yaffs2")
 		return Wipe_MTD();
 
-	LOGE("Unable to wipe '%s' -- unknown file system '%s'\n", Mount_Point.c_str(), Current_File_System.c_str());
+	LOGE("Unable to wipe '%s' -- unknown file system '%s'\n", Mount_Point.c_str(), New_File_System.c_str());
 	return false;
 }
 
+bool TWPartition::Wipe() {
+	return Wipe(Current_File_System);
+}
+
 bool TWPartition::Wipe_AndSec(void) {
 	if (!Has_Android_Secure)
 		return false;
@@ -789,12 +797,36 @@
 }
 
 bool TWPartition::Restore(string restore_folder) {
-	if (Backup_Method == FILES)
-		return Restore_Tar(restore_folder);
-	else if (Backup_Method == DD)
-		return Restore_DD(restore_folder);
-	else if (Backup_Method == FLASH_UTILS)
-		return Restore_Flash_Image(restore_folder);
+	size_t first_period, second_period;
+	string Restore_File_System;
+
+	TWFunc::GUI_Operation_Text(TW_RESTORE_TEXT, Display_Name, "Restoring");
+	LOGI("Restore filename is: %s\n", Backup_FileName.c_str());
+
+	// Parse backup filename to extract the file system before wiping
+	first_period = Backup_FileName.find(".");
+	if (first_period == string::npos) {
+		LOGE("Unable to find file system (first period).\n");
+		return false;
+	}
+	Restore_File_System = Backup_FileName.substr(first_period + 1, Backup_FileName.size() - first_period - 1);
+	second_period = Restore_File_System.find(".");
+	if (second_period == string::npos) {
+		LOGE("Unable to find file system (second period).\n");
+		return false;
+	}
+	Restore_File_System.resize(second_period);
+	LOGI("Restore file system is: '%s'.\n", Restore_File_System.c_str());
+
+	if (Is_File_System(Restore_File_System))
+		return Restore_Tar(restore_folder, Restore_File_System);
+	else if (Is_Image(Restore_File_System)) {
+		if (Restore_File_System == "emmc")
+			return Restore_DD(restore_folder);
+		else if (Restore_File_System == "mtd" || Restore_File_System == "bml")
+			return Restore_Flash_Image(restore_folder);
+	}
+
 	LOGE("Unknown restore method for '%s'\n", Mount_Point.c_str());
 	return false;
 }
@@ -853,8 +885,8 @@
 	char* arg;
 	char* ptr;
 
-	if (Fstab_File_System == "yaffs2" || Fstab_File_System == "mtd" || Fstab_File_System == "bml")
-		return; // Running blkid on some mtd devices causes a massive crash
+	if (Fstab_File_System == "yaffs2" || Fstab_File_System == "mtd" || Fstab_File_System == "bml" || Ignore_Blkid)
+		return; // Running blkid on some mtd devices causes a massive crash or needs to be skipped
 
 	Find_Actual_Block_Device();
 	if (!Is_Present)
@@ -920,7 +952,7 @@
 	return;
 }
 
-bool TWPartition::Wipe_EXT23() {
+bool TWPartition::Wipe_EXT23(string File_System) {
 	if (!UnMount(true))
 		return false;
 
@@ -929,7 +961,7 @@
 
 		ui_print("Formatting %s using mke2fs...\n", Display_Name.c_str());
 		Find_Actual_Block_Device();
-		sprintf(command, "mke2fs -t %s -m 0 %s", Current_File_System.c_str(), Actual_Block_Device.c_str());
+		sprintf(command, "mke2fs -t %s -m 0 %s", File_System.c_str(), Actual_Block_Device.c_str());
 		LOGI("mke2fs command: %s\n", command);
 		if (system(command) == 0) {
 			Recreate_AndSec_Folder();
@@ -973,7 +1005,7 @@
 			return false;
 		}
 	} else
-		return Wipe_EXT23();
+		return Wipe_EXT23("ext4");
 
 	return false;
 }
@@ -1198,42 +1230,26 @@
 	return true;
 }
 
-bool TWPartition::Restore_Tar(string restore_folder) {
-	size_t first_period, second_period;
-	string Restore_File_System, Full_FileName, Command;
+bool TWPartition::Restore_Tar(string restore_folder, string Restore_File_System) {
+	string Full_FileName, Command;
 	int index = 0;
 	char split_index[5];
 
-	TWFunc::GUI_Operation_Text(TW_RESTORE_TEXT, Display_Name, "Restoring");
-	LOGI("Restore filename is: %s\n", Backup_FileName.c_str());
-
-	// Parse backup filename to extract the file system before wiping
-	first_period = Backup_FileName.find(".");
-	if (first_period == string::npos) {
-		LOGE("Unable to find file system (first period).\n");
-		return false;
-	}
-	Restore_File_System = Backup_FileName.substr(first_period + 1, Backup_FileName.size() - first_period - 1);
-	second_period = Restore_File_System.find(".");
-	if (second_period == string::npos) {
-		LOGE("Unable to find file system (second period).\n");
-		return false;
-	}
-	Restore_File_System.resize(second_period);
-	LOGI("Restore file system is: '%s'.\n", Restore_File_System.c_str());
 	Current_File_System = Restore_File_System;
 	if (Has_Android_Secure) {
 		ui_print("Wiping android secure...\n");
 		if (!Wipe_AndSec())
 			return false;
-	} else if (!Wipe()) {
+	} else {
 		ui_print("Wiping %s...\n", Display_Name.c_str());
-		return false;
+		if (!Wipe(Restore_File_System))
+		    return false;
 	}
 
 	if (!Mount(true))
 		return false;
 
+	TWFunc::GUI_Operation_Text(TW_RESTORE_TEXT, Display_Name, "Restoring");
 	ui_print("Restoring %s...\n", Display_Name.c_str());
 	Full_FileName = restore_folder + "/" + Backup_FileName;
 	if (!TWFunc::Path_Exists(Full_FileName)) {
@@ -1277,7 +1293,6 @@
 bool TWPartition::Restore_Flash_Image(string restore_folder) {
 	string Full_FileName, Command;
 
-	TWFunc::GUI_Operation_Text(TW_RESTORE_TEXT, Display_Name, "Restoring");
 	ui_print("Restoring %s...\n", Display_Name.c_str());
 	Full_FileName = restore_folder + "/" + Backup_FileName;
 	// Sometimes flash image doesn't like to flash due to the first 2KB matching, so we erase first to ensure that it flashes
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index 57e1108..536e867 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -129,68 +129,70 @@
 void TWPartitionManager::Output_Partition(TWPartition* Part) {
 	unsigned long long mb = 1048576;
 
+	printf("%s | %s | Size: %iMB", Part->Mount_Point.c_str(), Part->Actual_Block_Device.c_str(), (int)(Part->Size / mb));
 	if (Part->Can_Be_Mounted) {
-		printf("%s | %s | Size: %iMB Used: %iMB Free: %iMB Backup Size: %iMB\n   Flags: ", Part->Mount_Point.c_str(), Part->Actual_Block_Device.c_str(), (int)(Part->Size / mb), (int)(Part->Used / mb), (int)(Part->Free / mb), (int)(Part->Backup_Size / mb));
-		if (Part->Can_Be_Wiped)
-			printf("Can_Be_Wiped ");
-		if (Part->Wipe_During_Factory_Reset)
-			printf("Wipe_During_Factory_Reset ");
-		if (Part->Wipe_Available_in_GUI)
-			printf("Wipe_Available_in_GUI ");
-		if (Part->Is_SubPartition)
-			printf("Is_SubPartition ");
-		if (Part->Has_SubPartition)
-			printf("Has_SubPartition ");
-		if (Part->Removable)
-			printf("Removable ");
-		if (Part->Is_Present)
-			printf("IsPresent ");
-		if (Part->Can_Be_Encrypted)
-			printf("Can_Be_Encrypted ");
-		if (Part->Is_Encrypted)
-			printf("Is_Encrypted ");
-		if (Part->Is_Decrypted)
-			printf("Is_Decrypted ");
-		if (Part->Has_Data_Media)
-			printf("Has_Data_Media ");
-		if (Part->Has_Android_Secure)
-			printf("Has_Android_Secure ");
-		if (Part->Is_Storage)
-			printf("Is_Storage ");
-		printf("\n");
-		if (!Part->SubPartition_Of.empty())
-			printf("   SubPartition_Of: %s\n", Part->SubPartition_Of.c_str());
-		if (!Part->Symlink_Path.empty())
-			printf("   Symlink_Path: %s\n", Part->Symlink_Path.c_str());
-		if (!Part->Symlink_Mount_Point.empty())
-			printf("   Symlink_Mount_Point: %s\n", Part->Symlink_Mount_Point.c_str());
-		if (!Part->Primary_Block_Device.empty())
-			printf("   Primary_Block_Device: %s\n", Part->Primary_Block_Device.c_str());
-		if (!Part->Alternate_Block_Device.empty())
-			printf("   Alternate_Block_Device: %s\n", Part->Alternate_Block_Device.c_str());
-		if (!Part->Decrypted_Block_Device.empty())
-			printf("   Decrypted_Block_Device: %s\n", Part->Decrypted_Block_Device.c_str());
-		if (Part->Length != 0)
-			printf("   Length: %i\n", Part->Length);
-		if (!Part->Display_Name.empty())
-			printf("   Display_Name: %s\n", Part->Display_Name.c_str());
-		if (!Part->Backup_Path.empty())
-			printf("   Backup_Path: %s\n", Part->Backup_Path.c_str());
-		if (!Part->Backup_Name.empty())
-			printf("   Backup_Name: %s\n", Part->Backup_Name.c_str());
-		if (!Part->Backup_FileName.empty())
-			printf("   Backup_FileName: %s\n", Part->Backup_FileName.c_str());
-		if (!Part->Storage_Path.empty())
-			printf("   Storage_Path: %s\n", Part->Storage_Path.c_str());
-		if (!Part->Current_File_System.empty())
-			printf("   Current_File_System: %s\n", Part->Current_File_System.c_str());
-		if (!Part->Fstab_File_System.empty())
-			printf("   Fstab_File_System: %s\n", Part->Fstab_File_System.c_str());
-		if (Part->Format_Block_Size != 0)
-			printf("   Format_Block_Size: %i\n", Part->Format_Block_Size);
-	} else {
-		printf("%s | %s | Size: %iMB\n", Part->Mount_Point.c_str(), Part->Actual_Block_Device.c_str(), (int)(Part->Size / mb));
+		printf(" Used: %iMB Free: %iMB Backup Size: %iMB", (int)(Part->Used / mb), (int)(Part->Free / mb), (int)(Part->Backup_Size / mb));
 	}
+	printf("\n   Flags: ");
+	if (Part->Can_Be_Wiped)
+		printf("Can_Be_Wiped ");
+	if (Part->Wipe_During_Factory_Reset)
+		printf("Wipe_During_Factory_Reset ");
+	if (Part->Wipe_Available_in_GUI)
+		printf("Wipe_Available_in_GUI ");
+	if (Part->Is_SubPartition)
+		printf("Is_SubPartition ");
+	if (Part->Has_SubPartition)
+		printf("Has_SubPartition ");
+	if (Part->Removable)
+		printf("Removable ");
+	if (Part->Is_Present)
+		printf("IsPresent ");
+	if (Part->Can_Be_Encrypted)
+		printf("Can_Be_Encrypted ");
+	if (Part->Is_Encrypted)
+		printf("Is_Encrypted ");
+	if (Part->Is_Decrypted)
+		printf("Is_Decrypted ");
+	if (Part->Has_Data_Media)
+		printf("Has_Data_Media ");
+	if (Part->Has_Android_Secure)
+		printf("Has_Android_Secure ");
+	if (Part->Is_Storage)
+		printf("Is_Storage ");
+	if (Part->Ignore_Blkid)
+		printf("Ignore_Blkid ");
+	printf("\n");
+	if (!Part->SubPartition_Of.empty())
+		printf("   SubPartition_Of: %s\n", Part->SubPartition_Of.c_str());
+	if (!Part->Symlink_Path.empty())
+		printf("   Symlink_Path: %s\n", Part->Symlink_Path.c_str());
+	if (!Part->Symlink_Mount_Point.empty())
+		printf("   Symlink_Mount_Point: %s\n", Part->Symlink_Mount_Point.c_str());
+	if (!Part->Primary_Block_Device.empty())
+		printf("   Primary_Block_Device: %s\n", Part->Primary_Block_Device.c_str());
+	if (!Part->Alternate_Block_Device.empty())
+		printf("   Alternate_Block_Device: %s\n", Part->Alternate_Block_Device.c_str());
+	if (!Part->Decrypted_Block_Device.empty())
+		printf("   Decrypted_Block_Device: %s\n", Part->Decrypted_Block_Device.c_str());
+	if (Part->Length != 0)
+		printf("   Length: %i\n", Part->Length);
+	if (!Part->Display_Name.empty())
+		printf("   Display_Name: %s\n", Part->Display_Name.c_str());
+	if (!Part->Backup_Path.empty())
+		printf("   Backup_Path: %s\n", Part->Backup_Path.c_str());
+	if (!Part->Backup_Name.empty())
+		printf("   Backup_Name: %s\n", Part->Backup_Name.c_str());
+	if (!Part->Backup_FileName.empty())
+		printf("   Backup_FileName: %s\n", Part->Backup_FileName.c_str());
+	if (!Part->Storage_Path.empty())
+		printf("   Storage_Path: %s\n", Part->Storage_Path.c_str());
+	if (!Part->Current_File_System.empty())
+		printf("   Current_File_System: %s\n", Part->Current_File_System.c_str());
+	if (!Part->Fstab_File_System.empty())
+		printf("   Fstab_File_System: %s\n", Part->Fstab_File_System.c_str());
+	if (Part->Format_Block_Size != 0)
+		printf("   Format_Block_Size: %i\n", Part->Format_Block_Size);
 	if (!Part->MTD_Name.empty())
 		printf("   MTD_Name: %s\n", Part->MTD_Name.c_str());
 	string back_meth = Part->Backup_Method_By_Name();
diff --git a/partitions.hpp b/partitions.hpp
index 83e9243..2c3ad71 100644
--- a/partitions.hpp
+++ b/partitions.hpp
@@ -49,6 +49,7 @@
 	virtual bool Is_Mounted();                                                // Checks mount to see if the partition is currently mounted
 	virtual bool Mount(bool Display_Error);                                   // Mounts the partition if it is not mounted
 	virtual bool UnMount(bool Display_Error);                                 // Unmounts the partition if it is mounted
+	virtual bool Wipe(string New_File_System);                                // Wipes the partition
 	virtual bool Wipe();                                                      // Wipes the partition
 	virtual bool Wipe_AndSec();                                               // Wipes android secure
 	virtual bool Backup(string backup_folder);                                // Backs up the partition to the folder specified
@@ -105,6 +106,7 @@
 	string Storage_Path;                                                      // Indicates the path to the storage -- root indicates mount point, media/ indicates e.g. /data/media
 	string Fstab_File_System;                                                 // File system from the recovery.fstab
 	int Format_Block_Size;                                                    // Block size for formatting
+	bool Ignore_Blkid;                                                        // Ignore blkid results due to superblocks lying to us on certain devices / partitions
 
 private:
 	bool Process_Flags(string Flags, bool Display_Error);                     // Process custom fstab flags
@@ -116,7 +118,7 @@
 	void Find_Real_Block_Device(string& Block_Device, bool Display_Error);    // Checks the block device given and follows symlinks until it gets to the real block device
 	bool Find_Partition_Size();                                               // Finds the partition size from /proc/partitions
 	unsigned long long Get_Size_Via_du(string Path, bool Display_Error);      // Uses du to get sizes
-	bool Wipe_EXT23();                                                        // Formats as ext3 or ext2
+	bool Wipe_EXT23(string File_System);                                      // Formats as ext3 or ext2
 	bool Wipe_EXT4();                                                         // Formats using ext4, uses make_ext4fs when present
 	bool Wipe_FAT();                                                          // Formats as FAT except that mkdosfs from busybox usually fails so oftentimes this is actually a rm -rf wipe
 	bool Wipe_MTD();                                                          // Formats as yaffs2 for MTD memory types
@@ -125,7 +127,7 @@
 	bool Backup_Tar(string backup_folder);                                    // Backs up using tar for file systems
 	bool Backup_DD(string backup_folder);                                     // Backs up using dd for emmc memory types
 	bool Backup_Dump_Image(string backup_folder);                             // Backs up using dump_image for MTD memory types
-	bool Restore_Tar(string restore_folder);                                  // Restore using tar for file systems
+	bool Restore_Tar(string restore_folder, string Restore_File_System);      // Restore using tar for file systems
 	bool Restore_DD(string restore_folder);                                   // Restore using dd for emmc memory types
 	bool Restore_Flash_Image(string restore_folder);                          // Restore using flash_image for MTD memory types
 	bool Get_Size_Via_statfs(bool Display_Error);                             // Get Partition size, used, and free space using statfs