Add some options to FileMenu

!Warning, there is no confirmation yet on deletions
This commit is contained in:
SuchMemeManySkill
2020-12-25 22:19:04 +01:00
parent 9588ffb89a
commit 9c47d11843
4 changed files with 42 additions and 5 deletions

View File

@@ -8,6 +8,8 @@
#include <utils/sprintf.h>
#include "../../tegraexplorer/tconf.h"
#include "../../hid/hid.h"
#include <libs/fatfs/ff.h>
#include "../../utils/utils.h"
MenuEntry_t FileMenuEntries[] = {
// Still have to think up the options
@@ -36,11 +38,31 @@ void LaunchPayload(char *path, FSEntry_t entry){
launch_payload(CombinePaths(path, entry.name));
}
void CopyClipboard(char *path, FSEntry_t entry){
char *thing = CombinePaths(path, entry.name);
SetCopyParams(thing, CMODE_Copy);
free(thing);
}
void MoveClipboard(char *path, FSEntry_t entry){
char *thing = CombinePaths(path, entry.name);
SetCopyParams(thing, CMODE_Copy);
free(thing);
}
void DeleteFile(char *path, FSEntry_t entry){
char *thing = CombinePaths(path, entry.name);
int res = f_unlink(thing);
if (res)
DrawError(newErrCode(res));
free(thing);
}
menuPaths FileMenuPaths[] = {
CopyClipboard,
MoveClipboard,
UnimplementedException,
UnimplementedException,
UnimplementedException,
UnimplementedException,
DeleteFile,
UnimplementedException,
LaunchPayload,
UnimplementedException
@@ -55,6 +77,9 @@ void FileMenu(char *path, FSEntry_t entry){
free(attribList);
FileMenuEntries[2].name = attribs;
FileMenuEntries[10].hide = !StrEndsWith(entry.name, ".bin");
FileMenuEntries[11].hide = !StrEndsWith(entry.name, ".te");
Vector_t ent = vecFromArray(FileMenuEntries, ARR_LEN(FileMenuEntries), sizeof(MenuEntry_t));
gfx_boxGrey(384, 200, 384 + 512, 200 + 320, 0x33);
gfx_con_setpos(384 + 16, 200 + 16);