Create Simulator target scaffold
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NativeLibDir>$(NativeLibDir)</NativeLibDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="$(NativeLibDir)\nova64_core.dll" Condition="Exists('$(NativeLibDir)\nova64_core.dll')" />
|
||||
<None Include="$(NativeLibDir)\libnova64_core.so" Condition="Exists('$(NativeLibDir)\libnova64_core.so')" />
|
||||
<None Include="$(NativeLibDir)\libnova64_core.dylib" Condition="Exists('$(NativeLibDir)\libnova64_core.dylib')" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CopyNativeLibrary" AfterTargets="Build" Condition="'$(NativeLibDir)' != ''">
|
||||
<ItemGroup>
|
||||
<NativeLibraryFiles Include="$(NativeLibDir)\nova64_core.dll" Condition="Exists('$(NativeLibDir)\nova64_core.dll')" />
|
||||
<NativeLibraryFiles Include="$(NativeLibDir)\libnova64_core.so" Condition="Exists('$(NativeLibDir)\libnova64_core.so')" />
|
||||
<NativeLibraryFiles Include="$(NativeLibDir)\libnova64_core.dylib" Condition="Exists('$(NativeLibDir)\libnova64_core.dylib')" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(NativeLibraryFiles)" DestinationFolder="$(OutputPath)" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
internal static class Nova64Core
|
||||
{
|
||||
private const string LibName = "nova64_core";
|
||||
|
||||
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern bool nova64_init_io(IntPtr io_interface);
|
||||
|
||||
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int nova64_process_tick(uint delta_ms);
|
||||
|
||||
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern uint nova64_get_version();
|
||||
}
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static void Main()
|
||||
{
|
||||
Console.WriteLine("Nova64 simulator starting...");
|
||||
|
||||
try
|
||||
{
|
||||
var version = Nova64Core.nova64_get_version();
|
||||
Console.WriteLine($"Loaded nova64_core native library. Version: 0x{version:X}");
|
||||
}
|
||||
catch (DllNotFoundException ex)
|
||||
{
|
||||
Console.WriteLine($"Native library not found: {ex.Message}");
|
||||
}
|
||||
catch (EntryPointNotFoundException ex)
|
||||
{
|
||||
Console.WriteLine($"Native entry point missing: {ex.Message}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Failed to initialize native library: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user