]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
1.0.21 release v1.0.21
authorlongpanda <admin@ventoy.net>
Sat, 12 Sep 2020 14:31:21 +0000 (22:31 +0800)
committerlongpanda <admin@ventoy.net>
Sat, 12 Sep 2020 14:31:21 +0000 (22:31 +0800)
14 files changed:
GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_vhd.c
INSTALL/EFI/BOOT/grubx64_real.efi
INSTALL/grub/debug.cfg
INSTALL/grub/grub.cfg
INSTALL/grub/i386-pc/core.img
INSTALL/grub/i386-pc/moddep.lst
INSTALL/grub/localboot.cfg
INSTALL/grub/x86_64-efi/moddep.lst
INSTALL/grub/x86_64-efi/normal.mod
INSTALL/ventoy/ventoy.cpio
INSTALL/ventoy/vtloopex.cpio

index 070f6d20fe4d23b06cae25a11901c1f910666632..8d73c3c06699f2459f1c889e0cb45e94fc7aa4b3 100644 (file)
@@ -999,6 +999,9 @@ show_menu (grub_menu_t menu, int nested, int autobooted)
        grub_menu_execute_entry (e, 0);
       if (autobooted)
        break;
+
+      if (2 == e->argc && e->args && e->args[1] && grub_strncmp(e->args[1], "VTOY_RUN_RET", 12) == 0)
+        break; 
     }
 
   return GRUB_ERR_NONE;
index 79e1f881013dbc6565f5b57227c00af1394279c1..1fc40fe1a8c67e78b4815489bfc883995cf6788c 100644 (file)
@@ -39,6 +39,7 @@
 #include <grub/efi/efi.h>
 #endif
 #include <grub/time.h>
+#include <grub/video.h>
 #include <grub/relocator.h>
 #include <grub/charset.h>
 #include <grub/ventoy.h>
@@ -90,6 +91,8 @@ char *g_wimiso_path = NULL;
 
 int g_vhdboot_enable = 0;
 
+ventoy_gpt_info *g_ventoy_part_info = NULL;
+
 static char *g_tree_script_buf = NULL;
 static int g_tree_script_pos = 0;
 
@@ -99,6 +102,10 @@ static int g_list_script_pos = 0;
 static char *g_part_list_buf = NULL;
 static int g_part_list_pos = 0;
 
+static int g_video_mode_max = 0;
+static int g_video_mode_num = 0;
+static ventoy_video_mode *g_video_mode_list = NULL;
+
 static const char *g_menu_class[] = 
 {
     "vtoyiso", "vtoywim", "vtoyefi", "vtoyimg", "vtoyvhd"
@@ -215,6 +222,120 @@ static grub_err_t ventoy_fs_close(grub_file_t file)
     return 0;
 }
 
