From 3e47f5e8decc5234b0e1a34b7a50886057a0e5d4 Mon Sep 17 00:00:00 2001 From: longpanda Date: Wed, 9 Jun 2021 20:55:45 +0800 Subject: [PATCH] Fix a bug about ventoy version message position when VTOY_DEFAULT_IMG is set to F6>xxx --- .../grub-2.04/grub-core/ventoy/ventoy_def.h | 6 ++++++ .../grub-2.04/grub-core/ventoy/ventoy_plugin.c | 16 ++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) 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 60019840..4c349707 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 @@ -1047,5 +1047,11 @@ int ventoy_chain_file_read(const char *path, int offset, int len, void *buf); #define vtoy_theme_random_boot_day 1 #define vtoy_theme_random_boot_month 2 +#define ventoy_env_export(env, name) \ +{\ + grub_env_set((env), (name));\ + grub_env_export(env);\ +} + #endif /* __VENTOY_DEF_H__ */ 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 8b3ecd7f..c41d9649 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 @@ -304,7 +304,7 @@ static int ventoy_plugin_theme_entry(VTOY_JSON *json, const char *isodisk) } debug("vtoy_theme %s\n", filepath); - grub_env_set("vtoy_theme", filepath); + ventoy_env_export("vtoy_theme", filepath); grub_snprintf(g_theme_single_file, sizeof(g_theme_single_file), "%s", filepath); } else @@ -346,7 +346,7 @@ static int ventoy_plugin_theme_entry(VTOY_JSON *json, const char *isodisk) } } - grub_env_set("vtoy_theme", "random"); + ventoy_env_export("vtoy_theme", "random"); value = vtoy_json_get_string_ex(json->pstChild, "random"); if (value) { @@ -370,39 +370,39 @@ static int ventoy_plugin_theme_entry(VTOY_JSON *json, const char *isodisk) if (value) { debug("vtoy_gfxmode %s\n", value); - grub_env_set("vtoy_gfxmode", value); + ventoy_env_export("vtoy_gfxmode", value); } value = vtoy_json_get_string_ex(json->pstChild, "display_mode"); if (value) { debug("display_mode %s\n", value); - grub_env_set("vtoy_display_mode", value); + ventoy_env_export("vtoy_display_mode", value); } value = vtoy_json_get_string_ex(json->pstChild, "serial_param"); if (value) { debug("serial_param %s\n", value); - grub_env_set("vtoy_serial_param", value); + ventoy_env_export("vtoy_serial_param", value); } value = vtoy_json_get_string_ex(json->pstChild, "ventoy_left"); if (value) { - grub_env_set("VTLE_LFT", value); + ventoy_env_export("VTLE_LFT", value); } value = vtoy_json_get_string_ex(json->pstChild, "ventoy_top"); if (value) { - grub_env_set("VTLE_TOP", value); + ventoy_env_export("VTLE_TOP", value); } value = vtoy_json_get_string_ex(json->pstChild, "ventoy_color"); if (value) { - grub_env_set("VTLE_CLR", value); + ventoy_env_export("VTLE_CLR", value); } node = vtoy_json_find_item(json->pstChild, JSON_TYPE_ARRAY, "fonts");