diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index f22d5ed3c9..d3e0cd5b97 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -165,6 +165,7 @@ add_library(core IOS/ES/TitleInformation.cpp IOS/ES/TitleManagement.cpp IOS/ES/Views.cpp + IOS/FS/FileSystem.cpp IOS/FS/HostBackend/File.cpp IOS/FS/HostBackend/FS.cpp IOS/FS/FileIO.cpp diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index 847086a188..0abe26aa84 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -197,6 +197,7 @@ + diff --git a/Source/Core/Core/Core.vcxproj.filters b/Source/Core/Core/Core.vcxproj.filters index f997b6a741..cff27f6add 100644 --- a/Source/Core/Core/Core.vcxproj.filters +++ b/Source/Core/Core/Core.vcxproj.filters @@ -735,6 +735,9 @@ IOS\FS + + IOS\FS + IOS\FS diff --git a/Source/Core/Core/IOS/FS/FileSystem.cpp b/Source/Core/Core/IOS/FS/FileSystem.cpp new file mode 100644 index 0000000000..74cee8e9cd --- /dev/null +++ b/Source/Core/Core/IOS/FS/FileSystem.cpp @@ -0,0 +1,15 @@ +// Copyright 2018 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "Core/IOS/FS/FileSystem.h" + +#include "Core/IOS/FS/HostBackend/FS.h" + +namespace IOS::HLE::FS +{ +std::unique_ptr MakeFileSystem() +{ + return std::make_unique(); +} +} // namespace IOS::HLE::FS diff --git a/Source/Core/Core/IOS/FS/FileSystem.h b/Source/Core/Core/IOS/FS/FileSystem.h index 6607c9ab02..f56df41998 100644 --- a/Source/Core/Core/IOS/FS/FileSystem.h +++ b/Source/Core/Core/IOS/FS/FileSystem.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include @@ -170,4 +171,6 @@ public: virtual Result GetDirectoryStats(const std::string& path) = 0; }; +std::unique_ptr MakeFileSystem(); + } // namespace IOS::HLE::FS diff --git a/Source/Core/Core/IOS/IOS.cpp b/Source/Core/Core/IOS/IOS.cpp index 4abd2312a5..bd704fc895 100644 --- a/Source/Core/Core/IOS/IOS.cpp +++ b/Source/Core/Core/IOS/IOS.cpp @@ -33,6 +33,7 @@ #include "Core/IOS/ES/ES.h" #include "Core/IOS/FS/FS.h" #include "Core/IOS/FS/FileIO.h" +#include "Core/IOS/FS/FileSystem.h" #include "Core/IOS/MIOS.h" #include "Core/IOS/Network/IP/Top.h" #include "Core/IOS/Network/KD/NetKDRequest.h" @@ -242,9 +243,9 @@ u32 Kernel::GetVersion() const return static_cast(m_title_id); } -std::shared_ptr Kernel::GetFS() +std::shared_ptr Kernel::GetFS() { - return std::static_pointer_cast(m_device_map.at("/dev/fs")); + return m_fs; } std::shared_ptr Kernel::GetES() @@ -368,6 +369,9 @@ void Kernel::AddDevice(std::unique_ptr device) void Kernel::AddCoreDevices() { + m_fs = FS::MakeFileSystem(); + ASSERT(m_fs); + std::lock_guard lock(m_device_map_mutex); AddDevice(std::make_unique(*this, "/dev/fs")); AddDevice(std::make_unique(*this, "/dev/es")); @@ -691,6 +695,7 @@ void Kernel::DoState(PointerWrap& p) p.Do(m_ppc_gid); m_iosc.DoState(p); + m_fs->DoState(p); if (m_title_id == Titles::MIOS) return; diff --git a/Source/Core/Core/IOS/IOS.h b/Source/Core/Core/IOS/IOS.h index 0f58359683..1d3e94b50b 100644 --- a/Source/Core/Core/IOS/IOS.h +++ b/Source/Core/Core/IOS/IOS.h @@ -23,11 +23,15 @@ namespace IOS { namespace HLE { +namespace FS +{ +class FileSystem; +} + namespace Device { class Device; class ES; -class FS; } struct Request; @@ -94,7 +98,7 @@ public: // These are *always* part of the IOS kernel and always available. // They are also the only available resource managers even before loading any module. - std::shared_ptr GetFS(); + std::shared_ptr GetFS(); std::shared_ptr GetES(); void SDIO_EventNotify(); @@ -146,6 +150,7 @@ protected: u64 m_last_reply_time = 0; IOSC m_iosc; + std::shared_ptr m_fs; }; // HLE for an IOS tied to emulation: base kernel which may have additional modules loaded.