mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-21 05:18:38 +00:00
check if VBE is available with multiboot
This commit is contained in:
parent
f20d7f3930
commit
cf019fef47
3 changed files with 27 additions and 2 deletions
|
|
@ -64,6 +64,25 @@ namespace Cosmos.Core
|
|||
public unsafe static class VBE
|
||||
{
|
||||
|
||||
static uint VBEINFO_PRESENT = (1 << 11);
|
||||
|
||||
public static bool IsAvailable()
|
||||
{
|
||||
if ((Bootstrap.header->Flags & VBEINFO_PRESENT) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static ModeInfo getModeInfo()
|
||||
{
|
||||
return *Bootstrap.modeinfo;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 36)]
|
||||
public struct ControllerInfo
|
||||
{
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace Cosmos.System.Graphics
|
|||
{
|
||||
return new SVGAIICanvas();
|
||||
}
|
||||
else if (BGAExists() || PCI.GetDevice((VendorID)0x80EE, (DeviceID)0xBEEF) != null)
|
||||
else if (BGAExists() || PCI.GetDevice((VendorID)0x80EE, (DeviceID)0xBEEF) != null || Core.VBE.IsAvailable())
|
||||
{
|
||||
return new VBECanvas();
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ namespace Cosmos.System.Graphics
|
|||
{
|
||||
return new SVGAIICanvas(mode);
|
||||
}
|
||||
else if (BGAExists() || PCI.GetDevice((VendorID)0x80EE, (DeviceID)0xBEEF) != null)
|
||||
else if (BGAExists() || PCI.GetDevice((VendorID)0x80EE, (DeviceID)0xBEEF) != null || Core.VBE.IsAvailable())
|
||||
{
|
||||
return new VBECanvas(mode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,12 @@ namespace Cosmos.System.Graphics
|
|||
{
|
||||
Global.mDebugger.SendInternal($"Creating new VBEScreen() with mode {aMode.Columns}x{aMode.Rows}x{(uint)aMode.ColorDepth}");
|
||||
|
||||
if (Core.VBE.IsAvailable())
|
||||
{
|
||||
Core.VBE.ModeInfo ModeInfo = Core.VBE.getModeInfo();
|
||||
aMode = new Mode(ModeInfo.width, ModeInfo.height, (ColorDepth)ModeInfo.bpp);
|
||||
}
|
||||
|
||||
ThrowIfModeIsNotValid(aMode);
|
||||
|
||||
_VBEDriver = new VBEDriver((ushort)aMode.Columns, (ushort)aMode.Rows, (ushort)aMode.ColorDepth);
|
||||
|
|
|
|||
Loading…
Reference in a new issue