Program.cs 1.6 KB

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