Skip to content

Commit

Permalink
The newest ILCompiler doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
nifanfa committed Dec 16, 2022
1 parent 48493cf commit 249362b
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ConsoleApp1/ConsoleApp1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="7.0.0-preview.2.22152.2" />
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="7.0.0-alpha.1.22074.1" />
</ItemGroup>

<!-- The project file pretends this is .NET, but it's not .NET. Remove all assembly references the .NET SDK added. -->
Expand Down
53 changes: 49 additions & 4 deletions ConsoleApp1/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,64 @@ static EFI_STATUS EfiMain(EFI_HANDLE imageHandle, EFI_SYSTEM_TABLE* systemTable)

#if true
#region Cursor
int[] cursor = new int[]
{
1,0,0,0,0,0,0,0,0,0,0,0,
1,1,0,0,0,0,0,0,0,0,0,0,
1,2,1,0,0,0,0,0,0,0,0,0,
1,2,2,1,0,0,0,0,0,0,0,0,
1,2,2,2,1,0,0,0,0,0,0,0,
1,2,2,2,2,1,0,0,0,0,0,0,
1,2,2,2,2,2,1,0,0,0,0,0,
1,2,2,2,2,2,2,1,0,0,0,0,
1,2,2,2,2,2,2,2,1,0,0,0,
1,2,2,2,2,2,2,2,2,1,0,0,
1,2,2,2,2,2,2,2,2,2,1,0,
1,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,1,1,1,1,1,
1,2,2,2,1,2,2,1,0,0,0,0,
1,2,2,1,0,1,2,2,1,0,0,0,
1,2,1,0,0,1,2,2,1,0,0,0,
1,1,0,0,0,0,1,2,2,1,0,0,
0,0,0,0,0,0,1,2,2,1,0,0,
0,0,0,0,0,0,0,1,1,0,0,0
};

EFI_SIMPLE_POINTER_PROTOCOL* pointer;
gBS->LocateProtocol((EFI_GUID*)EFI_SIMPLE_POINTER_PROTOCOL_GUID, null, (void**)&pointer);
GetFB(out var fb, out var width, out var height);
EFI_SIMPLE_POINTER_STATE sts;
pointer->Mode->ResolutionX = width;
pointer->Mode->ResolutionY = height;
float Precision = 100;
float MouseSpeed = 200;

int CursorX = 0;
int CursorY = 0;

for (; ; )
{
pointer->GetState(pointer, &sts);
int AxisX = (int)((sts.RelativeMovementX / 65536f) * Precision);
int AxisY = (int)((sts.RelativeMovementY / 65536f) * Precision);
fb[width * (height / 2 + AxisY) + (width / 2 + AxisX)] = 0xFFFF0000;
CursorX = Clamp(CursorX + (int)((sts.RelativeMovementX / 65536f) * MouseSpeed), 0, (int)width);
CursorY = Clamp(CursorY + (int)((sts.RelativeMovementY / 65536f) * MouseSpeed), 0, (int)height);
DrawCursor(fb,CursorX, CursorY);
}

void DrawCursor(uint* fb, int x, int y)
{
for (int h = 0; h < 19; h++)
{
for (int w = 0; w < 12; w++)
{
if (cursor[h * 12 + w] == 1)
{
SetPixel(w + x, h + y, 0);
}
if (cursor[h * 12 + w] == 2)
{
SetPixel(w + x, h + y, 0xFFFFFFFF);
}
}
}
}

void SetPixel(int x,int y,uint color)
Expand Down
10 changes: 10 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
<add key="dotnet-experimental" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>

0 comments on commit 249362b

Please sign in to comment.