1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-22 20:06:43 +00:00

Fix broken menus

This commit is contained in:
Such Meme, Many Skill 2020-05-04 20:48:23 +02:00
parent a9ea9725d4
commit 74ba5bb776
4 changed files with 5 additions and 8 deletions

View file

@ -36,7 +36,7 @@ void fileexplorer(const char *startpath, int type){
*/ */
while (1){ while (1){
res = menu_make(fsreader_files, mu_countObjects(fsreader_files, 0), currentpath); res = menu_make(fsreader_files, mu_countObjects(fsreader_files, 0, 0), currentpath);
switch (res){ switch (res){
case FILEMENU_RETURN: case FILEMENU_RETURN:
if (!strcmp(startpath, currentpath)) if (!strcmp(startpath, currentpath))

View file

@ -70,7 +70,7 @@ int menu_make(menu_entry *entries, int amount, const char *toptext){
gfx_clearscreen(); gfx_clearscreen();
calculatedamount = mu_countObjects(entries, ISMENU); calculatedamount = mu_countObjects(entries, amount, ISMENU);
gfx_con_setpos(0, 16); gfx_con_setpos(0, 16);

View file

@ -20,17 +20,14 @@ void mu_createObjects(int size, menu_entry **menu){
(*menu)[size].name = NULL; (*menu)[size].name = NULL;
} }
int mu_countObjects(menu_entry *entries, u8 propertyMask){ int mu_countObjects(menu_entry *entries, u32 count, u8 propertyMask){
int amount = 0; int amount = 0;
for (u32 i = 0; entries[i].name != NULL; i++){ for (u32 i = 0; (count) ? i < count : entries[i].name != NULL; i++){
if (!(entries[i].property & propertyMask)) if (!(entries[i].property & propertyMask))
amount++; amount++;
} }
while (entries[amount].name != NULL)
amount++;
return amount; return amount;
} }

View file

@ -4,5 +4,5 @@
void mu_createObjects(int size, menu_entry **menu); void mu_createObjects(int size, menu_entry **menu);
void mu_clearObjects(menu_entry **menu); void mu_clearObjects(menu_entry **menu);
int mu_countObjects(menu_entry *entries, u8 propertyMask); int mu_countObjects(menu_entry *entries, u32 count, u8 propertyMask);
void mu_copySingle(char *name, u32 storage, u8 property, menu_entry *out); void mu_copySingle(char *name, u32 storage, u8 property, menu_entry *out);