Program.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 Ns = new Switch(Renderer, AudioOut);
  18. Config.Read(Ns.Log);
  19. Ns.Log.Updated += ConsoleLog.PrintLog;
  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. Ns.LoadCart(args[0], RomFsFiles[0]);
  33. }
  34. else
  35. {
  36. Console.WriteLine("Loading as cart WITHOUT RomFS.");
  37. Ns.LoadCart(args[0]);
  38. }
  39. }
  40. else if (File.Exists(args[0]))
  41. {
  42. Console.WriteLine("Loading as homebrew.");
  43. Ns.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(Ns, Renderer))
  51. {
  52. Ns.Finish += (Sender, Args) =>
  53. {
  54. Screen.Exit();
  55. };
  56. Screen.MainLoop();
  57. }
  58. Environment.Exit(0);
  59. }
  60. }
  61. }