Program.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. Config.Read();
  13. Console.Title = "Ryujinx Console";
  14. IGalRenderer Renderer = new OpenGLRenderer();
  15. Switch Ns = new Switch(Renderer);
  16. if (args.Length == 1)
  17. {
  18. if (Directory.Exists(args[0]))
  19. {
  20. string[] RomFsFiles = Directory.GetFiles(args[0], "*.istorage");
  21. if (RomFsFiles.Length > 0)
  22. {
  23. Logging.Info("Loading as cart with RomFS.");
  24. Ns.LoadCart(args[0], RomFsFiles[0]);
  25. }
  26. else
  27. {
  28. Logging.Info("Loading as cart WITHOUT RomFS.");
  29. Ns.LoadCart(args[0]);
  30. }
  31. }
  32. else if (File.Exists(args[0]))
  33. {
  34. Logging.Info("Loading as homebrew.");
  35. Ns.LoadProgram(args[0]);
  36. }
  37. }
  38. else
  39. {
  40. Logging.Error("Please specify the folder with the NSOs/IStorage or a NSO/NRO.");
  41. }
  42. using (GLScreen Screen = new GLScreen(Ns, Renderer))
  43. {
  44. Ns.Finish += (Sender, Args) =>
  45. {
  46. Screen.Exit();
  47. };
  48. Screen.Run(60.0);
  49. }
  50. Environment.Exit(0);
  51. }
  52. }
  53. }