This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Target Name="GenerateVirtuaDisk" AfterTargets="Publish"> | |
<PropertyGroup> | |
<VHD>$(MSBuildProjectDirectory)\$(NativeOutputPath)seesharpsnake.vhdx</VHD> | |
<CreatePartitionCommand> | |
create vdisk file=$(VHD) maximum=40 | |
select vdisk file=$(VHD) | |
attach vdisk | |
convert gpt | |
create partition efi | |
format quick fs=fat32 label="System" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ItemGroup> | |
<LinkerArg Include="/subsystem:EFI_APPLICATION /entry:EfiMain" /> | |
</ItemGroup> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PropertyGroup> | |
<NoStdLib>true</NoStdLib> | |
<NoConfig>true</NoConfig> | |
<RuntimeMetadataVersion>v4.0.30319</RuntimeMetadataVersion> | |
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> | |
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute> | |
<IlcSystemModule>SeeSharpSnake</IlcSystemModule> | |
</PropertyGroup> | |
<Target Name="CustomizeReferences" BeforeTargets="BeforeCompile" AfterTargets="FindReferenceAssembliesForReferences"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace System.Runtime.InteropServices | |
{ | |
public class UnmanagedType { } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Runtime.InteropServices.McgIntrinsicsAttribute] | |
internal class RawCalliHelper | |
{ | |
public static unsafe ulong StdCall<T, U, W, X>(IntPtr pfn, T* arg1, U* arg2, W* arg3, X* arg4) where T : unmanaged where U : unmanaged where W : unmanaged where X : unmanaged | |
{ | |
// This will be filled in by an IL transform | |
return 0; | |
} | |
public static unsafe ulong StdCall<T, U, W, X>(IntPtr pfn, T arg1, U* arg2, W* arg3, X* arg4) where T : struct where U : unmanaged where W : unmanaged where X : unmanaged | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public unsafe static class EfiApplication | |
{ | |
[System.Runtime.RuntimeExport("EfiMain")] | |
unsafe static long EfiMain(IntPtr imageHandle, EFI_SYSTEM_TABLE* systemTable) | |
{ | |
EfiRuntimeHost.Initialize(systemTable); | |
Console.Clear(); | |
Game.Main(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[StructLayout(LayoutKind.Sequential)] | |
public unsafe readonly struct EFI_SIMPLE_TEXT_INPUT_PROTOCOL | |
{ | |
private readonly IntPtr _reset; | |
private readonly IntPtr _readKeyStroke; | |
public readonly IntPtr WaitForKey; | |
public void Reset(void* handle, bool ExtendedVerification) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public unsafe static ConsoleColor ForegroundColor | |
{ | |
set | |
{ | |
s_consoleAttribute = (ushort)value; | |
uint color = s_consoleAttribute; | |
EfiRuntimeHost.SystemTable->ConOut->SetAttribute(EfiRuntimeHost.SystemTable->ConOut, color); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public unsafe static class EfiRuntimeHost | |
{ | |
public static EFI_SYSTEM_TABLE* SystemTable { get; private set; } | |
public static void Initialize(EFI_SYSTEM_TABLE* systemTable) | |
{ | |
SystemTable = systemTable; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<packageSources> | |
<add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"/> | |
</packageSources> | |
</configuration> |