Program.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using Ryujinx.Audio;
  2. using Ryujinx.Audio.OpenAL;
  3. using Ryujinx.Core;
  4. using Ryujinx.Graphics.Gal;
  5. using Ryujinx.Graphics.Gal.OpenGL;
  6. using System;
  7. using System.IO;
  8. namespace Ryujinx
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. AOptimizations.DisableMemoryChecks = true;
  15. Config.Read();
  16. Console.Title = "Ryujinx Console";
  17. IGalRenderer Renderer = new OpenGLRenderer();
  18. IAalOutput AudioOut = new OpenALAudioOut();
  19. Switch Ns = new Switch(Renderer, AudioOut);
  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. Logging.Info("Loading as cart with RomFS.");
  28. Ns.LoadCart(args[0], RomFsFiles[0]);
  29. }
  30. else
  31. {
  32. Logging.Info("Loading as cart WITHOUT RomFS.");
  33. Ns.LoadCart(args[0]);
  34. }
  35. }
  36. else if (File.Exists(args[0]))
  37. {
  38. Logging.Info("Loading as homebrew.");
  39. Ns.LoadProgram(args[0]);
  40. }
  41. }
  42. else
  43. {
  44. Logging.Error("Please specify the folder with the NSOs/IStorage or a NSO/NRO.");
  45. }
  46. using (GLScreen Screen = new GLScreen(Ns, Renderer))
  47. {
  48. Ns.Finish += (Sender, Args) =>
  49. {
  50. Screen.Exit();
  51. };
  52. Screen.Run(60.0);
  53. }
  54. Environment.Exit(0);
  55. }
  56. }
  57. }