+static int ventoy_video_hook(const struct grub_video_mode_info *info, void *hook_arg)
+{
+    int i;
+
+    (void)hook_arg;
+
+    if (info->mode_type & GRUB_VIDEO_MODE_TYPE_PURE_TEXT)
+    {
+        return 0;
+    }
+    
+    for (i = 0; i < g_video_mode_num; i++)
+    {
+        if (g_video_mode_list[i].width == info->width && 
+            g_video_mode_list[i].height == info->height &&
+            g_video_mode_list[i].bpp == info->bpp)
+        {
+            return 0;
+        }
+    }
+
+    g_video_mode_list[g_video_mode_num].width = info->width;
+    g_video_mode_list[g_video_mode_num].height = info->height;
+    g_video_mode_list[g_video_mode_num].bpp = info->bpp;
+    g_video_mode_num++;
+
+    if (g_video_mode_num == g_video_mode_max)
+    {
+        g_video_mode_max *= 2;
+        g_video_mode_list = grub_realloc(g_video_mode_list, g_video_mode_max * sizeof(ventoy_video_mode));
+    }
+
+    return 0;
+}
+
+static int ventoy_video_mode_cmp(ventoy_video_mode *v1, ventoy_video_mode *v2)
+{
+    if (v1->bpp == v2->bpp)
+    {
+        if (v1->width == v2->width)
+        {
+            if (v1->height == v2->height)
+            {
+                return 0;
+            }
+            else
+            {
+                return (v1->height < v2->height) ? -1 : 1;
+            }
+        }
+        else
+        {
+            return (v1->width < v2->width) ? -1 : 1;
+        }
+    }
+    else
+    {
+        return (v1->bpp < v2->bpp) ? -1 : 1;
+    }
+}
+
+static int ventoy_enum_video_mode(void)
+{
+    int i, j;
+    grub_video_adapter_t adapter;
+    grub_video_driver_id_t id;
+    ventoy_video_mode mode;
+    
+    g_video_mode_num = 0;
+    g_video_mode_max = 1024;
+    g_video_mode_list = grub_malloc(sizeof(ventoy_video_mode) * g_video_mode_max);
+    if (!g_video_mode_list)
+    {
+        return 0;
+    }
+
+    #ifdef GRUB_MACHINE_PCBIOS
+    grub_dl_load ("vbe");
+    #endif
+
+    id = grub_video_get_driver_id ();
+
+    FOR_VIDEO_ADAPTERS (adapter)
+    {
+        if (!adapter->iterate ||
+            (adapter->id != id && (id != GRUB_VIDEO_DRIVER_NONE ||
+             adapter->init() != GRUB_ERR_NONE)))
+        {
+            continue;
+        }
+
+        adapter->iterate(ventoy_video_hook, NULL);
+
+        if (adapter->id != id)
+        {
+            adapter->fini();
+        }
+    }
+
+    /* sort video mode */
+    for (i = 0; i < g_video_mode_num; i++)
+    for (j = i + 1; j < g_video_mode_num; j++)
+    {
+        if (ventoy_video_mode_cmp(g_video_mode_list + i, g_video_mode_list + j) < 0)
+        {
+            grub_memcpy(&mode, g_video_mode_list + i, sizeof(ventoy_video_mode));
+            grub_memcpy(g_video_mode_list + i, g_video_mode_list + j, sizeof(ventoy_video_mode));
+            grub_memcpy(g_video_mode_list + j, &mode, sizeof(ventoy_video_mode));
+        }
+    }
+    
+    VENTOY_CMD_RETURN(GRUB_ERR_NONE);
+}
+
 static grub_file_t ventoy_wrapper_open(grub_file_t rawFile, enum grub_file_type type)
 {
     int len;
@@ -2958,6 +3079,67 @@ end:
     return rc;
 }
 
