diff --git a/src/Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs b/src/Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs index b1cffcb56..2ff49526a 100644 --- a/src/Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs +++ b/src/Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs @@ -3,7 +3,7 @@ using System.Text; namespace Ryujinx.Common.Logging.Formatters { - internal class DefaultLogFormatter : ILogFormatter + public class DefaultLogFormatter : ILogFormatter { private static readonly ObjectPool _stringBuilderPool = SharedPools.Default(); diff --git a/src/Ryujinx.Common/Logging/Logger.cs b/src/Ryujinx.Common/Logging/Logger.cs index 4b6e63856..b2b46905e 100644 --- a/src/Ryujinx.Common/Logging/Logger.cs +++ b/src/Ryujinx.Common/Logging/Logger.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; using System.Runtime.CompilerServices; using System.Threading; @@ -136,11 +135,14 @@ namespace Ryujinx.Common.Logging _time = Stopwatch.StartNew(); - // Logger should log to console by default - AddTarget(new AsyncLogTargetWrapper( - new ConsoleLogTarget("console"), - 1000, - AsyncLogTargetOverflowAction.Discard)); + if (!PlatformInfo.IsBionic) + { + // Logger should log to console by default + AddTarget(new AsyncLogTargetWrapper( + new ConsoleLogTarget("console"), + 1000, + AsyncLogTargetOverflowAction.Discard)); + } Notice = new Log(LogLevel.Notice); @@ -158,16 +160,21 @@ namespace Ryujinx.Common.Logging _time.Restart(); } - private static ILogTarget GetTarget(string targetName) - => _logTargets.FirstOrDefault(target => target.Name.Equals(targetName)); + private static ILogTarget GetTarget(string targetName) + { + foreach (var target in _logTargets) + { + if (target.Name.Equals(targetName)) + { + return target; + } + } + + return null; + } public static void AddTarget(ILogTarget target) { - if (_logTargets.Any(t => t.Name == target.Name)) - { - return; - } - _logTargets.Add(target); Updated += target.Log; diff --git a/src/Ryujinx.Common/ReleaseInformation.cs b/src/Ryujinx.Common/ReleaseInformation.cs index 774ae012a..01a5bfafb 100644 --- a/src/Ryujinx.Common/ReleaseInformation.cs +++ b/src/Ryujinx.Common/ReleaseInformation.cs @@ -1,4 +1,5 @@ using System.Reflection; +using System.Runtime.CompilerServices; namespace Ryujinx.Common { @@ -26,6 +27,6 @@ namespace Ryujinx.Common public static bool IsFlatHubBuild => IsValid && ReleaseChannelOwner.Equals(FlatHubChannelOwner); - public static string Version => IsValid ? BuildVersion : Assembly.GetEntryAssembly()!.GetCustomAttribute()?.InformationalVersion; + public static string Version => (IsValid || !RuntimeFeature.IsDynamicCodeCompiled) ? (PlatformInfo.IsBionic ? "Bionic_2.0.3" : BuildVersion) : Assembly.GetEntryAssembly()!.GetCustomAttribute()?.InformationalVersion; } } diff --git a/src/Ryujinx.Cpu/AddressTable.cs b/src/Ryujinx.Cpu/AddressTable.cs index f8c27645c..aaba642c6 100644 --- a/src/Ryujinx.Cpu/AddressTable.cs +++ b/src/Ryujinx.Cpu/AddressTable.cs @@ -181,7 +181,7 @@ namespace ARMeilleure.Common public static AddressTable CreateForArm(bool for64Bits, MemoryManagerType type) { // 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(AddressTablePresets.GetArmPreset(for64Bits, sparse), sparse); } diff --git a/src/Ryujinx.Cpu/MemoryEhMeilleure.cs b/src/Ryujinx.Cpu/MemoryEhMeilleure.cs index 379ace941..cb838a5da 100644 --- a/src/Ryujinx.Cpu/MemoryEhMeilleure.cs +++ b/src/Ryujinx.Cpu/MemoryEhMeilleure.cs @@ -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) { ulong pageSize = _pageSize; diff --git a/src/Ryujinx.Cpu/Signal/NativeSignalHandler.cs b/src/Ryujinx.Cpu/Signal/NativeSignalHandler.cs index e467710d7..4dd03067a 100644 --- a/src/Ryujinx.Cpu/Signal/NativeSignalHandler.cs +++ b/src/Ryujinx.Cpu/Signal/NativeSignalHandler.cs @@ -89,10 +89,16 @@ namespace Ryujinx.Cpu.Signal ref SignalHandlerConfig config = ref GetConfigRef(); - if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS()) + if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic) { _signalHandlerPtr = MapCode(NativeSignalHandlerGenerator.GenerateUnixSignalHandler(_handlerConfig, rangeStructSize)); + if (PlatformInfo.IsBionic) + { + config.StructAddressOffset = 16; // si_addr + config.StructWriteOffset = 8; // si_code + } + if (customSignalHandlerFactory != null) { _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 code) { Debug.Assert(_codeBlock == null); diff --git a/src/Ryujinx.Cpu/Signal/UnixSignalHandlerRegistration.cs b/src/Ryujinx.Cpu/Signal/UnixSignalHandlerRegistration.cs index e88a6c0f6..c98205588 100644 --- a/src/Ryujinx.Cpu/Signal/UnixSignalHandlerRegistration.cs +++ b/src/Ryujinx.Cpu/Signal/UnixSignalHandlerRegistration.cs @@ -1,5 +1,7 @@ +using Ryujinx.Common; using System; using System.Runtime.InteropServices; +using System.Runtime.Versioning; namespace Ryujinx.Cpu.Signal { @@ -20,26 +22,73 @@ namespace Ryujinx.Cpu.Signal 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 SIGBUS = 10; 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)] 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)] 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)] 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() { - 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) { - throw new InvalidOperationException($"Could not get SIGSEGV sigaction. Error: {result}"); + throw new SystemException($"Could not get SIGSEGV sigaction. Error: {Marshal.GetLastPInvokeErrorMessage()}"); } return old; @@ -47,37 +96,167 @@ namespace Ryujinx.Cpu.Signal public static SigAction RegisterExceptionHandler(IntPtr action) { - SigAction sig = new() + int result; + SigAction old; + + if (PlatformInfo.IsBionic) { - sa_handler = action, - sa_flags = SA_SIGINFO, - }; + SigActionBionic sig = new() + { + 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) - { - throw new InvalidOperationException($"Could not register SIGSEGV sigaction. Error: {result}"); + old = new SigAction + { + sa_handler = tmp.sa_handler, + sa_mask = tmp.sa_mask, + sa_flags = tmp.sa_flags, + sa_restorer = tmp.sa_restorer + }; } - - if (OperatingSystem.IsMacOS()) + else { - 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) { - 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; } + 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) { - 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; + } } } } diff --git a/src/Ryujinx.Graphics.Vulkan/VulkanDebugMessenger.cs b/src/Ryujinx.Graphics.Vulkan/VulkanDebugMessenger.cs index 496a90fbe..167cd355d 100644 --- a/src/Ryujinx.Graphics.Vulkan/VulkanDebugMessenger.cs +++ b/src/Ryujinx.Graphics.Vulkan/VulkanDebugMessenger.cs @@ -1,6 +1,7 @@ using Ryujinx.Common.Configuration; using Ryujinx.Common.Logging; using Ryujinx.Common.Utilities; +using Silk.NET.Core; using Silk.NET.Vulkan; using Silk.NET.Vulkan.Extensions.EXT; using System; @@ -16,6 +17,7 @@ namespace Ryujinx.Graphics.Vulkan private readonly ExtDebugUtils _debugUtils; private readonly DebugUtilsMessengerEXT? _debugUtilsMessenger; private bool _disposed; + private unsafe delegate* unmanaged[Cdecl] _messageDelegate; public VulkanDebugMessenger(Vk api, Instance instance, GraphicsDebugLevel logLevel) { @@ -71,7 +73,8 @@ namespace Ryujinx.Graphics.Vulkan unsafe { - debugUtilsMessengerCreateInfo.PfnUserCallback = new PfnDebugUtilsMessengerCallbackEXT(UserCallback); + _messageDelegate = (delegate* unmanaged[Cdecl])Marshal.GetFunctionPointerForDelegate(UserCallback); + debugUtilsMessengerCreateInfo.PfnUserCallback = new PfnDebugUtilsMessengerCallbackEXT(_messageDelegate); } DebugUtilsMessengerEXT messengerHandle = default; @@ -89,7 +92,7 @@ namespace Ryujinx.Graphics.Vulkan return Result.Success; } - private unsafe static uint UserCallback( + private unsafe static Bool32 UserCallback( DebugUtilsMessageSeverityFlagsEXT messageSeverity, DebugUtilsMessageTypeFlagsEXT messageTypes, DebugUtilsMessengerCallbackDataEXT* pCallbackData, diff --git a/src/Ryujinx.HLE/HOS/Kernel/Common/KSystemControl.cs b/src/Ryujinx.HLE/HOS/Kernel/Common/KSystemControl.cs index 387ab1bc4..c0c850614 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Common/KSystemControl.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Common/KSystemControl.cs @@ -24,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common { return arrange switch { - MemoryArrange.MemoryArrange4GiB => 3455 * MiB, + MemoryArrange.MemoryArrange4GiB or MemoryArrange.MemoryArrange4GiBSystemDev or MemoryArrange.MemoryArrange6GiBAppletDev => 3285 * MiB, MemoryArrange.MemoryArrange4GiBAppletDev => 2048 * MiB, diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs index 581a2906b..e5ef86331 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs @@ -25,7 +25,10 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService IsAnyInternetRequestAccepted = true, // NOTE: Why not accept any internet request? }; - NetworkChange.NetworkAddressChanged += LocalInterfaceCacheHandler; + if (!PlatformInfo.IsBionic) + { + NetworkChange.NetworkAddressChanged += LocalInterfaceCacheHandler; + } GeneralServiceManager.Add(_generalServiceDetail); } @@ -84,7 +87,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService networkProfile.IpSettingData.IpAddressSetting = new IpAddressSetting(interfaceProperties, unicastAddress); networkProfile.IpSettingData.DnsSetting = new DnsSetting(interfaceProperties); - "RyujinxNetwork"u8.CopyTo(networkProfile.Name.AsSpan()); + "KenjinxNetwork"u8.CopyTo(networkProfile.Name.AsSpan()); context.Memory.Write(networkProfileDataPosition, networkProfile); @@ -196,7 +199,10 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService { if (isDisposing) { - NetworkChange.NetworkAddressChanged -= LocalInterfaceCacheHandler; + if (!PlatformInfo.IsBionic) + { + NetworkChange.NetworkAddressChanged -= LocalInterfaceCacheHandler; + } GeneralServiceManager.Remove(_generalServiceDetail.ClientId); } diff --git a/src/Ryujinx.HLE/HOS/Services/Pm/IBootModeInterface.cs b/src/Ryujinx.HLE/HOS/Services/Pm/IBootModeInterface.cs index 1f1aafc16..b3b1d495a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Pm/IBootModeInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Pm/IBootModeInterface.cs @@ -1,8 +1,19 @@ +using Ryujinx.Common.Logging; +using Ryujinx.HLE.HOS.Services.Pm.Types; + namespace Ryujinx.HLE.HOS.Services.Pm { [Service("pm:bm")] class IBootModeInterface : IpcService { public IBootModeInterface(ServiceCtx context) { } + + [CommandCmif(0)] + // GetBootMode() -> u32 + public ResultCode GetBootMode(ServiceCtx context) + { + context.ResponseData.Write((uint)BootMode.Normal); + return ResultCode.Success; + } } } diff --git a/src/Ryujinx.HLE/HOS/Services/Pm/Types/BootMode.cs b/src/Ryujinx.HLE/HOS/Services/Pm/Types/BootMode.cs new file mode 100644 index 000000000..9b0c62ef2 --- /dev/null +++ b/src/Ryujinx.HLE/HOS/Services/Pm/Types/BootMode.cs @@ -0,0 +1,9 @@ +namespace Ryujinx.HLE.HOS.Services.Pm.Types +{ + enum BootMode : uint + { + Normal = 0, + Maintenance = 1, + SafeMode = 2, + } +} \ No newline at end of file diff --git a/src/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs b/src/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs index 65748be33..846c4dc4f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs @@ -244,6 +244,15 @@ namespace Ryujinx.HLE.HOS.Services.Settings return ResultCode.Success; } + [CommandCmif(68)] + // GetSerialNumber() -> buffer + public ResultCode GetSerialNumber(ServiceCtx context) + { + context.ResponseData.Write(Encoding.ASCII.GetBytes("RYU00000000000")); + + return ResultCode.Success; + } + [CommandCmif(77)] // GetDeviceNickName() -> buffer public ResultCode GetDeviceNickName(ServiceCtx context) diff --git a/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs b/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs index c57544142..b21437f8e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Spl/IGeneralInterface.cs @@ -1,3 +1,4 @@ +using Ryujinx.Common; using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.HOS.Kernel.Common; using Ryujinx.HLE.HOS.Services.Spl.Types; @@ -51,6 +52,14 @@ namespace Ryujinx.HLE.HOS.Services.Spl context.ResponseData.Write(configValue); + if(PlatformInfo.IsBionic) + { + if (result == SmcResult.Success) + { + return ResultCode.Success; + } + } + return (ResultCode)((int)result << 9) | ResultCode.ModuleId; } diff --git a/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs b/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs index f576945eb..a6d42628c 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs @@ -82,6 +82,13 @@ namespace Ryujinx.HLE.Loaders.Processes.Extensions // Apply Nsos patches. 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 = ""; if (!isHomebrew && programId > 0x010000000000FFFF) @@ -114,7 +121,7 @@ namespace Ryujinx.HLE.Loaders.Processes.Extensions device.System.KernelContext, metaLoader, nacpData, - device.System.EnablePtc, + enablePtc, modLoadResult.Hash, true, programName, diff --git a/src/Ryujinx.Memory/MemoryBlock.cs b/src/Ryujinx.Memory/MemoryBlock.cs index 56023b6f6..757722639 100644 --- a/src/Ryujinx.Memory/MemoryBlock.cs +++ b/src/Ryujinx.Memory/MemoryBlock.cs @@ -1,3 +1,4 @@ +using Ryujinx.Common; using System; using System.Runtime.CompilerServices; using System.Threading; @@ -426,7 +427,7 @@ namespace Ryujinx.Memory return OperatingSystem.IsWindowsVersionAtLeast(10, 0, 17134); } - return OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic; + return OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic; } return true; diff --git a/src/Ryujinx.Memory/MemoryManagement.cs b/src/Ryujinx.Memory/MemoryManagement.cs index f57308e09..faa0aa93c 100644 --- a/src/Ryujinx.Memory/MemoryManagement.cs +++ b/src/Ryujinx.Memory/MemoryManagement.cs @@ -1,3 +1,4 @@ +using Ryujinx.Common; using System; namespace Ryujinx.Memory @@ -10,7 +11,7 @@ namespace Ryujinx.Memory { 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); } @@ -26,7 +27,7 @@ namespace Ryujinx.Memory { 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); } @@ -42,7 +43,7 @@ namespace Ryujinx.Memory { 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); } @@ -58,7 +59,7 @@ namespace Ryujinx.Memory { 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); } @@ -74,7 +75,7 @@ namespace Ryujinx.Memory { 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); } @@ -90,7 +91,7 @@ namespace Ryujinx.Memory { 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); } @@ -108,7 +109,7 @@ namespace Ryujinx.Memory { 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); } @@ -129,7 +130,7 @@ namespace Ryujinx.Memory { 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); } @@ -145,7 +146,7 @@ namespace Ryujinx.Memory { 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); } @@ -161,7 +162,7 @@ namespace Ryujinx.Memory { MemoryManagementWindows.DestroySharedMemory(handle); } - else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) + else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic) { MemoryManagementUnix.DestroySharedMemory(handle); } @@ -177,7 +178,7 @@ namespace Ryujinx.Memory { 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); } @@ -193,7 +194,7 @@ namespace Ryujinx.Memory { MemoryManagementWindows.UnmapSharedMemory(address); } - else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || Common.PlatformInfo.IsBionic) + else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic) { MemoryManagementUnix.UnmapSharedMemory(address, size); } diff --git a/src/Ryujinx.Memory/MemoryManagementUnix.cs b/src/Ryujinx.Memory/MemoryManagementUnix.cs index 82e9b2613..b7fea9b7a 100644 --- a/src/Ryujinx.Memory/MemoryManagementUnix.cs +++ b/src/Ryujinx.Memory/MemoryManagementUnix.cs @@ -1,3 +1,4 @@ +using Ryujinx.Common; using Ryujinx.Common.Logging; using System; 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(); diff --git a/src/Ryujinx.Memory/MemoryManagerUnixHelper.cs b/src/Ryujinx.Memory/MemoryManagerUnixHelper.cs index 8bed0d2db..e3ec6dece 100644 --- a/src/Ryujinx.Memory/MemoryManagerUnixHelper.cs +++ b/src/Ryujinx.Memory/MemoryManagerUnixHelper.cs @@ -1,3 +1,4 @@ +using Ryujinx.Common; using System; using System.Runtime.InteropServices; using System.Runtime.Versioning; @@ -113,7 +114,7 @@ namespace Ryujinx.Memory if (flags.HasFlag(MmapFlags.MAP_ANONYMOUS)) { - if (OperatingSystem.IsLinux() || Common.PlatformInfo.IsBionic) + if (OperatingSystem.IsLinux() || PlatformInfo.IsBionic) { result |= MAP_ANONYMOUS_LINUX_GENERIC; } @@ -129,7 +130,7 @@ namespace Ryujinx.Memory if (flags.HasFlag(MmapFlags.MAP_NORESERVE)) { - if (OperatingSystem.IsLinux() || Common.PlatformInfo.IsBionic) + if (OperatingSystem.IsLinux() || PlatformInfo.IsBionic) { result |= MAP_NORESERVE_LINUX_GENERIC; } @@ -145,7 +146,7 @@ namespace Ryujinx.Memory if (flags.HasFlag(MmapFlags.MAP_UNLOCKED)) { - if (OperatingSystem.IsLinux() || Common.PlatformInfo.IsBionic) + if (OperatingSystem.IsLinux() || PlatformInfo.IsBionic) { result |= MAP_UNLOCKED_LINUX_GENERIC; }