0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-12-23 14:45:45 +00:00
ryujinx-fork/Ryujinx/Ui/Program.cs

91 lines
2.7 KiB
C#
Raw Normal View History

using Ryujinx.Audio;
using Ryujinx.Audio.OpenAL;
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.Gal;
using Ryujinx.Graphics.Gal.OpenGL;
using Ryujinx.HLE;
2018-02-04 23:08:20 +00:00
using System;
using System.IO;
namespace Ryujinx
{
class Program
{
static void Main(string[] args)
{
Console.Title = "Ryujinx Console";
IGalRenderer renderer = new OGLRenderer();
2018-02-04 23:08:20 +00:00
IAalOutput audioOut = new OpenALAudioOut();
Switch device = new Switch(renderer, audioOut);
2018-02-04 23:08:20 +00:00
Config.Read(device);
2018-04-24 18:57:39 +00:00
Logger.Updated += ConsoleLog.Log;
2018-04-24 18:57:39 +00:00
2018-02-04 23:08:20 +00:00
if (args.Length == 1)
{
if (Directory.Exists(args[0]))
{
string[] romFsFiles = Directory.GetFiles(args[0], "*.istorage");
2018-02-04 23:08:20 +00:00
if (romFsFiles.Length == 0)
2018-04-06 05:02:13 +00:00
{
romFsFiles = Directory.GetFiles(args[0], "*.romfs");
2018-04-06 05:02:13 +00:00
}
if (romFsFiles.Length > 0)
2018-02-04 23:08:20 +00:00
{
2018-04-24 18:57:39 +00:00
Console.WriteLine("Loading as cart with RomFS.");
2018-02-04 23:08:20 +00:00
device.LoadCart(args[0], romFsFiles[0]);
2018-02-04 23:08:20 +00:00
}
else
{
2018-04-24 18:57:39 +00:00
Console.WriteLine("Loading as cart WITHOUT RomFS.");
2018-02-04 23:08:20 +00:00
device.LoadCart(args[0]);
2018-02-04 23:08:20 +00:00
}
}
else if (File.Exists(args[0]))
{
switch (Path.GetExtension(args[0]).ToLowerInvariant())
{
case ".xci":
Console.WriteLine("Loading as XCI.");
device.LoadXci(args[0]);
break;
case ".nca":
Console.WriteLine("Loading as NCA.");
device.LoadNca(args[0]);
break;
case ".nsp":
Console.WriteLine("Loading as NSP.");
device.LoadNsp(args[0]);
break;
default:
Console.WriteLine("Loading as homebrew.");
device.LoadProgram(args[0]);
break;
}
2018-02-04 23:08:20 +00:00
}
}
else
{
2018-04-24 18:57:39 +00:00
Console.WriteLine("Please specify the folder with the NSOs/IStorage or a NSO/NRO.");
2018-02-04 23:08:20 +00:00
}
using (GlScreen screen = new GlScreen(device, renderer))
2018-02-04 23:08:20 +00:00
{
screen.MainLoop();
device.Dispose();
2018-02-04 23:08:20 +00:00
}
audioOut.Dispose();
2018-02-04 23:08:20 +00:00
}
}
}