Android: Numerous fixes

* GetSerialNumber in ISystemSettingsServer

* Bionic qualifiers

* Revert application pool size to 3285 MB for 4 GB DRAM

* Fix PPTC recompilation if mod or patch is applied
This commit is contained in:
KeatonTheBot 2025-05-26 14:11:16 -05:00
parent 20f1cef9b2
commit 19dd23c288
19 changed files with 341 additions and 57 deletions

View file

@ -3,7 +3,7 @@ using System.Text;
namespace Ryujinx.Common.Logging.Formatters namespace Ryujinx.Common.Logging.Formatters
{ {
internal class DefaultLogFormatter : ILogFormatter public class DefaultLogFormatter : ILogFormatter
{ {
private static readonly ObjectPool<StringBuilder> _stringBuilderPool = SharedPools.Default<StringBuilder>(); private static readonly ObjectPool<StringBuilder> _stringBuilderPool = SharedPools.Default<StringBuilder>();

View file

@ -4,7 +4,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
@ -136,11 +135,14 @@ namespace Ryujinx.Common.Logging
_time = Stopwatch.StartNew(); _time = Stopwatch.StartNew();
// Logger should log to console by default if (!PlatformInfo.IsBionic)
AddTarget(new AsyncLogTargetWrapper( {
new ConsoleLogTarget("console"), // Logger should log to console by default
1000, AddTarget(new AsyncLogTargetWrapper(
AsyncLogTargetOverflowAction.Discard)); new ConsoleLogTarget("console"),
1000,
AsyncLogTargetOverflowAction.Discard));
}
Notice = new Log(LogLevel.Notice); Notice = new Log(LogLevel.Notice);
@ -159,15 +161,20 @@ namespace Ryujinx.Common.Logging
} }
private static ILogTarget GetTarget(string targetName) private static ILogTarget GetTarget(string targetName)
=> _logTargets.FirstOrDefault(target => target.Name.Equals(targetName)); {
foreach (var target in _logTargets)
{
if (target.Name.Equals(targetName))
{
return target;
}
}
return null;
}
public static void AddTarget(ILogTarget target) public static void AddTarget(ILogTarget target)
{ {
if (_logTargets.Any(t => t.Name == target.Name))
{
return;
}
_logTargets.Add(target); _logTargets.Add(target);
Updated += target.Log; Updated += target.Log;

View file

@ -1,4 +1,5 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
namespace Ryujinx.Common namespace Ryujinx.Common
{ {
@ -26,6 +27,6 @@ namespace Ryujinx.Common
public static bool IsFlatHubBuild => IsValid && ReleaseChannelOwner.Equals(FlatHubChannelOwner); public static bool IsFlatHubBuild => IsValid && ReleaseChannelOwner.Equals(FlatHubChannelOwner);
public static string Version => IsValid ? BuildVersion : Assembly.GetEntryAssembly()!.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion; public static string Version => (IsValid || !RuntimeFeature.IsDynamicCodeCompiled) ? (PlatformInfo.IsBionic ? "Bionic_2.0.3" : BuildVersion) : Assembly.GetEntryAssembly()!.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
} }
} }

View file

@ -181,7 +181,7 @@ namespace ARMeilleure.Common
public static AddressTable<TEntry> CreateForArm(bool for64Bits, MemoryManagerType type) public static AddressTable<TEntry> CreateForArm(bool for64Bits, MemoryManagerType type)
{ {
// Assume software memory means that we don't want to use any signal handlers. // Assume software memory means that we don't want to use any signal handlers.
bool sparse = type != MemoryManagerType.SoftwareMmu && type != MemoryManagerType.SoftwarePageTable; bool sparse = type != MemoryManagerType.SoftwareMmu && type != MemoryManagerType.SoftwarePageTable && PlatformInfo.IsBionic != true;
return new AddressTable<TEntry>(AddressTablePresets.GetArmPreset(for64Bits, sparse), sparse); return new AddressTable<TEntry>(AddressTablePresets.GetArmPreset(for64Bits, sparse), sparse);
} }

View file

@ -55,6 +55,24 @@ namespace Ryujinx.Cpu
} }
} }
public MemoryEhMeilleure(ulong asSize, MemoryTracking tracking)
{
_tracking = tracking;
_baseAddress = 0UL;
ulong endAddress = asSize;
_trackingEvent = VirtualMemoryEvent;
_pageSize = MemoryBlock.GetPageSize();
bool added = NativeSignalHandler.AddTrackedRegion((nuint)_baseAddress, (nuint)endAddress, Marshal.GetFunctionPointerForDelegate(_trackingEvent));
if (!added)
{
throw new InvalidOperationException("Number of allowed tracked regions exceeded.");
}
}
private ulong VirtualMemoryEvent(ulong address, ulong size, bool write) private ulong VirtualMemoryEvent(ulong address, ulong size, bool write)
{ {
ulong pageSize = _pageSize; ulong pageSize = _pageSize;

View file

@ -89,10 +89,16 @@ namespace Ryujinx.Cpu.Signal
ref SignalHandlerConfig config = ref GetConfigRef(); ref SignalHandlerConfig config = ref GetConfigRef();
if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS()) if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
{ {
_signalHandlerPtr = MapCode(NativeSignalHandlerGenerator.GenerateUnixSignalHandler(_handlerConfig, rangeStructSize)); _signalHandlerPtr = MapCode(NativeSignalHandlerGenerator.GenerateUnixSignalHandler(_handlerConfig, rangeStructSize));
if (PlatformInfo.IsBionic)
{
config.StructAddressOffset = 16; // si_addr
config.StructWriteOffset = 8; // si_code
}
if (customSignalHandlerFactory != null) if (customSignalHandlerFactory != null)
{ {
_signalHandlerPtr = customSignalHandlerFactory(UnixSignalHandlerRegistration.GetSegfaultExceptionHandler().sa_handler, _signalHandlerPtr); _signalHandlerPtr = customSignalHandlerFactory(UnixSignalHandlerRegistration.GetSegfaultExceptionHandler().sa_handler, _signalHandlerPtr);
@ -122,6 +128,21 @@ namespace Ryujinx.Cpu.Signal
} }
} }
public static void InstallUnixAlternateStackForCurrentThread(IntPtr stackPtr, ulong stackSize)
{
UnixSignalHandlerRegistration.RegisterAlternateStack(stackPtr, stackSize);
}
public static void UninstallUnixAlternateStackForCurrentThread()
{
UnixSignalHandlerRegistration.UnregisterAlternateStack();
}
public static void InstallUnixSignalHandler(int sigNum, IntPtr action)
{
UnixSignalHandlerRegistration.RegisterExceptionHandler(sigNum, action);
}
private static IntPtr MapCode(ReadOnlySpan<byte> code) private static IntPtr MapCode(ReadOnlySpan<byte> code)
{ {
Debug.Assert(_codeBlock == null); Debug.Assert(_codeBlock == null);

View file

@ -1,5 +1,7 @@
using Ryujinx.Common;
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Ryujinx.Cpu.Signal namespace Ryujinx.Cpu.Signal
{ {
@ -20,26 +22,73 @@ namespace Ryujinx.Cpu.Signal
public IntPtr sa_restorer; public IntPtr sa_restorer;
} }
[SupportedOSPlatform("android"), StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct SigActionBionic
{
public int sa_flags;
public IntPtr sa_handler;
public SigSet sa_mask;
public IntPtr sa_restorer;
}
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct Stack
{
public IntPtr ss_sp;
public int ss_flags;
public IntPtr ss_size;
}
private const int SIGSEGV = 11; private const int SIGSEGV = 11;
private const int SIGBUS = 10; private const int SIGBUS = 10;
private const int SA_SIGINFO = 0x00000004; private const int SA_SIGINFO = 0x00000004;
private const int SA_ONSTACK = 0x08000000;
private const int SS_DISABLE = 2;
private const int SS_AUTODISARM = 1 << 31;
[LibraryImport("libc", SetLastError = true)] [LibraryImport("libc", SetLastError = true)]
private static partial int sigaction(int signum, ref SigAction sigAction, out SigAction oldAction); private static partial int sigaction(int signum, ref SigAction sigAction, out SigAction oldAction);
[SupportedOSPlatform("android"), LibraryImport("libc", SetLastError = true)]
private static partial int sigaction(int signum, ref SigActionBionic sigAction, out SigActionBionic oldAction);
[LibraryImport("libc", SetLastError = true)] [LibraryImport("libc", SetLastError = true)]
private static partial int sigaction(int signum, IntPtr sigAction, out SigAction oldAction); private static partial int sigaction(int signum, IntPtr sigAction, out SigAction oldAction);
[SupportedOSPlatform("android"), LibraryImport("libc", SetLastError = true)]
private static partial int sigaction(int signum, IntPtr sigAction, out SigActionBionic oldAction);
[LibraryImport("libc", SetLastError = true)] [LibraryImport("libc", SetLastError = true)]
private static partial int sigemptyset(ref SigSet set); private static partial int sigemptyset(ref SigSet set);
[LibraryImport("libc", SetLastError = true)]
private static partial int sigaltstack(ref Stack ss, out Stack oldSs);
public static SigAction GetSegfaultExceptionHandler() public static SigAction GetSegfaultExceptionHandler()
{ {
int result = sigaction(SIGSEGV, IntPtr.Zero, out SigAction old); int result;
SigAction old;
if (PlatformInfo.IsBionic)
{
result = sigaction(SIGSEGV, IntPtr.Zero, out SigActionBionic tmp);
old = new SigAction
{
sa_handler = tmp.sa_handler,
sa_mask = tmp.sa_mask,
sa_flags = tmp.sa_flags,
sa_restorer = tmp.sa_restorer
};
}
else
{
result = sigaction(SIGSEGV, IntPtr.Zero, out old);
}
if (result != 0) if (result != 0)
{ {
throw new InvalidOperationException($"Could not get SIGSEGV sigaction. Error: {result}"); throw new SystemException($"Could not get SIGSEGV sigaction. Error: {Marshal.GetLastPInvokeErrorMessage()}");
} }
return old; return old;
@ -47,37 +96,167 @@ namespace Ryujinx.Cpu.Signal
public static SigAction RegisterExceptionHandler(IntPtr action) public static SigAction RegisterExceptionHandler(IntPtr action)
{ {
SigAction sig = new() int result;
SigAction old;
if (PlatformInfo.IsBionic)
{ {
sa_handler = action, SigActionBionic sig = new()
sa_flags = SA_SIGINFO, {
}; sa_handler = action,
sa_flags = SA_SIGINFO | SA_ONSTACK,
};
sigemptyset(ref sig.sa_mask); sigemptyset(ref sig.sa_mask);
int result = sigaction(SIGSEGV, ref sig, out SigAction old); result = sigaction(SIGSEGV, ref sig, out SigActionBionic tmp);
if (result != 0) old = new SigAction
{ {
throw new InvalidOperationException($"Could not register SIGSEGV sigaction. Error: {result}"); sa_handler = tmp.sa_handler,
sa_mask = tmp.sa_mask,
sa_flags = tmp.sa_flags,
sa_restorer = tmp.sa_restorer
};
} }
else
if (OperatingSystem.IsMacOS())
{ {
result = sigaction(SIGBUS, ref sig, out _); SigAction sig = new SigAction
{
sa_handler = action,
sa_flags = SA_SIGINFO | SA_ONSTACK,
};
sigemptyset(ref sig.sa_mask);
result = sigaction(SIGSEGV, ref sig, out old);
if (result != 0) if (result != 0)
{ {
throw new InvalidOperationException($"Could not register SIGBUS sigaction. Error: {result}"); throw new SystemException($"Could not register SIGSEGV sigaction. Error: {Marshal.GetLastPInvokeErrorMessage()}");
}
if (OperatingSystem.IsMacOS() || OperatingSystem.IsIOS())
{
result = sigaction(SIGBUS, ref sig, out _);
if (result != 0)
{
throw new SystemException($"Could not register SIGBUS sigaction. Error: {Marshal.GetLastPInvokeErrorMessage()}");
}
} }
} }
return old; return old;
} }
public static void RegisterAlternateStack(IntPtr stackPtr, ulong stackSize)
{
Stack stack = new()
{
ss_sp = stackPtr,
ss_flags = SS_AUTODISARM,
ss_size = (IntPtr)stackSize
};
int result = sigaltstack(ref stack, out _);
if (result != 0)
{
throw new SystemException($"Could not set alternate stack. Error: {Marshal.GetLastPInvokeErrorMessage()}");
}
}
public static void UnregisterAlternateStack()
{
Stack stack = new()
{
ss_flags = SS_DISABLE
};
int result = sigaltstack(ref stack, out _);
if (result != 0)
{
throw new SystemException($"Could not remove alternate stack. Error: {Marshal.GetLastPInvokeErrorMessage()}");
}
}
public static void RegisterExceptionHandler(int sigNum, IntPtr action)
{
int result;
if (PlatformInfo.IsBionic)
{
SigActionBionic sig = new()
{
sa_handler = action,
sa_flags = SA_SIGINFO | SA_ONSTACK
};
sigemptyset(ref sig.sa_mask);
result = sigaction(sigNum, ref sig, out SigActionBionic oldu);
if (oldu.sa_handler != IntPtr.Zero)
{
throw new InvalidOperationException($"SIG{sigNum} is already in use.");
}
if (result != 0)
{
throw new SystemException($"Could not register SIG{sigNum} sigaction. Error: {Marshal.GetLastPInvokeErrorMessage()}");
}
}
else
{
SigAction sig = new()
{
sa_handler = action,
sa_flags = SA_SIGINFO | SA_ONSTACK,
};
sigemptyset(ref sig.sa_mask);
result = sigaction(sigNum, ref sig, out SigAction oldu);
if (oldu.sa_handler != IntPtr.Zero)
{
throw new InvalidOperationException($"SIG{sigNum} is already in use.");
}
if (result != 0)
{
throw new SystemException($"Could not register SIG{sigNum} sigaction. Error: {Marshal.GetLastPInvokeErrorMessage()}");
}
}
}
public static bool RestoreExceptionHandler(SigAction oldAction) public static bool RestoreExceptionHandler(SigAction oldAction)
{ {
return sigaction(SIGSEGV, ref oldAction, out SigAction _) == 0 && (!OperatingSystem.IsMacOS() || sigaction(SIGBUS, ref oldAction, out SigAction _) == 0); if (PlatformInfo.IsBionic)
{
SigActionBionic tmp = new SigActionBionic
{
sa_handler = oldAction.sa_handler,
sa_mask = oldAction.sa_mask,
sa_flags = oldAction.sa_flags,
sa_restorer = oldAction.sa_restorer
};
return sigaction(SIGSEGV, ref tmp, out SigActionBionic _) == 0;
}
else
{
bool success = sigaction(SIGSEGV, ref oldAction, out SigAction _) == 0;
if (success && (OperatingSystem.IsMacOS() || OperatingSystem.IsIOS()))
{
success = sigaction(SIGBUS, ref oldAction, out SigAction _) == 0;
}
return success;
}
} }
} }
} }

View file

@ -1,6 +1,7 @@
using Ryujinx.Common.Configuration; using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.Common.Utilities; using Ryujinx.Common.Utilities;
using Silk.NET.Core;
using Silk.NET.Vulkan; using Silk.NET.Vulkan;
using Silk.NET.Vulkan.Extensions.EXT; using Silk.NET.Vulkan.Extensions.EXT;
using System; using System;
@ -16,6 +17,7 @@ namespace Ryujinx.Graphics.Vulkan
private readonly ExtDebugUtils _debugUtils; private readonly ExtDebugUtils _debugUtils;
private readonly DebugUtilsMessengerEXT? _debugUtilsMessenger; private readonly DebugUtilsMessengerEXT? _debugUtilsMessenger;
private bool _disposed; private bool _disposed;
private unsafe delegate* unmanaged[Cdecl]<DebugUtilsMessageSeverityFlagsEXT, DebugUtilsMessageTypeFlagsEXT, DebugUtilsMessengerCallbackDataEXT*, void*, Bool32> _messageDelegate;
public VulkanDebugMessenger(Vk api, Instance instance, GraphicsDebugLevel logLevel) public VulkanDebugMessenger(Vk api, Instance instance, GraphicsDebugLevel logLevel)
{ {
@ -71,7 +73,8 @@ namespace Ryujinx.Graphics.Vulkan
unsafe unsafe
{ {
debugUtilsMessengerCreateInfo.PfnUserCallback = new PfnDebugUtilsMessengerCallbackEXT(UserCallback); _messageDelegate = (delegate* unmanaged[Cdecl]<DebugUtilsMessageSeverityFlagsEXT, DebugUtilsMessageTypeFlagsEXT, DebugUtilsMessengerCallbackDataEXT*, void*, Bool32>)Marshal.GetFunctionPointerForDelegate(UserCallback);
debugUtilsMessengerCreateInfo.PfnUserCallback = new PfnDebugUtilsMessengerCallbackEXT(_messageDelegate);
} }
DebugUtilsMessengerEXT messengerHandle = default; DebugUtilsMessengerEXT messengerHandle = default;
@ -89,7 +92,7 @@ namespace Ryujinx.Graphics.Vulkan
return Result.Success; return Result.Success;
} }
private unsafe static uint UserCallback( private unsafe static Bool32 UserCallback(
DebugUtilsMessageSeverityFlagsEXT messageSeverity, DebugUtilsMessageSeverityFlagsEXT messageSeverity,
DebugUtilsMessageTypeFlagsEXT messageTypes, DebugUtilsMessageTypeFlagsEXT messageTypes,
DebugUtilsMessengerCallbackDataEXT* pCallbackData, DebugUtilsMessengerCallbackDataEXT* pCallbackData,

View file

@ -24,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
{ {
return arrange switch return arrange switch
{ {
MemoryArrange.MemoryArrange4GiB => 3455 * MiB, MemoryArrange.MemoryArrange4GiB or
MemoryArrange.MemoryArrange4GiBSystemDev or MemoryArrange.MemoryArrange4GiBSystemDev or
MemoryArrange.MemoryArrange6GiBAppletDev => 3285 * MiB, MemoryArrange.MemoryArrange6GiBAppletDev => 3285 * MiB,
MemoryArrange.MemoryArrange4GiBAppletDev => 2048 * MiB, MemoryArrange.MemoryArrange4GiBAppletDev => 2048 * MiB,

View file

@ -25,7 +25,10 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
IsAnyInternetRequestAccepted = true, // NOTE: Why not accept any internet request? IsAnyInternetRequestAccepted = true, // NOTE: Why not accept any internet request?
}; };
NetworkChange.NetworkAddressChanged += LocalInterfaceCacheHandler; if (!PlatformInfo.IsBionic)
{
NetworkChange.NetworkAddressChanged += LocalInterfaceCacheHandler;
}
GeneralServiceManager.Add(_generalServiceDetail); GeneralServiceManager.Add(_generalServiceDetail);
} }
@ -84,7 +87,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
networkProfile.IpSettingData.IpAddressSetting = new IpAddressSetting(interfaceProperties, unicastAddress); networkProfile.IpSettingData.IpAddressSetting = new IpAddressSetting(interfaceProperties, unicastAddress);
networkProfile.IpSettingData.DnsSetting = new DnsSetting(interfaceProperties); networkProfile.IpSettingData.DnsSetting = new DnsSetting(interfaceProperties);
"RyujinxNetwork"u8.CopyTo(networkProfile.Name.AsSpan()); "KenjinxNetwork"u8.CopyTo(networkProfile.Name.AsSpan());
context.Memory.Write(networkProfileDataPosition, networkProfile); context.Memory.Write(networkProfileDataPosition, networkProfile);
@ -196,7 +199,10 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
{ {
if (isDisposing) if (isDisposing)
{ {
NetworkChange.NetworkAddressChanged -= LocalInterfaceCacheHandler; if (!PlatformInfo.IsBionic)
{
NetworkChange.NetworkAddressChanged -= LocalInterfaceCacheHandler;
}
GeneralServiceManager.Remove(_generalServiceDetail.ClientId); GeneralServiceManager.Remove(_generalServiceDetail.ClientId);
} }

View file

@ -1,8 +1,19 @@
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Services.Pm.Types;
namespace Ryujinx.HLE.HOS.Services.Pm namespace Ryujinx.HLE.HOS.Services.Pm
{ {
[Service("pm:bm")] [Service("pm:bm")]
class IBootModeInterface : IpcService class IBootModeInterface : IpcService
{ {
public IBootModeInterface(ServiceCtx context) { } public IBootModeInterface(ServiceCtx context) { }
[CommandCmif(0)]
// GetBootMode() -> u32
public ResultCode GetBootMode(ServiceCtx context)
{
context.ResponseData.Write((uint)BootMode.Normal);
return ResultCode.Success;
}
} }
} }

View file

@ -0,0 +1,9 @@
namespace Ryujinx.HLE.HOS.Services.Pm.Types
{
enum BootMode : uint
{
Normal = 0,
Maintenance = 1,
SafeMode = 2,
}
}

View file

@ -244,6 +244,15 @@ namespace Ryujinx.HLE.HOS.Services.Settings
return ResultCode.Success; return ResultCode.Success;
} }
[CommandCmif(68)]
// GetSerialNumber() -> buffer<nn::settings::system::SerialNumber, 0x16>
public ResultCode GetSerialNumber(ServiceCtx context)
{
context.ResponseData.Write(Encoding.ASCII.GetBytes("RYU00000000000"));
return ResultCode.Success;
}
[CommandCmif(77)] [CommandCmif(77)]
// GetDeviceNickName() -> buffer<nn::settings::system::DeviceNickName, 0x16> // GetDeviceNickName() -> buffer<nn::settings::system::DeviceNickName, 0x16>
public ResultCode GetDeviceNickName(ServiceCtx context) public ResultCode GetDeviceNickName(ServiceCtx context)

View file

@ -1,3 +1,4 @@
using Ryujinx.Common;
using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.HOS.Kernel.Common; using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Services.Spl.Types; using Ryujinx.HLE.HOS.Services.Spl.Types;
@ -51,6 +52,14 @@ namespace Ryujinx.HLE.HOS.Services.Spl
context.ResponseData.Write(configValue); context.ResponseData.Write(configValue);
if(PlatformInfo.IsBionic)
{
if (result == SmcResult.Success)
{
return ResultCode.Success;
}
}
return (ResultCode)((int)result << 9) | ResultCode.ModuleId; return (ResultCode)((int)result << 9) | ResultCode.ModuleId;
} }

View file

@ -82,6 +82,13 @@ namespace Ryujinx.HLE.Loaders.Processes.Extensions
// Apply Nsos patches. // Apply Nsos patches.
device.Configuration.VirtualFileSystem.ModLoader.ApplyNsoPatches(programId, nsoExecutables); device.Configuration.VirtualFileSystem.ModLoader.ApplyNsoPatches(programId, nsoExecutables);
// Don't use PTC if ExeFS files have been replaced.
bool enablePtc = device.System.EnablePtc && !modLoadResult.Modified;
if (!enablePtc)
{
Logger.Warning?.Print(LogClass.Ptc, "Detected unsupported ExeFs modifications. PTC disabled.");
}
string programName = ""; string programName = "";
if (!isHomebrew && programId > 0x010000000000FFFF) if (!isHomebrew && programId > 0x010000000000FFFF)
@ -114,7 +121,7 @@ namespace Ryujinx.HLE.Loaders.Processes.Extensions
device.System.KernelContext, device.System.KernelContext,
metaLoader, metaLoader,
nacpData, nacpData,
device.System.EnablePtc, enablePtc,
modLoadResult.Hash, modLoadResult.Hash,
true, true,
programName, programName,

View file

@ -1,3 +1,4 @@
using Ryujinx.Common;
using System; using System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
@ -426,7 +427,7 @@ namespace Ryujinx.Memory
return OperatingSystem.IsWindowsVersionAtLeast(10, 0, 17134); return OperatingSystem.IsWindowsVersionAtLeast(10, 0, 17134);
} }
return OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic; return OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic;
} }
return true; return true;

