summaryrefslogtreecommitdiff
path: root/src/core/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r--src/core/core.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 83d4d742b..05af68f22 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -17,6 +17,7 @@
17#include "core/hle/service/sm/sm.h" 17#include "core/hle/service/sm/sm.h"
18#include "core/loader/loader.h" 18#include "core/loader/loader.h"
19#include "core/settings.h" 19#include "core/settings.h"
20#include "file_sys/vfs_concat.h"
20#include "file_sys/vfs_real.h" 21#include "file_sys/vfs_real.h"
21#include "video_core/renderer_base.h" 22#include "video_core/renderer_base.h"
22#include "video_core/video_core.h" 23#include "video_core/video_core.h"
@@ -88,8 +89,39 @@ System::ResultStatus System::SingleStep() {
88 return RunLoop(false); 89 return RunLoop(false);
89} 90}
90 91
92static FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
93 const std::string& path) {
94 // To account for split 00+01+etc files.
95 std::string dir_name;
96 std::string filename;
97 Common::SplitPath(path, &dir_name, &filename, nullptr);
98 if (filename == "00") {
99 const auto dir = vfs->OpenDirectory(dir_name, FileSys::Mode::Read);
100 std::vector<FileSys::VirtualFile> concat;
101 for (u8 i = 0; i < 0x10; ++i) {
102 auto next = dir->GetFile(fmt::format("{:02X}", i));
103 if (next != nullptr)
104 concat.push_back(std::move(next));
105 else {
106 next = dir->GetFile(fmt::format("{:02x}", i));
107 if (next != nullptr)
108 concat.push_back(std::move(next));
109 else
110 break;
111 }
112 }
113
114 if (concat.empty())
115 return nullptr;
116
117 return FileSys::ConcatenateFiles(concat, dir->GetName());
118 }
119
120 return vfs->OpenFile(path, FileSys::Mode::Read);
121}
122
91System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath) { 123System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath) {
92 app_loader = Loader::GetLoader(virtual_filesystem->OpenFile(filepath, FileSys::Mode::Read)); 124 app_loader = Loader::GetLoader(GetGameFileFromPath(virtual_filesystem, filepath));
93 125
94 if (!app_loader) { 126 if (!app_loader) {
95 LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath); 127 LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);