core: Store FileSystemController in core

merge-requests/60/head
Zach Hilman 2019-04-23 08:35:33 +07:00
parent 2590b5a9ea
commit c182688ad6
2 changed files with 32 additions and 0 deletions

@ -14,8 +14,13 @@
#include "core/core_cpu.h" #include "core/core_cpu.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/cpu_core_manager.h" #include "core/cpu_core_manager.h"
#include "core/file_sys/bis_factory.h"
#include "core/file_sys/card_image.h"
#include "core/file_sys/mode.h" #include "core/file_sys/mode.h"
#include "core/file_sys/registered_cache.h" #include "core/file_sys/registered_cache.h"
#include "core/file_sys/romfs_factory.h"
#include "core/file_sys/savedata_factory.h"
#include "core/file_sys/sdmc_factory.h"
#include "core/file_sys/vfs_concat.h" #include "core/file_sys/vfs_concat.h"
#include "core/file_sys/vfs_real.h" #include "core/file_sys/vfs_real.h"
#include "core/gdbstub/gdbstub.h" #include "core/gdbstub/gdbstub.h"
@ -27,6 +32,7 @@
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/hle/service/am/applets/applets.h" #include "core/hle/service/am/applets/applets.h"
#include "core/hle/service/apm/controller.h" #include "core/hle/service/apm/controller.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/glue/manager.h" #include "core/hle/service/glue/manager.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
#include "core/hle/service/sm/sm.h" #include "core/hle/service/sm/sm.h"
@ -202,6 +208,15 @@ struct System::Impl {
main_process->Run(load_parameters->main_thread_priority, main_process->Run(load_parameters->main_thread_priority,
load_parameters->main_thread_stack_size); load_parameters->main_thread_stack_size);
if (Settings::values.gamecard_inserted) {
if (Settings::values.gamecard_current_game) {
fs_controller.SetGameCard(GetGameFileFromPath(virtual_filesystem, filepath));
} else if (!Settings::values.gamecard_path.empty()) {
fs_controller.SetGameCard(
GetGameFileFromPath(virtual_filesystem, Settings::values.gamecard_path));
}
}
u64 title_id{0}; u64 title_id{0};
if (app_loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) { if (app_loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) {
LOG_ERROR(Core, "Failed to find title id for ROM (Error {})", LOG_ERROR(Core, "Failed to find title id for ROM (Error {})",
@ -304,6 +319,7 @@ struct System::Impl {
FileSys::VirtualFilesystem virtual_filesystem; FileSys::VirtualFilesystem virtual_filesystem;
/// ContentProviderUnion instance /// ContentProviderUnion instance
std::unique_ptr<FileSys::ContentProviderUnion> content_provider; std::unique_ptr<FileSys::ContentProviderUnion> content_provider;
Service::FileSystem::FileSystemController fs_controller;
/// AppLoader used to load the current executing application /// AppLoader used to load the current executing application
std::unique_ptr<Loader::AppLoader> app_loader; std::unique_ptr<Loader::AppLoader> app_loader;
std::unique_ptr<VideoCore::RendererBase> renderer; std::unique_ptr<VideoCore::RendererBase> renderer;
@ -571,6 +587,14 @@ const FileSys::ContentProvider& System::GetContentProvider() const {
return *impl->content_provider; return *impl->content_provider;
} }
Service::FileSystem::FileSystemController& System::GetFileSystemController() {
return impl->fs_controller;
}
const Service::FileSystem::FileSystemController& System::GetFileSystemController() const {
return impl->fs_controller;
}
void System::RegisterContentProvider(FileSys::ContentProviderUnionSlot slot, void System::RegisterContentProvider(FileSys::ContentProviderUnionSlot slot,
FileSys::ContentProvider* provider) { FileSys::ContentProvider* provider) {
impl->content_provider->SetSlot(slot, provider); impl->content_provider->SetSlot(slot, provider);

@ -47,6 +47,10 @@ namespace APM {
class Controller; class Controller;
} }
namespace FileSystem {
class FileSystemController;
} // namespace FileSystem
namespace Glue { namespace Glue {
class ARPManager; class ARPManager;
} }
@ -299,6 +303,10 @@ public:
const FileSys::ContentProvider& GetContentProvider() const; const FileSys::ContentProvider& GetContentProvider() const;
Service::FileSystem::FileSystemController& GetFileSystemController();
const Service::FileSystem::FileSystemController& GetFileSystemController() const;
void RegisterContentProvider(FileSys::ContentProviderUnionSlot slot, void RegisterContentProvider(FileSys::ContentProviderUnionSlot slot,
FileSys::ContentProvider* provider); FileSys::ContentProvider* provider);