mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-06-30 04:16:25 +02:00
bunch of stuff don't push this monstrosity anywhere
actual stuff don't push this monstrosity anywhere
This commit is contained in:
parent
259f5da0fb
commit
59d6ceb9ee
31 changed files with 513 additions and 77 deletions
|
@ -33,6 +33,7 @@ using Silk.NET.Vulkan;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using ConfigGamepadInputId = Ryujinx.Common.Configuration.Hid.Controller.GamepadInputId;
|
||||
|
@ -60,16 +61,46 @@ namespace Ryujinx.Headless.SDL2
|
|||
|
||||
private static readonly InputConfigJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
|
||||
[UnmanagedCallersOnly(EntryPoint = "main_ryujinx_sdl")]
|
||||
public static unsafe int MainExternal(int argCount, IntPtr* pArgs)
|
||||
{
|
||||
string[] args = new string[argCount];
|
||||
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < argCount; i++)
|
||||
{
|
||||
args[i] = Marshal.PtrToStringAnsi(pArgs[i]);
|
||||
|
||||
Console.WriteLine(args[i]);
|
||||
}
|
||||
|
||||
Main(args);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.ToString());
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Version = ReleaseInformation.GetVersion();
|
||||
|
||||
// Make process DPI aware for proper window sizing on high-res screens.
|
||||
ForceDpiAware.Windows();
|
||||
|
||||
Console.Title = $"Ryujinx Console {Version} (Headless SDL2)";
|
||||
Silk.NET.Core.Loader.SearchPathContainer.Platform = Silk.NET.Core.Loader.UnderlyingPlatform.MacOS;
|
||||
|
||||
if (OperatingSystem.IsMacOS() || OperatingSystem.IsLinux())
|
||||
Version = ReleaseInformation.GetVersion();
|
||||
|
||||
if (!OperatingSystem.IsIOS())
|
||||
{
|
||||
Console.Title = $"Ryujinx Console {Version} (Headless SDL2)";
|
||||
}
|
||||
|
||||
if (OperatingSystem.IsMacOS() || OperatingSystem.IsIOS() || OperatingSystem.IsLinux())
|
||||
{
|
||||
AutoResetEvent invoked = new(false);
|
||||
|
||||
|
@ -344,12 +375,12 @@ namespace Ryujinx.Headless.SDL2
|
|||
|
||||
GraphicsConfig.EnableShaderCache = true;
|
||||
|
||||
if (OperatingSystem.IsMacOS())
|
||||
if (OperatingSystem.IsMacOS() || OperatingSystem.IsIOS())
|
||||
{
|
||||
if (option.GraphicsBackend == GraphicsBackend.OpenGl)
|
||||
{
|
||||
option.GraphicsBackend = GraphicsBackend.Vulkan;
|
||||
Logger.Warning?.Print(LogClass.Application, "OpenGL is not supported on macOS, switching to Vulkan!");
|
||||
Logger.Warning?.Print(LogClass.Application, "OpenGL is not supported on Apple platforms, switching to Vulkan!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,88 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifiers>ios-arm64</RuntimeIdentifiers>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Version>1.0.0-dirty</Version>
|
||||
<DefineConstants Condition=" '$(ExtraDefineConstants)' != '' ">$(DefineConstants);$(ExtraDefineConstants)</DefineConstants>
|
||||
<SigningCertificate Condition=" '$(SigningCertificate)' == '' ">-</SigningCertificate>
|
||||
<TieredPGO>true</TieredPGO>
|
||||
|
||||
<PublishAot>true</PublishAot>
|
||||
<PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
|
||||
<UseNativeAOTRuntime>true</UseNativeAOTRuntime>
|
||||
<TrimmerSingleWarn>false</TrimmerSingleWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- iOS linking stuff from godot -->
|
||||
|
||||
<PropertyGroup>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<LinkStandardCPlusPlusLibrary>true</LinkStandardCPlusPlusLibrary>
|
||||
<FindXCode Condition=" '$(XCodePath)' == '' and '$([MSBuild]::IsOsPlatform(OSX))' ">true</FindXCode>
|
||||
<XCodePath Condition=" '$(XCodePath)' == '' ">/Applications/Xcode.app/Contents/Developer</XCodePath>
|
||||
<XCodePath>$([MSBuild]::EnsureTrailingSlash('$(XCodePath)'))</XCodePath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="PrepareBeforeIlcCompile"
|
||||
BeforeTargets="IlcCompile">
|
||||
|
||||
<Copy SourceFiles="%(ResolvedRuntimePack.PackageDirectory)/runtimes/$(RuntimeIdentifier)/native/icudt.dat" DestinationFolder="$(PublishDir)"/>
|
||||
|
||||
<!-- We need to find the path to Xcode so we can set manual linker args to the correct SDKs
|
||||
Once https://github.com/dotnet/runtime/issues/88737 is released, we can take this out
|
||||
-->
|
||||
|
||||
<Exec Command="xcrun xcode-select -p" ConsoleToMSBuild="true" Condition=" '$(FindXCode)' == 'true' ">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="XcodeSelect" />
|
||||
</Exec>
|
||||
|
||||
<PropertyGroup Condition=" '$(FindXCode)' == 'true' ">
|
||||
<XCodePath>$(XcodeSelect)</XCodePath>
|
||||
<XCodePath>$([MSBuild]::EnsureTrailingSlash('$(XCodePath)'))</XCodePath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Message Importance="normal" Text="Found XCode at $(XcodeSelect)" Condition=" '$(FindXCode)' == 'true' "/>
|
||||
|
||||
<ItemGroup>
|
||||
<LinkerArg Include="-Wl,-ld_classic" />
|
||||
<LinkerArg Include="-isysroot %22$(XCodePath)Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk%22"
|
||||
Condition=" $(RuntimeIdentifier.Contains('simulator')) "/>
|
||||
<LinkerArg Include="-isysroot %22$(XCodePath)Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk%22"
|
||||
Condition=" !$(RuntimeIdentifier.Contains('simulator')) "/>
|
||||
</ItemGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
<Target Name="FixDylib"
|
||||
AfterTargets="Publish">
|
||||
<!-- The dylib id needs to be changed to have @rpath -->
|
||||
|
||||
<Exec Command="install_name_tool -id @rpath/$(TargetName).dylib $(NativeBinary)" ConsoleToMSBuild="true" />
|
||||
</Target>
|
||||
|
||||
<Target Name="FixSymbols"
|
||||
AfterTargets="Publish">
|
||||
|
||||
<RemoveDir Directories="$(PublishDir)$(TargetName).framework.dSYM"/>
|
||||
|
||||
<!-- create-xcframework (called from the export plugin wants the symbol files in a directory
|
||||
with a slightly different name from the one created by dotnet publish, so we copy them over
|
||||
to the correctly-named directory -->
|
||||
<ItemGroup>
|
||||
<SymbolFiles Include="$(NativeBinary).dsym\**\*.*"/>
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(SymbolFiles)" DestinationFolder="$(PublishDir)$(TargetName).framework.dSYM"/>
|
||||
</Target>
|
||||
|
||||
<!-- end iOS linking stuff from godot -->
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="OpenTK.Core" />
|
||||
<PackageReference Include="Ryujinx.Graphics.Nvdec.Dependencies" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="$([MSBuild]::IsOSPlatform('OSX'))">
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="false">
|
||||
<Exec Command="codesign --entitlements '$(ProjectDir)..\..\distribution\macos\entitlements.xml' -f --deep -s $(SigningCertificate) '$(TargetDir)$(TargetName)'" />
|
||||
</Target>
|
||||
|
||||
|
@ -65,7 +132,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' != ''">
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<PublishSingleFile>false</PublishSingleFile>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<TrimMode>partial</TrimMode>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Ryujinx.Headless.SDL2
|
|||
|
||||
private static readonly ConcurrentQueue<Action> _mainThreadActions = new();
|
||||
|
||||
[LibraryImport("SDL2")]
|
||||
[LibraryImport("SDL2.framework/SDL2")]
|
||||
// TODO: Remove this as soon as SDL2-CS was updated to expose this method publicly
|
||||
private static partial IntPtr SDL_LoadBMP_RW(IntPtr src, int freesrc);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue