1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-12-26 11:26:05 +00:00

Misc fixes, mostly related to no-joycon controls

This commit is contained in:
Such Meme, Many Skill 2020-05-02 20:53:13 +02:00
parent a146a38af7
commit 7add4b6b13
7 changed files with 23 additions and 10 deletions

View file

@ -98,4 +98,9 @@ Inputs *hidWait(){
while (!(in->buttons))
hidRead();
return in;
}
bool hidConnected(){
jc_gamepad_rpt_t *controller = joycon_poll();
return (controller->conn_l && controller->conn_r) ? 1 : 0;
}

View file

@ -51,4 +51,5 @@ typedef struct _inputs {
void hidInit();
Inputs *hidRead();
Inputs *hidWait();
Inputs *hidWaitMask(u32 mask);
Inputs *hidWaitMask(u32 mask);
bool hidConnected();

View file

@ -451,7 +451,7 @@ static void _show_errors(){
}
RESETCOLOR;
gfx_printf("\n\nPress any key to continue...");
gfx_printf("\n\nPress vol+/- or power to continue");
*excp_enabled = 0;
btn_wait();

View file

@ -147,6 +147,7 @@ int filemenu(menu_entry file){
(attribs.fattrib & AM_ARC) ? 'A' : '-');
}
SETBIT(fs_menu_file[6].property, ISHIDE, !hidConnected());
SETBIT(fs_menu_file[8].property, ISHIDE, !(strstr(file.name, ".bin") != NULL && file.property & ISKB) && strstr(file.name, ".rom") == NULL);
SETBIT(fs_menu_file[9].property, ISHIDE, strstr(file.name, ".te") == NULL);
SETBIT(fs_menu_file[11].property, ISHIDE, strstr(file.name, ".bis") == NULL);
@ -166,7 +167,7 @@ int filemenu(menu_entry file){
char *name, *curPath;
gfx_clearscreen();
gfx_printf("Renaming %s...\n\n", file.name);
name = utils_InputText(file.name, 32);
name = utils_InputText(file.name, 39);
if (name == NULL)
break;

View file

@ -10,6 +10,7 @@
#include "fsutils.h"
#include "../../utils/sprintf.h"
#include "../utils/utils.h"
#include "../../hid/hid.h"
extern char *currentpath;
extern char *clipboard;
@ -39,7 +40,7 @@ void copyfolder(char *in, char *out){
}
int foldermenu(){
int res;
int res, hidConn;
char *name;
FILINFO attribs;
@ -48,11 +49,13 @@ int foldermenu(){
fs_menu_folder[0].name = malloc(16);
res = strlen(currentpath);
hidConn = hidConnected();
res = strlen(currentpath);
SETBIT(fs_menu_folder[3].property, ISHIDE, (*(currentpath + res - 1) == '/'));
SETBIT(fs_menu_folder[4].property, ISHIDE, (*(currentpath + res - 1) == '/'));
SETBIT(fs_menu_folder[5].property, ISHIDE, (*(currentpath + res - 1) == '/'));
SETBIT(fs_menu_folder[5].property, ISHIDE, (*(currentpath + res - 1) == '/') || !hidConn);
SETBIT(fs_menu_folder[6].property, ISHIDE, !hidConn);
if (f_stat(currentpath, &attribs))
SETBIT(fs_menu_folder[0].property, ISHIDE, 1);
@ -93,7 +96,7 @@ int foldermenu(){
gfx_clearscreen();
gfx_printf("Renaming %s...\n\n", dirName);
name = utils_InputText(dirName, 32);
name = utils_InputText(dirName, 39);
if (name == NULL)
break;
@ -115,7 +118,7 @@ int foldermenu(){
case DIR_CREATE:;
gfx_clearscreen();
gfx_printf("Give a name for your new folder\n\n");
name = utils_InputText("New Folder", 32);
name = utils_InputText("New Folder", 39);
if (name == NULL)
break;

View file

@ -459,10 +459,10 @@ int part_setPrintPos(){
if (parseIntInput(argv[1], &right))
return -1;
if (left > 42)
if (left > 78)
return -1;
if (right > 78)
if (right > 42)
return -1;
gfx_con_setpos(left * 16, right * 16);

View file

@ -40,6 +40,9 @@ void utils_takeScreenshot(){
*/
char *utils_InputText(char *start, int maxLen){
if (!hidConnected())
return NULL;
int offset = -1, currentPos = 0, len;
char temp;
Inputs *input = hidRead();