Program.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. Ns.OnFinish(EventArgs.Empty);
  58. }
  59. Environment.Exit(0);
  60. }
  61. }
  62. }