Skip to content

Commit

Permalink
4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
zdimension committed May 2, 2016
1 parent 70e3a03 commit 6168899
Show file tree
Hide file tree
Showing 9 changed files with 327 additions and 238 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
################################################################################

/SharpBoot/MorePerfectDOSVGA.ttf
/SharpBoot/MorePerfectDOSVGA2.ttf
/SharpBoot/obj
/SharpBoot/bin/Debug/SharpBoot.vshost.exe.manifest
*.userprefs
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SharpBoot
SharpBoot is a program for creating multiboot ISOs or USB keys by choosing other ISO files and putting them in categories.
You can choose between Syslinux and Grub4DOS, you can choose filesystem (when making an USB key) between FAT12, FAT16 or FAT32, you can choose resolution between 640x480, 800x600, 1024x768 or 1280x1024.
You can choose between Syslinux and Grub4DOS, you can choose filesystem (when making an USB key) between FAT12, FAT16, FAT32 or NTFS, you can choose resolution between 640x480, 800x600, 1024x768 or 1280x1024.
You can also pick a custom background image (automatically resized to chosen resolution).
![SharpBoot 4.2](https://i.imgur.com/Qox1uWk.png)
![SharpBoot 4.3](https://i.imgur.com/Qox1uWk.png)

# Translators
<table>
Expand Down
9 changes: 6 additions & 3 deletions SharpBoot.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 14.00
# Visual Studio 2015
VisualStudioVersion = 12.0.30501.0
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpBoot", "SharpBoot\SharpBoot.csproj", "{7EA17673-BEC5-4E2D-B51E-98FAA9C9B178}"
EndProject
Expand All @@ -19,4 +19,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(CodealikeProperties) = postSolution
SolutionGuid = ef9d50c6-b112-42f8-970f-658f3ab2802f
EndGlobalSection
EndGlobal
442 changes: 221 additions & 221 deletions SharpBoot/About.resx

Large diffs are not rendered by default.

100 changes: 90 additions & 10 deletions SharpBoot/Bootloaders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,31 +481,111 @@ public class Grub2 : IBootloader
{
public override string GetCode(BootMenu menu)
{
throw new NotImplementedException();
var code = "";

code += $"set gfxmode={Resolution.Width}x{Resolution.Height}\n";
code += "insmod video_bochs\ninsmod video_cirrus\ninsmod png\n";
code += "background_image /win32-loader/sharpboot.png\n";

menu.Items.ForEach(x => code += GetCode(x));

return code;
}

public override string GetCode(BootMenuItem item)
{
throw new NotImplementedException();
if (item.CustomCode != "") return item.CustomCode;

var code = "";

code += "menuentry \"" + item.Name.RemoveAccent() + "\" {\n";

if (item.Type == EntryType.BootHDD)
{
code += "insmod part_msdos\n";
code += "insmod chain\n";
code += "chainloader (hd0,0)\n";
}
else if(item.Type == EntryType.Category)
{
code += "configfile /win32-loader/" + item.IsoName + ".cfg\n";
}
else
{
code += $"search -f \"--set-root /images/{item.IsoName}\"\n";
switch (item.Type)
{
case EntryType.ISO:
code += $"drivemap \"/images/{item.IsoName}\" '(hd32)'\ndrivemap '--hook' ''\nset root='(hd32)'\nchainloader +1\n";
break;
case EntryType.IMG:
code += $"linux /memdisk\ninitrd /images/{item.IsoName}\n";
break;
case EntryType.NTLDR:
code += $"insmod part_msdos\ninsmod ntldr\ninsmod ntfs\nntldr /images/{item.IsoName}";
break;
case EntryType.GRLDR:
case EntryType.CMLDR:
case EntryType.FreeDOS:
case EntryType.MS_DOS:
case EntryType.MS_DOS_7:
case EntryType.PC_DOS:
case EntryType.DRMK:
case EntryType.ReactOS:
code += string.Format(
"ls /images/{0} || find --set-root /images/{0}\nchainloader /images/{0}\n",
item.IsoName);
break;
}
}

code += "}\n";

return code;
}

public override void SetImage(Image img, Size sz)
public override void SetImage(Image image, Size sz)
{
throw new NotImplementedException();
if (image == null) return;

var width = sz.Width;
var height = sz.Height;

var destRect = new Rectangle(0, 0, width, height);
var destImage = new Bitmap(width, height, PixelFormat.Format16bppRgb555);

destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);

using (var graphics = Graphics.FromImage(destImage))
{
graphics.CompositingMode = CompositingMode.SourceCopy;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;

using (var wrapMode = new ImageAttributes())
{
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
}
}

destImage.Save(Path.Combine(WorkingDir, "sharpboot.png"), ImageFormat.Png);
}

public override string BinFile { get; set; } = "g2ldr";
public override byte[] Archive { get; set; } = Resources.grub2;
public override string FolderName { get; set; } = "grub2";
public override string FolderName { get; set; } = "../win32-loader";
public override string DisplayName { get; set; } = "Grub2";
public override string FileExt { get; set; } = ".cfg";
public override string CmdArgs { get; set; } = "";
public override bool SupportAccent { get; set; } = false;
public override bool SupportAccent { get; set; } = true;
public override long TotalSize { get; set; } = 180335;

public override void Install(string l)
{
/*var d = Program.GetTemporaryDirectory();
var d = Program.GetTemporaryDirectory();
var exepath = Path.Combine(d, "grubinst.exe");
File.WriteAllBytes(exepath, Resources.grubinst);

Expand All @@ -525,8 +605,8 @@ public override void Install(string l)
p.Start();
p.WaitForExit();

Program.SafeDel(d);*/
var grub2_mbr = new byte[432]
Program.SafeDel(d);
/*var grub2_mbr = new byte[432]
{
0xEB, 0x63, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -585,7 +665,7 @@ public override void Install(string l)
src.Position = 0;
src.Write(mbr, 0, 512);
}
}
}*/
}
}

Expand Down
2 changes: 2 additions & 0 deletions SharpBoot/GenIsoFrm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ public void Generate()
File.WriteAllText(Path.Combine(sylp, "syslinux.cfg"), bloader.GetCode(main), Program.GetEnc());
else if (bloader is Grub4DOS)
File.WriteAllText(Path.Combine(isodir, "menu.lst"), bloader.GetCode(main));
else if(bloader is Grub2)
File.WriteAllText(Path.Combine(sylp, "grub.cfg"), bloader.GetCode(main));

if (bwkISO.CancellationPending)
{
Expand Down
4 changes: 2 additions & 2 deletions SharpBoot/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("4.2")]
[assembly: AssemblyFileVersion("4.2")]
[assembly: AssemblyVersion("4.3")]
[assembly: AssemblyFileVersion("4.3")]
[assembly: NeutralResourcesLanguage("en")]
Binary file modified SharpBoot/Resources/imagemagick.7z
Binary file not shown.
Binary file modified SharpBoot/Resources/qemu.7z
Binary file not shown.

0 comments on commit 6168899

Please sign in to comment.