[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.
This commit is contained in:
emoose 2020-01-20 20:40:59 +00:00 committed by illusion
parent 8d51cf3044
commit d9886ae75e
2 changed files with 14 additions and 12 deletions

View File

@ -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<std::wstring>& 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<vfs::NullDevice>(
"\\Device\\Harddisk0", null_files, emulator->file_system());
if (null_device->Initialize()) {
emulator->file_system()->RegisterDevice(std::move(null_device));
}
}
// Set a debug handler.

View File

@ -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<vfs::NullDevice>(
"\\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"";