2023-12-04 13:17:13 +00:00
|
|
|
using Ryujinx.Graphics.Device;
|
2020-07-12 03:07:01 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Host1x
|
|
|
|
{
|
|
|
|
class Devices : IDisposable
|
|
|
|
{
|
2023-06-27 14:35:48 +00:00
|
|
|
private readonly Dictionary<ClassId, IDeviceState> _devices = new();
|
2020-07-12 03:07:01 +00:00
|
|
|
|
|
|
|
public void RegisterDevice(ClassId classId, IDeviceState device)
|
|
|
|
{
|
|
|
|
_devices[classId] = device;
|
|
|
|
}
|
|
|
|
|
|
|
|
public IDeviceState GetDevice(ClassId classId)
|
|
|
|
{
|
|
|
|
return _devices.TryGetValue(classId, out IDeviceState device) ? device : null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
foreach (var device in _devices.Values)
|
|
|
|
{
|
|
|
|
if (device is ThiDevice thi)
|
|
|
|
{
|
|
|
|
thi.Dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|