Program.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using Ryujinx.Audio;
  2. using Ryujinx.Audio.OpenAL;
  3. using Ryujinx.Graphics.Gal;
  4. using Ryujinx.Graphics.Gal.OpenGL;
  5. using Ryujinx.HLE;
  6. using System;
  7. using System.IO;
  8. namespace Ryujinx
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. Console.Title = "Ryujinx Console";
  15. IGalRenderer Renderer = new OGLRenderer();
  16. IAalOutput AudioOut = new OpenALAudioOut();
  17. Switch Device = new Switch(Renderer, AudioOut);
  18. Config.Read(Device);
  19. Device.Log.Updated += ConsoleLog.Log;
  20. if (args.Length == 1)
  21. {
  22. if (Directory.Exists(args[0]))
  23. {
  24. string[] RomFsFiles = Directory.GetFiles(args[0], "*.istorage");
  25. if (RomFsFiles.Length == 0)
  26. {
  27. RomFsFiles = Directory.GetFiles(args[0], "*.romfs");
  28. }
  29. if (RomFsFiles.Length > 0)
  30. {
  31. Console.WriteLine("Loading as cart with RomFS.");
  32. Device.LoadCart(args[0], RomFsFiles[0]);
  33. }
  34. else
  35. {
  36. Console.WriteLine("Loading as cart WITHOUT RomFS.");
  37. Device.LoadCart(args[0]);
  38. }
  39. }
  40. else if (File.Exists(args[0]))
  41. {
  42. Console.WriteLine("Loading as homebrew.");
  43. Device.LoadProgram(args[0]);
  44. }
  45. }
  46. else
  47. {
  48. Console.WriteLine("Please specify the folder with the NSOs/IStorage or a NSO/NRO.");
  49. }
  50. using (GLScreen Screen = new GLScreen(Device, Renderer))
  51. {
  52. Screen.MainLoop();
  53. Device.Dispose();
  54. }
  55. AudioOut.Dispose();
  56. }
  57. }
  58. }