Skip to content

Commit

Permalink
1.0.61 release
Browse files Browse the repository at this point in the history
  • Loading branch information
ventoy committed Nov 13, 2021
1 parent 443a134 commit b5a649f
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/issue_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
23 changes: 13 additions & 10 deletions GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
}

Expand Down
5 changes: 4 additions & 1 deletion GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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);
Expand Down
50 changes: 41 additions & 9 deletions GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion INSTALL/grub/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b5a649f

Please sign in to comment.