# See http://www.easy2boot.com/configuring-e2b/add-a-new-menu-folder/ 
# --- FASTLOAD ---

iftitle [if not exist CD && if not exist NOFLDMNU && cat --locate=NO ()/FASTLOAD.YES > nul] $$STRhMFE
# use current menu
echo YES > /FASTLOAD.YES && set MFOLDER=/_ISO/MAINMENU
# update cached menu file
cat (md)0xA000+0x50 > /%grub%/FASTLOAD.MNU
configfile (md)0xA000+0x50

iftitle [if not exist CD && if not exist NOFLDMNU && cat --locate=YES ()/FASTLOAD.YES > nul] $$STRhMFD 
# Disable fastload
echo NO > /FASTLOAD.YES && set MFOLDER=/_ISO/MAINMENU
configfile /%grub%/menu.lst

# --- FASTLOAD STATUS INDICATOR

iftitle [if exist STALE && cat --locate=YES ()/FASTLOAD.YES > nul] $$STRmFS1
if not "%GFX%"=="" configfile (md)0xa000+0x50
root ()

# --- AUTO FOLDER ---

iftitle [if "%GFX%"=="" && ls (bd)/_ISO/AUTO/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRmAUT
set LBACKMENU=(bd)/%grub%/menu.lst
(bd)/%grub%/QAUTO.g4b .automenu /_ISO/AUTO
debug 0
configfile (md)0x3000+0x50

# if GFX menu
iftitle [if not "%GFX%"=="" && ls (bd)/_ISO/AUTO/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRmGAT
set LBACKMENU=(bd)/%grub%/menu.lst
(bd)/%grub%/QAUTO.g4b .automenu /_ISO/AUTO
debug 0
configfile (md)0x3000+0x50

# -- SUBFOLDER MENUS ---


iftitle [if "%GFX%"=="" && ls (bd)/_ISO/ANTIVIRUS/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRm016
#MFOLDER must be the full folder path starting with /
set MFOLDER=/_ISO/ANTIVIRUS
#HDG is the top heading for the menu
set HDG=$$STRm017
(bd)/%grub%/SubMenu.g4b
boot


iftitle [if not "%GFX%"=="" && ls (bd)/_ISO/ANTIVIRUS/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRmG16
#MFOLDER must be the full folder path starting with /
set MFOLDER=/_ISO/ANTIVIRUS
#HDG is the top heading for the menu
set HDG=$$STRm017
(bd)/%grub%/SubMenu.g4b
boot



iftitle [if "%GFX%"=="" && ls (bd)/_ISO/BACKUP/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRm022
#MFOLDER must be the full folder path starting with /
set MFOLDER=/_ISO/BACKUP
#HDG is the top heading for the menu
set HDG=$$STRm023
(bd)/%grub%/SubMenu.g4b
boot

iftitle [if not "%GFX%"=="" && ls (bd)/_ISO/BACKUP/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRmG22
#MFOLDER must be the full folder path starting with /
set MFOLDER=/_ISO/BACKUP
#HDG is the top heading for the menu
set HDG=$$STRm023
(bd)/%grub%/SubMenu.g4b
boot




iftitle [if "%GFX%"=="" && ls (bd)/_ISO/DOS/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRm018
set MFOLDER=/_ISO/DOS
#MFOLDER must be the full folder path starting with /
set HDG=$$STRm019
#HDG is the top heading for the menu
(bd)/%grub%/SubMenu.g4b
boot

iftitle [if not "%GFX%"=="" && ls (bd)/_ISO/DOS/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRmG18
set MFOLDER=/_ISO/DOS
#MFOLDER must be the full folder path starting with /
set HDG=$$STRm019
#HDG is the top heading for the menu
(bd)/%grub%/SubMenu.g4b
boot

iftitle [if "%GFX%"=="" && ls (bd)/_ISO/LINUX/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRm020
#MFOLDER must be the full folder path starting with /
set MFOLDER=/_ISO/LINUX
#HDG is the top heading for the menu
set HDG=$$STRm021
(bd)/%grub%/SubMenu.g4b
boot

iftitle [if not "%GFX%"=="" && ls (bd)/_ISO/LINUX/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRmG20
#MFOLDER must be the full folder path starting with /
set MFOLDER=/_ISO/LINUX
#HDG is the top heading for the menu
set HDG=$$STRm021
(bd)/%grub%/SubMenu.g4b
boot



iftitle [if "%GFX%"=="" && ls (bd)/_ISO/UTILITIES/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRm024
#MFOLDER must be the full folder path starting with /
set MFOLDER=/_ISO/UTILITIES
#HDG is the top heading for the menu
set HDG=$$STRm025
(bd)/%grub%/SubMenu.g4b
boot


iftitle [if not "%GFX%"=="" && ls (bd)/_ISO/UTILITIES/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRmG24
#MFOLDER must be the full folder path starting with /
set MFOLDER=/_ISO/UTILITIES
#HDG is the top heading for the menu
set HDG=$$STRm025
(bd)/%grub%/SubMenu.g4b
boot


iftitle [if "%GFX%"=="" && ls (bd)/_ISO/WINPE/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRm026
#MFOLDER must be the full folder path starting with /
set MFOLDER=/_ISO/WINPE
#HDG is the top heading for the menu
set HDG=$$STRm027
(bd)/%grub%/SubMenu.g4b
boot

iftitle [if not "%GFX%"=="" && ls (bd)/_ISO/WINPE/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRmG26
set MFOLDER=/_ISO/WINPE
#HDG is the top heading for the menu
set HDG=$$STRm027
(bd)/%grub%/SubMenu.g4b
boot

iftitle [if "%GFX%"=="" && ls (bd)/_ISO/WIN/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRm003
#MFOLDER must be the full folder path starting with /
set MFOLDER=/_ISO/WIN
#HDG is the top heading for the menu
set HDG=$$STRm004
(bd)/%grub%/SubMenu.g4b
boot

iftitle [if not "%GFX%"=="" && ls (bd)/_ISO/WIN/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] $$STRmG03
#MFOLDER must be the full folder path starting with /
set MFOLDER=/_ISO/WIN
#HDG is the top heading for the menu
set HDG=$$STRm004
(bd)/%grub%/SubMenu.g4b
boot

# --- WINDOWS INSTALLS

iftitle [if "%GFX%"=="" && if not @%CALL%@==@0@ && if not exist NOWINMAIN] $$STRm0WI
debug 0
/%grub%/configX.g4b (bd)/%grub%/MenuWinInstall.lst
boot

iftitle [if not "%GFX%"=="" && if not @%CALL%@==@0@ && if not exist NOWINMAIN] $$STRmGWI
debug 0
/%grub%/configX.g4b (bd)/%grub%/MenuWinInstall.lst
boot

F1
# --- F1 HELP ---

iftitle [if "%GFX%"=="" if not exist NOF1] $$STRhelp
if exist /_ISO/F1.cfg configfile /_ISO/F1.cfg
if exist /%grub%/%LANG%/F1.cfg configfile /%grub%/%LANG%/F1.cfg
if exist /%grub%/ENG/F1.cfg configfile /%grub%/ENG/F1.cfg
errorcheck off
boot


iftitle [if not "%GFX%"=="" if not exist NOF1] $$STRhelG
if exist /_ISO/F1.cfg configfile /_ISO/F1.cfg
if exist /%grub%/%LANG%/F1.cfg configfile /%grub%/%LANG%/F1.cfg
if exist /%grub%/ENG/F1.cfg configfile /%grub%/ENG/F1.cfg
errorcheck off
boot

# === F7 ===


iftitle [if "%GFX%"=="" if not exist NOF7HD] $$STRh0F7
if not exist CD map (hd0) (hd1) && map (hd1) (hd0)
if not exist CD map --hook
chainloader (hd0)+1 
rootnoverify (hd0)

iftitle [if not "%GFX%"=="" if not exist NOF7HD] $$STRhGF7
if not exist CD map (hd0) (hd1) && map (hd1) (hd0)
if not exist CD map --hook
chainloader (hd0)+1 
rootnoverify (hd0)


# --- F8 RELOAD\REFRESH CACHE ---

iftitle [if "%GFX%"=="" && if not exist NOF8MAIN] $$STRh0F8
# Update fastmenu if possible
if not exist CD cat --locate=YES ()/FASTLOAD.YES > nul && echo REFRESH > /FASTLOAD.YES
debug 0
# uncomment lines below for F8 to do a fresh reload
#splashimage
#set DONEMENU=
if exist (bd)/%grub%/menu.lst configfile (bd)/%grub%/menu.lst 
if not exist (bd)/%grub%/menu.lst set MFOLDER=/_ISO/MAINMENU && configfile (md)0xA000+0x50
boot

iftitle [if not "%GFX%"=="" && if not exist NOF8MAIN] $$STRhGF8
# Update fastmenu if possible
if not exist CD cat --locate=YES ()/FASTLOAD.YES > nul && echo REFRESH > /FASTLOAD.YES
debug 0
#set DONEMENU=
if exist (bd)/%grub%/menu.lst configfile (bd)/%grub%/menu.lst 
if not exist (bd)/%grub%/menu.lst set MFOLDER=/_ISO/MAINMENU && configfile (md)0xA000+0x50
boot












