forked from MeloNX/MeloNX
add helper for checking bionic
This commit is contained in:
parent
1835e16045
commit
ad0f9a7fc7
@ -14,7 +14,7 @@ namespace ARMeilleure.CodeGen.Arm64
|
||||
return;
|
||||
}
|
||||
|
||||
if (OperatingSystem.IsLinux() || OperatingSystem.IsAndroid())
|
||||
if (OperatingSystem.IsLinux() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
LinuxFeatureInfoHwCap = (LinuxFeatureFlagsHwCap)getauxval(AT_HWCAP);
|
||||
LinuxFeatureInfoHwCap2 = (LinuxFeatureFlagsHwCap2)getauxval(AT_HWCAP2);
|
||||
|
@ -111,7 +111,7 @@ namespace ARMeilleure.Signal
|
||||
return context.BitwiseAnd(err, Const(2ul));
|
||||
}
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsAndroid())
|
||||
else if (OperatingSystem.IsLinux() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
||||
{
|
||||
|
@ -1010,7 +1010,7 @@ namespace ARMeilleure.Translation.PTC
|
||||
osPlatform |= (OperatingSystem.IsLinux() ? 1u : 0u) << 1;
|
||||
osPlatform |= (OperatingSystem.IsMacOS() ? 1u : 0u) << 2;
|
||||
osPlatform |= (OperatingSystem.IsWindows() ? 1u : 0u) << 3;
|
||||
osPlatform |= (OperatingSystem.IsAndroid() ? 1u : 0u) << 4;
|
||||
osPlatform |= (Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid() ? 1u : 0u) << 4;
|
||||
#pragma warning restore IDE0055
|
||||
|
||||
return osPlatform;
|
||||
|
@ -126,11 +126,14 @@ namespace Ryujinx.Common.Logging
|
||||
|
||||
_time = Stopwatch.StartNew();
|
||||
|
||||
if (!Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
// Logger should log to console by default
|
||||
AddTarget(new AsyncLogTargetWrapper(
|
||||
new ConsoleLogTarget("console"),
|
||||
1000,
|
||||
AsyncLogTargetOverflowAction.Discard));
|
||||
}
|
||||
|
||||
Notice = new Log(LogLevel.Notice);
|
||||
|
||||
|
@ -88,11 +88,11 @@ namespace Ryujinx.Cpu.Signal
|
||||
|
||||
ref SignalHandlerConfig config = ref GetConfigRef();
|
||||
|
||||
if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid())
|
||||
if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
_signalHandlerPtr = MapCode(NativeSignalHandlerGenerator.GenerateUnixSignalHandler(_handlerConfig, rangeStructSize, pageSize));
|
||||
|
||||
if (OperatingSystem.IsAndroid())
|
||||
if (Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
config.StructAddressOffset = 16; // si_addr
|
||||
config.StructWriteOffset = 8; // si_code
|
||||
|
@ -57,7 +57,7 @@ namespace Ryujinx.Cpu.Signal
|
||||
int result;
|
||||
SigAction old;
|
||||
|
||||
if (OperatingSystem.IsAndroid())
|
||||
if (Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
result = sigaction(SIGSEGV, IntPtr.Zero, out SigActionBionic tmp);
|
||||
|
||||
@ -155,7 +155,7 @@ namespace Ryujinx.Cpu.Signal
|
||||
|
||||
public static bool RestoreExceptionHandler(SigAction oldAction)
|
||||
{
|
||||
if (OperatingSystem.IsAndroid())
|
||||
if (Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
SigActionBionic tmp = new SigActionBionic
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
ImageUsage = ImageUsageFlags.ColorAttachmentBit | ImageUsageFlags.TransferDstBit | ImageUsageFlags.StorageBit,
|
||||
ImageSharingMode = SharingMode.Exclusive,
|
||||
ImageArrayLayers = 1,
|
||||
PreTransform = capabilities.CurrentTransform,
|
||||
PreTransform = Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid() ? SurfaceTransformFlagsKHR.IdentityBitKhr : capabilities.CurrentTransform,
|
||||
CompositeAlpha = ChooseCompositeAlpha(capabilities.SupportedCompositeAlpha),
|
||||
PresentMode = ChooseSwapPresentMode(presentModes, _vsyncEnabled),
|
||||
Clipped = true,
|
||||
|
@ -426,7 +426,7 @@ namespace Ryujinx.Memory
|
||||
return OperatingSystem.IsWindowsVersionAtLeast(10, 0, 17134);
|
||||
}
|
||||
|
||||
return OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid();
|
||||
return OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -10,7 +10,7 @@ namespace Ryujinx.Memory
|
||||
{
|
||||
return MemoryManagementWindows.Allocate((IntPtr)size);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid())
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
return MemoryManagementUnix.Allocate(size, forJit);
|
||||
}
|
||||
@ -26,7 +26,7 @@ namespace Ryujinx.Memory
|
||||
{
|
||||
return MemoryManagementWindows.Reserve((IntPtr)size, viewCompatible);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid())
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
return MemoryManagementUnix.Reserve(size, forJit);
|
||||
}
|
||||
@ -42,7 +42,7 @@ namespace Ryujinx.Memory
|
||||
{
|
||||
MemoryManagementWindows.Commit(address, (IntPtr)size);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid())
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
MemoryManagementUnix.Commit(address, size, forJit);
|
||||
}
|
||||
@ -58,7 +58,7 @@ namespace Ryujinx.Memory
|
||||
{
|
||||
MemoryManagementWindows.Decommit(address, (IntPtr)size);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid())
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
MemoryManagementUnix.Decommit(address, size);
|
||||
}
|
||||
@ -74,7 +74,7 @@ namespace Ryujinx.Memory
|
||||
{
|
||||
MemoryManagementWindows.MapView(sharedMemory, srcOffset, address, (IntPtr)size, owner);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid())
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
MemoryManagementUnix.MapView(sharedMemory, srcOffset, address, size);
|
||||
}
|
||||
@ -90,7 +90,7 @@ namespace Ryujinx.Memory
|
||||
{
|
||||
MemoryManagementWindows.UnmapView(sharedMemory, address, (IntPtr)size, owner);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid())
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
MemoryManagementUnix.UnmapView(address, size);
|
||||
}
|
||||
@ -108,7 +108,7 @@ namespace Ryujinx.Memory
|
||||
{
|
||||
result = MemoryManagementWindows.Reprotect(address, (IntPtr)size, permission, forView);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid())
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
result = MemoryManagementUnix.Reprotect(address, size, permission);
|
||||
}
|
||||
@ -129,7 +129,7 @@ namespace Ryujinx.Memory
|
||||
{
|
||||
return MemoryManagementWindows.Free(address, (IntPtr)size);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid())
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
return MemoryManagementUnix.Free(address);
|
||||
}
|
||||
@ -145,7 +145,7 @@ namespace Ryujinx.Memory
|
||||
{
|
||||
return MemoryManagementWindows.CreateSharedMemory((IntPtr)size, reserve);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid())
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
return MemoryManagementUnix.CreateSharedMemory(size, reserve);
|
||||
}
|
||||
@ -161,7 +161,7 @@ namespace Ryujinx.Memory
|
||||
{
|
||||
MemoryManagementWindows.DestroySharedMemory(handle);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid())
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
MemoryManagementUnix.DestroySharedMemory(handle);
|
||||
}
|
||||
@ -177,7 +177,7 @@ namespace Ryujinx.Memory
|
||||
{
|
||||
return MemoryManagementWindows.MapSharedMemory(handle);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid())
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
return MemoryManagementUnix.MapSharedMemory(handle, size);
|
||||
}
|
||||
@ -193,7 +193,7 @@ namespace Ryujinx.Memory
|
||||
{
|
||||
MemoryManagementWindows.UnmapSharedMemory(address);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsAndroid())
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
MemoryManagementUnix.UnmapSharedMemory(address, size);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
using Ryujinx.Common.Logging;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Runtime.InteropServices;
|
||||
@ -138,6 +139,7 @@ namespace Ryujinx.Memory
|
||||
public unsafe static IntPtr CreateSharedMemory(ulong size, bool reserve)
|
||||
{
|
||||
int fd;
|
||||
Logger.Debug?.Print(LogClass.Cpu, $"Operating System: {RuntimeInformation.OSDescription}");
|
||||
|
||||
if (OperatingSystem.IsMacOS())
|
||||
{
|
||||
@ -157,9 +159,11 @@ namespace Ryujinx.Memory
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (OperatingSystem.IsAndroid())
|
||||
else if (Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
byte[] memName = Encoding.ASCII.GetBytes("Ryujinx-XXXXXX");
|
||||
byte[] memName = "Ryujinx-XXXXXX"u8.ToArray();
|
||||
|
||||
Logger.Debug?.Print(LogClass.Cpu, $"Creating Android SharedMemory of size:{size}");
|
||||
|
||||
fixed (byte* pMemName = memName)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ namespace Ryujinx.Memory
|
||||
|
||||
if (flags.HasFlag(MmapFlags.MAP_ANONYMOUS))
|
||||
{
|
||||
if (OperatingSystem.IsLinux() || OperatingSystem.IsAndroid())
|
||||
if (OperatingSystem.IsLinux() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
result |= MAP_ANONYMOUS_LINUX_GENERIC;
|
||||
}
|
||||
@ -129,7 +129,7 @@ namespace Ryujinx.Memory
|
||||
|
||||
if (flags.HasFlag(MmapFlags.MAP_NORESERVE))
|
||||
{
|
||||
if (OperatingSystem.IsLinux() || OperatingSystem.IsAndroid())
|
||||
if (OperatingSystem.IsLinux() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
result |= MAP_NORESERVE_LINUX_GENERIC;
|
||||
}
|
||||
@ -145,7 +145,7 @@ namespace Ryujinx.Memory
|
||||
|
||||
if (flags.HasFlag(MmapFlags.MAP_UNLOCKED))
|
||||
{
|
||||
if (OperatingSystem.IsLinux() || OperatingSystem.IsAndroid())
|
||||
if (OperatingSystem.IsLinux() || Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid())
|
||||
{
|
||||
result |= MAP_UNLOCKED_LINUX_GENERIC;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ namespace Ryujinx.Ui.Common.SystemInfo
|
||||
{
|
||||
public class SystemInfo
|
||||
{
|
||||
public static bool IsBionic { get; set; }
|
||||
public string OsDescription { get; protected set; }
|
||||
public string CpuName { get; protected set; }
|
||||
public ulong RamTotal { get; protected set; }
|
||||
@ -75,5 +76,10 @@ namespace Ryujinx.Ui.Common.SystemInfo
|
||||
|
||||
return string.IsNullOrEmpty(name) ? null : name;
|
||||
}
|
||||
|
||||
public static bool IsAndroid()
|
||||
{
|
||||
return OperatingSystem.IsAndroid() || IsBionic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user