summaryrefslogtreecommitdiffstats
path: root/src/core/core.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-08-16 05:11:58 +0200
committerGitHub <noreply@github.com>2018-08-16 05:11:58 +0200
commitc594ec341768a54dc2577c64fd15a6c0041456cd (patch)
tree3814f831fd8207598c342341e56997a0b3123cd0 /src/core/core.cpp
parentMerge pull request #1078 from lioncash/message (diff)
parentregistration: Various style and documentation improvements (diff)
downloadyuzu-c594ec341768a54dc2577c64fd15a6c0041456cd.tar
yuzu-c594ec341768a54dc2577c64fd15a6c0041456cd.tar.gz
yuzu-c594ec341768a54dc2577c64fd15a6c0041456cd.tar.bz2
yuzu-c594ec341768a54dc2577c64fd15a6c0041456cd.tar.lz
yuzu-c594ec341768a54dc2577c64fd15a6c0041456cd.tar.xz
yuzu-c594ec341768a54dc2577c64fd15a6c0041456cd.tar.zst
yuzu-c594ec341768a54dc2577c64fd15a6c0041456cd.zip
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r--src/core/core.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 83d4d742b..28038ff6f 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -5,6 +5,7 @@
#include <memory>
#include <utility>
#include "common/logging/log.h"
+#include "common/string_util.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/gdbstub/gdbstub.h"
@@ -17,6 +18,7 @@
#include "core/hle/service/sm/sm.h"
#include "core/loader/loader.h"
#include "core/settings.h"
+#include "file_sys/vfs_concat.h"
#include "file_sys/vfs_real.h"
#include "video_core/renderer_base.h"
#include "video_core/video_core.h"
@@ -88,8 +90,39 @@ System::ResultStatus System::SingleStep() {
return RunLoop(false);
}
+static FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
+ const std::string& path) {
+ // To account for split 00+01+etc files.
+ std::string dir_name;
+ std::string filename;
+ Common::SplitPath(path, &dir_name, &filename, nullptr);
+ if (filename == "00") {
+ const auto dir = vfs->OpenDirectory(dir_name, FileSys::Mode::Read);
+ std::vector<FileSys::VirtualFile> concat;
+ for (u8 i = 0; i < 0x10; ++i) {
+ auto next = dir->GetFile(fmt::format("{:02X}", i));
+ if (next != nullptr)
+ concat.push_back(std::move(next));
+ else {
+ next = dir->GetFile(fmt::format("{:02x}", i));
+ if (next != nullptr)
+ concat.push_back(std::move(next));
+ else
+ break;
+ }
+ }
+
+ if (concat.empty())
+ return nullptr;
+
+ return FileSys::ConcatenateFiles(concat, dir->GetName());
+ }
+
+ return vfs->OpenFile(path, FileSys::Mode::Read);
+}
+
System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath) {
- app_loader = Loader::GetLoader(virtual_filesystem->OpenFile(filepath, FileSys::Mode::Read));
+ app_loader = Loader::GetLoader(GetGameFileFromPath(virtual_filesystem, filepath));
if (!app_loader) {
LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);