From d9886ae75ee68d97500a21753d7129d865427c1a Mon Sep 17 00:00:00 2001 From: emoose Date: Mon, 20 Jan 2020 20:40:59 +0000 Subject: [PATCH] [App] Move NullDevice mounting code back into emulator.cc Fixes Xenia not being able to locate unpacked XEXs.. Ideally this should be inside xenia_main.cc though, need to figure out some way to get it working there. --- src/xenia/app/xenia_main.cc | 12 ------------ src/xenia/emulator.cc | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) 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"";