diff --git a/.github/ISSUE_TEMPLATE/issue_template.yml b/.github/ISSUE_TEMPLATE/issue_template.yml index fbd3f76c..3003f364 100644 --- a/.github/ISSUE_TEMPLATE/issue_template.yml +++ b/.github/ISSUE_TEMPLATE/issue_template.yml @@ -21,7 +21,7 @@ body: attributes: label: Ventoy Version description: What version of ventoy are you running? - placeholder: 1.0.60 + placeholder: 1.0.61 validations: required: true - type: dropdown diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c index 22954d6d..86116616 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c @@ -405,7 +405,9 @@ const char * g_ventoy_tip_msg2 = NULL; static const char *g_ventoy_cur_img_path = NULL; static void menu_set_chosen_tip(grub_menu_t menu, int entry) { + int i; img_info *img; + menu_tip *tip; grub_menu_entry_t e = grub_menu_get_entry (menu, entry); g_ventoy_tip_msg1 = g_ventoy_tip_msg2 = NULL; @@ -419,6 +421,26 @@ static void menu_set_chosen_tip(grub_menu_t menu, int entry) g_ventoy_cur_img_path = img->path; } } + else if (e && e->id && grub_strncmp(e->id, "DIR_", 4) == 0) + { + for (i = 0; i < e->argc; i++) + { + if (e->args[i] && grub_strncmp(e->args[i], "_VTIP_", 6) == 0) + { + break; + } + } + + if (i < e->argc) + { + tip = (menu_tip *)(void *)grub_strtoul(e->args[i] + 6, NULL, 16); + if (tip) + { + g_ventoy_tip_msg1 = tip->tip1; + g_ventoy_tip_msg2 = tip->tip2; + } + } + } } static void diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c index 0879585b..ea53303c 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c @@ -1866,7 +1866,7 @@ static int ventoy_collect_img_files(const char *filename, const struct grub_dirh img->alias = ventoy_plugin_get_menu_alias(vtoy_alias_image_file, img->path); - tip = ventoy_plugin_get_menu_tip(img->path); + tip = ventoy_plugin_get_menu_tip(vtoy_tip_image_file, img->path); if (tip) { img->tip1 = tip->tip1; @@ -2067,7 +2067,8 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node) const char *dir_class = NULL; const char *dir_alias = NULL; img_iterator_node *child = NULL; - + const menu_tip *tip = NULL; + if (node->isocnt == 0 || node->done == 1) { return 0; @@ -2107,20 +2108,22 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node) dir_class = "vtoydir"; } + tip = ventoy_plugin_get_menu_tip(vtoy_tip_directory, node->dir); + dir_alias = ventoy_plugin_get_menu_alias(vtoy_alias_directory, node->dir); if (dir_alias) { if (g_tree_view_menu_style == 0) { vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, - "submenu \"%-10s %s\" --class=\"%s\" --id=\"DIR_%s\" {\n", - "DIR", dir_alias, dir_class, node->dir + offset); + "submenu \"%-10s %s\" --class=\"%s\" --id=\"DIR_%s\" _VTIP_%p {\n", + "DIR", dir_alias, dir_class, node->dir + offset, tip); } else { vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, - "submenu \"%s\" --class=\"%s\" --id=\"DIR_%s\" {\n", - dir_alias, dir_class, node->dir + offset); + "submenu \"%s\" --class=\"%s\" --id=\"DIR_%s\" _VTIP_%p {\n", + dir_alias, dir_class, node->dir + offset, tip); } } else @@ -2130,14 +2133,14 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node) if (g_tree_view_menu_style == 0) { vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, - "submenu \"%-10s [%s]\" --class=\"%s\" --id=\"DIR_%s\" {\n", - "DIR", dir_alias, dir_class, node->dir + offset); + "submenu \"%-10s [%s]\" --class=\"%s\" --id=\"DIR_%s\" _VTIP_%p {\n", + "DIR", dir_alias, dir_class, node->dir + offset, tip); } else { vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, - "submenu \"[%s]\" --class=\"%s\" --id=\"DIR_%s\" {\n", - dir_alias, dir_class, node->dir + offset); + "submenu \"[%s]\" --class=\"%s\" --id=\"DIR_%s\" _VTIP_%p {\n", + dir_alias, dir_class, node->dir + offset, tip); } } diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h index 2b722316..82428770 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h @@ -896,8 +896,11 @@ typedef struct menu_alias struct menu_alias *next; }menu_alias; +#define vtoy_tip_image_file 0 +#define vtoy_tip_directory 1 typedef struct menu_tip { + int type; int pathlen; char isopath[256]; char tip1[1024]; @@ -1063,7 +1066,7 @@ int ventoy_fill_windows_rtdata(void *buf, char *isopath); int ventoy_plugin_get_persistent_chunklist(const char *isopath, int index, ventoy_img_chunk_list *chunk_list); const char * ventoy_plugin_get_injection(const char *isopath); const char * ventoy_plugin_get_menu_alias(int type, const char *isopath); -const menu_tip * ventoy_plugin_get_menu_tip(const char *isopath); +const menu_tip * ventoy_plugin_get_menu_tip(int type, const char *isopath); const char * ventoy_plugin_get_menu_class(int type, const char *name, const char *path); int ventoy_plugin_check_memdisk(const char *isopath); int ventoy_plugin_get_image_list_index(int type, const char *name); diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c index ca0e96dc..65d57799 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c @@ -1478,6 +1478,7 @@ static int ventoy_plugin_menualias_entry(VTOY_JSON *json, const char *isodisk) static int ventoy_plugin_menutip_check(VTOY_JSON *json, const char *isodisk) { + int type; const char *path = NULL; const char *tip = NULL; VTOY_JSON *pNode = NULL; @@ -1511,20 +1512,41 @@ static int ventoy_plugin_menutip_check(VTOY_JSON *json, const char *isodisk) pNode = vtoy_json_find_item(json->pstChild, JSON_TYPE_ARRAY, "tips"); for (pNode = pNode->pstChild; pNode; pNode = pNode->pstNext) { + type = vtoy_tip_image_file; path = vtoy_json_get_string_ex(pNode->pstChild, "image"); + if (!path) + { + path = vtoy_json_get_string_ex(pNode->pstChild, "dir"); + type = vtoy_tip_directory; + } + if (path && path[0] == '/') { - if (grub_strchr(path, '*')) + if (vtoy_tip_image_file == type) { - grub_printf("image: <%s> [ * ]\n", path); - } - else if (ventoy_check_file_exist("%s%s", isodisk, path)) - { - grub_printf("image: <%s> [ OK ]\n", path); + if (grub_strchr(path, '*')) + { + grub_printf("image: <%s> [ * ]\n", path); + } + else if (ventoy_is_file_exist("%s%s", isodisk, path)) + { + grub_printf("image: <%s> [ OK ]\n", path); + } + else + { + grub_printf("image: <%s> [ NOT EXIST ]\n", path); + } } else { - grub_printf("image: <%s> [ NOT EXIST ]\n", path); + if (ventoy_is_dir_exist("%s%s", isodisk, path)) + { + grub_printf("dir: <%s> [ OK ]\n", path); + } + else + { + grub_printf("dir: <%s> [ NOT EXIST ]\n", path); + } } tip = vtoy_json_get_string_ex(pNode->pstChild, "tip"); @@ -1558,6 +1580,7 @@ static int ventoy_plugin_menutip_check(VTOY_JSON *json, const char *isodisk) static int ventoy_plugin_menutip_entry(VTOY_JSON *json, const char *isodisk) { + int type; const char *path = NULL; const char *tip = NULL; VTOY_JSON *pNode = NULL; @@ -1610,12 +1633,20 @@ static int ventoy_plugin_menutip_entry(VTOY_JSON *json, const char *isodisk) for (pNode = pNode->pstChild; pNode; pNode = pNode->pstNext) { + type = vtoy_tip_image_file; path = vtoy_json_get_string_ex(pNode->pstChild, "image"); + if (!path) + { + path = vtoy_json_get_string_ex(pNode->pstChild, "dir"); + type = vtoy_tip_directory; + } + if (path && path[0] == '/') { node = grub_zalloc(sizeof(menu_tip)); if (node) { + node->type = type; node->pathlen = grub_snprintf(node->isopath, sizeof(node->isopath), "%s", path); tip = vtoy_json_get_string_ex(pNode->pstChild, "tip"); @@ -2754,7 +2785,7 @@ const char * ventoy_plugin_get_menu_alias(int type, const char *isopath) return NULL; } -const menu_tip * ventoy_plugin_get_menu_tip(const char *isopath) +const menu_tip * ventoy_plugin_get_menu_tip(int type, const char *isopath) { int len; menu_tip *node = NULL; @@ -2767,7 +2798,8 @@ const menu_tip * ventoy_plugin_get_menu_tip(const char *isopath) len = (int)grub_strlen(isopath); for (node = g_menu_tip_head; node; node = node->next) { - if (node->pathlen == len && ventoy_strcmp(node->isopath, isopath) == 0) + if (node->type == type && node->pathlen && + node->pathlen == len && ventoy_strcmp(node->isopath, isopath) == 0) { return node; } diff --git a/INSTALL/grub/grub.cfg b/INSTALL/grub/grub.cfg index 5dc76d46..92497b45 100644 --- a/INSTALL/grub/grub.cfg +++ b/INSTALL/grub/grub.cfg @@ -2010,7 +2010,7 @@ function img_unsupport_menuentry { ############################################################# ############################################################# -set VENTOY_VERSION="1.0.59" +set VENTOY_VERSION="1.0.61" #ACPI not compatible with Window7/8, so disable by default set VTOY_PARAM_NO_ACPI=1