From 472c0e293ab8cab5daa9cf4c9fb90faf064b90b4 Mon Sep 17 00:00:00 2001 From: "Such Meme, Many Skill" Date: Mon, 16 Dec 2019 23:31:29 +0100 Subject: [PATCH] Spice up Console Info menu --- source/tegraexplorer/emmc.c | 6 ++++-- source/tegraexplorer/gfx.h | 3 +++ source/tegraexplorer/tools.c | 19 ++++++++++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/source/tegraexplorer/emmc.c b/source/tegraexplorer/emmc.c index 0799156..611b2bd 100644 --- a/source/tegraexplorer/emmc.c +++ b/source/tegraexplorer/emmc.c @@ -28,7 +28,7 @@ __attribute__ ((aligned (16))) FATFS emmc; LIST_INIT(gpt); u8 bis_key[4][32]; -short pkg1ver; +short pkg1ver = -1; static bool _key_exists(const void *data) { return memcmp(data, zeros, 0x10); }; @@ -44,9 +44,11 @@ static void _generate_kek(u32 ks, const void *key_source, void *master_key, cons } void print_biskeys(){ - gfx_printf("\n"); + gfx_printf("Bis_Key_00\n"); gfx_hexdump(0, bis_key[0], 32); + gfx_printf("Bis_Key_01\n"); gfx_hexdump(0, bis_key[1], 32); + gfx_printf("Bis_Key_02 & 03\n"); gfx_hexdump(0, bis_key[2], 32); } diff --git a/source/tegraexplorer/gfx.h b/source/tegraexplorer/gfx.h index 5db04b1..5b2df77 100644 --- a/source/tegraexplorer/gfx.h +++ b/source/tegraexplorer/gfx.h @@ -2,6 +2,9 @@ #include "te.h" #include "fs.h" +#define SWAPCOLOR(color) gfx_printf("%k", color) +#define RESETCOLOR gfx_printf("%k%K", COLOR_WHITE, COLOR_DEFAULT) + int makemenu(menu_item menu[], int menuamount); int message(char* message, u32 color); void clearscreen(); diff --git a/source/tegraexplorer/tools.c b/source/tegraexplorer/tools.c index 1ce2149..9622757 100644 --- a/source/tegraexplorer/tools.c +++ b/source/tegraexplorer/tools.c @@ -9,6 +9,7 @@ #include "../libs/fatfs/diskio.h" #include "../storage/sdmmc.h" #include "../utils/sprintf.h" +#include "../soc/fuse.h" #include "emmc.h" #include "fs.h" @@ -22,11 +23,24 @@ void displayinfo(){ FATFS *fs; DWORD fre_clust, fre_sect, tot_sect; u32 capacity; + u8 fuse_count = 0; int res; - gfx_printf("Biskeys:\n"); + for (u32 i = 0; i < 32; i++){ + if ((fuse_read_odm(7) >> i) & 1) + fuse_count++; + } + + SWAPCOLOR(COLOR_ORANGE); + + gfx_printf("Fuse count: %d\nPKG1 version: %d\n\n", fuse_count, returnpkg1ver()); print_biskeys(); + RESETCOLOR; + gfx_printf("\n-----\n\n"); + + SWAPCOLOR(COLOR_BLUE); + if (!sd_mount()){ gfx_printf("SD mount failed!\nFailed to display SD info\n"); } @@ -44,6 +58,7 @@ void displayinfo(){ gfx_printf("First partition on SD:\nSectors: %d\nSpace total: %d MB\nSpace free: %d MB\n\n", tot_sect, tot_sect / 2048, fre_sect / 2048); } + RESETCOLOR; gfx_printf("Press any key to continue"); btn_wait(); } @@ -141,6 +156,8 @@ int format(int mode){ timer = get_tmr_s(); totalsectors = sd_storage.csd.capacity; + // 32gb sd card size is 67108864‬? + if (mode == 0){ if (totalsectors < 61145088){ gfx_printf("%k\nNot enough free space for emummc!", COLOR_RED);