1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-22 09:56:40 +00:00

hekate/nyx: use updated dirlist

This commit is contained in:
CTCaer 2024-10-09 15:22:16 +03:00
parent d2fc6379c6
commit 6fa844b031
4 changed files with 24 additions and 24 deletions

View file

@ -65,7 +65,7 @@ static int _config_kip1(launch_ctxt_t *ctxt, const char *value)
u32 dirlen = 0; u32 dirlen = 0;
dir[strlen(dir) - 2] = 0; dir[strlen(dir) - 2] = 0;
char *filelist = dirlist(dir, "*.kip*", false, false); dirlist_t *filelist = dirlist(dir, "*.kip*", false, false);
strcat(dir, "/"); strcat(dir, "/");
dirlen = strlen(dir); dirlen = strlen(dir);
@ -75,10 +75,10 @@ static int _config_kip1(launch_ctxt_t *ctxt, const char *value)
{ {
while (true) while (true)
{ {
if (!filelist[i * 256]) if (!filelist->name[i])
break; break;
strcpy(dir + dirlen, &filelist[i * 256]); strcpy(dir + dirlen, filelist->name[i]);
merge_kip_t *mkip1 = (merge_kip_t *)malloc(sizeof(merge_kip_t)); merge_kip_t *mkip1 = (merge_kip_t *)malloc(sizeof(merge_kip_t));
mkip1->kip1 = sd_file_read(dir, &size); mkip1->kip1 = sd_file_read(dir, &size);

View file

@ -257,9 +257,9 @@ static void _launch_payloads()
{ {
u8 max_entries = 61; u8 max_entries = 61;
ment_t *ments = NULL; ment_t *ments = NULL;
char *filelist = NULL;
char *file_sec = NULL; char *file_sec = NULL;
char *dir = NULL; char *dir = NULL;
dirlist_t *filelist = NULL;
gfx_clear_grey(0x1B); gfx_clear_grey(0x1B);
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
@ -286,11 +286,11 @@ static void _launch_payloads()
while (true) while (true)
{ {
if (i > max_entries || !filelist[i * 256]) if (i > max_entries || !filelist->name[i])
break; break;
ments[i + 2].type = INI_CHOICE; ments[i + 2].type = INI_CHOICE;
ments[i + 2].caption = &filelist[i * 256]; ments[i + 2].caption = filelist->name[i];
ments[i + 2].data = &filelist[i * 256]; ments[i + 2].data = filelist->name[i];
i++; i++;
} }

View file

@ -1394,7 +1394,7 @@ static lv_res_t _create_mbox_payloads(lv_obj_t *btn)
goto out_end; goto out_end;
} }
char *filelist = dirlist("bootloader/payloads", NULL, false, false); dirlist_t *filelist = dirlist("bootloader/payloads", NULL, false, false);
sd_unmount(); sd_unmount();
u32 i = 0; u32 i = 0;
@ -1402,9 +1402,9 @@ static lv_res_t _create_mbox_payloads(lv_obj_t *btn)
{ {
while (true) while (true)
{ {
if (!filelist[i * 256]) if (!filelist->name[i])
break; break;
lv_list_add(list, NULL, &filelist[i * 256], launch_payload); lv_list_add(list, NULL, filelist->name[i], launch_payload);
i++; i++;
} }
free(filelist); free(filelist);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2022 CTCaer * Copyright (c) 2019-2024 CTCaer
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@ -749,7 +749,7 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt)
typedef struct _emummc_images_t typedef struct _emummc_images_t
{ {
char *dirlist; dirlist_t *dirlist;
u32 part_sector[3]; u32 part_sector[3];
u32 part_type[3]; u32 part_type[3];
u32 part_end[3]; u32 part_end[3];
@ -1009,9 +1009,9 @@ static lv_res_t _create_change_emummc_window(lv_obj_t *btn_caller)
FIL fp; FIL fp;
// Check for sd raw partitions, based on the folders in /emuMMC. // Check for sd raw partitions, based on the folders in /emuMMC.
while (emummc_img->dirlist[emummc_idx * 256]) while (emummc_img->dirlist->name[emummc_idx])
{ {
s_printf(path, "emuMMC/%s/raw_based", &emummc_img->dirlist[emummc_idx * 256]); s_printf(path, "emuMMC/%s/raw_based", emummc_img->dirlist->name[emummc_idx]);
if (!f_stat(path, NULL)) if (!f_stat(path, NULL))
{ {
@ -1024,21 +1024,21 @@ static lv_res_t _create_change_emummc_window(lv_obj_t *btn_caller)
if ((curr_list_sector == 2) || (emummc_img->part_sector[0] && curr_list_sector >= emummc_img->part_sector[0] && if ((curr_list_sector == 2) || (emummc_img->part_sector[0] && curr_list_sector >= emummc_img->part_sector[0] &&
curr_list_sector < emummc_img->part_end[0] && emummc_img->part_type[0] != 0x83)) curr_list_sector < emummc_img->part_end[0] && emummc_img->part_type[0] != 0x83))
{ {
s_printf(&emummc_img->part_path[0], "emuMMC/%s", &emummc_img->dirlist[emummc_idx * 256]); s_printf(&emummc_img->part_path[0], "emuMMC/%s", emummc_img->dirlist->name[emummc_idx]);
emummc_img->part_sector[0] = curr_list_sector; emummc_img->part_sector[0] = curr_list_sector;
emummc_img->part_end[0] = 0; emummc_img->part_end[0] = 0;
} }
else if (emummc_img->part_sector[1] && curr_list_sector >= emummc_img->part_sector[1] && else if (emummc_img->part_sector[1] && curr_list_sector >= emummc_img->part_sector[1] &&
curr_list_sector < emummc_img->part_end[1] && emummc_img->part_type[1] != 0x83) curr_list_sector < emummc_img->part_end[1] && emummc_img->part_type[1] != 0x83)
{ {
s_printf(&emummc_img->part_path[1 * 128], "emuMMC/%s", &emummc_img->dirlist[emummc_idx * 256]); s_printf(&emummc_img->part_path[1 * 128], "emuMMC/%s", emummc_img->dirlist->name[emummc_idx]);
emummc_img->part_sector[1] = curr_list_sector; emummc_img->part_sector[1] = curr_list_sector;
emummc_img->part_end[1] = 0; emummc_img->part_end[1] = 0;
} }
else if (emummc_img->part_sector[2] && curr_list_sector >= emummc_img->part_sector[2] && else if (emummc_img->part_sector[2] && curr_list_sector >= emummc_img->part_sector[2] &&
curr_list_sector < emummc_img->part_end[2] && emummc_img->part_type[2] != 0x83) curr_list_sector < emummc_img->part_end[2] && emummc_img->part_type[2] != 0x83)
{ {
s_printf(&emummc_img->part_path[2 * 128], "emuMMC/%s", &emummc_img->dirlist[emummc_idx * 256]); s_printf(&emummc_img->part_path[2 * 128], "emuMMC/%s", emummc_img->dirlist->name[emummc_idx]);
emummc_img->part_sector[2] = curr_list_sector; emummc_img->part_sector[2] = curr_list_sector;
emummc_img->part_end[2] = 0; emummc_img->part_end[2] = 0;
} }
@ -1050,19 +1050,19 @@ static lv_res_t _create_change_emummc_window(lv_obj_t *btn_caller)
u32 file_based_idx = 0; u32 file_based_idx = 0;
// Sanitize the directory list with sd file based ones. // Sanitize the directory list with sd file based ones.
while (emummc_img->dirlist[emummc_idx * 256]) while (emummc_img->dirlist->name[emummc_idx])
{ {
s_printf(path, "emuMMC/%s/file_based", &emummc_img->dirlist[emummc_idx * 256]); s_printf(path, "emuMMC/%s/file_based", emummc_img->dirlist->name[emummc_idx]);
if (!f_stat(path, NULL)) if (!f_stat(path, NULL))
{ {
char *tmp = &emummc_img->dirlist[emummc_idx * 256]; char *tmp = emummc_img->dirlist->name[emummc_idx];
memcpy(&emummc_img->dirlist[file_based_idx * 256], tmp, strlen(tmp) + 1); memcpy(emummc_img->dirlist->name[file_based_idx], tmp, strlen(tmp) + 1);
file_based_idx++; file_based_idx++;
} }
emummc_idx++; emummc_idx++;
} }
emummc_img->dirlist[file_based_idx * 256] = 0; emummc_img->dirlist->name[file_based_idx] = NULL;
out0:; out0:;
static lv_style_t h_style; static lv_style_t h_style;
@ -1179,9 +1179,9 @@ out0:;
emummc_idx = 0; emummc_idx = 0;
// Add file based to the list. // Add file based to the list.
while (emummc_img->dirlist[emummc_idx * 256]) while (emummc_img->dirlist->name[emummc_idx])
{ {
s_printf(path, "emuMMC/%s", &emummc_img->dirlist[emummc_idx * 256]); s_printf(path, "emuMMC/%s", emummc_img->dirlist->name[emummc_idx]);
lv_list_add(list_sd_based, NULL, path, _save_file_emummc_cfg_action); lv_list_add(list_sd_based, NULL, path, _save_file_emummc_cfg_action);