Switch.cs 933 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using ChocolArm64.Memory;
  2. using Gal;
  3. using Ryujinx.Gpu;
  4. using Ryujinx.OsHle;
  5. using System;
  6. using System.Runtime.InteropServices;
  7. namespace Ryujinx
  8. {
  9. public class Switch : IDisposable
  10. {
  11. public IntPtr Ram {get; private set; }
  12. internal NsGpu Gpu { get; private set; }
  13. internal Horizon Os { get; private set; }
  14. internal VirtualFs VFs { get; private set; }
  15. public Switch(IGalRenderer Renderer)
  16. {
  17. Ram = Marshal.AllocHGlobal((IntPtr)AMemoryMgr.RamSize);
  18. Gpu = new NsGpu(Renderer);
  19. Os = new Horizon(this);
  20. VFs = new VirtualFs();
  21. }
  22. public void Dispose()
  23. {
  24. Dispose(true);
  25. }
  26. protected virtual void Dispose(bool disposing)
  27. {
  28. if (disposing)
  29. {
  30. VFs.Dispose();
  31. }
  32. Marshal.FreeHGlobal(Ram);
  33. }
  34. }
  35. }