1.0.61 release

This commit is contained in:
longpanda 2021-11-13 22:49:51 +08:00
parent 443a1344f2
commit b5a649f96f
6 changed files with 82 additions and 22 deletions

View File

@ -21,7 +21,7 @@ body:
attributes: attributes:
label: Ventoy Version label: Ventoy Version
description: What version of ventoy are you running? description: What version of ventoy are you running?
placeholder: 1.0.60 placeholder: 1.0.61
validations: validations:
required: true required: true
- type: dropdown - type: dropdown

View File

@ -405,7 +405,9 @@ const char * g_ventoy_tip_msg2 = NULL;
static const char *g_ventoy_cur_img_path = NULL; static const char *g_ventoy_cur_img_path = NULL;
static void menu_set_chosen_tip(grub_menu_t menu, int entry) 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); grub_menu_entry_t e = grub_menu_get_entry (menu, entry);
g_ventoy_tip_msg1 = g_ventoy_tip_msg2 = NULL; 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

View 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) if (tip)
{ {
img->tip1 = tip->tip1; img->tip1 = tip->tip1;
@ -2067,6 +2067,7 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
const char *dir_class = NULL; const char *dir_class = NULL;
const char *dir_alias = NULL; const char *dir_alias = NULL;
img_iterator_node *child = NULL; img_iterator_node *child = NULL;
const menu_tip *tip = NULL;
if (node->isocnt == 0 || node->done == 1) if (node->isocnt == 0 || node->done == 1)
{ {
@ -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); dir_alias = ventoy_plugin_get_menu_alias(vtoy_alias_directory, node->dir);
if (dir_alias) if (dir_alias)
{ {
if (g_tree_view_menu_style == 0) if (g_tree_view_menu_style == 0)
{ {
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"%-10s %s\" --class=\"%s\" --id=\"DIR_%s\" {\n", "submenu \"%-10s %s\" --class=\"%s\" --id=\"DIR_%s\" _VTIP_%p {\n",
"DIR", dir_alias, dir_class, node->dir + offset); "DIR", dir_alias, dir_class, node->dir + offset, tip);
} }
else else
{ {
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"%s\" --class=\"%s\" --id=\"DIR_%s\" {\n", "submenu \"%s\" --class=\"%s\" --id=\"DIR_%s\" _VTIP_%p {\n",
dir_alias, dir_class, node->dir + offset); 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) if (g_tree_view_menu_style == 0)
{ {
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"%-10s [%s]\" --class=\"%s\" --id=\"DIR_%s\" {\n", "submenu \"%-10s [%s]\" --class=\"%s\" --id=\"DIR_%s\" _VTIP_%p {\n",
"DIR", dir_alias, dir_class, node->dir + offset); "DIR", dir_alias, dir_class, node->dir + offset, tip);
} }
else else
{ {
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"[%s]\" --class=\"%s\" --id=\"DIR_%s\" {\n", "submenu \"[%s]\" --class=\"%s\" --id=\"DIR_%s\" _VTIP_%p {\n",
dir_alias, dir_class, node->dir + offset); dir_alias, dir_class, node->dir + offset, tip);
} }
} }

View File

@ -896,8 +896,11 @@ typedef struct menu_alias
struct menu_alias *next; struct menu_alias *next;
}menu_alias; }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; int pathlen;
char isopath[256]; char isopath[256];
char tip1[1024]; 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); 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_injection(const char *isopath);
const char * ventoy_plugin_get_menu_alias(int type, 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); 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_check_memdisk(const char *isopath);
int ventoy_plugin_get_image_list_index(int type, const char *name); int ventoy_plugin_get_image_list_index(int type, const char *name);

View 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 *path = NULL;
const char *tip = NULL; const char *tip = NULL;
VTOY_JSON *pNode = NULL; VTOY_JSON *pNode = NULL;
@ -1511,14 +1512,23 @@ static int ventoy_plugin_menutip_check(VTOY_JSON *json, const char *isodisk)
pNode = vtoy_json_find_item(json->pstChild, JSON_TYPE_ARRAY, "tips"); pNode = vtoy_json_find_item(json->pstChild, JSON_TYPE_ARRAY, "tips");
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] == '/') if (path && path[0] == '/')
{
if (vtoy_tip_image_file == type)
{ {
if (grub_strchr(path, '*')) if (grub_strchr(path, '*'))
{ {
grub_printf("image: <%s> [ * ]\n", path); grub_printf("image: <%s> [ * ]\n", path);
} }
else if (ventoy_check_file_exist("%s%s", isodisk, path)) else if (ventoy_is_file_exist("%s%s", isodisk, path))
{ {
grub_printf("image: <%s> [ OK ]\n", path); grub_printf("image: <%s> [ OK ]\n", path);
} }
@ -1526,6 +1536,18 @@ static int ventoy_plugin_menutip_check(VTOY_JSON *json, const char *isodisk)
{ {
grub_printf("image: <%s> [ NOT EXIST ]\n", path); grub_printf("image: <%s> [ NOT EXIST ]\n", path);
} }
}
else
{
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");
if (tip) if (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 *path = NULL;
const char *tip = NULL; const char *tip = NULL;
VTOY_JSON *pNode = 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] == '/') if (path && path[0] == '/')
{ {
node = grub_zalloc(sizeof(menu_tip)); node = grub_zalloc(sizeof(menu_tip));
if (node) if (node)
{ {
node->type = type;
node->pathlen = grub_snprintf(node->isopath, sizeof(node->isopath), "%s", path); node->pathlen = grub_snprintf(node->isopath, sizeof(node->isopath), "%s", path);
tip = vtoy_json_get_string_ex(pNode->pstChild, "tip"); 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; int len;
menu_tip *node = NULL; menu_tip *node = NULL;
@ -2767,7 +2798,8 @@ const menu_tip * ventoy_plugin_get_menu_tip(const char *isopath)
len = (int)grub_strlen(isopath); len = (int)grub_strlen(isopath);
for (node = g_menu_tip_head; node; node = node->next) 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;
} }

View 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 #ACPI not compatible with Window7/8, so disable by default
set VTOY_PARAM_NO_ACPI=1 set VTOY_PARAM_NO_ACPI=1