Program.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. switch (Path.GetExtension(args[0]).ToLowerInvariant())
  43. {
  44. case ".xci":
  45. Console.WriteLine("Loading as XCI.");
  46. Device.LoadXci(args[0]);
  47. break;
  48. case ".nca":
  49. Console.WriteLine("Loading as NCA.");
  50. Device.LoadNca(args[0]);
  51. break;
  52. case ".nsp":
  53. Console.WriteLine("Loading as NSP.");
  54. Device.LoadNsp(args[0]);
  55. break;
  56. default:
  57. Console.WriteLine("Loading as homebrew.");
  58. Device.LoadProgram(args[0]);
  59. break;
  60. }
  61. }
  62. }
  63. else
  64. {
  65. Console.WriteLine("Please specify the folder with the NSOs/IStorage or a NSO/NRO.");
  66. }
  67. using (GLScreen Screen = new GLScreen(Device, Renderer))
  68. {
  69. Screen.MainLoop();
  70. Device.Dispose();
  71. }
  72. AudioOut.Dispose();
  73. }
  74. }
  75. }