Program.cs 1.7 KB

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