View file

@ -1,3 +1,4 @@
using Ryujinx.Common;
using System; using System;
namespace Ryujinx.Memory namespace Ryujinx.Memory
@ -10,7 +11,7 @@ namespace Ryujinx.Memory
{ {
return MemoryManagementWindows.Allocate((IntPtr)size); return MemoryManagementWindows.Allocate((IntPtr)size);
} }
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
{ {
return MemoryManagementUnix.Allocate(size, forJit); return MemoryManagementUnix.Allocate(size, forJit);
} }
@ -26,7 +27,7 @@ namespace Ryujinx.Memory
{ {
return MemoryManagementWindows.Reserve((IntPtr)size, viewCompatible); return MemoryManagementWindows.Reserve((IntPtr)size, viewCompatible);
} }
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
{ {
return MemoryManagementUnix.Reserve(size, forJit); return MemoryManagementUnix.Reserve(size, forJit);
} }
@ -42,7 +43,7 @@ namespace Ryujinx.Memory
{ {
MemoryManagementWindows.Commit(address, (IntPtr)size); MemoryManagementWindows.Commit(address, (IntPtr)size);
} }
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
{ {
MemoryManagementUnix.Commit(address, size, forJit); MemoryManagementUnix.Commit(address, size, forJit);
} }
@ -58,7 +59,7 @@ namespace Ryujinx.Memory
{ {
MemoryManagementWindows.Decommit(address, (IntPtr)size); MemoryManagementWindows.Decommit(address, (IntPtr)size);
} }
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
{ {
MemoryManagementUnix.Decommit(address, size); MemoryManagementUnix.Decommit(address, size);
} }
@ -74,7 +75,7 @@ namespace Ryujinx.Memory
{ {
MemoryManagementWindows.MapView(sharedMemory, srcOffset, address, (IntPtr)size, owner); MemoryManagementWindows.MapView(sharedMemory, srcOffset, address, (IntPtr)size, owner);
} }
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
{ {
MemoryManagementUnix.MapView(sharedMemory, srcOffset, address, size); MemoryManagementUnix.MapView(sharedMemory, srcOffset, address, size);
} }
@ -90,7 +91,7 @@ namespace Ryujinx.Memory
{ {
MemoryManagementWindows.UnmapView(sharedMemory, address, (IntPtr)size, owner); MemoryManagementWindows.UnmapView(sharedMemory, address, (IntPtr)size, owner);
} }
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
{ {
MemoryManagementUnix.UnmapView(address, size); MemoryManagementUnix.UnmapView(address, size);
} }
@ -108,7 +109,7 @@ namespace Ryujinx.Memory
{ {
result = MemoryManagementWindows.Reprotect(address, (IntPtr)size, permission, forView); result = MemoryManagementWindows.Reprotect(address, (IntPtr)size, permission, forView);
} }
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
{ {
result = MemoryManagementUnix.Reprotect(address, size, permission); result = MemoryManagementUnix.Reprotect(address, size, permission);
} }
@ -129,7 +130,7 @@ namespace Ryujinx.Memory
{ {
return MemoryManagementWindows.Free(address, (IntPtr)size); return MemoryManagementWindows.Free(address, (IntPtr)size);
} }
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
{ {
return MemoryManagementUnix.Free(address); return MemoryManagementUnix.Free(address);
} }
@ -145,7 +146,7 @@ namespace Ryujinx.Memory
{ {
return MemoryManagementWindows.CreateSharedMemory((IntPtr)size, reserve); return MemoryManagementWindows.CreateSharedMemory((IntPtr)size, reserve);
} }
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
{ {
return MemoryManagementUnix.CreateSharedMemory(size, reserve); return MemoryManagementUnix.CreateSharedMemory(size, reserve);
} }
@ -161,7 +162,7 @@ namespace Ryujinx.Memory
{ {
MemoryManagementWindows.DestroySharedMemory(handle); MemoryManagementWindows.DestroySharedMemory(handle);
} }
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
{ {
MemoryManagementUnix.DestroySharedMemory(handle); MemoryManagementUnix.DestroySharedMemory(handle);
} }
@ -177,7 +178,7 @@ namespace Ryujinx.Memory
{ {
return MemoryManagementWindows.MapSharedMemory(handle); return MemoryManagementWindows.MapSharedMemory(handle);
} }
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
{ {
return MemoryManagementUnix.MapSharedMemory(handle, size); return MemoryManagementUnix.MapSharedMemory(handle, size);
} }
@ -193,7 +194,7 @@ namespace Ryujinx.Memory
{ {
MemoryManagementWindows.UnmapSharedMemory(address); MemoryManagementWindows.UnmapSharedMemory(address);
} }
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
{ {
MemoryManagementUnix.UnmapSharedMemory(address, size); MemoryManagementUnix.UnmapSharedMemory(address, size);
} }

