Handle write permissions for SD data

This commit is contained in:
d0k3 2016-10-29 17:15:16 +02:00
parent a9f3b1d6ea
commit 779b6fe25b
3 changed files with 17 additions and 9 deletions

View File

@ -208,13 +208,7 @@ bool CheckWritePermissions(const char* path) {
int drvtype = DriveType(path); int drvtype = DriveType(path);
u32 perm; u32 perm;
if (drvtype & DRV_SDCARD) { if (drvtype & DRV_SYSNAND) {
perm = PERM_SDCARD;
snprintf(area_name, 16, "the SD card");
} else if (drvtype & DRV_RAMDRIVE) {
perm = PERM_RAMDRIVE;
snprintf(area_name, 16, "the RAM drive");
} else if (drvtype & DRV_SYSNAND) {
perm = PERM_SYSNAND; perm = PERM_SYSNAND;
snprintf(area_name, 16, "the SysNAND"); snprintf(area_name, 16, "the SysNAND");
// check virtual file flags (if any) // check virtual file flags (if any)
@ -232,6 +226,15 @@ bool CheckWritePermissions(const char* path) {
} else if (drvtype & DRV_MEMORY) { } else if (drvtype & DRV_MEMORY) {
perm = PERM_MEMORY; perm = PERM_MEMORY;
snprintf(area_name, 16, "memory areas"); snprintf(area_name, 16, "memory areas");
} else if ((drvtype & DRV_ALIAS) || (strncmp(path, "0:/Nintendo 3DS", 15) == 0)) {
perm = PERM_SDDATA;
snprintf(area_name, 16, "SD system data");
} else if (drvtype & DRV_SDCARD) {
perm = PERM_SDCARD;
snprintf(area_name, 16, "the SD card");
} else if (drvtype & DRV_RAMDRIVE) {
perm = PERM_RAMDRIVE;
snprintf(area_name, 16, "the RAM drive");
} else { } else {
return false; return false;
} }
@ -273,6 +276,10 @@ bool SetWritePermissions(u32 perm, bool add_perm) {
if (!ShowUnlockSequence(2, "You want to enable image\nwriting permissions.")) if (!ShowUnlockSequence(2, "You want to enable image\nwriting permissions."))
return false; return false;
break; break;
case PERM_SDDATA:
if (!ShowUnlockSequence(2, "You want to enable SD data\nwriting permissions."))
return false;
break;
#ifndef SAFEMODE #ifndef SAFEMODE
case PERM_SYSNAND: case PERM_SYSNAND:
if (!ShowUnlockSequence(3, "!Better be careful!\n \nYou want to enable SysNAND\nwriting permissions.\nThis enables you to do some\nreally dangerous stuff!")) if (!ShowUnlockSequence(3, "!Better be careful!\n \nYou want to enable SysNAND\nwriting permissions.\nThis enables you to do some\nreally dangerous stuff!"))

View File

@ -34,8 +34,9 @@ typedef enum {
#define PERM_IMAGE (1<<4) #define PERM_IMAGE (1<<4)
#define PERM_MEMORY (1<<5) #define PERM_MEMORY (1<<5)
#define PERM_A9LH ((1<<6) | PERM_SYSNAND) #define PERM_A9LH ((1<<6) | PERM_SYSNAND)
#define PERM_SDDATA ((1<<7) | PERM_SDCARD)
#define PERM_BASE (PERM_SDCARD | PERM_RAMDRIVE) #define PERM_BASE (PERM_SDCARD | PERM_RAMDRIVE)
#define PERM_ALL (PERM_SDCARD | PERM_RAMDRIVE | PERM_EMUNAND | PERM_SYSNAND | PERM_IMAGE | PERM_MEMORY) #define PERM_ALL (PERM_SDCARD | PERM_RAMDRIVE | PERM_EMUNAND | PERM_SYSNAND | PERM_IMAGE | PERM_MEMORY | PERM_SDDATA)
// move / copy flags // move / copy flags
#define ASK_ALL (1<<0) #define ASK_ALL (1<<0)

View File

@ -7,7 +7,7 @@
#include "virtual.h" #include "virtual.h"
#include "image.h" #include "image.h"
#define VERSION "0.7.0" #define VERSION "0.7.1"
#define N_PANES 2 #define N_PANES 2
#define IMG_DRV "789I" #define IMG_DRV "789I"