diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/core/file_sys/archive_other_savedata.cpp | 145 | ||||
-rw-r--r-- | src/core/file_sys/archive_other_savedata.h | 52 | ||||
-rw-r--r-- | src/core/file_sys/archive_savedata.cpp | 79 | ||||
-rw-r--r-- | src/core/file_sys/archive_savedata.h | 8 | ||||
-rw-r--r-- | src/core/file_sys/archive_source_sd_savedata.cpp | 93 | ||||
-rw-r--r-- | src/core/file_sys/archive_source_sd_savedata.h | 30 | ||||
-rw-r--r-- | src/core/file_sys/errors.h | 3 | ||||
-rw-r--r-- | src/core/hle/result.h | 1 | ||||
-rw-r--r-- | src/core/hle/service/am/am.cpp | 10 | ||||
-rw-r--r-- | src/core/hle/service/am/am.h | 20 | ||||
-rw-r--r-- | src/core/hle/service/am/am_app.cpp | 5 | ||||
-rw-r--r-- | src/core/hle/service/am/am_net.cpp | 157 | ||||
-rw-r--r-- | src/core/hle/service/am/am_sys.cpp | 71 | ||||
-rw-r--r-- | src/core/hle/service/am/am_u.cpp | 96 | ||||
-rw-r--r-- | src/core/hle/service/fs/archive.cpp | 12 | ||||
-rw-r--r-- | src/core/hle/service/fs/archive.h | 4 |
17 files changed, 597 insertions, 193 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 299f1f261..8ce141e6a 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -18,10 +18,12 @@ set(SRCS file_sys/archive_backend.cpp file_sys/archive_extsavedata.cpp file_sys/archive_ncch.cpp + file_sys/archive_other_savedata.cpp file_sys/archive_romfs.cpp file_sys/archive_savedata.cpp file_sys/archive_sdmc.cpp file_sys/archive_sdmcwriteonly.cpp + file_sys/archive_source_sd_savedata.cpp file_sys/archive_systemsavedata.cpp file_sys/disk_archive.cpp file_sys/ivfc_archive.cpp @@ -163,10 +165,12 @@ set(HEADERS file_sys/archive_backend.h file_sys/archive_extsavedata.h file_sys/archive_ncch.h + file_sys/archive_other_savedata.h file_sys/archive_romfs.h file_sys/archive_savedata.h file_sys/archive_sdmc.h file_sys/archive_sdmcwriteonly.h + file_sys/archive_source_sd_savedata.h file_sys/archive_systemsavedata.h file_sys/directory_backend.h file_sys/disk_archive.h diff --git a/src/core/file_sys/archive_other_savedata.cpp b/src/core/file_sys/archive_other_savedata.cpp new file mode 100644 index 000000000..d3cf080da --- /dev/null +++ b/src/core/file_sys/archive_other_savedata.cpp @@ -0,0 +1,145 @@ +// Copyright 2016 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include <tuple> +#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 <typename T> +ResultVal<std::tuple<MediaType, u64>> ParsePath(const Path& path, T program_id_reader) { + if (path.GetType() != Binary) { + LOG_ERROR(Service_FS, "Wrong path type %d", static_cast<int>(path.GetType())); + return ERROR_INVALID_PATH; + } + + std::vector<u8> 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<const u32*>(vec_data.data()); + auto media_type = static_cast<MediaType>(data[0]); + + if (media_type != MediaType::SDMC && media_type != MediaType::GameCard) { + LOG_ERROR(Service_FS, "Unsupported media type %u", static_cast<u32>(media_type)); + + // Note: this is strange, but the error code was verified with a real 3DS + return ERROR_UNSUPPORTED_OPEN_FLAGS; + } + + return MakeResult<std::tuple<MediaType, u64>>(media_type, program_id_reader(data)); +} + +ResultVal<std::tuple<MediaType, u64>> ParsePathPermitted(const Path& path) { + return ParsePath(path, + [](const u32* data) -> u64 { return (data[1] << 8) | 0x0004000000000000ULL; }); +} + +ResultVal<std::tuple<MediaType, u64>> ParsePathGeneral(const Path& path) { + return ParsePath( + path, [](const u32* data) -> u64 { return data[1] | (static_cast<u64>(data[2]) << 32); }); +} + +} // namespace + +ArchiveFactory_OtherSaveDataPermitted::ArchiveFactory_OtherSaveDataPermitted( + std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata) + : sd_savedata_source(sd_savedata) {} + +ResultVal<std::unique_ptr<ArchiveBackend>> 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<ArchiveFormatInfo> 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<ArchiveSource_SDSaveData> sd_savedata) + : sd_savedata_source(sd_savedata) {} + +ResultVal<std::unique_ptr<ArchiveBackend>> 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<ArchiveFormatInfo> 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 diff --git a/src/core/file_sys/archive_other_savedata.h b/src/core/file_sys/archive_other_savedata.h new file mode 100644 index 000000000..d80725158 --- /dev/null +++ b/src/core/file_sys/archive_other_savedata.h @@ -0,0 +1,52 @@ +// Copyright 2016 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/file_sys/archive_source_sd_savedata.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// FileSys namespace + +namespace FileSys { + +/// File system interface to the OtherSaveDataPermitted archive +class ArchiveFactory_OtherSaveDataPermitted final : public ArchiveFactory { +public: + explicit ArchiveFactory_OtherSaveDataPermitted( + std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata_source); + + std::string GetName() const override { + return "OtherSaveDataPermitted"; + } + + ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) override; + ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) override; + ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path) const override; + +private: + std::string mount_point; + std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata_source; +}; + +/// File system interface to the OtherSaveDataGeneral archive +class ArchiveFactory_OtherSaveDataGeneral final : public ArchiveFactory { +public: + explicit ArchiveFactory_OtherSaveDataGeneral( + std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata_source); + + std::string GetName() const override { + return "OtherSaveDataGeneral"; + } + + ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) override; + ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) override; + ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path) const override; + +private: + std::string mount_point; + std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata_source; +}; + +} // namespace FileSys diff --git a/src/core/file_sys/archive_savedata.cpp b/src/core/file_sys/archive_savedata.cpp index ecb44a215..61f7654f7 100644 --- a/src/core/file_sys/archive_savedata.cpp +++ b/src/core/file_sys/archive_savedata.cpp @@ -2,96 +2,29 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include <algorithm> -#include <memory> -#include "common/common_types.h" -#include "common/file_util.h" -#include "common/logging/log.h" -#include "common/string_util.h" #include "core/file_sys/archive_savedata.h" -#include "core/file_sys/savedata_archive.h" #include "core/hle/kernel/process.h" -#include "core/hle/service/fs/archive.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // FileSys namespace namespace FileSys { -static std::string GetSaveDataContainerPath(const std::string& sdmc_directory) { - return Common::StringFromFormat("%sNintendo 3DS/%s/%s/title/", sdmc_directory.c_str(), - SYSTEM_ID.c_str(), SDCARD_ID.c_str()); -} - -static std::string GetSaveDataPath(const std::string& mount_location, u64 program_id) { - u32 high = (u32)(program_id >> 32); - u32 low = (u32)(program_id & 0xFFFFFFFF); - return Common::StringFromFormat("%s%08x/%08x/data/00000001/", mount_location.c_str(), high, - low); -} - -static std::string GetSaveDataMetadataPath(const std::string& mount_location, u64 program_id) { - u32 high = (u32)(program_id >> 32); - u32 low = (u32)(program_id & 0xFFFFFFFF); - return Common::StringFromFormat("%s%08x/%08x/data/00000001.metadata", mount_location.c_str(), - high, low); -} - -ArchiveFactory_SaveData::ArchiveFactory_SaveData(const std::string& sdmc_directory) - : mount_point(GetSaveDataContainerPath(sdmc_directory)) { - LOG_INFO(Service_FS, "Directory %s set as SaveData.", this->mount_point.c_str()); -} +ArchiveFactory_SaveData::ArchiveFactory_SaveData( + std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata) + : sd_savedata_source(sd_savedata) {} ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveData::Open(const Path& path) { - std::string concrete_mount_point = - GetSaveDataPath(mount_point, Kernel::g_current_process->codeset->program_id); - if (!FileUtil::Exists(concrete_mount_point)) { - // When a SaveData archive is created for the first time, it is not yet formatted and the - // save file/directory structure expected by the game has not yet been initialized. - // Returning the NotFormatted error code will signal the game to provision the SaveData - // archive with the files and folders that it expects. - return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS, - ErrorSummary::InvalidState, ErrorLevel::Status); - } - - auto archive = std::make_unique<SaveDataArchive>(std::move(concrete_mount_point)); - return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); + return sd_savedata_source->Open(Kernel::g_current_process->codeset->program_id); } ResultCode ArchiveFactory_SaveData::Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) { - std::string concrete_mount_point = - GetSaveDataPath(mount_point, Kernel::g_current_process->codeset->program_id); - FileUtil::DeleteDirRecursively(concrete_mount_point); - FileUtil::CreateFullPath(concrete_mount_point); - - // Write the format metadata - std::string metadata_path = - GetSaveDataMetadataPath(mount_point, Kernel::g_current_process->codeset->program_id); - FileUtil::IOFile file(metadata_path, "wb"); - - if (file.IsOpen()) { - file.WriteBytes(&format_info, sizeof(format_info)); - return RESULT_SUCCESS; - } - return RESULT_SUCCESS; + return sd_savedata_source->Format(Kernel::g_current_process->codeset->program_id, format_info); } ResultVal<ArchiveFormatInfo> ArchiveFactory_SaveData::GetFormatInfo(const Path& path) const { - std::string metadata_path = - GetSaveDataMetadataPath(mount_point, Kernel::g_current_process->codeset->program_id); - FileUtil::IOFile file(metadata_path, "rb"); - - if (!file.IsOpen()) { - LOG_ERROR(Service_FS, "Could not open metadata information for archive"); - // TODO(Subv): Verify error code - return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS, - ErrorSummary::InvalidState, ErrorLevel::Status); - } - - ArchiveFormatInfo info = {}; - file.ReadBytes(&info, sizeof(info)); - return MakeResult<ArchiveFormatInfo>(info); + return sd_savedata_source->GetFormatInfo(Kernel::g_current_process->codeset->program_id); } } // namespace FileSys diff --git a/src/core/file_sys/archive_savedata.h b/src/core/file_sys/archive_savedata.h index 6a372865a..41aa6f189 100644 --- a/src/core/file_sys/archive_savedata.h +++ b/src/core/file_sys/archive_savedata.h @@ -4,10 +4,7 @@ #pragma once -#include <memory> -#include <string> -#include "core/file_sys/archive_backend.h" -#include "core/hle/result.h" +#include "core/file_sys/archive_source_sd_savedata.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // FileSys namespace @@ -17,7 +14,7 @@ namespace FileSys { /// File system interface to the SaveData archive class ArchiveFactory_SaveData final : public ArchiveFactory { public: - ArchiveFactory_SaveData(const std::string& mount_point); + explicit ArchiveFactory_SaveData(std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata_source); std::string GetName() const override { return "SaveData"; @@ -30,6 +27,7 @@ public: private: std::string mount_point; + std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata_source; }; } // namespace FileSys diff --git a/src/core/file_sys/archive_source_sd_savedata.cpp b/src/core/file_sys/archive_source_sd_savedata.cpp new file mode 100644 index 000000000..2d8a950a3 --- /dev/null +++ b/src/core/file_sys/archive_source_sd_savedata.cpp @@ -0,0 +1,93 @@ +// Copyright 2016 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/file_util.h" +#include "common/logging/log.h" +#include "common/string_util.h" +#include "core/file_sys/archive_source_sd_savedata.h" +#include "core/file_sys/savedata_archive.h" +#include "core/hle/service/fs/archive.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// FileSys namespace + +namespace FileSys { + +namespace { + +std::string GetSaveDataContainerPath(const std::string& sdmc_directory) { + return Common::StringFromFormat("%sNintendo 3DS/%s/%s/title/", sdmc_directory.c_str(), + SYSTEM_ID.c_str(), SDCARD_ID.c_str()); +} + +std::string GetSaveDataPath(const std::string& mount_location, u64 program_id) { + u32 high = static_cast<u32>(program_id >> 32); + u32 low = static_cast<u32>(program_id & 0xFFFFFFFF); + return Common::StringFromFormat("%s%08x/%08x/data/00000001/", mount_location.c_str(), high, + low); +} + +std::string GetSaveDataMetadataPath(const std::string& mount_location, u64 program_id) { + u32 high = static_cast<u32>(program_id >> 32); + u32 low = static_cast<u32>(program_id & 0xFFFFFFFF); + return Common::StringFromFormat("%s%08x/%08x/data/00000001.metadata", mount_location.c_str(), + high, low); +} + +} // namespace + +ArchiveSource_SDSaveData::ArchiveSource_SDSaveData(const std::string& sdmc_directory) + : mount_point(GetSaveDataContainerPath(sdmc_directory)) { + LOG_INFO(Service_FS, "Directory %s set as SaveData.", mount_point.c_str()); +} + +ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveSource_SDSaveData::Open(u64 program_id) { + std::string concrete_mount_point = GetSaveDataPath(mount_point, program_id); + if (!FileUtil::Exists(concrete_mount_point)) { + // When a SaveData archive is created for the first time, it is not yet formatted and the + // save file/directory structure expected by the game has not yet been initialized. + // Returning the NotFormatted error code will signal the game to provision the SaveData + // archive with the files and folders that it expects. + return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS, + ErrorSummary::InvalidState, ErrorLevel::Status); + } + + auto archive = std::make_unique<SaveDataArchive>(std::move(concrete_mount_point)); + return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); +} + +ResultCode ArchiveSource_SDSaveData::Format(u64 program_id, + const FileSys::ArchiveFormatInfo& format_info) { + std::string concrete_mount_point = GetSaveDataPath(mount_point, program_id); + FileUtil::DeleteDirRecursively(concrete_mount_point); + FileUtil::CreateFullPath(concrete_mount_point); + + // Write the format metadata + std::string metadata_path = GetSaveDataMetadataPath(mount_point, program_id); + FileUtil::IOFile file(metadata_path, "wb"); + + if (file.IsOpen()) { + file.WriteBytes(&format_info, sizeof(format_info)); + return RESULT_SUCCESS; + } + return RESULT_SUCCESS; +} + +ResultVal<ArchiveFormatInfo> ArchiveSource_SDSaveData::GetFormatInfo(u64 program_id) const { + std::string metadata_path = GetSaveDataMetadataPath(mount_point, program_id); + FileUtil::IOFile file(metadata_path, "rb"); + + if (!file.IsOpen()) { + LOG_ERROR(Service_FS, "Could not open metadata information for archive"); + // TODO(Subv): Verify error code + return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS, + ErrorSummary::InvalidState, ErrorLevel::Status); + } + + ArchiveFormatInfo info = {}; + file.ReadBytes(&info, sizeof(info)); + return MakeResult<ArchiveFormatInfo>(info); +} + +} // namespace FileSys diff --git a/src/core/file_sys/archive_source_sd_savedata.h b/src/core/file_sys/archive_source_sd_savedata.h new file mode 100644 index 000000000..b33126c31 --- /dev/null +++ b/src/core/file_sys/archive_source_sd_savedata.h @@ -0,0 +1,30 @@ +// Copyright 2016 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <memory> +#include <string> +#include "core/file_sys/archive_backend.h" +#include "core/hle/result.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// FileSys namespace + +namespace FileSys { + +/// A common source of SD save data archive +class ArchiveSource_SDSaveData { +public: + explicit ArchiveSource_SDSaveData(const std::string& mount_point); + + ResultVal<std::unique_ptr<ArchiveBackend>> Open(u64 program_id); + ResultCode Format(u64 program_id, const FileSys::ArchiveFormatInfo& format_info); + ResultVal<ArchiveFormatInfo> GetFormatInfo(u64 program_id) const; + +private: + std::string mount_point; +}; + +} // namespace FileSys diff --git a/src/core/file_sys/errors.h b/src/core/file_sys/errors.h index fd1b07df0..4d5f62b08 100644 --- a/src/core/file_sys/errors.h +++ b/src/core/file_sys/errors.h @@ -36,5 +36,8 @@ const ResultCode ERROR_ALREADY_EXISTS(ErrorDescription::FS_AlreadyExists, ErrorM ErrorSummary::NothingHappened, ErrorLevel::Status); const ResultCode ERROR_DIRECTORY_NOT_EMPTY(ErrorDescription::FS_DirectoryNotEmpty, ErrorModule::FS, ErrorSummary::Canceled, ErrorLevel::Status); +const ResultCode ERROR_GAMECARD_NOT_INSERTED(ErrorDescription::FS_GameCardNotInserted, + ErrorModule::FS, ErrorSummary::NotFound, + ErrorLevel::Status); } // namespace FileSys diff --git a/src/core/hle/result.h b/src/core/hle/result.h index f7356f9d8..8d29117a8 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h @@ -22,6 +22,7 @@ enum class ErrorDescription : u32 { FS_ArchiveNotMounted = 101, FS_FileNotFound = 112, FS_PathNotFound = 113, + FS_GameCardNotInserted = 141, FS_NotFound = 120, FS_FileAlreadyExists = 180, FS_DirectoryAlreadyExists = 185, diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index f7a990d69..d344a622f 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -20,7 +20,7 @@ static std::array<u32, 3> am_titles_list_count = {0, 0, 0}; static u32 am_ticket_count = 0; static u32 am_ticket_list_count = 0; -void GetTitleCount(Service::Interface* self) { +void GetNumPrograms(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 media_type = cmd_buff[1] & 0xFF; @@ -81,7 +81,7 @@ void DeleteContents(Service::Interface* self) { media_type, title_id, am_content_count[media_type], content_ids_pointer); } -void GetTitleList(Service::Interface* self) { +void GetProgramList(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 media_type = cmd_buff[2] & 0xFF; @@ -97,7 +97,7 @@ void GetTitleList(Service::Interface* self) { media_type, am_titles_list_count[media_type], title_ids_output_pointer); } -void GetTitleInfo(Service::Interface* self) { +void GetProgramInfos(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 media_type = cmd_buff[1] & 0xFF; @@ -113,7 +113,7 @@ void GetTitleInfo(Service::Interface* self) { } void GetDataTitleInfos(Service::Interface* self) { - GetTitleInfo(self); + GetProgramInfos(self); LOG_WARNING(Service_AM, "(STUBBED) called"); } @@ -151,7 +151,7 @@ void DeleteTicket(Service::Interface* self) { LOG_WARNING(Service_AM, "(STUBBED) called title_id=0x%016" PRIx64 "", title_id); } -void GetTicketCount(Service::Interface* self) { +void GetNumTickets(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); cmd_buff[1] = RESULT_SUCCESS.raw; diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 5676cdd5f..9bc2ca305 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -11,7 +11,7 @@ class Interface; namespace AM { /** - * AM::GetTitleCount service function + * AM::GetNumPrograms service function * Gets the number of installed titles in the requested media type * Inputs: * 0 : Command header (0x00010040) @@ -20,7 +20,7 @@ namespace AM { * 1 : Result, 0 on success, otherwise error code * 2 : The number of titles in the requested media type */ -void GetTitleCount(Service::Interface* self); +void GetNumPrograms(Service::Interface* self); /** * AM::FindContentInfos service function @@ -62,7 +62,7 @@ void ListContentInfos(Service::Interface* self); void DeleteContents(Service::Interface* self); /** - * AM::GetTitleList service function + * AM::GetProgramList service function * Loads information about the desired number of titles from the desired media type into an array * Inputs: * 1 : Title count @@ -72,10 +72,10 @@ void DeleteContents(Service::Interface* self); * 1 : Result, 0 on success, otherwise error code * 2 : The number of titles loaded from the requested media type */ -void GetTitleList(Service::Interface* self); +void GetProgramList(Service::Interface* self); /** - * AM::GetTitleInfo service function + * AM::GetProgramInfos service function * Inputs: * 1 : u8 Mediatype * 2 : Total titles @@ -84,11 +84,11 @@ void GetTitleList(Service::Interface* self); * Outputs: * 1 : Result, 0 on success, otherwise error code */ -void GetTitleInfo(Service::Interface* self); +void GetProgramInfos(Service::Interface* self); /** * AM::GetDataTitleInfos service function - * Wrapper for AM::GetTitleInfo + * Wrapper for AM::GetProgramInfos * Inputs: * 1 : u8 Mediatype * 2 : Total titles @@ -135,12 +135,12 @@ void GetNumContentInfos(Service::Interface* self); void DeleteTicket(Service::Interface* self); /** - * AM::GetTicketCount service function + * AM::GetNumTickets service function * Outputs: * 1 : Result, 0 on success, otherwise error code - * 2 : Total titles + * 2 : Number of tickets */ -void GetTicketCount(Service::Interface* self); +void GetNumTickets(Service::Interface* self); /** * AM::GetTicketList service function diff --git a/src/core/hle/service/am/am_app.cpp b/src/core/hle/service/am/am_app.cpp index bfc1ca6bd..218375c8f 100644 --- a/src/core/hle/service/am/am_app.cpp +++ b/src/core/hle/service/am/am_app.cpp @@ -14,9 +14,14 @@ const Interface::FunctionInfo FunctionTable[] = { {0x10030142, ListContentInfos, "ListContentInfos"}, {0x10040102, DeleteContents, "DeleteContents"}, {0x10050084, GetDataTitleInfos, "GetDataTitleInfos"}, + {0x10060080, nullptr, "GetNumDataTitleTickets"}, {0x10070102, ListDataTitleTicketInfos, "ListDataTitleTicketInfos"}, + {0x100801C2, nullptr, "GetItemRights"}, {0x100900C0, nullptr, "IsDataTitleInUse"}, {0x100A0000, nullptr, "IsExternalTitleDatabaseInitialized"}, + {0x100B00C0, nullptr, "GetNumExistingContentInfos"}, + {0x100C0142, nullptr, "ListExistingContentInfos"}, + {0x100D0084, nullptr, "GetPatchTitleInfos"}, }; AM_APP_Interface::AM_APP_Interface() { diff --git a/src/core/hle/service/am/am_net.cpp b/src/core/hle/service/am/am_net.cpp index 3a597a34c..f3cd1d23f 100644 --- a/src/core/hle/service/am/am_net.cpp +++ b/src/core/hle/service/am/am_net.cpp @@ -9,61 +9,116 @@ namespace Service { namespace AM { const Interface::FunctionInfo FunctionTable[] = { - {0x00010040, GetTitleCount, "GetTitleCount"}, - {0x00020082, GetTitleList, "GetTitleList"}, - {0x00030084, GetTitleInfo, "GetTitleInfo"}, - {0x000400C0, nullptr, "DeleteApplicationTitle"}, - {0x000500C0, nullptr, "GetTitleProductCode"}, - {0x000600C0, nullptr, "GetTitleExtDataId"}, + {0x00010040, GetNumPrograms, "GetNumPrograms"}, + {0x00020082, GetProgramList, "GetProgramList"}, + {0x00030084, GetProgramInfos, "GetProgramInfos"}, + {0x000400C0, nullptr, "DeleteUserProgram"}, + {0x000500C0, nullptr, "GetProductCode"}, + {0x000600C0, nullptr, "GetStorageId"}, {0x00070080, DeleteTicket, "DeleteTicket"}, - {0x00080000, GetTicketCount, "GetTicketCount"}, + {0x00080000, GetNumTickets, "GetNumTickets"}, {0x00090082, GetTicketList, "GetTicketList"}, {0x000A0000, nullptr, "GetDeviceID"}, - {0x000D0084, nullptr, "GetPendingTitleInfo"}, - {0x000E00C0, nullptr, "DeletePendingTitle"}, - {0x00140040, nullptr, "FinalizePendingTitles"}, - {0x00150040, nullptr, "DeleteAllPendingTitles"}, + {0x000B0040, nullptr, "GetNumImportTitleContexts"}, + {0x000C0082, nullptr, "GetImportTitleContextList"}, + {0x000D0084, nullptr, "GetImportTitleContexts"}, + {0x000E00C0, nullptr, "DeleteImportTitleContext"}, + {0x000F00C0, nullptr, "GetNumImportContentContexts"}, + {0x00100102, nullptr, "GetImportContentContextList"}, + {0x00110104, nullptr, "GetImportContentContexts"}, + {0x00120102, nullptr, "DeleteImportContentContexts"}, + {0x00130040, nullptr, "NeedsCleanup"}, + {0x00140040, nullptr, "DoCleanup"}, + {0x00150040, nullptr, "DeleteAllImportContexts"}, + {0x00160000, nullptr, "DeleteAllTemporaryPrograms"}, + {0x00170044, nullptr, "ImportTwlBackupLegacy"}, {0x00180080, nullptr, "InitializeTitleDatabase"}, - {0x00190040, nullptr, "ReloadDBS"}, - {0x001A00C0, nullptr, "GetDSiWareExportSize"}, - {0x001B0144, nullptr, "ExportDSiWare"}, - {0x001C0084, nullptr, "ImportDSiWare"}, - {0x00230080, nullptr, "TitleIDListGetTotal2"}, - {0x002400C2, nullptr, "GetTitleIDList2"}, - {0x04010080, nullptr, "InstallFIRM"}, - {0x04020040, nullptr, "StartInstallCIADB0"}, - {0x04030000, nullptr, "StartInstallCIADB1"}, - {0x04040002, nullptr, "AbortCIAInstall"}, - {0x04050002, nullptr, "CloseCIAFinalizeInstall"}, - {0x04060002, nullptr, "CloseCIA"}, - {0x040700C2, nullptr, "FinalizeTitlesInstall"}, - {0x04080042, nullptr, "GetCiaFileInfo"}, - {0x040E00C2, nullptr, "InstallTitlesFinish"}, - {0x040F0000, nullptr, "InstallNATIVEFIRM"}, - {0x041000C0, nullptr, "DeleteTitle"}, - {0x04120000, nullptr, "Initialize"}, - {0x041700C0, nullptr, "MigrateAGBtoSAV"}, - {0x08010000, nullptr, "OpenTicket"}, - {0x08020002, nullptr, "TicketAbortInstall"}, - {0x08030002, nullptr, "TicketFinalizeInstall"}, - {0x08040100, nullptr, "InstallTitleBegin"}, - {0x08050000, nullptr, "InstallTitleAbort"}, - {0x080600C0, nullptr, "InstallTitleResume"}, - {0x08070000, nullptr, "InstallTitleAbortTMD"}, - {0x08080000, nullptr, "InstallTitleFinish"}, - {0x080A0000, nullptr, "OpenTMD"}, - {0x080B0002, nullptr, "TMDAbortInstall"}, - {0x080C0042, nullptr, "TMDFinalizeInstall"}, - {0x080E0040, nullptr, "OpenContentCreate"}, - {0x080F0002, nullptr, "ContentAbortInstall"}, - {0x08100040, nullptr, "OpenContentResume"}, - {0x08120002, nullptr, "ContentFinalizeInstall"}, - {0x08130000, nullptr, "GetTotalContents"}, - {0x08140042, nullptr, "GetContentIndexes"}, - {0x08150044, nullptr, "GetContentsInfo"}, - {0x08180042, nullptr, "GetCTCert"}, - {0x08190108, nullptr, "SetCertificates"}, - {0x081B00C2, nullptr, "InstallTitlesFinish"}, + {0x00190040, nullptr, "QueryAvailableTitleDatabase"}, + {0x001A00C0, nullptr, "CalcTwlBackupSize"}, + {0x001B0144, nullptr, "ExportTwlBackup"}, + {0x001C0084, nullptr, "ImportTwlBackup"}, + {0x001D0000, nullptr, "DeleteAllTwlUserPrograms"}, + {0x001E00C8, nullptr, "ReadTwlBackupInfo"}, + {0x001F0040, nullptr, "DeleteAllExpiredUserPrograms"}, + {0x00200000, nullptr, "GetTwlArchiveResourceInfo"}, + {0x00210042, nullptr, "GetPersonalizedTicketInfoList"}, + {0x00220080, nullptr, "DeleteAllImportContextsFiltered"}, + {0x00230080, nullptr, "GetNumImportTitleContextsFiltered"}, + {0x002400C2, nullptr, "GetImportTitleContextListFiltered"}, + {0x002500C0, nullptr, "CheckContentRights"}, + {0x00260044, nullptr, "GetTicketLimitInfos"}, + {0x00270044, nullptr, "GetDemoLaunchInfos"}, + {0x00280108, nullptr, "ReadTwlBackupInfoEx"}, + {0x00290082, nullptr, "DeleteUserProgramsAtomically"}, + {0x002A00C0, nullptr, "GetNumExistingContentInfosSystem"}, + {0x002B0142, nullptr, "ListExistingContentInfosSystem"}, + {0x002C0084, nullptr, "GetProgramInfosIgnorePlatform"}, + {0x002D00C0, nullptr, "CheckContentRightsIgnorePlatform"}, + {0x04010080, nullptr, "UpdateFirmwareTo"}, + {0x04020040, nullptr, "BeginImportProgram"}, + {0x04030000, nullptr, "BeginImportProgramTemporarily"}, + {0x04040002, nullptr, "CancelImportProgram"}, + {0x04050002, nullptr, "EndImportProgram"}, + {0x04060002, nullptr, "EndImportProgramWithoutCommit"}, + {0x040700C2, nullptr, "CommitImportPrograms"}, + {0x04080042, nullptr, "GetProgramInfoFromCia"}, + {0x04090004, nullptr, "GetSystemMenuDataFromCia"}, + {0x040A0002, nullptr, "GetDependencyListFromCia"}, + {0x040B0002, nullptr, "GetTransferSizeFromCia"}, + {0x040C0002, nullptr, "GetCoreVersionFromCia"}, + {0x040D0042, nullptr, "GetRequiredSizeFromCia"}, + {0x040E00C2, nullptr, "CommitImportProgramsAndUpdateFirmwareAuto"}, + {0x040F0000, nullptr, "UpdateFirmwareAuto"}, + {0x041000C0, nullptr, "DeleteProgram"}, + {0x04110044, nullptr, "GetTwlProgramListForReboot"}, + {0x04120000, nullptr, "GetSystemUpdaterMutex"}, + {0x04130002, nullptr, "GetMetaSizeFromCia"}, + {0x04140044, nullptr, "GetMetaDataFromCia"}, + {0x04150080, nullptr, "CheckDemoLaunchRights"}, + {0x041600C0, nullptr, "GetInternalTitleLocationInfo"}, + {0x041700C0, nullptr, "PerpetuateAgbSaveData"}, + {0x04180040, nullptr, "BeginImportProgramForOverWrite"}, + {0x04190000, nullptr, "BeginImportSystemProgram"}, + {0x08010000, nullptr, "BeginImportTicket"}, + {0x08020002, nullptr, "CancelImportTicket"}, + {0x08030002, nullptr, "EndImportTicket"}, + {0x08040100, nullptr, "BeginImportTitle"}, + {0x08050000, nullptr, "StopImportTitle"}, + {0x080600C0, nullptr, "ResumeImportTitle"}, + {0x08070000, nullptr, "CancelImportTitle"}, + {0x08080000, nullptr, "EndImportTitle"}, + {0x080900C2, nullptr, "CommitImportTitles"}, + {0x080A0000, nullptr, "BeginImportTmd"}, + {0x080B0002, nullptr, "CancelImportTmd"}, + {0x080C0042, nullptr, "EndImportTmd"}, + {0x080D0042, nullptr, "CreateImportContentContexts"}, + {0x080E0040, nullptr, "BeginImportContent"}, + {0x080F0002, nullptr, "StopImportContent"}, + {0x08100040, nullptr, "ResumeImportContent"}, + {0x08110002, nullptr, "CancelImportContent"}, + {0x08120002, nullptr, "EndImportContent"}, + {0x08130000, nullptr, "GetNumCurrentImportContentContexts"}, + {0x08140042, nullptr, "GetCurrentImportContentContextList"}, + {0x08150044, nullptr, "GetCurrentImportContentContexts"}, + {0x08160146, nullptr, "Sign"}, + {0x08170146, nullptr, "Verify"}, + {0x08180042, nullptr, "GetDeviceCert"}, + {0x08190108, nullptr, "ImportCertificates"}, + {0x081A0042, nullptr, "ImportCertificate"}, + {0x081B00C2, nullptr, "CommitImportTitlesAndUpdateFirmwareAuto"}, + {0x081C0100, nullptr, "DeleteTicketId"}, + {0x081D0080, nullptr, "GetNumTicketIds"}, + {0x081E0102, nullptr, "GetTicketIdList"}, + {0x081F0080, nullptr, "GetNumTicketsOfProgram"}, + {0x08200102, nullptr, "ListTicketInfos"}, + {0x08210142, nullptr, "GetRightsOnlyTicketData"}, + {0x08220000, nullptr, "GetNumCurrentContentInfos"}, + {0x08230044, nullptr, "FindCurrentContentInfos"}, + {0x08240082, nullptr, "ListCurrentContentInfos"}, + {0x08250102, nullptr, "CalculateContextRequiredSize"}, + {0x08260042, nullptr, "UpdateImportContentContexts"}, + {0x08270000, nullptr, "DeleteAllDemoLaunchInfos"}, + {0x082800C0, nullptr, "BeginImportTitleForOverWrite"}, }; AM_NET_Interface::AM_NET_Interface() { diff --git a/src/core/hle/service/am/am_sys.cpp b/src/core/hle/service/am/am_sys.cpp index a2268303c..949b3591d 100644 --- a/src/core/hle/service/am/am_sys.cpp +++ b/src/core/hle/service/am/am_sys.cpp @@ -9,27 +9,64 @@ namespace Service { namespace AM { const Interface::FunctionInfo FunctionTable[] = { - {0x00010040, GetTitleCount, "GetTitleCount"}, - {0x00020082, GetTitleList, "GetTitleList"}, - {0x00030084, GetTitleInfo, "GetTitleInfo"}, - {0x000400C0, nullptr, "DeleteApplicationTitle"}, - {0x000500C0, nullptr, "GetTitleProductCode"}, - {0x000600C0, nullptr, "GetTitleExtDataId"}, + {0x00010040, GetNumPrograms, "GetNumPrograms"}, + {0x00020082, GetProgramList, "GetProgramList"}, + {0x00030084, GetProgramInfos, "GetProgramInfos"}, + {0x000400C0, nullptr, "DeleteUserProgram"}, + {0x000500C0, nullptr, "GetProductCode"}, + {0x000600C0, nullptr, "GetStorageId"}, {0x00070080, DeleteTicket, "DeleteTicket"}, - {0x00080000, GetTicketCount, "GetTicketCount"}, + {0x00080000, GetNumTickets, "GetNumTickets"}, {0x00090082, GetTicketList, "GetTicketList"}, {0x000A0000, nullptr, "GetDeviceID"}, - {0x000D0084, nullptr, "GetPendingTitleInfo"}, - {0x000E00C0, nullptr, "DeletePendingTitle"}, - {0x00140040, nullptr, "FinalizePendingTitles"}, - {0x00150040, nullptr, "DeleteAllPendingTitles"}, + {0x000B0040, nullptr, "GetNumImportTitleContexts"}, + {0x000C0082, nullptr, "GetImportTitleContextList"}, + {0x000D0084, nullptr, "GetImportTitleContexts"}, + {0x000E00C0, nullptr, "DeleteImportTitleContext"}, + {0x000F00C0, nullptr, "GetNumImportContentContexts"}, + {0x00100102, nullptr, "GetImportContentContextList"}, + {0x00110104, nullptr, "GetImportContentContexts"}, + {0x00120102, nullptr, "DeleteImportContentContexts"}, + {0x00130040, nullptr, "NeedsCleanup"}, + {0x00140040, nullptr, "DoCleanup"}, + {0x00150040, nullptr, "DeleteAllImportContexts"}, + {0x00160000, nullptr, "DeleteAllTemporaryPrograms"}, + {0x00170044, nullptr, "ImportTwlBackupLegacy"}, {0x00180080, nullptr, "InitializeTitleDatabase"}, - {0x00190040, nullptr, "ReloadDBS"}, - {0x001A00C0, nullptr, "GetDSiWareExportSize"}, - {0x001B0144, nullptr, "ExportDSiWare"}, - {0x001C0084, nullptr, "ImportDSiWare"}, - {0x00230080, nullptr, "GetPendingTitleCount"}, - {0x002400C2, nullptr, "GetPendingTitleList"}, + {0x00190040, nullptr, "QueryAvailableTitleDatabase"}, + {0x001A00C0, nullptr, "CalcTwlBackupSize"}, + {0x001B0144, nullptr, "ExportTwlBackup"}, + {0x001C0084, nullptr, "ImportTwlBackup"}, + {0x001D0000, nullptr, "DeleteAllTwlUserPrograms"}, + {0x001E00C8, nullptr, "ReadTwlBackupInfo"}, + {0x001F0040, nullptr, "DeleteAllExpiredUserPrograms"}, + {0x00200000, nullptr, "GetTwlArchiveResourceInfo"}, + {0x00210042, nullptr, "GetPersonalizedTicketInfoList"}, + {0x00220080, nullptr, "DeleteAllImportContextsFiltered"}, + {0x00230080, nullptr, "GetNumImportTitleContextsFiltered"}, + {0x002400C2, nullptr, "GetImportTitleContextListFiltered"}, + {0x002500C0, nullptr, "CheckContentRights"}, + {0x00260044, nullptr, "GetTicketLimitInfos"}, + {0x00270044, nullptr, "GetDemoLaunchInfos"}, + {0x00280108, nullptr, "ReadTwlBackupInfoEx"}, + {0x00290082, nullptr, "DeleteUserProgramsAtomically"}, + {0x002A00C0, nullptr, "GetNumExistingContentInfosSystem"}, + {0x002B0142, nullptr, "ListExistingContentInfosSystem"}, + {0x002C0084, nullptr, "GetProgramInfosIgnorePlatform"}, + {0x002D00C0, nullptr, "CheckContentRightsIgnorePlatform"}, + {0x100100C0, GetNumContentInfos, "GetNumContentInfos"}, + {0x10020104, FindContentInfos, "FindContentInfos"}, + {0x10030142, ListContentInfos, "ListContentInfos"}, + {0x10040102, DeleteContents, "DeleteContents"}, + {0x10050084, GetDataTitleInfos, "GetDataTitleInfos"}, + {0x10060080, nullptr, "GetNumDataTitleTickets"}, + {0x10070102, ListDataTitleTicketInfos, "ListDataTitleTicketInfos"}, + {0x100801C2, nullptr, "GetItemRights"}, + {0x100900C0, nullptr, "IsDataTitleInUse"}, + {0x100A0000, nullptr, "IsExternalTitleDatabaseInitialized"}, + {0x100B00C0, nullptr, "GetNumExistingContentInfos"}, + {0x100C0142, nullptr, "ListExistingContentInfos"}, + {0x100D0084, nullptr, "GetPatchTitleInfos"}, }; AM_SYS_Interface::AM_SYS_Interface() { diff --git a/src/core/hle/service/am/am_u.cpp b/src/core/hle/service/am/am_u.cpp index 151b5e42b..354d51610 100644 --- a/src/core/hle/service/am/am_u.cpp +++ b/src/core/hle/service/am/am_u.cpp @@ -9,40 +9,76 @@ namespace Service { namespace AM { const Interface::FunctionInfo FunctionTable[] = { - {0x00010040, GetTitleCount, "GetTitleCount"}, - {0x00020082, GetTitleList, "GetTitleList"}, - {0x00030084, GetTitleInfo, "GetTitleInfo"}, - {0x000400C0, nullptr, "DeleteApplicationTitle"}, - {0x000500C0, nullptr, "GetTitleProductCode"}, - {0x000600C0, nullptr, "GetTitleExtDataId"}, + {0x00010040, GetNumPrograms, "GetNumPrograms"}, + {0x00020082, GetProgramList, "GetProgramList"}, + {0x00030084, GetProgramInfos, "GetProgramInfos"}, + {0x000400C0, nullptr, "DeleteUserProgram"}, + {0x000500C0, nullptr, "GetProductCode"}, + {0x000600C0, nullptr, "GetStorageId"}, {0x00070080, DeleteTicket, "DeleteTicket"}, - {0x00080000, GetTicketCount, "GetTicketCount"}, + {0x00080000, GetNumTickets, "GetNumTickets"}, {0x00090082, GetTicketList, "GetTicketList"}, {0x000A0000, nullptr, "GetDeviceID"}, - {0x000D0084, nullptr, "GetPendingTitleInfo"}, - {0x000E00C0, nullptr, "DeletePendingTitle"}, - {0x00140040, nullptr, "FinalizePendingTitles"}, - {0x00150040, nullptr, "DeleteAllPendingTitles"}, + {0x000B0040, nullptr, "GetNumImportTitleContexts"}, + {0x000C0082, nullptr, "GetImportTitleContextList"}, + {0x000D0084, nullptr, "GetImportTitleContexts"}, + {0x000E00C0, nullptr, "DeleteImportTitleContext"}, + {0x000F00C0, nullptr, "GetNumImportContentContexts"}, + {0x00100102, nullptr, "GetImportContentContextList"}, + {0x00110104, nullptr, "GetImportContentContexts"}, + {0x00120102, nullptr, "DeleteImportContentContexts"}, + {0x00130040, nullptr, "NeedsCleanup"}, + {0x00140040, nullptr, "DoCleanup"}, + {0x00150040, nullptr, "DeleteAllImportContexts"}, + {0x00160000, nullptr, "DeleteAllTemporaryPrograms"}, + {0x00170044, nullptr, "ImportTwlBackupLegacy"}, {0x00180080, nullptr, "InitializeTitleDatabase"}, - {0x00190040, nullptr, "ReloadDBS"}, - {0x001A00C0, nullptr, "GetDSiWareExportSize"}, - {0x001B0144, nullptr, "ExportDSiWare"}, - {0x001C0084, nullptr, "ImportDSiWare"}, - {0x00230080, nullptr, "TitleIDListGetTotal2"}, - {0x002400C2, nullptr, "GetTitleIDList2"}, - {0x04010080, nullptr, "InstallFIRM"}, - {0x04020040, nullptr, "StartInstallCIADB0"}, - {0x04030000, nullptr, "StartInstallCIADB1"}, - {0x04040002, nullptr, "AbortCIAInstall"}, - {0x04050002, nullptr, "CloseCIAFinalizeInstall"}, - {0x04060002, nullptr, "CloseCIA"}, - {0x040700C2, nullptr, "FinalizeTitlesInstall"}, - {0x04080042, nullptr, "GetCiaFileInfo"}, - {0x040E00C2, nullptr, "InstallTitlesFinish"}, - {0x040F0000, nullptr, "InstallNATIVEFIRM"}, - {0x041000C0, nullptr, "DeleteTitle"}, - {0x04120000, nullptr, "Initialize"}, - {0x041700C0, nullptr, "MigrateAGBtoSAV"}, + {0x00190040, nullptr, "QueryAvailableTitleDatabase"}, + {0x001A00C0, nullptr, "CalcTwlBackupSize"}, + {0x001B0144, nullptr, "ExportTwlBackup"}, + {0x001C0084, nullptr, "ImportTwlBackup"}, + {0x001D0000, nullptr, "DeleteAllTwlUserPrograms"}, + {0x001E00C8, nullptr, "ReadTwlBackupInfo"}, + {0x001F0040, nullptr, "DeleteAllExpiredUserPrograms"}, + {0x00200000, nullptr, "GetTwlArchiveResourceInfo"}, + {0x00210042, nullptr, "GetPersonalizedTicketInfoList"}, + {0x00220080, nullptr, "DeleteAllImportContextsFiltered"}, + {0x00230080, nullptr, "GetNumImportTitleContextsFiltered"}, + {0x002400C2, nullptr, "GetImportTitleContextListFiltered"}, + {0x002500C0, nullptr, "CheckContentRights"}, + {0x00260044, nullptr, "GetTicketLimitInfos"}, + {0x00270044, nullptr, "GetDemoLaunchInfos"}, + {0x00280108, nullptr, "ReadTwlBackupInfoEx"}, + {0x00290082, nullptr, "DeleteUserProgramsAtomically"}, + {0x002A00C0, nullptr, "GetNumExistingContentInfosSystem"}, + {0x002B0142, nullptr, "ListExistingContentInfosSystem"}, + {0x002C0084, nullptr, "GetProgramInfosIgnorePlatform"}, + {0x002D00C0, nullptr, "CheckContentRightsIgnorePlatform"}, + {0x04010080, nullptr, "UpdateFirmwareTo"}, + {0x04020040, nullptr, "BeginImportProgram"}, + {0x04030000, nullptr, "BeginImportProgramTemporarily"}, + {0x04040002, nullptr, "CancelImportProgram"}, + {0x04050002, nullptr, "EndImportProgram"}, + {0x04060002, nullptr, "EndImportProgramWithoutCommit"}, + {0x040700C2, nullptr, "CommitImportPrograms"}, + {0x04080042, nullptr, "GetProgramInfoFromCia"}, + {0x04090004, nullptr, "GetSystemMenuDataFromCia"}, + {0x040A0002, nullptr, "GetDependencyListFromCia"}, + {0x040B0002, nullptr, "GetTransferSizeFromCia"}, + {0x040C0002, nullptr, "GetCoreVersionFromCia"}, + {0x040D0042, nullptr, "GetRequiredSizeFromCia"}, + {0x040E00C2, nullptr, "CommitImportProgramsAndUpdateFirmwareAuto"}, + {0x040F0000, nullptr, "UpdateFirmwareAuto"}, + {0x041000C0, nullptr, "DeleteProgram"}, + {0x04110044, nullptr, "GetTwlProgramListForReboot"}, + {0x04120000, nullptr, "GetSystemUpdaterMutex"}, + {0x04130002, nullptr, "GetMetaSizeFromCia"}, + {0x04140044, nullptr, "GetMetaDataFromCia"}, + {0x04150080, nullptr, "CheckDemoLaunchRights"}, + {0x041600C0, nullptr, "GetInternalTitleLocationInfo"}, + {0x041700C0, nullptr, "PerpetuateAgbSaveData"}, + {0x04180040, nullptr, "BeginImportProgramForOverWrite"}, + {0x04190000, nullptr, "BeginImportSystemProgram"}, }; AM_U_Interface::AM_U_Interface() { diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 4c29784e8..bef75f5df 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -16,6 +16,7 @@ #include "core/file_sys/archive_backend.h" #include "core/file_sys/archive_extsavedata.h" #include "core/file_sys/archive_ncch.h" +#include "core/file_sys/archive_other_savedata.h" #include "core/file_sys/archive_savedata.h" #include "core/file_sys/archive_sdmc.h" #include "core/file_sys/archive_sdmcwriteonly.h" @@ -535,8 +536,17 @@ void RegisterArchiveTypes() { sdmc_directory.c_str()); // Create the SaveData archive - auto savedata_factory = std::make_unique<FileSys::ArchiveFactory_SaveData>(sdmc_directory); + auto sd_savedata_source = std::make_shared<FileSys::ArchiveSource_SDSaveData>(sdmc_directory); + auto savedata_factory = std::make_unique<FileSys::ArchiveFactory_SaveData>(sd_savedata_source); RegisterArchiveType(std::move(savedata_factory), ArchiveIdCode::SaveData); + auto other_savedata_permitted_factory = + std::make_unique<FileSys::ArchiveFactory_OtherSaveDataPermitted>(sd_savedata_source); + RegisterArchiveType(std::move(other_savedata_permitted_factory), + ArchiveIdCode::OtherSaveDataPermitted); + auto other_savedata_general_factory = + std::make_unique<FileSys::ArchiveFactory_OtherSaveDataGeneral>(sd_savedata_source); + RegisterArchiveType(std::move(other_savedata_general_factory), + ArchiveIdCode::OtherSaveDataGeneral); auto extsavedata_factory = std::make_unique<FileSys::ArchiveFactory_ExtSaveData>(sdmc_directory, false); diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h index 21ed9717b..87089bd92 100644 --- a/src/core/hle/service/fs/archive.h +++ b/src/core/hle/service/fs/archive.h @@ -34,10 +34,12 @@ enum class ArchiveIdCode : u32 { SDMC = 0x00000009, SDMCWriteOnly = 0x0000000A, NCCH = 0x2345678A, + OtherSaveDataGeneral = 0x567890B2, + OtherSaveDataPermitted = 0x567890B4, }; /// Media types for the archives -enum class MediaType : u32 { NAND = 0, SDMC = 1 }; +enum class MediaType : u32 { NAND = 0, SDMC = 1, GameCard = 2 }; typedef u64 ArchiveHandle; |