Android: Memory specific switches

This commit is contained in:
KeatonTheBot 2025-05-15 13:44:23 -05:00
parent 846b5b6e8a
commit 98b4ff331c
5 changed files with 46 additions and 16 deletions

View file

@ -1,3 +1,4 @@
using Ryujinx.Common.Logging;
using System;
using System.Collections.Concurrent;
using System.Runtime.InteropServices;
@ -8,6 +9,7 @@ namespace Ryujinx.Memory
{
[SupportedOSPlatform("linux")]
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("android")]
static class MemoryManagementUnix
{
private static readonly ConcurrentDictionary<IntPtr, ulong> _allocations = new();
@ -156,6 +158,24 @@ namespace Ryujinx.Memory
}
}
}
else if (Ryujinx.Common.PlatformInfo.IsBionic)
{
byte[] memName = "Ryujinx-XXXXXX"u8.ToArray();
Logger.Debug?.Print(LogClass.Cpu, $"Creating Android SharedMemory of size:{size}");
fixed (byte* pMemName = memName)
{
fd = ASharedMemory_create((IntPtr)pMemName, (nuint)size);
if (fd <= 0)
{
throw new OutOfMemoryException();
}
}
// ASharedMemory_create handle ftruncate for us.
return (IntPtr)fd;
}
else
{
byte[] fileName = "/dev/shm/Ryujinx-XXXXXX"u8.ToArray();