From 72b03025ac4ef0d8633c2f3e55b513cd149c59e5 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 12 Oct 2017 21:21:49 -0400 Subject: Remove lots more 3DS-specific code. --- src/core/file_sys/archive_other_savedata.cpp | 145 --------------------------- 1 file changed, 145 deletions(-) delete mode 100644 src/core/file_sys/archive_other_savedata.cpp (limited to 'src/core/file_sys/archive_other_savedata.cpp') diff --git a/src/core/file_sys/archive_other_savedata.cpp b/src/core/file_sys/archive_other_savedata.cpp deleted file mode 100644 index d3cf080da..000000000 --- a/src/core/file_sys/archive_other_savedata.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2016 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include -#include "core/file_sys/archive_other_savedata.h" -#include "core/file_sys/errors.h" -#include "core/hle/kernel/process.h" -#include "core/hle/service/fs/archive.h" - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// FileSys namespace - -namespace FileSys { - -// TODO(wwylele): The storage info in exheader should be checked before accessing these archives - -using Service::FS::MediaType; - -namespace { - -template -ResultVal> ParsePath(const Path& path, T program_id_reader) { - if (path.GetType() != Binary) { - LOG_ERROR(Service_FS, "Wrong path type %d", static_cast(path.GetType())); - return ERROR_INVALID_PATH; - } - - std::vector vec_data = path.AsBinary(); - - if (vec_data.size() != 12) { - LOG_ERROR(Service_FS, "Wrong path length %zu", vec_data.size()); - return ERROR_INVALID_PATH; - } - - const u32* data = reinterpret_cast(vec_data.data()); - auto media_type = static_cast(data[0]); - - if (media_type != MediaType::SDMC && media_type != MediaType::GameCard) { - LOG_ERROR(Service_FS, "Unsupported media type %u", static_cast(media_type)); - - // Note: this is strange, but the error code was verified with a real 3DS - return ERROR_UNSUPPORTED_OPEN_FLAGS; - } - - return MakeResult>(media_type, program_id_reader(data)); -} - -ResultVal> ParsePathPermitted(const Path& path) { - return ParsePath(path, - [](const u32* data) -> u64 { return (data[1] << 8) | 0x0004000000000000ULL; }); -} - -ResultVal> ParsePathGeneral(const Path& path) { - return ParsePath( - path, [](const u32* data) -> u64 { return data[1] | (static_cast(data[2]) << 32); }); -} - -} // namespace - -ArchiveFactory_OtherSaveDataPermitted::ArchiveFactory_OtherSaveDataPermitted( - std::shared_ptr sd_savedata) - : sd_savedata_source(sd_savedata) {} - -ResultVal> ArchiveFactory_OtherSaveDataPermitted::Open( - const Path& path) { - MediaType media_type; - u64 program_id; - CASCADE_RESULT(std::tie(media_type, program_id), ParsePathPermitted(path)); - - if (media_type == MediaType::GameCard) { - LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard"); - return ERROR_GAMECARD_NOT_INSERTED; - } - - return sd_savedata_source->Open(program_id); -} - -ResultCode ArchiveFactory_OtherSaveDataPermitted::Format( - const Path& path, const FileSys::ArchiveFormatInfo& format_info) { - LOG_ERROR(Service_FS, "Attempted to format a OtherSaveDataPermitted archive."); - return ERROR_INVALID_PATH; -} - -ResultVal ArchiveFactory_OtherSaveDataPermitted::GetFormatInfo( - const Path& path) const { - MediaType media_type; - u64 program_id; - CASCADE_RESULT(std::tie(media_type, program_id), ParsePathPermitted(path)); - - if (media_type == MediaType::GameCard) { - LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard"); - return ERROR_GAMECARD_NOT_INSERTED; - } - - return sd_savedata_source->GetFormatInfo(program_id); -} - -ArchiveFactory_OtherSaveDataGeneral::ArchiveFactory_OtherSaveDataGeneral( - std::shared_ptr sd_savedata) - : sd_savedata_source(sd_savedata) {} - -ResultVal> ArchiveFactory_OtherSaveDataGeneral::Open( - const Path& path) { - MediaType media_type; - u64 program_id; - CASCADE_RESULT(std::tie(media_type, program_id), ParsePathGeneral(path)); - - if (media_type == MediaType::GameCard) { - LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard"); - return ERROR_GAMECARD_NOT_INSERTED; - } - - return sd_savedata_source->Open(program_id); -} - -ResultCode ArchiveFactory_OtherSaveDataGeneral::Format( - const Path& path, const FileSys::ArchiveFormatInfo& format_info) { - MediaType media_type; - u64 program_id; - CASCADE_RESULT(std::tie(media_type, program_id), ParsePathGeneral(path)); - - if (media_type == MediaType::GameCard) { - LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard"); - return ERROR_GAMECARD_NOT_INSERTED; - } - - return sd_savedata_source->Format(program_id, format_info); -} - -ResultVal ArchiveFactory_OtherSaveDataGeneral::GetFormatInfo( - const Path& path) const { - MediaType media_type; - u64 program_id; - CASCADE_RESULT(std::tie(media_type, program_id), ParsePathGeneral(path)); - - if (media_type == MediaType::GameCard) { - LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard"); - return ERROR_GAMECARD_NOT_INSERTED; - } - - return sd_savedata_source->GetFormatInfo(program_id); -} - -} // namespace FileSys -- cgit v1.2.3