Add a warning when overwriting A9LH

This commit is contained in:
d0k3 2016-04-22 17:47:13 +02:00
parent d9fa450e66
commit 9e4c073933
3 changed files with 19 additions and 8 deletions

View File

@ -218,6 +218,15 @@ bool PathCopyVirtual(const char* destdir, const char* orig) {
TruncateString(deststr, dest, 36, 8);
TruncateString(origstr, orig, 36, 8);
if (GetVirtualSource(dest)) { // check destination file flags
VirtualFile dvfile;
if (!FindVirtualFile(&dvfile, dest, 0))
return false;
if ((dvfile.flags & VFLAG_A9LH_AREA) &&
!ShowPrompt(true, "This is critical for A9LH:\n%s\nProceed writing to it?", deststr))
return false;
}
if (GetVirtualSource(dest) && GetVirtualSource(orig)) { // virtual to virtual
VirtualFile dvfile;
VirtualFile ovfile;

View File

@ -16,19 +16,19 @@ VirtualFile virtualFileTemplates[] = {
{ "twln.bin" , 0x00012E00, 0x08FB5200, 0x03, VFLAG_ON_NAND },
{ "twlp.bin" , 0x09011A00, 0x020B6600, 0x03, VFLAG_ON_NAND },
{ "agbsave.bin" , 0x0B100000, 0x00030000, 0x07, VFLAG_ON_NAND },
{ "firm0.bin" , 0x0B130000, 0x00400000, 0x06, VFLAG_ON_NAND },
{ "firm1.bin" , 0x0B530000, 0x00400000, 0x06, VFLAG_ON_NAND },
{ "firm0.bin" , 0x0B130000, 0x00400000, 0x06, VFLAG_ON_NAND | VFLAG_A9LH_AREA},
{ "firm1.bin" , 0x0B530000, 0x00400000, 0x06, VFLAG_ON_NAND | VFLAG_A9LH_AREA},
{ "ctrnand_fat.bin" , 0x0B95CA00, 0x2F3E3600, 0x04, VFLAG_ON_O3DS },
{ "ctrnand_fat.bin" , 0x0B95AE00, 0x41D2D200, 0x05, VFLAG_ON_N3DS },
{ "ctrnand_fat.bin" , 0x0B95AE00, 0x41D2D200, 0x04, VFLAG_ON_NO3DS },
{ "ctrnand_full.bin" , 0x0B930000, 0x2F5D0000, 0x04, VFLAG_ON_O3DS },
{ "ctrnand_full.bin" , 0x0B930000, 0x41ED0000, 0x05, VFLAG_ON_N3DS },
{ "ctrnand_full.bin" , 0x0B930000, 0x41ED0000, 0x04, VFLAG_ON_NO3DS },
{ "nand.bin" , 0x00000000, 0x00000000, 0xFF, VFLAG_ON_NAND | VFLAG_NAND_SIZE },
{ "nand_minsize.bin" , 0x00000000, 0x3AF00000, 0xFF, VFLAG_ON_O3DS },
{ "nand_minsize.bin" , 0x00000000, 0x4D800000, 0xFF, VFLAG_ON_N3DS | VFLAG_ON_NO3DS },
{ "sector0x96.bin" , 0x00012C00, 0x00000200, 0xFF, VFLAG_ON_NAND },
{ "nand_hdr.bin" , 0x00000000, 0x00000200, 0xFF, VFLAG_ON_NAND },
{ "nand.bin" , 0x00000000, 0x00000000, 0xFF, VFLAG_ON_NAND | VFLAG_NAND_SIZE | VFLAG_A9LH_AREA },
{ "nand_minsize.bin" , 0x00000000, 0x3AF00000, 0xFF, VFLAG_ON_O3DS | VFLAG_A9LH_AREA},
{ "nand_minsize.bin" , 0x00000000, 0x4D800000, 0xFF, VFLAG_ON_N3DS | VFLAG_ON_NO3DS | VFLAG_A9LH_AREA },
{ "sector0x96.bin" , 0x00012C00, 0x00000200, 0xFF, VFLAG_ON_NAND | VFLAG_A9LH_AREA },
{ "nand_hdr.bin" , 0x00000000, 0x00000200, 0xFF, VFLAG_ON_NAND | VFLAG_A9LH_AREA },
{ "itcm.mem" , 0x01FF8000, 0x00008000, 0xFF, VFLAG_ON_MEMORY },
{ "arm9.mem" , 0x08000000, 0x00100000, 0xFF, VFLAG_ON_MEMORY },
{ "arm9ext.mem" , 0x08010000, 0x00100000, 0xFF, VFLAG_ON_MEMORY | VFLAG_N3DS_ONLY },
@ -99,6 +99,8 @@ bool FindVirtualFile(VirtualFile* vfile, const char* path, u32 size)
// process special flags
if ((vfile->keyslot == 0x05) && !CheckSlot0x05Crypto())
return false; // keyslot 0x05 not properly set up
if (!(virtual_src & VRT_SYSNAND) || (*(vu32*) 0x101401C0))
vfile->flags &= ~VFLAG_A9LH_AREA; // flag is meaningless outside of A9LH / SysNAND
if ((vfile->flags & VFLAG_N3DS_ONLY) && (GetUnitPlatform() != PLATFORM_N3DS))
return false; // this is not on O3DS consoles
if (vfile->flags & VFLAG_NAND_SIZE) {

View File

@ -8,7 +8,7 @@
#define VRT_IMGNAND NAND_IMGNAND
#define VRT_MEMORY (1<<10)
#define VFLAG_EXT_A9LH_AREA (1<<20)
#define VFLAG_A9LH_AREA (1<<20)
static const char* virtualFileList[] = { // must have a match in virtualFileTemplates[]
"twln.bin", "twlp.bin", "agbsave.bin", "firm0.bin", "firm1.bin", "ctrnand_fat.bin",