mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-26 13:52:06 +00:00
Add file attributes to menus
+ fix a few misc things + bump version (readme isn't updated yet)
This commit is contained in:
parent
00bd1cd083
commit
008d3ab494
5 changed files with 63 additions and 30 deletions
2
Makefile
2
Makefile
|
@ -10,7 +10,7 @@ include $(DEVKITARM)/base_rules
|
||||||
|
|
||||||
IPL_LOAD_ADDR := 0x40003000
|
IPL_LOAD_ADDR := 0x40003000
|
||||||
LPVERSION_MAJOR := 2
|
LPVERSION_MAJOR := 2
|
||||||
LPVERSION_MINOR := 1
|
LPVERSION_MINOR := 2
|
||||||
LPVERSION_BUGFX := 0
|
LPVERSION_BUGFX := 0
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
|
@ -18,10 +18,11 @@ 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[9] = {
|
menu_item explfilemenu[10] = {
|
||||||
{"-- 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},
|
||||||
|
{"ATTRIB", 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},
|
||||||
|
@ -30,9 +31,10 @@ menu_item explfilemenu[9] = {
|
||||||
{"View Hex", COLOR_GREEN, HEXVIEW, 1}
|
{"View Hex", COLOR_GREEN, HEXVIEW, 1}
|
||||||
};
|
};
|
||||||
|
|
||||||
menu_item explfoldermenu[5] = {
|
menu_item explfoldermenu[6] = {
|
||||||
{"-- Folder Menu --\n", COLOR_BLUE, -1, 0},
|
{"-- Folder Menu --\n", COLOR_BLUE, -1, 0},
|
||||||
{"Back", COLOR_WHITE, -1, 1},
|
{"ATTRIB", COLOR_VIOLET, -1, 0},
|
||||||
|
{"\n\nBack", COLOR_WHITE, -1, 1},
|
||||||
{"Return to main menu\n", COLOR_BLUE, EXITFOLDER, 1},
|
{"Return to main menu\n", COLOR_BLUE, EXITFOLDER, 1},
|
||||||
{"Copy to clipboard", COLOR_VIOLET, COPYFOLDER, 1},
|
{"Copy to clipboard", COLOR_VIOLET, COPYFOLDER, 1},
|
||||||
{"Delete folder", COLOR_RED, DELETEFOLDER, 1}
|
{"Delete folder", COLOR_RED, DELETEFOLDER, 1}
|
||||||
|
@ -70,7 +72,7 @@ void writeclipboard(const char *in, bool move, bool folder){
|
||||||
strcpy(clipboard, in);
|
strcpy(clipboard, in);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getnextloc(char *current, char *add){
|
char *getnextloc(const char *current, const char *add){
|
||||||
static char *ret;
|
static char *ret;
|
||||||
|
|
||||||
if (ret != NULL){
|
if (ret != NULL){
|
||||||
|
@ -125,25 +127,23 @@ fs_entry getfileobj(int spot){
|
||||||
}
|
}
|
||||||
|
|
||||||
void copyfile(const char *path, const char *outfolder){
|
void copyfile(const char *path, const char *outfolder){
|
||||||
char *filename = strrchr(path, '/');
|
char *filename = strrchr(path, '/') + 1;
|
||||||
char *outstring;
|
char *outstring;
|
||||||
size_t outstringsize = strlen(filename) + strlen(outfolder) + 2;
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
clearscreen();
|
clearscreen();
|
||||||
|
makestring(getnextloc(outfolder, filename), &outstring);
|
||||||
outstring = (char*) malloc (outstringsize);
|
|
||||||
|
|
||||||
if (strcmp(rootpath, outfolder))
|
|
||||||
sprintf(outstring, "%s/%s", outfolder, filename + 1);
|
|
||||||
else
|
|
||||||
sprintf(outstring, "%s%s", outfolder, filename + 1);
|
|
||||||
|
|
||||||
gfx_printf("Note:\nTo stop the transfer hold Vol-\n\n%s\nProgress: ", outstring);
|
gfx_printf("Note:\nTo stop the transfer hold Vol-\n\n%s\nProgress: ", outstring);
|
||||||
|
|
||||||
if (clipboardhelper & OPERATIONMOVE){
|
if (!strcmp(path, outstring)){
|
||||||
if (strcmp(rootpath, "emmc:/"))
|
message(COLOR_RED, "\nIn and out are the same!");
|
||||||
|
}
|
||||||
|
else if (clipboardhelper & OPERATIONMOVE){
|
||||||
|
if (strcmp(rootpath, "emmc:/")){
|
||||||
f_rename(path, outstring);
|
f_rename(path, outstring);
|
||||||
|
readfolder(currentpath);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
message(COLOR_RED, "\nMoving in emummc is not allowed!");
|
message(COLOR_RED, "\nMoving in emummc is not allowed!");
|
||||||
}
|
}
|
||||||
|
@ -283,6 +283,7 @@ void copyfolder(char *in, char *out){
|
||||||
|
|
||||||
int filemenu(fs_entry file){
|
int filemenu(fs_entry file){
|
||||||
int temp;
|
int temp;
|
||||||
|
FILINFO attribs;
|
||||||
strlcpy(explfilemenu[1].name, file.name, 43);
|
strlcpy(explfilemenu[1].name, file.name, 43);
|
||||||
|
|
||||||
for (temp = 4; temp < 8; temp++)
|
for (temp = 4; temp < 8; temp++)
|
||||||
|
@ -291,13 +292,24 @@ int filemenu(fs_entry file){
|
||||||
|
|
||||||
sprintf(explfilemenu[2].name, "\nSize: %d %s", file.size, sizevalues[temp - 4]);
|
sprintf(explfilemenu[2].name, "\nSize: %d %s", file.size, sizevalues[temp - 4]);
|
||||||
|
|
||||||
|
if (f_stat(getnextloc(currentpath, file.name), &attribs))
|
||||||
|
explfilemenu[3].property = -1;
|
||||||
|
else {
|
||||||
|
explfilemenu[3].property = 0;
|
||||||
|
sprintf(explfilemenu[3].name, "Attribs: %c%c%c%c",
|
||||||
|
(attribs.fattrib & AM_RDO) ? 'R' : '-',
|
||||||
|
(attribs.fattrib & AM_SYS) ? 'S' : '-',
|
||||||
|
(attribs.fattrib & AM_HID) ? 'H' : '-',
|
||||||
|
(attribs.fattrib & AM_ARC) ? 'A' : '-');
|
||||||
|
}
|
||||||
|
|
||||||
if (strstr(file.name, ".bin") != NULL && file.size & ISKB){
|
if (strstr(file.name, ".bin") != NULL && file.size & ISKB){
|
||||||
explfilemenu[7].property = 1;
|
explfilemenu[8].property = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
explfilemenu[7].property = -1;
|
explfilemenu[8].property = -1;
|
||||||
|
|
||||||
temp = makemenu(explfilemenu, 9);
|
temp = makemenu(explfilemenu, 10);
|
||||||
|
|
||||||
switch (temp){
|
switch (temp){
|
||||||
case COPY:
|
case COPY:
|
||||||
|
@ -322,8 +334,29 @@ int filemenu(fs_entry file){
|
||||||
|
|
||||||
int foldermenu(){
|
int foldermenu(){
|
||||||
int res;
|
int res;
|
||||||
|
FILINFO attribs;
|
||||||
|
|
||||||
res = makemenu(explfoldermenu, 5);
|
if (!strcmp(rootpath, currentpath)){
|
||||||
|
explfoldermenu[4].property = -1;
|
||||||
|
explfoldermenu[5].property = -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
explfoldermenu[4].property = 1;
|
||||||
|
explfoldermenu[5].property = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f_stat(currentpath, &attribs))
|
||||||
|
explfoldermenu[1].property = -1;
|
||||||
|
else {
|
||||||
|
explfoldermenu[1].property = 0;
|
||||||
|
sprintf(explfoldermenu[1].name, "Attribs: %c%c%c%c",
|
||||||
|
(attribs.fattrib & AM_RDO) ? 'R' : '-',
|
||||||
|
(attribs.fattrib & AM_SYS) ? 'S' : '-',
|
||||||
|
(attribs.fattrib & AM_HID) ? 'H' : '-',
|
||||||
|
(attribs.fattrib & AM_ARC) ? 'A' : '-');
|
||||||
|
}
|
||||||
|
|
||||||
|
res = makemenu(explfoldermenu, 6);
|
||||||
|
|
||||||
switch (res){
|
switch (res){
|
||||||
case EXITFOLDER:
|
case EXITFOLDER:
|
||||||
|
@ -359,9 +392,9 @@ void fileexplorer(const char *startpath){
|
||||||
readfolder(currentpath);
|
readfolder(currentpath);
|
||||||
|
|
||||||
if (strcmp(rootpath, "emmc:/"))
|
if (strcmp(rootpath, "emmc:/"))
|
||||||
explfilemenu[5].property = 1;
|
explfilemenu[6].property = 1;
|
||||||
else
|
else
|
||||||
explfilemenu[5].property = -1;
|
explfilemenu[6].property = -1;
|
||||||
|
|
||||||
while (1){
|
while (1){
|
||||||
res = makefilemenu(fileobjects, getfileobjamount(), currentpath);
|
res = makefilemenu(fileobjects, getfileobjamount(), currentpath);
|
||||||
|
|
|
@ -45,4 +45,4 @@ enum foldermenuoptions {
|
||||||
|
|
||||||
int readfolder(const char *path);
|
int readfolder(const char *path);
|
||||||
void fileexplorer(const char *startpath);
|
void fileexplorer(const char *startpath);
|
||||||
char *getnextloc(char *current, char *add);
|
char *getnextloc(const char *current, const char *add);
|
|
@ -27,7 +27,7 @@ void clearscreen(){
|
||||||
gfx_clear_grey(0x1B);
|
gfx_clear_grey(0x1B);
|
||||||
gfx_box(0, 0, 719, 15, COLOR_WHITE);
|
gfx_box(0, 0, 719, 15, COLOR_WHITE);
|
||||||
gfx_con_setpos(0, 0);
|
gfx_con_setpos(0, 0);
|
||||||
gfx_printf("%k%KTegraexplorer v1.1.1%k%K\n", COLOR_DEFAULT, COLOR_WHITE, COLOR_WHITE, COLOR_DEFAULT);
|
gfx_printf("%k%KTegraexplorer v1.2.0%k%K\n", COLOR_DEFAULT, COLOR_WHITE, COLOR_WHITE, COLOR_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int message(u32 color, const char* message, ...){
|
int message(u32 color, const char* message, ...){
|
||||||
|
|
|
@ -86,9 +86,6 @@ int copy(const char *locin, const char *locout, bool print, bool canCancel){
|
||||||
return 23;
|
return 23;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = f_chmod(locout, in_info.fattrib, 0x3F)))
|
|
||||||
return res;
|
|
||||||
|
|
||||||
buff = malloc (BUFSIZE);
|
buff = malloc (BUFSIZE);
|
||||||
sizeoffile = f_size(&in);
|
sizeoffile = f_size(&in);
|
||||||
totalsize = sizeoffile;
|
totalsize = sizeoffile;
|
||||||
|
@ -123,6 +120,9 @@ int copy(const char *locin, const char *locout, bool print, bool canCancel){
|
||||||
f_close(&out);
|
f_close(&out);
|
||||||
free(buff);
|
free(buff);
|
||||||
|
|
||||||
|
if ((res = f_chmod(locout, in_info.fattrib, 0x3A)))
|
||||||
|
return res;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,9 +216,6 @@ int copy_recursive(char *path, char *dstpath){
|
||||||
if (f_stat(startpath, &fno))
|
if (f_stat(startpath, &fno))
|
||||||
return 22;
|
return 22;
|
||||||
|
|
||||||
if ((res = f_chmod(destpath, fno.fattrib, 0x3F)))
|
|
||||||
return res;
|
|
||||||
|
|
||||||
while (!f_readdir(&dir, &fno) && fno.fname[0]){
|
while (!f_readdir(&dir, &fno) && fno.fname[0]){
|
||||||
if (fno.fattrib & AM_DIR){
|
if (fno.fattrib & AM_DIR){
|
||||||
copy_recursive(getnextloc(startpath, fno.fname), destpath);
|
copy_recursive(getnextloc(startpath, fno.fname), destpath);
|
||||||
|
@ -244,5 +241,8 @@ int copy_recursive(char *path, char *dstpath){
|
||||||
free(destpath);
|
free(destpath);
|
||||||
free(destfoldername);
|
free(destfoldername);
|
||||||
|
|
||||||
|
if ((res = f_chmod(destpath, fno.fattrib, 0x3A)))
|
||||||
|
return res;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in a new issue