View file

@ -1,3 +1,4 @@
using Ryujinx.Common;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
@ -158,7 +159,7 @@ namespace Ryujinx.Memory
} }
} }
} }
else if (Ryujinx.Common.PlatformInfo.IsBionic) else if (PlatformInfo.IsBionic)
{ {
byte[] memName = "Ryujinx-XXXXXX"u8.ToArray(); byte[] memName = "Ryujinx-XXXXXX"u8.ToArray();

View file

@ -1,3 +1,4 @@
using Ryujinx.Common;
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Runtime.Versioning; using System.Runtime.Versioning;
@ -113,7 +114,7 @@ namespace Ryujinx.Memory
if (flags.HasFlag(MmapFlags.MAP_ANONYMOUS)) if (flags.HasFlag(MmapFlags.MAP_ANONYMOUS))
{ {
if (OperatingSystem.IsLinux() || Common.PlatformInfo.IsBionic) if (OperatingSystem.IsLinux() || PlatformInfo.IsBionic)
{ {
result |= MAP_ANONYMOUS_LINUX_GENERIC; result |= MAP_ANONYMOUS_LINUX_GENERIC;
} }
@ -129,7 +130,7 @@ namespace Ryujinx.Memory
if (flags.HasFlag(MmapFlags.MAP_NORESERVE)) if (flags.HasFlag(MmapFlags.MAP_NORESERVE))
{ {
if (OperatingSystem.IsLinux() || Common.PlatformInfo.IsBionic) if (OperatingSystem.IsLinux() || PlatformInfo.IsBionic)
{ {
result |= MAP_NORESERVE_LINUX_GENERIC; result |= MAP_NORESERVE_LINUX_GENERIC;
} }
@ -145,7 +146,7 @@ namespace Ryujinx.Memory
if (flags.HasFlag(MmapFlags.MAP_UNLOCKED)) if (flags.HasFlag(MmapFlags.MAP_UNLOCKED))
{ {
if (OperatingSystem.IsLinux() || Common.PlatformInfo.IsBionic) if (OperatingSystem.IsLinux() || PlatformInfo.IsBionic)
{ {
result |= MAP_UNLOCKED_LINUX_GENERIC; result |= MAP_UNLOCKED_LINUX_GENERIC;
} }