aboutsummaryrefslogtreecommitdiff
path: root/Program.cs
blob: 88a8a117c3145f433568fe39edec730e3d6c4979 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using Gal;
using Gal.OpenGL;
using System;
using System.IO;

namespace Ryujinx
{
    class Program
    {
        static void Main(string[] args)
        {
            Config.Read();

            Console.Title = "Ryujinx Console";

            IGalRenderer Renderer = new OpenGLRenderer();

            Switch Ns = new Switch(Renderer);

            if (args.Length == 1)
            {
                if (Directory.Exists(args[0]))
                {
                    string[] RomFsFiles = Directory.GetFiles(args[0], "*.istorage");

                    if (RomFsFiles.Length > 0)
                    {
                        Logging.Info("Loading as cart with RomFS.");

                        Ns.Os.LoadCart(args[0], RomFsFiles[0]);
                    }
                    else
                    {
                        Logging.Info("Loading as cart WITHOUT RomFS.");

                        Ns.Os.LoadCart(args[0]);
                    }
                }
                else if (File.Exists(args[0]))
                {
                    Logging.Info("Loading as homebrew.");

                    Ns.Os.LoadProgram(args[0]);
                }
            }
            else
            {
                Logging.Error("Please specify the folder with the NSOs/IStorage or a NSO/NRO.");
            }

            using (GLScreen Screen = new GLScreen(Ns, Renderer))
            {
                Ns.Finish += (Sender, Args) => {
                    Screen.Exit();
                };

                Screen.Run(60.0);
            }

            Ns.Os.FinalizeAllProcesses();

            Ns.Dispose();
        }
    }
}