mirror of
https://github.com/Scandal-UK/Incognito_RCM.git
synced 2024-11-26 13:52:29 +00:00
- decrypting and encrypting working
- backup and restore working - add menu options - incognito todo
This commit is contained in:
parent
251477c46c
commit
5f42d12184
8 changed files with 526 additions and 616 deletions
|
@ -397,6 +397,21 @@ void gfx_printf(const char *fmt, ...)
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gfx_print_header()
|
||||||
|
{
|
||||||
|
u8 prevFontSize = gfx_con.fntsz;
|
||||||
|
gfx_con.fntsz = 14;
|
||||||
|
gfx_printf("%k ____ _ __ ____ ________ ___\n", colors[4]);
|
||||||
|
gfx_printf("%k / _/___ _________ ____ _____ (_) /_____ / __ \\/ ____/ |/ /\n", COLOR_GREEN);
|
||||||
|
gfx_printf("%k / // __ \\/ ___/ __ \\/ __ `/ __ \\/ / __/ __ \\ / /_/ / / / /|_/ / \n", COLOR_GREEN);
|
||||||
|
gfx_printf("%k _/ // / / / /__/ /_/ / /_/ / / / / / /_/ /_/ / / _, _/ /___/ / / / \n", COLOR_GREEN);
|
||||||
|
gfx_printf("%k/___/_/ /_/\\___/\\____/\\__, /_/ /_/_/\\__/\\____/____/_/ |_|\\____/_/ /_/ \n", colors[4]);
|
||||||
|
gfx_printf("%k /____/ /_____/ \n", colors[4]);
|
||||||
|
gfx_printf("%kv%d.%d.%d%k\n\n\n\n",
|
||||||
|
colors[4], LP_VER_MJ, LP_VER_MN, LP_VER_BF, 0xFFCCCCCC);
|
||||||
|
gfx_con.fntsz = prevFontSize;
|
||||||
|
}
|
||||||
|
|
||||||
void gfx_hexdump(u32 base, const u8 *buf, u32 len)
|
void gfx_hexdump(u32 base, const u8 *buf, u32 len)
|
||||||
{
|
{
|
||||||
if (gfx_con.mute)
|
if (gfx_con.mute)
|
||||||
|
|
|
@ -37,6 +37,7 @@ void gfx_con_setpos(u32 x, u32 y);
|
||||||
void gfx_putc(char c);
|
void gfx_putc(char c);
|
||||||
void gfx_puts(const char *s);
|
void gfx_puts(const char *s);
|
||||||
void gfx_printf(const char *fmt, ...);
|
void gfx_printf(const char *fmt, ...);
|
||||||
|
void gfx_print_header();
|
||||||
void gfx_hexdump(u32 base, const u8 *buf, u32 len);
|
void gfx_hexdump(u32 base, const u8 *buf, u32 len);
|
||||||
|
|
||||||
void gfx_set_pixel(u32 x, u32 y, u32 color);
|
void gfx_set_pixel(u32 x, u32 y, u32 color);
|
||||||
|
|
|
@ -112,8 +112,8 @@ void *tui_do_menu(menu_t *menu)
|
||||||
{
|
{
|
||||||
gfx_con_setcol(0xFFCCCCCC, 1, 0xFF1B1B1B);
|
gfx_con_setcol(0xFFCCCCCC, 1, 0xFF1B1B1B);
|
||||||
gfx_con_setpos(menu->x, menu->y);
|
gfx_con_setpos(menu->x, menu->y);
|
||||||
gfx_printf("[%kLo%kck%kpi%kck%k_R%kCM%k v%d.%d.%d%k]\n\n",
|
|
||||||
colors[0], colors[1], colors[2], colors[3], colors[4], colors[5], 0xFFFF00FF, LP_VER_MJ, LP_VER_MN, LP_VER_BF, 0xFFCCCCCC);
|
gfx_print_header();
|
||||||
|
|
||||||
// Skip caption or seperator lines selection.
|
// Skip caption or seperator lines selection.
|
||||||
while (menu->ents[idx].type == MENT_CAPTION ||
|
while (menu->ents[idx].type == MENT_CAPTION ||
|
||||||
|
|
1023
source/keys/keys.c
1023
source/keys/keys.c
File diff suppressed because it is too large
Load diff
|
@ -19,12 +19,14 @@
|
||||||
|
|
||||||
#include "../utils/types.h"
|
#include "../utils/types.h"
|
||||||
|
|
||||||
void dump_keys();
|
bool dump_keys();
|
||||||
|
void cleanUp();
|
||||||
bool readData(u8 *buffer, u32 offset, u32 length);
|
bool readData(u8 *buffer, u32 offset, u32 length);
|
||||||
bool writeData(u8 *buffer, u32 offset, u32 length);
|
bool writeData(u8 *buffer, u32 offset, u32 length);
|
||||||
bool writeClientCertHash();
|
bool writeClientCertHash();
|
||||||
bool writeCal0Hash();
|
bool writeCal0Hash();
|
||||||
bool verify();
|
bool verifyProdinfo();
|
||||||
bool restore();
|
bool backupProdinfo();
|
||||||
|
bool restoreProdinfo();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -197,7 +197,7 @@ DRESULT disk_write_prod (
|
||||||
|
|
||||||
// fatfs will never pull more than a cluster
|
// fatfs will never pull more than a cluster
|
||||||
_emmc_xts(9, 8, 1, tweak, regen_tweak, tweak_exp, prev_cluster, buff, buff, count * 0x200);
|
_emmc_xts(9, 8, 1, tweak, regen_tweak, tweak_exp, prev_cluster, buff, buff, count * 0x200);
|
||||||
|
nx_emmc_part_write(&storage, prodinfo_part, sector, count, buff);
|
||||||
prev_sector = sector + count - 1;
|
prev_sector = sector + count - 1;
|
||||||
return RES_OK;
|
return RES_OK;
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "storage/sdmmc.h"
|
#include "storage/sdmmc.h"
|
||||||
#include "utils/sprintf.h"
|
#include "utils/sprintf.h"
|
||||||
#include "utils/util.h"
|
#include "utils/util.h"
|
||||||
|
#include "utils/btn.h"
|
||||||
|
|
||||||
#include "keys/keys.h"
|
#include "keys/keys.h"
|
||||||
|
|
||||||
|
@ -153,6 +154,14 @@ void dump_sysnand()
|
||||||
h_cfg.emummc_force_disable = true;
|
h_cfg.emummc_force_disable = true;
|
||||||
b_cfg.extra_cfg &= ~EXTRA_CFG_DUMP_EMUMMC;
|
b_cfg.extra_cfg &= ~EXTRA_CFG_DUMP_EMUMMC;
|
||||||
dump_keys();
|
dump_keys();
|
||||||
|
verifyProdinfo();
|
||||||
|
cleanUp();
|
||||||
|
// verifyProdinfo();
|
||||||
|
|
||||||
|
gfx_printf("\n%kPress any key to return to the main menu.", COLOR_GREEN);
|
||||||
|
// cleanUp();
|
||||||
|
|
||||||
|
btn_wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_emunand()
|
void dump_emunand()
|
||||||
|
@ -162,11 +171,74 @@ void dump_emunand()
|
||||||
emu_cfg.enabled = 1;
|
emu_cfg.enabled = 1;
|
||||||
b_cfg.extra_cfg |= EXTRA_CFG_DUMP_EMUMMC;
|
b_cfg.extra_cfg |= EXTRA_CFG_DUMP_EMUMMC;
|
||||||
dump_keys();
|
dump_keys();
|
||||||
|
verifyProdinfo();
|
||||||
|
cleanUp();
|
||||||
|
gfx_printf("\n%kPress any key to return to the main menu.", COLOR_GREEN);
|
||||||
|
btn_wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void backup_sysnand(){
|
||||||
|
h_cfg.emummc_force_disable = true;
|
||||||
|
b_cfg.extra_cfg &= ~EXTRA_CFG_DUMP_EMUMMC;
|
||||||
|
dump_keys();
|
||||||
|
|
||||||
|
backupProdinfo();
|
||||||
|
verifyProdinfo();
|
||||||
|
cleanUp();
|
||||||
|
gfx_printf("\n%kPress any key to return to the main menu.", COLOR_GREEN);
|
||||||
|
btn_wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
void backup_emunand(){
|
||||||
|
if (h_cfg.emummc_force_disable)
|
||||||
|
return;
|
||||||
|
emu_cfg.enabled = 1;
|
||||||
|
b_cfg.extra_cfg |= EXTRA_CFG_DUMP_EMUMMC;
|
||||||
|
dump_keys();
|
||||||
|
|
||||||
|
backupProdinfo();
|
||||||
|
verifyProdinfo();
|
||||||
|
cleanUp();
|
||||||
|
gfx_printf("\n%kPress any key to return to the main menu.", COLOR_GREEN);
|
||||||
|
btn_wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
void restore_sysnand(){
|
||||||
|
h_cfg.emummc_force_disable = true;
|
||||||
|
b_cfg.extra_cfg &= ~EXTRA_CFG_DUMP_EMUMMC;
|
||||||
|
dump_keys();
|
||||||
|
|
||||||
|
restoreProdinfo();
|
||||||
|
verifyProdinfo();
|
||||||
|
cleanUp();
|
||||||
|
gfx_printf("\n%kPress any key to return to the main menu.", COLOR_GREEN);
|
||||||
|
btn_wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
void restore_emunand(){
|
||||||
|
if (h_cfg.emummc_force_disable)
|
||||||
|
return;
|
||||||
|
emu_cfg.enabled = 1;
|
||||||
|
b_cfg.extra_cfg |= EXTRA_CFG_DUMP_EMUMMC;
|
||||||
|
|
||||||
|
dump_keys();
|
||||||
|
|
||||||
|
restoreProdinfo();
|
||||||
|
verifyProdinfo();
|
||||||
|
cleanUp();
|
||||||
|
gfx_printf("\n%kPress any key to return to the main menu.", COLOR_GREEN);
|
||||||
|
btn_wait();
|
||||||
|
}
|
||||||
ment_t ment_top[] = {
|
ment_t ment_top[] = {
|
||||||
MDEF_HANDLER("Dump keys from SysNAND", dump_sysnand, COLOR_RED),
|
MDEF_HANDLER("Incognito (SysNAND)", dump_sysnand, COLOR_ORANGE),
|
||||||
MDEF_HANDLER("Dump keys from emuMMC", dump_emunand, COLOR_ORANGE),
|
MDEF_HANDLER("Incognito (emuMMC)", dump_emunand, COLOR_ORANGE),
|
||||||
|
MDEF_CAPTION("", COLOR_YELLOW),
|
||||||
|
MDEF_HANDLER("Backup (SysNAND)", backup_sysnand, COLOR_ORANGE),
|
||||||
|
MDEF_HANDLER("Backup (emuMMC)", backup_emunand, COLOR_ORANGE),
|
||||||
|
MDEF_CAPTION("", COLOR_YELLOW),
|
||||||
|
MDEF_HANDLER("Restore (SysNAND)", restore_sysnand, COLOR_ORANGE),
|
||||||
|
MDEF_HANDLER("Restore (emuMMC)", restore_emunand, COLOR_ORANGE),
|
||||||
|
MDEF_CAPTION("", COLOR_YELLOW),
|
||||||
MDEF_CAPTION("---------------", COLOR_YELLOW),
|
MDEF_CAPTION("---------------", COLOR_YELLOW),
|
||||||
MDEF_HANDLER("Reboot (Normal)", reboot_normal, COLOR_GREEN),
|
MDEF_HANDLER("Reboot (Normal)", reboot_normal, COLOR_GREEN),
|
||||||
MDEF_HANDLER("Reboot (RCM)", reboot_rcm, COLOR_BLUE),
|
MDEF_HANDLER("Reboot (RCM)", reboot_rcm, COLOR_BLUE),
|
||||||
|
|
|
@ -74,5 +74,6 @@ int nx_emmc_part_write(sdmmc_storage_t *storage, emmc_part_t *part, u32 sector_o
|
||||||
// The last LBA is inclusive.
|
// The last LBA is inclusive.
|
||||||
if (part->lba_start + sector_off > part->lba_end)
|
if (part->lba_start + sector_off > part->lba_end)
|
||||||
return 0;
|
return 0;
|
||||||
return sdmmc_storage_write(storage, part->lba_start + sector_off, num_sectors, buf);
|
//return sdmmc_storage_write(storage, part->lba_start + sector_off, num_sectors, buf);
|
||||||
|
return emummc_storage_write(storage, part->lba_start + sector_off, num_sectors, buf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue