2018-02-17 13:36:08 -08:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
2018-02-20 12:09:23 -08:00
|
|
|
namespace Ryujinx.Core.OsHle.Handles
|
2018-02-04 15:08:20 -08:00
|
|
|
{
|
|
|
|
class HSharedMem
|
|
|
|
{
|
2018-02-17 13:36:08 -08:00
|
|
|
private List<long> Positions;
|
|
|
|
|
|
|
|
public EventHandler<EventArgs> MemoryMapped;
|
|
|
|
public EventHandler<EventArgs> MemoryUnmapped;
|
2018-02-04 15:08:20 -08:00
|
|
|
|
2018-02-27 15:45:07 -08:00
|
|
|
public HSharedMem()
|
2018-02-04 15:08:20 -08:00
|
|
|
{
|
2018-02-17 13:36:08 -08:00
|
|
|
Positions = new List<long>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void AddVirtualPosition(long Position)
|
|
|
|
{
|
|
|
|
lock (Positions)
|
|
|
|
{
|
|
|
|
Positions.Add(Position);
|
|
|
|
|
2018-02-20 02:54:00 -08:00
|
|
|
MemoryMapped?.Invoke(this, EventArgs.Empty);
|
2018-02-17 13:36:08 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void RemoveVirtualPosition(long Position)
|
|
|
|
{
|
|
|
|
lock (Positions)
|
|
|
|
{
|
|
|
|
Positions.Remove(Position);
|
|
|
|
|
2018-02-20 02:54:00 -08:00
|
|
|
MemoryUnmapped?.Invoke(this, EventArgs.Empty);
|
2018-02-17 13:36:08 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-04 21:09:52 -08:00
|
|
|
public long[] GetVirtualPositions()
|
2018-02-17 13:36:08 -08:00
|
|
|
{
|
2018-03-04 21:09:52 -08:00
|
|
|
return Positions.ToArray();
|
2018-02-04 15:08:20 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|