NvChNvMap.cs 890 B

12345678910111213141516171819202122232425262728293031
  1. using System.Collections.Concurrent;
  2. namespace Ryujinx.Core.OsHle.Services.Nv
  3. {
  4. class NvChNvMap
  5. {
  6. private static ConcurrentDictionary<Process, IdDictionary> NvMaps;
  7. public void Create(ServiceCtx Context)
  8. {
  9. long InputPosition = Context.Request.GetBufferType0x21Position();
  10. long OutputPosition = Context.Request.GetBufferType0x22Position();
  11. int Size = Context.Memory.ReadInt32(InputPosition);
  12. int Handle = AddNvMap(Context, new NvMap(Size));
  13. Context.Memory.WriteInt32(OutputPosition, Handle);
  14. }
  15. private int AddNvMap(ServiceCtx Context, NvMap Map)
  16. {
  17. return NvMaps[Context.Process].Add(Map);
  18. }
  19. public NvMap GetNvMap(ServiceCtx Context, int Handle)
  20. {
  21. return NvMaps[Context.Process].GetData<NvMap>(Handle);
  22. }
  23. }
  24. }