min update

Signed-off-by: Damien Zhao <zdm65477730@126.com>
This commit is contained in:
Damien Zhao
2023-04-02 16:37:24 +08:00
parent c9b22b2a36
commit a093a1fbba
7 changed files with 28 additions and 10 deletions

View File

@@ -47,6 +47,7 @@ char *GetFileAttribs(FSEntry_t entry){
return ret;
}
// Returns 1 if a file exists, 0 if it does not
bool FileExists(const char* path){
FRESULT fr;
FILINFO fno;

View File

@@ -74,6 +74,7 @@ void FileExplorer(char *path){
res = 0;
res = newMenu(&entries, res, 60, 42, ENABLEB | ENABLEPAGECOUNT, (int)fileVec.count);
vecFree(entries);
char *oldPath = storedPath;
@@ -125,6 +126,7 @@ void FileExplorer(char *path){
else if (res < ARR_LEN(topEntries)) {
if (!strcmp(storedPath, path)){
clearFileVector(&fileVec);
free(storedPath);
return;
}

View File

@@ -1,4 +1,7 @@
#pragma once
#include "../../utils/vector.h"
#include "../../gfx/menu.h"
#include "../fstypes.h"
void FileExplorer(char *path);
void FileExplorer(char *path);
MenuEntry_t MakeMenuOutFSEntry(FSEntry_t entry);

View File

@@ -50,10 +50,21 @@ static const pkg1_id_t _pkg1_ids[] = {
{ NULL } //End.
};
#define KB_FIRMWARE_VERSION_MAX 11
const pkg1_id_t *pkg1_identify(u8 *pkg1)
{
for (u32 i = 0; _pkg1_ids[i].id; i++)
if (!memcmp(pkg1 + 0x10, _pkg1_ids[i].id, 8))
return &_pkg1_ids[i];
return NULL;
char build_date[15];
memcpy(build_date, (char *)(pkg1 + 0x10), 14);
build_date[14] = 0;
if (*(pkg1 + 0xE) != KB_FIRMWARE_VERSION_MAX + 1) {
return NULL;
}
return &_pkg1_ids[ARRAY_SIZE(_pkg1_ids)-1];
}

View File

@@ -259,9 +259,9 @@ static ALWAYS_INLINE u8 *_read_pkg1(const pkg1_id_t **pkg1_id) {
*pkg1_id = pkg1_identify(pkg1 + pk1_offset);
if (!*pkg1_id) {
DPRINTF("Unknown pkg1 version.\n Make sure you have the latest Lockpick_RCM.\n If a new firmware version just came out,\n Lockpick_RCM must be updated.\n Check Github for new release.");
//gfx_hexdump(0, pkg1, 0x20);
//gfx_hexdump(0, pkg1 + pk1_offset, 0x20);
char pkg1txt[16] = {0};
memcpy(pkg1txt, pkg1 + pk1_offset + 0x10, 15);
memcpy(pkg1txt, pkg1 + pk1_offset + 0x10, 14);
gfx_printf("Unknown pkg1 version\nMake sure you have the latest version of TegraExplorer\n\nPKG1: '%s'\n", pkg1txt);
return NULL;
}
@@ -272,9 +272,6 @@ static ALWAYS_INLINE u8 *_read_pkg1(const pkg1_id_t **pkg1_id) {
key_derivation_ctx_t __attribute__((aligned(4))) dumpedKeys = {0};
int DumpKeys(){
if (h_cfg.t210b01) // i'm not even attempting to dump on mariko
return 2;
const pkg1_id_t *pkg1_id;
u8 *pkg1 = _read_pkg1(&pkg1_id);
if (!pkg1) {
@@ -284,6 +281,11 @@ int DumpKeys(){
TConf.pkg1ID = pkg1_id->id;
TConf.pkg1ver = (u8)pkg1_id->kb;
if (h_cfg.t210b01) {// i'm not even attempting to dump on mariko
free(pkg1);
return 2;
}
bool res = true;
tsec_ctxt_t tsec_ctxt;

View File

@@ -32,7 +32,7 @@
#include <soc/bpmp.h>
#include <soc/hw_init.h>
#include "storage/emummc.h"
#include "storage/emmc.h"
#include <storage/emmc.h>
#include <storage/sd.h>
#include <storage/sdmmc.h>
#include <utils/btn.h>

View File

@@ -120,7 +120,6 @@ void DumpSysFw(){
}
extern sdmmc_storage_t sd_storage;
extern bool is_sd_inited;
MenuEntry_t FatAndEmu[] = {
{.optionUnion = COLORTORGB(COLOR_ORANGE), .name = "Back to main menu"},
@@ -135,7 +134,7 @@ void FormatSD(){
bool emummc = 0;
int res;
if (!is_sd_inited || sd_get_card_removed())
if (!sd_get_card_initialized() || sd_get_card_removed())
return;
gfx_printf("\nDo you want to partition for an emummc?\n");