1
0
Fork 0
mirror of https://github.com/Scandal-UK/Incognito_RCM.git synced 2024-11-22 20:06:42 +00:00

testing some things - yep, should be another branch

This commit is contained in:
James Tophoven 2019-10-04 16:22:24 +02:00
parent e3adf0fe96
commit ee01f32e53
3 changed files with 55 additions and 19 deletions

View file

@ -61,6 +61,7 @@ u32 start_time, end_time;
#define ENCRYPTED 1 #define ENCRYPTED 1
#define DECRYPTED 0 #define DECRYPTED 0
#define SECTORS_IN_CLUSTER 32 #define SECTORS_IN_CLUSTER 32
#define PRODINFO_SIZE 0x3FBC00
static u8 temp_key[0x10], static u8 temp_key[0x10],
@ -542,22 +543,26 @@ bool writeHash(u32 hashOffset, u32 offset, u32 sz)
return true; return true;
} }
// void test(){ void test(){
// u32 size = 32768; u32 size = 262144;
// u8 *buffer = (u8 *)malloc(NX_EMMC_BLOCKSIZE); gfx_printf("%kTest reading %s bytes\n", COLOR_ORANGE, size);
// u8* bigBuffer = (u8 *)malloc(size); u8 *buffer = (u8 *)malloc(NX_EMMC_BLOCKSIZE);
// u32 offset = 0; u8* bigBuffer = (u8 *)malloc(size);
// readData(bigBuffer, 0, size, ENCRYPTED); u32 offset = 0;
// while(size > NX_EMMC_BLOCKSIZE){ readData(bigBuffer, 0, size, ENCRYPTED);
// readData(buffer, offset, NX_EMMC_BLOCKSIZE, ENCRYPTED); while(size > NX_EMMC_BLOCKSIZE){
// if(memcmp(buffer, bigBuffer + offset, NX_EMMC_BLOCKSIZE) != 0){ readData(buffer, offset, NX_EMMC_BLOCKSIZE, ENCRYPTED);
// gfx_printf("arry mismatch on offset %d", offset); if(memcmp(buffer, bigBuffer + offset, NX_EMMC_BLOCKSIZE) != 0){
gfx_printf("arry mismatch on offset %d", offset);
// } }
// size -= NX_EMMC_BLOCKSIZE; size -= NX_EMMC_BLOCKSIZE;
// offset += NX_EMMC_BLOCKSIZE; offset += NX_EMMC_BLOCKSIZE;
// } }
// } free(buffer);
free(bigBuffer);
gfx_printf("%Reading Done!\n", COLOR_ORANGE, size);
}
bool verifyHash(u32 hashOffset, u32 offset, u32 sz) bool verifyHash(u32 hashOffset, u32 offset, u32 sz)
{ {
@ -657,6 +662,31 @@ void print_progress(size_t count, size_t max)
free(buffer); free(buffer);
} }
bool getLastBackup(){
DIR dir;
//char* path = "sd:/incognito";
char path[255];
strcpy(path, "sd:/incognito");
FILINFO fno;
FRESULT res;
res = f_opendir(&dir, path); /* Open the directory */
if (res == FR_OK) {
for (;;) {
res = f_readdir(&dir, &fno); /* Read a directory item */
if (res != FR_OK || fno.fname[0] == 0) break; /* Break on error or end of dir */
if ((fno.fattrib & AM_DIR) == 0) { /* It is not a directory */
gfx_printf("%s/%s\n", path, fno.fname);
}
}
f_closedir(&dir);
}
return res;
}
bool backupProdinfo() bool backupProdinfo()
{ {
char *name; char *name;
@ -679,7 +709,7 @@ bool backupProdinfo()
FIL fp; FIL fp;
f_open(&fp, name, FA_CREATE_ALWAYS | FA_WRITE); f_open(&fp, name, FA_CREATE_ALWAYS | FA_WRITE);
u8 *bufferNX = (u8 *)malloc(NX_EMMC_BLOCKSIZE); u8 *bufferNX = (u8 *)malloc(NX_EMMC_BLOCKSIZE);
u32 size = 0x3FBC00; u32 size = PRODINFO_SIZE;
u8 percentDone = 0; u8 percentDone = 0;
u32 offset = 0; u32 offset = 0;
@ -749,7 +779,7 @@ bool restoreProdinfo()
} }
u8 bufferNX[NX_EMMC_BLOCKSIZE]; u8 bufferNX[NX_EMMC_BLOCKSIZE];
u32 size = 0x3FBC00; u32 size = PRODINFO_SIZE;
u8 percentDone = 0; u8 percentDone = 0;
u32 offset = 0; u32 offset = 0;

View file

@ -19,6 +19,10 @@
#include "../utils/types.h" #include "../utils/types.h"
//testing
void test();
//testing
bool dump_keys(); bool dump_keys();
void incognito(); void incognito();
void cleanUp(); void cleanUp();

View file

@ -159,7 +159,8 @@ void incognito_sysnand()
cleanUp(); cleanUp();
return; return;
} }
incognito(); //incognito();
test();
verifyProdinfo(); verifyProdinfo();
cleanUp(); cleanUp();
@ -178,7 +179,8 @@ void incognito_emunand()
cleanUp(); cleanUp();
return; return;
} }
incognito(); test();
//incognito();
verifyProdinfo(); verifyProdinfo();
cleanUp(); cleanUp();
gfx_printf("\n%k---------------\n%kPress any key to return to the main menu.", COLOR_YELLOW, COLOR_ORANGE); gfx_printf("\n%k---------------\n%kPress any key to return to the main menu.", COLOR_YELLOW, COLOR_ORANGE);