From 07073734ed3785d1dee487f0c898a645fbd5f03c Mon Sep 17 00:00:00 2001
From: Feng Chen <VonChenPlus@gmail.com>
Date: Tue, 20 Jul 2021 13:10:05 +0800
Subject: file_sys: Support load game collection (#6582)

Adds support for loading games with multiple programs embedded within such as the Dragon Quest 1+2+3 Collection
---
 src/core/loader/loader.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

(limited to 'src/core/loader/loader.cpp')

diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index 228dc63891..199e69e897 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -206,7 +206,8 @@ AppLoader::~AppLoader() = default;
  * @return std::unique_ptr<AppLoader> a pointer to a loader object;  nullptr for unsupported type
  */
 static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileSys::VirtualFile file,
-                                                FileType type, std::size_t program_index) {
+                                                FileType type, u64 program_id,
+                                                std::size_t program_index) {
     switch (type) {
     // Standard ELF file format.
     case FileType::ELF:
@@ -227,7 +228,8 @@ static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileSys::V
     // NX XCI (nX Card Image) file format.
     case FileType::XCI:
         return std::make_unique<AppLoader_XCI>(std::move(file), system.GetFileSystemController(),
-                                               system.GetContentProvider(), program_index);
+                                               system.GetContentProvider(), program_id,
+                                               program_index);
 
     // NX NAX (NintendoAesXts) file format.
     case FileType::NAX:
@@ -236,7 +238,8 @@ static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileSys::V
     // NX NSP (Nintendo Submission Package) file format
     case FileType::NSP:
         return std::make_unique<AppLoader_NSP>(std::move(file), system.GetFileSystemController(),
-                                               system.GetContentProvider(), program_index);
+                                               system.GetContentProvider(), program_id,
+                                               program_index);
 
     // NX KIP (Kernel Internal Process) file format
     case FileType::KIP:
@@ -252,7 +255,7 @@ static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileSys::V
 }
 
 std::unique_ptr<AppLoader> GetLoader(Core::System& system, FileSys::VirtualFile file,
-                                     std::size_t program_index) {
+                                     u64 program_id, std::size_t program_index) {
     FileType type = IdentifyFile(file);
     const FileType filename_type = GuessFromFilename(file->GetName());
 
@@ -266,7 +269,7 @@ std::unique_ptr<AppLoader> GetLoader(Core::System& system, FileSys::VirtualFile
 
     LOG_DEBUG(Loader, "Loading file {} as {}...", file->GetName(), GetFileTypeString(type));
 
-    return GetFileLoader(system, std::move(file), type, program_index);
+    return GetFileLoader(system, std::move(file), type, program_id, program_index);
 }
 
 } // namespace Loader
-- 
cgit v1.2.3-70-g09d2