First, a little reminder: SharpBoot was designed to replace XBoot, because it is buggy as hell, the UI quite sucks (I don't say SharpBoot's doesn't, but it's a bit more beautiful), sometimes it crashes while writing USB or ISO, etc. Next, it's designed to be more extensible and modular than YUMI (which almost only works well for booting Linux distros) and Sardu.
Next, I don't think we are talking about the same thing. Let's say I have an Ubuntu 16.04 ISO (/images/ubuntu.iso) and I want to boot it.
If I look into the ISO, I have the /boot/grub.cfg file which contains:
menuentry "Install Ubuntu" {
set gfxpayload=keep
linux /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash ---
initrd /casper/initrd.lz
}
Well I just have to take create a loopback, add (loop) in those two lines and add the iso-scan command and I have this:
menuentry "Ubuntu 16.04" {
set isofile="/images/ubuntu.iso"
loopback loop $isofile
linux (loop)/casper/vmlinuz.efi iso-scan/filename=$isofile boot=casper file=/cdrom/preseed/ubuntu.seed only-ubiquity quiet splash --
initrd (loop)/casper/initrd.lz
}
And it works.
The easiest way is just to write those two lines for each version directly in the AppDB so that when it detects version X of distro Y, it knows what to write. But here I didn't even need to know it was Ubuntu 16.04, I only took the line from the grub.cfg file, added iso-scan and (loop) and it works.
For Windows, you remove the linux and initrd lines and add "ntldr /bootmgr" and it works too.
Then, if nothing worked (if the ISO is neither Windows or Linux, or Linux with some weird bootloader) I simply have to do
menuentry "Nope" {
set opt='find --set-root /images/thing.iso;map /images/thing.iso (0xff);map --hook;root (0xff);chainloader (0xff);boot'
linux /boot/grub/grub.exe --config-file=$opt
}
And G4D CD-ROM emulation does the rest for me.
That way, I can boot absolutely any ISO file in the world, no matter if Grub is installed on an USB key or in an ISO file.