From fd5853fc24ef1c59e6c3e8ad81cb1325b0554709 Mon Sep 17 00:00:00 2001 From: Xpl0itR Date: Sat, 6 Jul 2019 14:41:06 +0100 Subject: [PATCH] caught an exception when ryujinx tries to load non-homebrew as homebrew --- Ryujinx/ApplicationLibrary.cs | 9 ++++++++- Ryujinx/GUI/MainWindow.cs | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Ryujinx/ApplicationLibrary.cs b/Ryujinx/ApplicationLibrary.cs index c065b11bb6..e355cfe97b 100644 --- a/Ryujinx/ApplicationLibrary.cs +++ b/Ryujinx/ApplicationLibrary.cs @@ -151,7 +151,14 @@ namespace Ryujinx } } - if ((Path.GetExtension(GamePath) == ".nca") || (Path.GetExtension(GamePath) == ".nro") || (Path.GetExtension(GamePath) == ".nso")) { TitleName = Path.GetFileName(GamePath); } + if ((Path.GetExtension(GamePath) == ".nca") || (Path.GetExtension(GamePath) == ".nro") || (Path.GetExtension(GamePath) == ".nso")) + { + StringBuilder titleName = new StringBuilder(); + titleName.Append(Path.GetFileName(GamePath)); + titleName.Remove(Path.GetFileName(GamePath).Length - Path.GetExtension(GamePath).Length, Path.GetExtension(GamePath).Length); + + TitleName = titleName.ToString(); + } else { IFile controlFile = controlFs.OpenFile("/control.nacp", OpenMode.Read); diff --git a/Ryujinx/GUI/MainWindow.cs b/Ryujinx/GUI/MainWindow.cs index d2b917b957..0bf7bc4f5b 100644 --- a/Ryujinx/GUI/MainWindow.cs +++ b/Ryujinx/GUI/MainWindow.cs @@ -225,7 +225,8 @@ namespace Ryujinx break; default: Logger.PrintInfo(LogClass.Application, "Loading as homebrew."); - _device.LoadProgram(path); + try { _device.LoadProgram(path); } + catch (ArgumentOutOfRangeException) { Logger.PrintError(LogClass.Application, $"The file which you have specified is unsupported by Ryujinx"); } break; } }