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
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;
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
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;
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;
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
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);
}
}
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];
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);
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;
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");
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;
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");
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;
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;
}
#############################################################
#############################################################
-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