+static grub_err_t ventoy_cmd_load_part_table(grub_extcmd_context_t ctxt, int argc, char **args)
+{
+    grub_disk_t disk;
+    
+    (void)argc;
+    (void)ctxt;
+
+    g_ventoy_part_info = grub_zalloc(sizeof(ventoy_gpt_info));
+    if (!g_ventoy_part_info)
+    {
+        return 1;
+    }
+
+    disk = grub_disk_open(args[0]);
+    if (!disk)
+    {
+        debug("Failed to open disk %s\n", args[0]);
+        return 1;
+    }
+
+    grub_disk_read(disk, 0, 0, sizeof(ventoy_gpt_info), g_ventoy_part_info);
+    grub_disk_close(disk);
+    
+    return 0;
+}
+
+static grub_err_t ventoy_cmd_part_exist(grub_extcmd_context_t ctxt, int argc, char **args)
+{
+    int id;
+    grub_uint8_t zeroguid[16] = {0};
+
+    (void)argc;
+    (void)ctxt;
+
+    id = (int)grub_strtoul(args[0], NULL, 10);
+    grub_errno = 0;
+    
+    if (grub_memcmp(g_ventoy_part_info->Head.Signature, "EFI PART", 8) == 0)
+    {
+        if (id >= 1 && id <= 128)
+        {
+            if (grub_memcmp(g_ventoy_part_info->PartTbl[id - 1].PartGuid, zeroguid, 16))
+            {
+                return 0;
+            }
+        }        
+    }
+    else
+    {
+        if (id >= 1 && id <= 4)
+        {
+            if (g_ventoy_part_info->MBR.PartTbl[id - 1].FsFlag)
+            {
+                return 0;
+            }
+        }
+    }
+
+    return 1;
+}
+
 static grub_err_t ventoy_cmd_get_fs_label(grub_extcmd_context_t ctxt, int argc, char **args)
 {
     int rc = 1;
@@ -3115,6 +3297,85 @@ static grub_err_t ventoy_cmd_basename(grub_extcmd_context_t ctxt, int argc, char
     return 0;
 }
 
+static grub_err_t ventoy_cmd_enum_video_mode(grub_extcmd_context_t ctxt, int argc, char **args)
+{
+    struct grub_video_mode_info info;
+    char buf[32];
+    
+    (void)ctxt;
+    (void)argc;
+    (void)args;
+
+    if (!g_video_mode_list)
+    {
+        ventoy_enum_video_mode();
+    }
+
+    if (grub_video_get_info(&info) == GRUB_ERR_NONE)
+    {
+        grub_snprintf(buf, sizeof(buf), "Resolution (%ux%u)", info.width, info.height);
+    }
+    else
+    {
+        grub_snprintf(buf, sizeof(buf), "Resolution (0x0)");
+    }
+
+    grub_env_set("VTOY_CUR_VIDEO_MODE", buf);
+
+    grub_snprintf(buf, sizeof(buf), "%d", g_video_mode_num);
+    grub_env_set("VTOY_VIDEO_MODE_NUM", buf);
+
+    VENTOY_CMD_RETURN(0);
+}
+
+static grub_err_t vt_cmd_update_cur_video_mode(grub_extcmd_context_t ctxt, int argc, char **args)
+{
+    struct grub_video_mode_info info;
+    char buf[32];
+    
+    (void)ctxt;
+    (void)argc;
+    (void)args;
+
+    if (grub_video_get_info(&info) == GRUB_ERR_NONE)
+    {
+        grub_snprintf(buf, sizeof(buf), "%ux%ux%u", info.width, info.height, info.bpp);
+    }
+    else
+    {
+        grub_snprintf(buf, sizeof(buf), "0x0x0");
+    }
+
+    grub_env_set(args[0], buf);
+
+    VENTOY_CMD_RETURN(0);
+}
+
+static grub_err_t ventoy_cmd_get_video_mode(grub_extcmd_context_t ctxt, int argc, char **args)
+{
+    int id;
+    char buf[32];
+    
+    (void)ctxt;
+    (void)argc;
+
+    if (!g_video_mode_list)
+    {
+        return 0;
+    }
+
+    id = (int)grub_strtoul(args[0], NULL, 10);
+    if (id < g_video_mode_num)
+    {
+        grub_snprintf(buf, sizeof(buf), "%ux%ux%u", 
+            g_video_mode_list[id].width, g_video_mode_list[id].height, g_video_mode_list[id].bpp);
+    }
+
+    grub_env_set(args[1], buf);
+
+    VENTOY_CMD_RETURN(0);
+}
+
 grub_uint64_t ventoy_grub_get_file_size(const char *fmt, ...)
 {
     grub_uint64_t size = 0;
@@ -3264,10 +3525,14 @@ static cmd_para ventoy_cmds[] =
     { "vt_pop_last_entry", ventoy_cmd_pop_last_entry, 0, NULL, "", "", NULL },
     { "vt_get_lib_module_ver", ventoy_cmd_lib_module_ver, 0, NULL, "", "", NULL },
 
+    { "vt_load_part_table", ventoy_cmd_load_part_table, 0, NULL, "", "", NULL },
+    { "vt_check_part_exist", ventoy_cmd_part_exist, 0, NULL, "", "", NULL },
     { "vt_get_fs_label", ventoy_cmd_get_fs_label, 0, NULL, "", "", NULL },
     { "vt_fs_enum_1st_file", ventoy_cmd_fs_enum_1st_file, 0, NULL, "", "", NULL },
-    { "vt_file_basename", ventoy_cmd_basename, 0, NULL, "", "", NULL },
-    
+    { "vt_file_basename", ventoy_cmd_basename, 0, NULL, "", "", NULL },    
+    { "vt_enum_video_mode", ventoy_cmd_enum_video_mode, 0, NULL, "", "", NULL },    
+    { "vt_get_video_mode", ventoy_cmd_get_video_mode, 0, NULL, "", "", NULL },    
+    { "vt_update_cur_video_mode", vt_cmd_update_cur_video_mode, 0, NULL, "", "", NULL },    
 
     
     { "vt_find_first_bootable_hd", ventoy_cmd_find_bootable_hdd, 0, NULL, "", "", NULL },
index 8756a883edd55864925a2403438021d62f238b5b..7fa04626c1d287d6cf4f22ccbcc6dd96b185493c 100644 (file)
@@ -658,6 +658,15 @@ typedef struct ventoy_gpt_info
 }ventoy_gpt_info;
 #pragma pack()
 
+typedef struct ventoy_video_mode
+{
+    grub_uint32_t width;
+    grub_uint32_t height;
+    grub_uint32_t bpp;
+}ventoy_video_mode;
+
+
+
 typedef struct file_fullpath
 {
     char path[256];
@@ -741,6 +750,7 @@ extern int g_ventoy_iso_uefi_drv;
 extern int g_ventoy_case_insensitive;
 extern grub_uint8_t g_ventoy_chain_type;
 extern int g_vhdboot_enable;
+extern ventoy_gpt_info *g_ventoy_part_info;
 
 
 #define ventoy_unix_fill_virt(new_data, new_len) \
index fed05e7ed5839ebe93507159d9720f6b8cf3f859..98e83842aad588e869240e8af38757e50abf74e0 100644 (file)
@@ -141,64 +141,35 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy
     return 0;
 }
 
-static int ventoy_vhd_patch_disk(char *isopart, ventoy_patch_vhd *patch1, ventoy_patch_vhd *patch2)
+static int ventoy_vhd_patch_disk(ventoy_patch_vhd *patch1, ventoy_patch_vhd *patch2)
 {
-    char *pos;
-    grub_disk_t disk;
-    ventoy_gpt_info *gptinfo;
     char efipart[16] = {0};
 
-    pos = grub_strchr(isopart, ',');
-    if (pos)
-    {
-        *pos = 0;
-    }
-
-    pos = isopart;
-    if (*pos == '(')
-    {
-        pos++;
-    }
-
-    debug("vhd disk <%s>\n", pos);
+    grub_memcpy(efipart, g_ventoy_part_info->Head.Signature, sizeof(g_ventoy_part_info->Head.Signature));
 
-    disk = grub_disk_open(pos);
-    if (!disk)
-    {
-        debug("Failed to open disk %s\n", pos);
-        return 1;
-    }
-
-    gptinfo = (ventoy_gpt_info *)(g_vhdboot_isobuf + g_vhdboot_isolen);
-    grub_disk_read(disk, 0, 0, sizeof(ventoy_gpt_info), gptinfo);
-
-    grub_memcpy(efipart, gptinfo->Head.Signature, sizeof(gptinfo->Head.Signature));
-
-    debug("part1 type: 0x%x <%s>\n", gptinfo->MBR.PartTbl[0].FsFlag, efipart);
+    debug("part1 type: 0x%x <%s>\n", g_ventoy_part_info->MBR.PartTbl[0].FsFlag, efipart);
 
     if (grub_strncmp(efipart, "EFI PART", 8) == 0)
     {
-        ventoy_debug_dump_guid("GPT disk GUID: ", gptinfo->Head.DiskGuid);
-        ventoy_debug_dump_guid("GPT part GUID: ", gptinfo->PartTbl[0].PartGuid);
+        ventoy_debug_dump_guid("GPT disk GUID: ", g_ventoy_part_info->Head.DiskGuid);
+        ventoy_debug_dump_guid("GPT part GUID: ", g_ventoy_part_info->PartTbl[0].PartGuid);
         
-        grub_memcpy(patch1->disk_signature_or_guid, gptinfo->Head.DiskGuid, 16);
-        grub_memcpy(patch1->part_offset_or_guid, gptinfo->PartTbl[0].PartGuid, 16);
-        grub_memcpy(patch2->disk_signature_or_guid, gptinfo->Head.DiskGuid, 16);
-        grub_memcpy(patch2->part_offset_or_guid, gptinfo->PartTbl[0].PartGuid, 16);
+        grub_memcpy(patch1->disk_signature_or_guid, g_ventoy_part_info->Head.DiskGuid, 16);
+        grub_memcpy(patch1->part_offset_or_guid, g_ventoy_part_info->PartTbl[0].PartGuid, 16);
+        grub_memcpy(patch2->disk_signature_or_guid, g_ventoy_part_info->Head.DiskGuid, 16);
+        grub_memcpy(patch2->part_offset_or_guid, g_ventoy_part_info->PartTbl[0].PartGuid, 16);
 
         patch1->part_type = patch2->part_type = 0;
     }
     else
     {
         debug("MBR disk signature: %02x%02x%02x%02x\n",
-            gptinfo->MBR.BootCode[0x1b8 + 0], gptinfo->MBR.BootCode[0x1b8 + 1],
-            gptinfo->MBR.BootCode[0x1b8 + 2], gptinfo->MBR.BootCode[0x1b8 + 3]);
-        grub_memcpy(patch1->disk_signature_or_guid, gptinfo->MBR.BootCode + 0x1b8, 4);
-        grub_memcpy(patch2->disk_signature_or_guid, gptinfo->MBR.BootCode + 0x1b8, 4);
+            g_ventoy_part_info->MBR.BootCode[0x1b8 + 0], g_ventoy_part_info->MBR.BootCode[0x1b8 + 1],
+            g_ventoy_part_info->MBR.BootCode[0x1b8 + 2], g_ventoy_part_info->MBR.BootCode[0x1b8 + 3]);
+        grub_memcpy(patch1->disk_signature_or_guid, g_ventoy_part_info->MBR.BootCode + 0x1b8, 4);
+        grub_memcpy(patch2->disk_signature_or_guid, g_ventoy_part_info->MBR.BootCode + 0x1b8, 4);
     }
 
-    grub_disk_close(disk);
-
     return 0;
 }
 
