Skip to content

Commit a1ae52e

Browse files
show key error upon mounting mmc and fix small files in hex view
1 parent bb4361c commit a1ae52e

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

source/fs/menus/filemenu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void HexView(char *path, FSEntry_t entry){
130130
hidRead();
131131

132132
gfx_clearscreen();
133-
print = malloc(2048);
133+
print = calloc(2048, 1);
134134

135135
if ((res = f_open(&in, filePath, FA_READ | FA_OPEN_EXISTING))){
136136
DrawError(newErrCode(res));
@@ -146,7 +146,7 @@ void HexView(char *path, FSEntry_t entry){
146146
}
147147

148148
gfx_con_setpos(0, 31);
149-
gfx_hexdump(offset * 32, print, size);
149+
gfx_hexdump(offset * 32, print, ((size + 31) / 32) * 32);
150150

151151
input = hidRead();
152152

source/storage/emmcfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ ErrCode_t DumpOrWriteEmmcPart(const char *path, const char *part, u8 write, u8 f
171171
if (!system_part)
172172
return newErrCode(TE_ERR_PARTITION_NOT_FOUND);
173173

174-
if (isSystemPartCrypt(system_part)){
174+
if (isSystemPartCrypt(system_part) && TConf.keysDumped){
175175
nx_emmc_bis_init(system_part);
176176
crypt = true;
177177
lba_start = 0;

source/storage/gptmenu.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,16 @@ void GptMenu(u8 MMCType){
108108
}
109109
else if (entries[res].icon == 127){
110110
unmountMMCPart();
111-
ErrCode_t err = mountMMCPart(entries[res].name);
111+
ErrCode_t err = (TConf.keysDumped) ? mountMMCPart(entries[res].name) : newErrCode(TE_ERR_KEYDUMP_FAIL);
112112
if (err.err){
113113
DrawError(err);
114114
}
115115
else {
116-
if (TConf.keysDumped){
117-
if (TConf.curExplorerLoc > LOC_SD)
118-
ResetCopyParams();
116+
if (TConf.curExplorerLoc > LOC_SD)
117+
ResetCopyParams();
119118

120-
TConf.curExplorerLoc = LOC_EMMC;
121-
FileExplorer("bis:/");
122-
}
119+
TConf.curExplorerLoc = LOC_EMMC;
120+
FileExplorer("bis:/");
123121
}
124122
}
125123
else {

0 commit comments

Comments
 (0)