diff options
| author | 2017-02-10 17:15:26 +0200 | |
|---|---|---|
| committer | 2017-02-13 13:57:38 +0200 | |
| commit | 20544977dab5b00a86c73572b94e7e75a7499f7a (patch) | |
| tree | 1c5f2e443a8c73d70cfbf52b0e5783f99d831802 /src | |
| parent | file_sys: add Self NCCH archive (diff) | |
| download | yuzu-20544977dab5b00a86c73572b94e7e75a7499f7a.tar.gz yuzu-20544977dab5b00a86c73572b94e7e75a7499f7a.tar.xz yuzu-20544977dab5b00a86c73572b94e7e75a7499f7a.zip | |
loader: use self NCCH archive
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/file_sys/archive_romfs.cpp | 43 | ||||
| -rw-r--r-- | src/core/file_sys/archive_romfs.h | 38 | ||||
| -rw-r--r-- | src/core/hle/service/fs/archive.h | 2 | ||||
| -rw-r--r-- | src/core/loader/3dsx.cpp | 6 | ||||
| -rw-r--r-- | src/core/loader/ncch.cpp | 6 |
6 files changed, 7 insertions, 90 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index a4aa90477..8c2438831 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -20,7 +20,6 @@ set(SRCS | |||
| 20 | file_sys/archive_extsavedata.cpp | 20 | file_sys/archive_extsavedata.cpp |
| 21 | file_sys/archive_ncch.cpp | 21 | file_sys/archive_ncch.cpp |
| 22 | file_sys/archive_other_savedata.cpp | 22 | file_sys/archive_other_savedata.cpp |
| 23 | file_sys/archive_romfs.cpp | ||
| 24 | file_sys/archive_savedata.cpp | 23 | file_sys/archive_savedata.cpp |
| 25 | file_sys/archive_sdmc.cpp | 24 | file_sys/archive_sdmc.cpp |
| 26 | file_sys/archive_sdmcwriteonly.cpp | 25 | file_sys/archive_sdmcwriteonly.cpp |
| @@ -198,7 +197,6 @@ set(HEADERS | |||
| 198 | file_sys/archive_extsavedata.h | 197 | file_sys/archive_extsavedata.h |
| 199 | file_sys/archive_ncch.h | 198 | file_sys/archive_ncch.h |
| 200 | file_sys/archive_other_savedata.h | 199 | file_sys/archive_other_savedata.h |
| 201 | file_sys/archive_romfs.h | ||
| 202 | file_sys/archive_savedata.h | 200 | file_sys/archive_savedata.h |
| 203 | file_sys/archive_sdmc.h | 201 | file_sys/archive_sdmc.h |
| 204 | file_sys/archive_sdmcwriteonly.h | 202 | file_sys/archive_sdmcwriteonly.h |
diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp deleted file mode 100644 index 6c99ca5b4..000000000 --- a/src/core/file_sys/archive_romfs.cpp +++ /dev/null | |||
| @@ -1,43 +0,0 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <algorithm> | ||
| 6 | #include <memory> | ||
| 7 | #include "common/common_types.h" | ||
| 8 | #include "common/logging/log.h" | ||
| 9 | #include "core/file_sys/archive_romfs.h" | ||
| 10 | #include "core/file_sys/ivfc_archive.h" | ||
| 11 | |||
| 12 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 13 | // FileSys namespace | ||
| 14 | |||
| 15 | namespace FileSys { | ||
| 16 | |||
| 17 | ArchiveFactory_RomFS::ArchiveFactory_RomFS(Loader::AppLoader& app_loader) { | ||
| 18 | // Load the RomFS from the app | ||
| 19 | if (Loader::ResultStatus::Success != app_loader.ReadRomFS(romfs_file, data_offset, data_size)) { | ||
| 20 | LOG_ERROR(Service_FS, "Unable to read RomFS!"); | ||
| 21 | } | ||
| 22 | } | ||
| 23 | |||
| 24 | ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_RomFS::Open(const Path& path) { | ||
| 25 | auto archive = std::make_unique<IVFCArchive>(romfs_file, data_offset, data_size); | ||
| 26 | return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); | ||
| 27 | } | ||
| 28 | |||
| 29 | ResultCode ArchiveFactory_RomFS::Format(const Path& path, | ||
| 30 | const FileSys::ArchiveFormatInfo& format_info) { | ||
| 31 | LOG_ERROR(Service_FS, "Attempted to format a RomFS archive."); | ||
| 32 | // TODO: Verify error code | ||
| 33 | return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported, | ||
| 34 | ErrorLevel::Permanent); | ||
| 35 | } | ||
| 36 | |||
| 37 | ResultVal<ArchiveFormatInfo> ArchiveFactory_RomFS::GetFormatInfo(const Path& path) const { | ||
| 38 | // TODO(Subv): Implement | ||
| 39 | LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str()); | ||
| 40 | return ResultCode(-1); | ||
| 41 | } | ||
| 42 | |||
| 43 | } // namespace FileSys | ||
diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h deleted file mode 100644 index 1eaf99b54..000000000 --- a/src/core/file_sys/archive_romfs.h +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <memory> | ||
| 8 | #include <string> | ||
| 9 | #include <vector> | ||
| 10 | #include "common/common_types.h" | ||
| 11 | #include "core/file_sys/archive_backend.h" | ||
| 12 | #include "core/hle/result.h" | ||
| 13 | #include "core/loader/loader.h" | ||
| 14 | |||
| 15 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 16 | // FileSys namespace | ||
| 17 | |||
| 18 | namespace FileSys { | ||
| 19 | |||
| 20 | /// File system interface to the RomFS archive | ||
| 21 | class ArchiveFactory_RomFS final : public ArchiveFactory { | ||
| 22 | public: | ||
| 23 | explicit ArchiveFactory_RomFS(Loader::AppLoader& app_loader); | ||
| 24 | |||
| 25 | std::string GetName() const override { | ||
| 26 | return "RomFS"; | ||
| 27 | } | ||
| 28 | ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) override; | ||
| 29 | ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) override; | ||
| 30 | ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path) const override; | ||
| 31 | |||
| 32 | private: | ||
| 33 | std::shared_ptr<FileUtil::IOFile> romfs_file; | ||
| 34 | u64 data_offset; | ||
| 35 | u64 data_size; | ||
| 36 | }; | ||
| 37 | |||
| 38 | } // namespace FileSys | ||
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h index 519c1f3a9..2ea956e0b 100644 --- a/src/core/hle/service/fs/archive.h +++ b/src/core/hle/service/fs/archive.h | |||
| @@ -26,7 +26,7 @@ namespace FS { | |||
| 26 | 26 | ||
| 27 | /// Supported archive types | 27 | /// Supported archive types |
| 28 | enum class ArchiveIdCode : u32 { | 28 | enum class ArchiveIdCode : u32 { |
| 29 | RomFS = 0x00000003, | 29 | SelfNCCH = 0x00000003, |
| 30 | SaveData = 0x00000004, | 30 | SaveData = 0x00000004, |
| 31 | ExtSaveData = 0x00000006, | 31 | ExtSaveData = 0x00000006, |
| 32 | SharedExtSaveData = 0x00000007, | 32 | SharedExtSaveData = 0x00000007, |
diff --git a/src/core/loader/3dsx.cpp b/src/core/loader/3dsx.cpp index 09266e8b0..74e336487 100644 --- a/src/core/loader/3dsx.cpp +++ b/src/core/loader/3dsx.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <vector> | 6 | #include <vector> |
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "core/file_sys/archive_romfs.h" | 8 | #include "core/file_sys/archive_selfncch.h" |
| 9 | #include "core/hle/kernel/process.h" | 9 | #include "core/hle/kernel/process.h" |
| 10 | #include "core/hle/kernel/resource_limit.h" | 10 | #include "core/hle/kernel/resource_limit.h" |
| 11 | #include "core/hle/service/fs/archive.h" | 11 | #include "core/hle/service/fs/archive.h" |
| @@ -277,8 +277,8 @@ ResultStatus AppLoader_THREEDSX::Load() { | |||
| 277 | 277 | ||
| 278 | Kernel::g_current_process->Run(48, Kernel::DEFAULT_STACK_SIZE); | 278 | Kernel::g_current_process->Run(48, Kernel::DEFAULT_STACK_SIZE); |
| 279 | 279 | ||
| 280 | Service::FS::RegisterArchiveType(std::make_unique<FileSys::ArchiveFactory_RomFS>(*this), | 280 | Service::FS::RegisterArchiveType(std::make_unique<FileSys::ArchiveFactory_SelfNCCH>(*this), |
| 281 | Service::FS::ArchiveIdCode::RomFS); | 281 | Service::FS::ArchiveIdCode::SelfNCCH); |
| 282 | 282 | ||
| 283 | is_loaded = true; | 283 | is_loaded = true; |
| 284 | return ResultStatus::Success; | 284 | return ResultStatus::Success; |
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 5df33f6d2..98b8259d9 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 9 | #include "common/string_util.h" | 9 | #include "common/string_util.h" |
| 10 | #include "common/swap.h" | 10 | #include "common/swap.h" |
| 11 | #include "core/file_sys/archive_romfs.h" | 11 | #include "core/file_sys/archive_selfncch.h" |
| 12 | #include "core/hle/kernel/process.h" | 12 | #include "core/hle/kernel/process.h" |
| 13 | #include "core/hle/kernel/resource_limit.h" | 13 | #include "core/hle/kernel/resource_limit.h" |
| 14 | #include "core/hle/service/cfg/cfg.h" | 14 | #include "core/hle/service/cfg/cfg.h" |
| @@ -342,8 +342,8 @@ ResultStatus AppLoader_NCCH::Load() { | |||
| 342 | if (ResultStatus::Success != result) | 342 | if (ResultStatus::Success != result) |
| 343 | return result; | 343 | return result; |
| 344 | 344 | ||
| 345 | Service::FS::RegisterArchiveType(std::make_unique<FileSys::ArchiveFactory_RomFS>(*this), | 345 | Service::FS::RegisterArchiveType(std::make_unique<FileSys::ArchiveFactory_SelfNCCH>(*this), |
| 346 | Service::FS::ArchiveIdCode::RomFS); | 346 | Service::FS::ArchiveIdCode::SelfNCCH); |
| 347 | 347 | ||
| 348 | ParseRegionLockoutInfo(); | 348 | ParseRegionLockoutInfo(); |
| 349 | 349 | ||