mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
core: Store system-wide ContentProvider for the emulator
This commit is contained in:
parent
a6c7ae6fe8
commit
45cb41f517
2 changed files with 40 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
||||||
#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/mode.h"
|
#include "core/file_sys/mode.h"
|
||||||
|
#include "core/file_sys/registered_cache.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"
|
||||||
|
@ -108,6 +109,8 @@ struct System::Impl {
|
||||||
// Create a default fs if one doesn't already exist.
|
// Create a default fs if one doesn't already exist.
|
||||||
if (virtual_filesystem == nullptr)
|
if (virtual_filesystem == nullptr)
|
||||||
virtual_filesystem = std::make_shared<FileSys::RealVfsFilesystem>();
|
virtual_filesystem = std::make_shared<FileSys::RealVfsFilesystem>();
|
||||||
|
if (content_provider == nullptr)
|
||||||
|
content_provider = std::make_unique<FileSys::ContentProviderUnion>();
|
||||||
|
|
||||||
/// Create default implementations of applets if one is not provided.
|
/// Create default implementations of applets if one is not provided.
|
||||||
if (profile_selector == nullptr)
|
if (profile_selector == nullptr)
|
||||||
|
@ -249,6 +252,8 @@ struct System::Impl {
|
||||||
Kernel::KernelCore kernel;
|
Kernel::KernelCore kernel;
|
||||||
/// RealVfsFilesystem instance
|
/// RealVfsFilesystem instance
|
||||||
FileSys::VirtualFilesystem virtual_filesystem;
|
FileSys::VirtualFilesystem virtual_filesystem;
|
||||||
|
/// ContentProviderUnion instance
|
||||||
|
std::unique_ptr<FileSys::ContentProviderUnion> content_provider;
|
||||||
/// 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;
|
||||||
|
@ -488,6 +493,27 @@ const Frontend::SoftwareKeyboardApplet& System::GetSoftwareKeyboard() const {
|
||||||
return *impl->software_keyboard;
|
return *impl->software_keyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void System::SetContentProvider(std::unique_ptr<FileSys::ContentProviderUnion> provider) {
|
||||||
|
impl->content_provider = std::move(provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSys::ContentProvider& System::GetContentProvider() {
|
||||||
|
return *impl->content_provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
const FileSys::ContentProvider& System::GetContentProvider() const {
|
||||||
|
return *impl->content_provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
void System::RegisterContentProvider(FileSys::ContentProviderUnionSlot slot,
|
||||||
|
FileSys::ContentProvider* provider) {
|
||||||
|
impl->content_provider->SetSlot(slot, provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
void System::ClearContentProvider(FileSys::ContentProviderUnionSlot slot) {
|
||||||
|
impl->content_provider->ClearSlot(slot);
|
||||||
|
}
|
||||||
|
|
||||||
void System::SetWebBrowser(std::unique_ptr<Frontend::WebBrowserApplet> applet) {
|
void System::SetWebBrowser(std::unique_ptr<Frontend::WebBrowserApplet> applet) {
|
||||||
impl->web_browser = std::move(applet);
|
impl->web_browser = std::move(applet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,9 @@ class WebBrowserApplet;
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
class CheatList;
|
class CheatList;
|
||||||
|
class ContentProvider;
|
||||||
|
class ContentProviderUnion;
|
||||||
|
enum class ContentProviderUnionSlot;
|
||||||
class VfsFilesystem;
|
class VfsFilesystem;
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
|
||||||
|
@ -270,6 +273,17 @@ public:
|
||||||
Frontend::WebBrowserApplet& GetWebBrowser();
|
Frontend::WebBrowserApplet& GetWebBrowser();
|
||||||
const Frontend::WebBrowserApplet& GetWebBrowser() const;
|
const Frontend::WebBrowserApplet& GetWebBrowser() const;
|
||||||
|
|
||||||
|
void SetContentProvider(std::unique_ptr<FileSys::ContentProviderUnion> provider);
|
||||||
|
|
||||||
|
FileSys::ContentProvider& GetContentProvider();
|
||||||
|
|
||||||
|
const FileSys::ContentProvider& GetContentProvider() const;
|
||||||
|
|
||||||
|
void RegisterContentProvider(FileSys::ContentProviderUnionSlot slot,
|
||||||
|
FileSys::ContentProvider* provider);
|
||||||
|
|
||||||
|
void ClearContentProvider(FileSys::ContentProviderUnionSlot slot);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
System();
|
System();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue