1
0
Fork 0
mirror of https://github.com/s1204IT/Lockpick_RCM.git synced 2024-11-29 21:12:10 +00:00

main: Read key generation from bct instead of pkg1

This commit is contained in:
shchmue 2020-07-02 13:05:22 -06:00
parent 5ed601dd4b
commit acc11300e5

View file

@ -23,7 +23,6 @@
#include <gfx/di.h> #include <gfx/di.h>
#include <gfx_utils.h> #include <gfx_utils.h>
#include "gfx/tui.h" #include "gfx/tui.h"
#include "hos/pkg1.h"
#include <libs/fatfs/ff.h> #include <libs/fatfs/ff.h>
#include <mem/heap.h> #include <mem/heap.h>
#include <mem/minerva.h> #include <mem/minerva.h>
@ -298,31 +297,27 @@ void _get_key_generations(char *sysnand_label, char *emunand_label)
sdmmc_t sdmmc; sdmmc_t sdmmc;
sdmmc_storage_t storage; sdmmc_storage_t storage;
sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400); sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400);
u8 *pkg1 = (u8 *)malloc(NX_EMMC_BLOCKSIZE); u8 *bct = (u8 *)malloc(NX_EMMC_BLOCKSIZE);
sdmmc_storage_set_mmc_partition(&storage, EMMC_BOOT0); sdmmc_storage_set_mmc_partition(&storage, EMMC_BOOT0);
sdmmc_storage_read(&storage, 0x100000 / NX_EMMC_BLOCKSIZE, 1, pkg1); sdmmc_storage_read(&storage, 0x2200 / NX_EMMC_BLOCKSIZE, 1, bct);
const pkg1_id_t *pkg1_id = pkg1_identify(pkg1);
sdmmc_storage_end(&storage); sdmmc_storage_end(&storage);
if (pkg1_id) sprintf(sysnand_label + 36, "% 3d", bct[0x130] - 1);
sprintf(sysnand_label + 36, "% 3d", pkg1_id->kb);
ment_top[0].caption = sysnand_label; ment_top[0].caption = sysnand_label;
if (h_cfg.emummc_force_disable) if (h_cfg.emummc_force_disable)
{ {
free(pkg1); free(bct);
return; return;
} }
emummc_storage_init_mmc(&storage, &sdmmc); emummc_storage_init_mmc(&storage, &sdmmc);
memset(pkg1, 0, NX_EMMC_BLOCKSIZE); memset(bct, 0, NX_EMMC_BLOCKSIZE);
emummc_storage_set_mmc_partition(&storage, EMMC_BOOT0); emummc_storage_set_mmc_partition(&storage, EMMC_BOOT0);
emummc_storage_read(&storage, 0x100000 / NX_EMMC_BLOCKSIZE, 1, pkg1); emummc_storage_read(&storage, 0x2200 / NX_EMMC_BLOCKSIZE, 1, bct);
pkg1_id = pkg1_identify(pkg1);
emummc_storage_end(&storage); emummc_storage_end(&storage);
if (pkg1_id) sprintf(emunand_label + 36, "% 3d", bct[0x130] - 1);
sprintf(emunand_label + 36, "% 3d", pkg1_id->kb); free(bct);
free(pkg1);
ment_top[1].caption = emunand_label; ment_top[1].caption = emunand_label;
} }