]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
1.0.61 release v1.0.61
authorlongpanda <admin@ventoy.net>
Sat, 13 Nov 2021 14:49:51 +0000 (22:49 +0800)
committerlongpanda <admin@ventoy.net>
Sat, 13 Nov 2021 14:49:51 +0000 (22:49 +0800)
.github/ISSUE_TEMPLATE/issue_template.yml
GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
INSTALL/grub/grub.cfg

index fbd3f76c0f346526d1a4e105653e5afe2b13e837..3003f3646764f1e9a4c81b0d6056c3b500eb59e7 100644 (file)
@@ -21,7 +21,7 @@ body:
     attributes:
       label: Ventoy Version
       description: What version of ventoy are you running?
     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
     validations:
       required: true
   - type: dropdown
index 22954d6d7100fac973547ab5769118f89d39af0c..861166165da1f46c9ffed89078d0c3cef1def3ac 100644 (file)
@@ -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)
 {
 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;
     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;
     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;
         }
     }
             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
 }
 
 static void
index 0879585ba146f7738b4bf9a8a7b8e9b51d693f28..ea53303cf3cd84c0b756fa827d20f153a3c54523 100644 (file)
@@ -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);
 
 
             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;
             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 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;
     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";
         }
 
             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, 
         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, 
             }
             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
             }
         }
         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, 
             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, 
             }
             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);
             }
         }
 
             }
         }
 
index 2b722316f42ee8968402529e2f0baaec35c82dbf..82428770fff4ef6343587c3489f92e70c407dc50 100644 (file)
@@ -896,8 +896,11 @@ typedef struct menu_alias
     struct menu_alias *next;
 }menu_alias;
 
     struct menu_alias *next;
 }menu_alias;
 
+#define vtoy_tip_image_file 0
+#define vtoy_tip_directory  1
 typedef struct menu_tip
 {
 typedef struct menu_tip
 {
+    int type;
     int pathlen;
     char isopath[256];
     char tip1[1024];
     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);
 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);
 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);
index ca0e96dc1cc504191ad42397f003d929450ceb5a..65d57799220e1908fd810868b3dfec7a0e2924a9 100644 (file)
@@ -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)
 {
 
 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;
     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)
     {
     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");
         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 (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
             {
             }
             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");
             }
 
             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)
 {
 
 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;
     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)
     {
 
     for (pNode = pNode->pstChild; pNode; pNode = pNode->pstNext)
     {
+        type = vtoy_tip_image_file;
         path = vtoy_json_get_string_ex(pNode->pstChild, "image");
         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)
             {
         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");
                 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;
 }
 
     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;
 {
     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)
     {
     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;
         }
         {
             return node;
         }
index 5dc76d46cadb4e8adb5a51bfeba3cd41183964f2..92497b45ebb94abb42c9c1fb4950f02fec5ad815 100644 (file)
@@ -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
 
 #ACPI not compatible with Window7/8, so disable by default
 set VTOY_PARAM_NO_ACPI=1