mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-29 23:32:06 +00:00
print hex
This commit is contained in:
parent
b0094f133c
commit
8731550688
6 changed files with 59 additions and 8 deletions
|
@ -6134,7 +6134,7 @@ FRESULT f_fdisk (
|
||||||
sz_part = (DWORD)sz_cyl * p_cyl;
|
sz_part = (DWORD)sz_cyl * p_cyl;
|
||||||
if (i == 0) { /* Exclude first track of cylinder 0 */
|
if (i == 0) { /* Exclude first track of cylinder 0 */
|
||||||
s_hd = 1;
|
s_hd = 1;
|
||||||
s_part += 32831; sz_part -= 32831;
|
s_part += 32768; sz_part -= 32768;
|
||||||
} else {
|
} else {
|
||||||
s_hd = 0;
|
s_hd = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,15 +17,16 @@ u8 clipboardhelper = 0;
|
||||||
extern const char sizevalues[4][3];
|
extern const char sizevalues[4][3];
|
||||||
extern int launch_payload(char *path);
|
extern int launch_payload(char *path);
|
||||||
|
|
||||||
menu_item explfilemenu[8] = {
|
menu_item explfilemenu[9] = {
|
||||||
{"-- File Menu --", COLOR_BLUE, -1, 0},
|
{"-- File Menu --", COLOR_BLUE, -1, 0},
|
||||||
{"FILE", COLOR_GREEN, -1, 0},
|
{"FILE", COLOR_GREEN, -1, 0},
|
||||||
{"\nSIZE", COLOR_VIOLET, -1, 0},
|
{"\nSIZE", COLOR_VIOLET, -1, 0},
|
||||||
{"\n\n\nBack", COLOR_WHITE, -1, 1},
|
{"\n\n\nBack", COLOR_WHITE, -1, 1},
|
||||||
{"\nCopy to clipboard", COLOR_BLUE, COPY, 1},
|
{"\nCopy to clipboard", COLOR_BLUE, COPY, 1},
|
||||||
{"Move to clipboard", COLOR_BLUE, MOVE, 1},
|
{"Move to clipboard", COLOR_BLUE, MOVE, 1},
|
||||||
{"\nDelete file", COLOR_RED, DELETE, 1},
|
{"\nDelete file\n", COLOR_RED, DELETE, 1},
|
||||||
{"\nLaunch Payload", COLOR_ORANGE, PAYLOAD, 1}
|
{"Launch Payload", COLOR_ORANGE, PAYLOAD, 1},
|
||||||
|
{"View Hex", COLOR_GREEN, HEXVIEW, 1}
|
||||||
};
|
};
|
||||||
|
|
||||||
void writecurpath(const char *in){
|
void writecurpath(const char *in){
|
||||||
|
@ -104,6 +105,46 @@ bool checkfile(char* path){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void viewbytes(char *path){
|
||||||
|
FIL in;
|
||||||
|
u8 print[2048];
|
||||||
|
u32 size;
|
||||||
|
QWORD offset = 0;
|
||||||
|
int res;
|
||||||
|
|
||||||
|
clearscreen();
|
||||||
|
res = f_open(&in, path, FA_READ | FA_OPEN_EXISTING);
|
||||||
|
if (res != FR_OK){
|
||||||
|
message("fuck", COLOR_RED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
msleep(200);
|
||||||
|
|
||||||
|
while (1){
|
||||||
|
f_lseek(&in, offset * 16);
|
||||||
|
|
||||||
|
res = f_read(&in, &print, 2048 * sizeof(u8), &size);
|
||||||
|
if (res != FR_OK){
|
||||||
|
message("ohgod", COLOR_RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
printbytes(print, size, offset * 16);
|
||||||
|
res = btn_read();
|
||||||
|
|
||||||
|
if (!res)
|
||||||
|
res = btn_wait();
|
||||||
|
|
||||||
|
if (res & BTN_VOL_DOWN && 2048 * sizeof(u8) == size)
|
||||||
|
offset++;
|
||||||
|
if (res & BTN_VOL_UP && offset > 0)
|
||||||
|
offset--;
|
||||||
|
if (res & BTN_POWER)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
f_close(&in);
|
||||||
|
}
|
||||||
|
|
||||||
void addobject(char* name, int spot, bool isfol, bool isarc){
|
void addobject(char* name, int spot, bool isfol, bool isarc){
|
||||||
size_t size = strlen(name) + 1;
|
size_t size = strlen(name) + 1;
|
||||||
fileobjects[spot].property = 0;
|
fileobjects[spot].property = 0;
|
||||||
|
@ -206,7 +247,7 @@ void filemenu(const char *startpath){
|
||||||
else
|
else
|
||||||
explfilemenu[7].property = -1;
|
explfilemenu[7].property = -1;
|
||||||
|
|
||||||
tempint = makemenu(explfilemenu, 8);
|
tempint = makemenu(explfilemenu, 9);
|
||||||
|
|
||||||
switch (tempint){
|
switch (tempint){
|
||||||
case COPY:
|
case COPY:
|
||||||
|
@ -227,6 +268,9 @@ void filemenu(const char *startpath){
|
||||||
case PAYLOAD:
|
case PAYLOAD:
|
||||||
launch_payload(getnextloc(currentpath, fileobjects[res - 1].name));
|
launch_payload(getnextloc(currentpath, fileobjects[res - 1].name));
|
||||||
break;
|
break;
|
||||||
|
case HEXVIEW:
|
||||||
|
viewbytes(getnextloc(currentpath, fileobjects[res - 1].name));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,8 @@ enum filemenuoptions {
|
||||||
COPY = 1,
|
COPY = 1,
|
||||||
MOVE,
|
MOVE,
|
||||||
DELETE,
|
DELETE,
|
||||||
PAYLOAD
|
PAYLOAD,
|
||||||
|
HEXVIEW
|
||||||
};
|
};
|
||||||
|
|
||||||
int readfolder(const char *path);
|
int readfolder(const char *path);
|
||||||
|
|
|
@ -80,6 +80,11 @@ int makemenu(menu_item menu[], int menuamount){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printbytes(u8 print[], u32 size, u32 offset){
|
||||||
|
gfx_con_setpos(0, 31);
|
||||||
|
gfx_hexdump(offset, print, size * sizeof(u8));
|
||||||
|
}
|
||||||
|
|
||||||
void printfsentry(fs_entry file, bool highlight, bool refresh){
|
void printfsentry(fs_entry file, bool highlight, bool refresh){
|
||||||
int size = 0;
|
int size = 0;
|
||||||
char *display;
|
char *display;
|
||||||
|
|
|
@ -6,3 +6,4 @@ int makemenu(menu_item menu[], int menuamount);
|
||||||
int message(char* message, u32 color);
|
int message(char* message, u32 color);
|
||||||
void clearscreen();
|
void clearscreen();
|
||||||
int makefilemenu(fs_entry *files, int amount, char *path);
|
int makefilemenu(fs_entry *files, int amount, char *path);
|
||||||
|
void printbytes(u8 print[], u32 size, u32 offset);
|
|
@ -31,7 +31,7 @@ void displayinfo(){
|
||||||
temp_sect = tot_sect;
|
temp_sect = tot_sect;
|
||||||
temp_sect -= 61145088;
|
temp_sect -= 61145088;
|
||||||
|
|
||||||
gfx_printf("\n1st part: %d\n2nd part: 61145088\n\n", temp_sect);
|
gfx_printf("\n%k1st part: %d\n2nd part: 61145088\n\n%k", COLOR_RED, temp_sect, COLOR_WHITE);
|
||||||
|
|
||||||
disk_initialize(0);
|
disk_initialize(0);
|
||||||
disk_ioctl(0, GET_SECTOR_COUNT, &sz_disk);
|
disk_ioctl(0, GET_SECTOR_COUNT, &sz_disk);
|
||||||
|
|
Loading…
Reference in a new issue