@@ -214,7 +185,7 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
 
     grub_env_unset("vtoy_vhd_buf_addr");
 
-    debug("patch vhd <%s> <%s>\n", args[0], args[1]);
+    debug("patch vhd <%s>\n", args[0]);
 
     if ((!g_vhdboot_enable) || (!g_vhdboot_totbuf))
     {
@@ -232,8 +203,8 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
     patch1 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + g_vhdboot_bcd_offset + 0x495a);
     patch2 = (ventoy_patch_vhd *)(g_vhdboot_isobuf + g_vhdboot_bcd_offset + 0x50aa);
 
-    ventoy_vhd_patch_disk(args[0], patch1, patch2);
-    ventoy_vhd_patch_path(args[1], patch1, patch2);
+    ventoy_vhd_patch_disk(patch1, patch2);
+    ventoy_vhd_patch_path(args[0], patch1, patch2);
 
     /* set buffer and size */
 #ifdef GRUB_MACHINE_EFI
@@ -278,7 +249,7 @@ grub_err_t ventoy_cmd_load_vhdboot(grub_extcmd_context_t ctxt, int argc, char **
 
     g_vhdboot_isolen = (int)file->size;
 
-    buflen = (int)(file->size + sizeof(ventoy_gpt_info) + sizeof(ventoy_chain_head));
+    buflen = (int)(file->size + sizeof(ventoy_chain_head));
 
 #ifdef GRUB_MACHINE_EFI
     g_vhdboot_totbuf = (char *)grub_efi_allocate_iso_buf(buflen);
index 2274415fb3b7c0d9ec87065445e908fd412277a1..b91cc7edddade55495f3aa108bbb0a47c6019bc0 100644 (file)
Binary files a/INSTALL/EFI/BOOT/grubx64_real.efi and b/INSTALL/EFI/BOOT/grubx64_real.efi differ
index 5abb39549d6a7bb07e858d3d17ee12745002c313..b2ed544b89c5bd10ed4d191762feea1e9b7664c6 100644 (file)
@@ -1,3 +1,5 @@
+
+
 submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
     menuentry 'Check global control plugin configuration' --class=debug_control {
         set pager=1
@@ -60,6 +62,15 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
         set pager=1
         vt_check_plugin_json $vt_plugin_path injection $vtoy_iso_part
         
+        echo -e "\npress ENTER to exit ..."
+        read vtInputKey
+        unset pager
+    } 
+
+    menuentry 'Check auto memdisk plugin configuration' --class=debug_automemdisk {
+        set pager=1
+        vt_check_plugin_json $vt_plugin_path auto_memdisk $vtoy_iso_part
+        
         echo -e "\npress ENTER to exit ..."
         read vtInputKey
         unset pager
@@ -71,6 +82,33 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
 }
 
 
+submenu "Resolution Configuration" --class=debug_resolution {
+    menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
+        echo 'Return ...'
+    }
+    
+    vt_update_cur_video_mode VT_CUR_MODE
+    set vdid=0
+    while [ $vdid -lt $VTOY_VIDEO_MODE_NUM ]; do
+        vt_get_video_mode $vdid vtCurMode
+        
+        unset vtActive
+        if [ "$vtCurMode" = "$VT_CUR_MODE" ]; then
+            set vtActive="[*]"
+        fi
+        
+        menuentry "$vtCurMode $vtActive" --class=debug_videomode VTOY_RUN_RET {
+            terminal_output console
+            set gfxmode=$1
+            terminal_output gfxterm
+        }
+
+        vt_incr vdid 1
+    done
+}
+
+
+
 if [ "$grub_platform" != "pc" ]; then
     submenu 'Ventoy UEFI Utilities' --class=debug_util {
         menuentry 'Fixup Windows BlinitializeLibrary Failure' {
index df7d9a6fb75669986c771867ae0949939aa912a7..a7a0caeaa7647f088bcaea21d693385fa4107dc5 100644 (file)
@@ -48,7 +48,8 @@ function ventoy_power {
     configfile $prefix/power.cfg
 }
 
-function ventoy_diagnosis {    
+function ventoy_diagnosis {
+    vt_enum_video_mode    
     configfile $prefix/debug.cfg
 }
 
@@ -864,6 +865,10 @@ function iso_common_menuentry {
 function miso_common_menuentry {
     vt_chosen_img_path vt_chosen_path vt_chosen_size
 
+    echo "memdisk mode boot for $vt_chosen_path"
+    echo ""
+    ventoy_debug_pause
+
     if [ "$grub_platform" = "pc" ]; then
         legacy_iso_memdisk $vtoy_iso_part $vt_chosen_path
     else
@@ -954,7 +959,7 @@ function vhd_common_menuentry {
     fi
 
     vt_chosen_img_path vt_chosen_path vt_chosen_size
-    vt_patch_vhdboot ${vtoy_iso_part} ${vt_chosen_path}
+    vt_patch_vhdboot ${vt_chosen_path}
     
     ventoy_debug_pause    
     
@@ -1250,7 +1255,7 @@ function img_unsupport_menuentry {
 #############################################################
 #############################################################
 
-set VENTOY_VERSION="1.0.20"
+set VENTOY_VERSION="1.0.21"
 
 # Default menu display mode, you can change it as you want.
 #    0: List mode   
@@ -1277,9 +1282,10 @@ vt_device $root  vtoy_dev
 if [ "$vtoy_dev" = "tftp" ]; then
     set vtoy_path=($root)
     for vtid in 0 1 2 3; do
-        if [ -d (hd$vtid,2)/ventoy ]; then
+        if [ -f (hd$vtid,2)/ventoy/ventoy.cpio ]; then
             set vtoy_iso_part=(hd$vtid,1)
             set vtoy_efi_part=(hd$vtid,2)
+            set vtoydev=hd$vtid
             break
         fi
     done
@@ -1298,12 +1304,15 @@ else
         set vtoy_path=($root)/ventoy
     fi
 
+    set vtoydev=$vtoy_dev
     set vtoy_iso_part=($vtoy_dev,1)
     set vtoy_efi_part=($vtoy_dev,2)
     loadfont unicode
     set vt_plugin_path=$vtoy_iso_part
 fi
 
+#Load Partition Table
+vt_load_part_table $vtoydev
 
 #Load Plugin
 if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
@@ -1331,17 +1340,19 @@ fi
 
 if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
     set VTOY_F3_CMD="vt_dynamic_menu 1 1"
-    set VTOY_HOTKEY_TIP="F1:Memdisk  F2:Power  F3:TreeView  F4:Localboot  F5:Debug  F6:ExMenu"
+    set VTOY_HOTKEY_TIP="F1:Memdisk  F2:Power  F3:TreeView  F4:Localboot  F5:Tools  F6:ExMenu"
 else
     set VTOY_F3_CMD="vt_dynamic_menu 1 0"
-    set VTOY_HOTKEY_TIP="F1:Memdisk  F2:Power  F3:ListView  F4:Localboot  F5:Debug  F6:ExMenu"
+    set VTOY_HOTKEY_TIP="F1:Memdisk  F2:Power  F3:ListView  F4:Localboot  F5:Tools  F6:ExMenu"
 fi
 
 
 if [ -n "$vtoy_gfxmode" ]; then
     set gfxmode=$vtoy_gfxmode
+    set gfxpayload=keep
 else
-    set gfxmode=1920x1080,1366x768,1024x768,800x600,auto
+    set gfxmode=1920x1080,1366x768,1024x768,800x600,auto    
+    set gfxpayload=keep
 fi
 
 if [ "$vtoy_display_mode" = "CLI" ]; then
@@ -1370,10 +1381,11 @@ fi
 #export necessary variable
 export theme
 export gfxmode
-export vtoy_dev
+export vtoydev
 export vtoy_iso_part
 export vtoy_efi_part
 export VENTOY_VERSION
+export VTOY_CUR_VIDEO_MODE
 
 
 
index 4a81b06b3fa433d3f6293766788188bbcb0966ea..96b008ea60876193a5494eabe378e48133bc01ac 100644 (file)
Binary files a/INSTALL/grub/i386-pc/core.img and b/INSTALL/grub/i386-pc/core.img differ
index adc608524859987db1ff23e513b387f9ad45f2be..4a8b6c6a63422d902fbef434c6059b7bc4afc9eb 100644 (file)
@@ -122,7 +122,7 @@ crypto:
 part_bsd: part_msdos
 cs5536: pci
 biosdisk:
-ventoy: ext2 fshelp font crypto exfat udf extcmd normal relocator gcry_sha1 iso9660
+ventoy: ext2 fshelp font crypto exfat udf extcmd normal video gcry_sha1 relocator iso9660
 lsapm:
 gcry_sha512: crypto
 password: crypto normal
index b60d54fcb6b8188635c31c2b723639efa24a77f9..ff834169778ae81d4d52a4c6c6d926e31b23cbbf 100644 (file)
@@ -1,10 +1,33 @@
 
 if [ "$grub_platform" = "pc" ]; then
-    menuentry 'Search and boot Windows' --class=boot_windows {    
-        if search -n -s -f /bootmgr; then
-            ntldr /bootmgr
-        elif search -n -s -f /NTLDR; then
-            ntldr /NTLDR
+    menuentry 'Search and boot Windows' --class=boot_windows {
+    
+        set partid=3
+        while [ $partid -le 128 ]; do
+            if vt_check_part_exist $partid; then
+                for bt in bootmgr BOOTMGR Bootmgr BootMGR; do
+                    if [ -f ($vtoydev,$partid)/$bt ]; then
+                        set root=($vtoydev,$partid)
+                        ntldr /$bt
+                        boot
+                    fi
+                done
+            else
+                break
+            fi
+            vt_incr partid 1
+        done
+    
+        if search -n -s -f /Boot/BCD; then
+            for bt in bootmgr BOOTMGR Bootmgr BootMGR; do
+                if [ -f /$bt ]; then
+                    ntldr /$bt
+                    break
+                fi
+            done
+        elif search -n -s -f /NTDETECT.COM; then
+            drivemap -s hd0 $root
+            ntldr /ntldr
         else
             echo "Windows NOT found ..."
         fi        
@@ -39,6 +62,22 @@ if [ "$grub_platform" = "pc" ]; then
 else
 
     menuentry 'Search and boot Windows' --class=boot_windows {    
+        
+        set partid=3
+        while [ $partid -le 128 ]; do
+            if vt_check_part_exist $partid; then
+                if [ -f ($vtoydev,$partid)/EFI/Microsoft/Boot/bootmgfw.efi ]; then
+                    set root=($vtoydev,$partid)
+                    terminal_output  console
+                    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
+                    boot
+                fi
+            else
+                break
+            fi
+            vt_incr partid 1
+        done
+                
         if search -n -s -f /EFI/Microsoft/Boot/bootmgfw.efi; then
             terminal_output  console
             chainloader /EFI/Microsoft/Boot/bootmgfw.efi
index fb1e9c1e5cfa905614c0099e15ce47cd8f406fb9..daa3d49580d8388534097ce727eab1d7f6f548ee 100644 (file)
@@ -119,7 +119,7 @@ ehci: cs5536 usb boot
 crypto:
 part_bsd: part_msdos
 cs5536:
-ventoy: ext2 fshelp crypto font exfat udf extcmd normal gcry_sha1 iso9660
+ventoy: ext2 fshelp crypto font exfat udf extcmd normal video gcry_sha1 iso9660
 gcry_sha512: crypto
 password: crypto normal
 fshelp:
index a300aa4168c54fdad853126e291ef714bc0dbc6c..5f0600082a8bac775edebd186f2180f07ce543f7 100644 (file)
Binary files a/INSTALL/grub/x86_64-efi/normal.mod and b/INSTALL/grub/x86_64-efi/normal.mod differ
index 09cb30db7a344c4c4df98a779aafc1caa908744e..fa7e9e6d88ff899ed85e6c74f2d3a30c99cd2995 100644 (file)
Binary files a/INSTALL/ventoy/ventoy.cpio and b/INSTALL/ventoy/ventoy.cpio differ
index 3383ca2f6b5c62fd1813d4264c0a4ce85e469dd7..c4b4ee898068c39d9dd675195eb28ac9b4a0b2c5 100644 (file)
Binary files a/INSTALL/ventoy/vtloopex.cpio and b/INSTALL/ventoy/vtloopex.cpio differ