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/core.cpp | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

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

diff --git a/src/core/core.cpp b/src/core/core.cpp
index 406320ed6b..15226cf417 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -216,9 +216,9 @@ struct System::Impl {
     }
 
     ResultStatus Load(System& system, Frontend::EmuWindow& emu_window, const std::string& filepath,
-                      std::size_t program_index) {
+                      u64 program_id, std::size_t program_index) {
         app_loader = Loader::GetLoader(system, GetGameFileFromPath(virtual_filesystem, filepath),
-                                       program_index);
+                                       program_id, program_index);
 
         if (!app_loader) {
             LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
@@ -269,11 +269,10 @@ struct System::Impl {
             }
         }
 
-        u64 title_id{0};
-        if (app_loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) {
+        if (app_loader->ReadProgramId(program_id) != Loader::ResultStatus::Success) {
             LOG_ERROR(Core, "Failed to find title id for ROM (Error {})", load_result);
         }
-        perf_stats = std::make_unique<PerfStats>(title_id);
+        perf_stats = std::make_unique<PerfStats>(program_id);
         // Reset counters and set time origin to current frame
         GetAndResetPerfStats();
         perf_stats->BeginSystemFrame();
@@ -459,8 +458,8 @@ void System::Shutdown() {
 }
 
 System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
-                                  std::size_t program_index) {
-    return impl->Load(*this, emu_window, filepath, program_index);
+                                  u64 program_id, std::size_t program_index) {
+    return impl->Load(*this, emu_window, filepath, program_id, program_index);
 }
 
 bool System::IsPoweredOn() const {
-- 
cgit v1.2.3-70-g09d2