Skip to content

Commit

Permalink
SkiaSharp: load correct arch
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Feb 17, 2018
1 parent 639ef33 commit c5aacbc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
33 changes: 33 additions & 0 deletions MainV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,25 @@ internal static extern IntPtr RegisterDeviceNotification

static public int SW_SHOWNORMAL = 1;
static public int SW_HIDE = 0;

[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hReservedNull, LoadLibraryFlags dwFlags);

[System.Flags]
public enum LoadLibraryFlags : uint
{
DONT_RESOLVE_DLL_REFERENCES = 0x00000001,
LOAD_IGNORE_CODE_AUTHZ_LEVEL = 0x00000010,
LOAD_LIBRARY_AS_DATAFILE = 0x00000002,
LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = 0x00000040,
LOAD_LIBRARY_AS_IMAGE_RESOURCE = 0x00000020,
LOAD_LIBRARY_SEARCH_APPLICATION_DIR = 0x00000200,
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000,
LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 0x00000100,
LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800,
LOAD_LIBRARY_SEARCH_USER_DIRS = 0x00000400,
LOAD_WITH_ALTERED_SEARCH_PATH = 0x00000008
}
}

public static menuicons displayicons = new burntkermitmenuicons();
Expand Down Expand Up @@ -537,6 +556,18 @@ public MainV2()

SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

try
{
if (Environment.Is64BitProcess)
{
var skia = NativeMethods.LoadLibraryEx("x64/libSkiaSharp.dll", IntPtr.Zero, 0);
}
else
{
var skia = NativeMethods.LoadLibraryEx("x86/libSkiaSharp.dll", IntPtr.Zero, 0);
}
} catch { }

// set this before we reset it
Settings.Instance["NUM_tracklength"] = "200";

Expand Down Expand Up @@ -981,6 +1012,8 @@ public MainV2()
MenuDonate.Image = Program.Logo;
}



Application.DoEvents();

Comports.Add(comPort);
Expand Down
10 changes: 9 additions & 1 deletion MissionPlanner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<EnableDefaultItems>false</EnableDefaultItems>
<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
<BumpRevision>false</BumpRevision>
<BumpResetLabel>dev</BumpResetLabel>
Expand Down Expand Up @@ -230,6 +230,7 @@
<PackageReference Include="SharpDX" version="4.0.1" targetFramework="net462" />
<PackageReference Include="SharpDX.DirectInput" version="4.0.1" targetFramework="net462" />
<PackageReference Include="SharpZipLib" version="0.86.0" targetFramework="net40" />
<PackageReference Include="SkiaSharp" Version="1.59.3" />
<PackageReference Include="SSH.NET" version="2016.0.0" targetFramework="net40" />
<PackageReference Include="System.Drawing.Common" Version="4.5.0-preview1-25914-04" />
<PackageReference Include="System.IO.Ports" Version="4.4.0" />
Expand Down Expand Up @@ -1963,4 +1964,11 @@
</Target>


<ItemGroup>
<None Update="C:\Users\hog\.nuget\packages\skiasharp\1.59.3\build\net45\..\..\runtimes\win7-x64\native\libSkiaSharp.dll">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
</ItemGroup>


</Project>

0 comments on commit c5aacbc

Please sign in to comment.