Rewrotes to cache loading & added "cache" device

This commit is contained in:
Gliniak 2020-10-25 19:15:28 +01:00
parent 61ba2c5347
commit be3fa2fc16
2 changed files with 15 additions and 21 deletions

View File

@ -76,7 +76,6 @@ DEFINE_path(
"Storage"); "Storage");
DEFINE_bool(mount_scratch, false, "Enable scratch mount", "Storage"); DEFINE_bool(mount_scratch, false, "Enable scratch mount", "Storage");
DEFINE_bool(mount_cache, true, "Enable cache mount", "Storage");
DEFINE_transient_path(target, "", DEFINE_transient_path(target, "",
"Specifies the target .xex or .iso to execute.", "Specifies the target .xex or .iso to execute.",
@ -308,27 +307,22 @@ int xenia_main(const std::vector<std::string>& args) {
} }
if (cvars::mount_cache) { if (cvars::mount_cache) {
auto cache0_device = constexpr std::pair<std::string_view, std::string_view> cache_mounts[] = {
std::make_unique<xe::vfs::HostPathDevice>("\\CACHE0", "cache0", false); {"\\CACHE", "cache"}, {"\\CACHE0", "cache0"}, {"\\CACHE1", "cache1"}};
if (!cache0_device->Initialize()) {
XELOGE("Unable to scan cache0 path");
} else {
if (!emulator->file_system()->RegisterDevice(std::move(cache0_device))) {
XELOGE("Unable to register cache0 path");
} else {
emulator->file_system()->RegisterSymbolicLink("cache0:", "\\CACHE0");
}
}
auto cache1_device = for (auto const cache_mount : cache_mounts) {
std::make_unique<xe::vfs::HostPathDevice>("\\CACHE1", "cache1", false); auto cache_device = std::make_unique<xe::vfs::HostPathDevice>(
if (!cache1_device->Initialize()) { cache_mount.first, cache_mount.second, false);
XELOGE("Unable to scan cache1 path");
} else { if (!cache_device->Initialize()) {
if (!emulator->file_system()->RegisterDevice(std::move(cache1_device))) { XELOGE("Unable to scan {} path", cache_mount.second);
XELOGE("Unable to register cache1 path");
} else { } else {
emulator->file_system()->RegisterSymbolicLink("cache1:", "\\CACHE1"); if (!emulator->file_system()->RegisterDevice(std::move(cache_device))) {
XELOGE("Unable to register {} path", cache_mount.second);
} else {
emulator->file_system()->RegisterSymbolicLink(
std::string(cache_mount.second) + ':', cache_mount.first);
}
} }
} }
} }

View File

@ -13,7 +13,7 @@
#include "xenia/base/string.h" #include "xenia/base/string.h"
#include "xenia/kernel/xfile.h" #include "xenia/kernel/xfile.h"
DEFINE_bool(mount_cache, false, "Enable cache mount", "Storage"); DEFINE_bool(mount_cache, true, "Enable cache mount", "Storage");
namespace xe { namespace xe {
namespace vfs { namespace vfs {