diff --git a/src/xenia/app/xenia_main.cc b/src/xenia/app/xenia_main.cc index ace658ade..06c47fefc 100644 --- a/src/xenia/app/xenia_main.cc +++ b/src/xenia/app/xenia_main.cc @@ -20,7 +20,6 @@ #include "xenia/emulator.h" #include "xenia/ui/file_picker.h" #include "xenia/vfs/devices/host_path_device.h" -#include "xenia/vfs/devices/null_device.h" // Available audio systems: #include "xenia/apu/nop/nop_audio_system.h" @@ -295,17 +294,6 @@ int xenia_main(const std::vector& args) { emulator->file_system()->RegisterSymbolicLink("cache1:", "\\CACHE1"); } } - - // Below are accessed directly by STFC/cache code baked into the game - // By using a NullDevice that just returns success to all IO requests, the - // cache code should hopefully progress without erroring out - auto null_files = {std::string("\\Partition0"), std::string("\\Cache0"), - std::string("\\Cache1")}; - auto null_device = std::make_unique( - "\\Device\\Harddisk0", null_files, emulator->file_system()); - if (null_device->Initialize()) { - emulator->file_system()->RegisterDevice(std::move(null_device)); - } } // Set a debug handler. diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index 73cf0dcee..1fee002e5 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -41,6 +41,7 @@ #include "xenia/ui/imgui_dialog.h" #include "xenia/vfs/devices/disc_image_device.h" #include "xenia/vfs/devices/host_path_device.h" +#include "xenia/vfs/devices/null_device.h" #include "xenia/vfs/devices/stfs_container_device.h" #include "xenia/vfs/virtual_file_system.h" @@ -655,6 +656,19 @@ std::string Emulator::FindLaunchModule() { X_STATUS Emulator::CompleteLaunch(const std::wstring& path, const std::string& module_path) { + if (cvars::mount_cache) { + // Below are accessed directly by STFC/cache code baked into the game + // By using a NullDevice that just returns success to all IO requests, the + // cache code should hopefully progress without erroring out + auto null_files = {std::string("\\Partition0"), std::string("\\Cache0"), + std::string("\\Cache1")}; + auto null_device = std::make_unique( + "\\Device\\Harddisk0", null_files, file_system()); + if (null_device->Initialize()) { + file_system_->RegisterDevice(std::move(null_device)); + } + } + // Reset state. title_id_ = 0; game_title_ = L"";