From bad122b19594de66e85ab318e934709306001acd Mon Sep 17 00:00:00 2001 From: Creak Date: Fri, 15 Oct 2021 15:57:25 -0400 Subject: [PATCH] main: Slightly refactor NCA entry installation in InstallNCA (#7181) * main: Slightly refactor NCA entry installation in InstallNCA Co-authored-by: Ameer J <52414509+ameerj@users.noreply.github.com> --- src/yuzu/main.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 9f80a245c..d808e9f1d 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2381,15 +2381,13 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) { static_cast(FileSys::TitleType::FirmwarePackageB); } - FileSys::InstallResult res; - if (index >= static_cast(FileSys::TitleType::Application)) { - res = system.GetFileSystemController().GetUserNANDContents()->InstallEntry( - *nca, static_cast(index), true, qt_raw_copy); - } else { - res = system.GetFileSystemController().GetSystemNANDContents()->InstallEntry( - *nca, static_cast(index), true, qt_raw_copy); - } + const bool is_application = index >= static_cast(FileSys::TitleType::Application); + const auto& fs_controller = system.GetFileSystemController(); + auto* registered_cache = is_application ? fs_controller.GetUserNANDContents() + : fs_controller.GetSystemNANDContents(); + const auto res = registered_cache->InstallEntry(*nca, static_cast(index), + true, qt_raw_copy); if (res == FileSys::InstallResult::Success) { return InstallResult::Success; } else if (res == FileSys::InstallResult::OverwriteExisting) {