mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-11-23 02:06:55 +01:00
44 lines
No EOL
1 KiB
C#
44 lines
No EOL
1 KiB
C#
using ChocolArm64.Memory;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Ryujinx.Core.OsHle.Handles
|
|
{
|
|
class HSharedMem
|
|
{
|
|
private List<(AMemory, long)> Positions;
|
|
|
|
public EventHandler<EventArgs> MemoryMapped;
|
|
public EventHandler<EventArgs> MemoryUnmapped;
|
|
|
|
public HSharedMem()
|
|
{
|
|
Positions = new List<(AMemory, long)>();
|
|
}
|
|
|
|
public void AddVirtualPosition(AMemory Memory, long Position)
|
|
{
|
|
lock (Positions)
|
|
{
|
|
Positions.Add((Memory, Position));
|
|
|
|
MemoryMapped?.Invoke(this, EventArgs.Empty);
|
|
}
|
|
}
|
|
|
|
public void RemoveVirtualPosition(AMemory Memory, long Position)
|
|
{
|
|
lock (Positions)
|
|
{
|
|
Positions.Remove((Memory, Position));
|
|
|
|
MemoryUnmapped?.Invoke(this, EventArgs.Empty);
|
|
}
|
|
}
|
|
|
|
public (AMemory, long)[] GetVirtualPositions()
|
|
{
|
|
return Positions.ToArray();
|
|
}
|
|
}
|
|
} |