Program.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using Ryujinx.Audio;
  2. using Ryujinx.Audio.OpenAL;
  3. using Ryujinx.Common.Logging;
  4. using Ryujinx.Graphics.Gal;
  5. using Ryujinx.Graphics.Gal.OpenGL;
  6. using Ryujinx.HLE;
  7. using System;
  8. using System.IO;
  9. namespace Ryujinx
  10. {
  11. class Program
  12. {
  13. static void Main(string[] args)
  14. {
  15. Console.Title = "Ryujinx Console";
  16. IGalRenderer Renderer = new OGLRenderer();
  17. IAalOutput AudioOut = new OpenALAudioOut();
  18. Switch Device = new Switch(Renderer, AudioOut);
  19. Config.Read(Device);
  20. Logger.Updated += ConsoleLog.Log;
  21. if (args.Length == 1)
  22. {
  23. if (Directory.Exists(args[0]))
  24. {
  25. string[] RomFsFiles = Directory.GetFiles(args[0], "*.istorage");
  26. if (RomFsFiles.Length == 0)
  27. {
  28. RomFsFiles = Directory.GetFiles(args[0], "*.romfs");
  29. }
  30. if (RomFsFiles.Length > 0)
  31. {
  32. Console.WriteLine("Loading as cart with RomFS.");
  33. Device.LoadCart(args[0], RomFsFiles[0]);
  34. }
  35. else
  36. {
  37. Console.WriteLine("Loading as cart WITHOUT RomFS.");
  38. Device.LoadCart(args[0]);
  39. }
  40. }
  41. else if (File.Exists(args[0]))
  42. {
  43. switch (Path.GetExtension(args[0]).ToLowerInvariant())
  44. {
  45. case ".xci":
  46. Console.WriteLine("Loading as XCI.");
  47. Device.LoadXci(args[0]);
  48. break;
  49. case ".nca":
  50. Console.WriteLine("Loading as NCA.");
  51. Device.LoadNca(args[0]);
  52. break;
  53. case ".nsp":
  54. Console.WriteLine("Loading as NSP.");
  55. Device.LoadNsp(args[0]);
  56. break;
  57. default:
  58. Console.WriteLine("Loading as homebrew.");
  59. Device.LoadProgram(args[0]);
  60. break;
  61. }
  62. }
  63. }
  64. else
  65. {
  66. Console.WriteLine("Please specify the folder with the NSOs/IStorage or a NSO/NRO.");
  67. }
  68. using (GLScreen Screen = new GLScreen(Device, Renderer))
  69. {
  70. Screen.MainLoop();
  71. Device.Dispose();
  72. }
  73. AudioOut.Dispose();
  74. }
  75. }
  76. }