code: Rename ResultCode to Result

This commit is contained in:
GPUCode
2023-12-11 23:52:28 +02:00
parent 0fd8892892
commit 3ae8431aef
108 changed files with 1385 additions and 1416 deletions

View File

@ -127,7 +127,7 @@ public:
* @param path Path relative to the archive
* @return Result of the operation
*/
virtual ResultCode DeleteFile(const Path& path) const = 0;
virtual Result DeleteFile(const Path& path) const = 0;
/**
* Rename a File specified by its path
@ -135,21 +135,21 @@ public:
* @param dest_path Destination path relative to the archive
* @return Result of the operation
*/
virtual ResultCode RenameFile(const Path& src_path, const Path& dest_path) const = 0;
virtual Result RenameFile(const Path& src_path, const Path& dest_path) const = 0;
/**
* Delete a directory specified by its path
* @param path Path relative to the archive
* @return Result of the operation
*/
virtual ResultCode DeleteDirectory(const Path& path) const = 0;
virtual Result DeleteDirectory(const Path& path) const = 0;
/**
* Delete a directory specified by its path and anything under it
* @param path Path relative to the archive
* @return Result of the operation
*/
virtual ResultCode DeleteDirectoryRecursively(const Path& path) const = 0;
virtual Result DeleteDirectoryRecursively(const Path& path) const = 0;
/**
* Create a file specified by its path
@ -157,14 +157,14 @@ public:
* @param size The size of the new file, filled with zeroes
* @return Result of the operation
*/
virtual ResultCode CreateFile(const Path& path, u64 size) const = 0;
virtual Result CreateFile(const Path& path, u64 size) const = 0;
/**
* Create a directory specified by its path
* @param path Path relative to the archive
* @return Result of the operation
*/
virtual ResultCode CreateDirectory(const Path& path) const = 0;
virtual Result CreateDirectory(const Path& path) const = 0;
/**
* Rename a Directory specified by its path
@ -172,7 +172,7 @@ public:
* @param dest_path Destination path relative to the archive
* @return Result of the operation
*/
virtual ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const = 0;
virtual Result RenameDirectory(const Path& src_path, const Path& dest_path) const = 0;
/**
* Open a directory specified by its path
@ -229,9 +229,9 @@ public:
* @param path Path to the archive
* @param format_info Format information for the new archive
* @param program_id the program ID of the client that requests the operation
* @return ResultCode of the operation, 0 on success
* @return Result of the operation, 0 on success
*/
virtual ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
virtual Result Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) = 0;
/**

View File

@ -155,7 +155,7 @@ public:
std::move(delay_generator));
}
ResultCode CreateFile(const Path& path, u64 size) const override {
Result CreateFile(const Path& path, u64 size) const override {
if (size == 0) {
LOG_ERROR(Service_FS, "Zero-size file is not supported");
return ERROR_UNSUPPORTED_OPEN_FLAGS;
@ -259,7 +259,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_ExtSaveData::Open(cons
return std::make_unique<ExtSaveDataArchive>(fullpath, std::move(delay_generator));
}
ResultCode ArchiveFactory_ExtSaveData::Format(const Path& path,
Result ArchiveFactory_ExtSaveData::Format(const Path& path,
const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) {
auto corrected_path = GetCorrectedPath(path);

View File

@ -31,7 +31,7 @@ public:
}
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path, u64 program_id) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
Result Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) override;
ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const override;

View File

@ -180,47 +180,47 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
return file;
}
ResultCode NCCHArchive::DeleteFile(const Path& path) const {
Result NCCHArchive::DeleteFile(const Path& path) const {
LOG_CRITICAL(Service_FS, "Attempted to delete a file from an NCCH archive ({}).", GetName());
// TODO(Subv): Verify error code
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
return Result(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
ErrorLevel::Status);
}
ResultCode NCCHArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
Result NCCHArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an NCCH archive ({}).", GetName());
// TODO(wwylele): Use correct error code
return RESULT_UNKNOWN;
}
ResultCode NCCHArchive::DeleteDirectory(const Path& path) const {
Result NCCHArchive::DeleteDirectory(const Path& path) const {
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an NCCH archive ({}).",
GetName());
// TODO(wwylele): Use correct error code
return RESULT_UNKNOWN;
}
ResultCode NCCHArchive::DeleteDirectoryRecursively(const Path& path) const {
Result NCCHArchive::DeleteDirectoryRecursively(const Path& path) const {
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an NCCH archive ({}).",
GetName());
// TODO(wwylele): Use correct error code
return RESULT_UNKNOWN;
}
ResultCode NCCHArchive::CreateFile(const Path& path, u64 size) const {
Result NCCHArchive::CreateFile(const Path& path, u64 size) const {
LOG_CRITICAL(Service_FS, "Attempted to create a file in an NCCH archive ({}).", GetName());
// TODO: Verify error code
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
return Result(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
ErrorLevel::Permanent);
}
ResultCode NCCHArchive::CreateDirectory(const Path& path) const {
Result NCCHArchive::CreateDirectory(const Path& path) const {
LOG_CRITICAL(Service_FS, "Attempted to create a directory in an NCCH archive ({}).", GetName());
// TODO(wwylele): Use correct error code
return RESULT_UNKNOWN;
}
ResultCode NCCHArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
Result NCCHArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an NCCH archive ({}).", GetName());
// TODO(wwylele): Use correct error code
return RESULT_UNKNOWN;
@ -292,12 +292,11 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path&
open_path.tid, static_cast<Service::FS::MediaType>(open_path.media_type & 0xFF));
}
ResultCode ArchiveFactory_NCCH::Format(const Path& path,
const FileSys::ArchiveFormatInfo& format_info,
Result ArchiveFactory_NCCH::Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) {
LOG_ERROR(Service_FS, "Attempted to format a NCCH archive.");
// TODO: Verify error code
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
return Result(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
ErrorLevel::Permanent);
}

View File

@ -50,13 +50,13 @@ public:
ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path,
const Mode& mode) const override;
ResultCode DeleteFile(const Path& path) const override;
ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override;
ResultCode DeleteDirectory(const Path& path) const override;
ResultCode DeleteDirectoryRecursively(const Path& path) const override;
ResultCode CreateFile(const Path& path, u64 size) const override;
ResultCode CreateDirectory(const Path& path) const override;
ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override;
Result DeleteFile(const Path& path) const override;
Result RenameFile(const Path& src_path, const Path& dest_path) const override;
Result DeleteDirectory(const Path& path) const override;
Result DeleteDirectoryRecursively(const Path& path) const override;
Result CreateFile(const Path& path, u64 size) const override;
Result CreateDirectory(const Path& path) const override;
Result RenameDirectory(const Path& src_path, const Path& dest_path) const override;
ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override;
u64 GetFreeBytes() const override;
@ -114,7 +114,7 @@ public:
}
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path, u64 program_id) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
Result Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) override;
ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const override;

View File

@ -78,8 +78,9 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_OtherSaveDataPermitted
return sd_savedata_source->Open(program_id);
}
ResultCode ArchiveFactory_OtherSaveDataPermitted::Format(
const Path& path, const FileSys::ArchiveFormatInfo& format_info, u64 program_id) {
Result ArchiveFactory_OtherSaveDataPermitted::Format(const Path& path,
const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) {
LOG_ERROR(Service_FS, "Attempted to format a OtherSaveDataPermitted archive.");
return ERROR_INVALID_PATH;
}
@ -116,8 +117,9 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_OtherSaveDataGeneral::
return sd_savedata_source->Open(program_id);
}
ResultCode ArchiveFactory_OtherSaveDataGeneral::Format(
const Path& path, const FileSys::ArchiveFormatInfo& format_info, u64 /*client_program_id*/) {
Result ArchiveFactory_OtherSaveDataGeneral::Format(const Path& path,
const FileSys::ArchiveFormatInfo& format_info,
u64 /*client_program_id*/) {
MediaType media_type;
u64 program_id;
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathGeneral(path));

View File

@ -22,7 +22,7 @@ public:
}
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path, u64 program_id) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
Result Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) override;
ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const override;
@ -49,7 +49,7 @@ public:
}
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path, u64 program_id) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
Result Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) override;
ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const override;

View File

@ -21,7 +21,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveData::Open(const P
return sd_savedata_source->Open(program_id);
}
ResultCode ArchiveFactory_SaveData::Format(const Path& path,
Result ArchiveFactory_SaveData::Format(const Path& path,
const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) {
return sd_savedata_source->Format(program_id, format_info);

View File

@ -20,7 +20,7 @@ public:
}
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path, u64 program_id) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
Result Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) override;
ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const override;

View File

@ -112,7 +112,7 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& pa
return std::make_unique<DiskFile>(std::move(file), mode, std::move(delay_generator));
}
ResultCode SDMCArchive::DeleteFile(const Path& path) const {
Result SDMCArchive::DeleteFile(const Path& path) const {
const PathParser path_parser(path);
if (!path_parser.IsValid()) {
@ -146,7 +146,7 @@ ResultCode SDMCArchive::DeleteFile(const Path& path) const {
return ERROR_NOT_FOUND;
}
ResultCode SDMCArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
Result SDMCArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
const PathParser path_parser_src(src_path);
// TODO: Verify these return codes with HW
@ -171,13 +171,12 @@ ResultCode SDMCArchive::RenameFile(const Path& src_path, const Path& dest_path)
// TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't
// exist or similar. Verify.
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
return Result(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
ErrorSummary::NothingHappened, ErrorLevel::Status);
}
template <typename T>
static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mount_point,
T deleter) {
static Result DeleteDirectoryHelper(const Path& path, const std::string& mount_point, T deleter) {
const PathParser path_parser(path);
if (!path_parser.IsValid()) {
@ -214,16 +213,16 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
}
ResultCode SDMCArchive::DeleteDirectory(const Path& path) const {
Result SDMCArchive::DeleteDirectory(const Path& path) const {
return DeleteDirectoryHelper(path, mount_point, FileUtil::DeleteDir);
}
ResultCode SDMCArchive::DeleteDirectoryRecursively(const Path& path) const {
Result SDMCArchive::DeleteDirectoryRecursively(const Path& path) const {
return DeleteDirectoryHelper(
path, mount_point, [](const std::string& p) { return FileUtil::DeleteDirRecursively(p); });
}
ResultCode SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const {
Result SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const {
const PathParser path_parser(path);
if (!path_parser.IsValid()) {
@ -264,11 +263,11 @@ ResultCode SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const {
}
LOG_ERROR(Service_FS, "Too large file");
return ResultCode(ErrorDescription::TooLarge, ErrorModule::FS, ErrorSummary::OutOfResource,
return Result(ErrorDescription::TooLarge, ErrorModule::FS, ErrorSummary::OutOfResource,
ErrorLevel::Info);
}
ResultCode SDMCArchive::CreateDirectory(const Path& path) const {
Result SDMCArchive::CreateDirectory(const Path& path) const {
const PathParser path_parser(path);
if (!path_parser.IsValid()) {
@ -299,11 +298,11 @@ ResultCode SDMCArchive::CreateDirectory(const Path& path) const {
}
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", mount_point);
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
return Result(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
ErrorLevel::Status);
}
ResultCode SDMCArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
Result SDMCArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
const PathParser path_parser_src(src_path);
// TODO: Verify these return codes with HW
@ -328,7 +327,7 @@ ResultCode SDMCArchive::RenameDirectory(const Path& src_path, const Path& dest_p
// TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't
// exist or similar. Verify.
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
return Result(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
ErrorSummary::NothingHappened, ErrorLevel::Status);
}
@ -392,8 +391,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SDMC::Open(const Path&
return std::make_unique<SDMCArchive>(sdmc_directory, std::move(delay_generator));
}
ResultCode ArchiveFactory_SDMC::Format(const Path& path,
const FileSys::ArchiveFormatInfo& format_info,
Result ArchiveFactory_SDMC::Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) {
// This is kind of an undesirable operation, so let's just ignore it. :)
return RESULT_SUCCESS;

View File

@ -29,13 +29,13 @@ public:
ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path,
const Mode& mode) const override;
ResultCode DeleteFile(const Path& path) const override;
ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override;
ResultCode DeleteDirectory(const Path& path) const override;
ResultCode DeleteDirectoryRecursively(const Path& path) const override;
ResultCode CreateFile(const Path& path, u64 size) const override;
ResultCode CreateDirectory(const Path& path) const override;
ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override;
Result DeleteFile(const Path& path) const override;
Result RenameFile(const Path& src_path, const Path& dest_path) const override;
Result DeleteDirectory(const Path& path) const override;
Result DeleteDirectoryRecursively(const Path& path) const override;
Result CreateFile(const Path& path, u64 size) const override;
Result CreateDirectory(const Path& path) const override;
Result RenameDirectory(const Path& src_path, const Path& dest_path) const override;
ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override;
u64 GetFreeBytes() const override;
@ -68,7 +68,7 @@ public:
}
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path, u64 program_id) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
Result Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) override;
ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const override;

View File

@ -81,7 +81,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SDMCWriteOnly::Open(co
return std::make_unique<SDMCWriteOnlyArchive>(sdmc_directory, std::move(delay_generator));
}
ResultCode ArchiveFactory_SDMCWriteOnly::Format(const Path& path,
Result ArchiveFactory_SDMCWriteOnly::Format(const Path& path,
const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) {
// TODO(wwylele): hwtest this

View File

@ -54,7 +54,7 @@ public:
}
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path, u64 program_id) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
Result Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) override;
ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const override;

View File

@ -134,37 +134,37 @@ public:
}
}
ResultCode DeleteFile(const Path& path) const override {
Result DeleteFile(const Path& path) const override {
LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS;
}
ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override {
Result RenameFile(const Path& src_path, const Path& dest_path) const override {
LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS;
}
ResultCode DeleteDirectory(const Path& path) const override {
Result DeleteDirectory(const Path& path) const override {
LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS;
}
ResultCode DeleteDirectoryRecursively(const Path& path) const override {
Result DeleteDirectoryRecursively(const Path& path) const override {
LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS;
}
ResultCode CreateFile(const Path& path, u64 size) const override {
Result CreateFile(const Path& path, u64 size) const override {
LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS;
}
ResultCode CreateDirectory(const Path& path) const override {
Result CreateDirectory(const Path& path) const override {
LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS;
}
ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override {
Result RenameDirectory(const Path& src_path, const Path& dest_path) const override {
LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS;
}
@ -296,7 +296,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SelfNCCH::Open(const P
return std::make_unique<SelfNCCHArchive>(ncch_data[program_id]);
}
ResultCode ArchiveFactory_SelfNCCH::Format(const Path&, const FileSys::ArchiveFormatInfo&,
Result ArchiveFactory_SelfNCCH::Format(const Path&, const FileSys::ArchiveFormatInfo&,
u64 program_id) {
LOG_ERROR(Service_FS, "Attempted to format a SelfNCCH archive.");
return ERROR_INVALID_PATH;

View File

@ -50,7 +50,7 @@ public:
return "SelfNCCH";
}
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path, u64 program_id) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
Result Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) override;
ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const override;

View File

@ -53,7 +53,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveSource_SDSaveData::Open(u64 pr
return std::make_unique<SaveDataArchive>(std::move(concrete_mount_point));
}
ResultCode ArchiveSource_SDSaveData::Format(u64 program_id,
Result 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);

View File

@ -19,7 +19,7 @@ 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);
Result Format(u64 program_id, const FileSys::ArchiveFormatInfo& format_info);
ResultVal<ArchiveFormatInfo> GetFormatInfo(u64 program_id) const;
static std::string GetSaveDataPathFor(const std::string& mount_point, u64 program_id);

View File

@ -62,7 +62,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SystemSaveData::Open(c
return std::make_unique<SaveDataArchive>(fullpath);
}
ResultCode ArchiveFactory_SystemSaveData::Format(const Path& path,
Result ArchiveFactory_SystemSaveData::Format(const Path& path,
const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) {
std::string fullpath = GetSystemSaveDataPath(base_path, path);

View File

@ -20,7 +20,7 @@ public:
explicit ArchiveFactory_SystemSaveData(const std::string& mount_point);
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path, u64 program_id) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
Result Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) override;
ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const override;

View File

@ -35,63 +35,61 @@ enum {
};
}
constexpr ResultCode ERROR_INVALID_PATH(ErrCodes::InvalidPath, ErrorModule::FS,
constexpr Result ERROR_INVALID_PATH(ErrCodes::InvalidPath, ErrorModule::FS,
ErrorSummary::InvalidArgument, ErrorLevel::Usage);
constexpr ResultCode ERROR_UNSUPPORTED_OPEN_FLAGS(ErrCodes::UnsupportedOpenFlags, ErrorModule::FS,
constexpr Result ERROR_UNSUPPORTED_OPEN_FLAGS(ErrCodes::UnsupportedOpenFlags, ErrorModule::FS,
ErrorSummary::NotSupported, ErrorLevel::Usage);
constexpr ResultCode ERROR_INVALID_OPEN_FLAGS(ErrCodes::InvalidOpenFlags, ErrorModule::FS,
constexpr Result ERROR_INVALID_OPEN_FLAGS(ErrCodes::InvalidOpenFlags, ErrorModule::FS,
ErrorSummary::Canceled, ErrorLevel::Status);
constexpr ResultCode ERROR_INVALID_READ_FLAG(ErrCodes::InvalidReadFlag, ErrorModule::FS,
constexpr Result ERROR_INVALID_READ_FLAG(ErrCodes::InvalidReadFlag, ErrorModule::FS,
ErrorSummary::InvalidArgument, ErrorLevel::Usage);
constexpr ResultCode ERROR_FILE_NOT_FOUND(ErrCodes::FileNotFound, ErrorModule::FS,
constexpr Result ERROR_FILE_NOT_FOUND(ErrCodes::FileNotFound, ErrorModule::FS,
ErrorSummary::NotFound, ErrorLevel::Status);
constexpr ResultCode ERROR_PATH_NOT_FOUND(ErrCodes::PathNotFound, ErrorModule::FS,
constexpr Result ERROR_PATH_NOT_FOUND(ErrCodes::PathNotFound, ErrorModule::FS,
ErrorSummary::NotFound, ErrorLevel::Status);
constexpr ResultCode ERROR_NOT_FOUND(ErrCodes::NotFound, ErrorModule::FS, ErrorSummary::NotFound,
constexpr Result ERROR_NOT_FOUND(ErrCodes::NotFound, ErrorModule::FS, ErrorSummary::NotFound,
ErrorLevel::Status);
constexpr ResultCode ERROR_UNEXPECTED_FILE_OR_DIRECTORY(ErrCodes::UnexpectedFileOrDirectory,
constexpr Result ERROR_UNEXPECTED_FILE_OR_DIRECTORY(ErrCodes::UnexpectedFileOrDirectory,
ErrorModule::FS, ErrorSummary::NotSupported,
ErrorLevel::Usage);
constexpr ResultCode ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC(ErrCodes::NotAFile, ErrorModule::FS,
constexpr Result ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC(ErrCodes::NotAFile, ErrorModule::FS,
ErrorSummary::Canceled,
ErrorLevel::Status);
constexpr ResultCode ERROR_DIRECTORY_ALREADY_EXISTS(ErrCodes::DirectoryAlreadyExists,
ErrorModule::FS, ErrorSummary::NothingHappened,
ErrorLevel::Status);
constexpr ResultCode ERROR_FILE_ALREADY_EXISTS(ErrCodes::FileAlreadyExists, ErrorModule::FS,
constexpr Result ERROR_DIRECTORY_ALREADY_EXISTS(ErrCodes::DirectoryAlreadyExists, ErrorModule::FS,
ErrorSummary::NothingHappened, ErrorLevel::Status);
constexpr ResultCode ERROR_ALREADY_EXISTS(ErrCodes::AlreadyExists, ErrorModule::FS,
constexpr Result ERROR_FILE_ALREADY_EXISTS(ErrCodes::FileAlreadyExists, ErrorModule::FS,
ErrorSummary::NothingHappened, ErrorLevel::Status);
constexpr ResultCode ERROR_DIRECTORY_NOT_EMPTY(ErrCodes::DirectoryNotEmpty, ErrorModule::FS,
constexpr Result ERROR_ALREADY_EXISTS(ErrCodes::AlreadyExists, ErrorModule::FS,
ErrorSummary::NothingHappened, ErrorLevel::Status);
constexpr Result ERROR_DIRECTORY_NOT_EMPTY(ErrCodes::DirectoryNotEmpty, ErrorModule::FS,
ErrorSummary::Canceled, ErrorLevel::Status);
constexpr ResultCode ERROR_GAMECARD_NOT_INSERTED(ErrCodes::GameCardNotInserted, ErrorModule::FS,
constexpr Result ERROR_GAMECARD_NOT_INSERTED(ErrCodes::GameCardNotInserted, ErrorModule::FS,
ErrorSummary::NotFound, ErrorLevel::Status);
constexpr ResultCode ERROR_INCORRECT_EXEFS_READ_SIZE(ErrCodes::IncorrectExeFSReadSize,
ErrorModule::FS, ErrorSummary::NotSupported,
ErrorLevel::Usage);
constexpr ResultCode ERROR_ROMFS_NOT_FOUND(ErrCodes::RomFSNotFound, ErrorModule::FS,
constexpr Result ERROR_INCORRECT_EXEFS_READ_SIZE(ErrCodes::IncorrectExeFSReadSize, ErrorModule::FS,
ErrorSummary::NotSupported, ErrorLevel::Usage);
constexpr Result ERROR_ROMFS_NOT_FOUND(ErrCodes::RomFSNotFound, ErrorModule::FS,
ErrorSummary::NotFound, ErrorLevel::Status);
constexpr ResultCode ERROR_COMMAND_NOT_ALLOWED(ErrCodes::CommandNotAllowed, ErrorModule::FS,
constexpr Result ERROR_COMMAND_NOT_ALLOWED(ErrCodes::CommandNotAllowed, ErrorModule::FS,
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
constexpr ResultCode ERROR_EXEFS_SECTION_NOT_FOUND(ErrCodes::ExeFSSectionNotFound, ErrorModule::FS,
constexpr Result ERROR_EXEFS_SECTION_NOT_FOUND(ErrCodes::ExeFSSectionNotFound, ErrorModule::FS,
ErrorSummary::NotFound, ErrorLevel::Status);
constexpr ResultCode ERROR_INSUFFICIENT_SPACE(ErrCodes::InsufficientSpace, ErrorModule::FS,
constexpr Result ERROR_INSUFFICIENT_SPACE(ErrCodes::InsufficientSpace, ErrorModule::FS,
ErrorSummary::OutOfResource, ErrorLevel::Status);
/// Returned when a function is passed an invalid archive handle.
constexpr ResultCode ERR_INVALID_ARCHIVE_HANDLE(ErrCodes::ArchiveNotMounted, ErrorModule::FS,
constexpr Result ERR_INVALID_ARCHIVE_HANDLE(ErrCodes::ArchiveNotMounted, ErrorModule::FS,
ErrorSummary::NotFound,
ErrorLevel::Status); // 0xC8804465
constexpr ResultCode ERR_WRITE_BEYOND_END(ErrCodes::WriteBeyondEnd, ErrorModule::FS,
constexpr Result ERR_WRITE_BEYOND_END(ErrCodes::WriteBeyondEnd, ErrorModule::FS,
ErrorSummary::InvalidArgument, ErrorLevel::Usage);
/**
* Variant of ERROR_NOT_FOUND returned in some places in the code. Unknown if these usages are
* correct or a bug.
*/
constexpr ResultCode ERR_NOT_FOUND_INVALID_STATE(ErrCodes::NotFound, ErrorModule::FS,
constexpr Result ERR_NOT_FOUND_INVALID_STATE(ErrCodes::NotFound, ErrorModule::FS,
ErrorSummary::InvalidState, ErrorLevel::Status);
constexpr ResultCode ERR_NOT_FORMATTED(ErrCodes::NotFormatted, ErrorModule::FS,
constexpr Result ERR_NOT_FORMATTED(ErrCodes::NotFormatted, ErrorModule::FS,
ErrorSummary::InvalidState, ErrorLevel::Status);
} // namespace FileSys

View File

@ -34,47 +34,47 @@ ResultVal<std::unique_ptr<FileBackend>> IVFCArchive::OpenFile(const Path& path,
return std::make_unique<IVFCFile>(romfs_file, std::move(delay_generator));
}
ResultCode IVFCArchive::DeleteFile(const Path& path) const {
Result IVFCArchive::DeleteFile(const Path& path) const {
LOG_CRITICAL(Service_FS, "Attempted to delete a file from an IVFC archive ({}).", GetName());
// TODO(Subv): Verify error code
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
return Result(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
ErrorLevel::Status);
}
ResultCode IVFCArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
Result IVFCArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive ({}).", GetName());
// TODO(wwylele): Use correct error code
return RESULT_UNKNOWN;
}
ResultCode IVFCArchive::DeleteDirectory(const Path& path) const {
Result IVFCArchive::DeleteDirectory(const Path& path) const {
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive ({}).",
GetName());
// TODO(wwylele): Use correct error code
return RESULT_UNKNOWN;
}
ResultCode IVFCArchive::DeleteDirectoryRecursively(const Path& path) const {
Result IVFCArchive::DeleteDirectoryRecursively(const Path& path) const {
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive ({}).",
GetName());
// TODO(wwylele): Use correct error code
return RESULT_UNKNOWN;
}
ResultCode IVFCArchive::CreateFile(const Path& path, u64 size) const {
Result IVFCArchive::CreateFile(const Path& path, u64 size) const {
LOG_CRITICAL(Service_FS, "Attempted to create a file in an IVFC archive ({}).", GetName());
// TODO: Verify error code
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
return Result(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
ErrorLevel::Permanent);
}
ResultCode IVFCArchive::CreateDirectory(const Path& path) const {
Result IVFCArchive::CreateDirectory(const Path& path) const {
LOG_CRITICAL(Service_FS, "Attempted to create a directory in an IVFC archive ({}).", GetName());
// TODO(wwylele): Use correct error code
return RESULT_UNKNOWN;
}
ResultCode IVFCArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
Result IVFCArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive ({}).", GetName());
// TODO(wwylele): Use correct error code
return RESULT_UNKNOWN;

View File

@ -103,13 +103,13 @@ public:
ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path,
const Mode& mode) const override;
ResultCode DeleteFile(const Path& path) const override;
ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override;
ResultCode DeleteDirectory(const Path& path) const override;
ResultCode DeleteDirectoryRecursively(const Path& path) const override;
ResultCode CreateFile(const Path& path, u64 size) const override;
ResultCode CreateDirectory(const Path& path) const override;
ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override;
Result DeleteFile(const Path& path) const override;
Result RenameFile(const Path& src_path, const Path& dest_path) const override;
Result DeleteDirectory(const Path& path) const override;
Result DeleteDirectoryRecursively(const Path& path) const override;
Result CreateFile(const Path& path, u64 size) const override;
Result CreateDirectory(const Path& path) const override;
Result RenameDirectory(const Path& src_path, const Path& dest_path) const override;
ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override;
u64 GetFreeBytes() const override;

View File

@ -93,7 +93,7 @@ ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& pa
return std::make_unique<DiskFile>(std::move(file), mode, std::move(delay_generator));
}
ResultCode SaveDataArchive::DeleteFile(const Path& path) const {
Result SaveDataArchive::DeleteFile(const Path& path) const {
const PathParser path_parser(path);
if (!path_parser.IsValid()) {
@ -127,7 +127,7 @@ ResultCode SaveDataArchive::DeleteFile(const Path& path) const {
return ERROR_FILE_NOT_FOUND;
}
ResultCode SaveDataArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
Result SaveDataArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
const PathParser path_parser_src(src_path);
// TODO: Verify these return codes with HW
@ -152,13 +152,12 @@ ResultCode SaveDataArchive::RenameFile(const Path& src_path, const Path& dest_pa
// TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't
// exist or similar. Verify.
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
return Result(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
ErrorSummary::NothingHappened, ErrorLevel::Status);
}
template <typename T>
static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mount_point,
T deleter) {
static Result DeleteDirectoryHelper(const Path& path, const std::string& mount_point, T deleter) {
const PathParser path_parser(path);
if (!path_parser.IsValid()) {
@ -195,16 +194,16 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
return ERROR_DIRECTORY_NOT_EMPTY;
}
ResultCode SaveDataArchive::DeleteDirectory(const Path& path) const {
Result SaveDataArchive::DeleteDirectory(const Path& path) const {
return DeleteDirectoryHelper(path, mount_point, FileUtil::DeleteDir);
}
ResultCode SaveDataArchive::DeleteDirectoryRecursively(const Path& path) const {
Result SaveDataArchive::DeleteDirectoryRecursively(const Path& path) const {
return DeleteDirectoryHelper(
path, mount_point, [](const std::string& p) { return FileUtil::DeleteDirRecursively(p); });
}
ResultCode SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) const {
Result SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) const {
const PathParser path_parser(path);
if (!path_parser.IsValid()) {
@ -245,11 +244,11 @@ ResultCode SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) cons
}
LOG_ERROR(Service_FS, "Too large file");
return ResultCode(ErrorDescription::TooLarge, ErrorModule::FS, ErrorSummary::OutOfResource,
return Result(ErrorDescription::TooLarge, ErrorModule::FS, ErrorSummary::OutOfResource,
ErrorLevel::Info);
}
ResultCode SaveDataArchive::CreateDirectory(const Path& path) const {
Result SaveDataArchive::CreateDirectory(const Path& path) const {
const PathParser path_parser(path);
if (!path_parser.IsValid()) {
@ -282,11 +281,11 @@ ResultCode SaveDataArchive::CreateDirectory(const Path& path) const {
}
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", mount_point);
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
return Result(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
ErrorLevel::Status);
}
ResultCode SaveDataArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
Result SaveDataArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
const PathParser path_parser_src(src_path);
// TODO: Verify these return codes with HW
@ -311,7 +310,7 @@ ResultCode SaveDataArchive::RenameDirectory(const Path& src_path, const Path& de
// TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't
// exist or similar. Verify.
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
return Result(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
ErrorSummary::NothingHappened, ErrorLevel::Status);
}

View File

@ -23,13 +23,13 @@ public:
ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path,
const Mode& mode) const override;
ResultCode DeleteFile(const Path& path) const override;
ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override;
ResultCode DeleteDirectory(const Path& path) const override;
ResultCode DeleteDirectoryRecursively(const Path& path) const override;
ResultCode CreateFile(const Path& path, u64 size) const override;
ResultCode CreateDirectory(const Path& path) const override;
ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override;
Result DeleteFile(const Path& path) const override;
Result RenameFile(const Path& src_path, const Path& dest_path) const override;
Result DeleteDirectory(const Path& path) const override;
Result DeleteDirectoryRecursively(const Path& path) const override;
Result CreateFile(const Path& path, u64 size) const override;
Result CreateDirectory(const Path& path) const override;
Result RenameDirectory(const Path& src_path, const Path& dest_path) const override;
ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override;
u64 GetFreeBytes() const override;

View File

@ -26,7 +26,7 @@ static Core::TimingEventType* applet_update_event = nullptr;
/// The interval at which the Applet update callback will be called, 16.6ms
static const u64 applet_update_interval_us = 16666;
ResultCode Applet::Create(Service::APT::AppletId id, Service::APT::AppletId parent, bool preload,
Result Applet::Create(Service::APT::AppletId id, Service::APT::AppletId parent, bool preload,
const std::shared_ptr<Service::APT::AppletManager>& manager) {
switch (id) {
case Service::APT::AppletId::SoftwareKeyboard1:
@ -48,8 +48,8 @@ ResultCode Applet::Create(Service::APT::AppletId id, Service::APT::AppletId pare
default:
LOG_ERROR(Service_APT, "Could not create applet {}", id);
// TODO(Subv): Find the right error code
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet,
ErrorSummary::NotSupported, ErrorLevel::Permanent);
return Result(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotSupported,
ErrorLevel::Permanent);
}
Service::APT::AppletAttributes attributes;
@ -104,10 +104,10 @@ bool Applet::IsActive() const {
return is_active;
}
ResultCode Applet::ReceiveParameter(const Service::APT::MessageParameter& parameter) {
Result Applet::ReceiveParameter(const Service::APT::MessageParameter& parameter) {
switch (parameter.signal) {
case Service::APT::SignalType::Wakeup: {
ResultCode result = Start(parameter);
Result result = Start(parameter);
if (!result.IsError()) {
is_active = true;
}

View File

@ -20,9 +20,9 @@ public:
* @param id Id of the applet to create.
* @param parent Id of the applet's parent.
* @param preload Whether the applet is being preloaded.
* @returns ResultCode Whether the operation was successful or not.
* @returns Result Whether the operation was successful or not.
*/
static ResultCode Create(Service::APT::AppletId id, Service::APT::AppletId parent, bool preload,
static Result Create(Service::APT::AppletId id, Service::APT::AppletId parent, bool preload,
const std::shared_ptr<Service::APT::AppletManager>& manager);
/**
@ -35,9 +35,9 @@ public:
/**
* Handles a parameter from the application.
* @param parameter Parameter data to handle.
* @returns ResultCode Whether the operation was successful or not.
* @returns Result Whether the operation was successful or not.
*/
ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter);
Result ReceiveParameter(const Service::APT::MessageParameter& parameter);
/**
* Whether the applet is currently running.
@ -62,22 +62,22 @@ protected:
/**
* Handles a parameter from the application.
* @param parameter Parameter data to handle.
* @returns ResultCode Whether the operation was successful or not.
* @returns Result Whether the operation was successful or not.
*/
virtual ResultCode ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) = 0;
virtual Result ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) = 0;
/**
* Handles the Applet start event, triggered from the application.
* @param parameter Parameter data to handle.
* @returns ResultCode Whether the operation was successful or not.
* @returns Result Whether the operation was successful or not.
*/
virtual ResultCode Start(const Service::APT::MessageParameter& parameter) = 0;
virtual Result Start(const Service::APT::MessageParameter& parameter) = 0;
/**
* Sends the LibAppletClosing signal to the application,
* along with the relevant data buffers.
*/
virtual ResultCode Finalize() = 0;
virtual Result Finalize() = 0;
Service::APT::AppletId id; ///< Id of this Applet
Service::APT::AppletId parent; ///< Id of this Applet's parent

View File

@ -9,12 +9,12 @@
namespace HLE::Applets {
ResultCode ErrEula::ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) {
Result ErrEula::ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) {
if (parameter.signal != Service::APT::SignalType::Request) {
LOG_ERROR(Service_APT, "unsupported signal {}", parameter.signal);
UNIMPLEMENTED();
// TODO(Subv): Find the right error code
return ResultCode(-1);
return Result(-1);
}
// The LibAppJustStarted message contains a buffer with the size of the framebuffer shared
@ -43,7 +43,7 @@ ResultCode ErrEula::ReceiveParameterImpl(const Service::APT::MessageParameter& p
return RESULT_SUCCESS;
}
ResultCode ErrEula::Start(const Service::APT::MessageParameter& parameter) {
Result ErrEula::Start(const Service::APT::MessageParameter& parameter) {
startup_param = parameter.buffer;
// TODO(Subv): Set the expected fields in the response buffer before resending it to the
@ -55,7 +55,7 @@ ResultCode ErrEula::Start(const Service::APT::MessageParameter& parameter) {
return RESULT_SUCCESS;
}
ResultCode ErrEula::Finalize() {
Result ErrEula::Finalize() {
std::vector<u8> buffer(startup_param.size());
std::fill(buffer.begin(), buffer.end(), 0);
CloseApplet(nullptr, buffer);

View File

@ -15,9 +15,9 @@ public:
std::weak_ptr<Service::APT::AppletManager> manager)
: Applet(id, parent, preload, std::move(manager)) {}
ResultCode ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) override;
ResultCode Start(const Service::APT::MessageParameter& parameter) override;
ResultCode Finalize() override;
Result ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) override;
Result Start(const Service::APT::MessageParameter& parameter) override;
Result Finalize() override;
void Update() override;
private:

View File

@ -17,12 +17,12 @@
namespace HLE::Applets {
ResultCode MiiSelector::ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) {
Result MiiSelector::ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) {
if (parameter.signal != Service::APT::SignalType::Request) {
LOG_ERROR(Service_APT, "unsupported signal {}", parameter.signal);
UNIMPLEMENTED();
// TODO(Subv): Find the right error code
return ResultCode(-1);
return Result(-1);
}
// The LibAppJustStarted message contains a buffer with the size of the framebuffer shared
@ -50,7 +50,7 @@ ResultCode MiiSelector::ReceiveParameterImpl(const Service::APT::MessageParamete
return RESULT_SUCCESS;
}
ResultCode MiiSelector::Start(const Service::APT::MessageParameter& parameter) {
Result MiiSelector::Start(const Service::APT::MessageParameter& parameter) {
ASSERT_MSG(parameter.buffer.size() == sizeof(config),
"The size of the parameter (MiiConfig) is wrong");
@ -78,7 +78,7 @@ void MiiSelector::Update() {
Finalize();
}
ResultCode MiiSelector::Finalize() {
Result MiiSelector::Finalize() {
std::vector<u8> buffer(sizeof(MiiResult));
std::memcpy(buffer.data(), &result, buffer.size());
CloseApplet(nullptr, buffer);

View File

@ -66,9 +66,9 @@ public:
std::weak_ptr<Service::APT::AppletManager> manager)
: Applet(id, parent, preload, std::move(manager)) {}
ResultCode ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) override;
ResultCode Start(const Service::APT::MessageParameter& parameter) override;
ResultCode Finalize() override;
Result ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) override;
Result Start(const Service::APT::MessageParameter& parameter) override;
Result Finalize() override;
void Update() override;
static MiiResult GetStandardMiiResult();

View File

@ -9,12 +9,12 @@
namespace HLE::Applets {
ResultCode Mint::ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) {
Result Mint::ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) {
if (parameter.signal != Service::APT::SignalType::Request) {
LOG_ERROR(Service_APT, "unsupported signal {}", parameter.signal);
UNIMPLEMENTED();
// TODO(Subv): Find the right error code
return ResultCode(-1);
return Result(-1);
}
// The Request message contains a buffer with the size of the framebuffer shared
@ -43,7 +43,7 @@ ResultCode Mint::ReceiveParameterImpl(const Service::APT::MessageParameter& para
return RESULT_SUCCESS;
}
ResultCode Mint::Start(const Service::APT::MessageParameter& parameter) {
Result Mint::Start(const Service::APT::MessageParameter& parameter) {
startup_param = parameter.buffer;
// TODO(Subv): Set the expected fields in the response buffer before resending it to the
@ -55,7 +55,7 @@ ResultCode Mint::Start(const Service::APT::MessageParameter& parameter) {
return RESULT_SUCCESS;
}
ResultCode Mint::Finalize() {
Result Mint::Finalize() {
std::vector<u8> buffer(startup_param.size());
std::fill(buffer.begin(), buffer.end(), 0);
CloseApplet(nullptr, buffer);

View File

@ -15,9 +15,9 @@ public:
std::weak_ptr<Service::APT::AppletManager> manager)
: Applet(id, parent, preload, std::move(manager)) {}
ResultCode ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) override;
ResultCode Start(const Service::APT::MessageParameter& parameter) override;
ResultCode Finalize() override;
Result ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) override;
Result Start(const Service::APT::MessageParameter& parameter) override;
Result Finalize() override;
void Update() override;
private:

View File

@ -19,7 +19,7 @@
namespace HLE::Applets {
ResultCode SoftwareKeyboard::ReceiveParameterImpl(Service::APT::MessageParameter const& parameter) {
Result SoftwareKeyboard::ReceiveParameterImpl(Service::APT::MessageParameter const& parameter) {
switch (parameter.signal) {
case Service::APT::SignalType::Request: {
// The LibAppJustStarted message contains a buffer with the size of the framebuffer shared
@ -84,12 +84,12 @@ ResultCode SoftwareKeyboard::ReceiveParameterImpl(Service::APT::MessageParameter
LOG_ERROR(Service_APT, "unsupported signal {}", parameter.signal);
UNIMPLEMENTED();
// TODO(Subv): Find the right error code
return ResultCode(-1);
return Result(-1);
}
}
}
ResultCode SoftwareKeyboard::Start(Service::APT::MessageParameter const& parameter) {
Result SoftwareKeyboard::Start(Service::APT::MessageParameter const& parameter) {
ASSERT_MSG(parameter.buffer.size() == sizeof(config),
"The size of the parameter (SoftwareKeyboardConfig) is wrong");
@ -166,7 +166,7 @@ void SoftwareKeyboard::DrawScreenKeyboard() {
// TODO(Subv): Draw the HLE keyboard, for now just do nothing
}
ResultCode SoftwareKeyboard::Finalize() {
Result SoftwareKeyboard::Finalize() {
std::vector<u8> buffer(sizeof(SoftwareKeyboardConfig));
std::memcpy(buffer.data(), &config, buffer.size());
CloseApplet(nullptr, buffer);

View File

@ -179,9 +179,9 @@ public:
std::weak_ptr<Service::APT::AppletManager> manager)
: Applet(id, parent, preload, std::move(manager)) {}
ResultCode ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) override;
ResultCode Start(const Service::APT::MessageParameter& parameter) override;
ResultCode Finalize() override;
Result ReceiveParameterImpl(const Service::APT::MessageParameter& parameter) override;
Result Start(const Service::APT::MessageParameter& parameter) override;
Result Finalize() override;
void Update() override;
/**

View File

@ -161,7 +161,7 @@ inline void RequestBuilder::Push(bool value) {
}
template <>
inline void RequestBuilder::Push(ResultCode value) {
inline void RequestBuilder::Push(Result value) {
Push(value.raw);
}
@ -371,8 +371,8 @@ inline bool RequestParser::Pop() {
}
template <>
inline ResultCode RequestParser::Pop() {
return ResultCode{Pop<u32>()};
inline Result RequestParser::Pop() {
return Result{Pop<u32>()};
}
template <typename T>

View File

@ -108,7 +108,7 @@ void AddressArbiter::WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> t
waiting_threads.end());
};
ResultCode AddressArbiter::ArbitrateAddress(std::shared_ptr<Thread> thread, ArbitrationType type,
Result AddressArbiter::ArbitrateAddress(std::shared_ptr<Thread> thread, ArbitrationType type,
VAddr address, s32 value, u64 nanoseconds) {
switch (type) {

View File

@ -55,7 +55,7 @@ public:
std::shared_ptr<ResourceLimit> resource_limit;
std::string name; ///< Name of address arbiter object (optional)
ResultCode ArbitrateAddress(std::shared_ptr<Thread> thread, ArbitrationType type, VAddr address,
Result ArbitrateAddress(std::shared_ptr<Thread> thread, ArbitrationType type, VAddr address,
s32 value, u64 nanoseconds);
class Callback;

View File

@ -20,7 +20,7 @@ namespace Kernel {
ClientPort::ClientPort(KernelSystem& kernel) : Object(kernel), kernel(kernel) {}
ClientPort::~ClientPort() = default;
ResultCode ClientPort::Connect(std::shared_ptr<ClientSession>& client_session) {
Result ClientPort::Connect(std::shared_ptr<ClientSession>& client_session) {
// Note: Threads do not wait for the server endpoint to call
// AcceptSession before returning from this call.

View File

@ -46,7 +46,7 @@ public:
* waiting on it to awake.
* @returns ClientSession The client endpoint of the created Session pair, or error code.
*/
ResultCode Connect(std::shared_ptr<ClientSession>& client_session);
Result Connect(std::shared_ptr<ClientSession>& client_session);
/**
* Signifies that a previously active connection has been closed,

View File

@ -44,7 +44,7 @@ ClientSession::~ClientSession() {
}
}
ResultCode ClientSession::SendSyncRequest(std::shared_ptr<Thread> thread) {
Result ClientSession::SendSyncRequest(std::shared_ptr<Thread> thread) {
// Keep ServerSession alive until we're done working with it.
std::shared_ptr<ServerSession> server = SharedFrom(parent->server);
R_UNLESS(server, ERR_SESSION_CLOSED_BY_REMOTE);

View File

@ -42,9 +42,9 @@ public:
/**
* Sends an SyncRequest from the current emulated thread.
* @param thread Thread that initiated the request.
* @return ResultCode of the operation.
* @return Result of the operation.
*/
ResultCode SendSyncRequest(std::shared_ptr<Thread> thread);
Result SendSyncRequest(std::shared_ptr<Thread> thread);
std::string name; ///< Name of client port (optional)

View File

@ -31,84 +31,82 @@ enum {
// WARNING: The kernel is quite inconsistent in it's usage of errors code. Make sure to always
// double check that the code matches before re-using the constant.
constexpr ResultCode ERR_OUT_OF_HANDLES(ErrCodes::OutOfHandles, ErrorModule::Kernel,
constexpr Result ERR_OUT_OF_HANDLES(ErrCodes::OutOfHandles, ErrorModule::Kernel,
ErrorSummary::OutOfResource,
ErrorLevel::Permanent); // 0xD8600413
constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(ErrCodes::SessionClosedByRemote, ErrorModule::OS,
constexpr Result ERR_SESSION_CLOSED_BY_REMOTE(ErrCodes::SessionClosedByRemote, ErrorModule::OS,
ErrorSummary::Canceled,
ErrorLevel::Status); // 0xC920181A
constexpr ResultCode ERR_PORT_NAME_TOO_LONG(ErrCodes::PortNameTooLong, ErrorModule::OS,
constexpr Result ERR_PORT_NAME_TOO_LONG(ErrCodes::PortNameTooLong, ErrorModule::OS,
ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E0181E
constexpr ResultCode ERR_WRONG_PERMISSION(ErrCodes::WrongPermission, ErrorModule::OS,
constexpr Result ERR_WRONG_PERMISSION(ErrCodes::WrongPermission, ErrorModule::OS,
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
constexpr ResultCode ERR_INVALID_BUFFER_DESCRIPTOR(ErrCodes::InvalidBufferDescriptor,
ErrorModule::OS, ErrorSummary::WrongArgument,
ErrorLevel::Permanent);
constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(ErrCodes::MaxConnectionsReached, ErrorModule::OS,
constexpr Result ERR_INVALID_BUFFER_DESCRIPTOR(ErrCodes::InvalidBufferDescriptor, ErrorModule::OS,
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
constexpr Result ERR_MAX_CONNECTIONS_REACHED(ErrCodes::MaxConnectionsReached, ErrorModule::OS,
ErrorSummary::WouldBlock,
ErrorLevel::Temporary); // 0xD0401834
constexpr ResultCode ERR_NOT_AUTHORIZED(ErrorDescription::NotAuthorized, ErrorModule::OS,
constexpr Result ERR_NOT_AUTHORIZED(ErrorDescription::NotAuthorized, ErrorModule::OS,
ErrorSummary::WrongArgument,
ErrorLevel::Permanent); // 0xD9001BEA
constexpr ResultCode ERR_INVALID_ENUM_VALUE(ErrorDescription::InvalidEnumValue, ErrorModule::Kernel,
constexpr Result ERR_INVALID_ENUM_VALUE(ErrorDescription::InvalidEnumValue, ErrorModule::Kernel,
ErrorSummary::InvalidArgument,
ErrorLevel::Permanent); // 0xD8E007ED
constexpr ResultCode ERR_INVALID_ENUM_VALUE_FND(ErrorDescription::InvalidEnumValue,
ErrorModule::FND, ErrorSummary::InvalidArgument,
constexpr Result ERR_INVALID_ENUM_VALUE_FND(ErrorDescription::InvalidEnumValue, ErrorModule::FND,
ErrorSummary::InvalidArgument,
ErrorLevel::Permanent); // 0xD8E093ED
constexpr ResultCode ERR_INVALID_COMBINATION(ErrorDescription::InvalidCombination, ErrorModule::OS,
constexpr Result ERR_INVALID_COMBINATION(ErrorDescription::InvalidCombination, ErrorModule::OS,
ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E01BEE
constexpr ResultCode ERR_INVALID_COMBINATION_KERNEL(ErrorDescription::InvalidCombination,
ErrorModule::Kernel,
ErrorSummary::WrongArgument,
constexpr Result ERR_INVALID_COMBINATION_KERNEL(ErrorDescription::InvalidCombination,
ErrorModule::Kernel, ErrorSummary::WrongArgument,
ErrorLevel::Permanent); // 0xD90007EE
constexpr ResultCode ERR_MISALIGNED_ADDRESS(ErrorDescription::MisalignedAddress, ErrorModule::OS,
constexpr Result ERR_MISALIGNED_ADDRESS(ErrorDescription::MisalignedAddress, ErrorModule::OS,
ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E01BF1
constexpr ResultCode ERR_MISALIGNED_SIZE(ErrorDescription::MisalignedSize, ErrorModule::OS,
constexpr Result ERR_MISALIGNED_SIZE(ErrorDescription::MisalignedSize, ErrorModule::OS,
ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E01BF2
constexpr ResultCode ERR_OUT_OF_MEMORY(ErrorDescription::OutOfMemory, ErrorModule::Kernel,
constexpr Result ERR_OUT_OF_MEMORY(ErrorDescription::OutOfMemory, ErrorModule::Kernel,
ErrorSummary::OutOfResource,
ErrorLevel::Permanent); // 0xD86007F3
/// Returned when out of heap or linear heap memory when allocating
constexpr ResultCode ERR_OUT_OF_HEAP_MEMORY(ErrorDescription::OutOfMemory, ErrorModule::OS,
constexpr Result ERR_OUT_OF_HEAP_MEMORY(ErrorDescription::OutOfMemory, ErrorModule::OS,
ErrorSummary::OutOfResource,
ErrorLevel::Status); // 0xC860180A
constexpr ResultCode ERR_NOT_IMPLEMENTED(ErrorDescription::NotImplemented, ErrorModule::OS,
constexpr Result ERR_NOT_IMPLEMENTED(ErrorDescription::NotImplemented, ErrorModule::OS,
ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E01BF4
constexpr ResultCode ERR_INVALID_ADDRESS(ErrorDescription::InvalidAddress, ErrorModule::OS,
constexpr Result ERR_INVALID_ADDRESS(ErrorDescription::InvalidAddress, ErrorModule::OS,
ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E01BF5
constexpr ResultCode ERR_INVALID_ADDRESS_STATE(ErrorDescription::InvalidAddress, ErrorModule::OS,
constexpr Result ERR_INVALID_ADDRESS_STATE(ErrorDescription::InvalidAddress, ErrorModule::OS,
ErrorSummary::InvalidState,
ErrorLevel::Usage); // 0xE0A01BF5
constexpr ResultCode ERR_INVALID_POINTER(ErrorDescription::InvalidPointer, ErrorModule::Kernel,
constexpr Result ERR_INVALID_POINTER(ErrorDescription::InvalidPointer, ErrorModule::Kernel,
ErrorSummary::InvalidArgument,
ErrorLevel::Permanent); // 0xD8E007F6
constexpr ResultCode ERR_INVALID_HANDLE(ErrorDescription::InvalidHandle, ErrorModule::Kernel,
constexpr Result ERR_INVALID_HANDLE(ErrorDescription::InvalidHandle, ErrorModule::Kernel,
ErrorSummary::InvalidArgument,
ErrorLevel::Permanent); // 0xD8E007F7
/// Alternate code returned instead of ERR_INVALID_HANDLE in some code paths.
constexpr ResultCode ERR_INVALID_HANDLE_OS(ErrorDescription::InvalidHandle, ErrorModule::OS,
constexpr Result ERR_INVALID_HANDLE_OS(ErrorDescription::InvalidHandle, ErrorModule::OS,
ErrorSummary::WrongArgument,
ErrorLevel::Permanent); // 0xD9001BF7
constexpr ResultCode ERR_NOT_FOUND(ErrorDescription::NotFound, ErrorModule::Kernel,
constexpr Result ERR_NOT_FOUND(ErrorDescription::NotFound, ErrorModule::Kernel,
ErrorSummary::NotFound, ErrorLevel::Permanent); // 0xD88007FA
constexpr ResultCode ERR_OUT_OF_RANGE(ErrorDescription::OutOfRange, ErrorModule::OS,
constexpr Result ERR_OUT_OF_RANGE(ErrorDescription::OutOfRange, ErrorModule::OS,
ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E01BFD
constexpr ResultCode ERR_OUT_OF_RANGE_KERNEL(ErrorDescription::OutOfRange, ErrorModule::Kernel,
constexpr Result ERR_OUT_OF_RANGE_KERNEL(ErrorDescription::OutOfRange, ErrorModule::Kernel,
ErrorSummary::InvalidArgument,
ErrorLevel::Permanent); // 0xD8E007FD
constexpr ResultCode RESULT_TIMEOUT(ErrorDescription::Timeout, ErrorModule::OS,
constexpr Result RESULT_TIMEOUT(ErrorDescription::Timeout, ErrorModule::OS,
ErrorSummary::StatusChanged, ErrorLevel::Info);
/// Returned when Accept() is called on a port with no sessions to be accepted.
constexpr ResultCode ERR_NO_PENDING_SESSIONS(ErrCodes::NoPendingSessions, ErrorModule::OS,
constexpr Result ERR_NO_PENDING_SESSIONS(ErrCodes::NoPendingSessions, ErrorModule::OS,
ErrorSummary::WouldBlock,
ErrorLevel::Permanent); // 0xD8401823

View File

@ -28,7 +28,7 @@ HandleTable::HandleTable(KernelSystem& kernel) : kernel(kernel) {
HandleTable::~HandleTable() = default;
ResultCode HandleTable::Create(Handle* out_handle, std::shared_ptr<Object> obj) {
Result HandleTable::Create(Handle* out_handle, std::shared_ptr<Object> obj) {
DEBUG_ASSERT(obj != nullptr);
u16 slot = next_free_slot;
@ -50,13 +50,13 @@ ResultCode HandleTable::Create(Handle* out_handle, std::shared_ptr<Object> obj)
return RESULT_SUCCESS;
}
ResultCode HandleTable::Duplicate(Handle* out, Handle handle) {
Result HandleTable::Duplicate(Handle* out, Handle handle) {
std::shared_ptr<Object> object = GetGeneric(handle);
R_UNLESS(object, ERR_INVALID_HANDLE);
return Create(out, std::move(object));
}
ResultCode HandleTable::Close(Handle handle) {
Result HandleTable::Close(Handle handle) {
R_UNLESS(IsValid(handle), ERR_INVALID_HANDLE);
const u16 slot = GetSlot(handle);

View File

@ -53,7 +53,7 @@ public:
* @return The created Handle or one of the following errors:
* - `ERR_OUT_OF_HANDLES`: the maximum number of handles has been exceeded.
*/
ResultCode Create(Handle* out_handle, std::shared_ptr<Object> obj);
Result Create(Handle* out_handle, std::shared_ptr<Object> obj);
/**
* Returns a new handle that points to the same object as the passed in handle.
@ -61,14 +61,14 @@ public:
* - `ERR_INVALID_HANDLE`: an invalid handle was passed in.
* - Any errors returned by `Create()`.
*/
ResultCode Duplicate(Handle* out, Handle handle);
Result Duplicate(Handle* out, Handle handle);
/**
* Closes a handle, removing it from the table and decreasing the object's ref-count.
* @return `RESULT_SUCCESS` or one of the following errors:
* - `ERR_INVALID_HANDLE`: an invalid handle was passed in.
*/
ResultCode Close(Handle handle);
Result Close(Handle handle);
/// Checks if a handle is valid and points to an existing object.
bool IsValid(Handle handle) const;

View File

@ -126,8 +126,8 @@ void HLERequestContext::AddStaticBuffer(u8 buffer_id, std::vector<u8> data) {
static_buffers[buffer_id] = std::move(data);
}
ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(
const u32_le* src_cmdbuf, std::shared_ptr<Process> src_process_) {
Result HLERequestContext::PopulateFromIncomingCommandBuffer(const u32_le* src_cmdbuf,
std::shared_ptr<Process> src_process_) {
auto& src_process = *src_process_;
IPC::Header header{src_cmdbuf[0]};
@ -206,7 +206,7 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(
return RESULT_SUCCESS;
}
ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf,
Result HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf,
Process& dst_process) const {
IPC::Header header{cmd_buf[0]};

View File

@ -363,10 +363,10 @@ public:
MappedBuffer& GetMappedBuffer(u32 id_from_cmdbuf);
/// Populates this context with data from the requesting process/thread.
ResultCode PopulateFromIncomingCommandBuffer(const u32_le* src_cmdbuf,
Result PopulateFromIncomingCommandBuffer(const u32_le* src_cmdbuf,
std::shared_ptr<Process> src_process);
/// Writes data from this context back to the requesting process/thread.
ResultCode WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, Process& dst_process) const;
Result WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, Process& dst_process) const;
/// Reports an unimplemented function.
void ReportUnimplemented() const;

View File

@ -18,12 +18,11 @@
namespace Kernel {
ResultCode TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem& memory,
Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem& memory,
std::shared_ptr<Thread> src_thread,
std::shared_ptr<Thread> dst_thread, VAddr src_address,
VAddr dst_address,
std::vector<MappedBufferContext>& mapped_buffer_context,
bool reply) {
std::vector<MappedBufferContext>& mapped_buffer_context, bool reply) {
auto src_process = src_thread->owner_process.lock();
auto dst_process = dst_thread->owner_process.lock();
ASSERT(src_process && dst_process);
@ -60,7 +59,7 @@ ResultCode TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySy
// Note: The real kernel does not check that the number of handles fits into the command
// buffer before writing them, only after finishing.
if (i + num_handles > command_size) {
return ResultCode(ErrCodes::CommandTooLarge, ErrorModule::OS,
return Result(ErrCodes::CommandTooLarge, ErrorModule::OS,
ErrorSummary::InvalidState, ErrorLevel::Status);
}
@ -180,7 +179,7 @@ ResultCode TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySy
next_vma.meminfo_state == MemoryState::Reserved);
// Unmap the buffer and guard pages from the source process
ResultCode result =
Result result =
src_process->vm_manager.UnmapRange(page_start - Memory::CITRA_PAGE_SIZE,
(num_pages + 2) * Memory::CITRA_PAGE_SIZE);
ASSERT(result == RESULT_SUCCESS);

View File

@ -40,10 +40,9 @@ private:
};
/// Performs IPC command buffer translation from one process to another.
ResultCode TranslateCommandBuffer(KernelSystem& system, Memory::MemorySystem& memory,
Result TranslateCommandBuffer(KernelSystem& system, Memory::MemorySystem& memory,
std::shared_ptr<Thread> src_thread,
std::shared_ptr<Thread> dst_thread, VAddr src_address,
VAddr dst_address,
std::vector<MappedBufferContext>& mapped_buffer_context,
bool reply);
std::vector<MappedBufferContext>& mapped_buffer_context, bool reply);
} // namespace Kernel

View File

@ -66,7 +66,7 @@ void Mutex::Acquire(Thread* thread) {
lock_count++;
}
ResultCode Mutex::Release(Thread* thread) {
Result Mutex::Release(Thread* thread) {
// We can only release the mutex if it's held by the calling thread.
if (thread != holding_thread.get()) {
if (holding_thread) {
@ -75,14 +75,14 @@ ResultCode Mutex::Release(Thread* thread) {
"Tried to release a mutex (owned by thread id {}) from a different thread id {}",
holding_thread->thread_id, thread->thread_id);
}
return ResultCode(ErrCodes::WrongLockingThread, ErrorModule::Kernel,
return Result(ErrCodes::WrongLockingThread, ErrorModule::Kernel,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
}
// Note: It should not be possible for the situation where the mutex has a holding thread with a
// zero lock count to occur. The real kernel still checks for this, so we do too.
if (lock_count <= 0)
return ResultCode(ErrorDescription::InvalidResultValue, ErrorModule::Kernel,
return Result(ErrorDescription::InvalidResultValue, ErrorModule::Kernel,
ErrorSummary::InvalidState, ErrorLevel::Permanent);
lock_count--;

View File

@ -60,7 +60,7 @@ public:
* @param thread Thread that wants to release the mutex.
* @returns The result code of the operation.
*/
ResultCode Release(Thread* thread);
Result Release(Thread* thread);
private:
KernelSystem& kernel;

View File

@ -249,7 +249,7 @@ VAddr Process::GetLinearHeapLimit() const {
return GetLinearHeapBase() + memory_region->size;
}
ResultCode Process::HeapAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermission perms,
Result Process::HeapAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermission perms,
MemoryState memory_state, bool skip_range_check) {
LOG_DEBUG(Kernel, "Allocate heap target={:08X}, size={:08X}", target, size);
if (target < Memory::HEAP_VADDR || target + size > Memory::HEAP_VADDR_END ||
@ -297,7 +297,7 @@ ResultCode Process::HeapAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPer
return RESULT_SUCCESS;
}
ResultCode Process::HeapFree(VAddr target, u32 size) {
Result Process::HeapFree(VAddr target, u32 size) {
LOG_DEBUG(Kernel, "Free heap target={:08X}, size={:08X}", target, size);
if (target < Memory::HEAP_VADDR || target + size > Memory::HEAP_VADDR_END ||
target + size < target) {
@ -315,7 +315,7 @@ ResultCode Process::HeapFree(VAddr target, u32 size) {
holding_memory -= MemoryRegionInfo::Interval(backing_offset, backing_offset + block_size);
}
ResultCode result = vm_manager.UnmapRange(target, size);
Result result = vm_manager.UnmapRange(target, size);
ASSERT(result.IsSuccess());
memory_used -= size;
@ -324,7 +324,7 @@ ResultCode Process::HeapFree(VAddr target, u32 size) {
return RESULT_SUCCESS;
}
ResultCode Process::LinearAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermission perms) {
Result Process::LinearAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermission perms) {
LOG_DEBUG(Kernel, "Allocate linear heap target={:08X}, size={:08X}", target, size);
u32 physical_offset;
if (target == 0) {
@ -372,7 +372,7 @@ ResultCode Process::LinearAllocate(VAddr* out_addr, VAddr target, u32 size, VMAP
return RESULT_SUCCESS;
}
ResultCode Process::LinearFree(VAddr target, u32 size) {
Result Process::LinearFree(VAddr target, u32 size) {
LOG_DEBUG(Kernel, "Free linear heap target={:08X}, size={:08X}", target, size);
if (target < GetLinearHeapBase() || target + size > GetLinearHeapLimit() ||
target + size < target) {
@ -463,8 +463,7 @@ ResultVal<VAddr> Process::AllocateThreadLocalStorage() {
return tls_address;
}
ResultCode Process::Map(VAddr target, VAddr source, u32 size, VMAPermission perms,
bool privileged) {
Result Process::Map(VAddr target, VAddr source, u32 size, VMAPermission perms, bool privileged) {
LOG_DEBUG(Kernel, "Map memory target={:08X}, source={:08X}, size={:08X}, perms={:08X}", target,
source, size, perms);
if (!privileged && (source < Memory::HEAP_VADDR || source + size > Memory::HEAP_VADDR_END ||
@ -518,8 +517,7 @@ ResultCode Process::Map(VAddr target, VAddr source, u32 size, VMAPermission perm
return RESULT_SUCCESS;
}
ResultCode Process::Unmap(VAddr target, VAddr source, u32 size, VMAPermission perms,
bool privileged) {
Result Process::Unmap(VAddr target, VAddr source, u32 size, VMAPermission perms, bool privileged) {
LOG_DEBUG(Kernel, "Unmap memory target={:08X}, source={:08X}, size={:08X}, perms={:08X}",
target, source, size, perms);
if (!privileged && (source < Memory::HEAP_VADDR || source + size > Memory::HEAP_VADDR_END ||

View File

@ -231,19 +231,18 @@ public:
VAddr GetLinearHeapBase() const;
VAddr GetLinearHeapLimit() const;
ResultCode HeapAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermission perms,
Result HeapAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermission perms,
MemoryState memory_state = MemoryState::Private,
bool skip_range_check = false);
ResultCode HeapFree(VAddr target, u32 size);
Result HeapFree(VAddr target, u32 size);
ResultCode LinearAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermission perms);
ResultCode LinearFree(VAddr target, u32 size);
Result LinearAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermission perms);
Result LinearFree(VAddr target, u32 size);
ResultVal<VAddr> AllocateThreadLocalStorage();
ResultCode Map(VAddr target, VAddr source, u32 size, VMAPermission perms,
bool privileged = false);
ResultCode Unmap(VAddr target, VAddr source, u32 size, VMAPermission perms,
Result Map(VAddr target, VAddr source, u32 size, VMAPermission perms, bool privileged = false);
Result Unmap(VAddr target, VAddr source, u32 size, VMAPermission perms,
bool privileged = false);
private:

View File

@ -48,7 +48,7 @@ void Semaphore::Acquire(Thread* thread) {
--available_count;
}
ResultCode Semaphore::Release(s32* count, s32 release_count) {
Result Semaphore::Release(s32* count, s32 release_count) {
R_UNLESS(max_count >= release_count + available_count, ERR_OUT_OF_RANGE_KERNEL);
*count = available_count;

View File

@ -47,7 +47,7 @@ public:
* @param release_count The number of slots to release
* @return The number of free slots the semaphore had before this call
*/
ResultCode Release(s32* count, s32 release_count);
Result Release(s32* count, s32 release_count);
private:
friend class boost::serialization::access;

View File

@ -24,7 +24,7 @@ namespace Kernel {
ServerPort::ServerPort(KernelSystem& kernel) : WaitObject(kernel) {}
ServerPort::~ServerPort() {}
ResultCode ServerPort::Accept(std::shared_ptr<ServerSession>& session) {
Result ServerPort::Accept(std::shared_ptr<ServerSession>& session) {
R_UNLESS(!pending_sessions.empty(), ERR_NO_PENDING_SESSIONS);
session = std::move(pending_sessions.back());

View File

@ -41,7 +41,7 @@ public:
* Accepts a pending incoming connection on this port. If there are no pending sessions, will
* return ERR_NO_PENDING_SESSIONS.
*/
ResultCode Accept(std::shared_ptr<ServerSession>& session);
Result Accept(std::shared_ptr<ServerSession>& session);
/**
* Sets the HLE handler template for the port. ServerSessions crated by connecting to this port

View File

@ -77,7 +77,7 @@ void ServerSession::Acquire(Thread* thread) {
pending_requesting_threads.pop_back();
}
ResultCode ServerSession::HandleSyncRequest(std::shared_ptr<Thread> thread) {
Result ServerSession::HandleSyncRequest(std::shared_ptr<Thread> thread) {
// The ServerSession received a sync request, this means that there's new data available
// from its ClientSession, so wake up any threads that may be waiting on a svcReplyAndReceive or
// similar.

View File

@ -66,9 +66,9 @@ public:
/**
* Handle a sync request from the emulated application.
* @param thread Thread that initiated the request.
* @returns ResultCode from the operation.
* @returns Result from the operation.
*/
ResultCode HandleSyncRequest(std::shared_ptr<Thread> thread);
Result HandleSyncRequest(std::shared_ptr<Thread> thread);
bool ShouldWait(const Thread* thread) const override;

View File

@ -106,7 +106,7 @@ std::shared_ptr<SharedMemory> KernelSystem::CreateSharedMemoryForApplet(
return shared_memory;
}
ResultCode SharedMemory::Map(Process& target_process, VAddr address, MemoryPermission permissions,
Result SharedMemory::Map(Process& target_process, VAddr address, MemoryPermission permissions,
MemoryPermission other_permissions) {
MemoryPermission own_other_permissions =
@ -141,7 +141,7 @@ ResultCode SharedMemory::Map(Process& target_process, VAddr address, MemoryPermi
// TODO(Subv): Check for the Shared Device Mem flag in the creator process.
/*if (was_created_with_shared_device_mem && address != 0) {
return ResultCode(ErrorDescription::InvalidCombination, ErrorModule::OS,
return Result(ErrorDescription::InvalidCombination, ErrorModule::OS,
ErrorSummary::InvalidArgument, ErrorLevel::Usage);
}*/
@ -190,7 +190,7 @@ ResultCode SharedMemory::Map(Process& target_process, VAddr address, MemoryPermi
return RESULT_SUCCESS;
}
ResultCode SharedMemory::Unmap(Process& target_process, VAddr address) {
Result SharedMemory::Unmap(Process& target_process, VAddr address) {
// TODO(Subv): Verify what happens if the application tries to unmap an address that is not
// mapped to a SharedMemory.
return target_process.vm_manager.UnmapRange(address, size);

View File

@ -61,7 +61,7 @@ public:
* @param permissions Memory block map permissions (specified by SVC field)
* @param other_permissions Memory block map other permissions (specified by SVC field)
*/
ResultCode Map(Process& target_process, VAddr address, MemoryPermission permissions,
Result Map(Process& target_process, VAddr address, MemoryPermission permissions,
MemoryPermission other_permissions);
/**
@ -70,7 +70,7 @@ public:
* @param address Address in system memory where the shared memory block is mapped
* @return Result code of the unmap operation
*/
ResultCode Unmap(Process& target_process, VAddr address);
Result Unmap(Process& target_process, VAddr address);
/**
* Gets a pointer to the shared memory block

View File

@ -366,79 +366,78 @@ private:
// SVC interfaces
ResultCode ControlMemory(u32* out_addr, u32 addr0, u32 addr1, u32 size, u32 operation,
Result ControlMemory(u32* out_addr, u32 addr0, u32 addr1, u32 size, u32 operation,
u32 permissions);
void ExitProcess();
ResultCode TerminateProcess(Handle handle);
ResultCode MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions);
ResultCode UnmapMemoryBlock(Handle handle, u32 addr);
ResultCode ConnectToPort(Handle* out_handle, VAddr port_name_address);
ResultCode SendSyncRequest(Handle handle);
ResultCode OpenProcess(Handle* out_handle, u32 process_id);
ResultCode OpenThread(Handle* out_handle, Handle process_handle, u32 thread_id);
ResultCode CloseHandle(Handle handle);
ResultCode WaitSynchronization1(Handle handle, s64 nano_seconds);
ResultCode WaitSynchronizationN(s32* out, VAddr handles_address, s32 handle_count,
bool wait_all, s64 nano_seconds);
ResultCode ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_count,
Result TerminateProcess(Handle handle);
Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions);
Result UnmapMemoryBlock(Handle handle, u32 addr);
Result ConnectToPort(Handle* out_handle, VAddr port_name_address);
Result SendSyncRequest(Handle handle);
Result OpenProcess(Handle* out_handle, u32 process_id);
Result OpenThread(Handle* out_handle, Handle process_handle, u32 thread_id);
Result CloseHandle(Handle handle);
Result WaitSynchronization1(Handle handle, s64 nano_seconds);
Result WaitSynchronizationN(s32* out, VAddr handles_address, s32 handle_count, bool wait_all,
s64 nano_seconds);
Result ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_count,
Handle reply_target);
ResultCode CreateAddressArbiter(Handle* out_handle);
ResultCode ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value, s64 nanoseconds);
Result CreateAddressArbiter(Handle* out_handle);
Result ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value, s64 nanoseconds);
void Break(u8 break_reason);
void OutputDebugString(VAddr address, s32 len);
ResultCode GetResourceLimit(Handle* resource_limit, Handle process_handle);
ResultCode GetResourceLimitCurrentValues(VAddr values, Handle resource_limit_handle,
VAddr names, u32 name_count);
ResultCode GetResourceLimitLimitValues(VAddr values, Handle resource_limit_handle, VAddr names,
Result GetResourceLimit(Handle* resource_limit, Handle process_handle);
Result GetResourceLimitCurrentValues(VAddr values, Handle resource_limit_handle, VAddr names,
u32 name_count);
ResultCode SetResourceLimitLimitValues(Handle res_limit, VAddr names, VAddr resource_list,
Result GetResourceLimitLimitValues(VAddr values, Handle resource_limit_handle, VAddr names,
u32 name_count);
ResultCode CreateThread(Handle* out_handle, u32 entry_point, u32 arg, VAddr stack_top,
u32 priority, s32 processor_id);
Result SetResourceLimitLimitValues(Handle res_limit, VAddr names, VAddr resource_list,
u32 name_count);
Result CreateThread(Handle* out_handle, u32 entry_point, u32 arg, VAddr stack_top, u32 priority,
s32 processor_id);
void ExitThread();
ResultCode GetThreadPriority(u32* priority, Handle handle);
ResultCode SetThreadPriority(Handle handle, u32 priority);
ResultCode CreateMutex(Handle* out_handle, u32 initial_locked);
ResultCode ReleaseMutex(Handle handle);
ResultCode GetProcessId(u32* process_id, Handle process_handle);
ResultCode GetProcessIdOfThread(u32* process_id, Handle thread_handle);
ResultCode GetThreadId(u32* thread_id, Handle handle);
ResultCode CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max_count);
ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count);
ResultCode KernelSetState(u32 kernel_state, u32 varg1, u32 varg2);
ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_info,
Handle process_handle, u32 addr);
ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, u32 addr);
ResultCode CreateEvent(Handle* out_handle, u32 reset_type);
ResultCode DuplicateHandle(Handle* out, Handle handle);
ResultCode SignalEvent(Handle handle);
ResultCode ClearEvent(Handle handle);
ResultCode CreateTimer(Handle* out_handle, u32 reset_type);
ResultCode ClearTimer(Handle handle);
ResultCode SetTimer(Handle handle, s64 initial, s64 interval);
ResultCode CancelTimer(Handle handle);
Result GetThreadPriority(u32* priority, Handle handle);
Result SetThreadPriority(Handle handle, u32 priority);
Result CreateMutex(Handle* out_handle, u32 initial_locked);
Result ReleaseMutex(Handle handle);
Result GetProcessId(u32* process_id, Handle process_handle);
Result GetProcessIdOfThread(u32* process_id, Handle thread_handle);
Result GetThreadId(u32* thread_id, Handle handle);
Result CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max_count);
Result ReleaseSemaphore(s32* count, Handle handle, s32 release_count);
Result KernelSetState(u32 kernel_state, u32 varg1, u32 varg2);
Result QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_info, Handle process_handle,
u32 addr);
Result QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, u32 addr);
Result CreateEvent(Handle* out_handle, u32 reset_type);
Result DuplicateHandle(Handle* out, Handle handle);
Result SignalEvent(Handle handle);
Result ClearEvent(Handle handle);
Result CreateTimer(Handle* out_handle, u32 reset_type);
Result ClearTimer(Handle handle);
Result SetTimer(Handle handle, s64 initial, s64 interval);
Result CancelTimer(Handle handle);
void SleepThread(s64 nanoseconds);
s64 GetSystemTick();
ResultCode GetHandleInfo(s64* out, Handle handle, u32 type);
ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my_permission,
Result GetHandleInfo(s64* out, Handle handle, u32 type);
Result CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my_permission,
u32 other_permission);
ResultCode CreatePort(Handle* server_port, Handle* client_port, VAddr name_address,
Result CreatePort(Handle* server_port, Handle* client_port, VAddr name_address,
u32 max_sessions);
ResultCode CreateSessionToPort(Handle* out_client_session, Handle client_port_handle);
ResultCode CreateSession(Handle* server_session, Handle* client_session);
ResultCode AcceptSession(Handle* out_server_session, Handle server_port_handle);
ResultCode GetSystemInfo(s64* out, u32 type, s32 param);
ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type);
ResultCode GetThreadInfo(s64* out, Handle thread_handle, u32 type);
ResultCode GetProcessList(s32* process_count, VAddr out_process_array,
s32 out_process_array_count);
ResultCode InvalidateInstructionCacheRange(u32 addr, u32 size);
ResultCode InvalidateEntireInstructionCache();
Result CreateSessionToPort(Handle* out_client_session, Handle client_port_handle);
Result CreateSession(Handle* server_session, Handle* client_session);
Result AcceptSession(Handle* out_server_session, Handle server_port_handle);
Result GetSystemInfo(s64* out, u32 type, s32 param);
Result GetProcessInfo(s64* out, Handle process_handle, u32 type);
Result GetThreadInfo(s64* out, Handle thread_handle, u32 type);
Result GetProcessList(s32* process_count, VAddr out_process_array, s32 out_process_array_count);
Result InvalidateInstructionCacheRange(u32 addr, u32 size);
Result InvalidateEntireInstructionCache();
u32 ConvertVaToPa(u32 addr);
ResultCode MapProcessMemoryEx(Handle dst_process_handle, u32 dst_address,
Handle src_process_handle, u32 src_address, u32 size);
ResultCode UnmapProcessMemoryEx(Handle process, u32 dst_address, u32 size);
ResultCode ControlProcess(Handle process_handle, u32 process_OP, u32 varg2, u32 varg3);
Result MapProcessMemoryEx(Handle dst_process_handle, u32 dst_address, Handle src_process_handle,
u32 src_address, u32 size);
Result UnmapProcessMemoryEx(Handle process, u32 dst_address, u32 size);
Result ControlProcess(Handle process_handle, u32 process_OP, u32 varg2, u32 varg3);
struct FunctionDef {
using Func = void (SVC::*)();
@ -453,7 +452,7 @@ private:
};
/// Map application or GSP heap memory
ResultCode SVC::ControlMemory(u32* out_addr, u32 addr0, u32 addr1, u32 size, u32 operation,
Result SVC::ControlMemory(u32* out_addr, u32 addr0, u32 addr1, u32 size, u32 operation,
u32 permissions) {
LOG_DEBUG(Kernel_SVC,
"called operation=0x{:08X}, addr0=0x{:08X}, addr1=0x{:08X}, "
@ -522,7 +521,7 @@ void SVC::ExitProcess() {
kernel.TerminateProcess(kernel.GetCurrentProcess());
}
ResultCode SVC::TerminateProcess(Handle handle) {
Result SVC::TerminateProcess(Handle handle) {
std::shared_ptr<Process> process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(handle);
R_UNLESS(process, ERR_INVALID_HANDLE);
@ -532,7 +531,7 @@ ResultCode SVC::TerminateProcess(Handle handle) {
}
/// Maps a memory block to specified address
ResultCode SVC::MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) {
Result SVC::MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) {
LOG_TRACE(Kernel_SVC,
"called memblock=0x{:08X}, addr=0x{:08X}, mypermissions=0x{:08X}, "
"otherpermission={}",
@ -561,7 +560,7 @@ ResultCode SVC::MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 oth
return ERR_INVALID_COMBINATION;
}
ResultCode SVC::UnmapMemoryBlock(Handle handle, u32 addr) {
Result SVC::UnmapMemoryBlock(Handle handle, u32 addr) {
LOG_TRACE(Kernel_SVC, "called memblock=0x{:08X}, addr=0x{:08X}", handle, addr);
// TODO(Subv): Return E0A01BF5 if the address is not in the application's heap
@ -575,7 +574,7 @@ ResultCode SVC::UnmapMemoryBlock(Handle handle, u32 addr) {
}
/// Connect to an OS service given the port name, returns the handle to the port to out
ResultCode SVC::ConnectToPort(Handle* out_handle, VAddr port_name_address) {
Result SVC::ConnectToPort(Handle* out_handle, VAddr port_name_address) {
R_UNLESS(memory.IsValidVirtualAddress(*kernel.GetCurrentProcess(), port_name_address),
ERR_NOT_FOUND);
@ -598,7 +597,7 @@ ResultCode SVC::ConnectToPort(Handle* out_handle, VAddr port_name_address) {
}
/// Makes a blocking IPC call to an OS service.
ResultCode SVC::SendSyncRequest(Handle handle) {
Result SVC::SendSyncRequest(Handle handle) {
std::shared_ptr<ClientSession> session =
kernel.GetCurrentProcess()->handle_table.Get<ClientSession>(handle);
R_UNLESS(session, ERR_INVALID_HANDLE);
@ -616,19 +615,19 @@ ResultCode SVC::SendSyncRequest(Handle handle) {
return session->SendSyncRequest(thread);
}
ResultCode SVC::OpenProcess(Handle* out_handle, u32 process_id) {
Result SVC::OpenProcess(Handle* out_handle, u32 process_id) {
std::shared_ptr<Process> process = kernel.GetProcessById(process_id);
if (!process) {
// Result 0xd9001818 (process not found?)
return ResultCode(24, ErrorModule::OS, ErrorSummary::WrongArgument, ErrorLevel::Permanent);
return Result(24, ErrorModule::OS, ErrorSummary::WrongArgument, ErrorLevel::Permanent);
}
return kernel.GetCurrentProcess()->handle_table.Create(out_handle, process);
}
ResultCode SVC::OpenThread(Handle* out_handle, Handle process_handle, u32 thread_id) {
Result SVC::OpenThread(Handle* out_handle, Handle process_handle, u32 thread_id) {
// Result 0xd9001819 (thread not found?)
constexpr static ResultCode ResultThreadNotFound(
25, ErrorModule::OS, ErrorSummary::WrongArgument, ErrorLevel::Permanent);
constexpr static Result ResultThreadNotFound(25, ErrorModule::OS, ErrorSummary::WrongArgument,
ErrorLevel::Permanent);
if (process_handle == 0) {
LOG_ERROR(Kernel_SVC, "Uninplemented svcOpenThread process_handle=0");
@ -651,12 +650,12 @@ ResultCode SVC::OpenThread(Handle* out_handle, Handle process_handle, u32 thread
}
/// Close a handle
ResultCode SVC::CloseHandle(Handle handle) {
Result SVC::CloseHandle(Handle handle) {
LOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle);
return kernel.GetCurrentProcess()->handle_table.Close(handle);
}
static ResultCode ReceiveIPCRequest(Kernel::KernelSystem& kernel, Memory::MemorySystem& memory,
static Result ReceiveIPCRequest(Kernel::KernelSystem& kernel, Memory::MemorySystem& memory,
std::shared_ptr<ServerSession> server_session,
std::shared_ptr<Thread> thread);
@ -703,7 +702,7 @@ public:
ASSERT(thread->status == ThreadStatus::WaitSynchAny);
ASSERT(reason == ThreadWakeupReason::Signal);
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
if (object->GetHandleType() == HandleType::ServerSession) {
auto server_session = DynamicObjectCast<ServerSession>(object);
@ -727,7 +726,7 @@ private:
};
/// Wait for a handle to synchronize, timeout after the specified nanoseconds
ResultCode SVC::WaitSynchronization1(Handle handle, s64 nano_seconds) {
Result SVC::WaitSynchronization1(Handle handle, s64 nano_seconds) {
auto object = kernel.GetCurrentProcess()->handle_table.Get<WaitObject>(handle);
Thread* thread = kernel.GetCurrentThreadManager().GetCurrentThread();
R_UNLESS(object, ERR_INVALID_HANDLE);
@ -760,8 +759,8 @@ ResultCode SVC::WaitSynchronization1(Handle handle, s64 nano_seconds) {
}
/// Wait for the given handles to synchronize, timeout after the specified nanoseconds
ResultCode SVC::WaitSynchronizationN(s32* out, VAddr handles_address, s32 handle_count,
bool wait_all, s64 nano_seconds) {
Result SVC::WaitSynchronizationN(s32* out, VAddr handles_address, s32 handle_count, bool wait_all,
s64 nano_seconds) {
Thread* thread = kernel.GetCurrentThreadManager().GetCurrentThread();
R_UNLESS(memory.IsValidVirtualAddress(*kernel.GetCurrentProcess(), handles_address),
ERR_INVALID_POINTER);
@ -873,7 +872,7 @@ ResultCode SVC::WaitSynchronizationN(s32* out, VAddr handles_address, s32 handle
}
}
static ResultCode ReceiveIPCRequest(Kernel::KernelSystem& kernel, Memory::MemorySystem& memory,
static Result ReceiveIPCRequest(Kernel::KernelSystem& kernel, Memory::MemorySystem& memory,
std::shared_ptr<ServerSession> server_session,
std::shared_ptr<Thread> thread) {
R_UNLESS(server_session->parent->client, ERR_SESSION_CLOSED_BY_REMOTE);
@ -881,7 +880,7 @@ static ResultCode ReceiveIPCRequest(Kernel::KernelSystem& kernel, Memory::Memory
VAddr target_address = thread->GetCommandBufferAddress();
VAddr source_address = server_session->currently_handling->GetCommandBufferAddress();
ResultCode translation_result = TranslateCommandBuffer(
Result translation_result = TranslateCommandBuffer(
kernel, memory, server_session->currently_handling, thread, source_address, target_address,
server_session->mapped_buffer_context, false);
@ -901,7 +900,7 @@ static ResultCode ReceiveIPCRequest(Kernel::KernelSystem& kernel, Memory::Memory
}
/// In a single operation, sends a IPC reply and waits for a new request.
ResultCode SVC::ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_count,
Result SVC::ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_count,
Handle reply_target) {
R_UNLESS(memory.IsValidVirtualAddress(*kernel.GetCurrentProcess(), handles_address),
ERR_INVALID_POINTER);
@ -945,7 +944,7 @@ ResultCode SVC::ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_co
VAddr source_address = thread->GetCommandBufferAddress();
VAddr target_address = request_thread->GetCommandBufferAddress();
ResultCode translation_result = TranslateCommandBuffer(
Result translation_result = TranslateCommandBuffer(
kernel, memory, SharedFrom(thread), request_thread, source_address, target_address,
session->mapped_buffer_context, true);
@ -962,7 +961,7 @@ ResultCode SVC::ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_co
R_SUCCEED_IF(reply_target != 0 && header.command_id != 0xFFFF);
// The kernel uses this value as a placeholder for the real error, and returns it when we
// pass no handles and do not perform any reply.
return ResultCode(0xE7E3FFFF);
return Result(0xE7E3FFFF);
}
// Find the first object that is acquirable in the provided list of objects
@ -1007,13 +1006,13 @@ ResultCode SVC::ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_co
}
/// Create an address arbiter (to allocate access to shared resources)
ResultCode SVC::CreateAddressArbiter(Handle* out_handle) {
Result SVC::CreateAddressArbiter(Handle* out_handle) {
// Update address arbiter count in resource limit.
const auto current_process = kernel.GetCurrentProcess();
const auto& resource_limit = current_process->resource_limit;
if (!resource_limit->Reserve(ResourceLimitType::AddressArbiter, 1)) {
return ResultCode(ErrCodes::OutOfAddressArbiters, ErrorModule::OS,
ErrorSummary::OutOfResource, ErrorLevel::Status);
return Result(ErrCodes::OutOfAddressArbiters, ErrorModule::OS, ErrorSummary::OutOfResource,
ErrorLevel::Status);
}
// Create address arbiter.
@ -1023,7 +1022,7 @@ ResultCode SVC::CreateAddressArbiter(Handle* out_handle) {
}
/// Arbitrate address
ResultCode SVC::ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value, s64 nanoseconds) {
Result SVC::ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value, s64 nanoseconds) {
LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}, address=0x{:08X}, type=0x{:08X}, value=0x{:08X}",
handle, address, type, value);
@ -1085,7 +1084,7 @@ void SVC::OutputDebugString(VAddr address, s32 len) {
}
/// Get resource limit
ResultCode SVC::GetResourceLimit(Handle* resource_limit, Handle process_handle) {
Result SVC::GetResourceLimit(Handle* resource_limit, Handle process_handle) {
LOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle);
std::shared_ptr<Process> current_process = kernel.GetCurrentProcess();
@ -1096,8 +1095,8 @@ ResultCode SVC::GetResourceLimit(Handle* resource_limit, Handle process_handle)
}
/// Get resource limit current values
ResultCode SVC::GetResourceLimitCurrentValues(VAddr values, Handle resource_limit_handle,
VAddr names, u32 name_count) {
Result SVC::GetResourceLimitCurrentValues(VAddr values, Handle resource_limit_handle, VAddr names,
u32 name_count) {
LOG_TRACE(Kernel_SVC, "called resource_limit={:08X}, names={:08X}, name_count={}",
resource_limit_handle, names, name_count);
@ -1115,7 +1114,7 @@ ResultCode SVC::GetResourceLimitCurrentValues(VAddr values, Handle resource_limi
}
/// Get resource limit max values
ResultCode SVC::GetResourceLimitLimitValues(VAddr values, Handle resource_limit_handle, VAddr names,
Result SVC::GetResourceLimitLimitValues(VAddr values, Handle resource_limit_handle, VAddr names,
u32 name_count) {
LOG_TRACE(Kernel_SVC, "called resource_limit={:08X}, names={:08X}, name_count={}",
resource_limit_handle, names, name_count);
@ -1134,7 +1133,7 @@ ResultCode SVC::GetResourceLimitLimitValues(VAddr values, Handle resource_limit_
return RESULT_SUCCESS;
}
ResultCode SVC::SetResourceLimitLimitValues(Handle res_limit, VAddr names, VAddr resource_list,
Result SVC::SetResourceLimitLimitValues(Handle res_limit, VAddr names, VAddr resource_list,
u32 name_count) {
LOG_TRACE(Kernel_SVC, "called resource_limit={:08X}, names={:08X}, name_count={}", res_limit,
names, name_count);
@ -1162,7 +1161,7 @@ ResultCode SVC::SetResourceLimitLimitValues(Handle res_limit, VAddr names, VAddr
}
/// Creates a new thread
ResultCode SVC::CreateThread(Handle* out_handle, u32 entry_point, u32 arg, VAddr stack_top,
Result SVC::CreateThread(Handle* out_handle, u32 entry_point, u32 arg, VAddr stack_top,
u32 priority, s32 processor_id) {
R_UNLESS(priority <= ThreadPrioLowest, ERR_OUT_OF_RANGE);
@ -1202,7 +1201,7 @@ ResultCode SVC::CreateThread(Handle* out_handle, u32 entry_point, u32 arg, VAddr
// Update thread count in resource limit.
if (!resource_limit->Reserve(ResourceLimitType::Thread, 1)) {
return ResultCode(ErrCodes::OutOfThreads, ErrorModule::OS, ErrorSummary::OutOfResource,
return Result(ErrCodes::OutOfThreads, ErrorModule::OS, ErrorSummary::OutOfResource,
ErrorLevel::Status);
}
@ -1234,7 +1233,7 @@ void SVC::ExitThread() {
}
/// Gets the priority for the specified thread
ResultCode SVC::GetThreadPriority(u32* priority, Handle handle) {
Result SVC::GetThreadPriority(u32* priority, Handle handle) {
const std::shared_ptr<Thread> thread =
kernel.GetCurrentProcess()->handle_table.Get<Thread>(handle);
R_UNLESS(thread, ERR_INVALID_HANDLE);
@ -1244,7 +1243,7 @@ ResultCode SVC::GetThreadPriority(u32* priority, Handle handle) {
}
/// Sets the priority for the specified thread
ResultCode SVC::SetThreadPriority(Handle handle, u32 priority) {
Result SVC::SetThreadPriority(Handle handle, u32 priority) {
R_UNLESS(priority <= ThreadPrioLowest, ERR_OUT_OF_RANGE);
const auto thread = kernel.GetCurrentProcess()->handle_table.Get<Thread>(handle);
@ -1269,12 +1268,12 @@ ResultCode SVC::SetThreadPriority(Handle handle, u32 priority) {
}
/// Create a mutex
ResultCode SVC::CreateMutex(Handle* out_handle, u32 initial_locked) {
Result SVC::CreateMutex(Handle* out_handle, u32 initial_locked) {
// Update mutex count in resource limit.
const auto current_process = kernel.GetCurrentProcess();
const auto& resource_limit = current_process->resource_limit;
if (!resource_limit->Reserve(ResourceLimitType::Mutex, 1)) {
return ResultCode(ErrCodes::OutOfMutexes, ErrorModule::OS, ErrorSummary::OutOfResource,
return Result(ErrCodes::OutOfMutexes, ErrorModule::OS, ErrorSummary::OutOfResource,
ErrorLevel::Status);
}
@ -1286,7 +1285,7 @@ ResultCode SVC::CreateMutex(Handle* out_handle, u32 initial_locked) {
}
/// Release a mutex
ResultCode SVC::ReleaseMutex(Handle handle) {
Result SVC::ReleaseMutex(Handle handle) {
LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}", handle);
std::shared_ptr<Mutex> mutex = kernel.GetCurrentProcess()->handle_table.Get<Mutex>(handle);
@ -1296,7 +1295,7 @@ ResultCode SVC::ReleaseMutex(Handle handle) {
}
/// Get the ID of the specified process
ResultCode SVC::GetProcessId(u32* process_id, Handle process_handle) {
Result SVC::GetProcessId(u32* process_id, Handle process_handle) {
LOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle);
const std::shared_ptr<Process> process =
@ -1308,7 +1307,7 @@ ResultCode SVC::GetProcessId(u32* process_id, Handle process_handle) {
}
/// Get the ID of the process that owns the specified thread
ResultCode SVC::GetProcessIdOfThread(u32* process_id, Handle thread_handle) {
Result SVC::GetProcessIdOfThread(u32* process_id, Handle thread_handle) {
LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle);
const std::shared_ptr<Thread> thread =
@ -1323,7 +1322,7 @@ ResultCode SVC::GetProcessIdOfThread(u32* process_id, Handle thread_handle) {
}
/// Get the ID for the specified thread.
ResultCode SVC::GetThreadId(u32* thread_id, Handle handle) {
Result SVC::GetThreadId(u32* thread_id, Handle handle) {
LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", handle);
const std::shared_ptr<Thread> thread =
@ -1335,12 +1334,12 @@ ResultCode SVC::GetThreadId(u32* thread_id, Handle handle) {
}
/// Creates a semaphore
ResultCode SVC::CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max_count) {
Result SVC::CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max_count) {
// Update semaphore count in resource limit.
const auto current_process = kernel.GetCurrentProcess();
const auto& resource_limit = current_process->resource_limit;
if (!resource_limit->Reserve(ResourceLimitType::Semaphore, 1)) {
return ResultCode(ErrCodes::OutOfSemaphores, ErrorModule::OS, ErrorSummary::OutOfResource,
return Result(ErrCodes::OutOfSemaphores, ErrorModule::OS, ErrorSummary::OutOfResource,
ErrorLevel::Status);
}
@ -1353,7 +1352,7 @@ ResultCode SVC::CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max_c
}
/// Releases a certain number of slots in a semaphore
ResultCode SVC::ReleaseSemaphore(s32* count, Handle handle, s32 release_count) {
Result SVC::ReleaseSemaphore(s32* count, Handle handle, s32 release_count) {
LOG_TRACE(Kernel_SVC, "called release_count={}, handle=0x{:08X}", release_count, handle);
std::shared_ptr<Semaphore> semaphore =
@ -1364,7 +1363,7 @@ ResultCode SVC::ReleaseSemaphore(s32* count, Handle handle, s32 release_count) {
}
/// Sets the kernel state
ResultCode SVC::KernelSetState(u32 kernel_state, u32 varg1, u32 varg2) {
Result SVC::KernelSetState(u32 kernel_state, u32 varg1, u32 varg2) {
switch (static_cast<KernelState>(kernel_state)) {
// This triggers a hardware reboot on real console, since this doesn't make sense
// on emulator, we shutdown instead.
@ -1379,8 +1378,8 @@ ResultCode SVC::KernelSetState(u32 kernel_state, u32 varg1, u32 varg2) {
}
/// Query process memory
ResultCode SVC::QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_info,
Handle process_handle, u32 addr) {
Result SVC::QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_info, Handle process_handle,
u32 addr) {
std::shared_ptr<Process> process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle);
R_UNLESS(process, ERR_INVALID_HANDLE);
@ -1416,17 +1415,17 @@ ResultCode SVC::QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_info,
}
/// Query memory
ResultCode SVC::QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, u32 addr) {
Result SVC::QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, u32 addr) {
return QueryProcessMemory(memory_info, page_info, CurrentProcess, addr);
}
/// Create an event
ResultCode SVC::CreateEvent(Handle* out_handle, u32 reset_type) {
Result SVC::CreateEvent(Handle* out_handle, u32 reset_type) {
// Update event count in resource limit.
const auto current_process = kernel.GetCurrentProcess();
const auto& resource_limit = current_process->resource_limit;
if (!resource_limit->Reserve(ResourceLimitType::Event, 1)) {
return ResultCode(ErrCodes::OutOfEvents, ErrorModule::OS, ErrorSummary::OutOfResource,
return Result(ErrCodes::OutOfEvents, ErrorModule::OS, ErrorSummary::OutOfResource,
ErrorLevel::Status);
}
@ -1438,12 +1437,12 @@ ResultCode SVC::CreateEvent(Handle* out_handle, u32 reset_type) {
}
/// Duplicates a kernel handle
ResultCode SVC::DuplicateHandle(Handle* out, Handle handle) {
Result SVC::DuplicateHandle(Handle* out, Handle handle) {
return kernel.GetCurrentProcess()->handle_table.Duplicate(out, handle);
}
/// Signals an event
ResultCode SVC::SignalEvent(Handle handle) {
Result SVC::SignalEvent(Handle handle) {
LOG_TRACE(Kernel_SVC, "called event=0x{:08X}", handle);
std::shared_ptr<Event> evt = kernel.GetCurrentProcess()->handle_table.Get<Event>(handle);
@ -1454,7 +1453,7 @@ ResultCode SVC::SignalEvent(Handle handle) {
}
/// Clears an event
ResultCode SVC::ClearEvent(Handle handle) {
Result SVC::ClearEvent(Handle handle) {
LOG_TRACE(Kernel_SVC, "called event=0x{:08X}", handle);
std::shared_ptr<Event> evt = kernel.GetCurrentProcess()->handle_table.Get<Event>(handle);
@ -1465,12 +1464,12 @@ ResultCode SVC::ClearEvent(Handle handle) {
}
/// Creates a timer
ResultCode SVC::CreateTimer(Handle* out_handle, u32 reset_type) {
Result SVC::CreateTimer(Handle* out_handle, u32 reset_type) {
// Update timer count in resource limit.
const auto current_process = kernel.GetCurrentProcess();
const auto& resource_limit = current_process->resource_limit;
if (!resource_limit->Reserve(ResourceLimitType::Timer, 1)) {
return ResultCode(ErrCodes::OutOfTimers, ErrorModule::OS, ErrorSummary::OutOfResource,
return Result(ErrCodes::OutOfTimers, ErrorModule::OS, ErrorSummary::OutOfResource,
ErrorLevel::Status);
}
@ -1482,7 +1481,7 @@ ResultCode SVC::CreateTimer(Handle* out_handle, u32 reset_type) {
}
/// Clears a timer
ResultCode SVC::ClearTimer(Handle handle) {
Result SVC::ClearTimer(Handle handle) {
LOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle);
std::shared_ptr<Timer> timer = kernel.GetCurrentProcess()->handle_table.Get<Timer>(handle);
@ -1493,7 +1492,7 @@ ResultCode SVC::ClearTimer(Handle handle) {
}
/// Starts a timer
ResultCode SVC::SetTimer(Handle handle, s64 initial, s64 interval) {
Result SVC::SetTimer(Handle handle, s64 initial, s64 interval) {
LOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle);
R_UNLESS(initial >= 0 && interval >= 0, ERR_OUT_OF_RANGE_KERNEL);
@ -1507,7 +1506,7 @@ ResultCode SVC::SetTimer(Handle handle, s64 initial, s64 interval) {
}
/// Cancels a timer
ResultCode SVC::CancelTimer(Handle handle) {
Result SVC::CancelTimer(Handle handle) {
LOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle);
std::shared_ptr<Timer> timer = kernel.GetCurrentProcess()->handle_table.Get<Timer>(handle);
@ -1549,7 +1548,7 @@ s64 SVC::GetSystemTick() {
}
// Returns information of the specified handle
ResultCode SVC::GetHandleInfo(s64* out, Handle handle, u32 type) {
Result SVC::GetHandleInfo(s64* out, Handle handle, u32 type) {
std::shared_ptr<Object> object = kernel.GetCurrentProcess()->handle_table.GetGeneric(handle);
R_UNLESS(object, ERR_INVALID_HANDLE);
@ -1581,7 +1580,7 @@ ResultCode SVC::GetHandleInfo(s64* out, Handle handle, u32 type) {
}
/// Creates a memory block at the specified address with the specified permissions and size
ResultCode SVC::CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my_permission,
Result SVC::CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my_permission,
u32 other_permission) {
R_UNLESS(size % Memory::CITRA_PAGE_SIZE == 0, ERR_MISALIGNED_SIZE);
@ -1618,7 +1617,7 @@ ResultCode SVC::CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my
const auto current_process = kernel.GetCurrentProcess();
const auto& resource_limit = current_process->resource_limit;
if (!resource_limit->Reserve(ResourceLimitType::SharedMemory, 1)) {
return ResultCode(ErrCodes::OutOfSharedMems, ErrorModule::OS, ErrorSummary::OutOfResource,
return Result(ErrCodes::OutOfSharedMems, ErrorModule::OS, ErrorSummary::OutOfResource,
ErrorLevel::Status);
}
@ -1638,7 +1637,7 @@ ResultCode SVC::CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my
return current_process->handle_table.Create(out_handle, std::move(shared_memory));
}
ResultCode SVC::CreatePort(Handle* server_port, Handle* client_port, VAddr name_address,
Result SVC::CreatePort(Handle* server_port, Handle* client_port, VAddr name_address,
u32 max_sessions) {
// TODO(Subv): Implement named ports.
ASSERT_MSG(name_address == 0, "Named ports are currently unimplemented");
@ -1653,7 +1652,7 @@ ResultCode SVC::CreatePort(Handle* server_port, Handle* client_port, VAddr name_
return current_process->handle_table.Create(server_port, std::move(server));
}
ResultCode SVC::CreateSessionToPort(Handle* out_client_session, Handle client_port_handle) {
Result SVC::CreateSessionToPort(Handle* out_client_session, Handle client_port_handle) {
std::shared_ptr<Process> current_process = kernel.GetCurrentProcess();
std::shared_ptr<ClientPort> client_port =
current_process->handle_table.Get<ClientPort>(client_port_handle);
@ -1665,7 +1664,7 @@ ResultCode SVC::CreateSessionToPort(Handle* out_client_session, Handle client_po
return current_process->handle_table.Create(out_client_session, std::move(session));
}
ResultCode SVC::CreateSession(Handle* server_session, Handle* client_session) {
Result SVC::CreateSession(Handle* server_session, Handle* client_session) {
auto [server, client] = kernel.CreateSessionPair();
LOG_TRACE(Kernel_SVC, "called");
@ -1675,7 +1674,7 @@ ResultCode SVC::CreateSession(Handle* server_session, Handle* client_session) {
return current_process->handle_table.Create(client_session, std::move(client));
}
ResultCode SVC::AcceptSession(Handle* out_server_session, Handle server_port_handle) {
Result SVC::AcceptSession(Handle* out_server_session, Handle server_port_handle) {
std::shared_ptr<Process> current_process = kernel.GetCurrentProcess();
std::shared_ptr<ServerPort> server_port =
current_process->handle_table.Get<ServerPort>(server_port_handle);
@ -1697,7 +1696,7 @@ static void CopyStringPart(char* out, const char* in, size_t offset, size_t max_
}
}
ResultCode SVC::GetSystemInfo(s64* out, u32 type, s32 param) {
Result SVC::GetSystemInfo(s64* out, u32 type, s32 param) {
LOG_TRACE(Kernel_SVC, "called type={} param={}", type, param);
switch ((SystemInfoType)type) {
@ -1795,7 +1794,7 @@ ResultCode SVC::GetSystemInfo(s64* out, u32 type, s32 param) {
return RESULT_SUCCESS;
}
ResultCode SVC::GetProcessInfo(s64* out, Handle process_handle, u32 type) {
Result SVC::GetProcessInfo(s64* out, Handle process_handle, u32 type) {
LOG_TRACE(Kernel_SVC, "called process=0x{:08X} type={}", process_handle, type);
std::shared_ptr<Process> process =
@ -1868,7 +1867,7 @@ ResultCode SVC::GetProcessInfo(s64* out, Handle process_handle, u32 type) {
return RESULT_SUCCESS;
}
ResultCode SVC::GetThreadInfo(s64* out, Handle thread_handle, u32 type) {
Result SVC::GetThreadInfo(s64* out, Handle thread_handle, u32 type) {
LOG_TRACE(Kernel_SVC, "called thread=0x{:08X} type={}", thread_handle, type);
std::shared_ptr<Thread> thread =
@ -1887,7 +1886,7 @@ ResultCode SVC::GetThreadInfo(s64* out, Handle thread_handle, u32 type) {
return RESULT_SUCCESS;
}
ResultCode SVC::GetProcessList(s32* process_count, VAddr out_process_array,
Result SVC::GetProcessList(s32* process_count, VAddr out_process_array,
s32 out_process_array_count) {
R_UNLESS(memory.IsValidVirtualAddress(*kernel.GetCurrentProcess(), out_process_array),
ERR_INVALID_POINTER);
@ -1905,12 +1904,12 @@ ResultCode SVC::GetProcessList(s32* process_count, VAddr out_process_array,
return RESULT_SUCCESS;
}
ResultCode SVC::InvalidateInstructionCacheRange(u32 addr, u32 size) {
Result SVC::InvalidateInstructionCacheRange(u32 addr, u32 size) {
system.GetRunningCore().InvalidateCacheRange(addr, size);
return RESULT_SUCCESS;
}
ResultCode SVC::InvalidateEntireInstructionCache() {
Result SVC::InvalidateEntireInstructionCache() {
system.GetRunningCore().ClearInstructionCache();
return RESULT_SUCCESS;
}
@ -1926,7 +1925,7 @@ u32 SVC::ConvertVaToPa(u32 addr) {
Memory::FCRAM_PADDR;
}
ResultCode SVC::MapProcessMemoryEx(Handle dst_process_handle, u32 dst_address,
Result SVC::MapProcessMemoryEx(Handle dst_process_handle, u32 dst_address,
Handle src_process_handle, u32 src_address, u32 size) {
std::shared_ptr<Process> dst_process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(dst_process_handle);
@ -1963,7 +1962,7 @@ ResultCode SVC::MapProcessMemoryEx(Handle dst_process_handle, u32 dst_address,
return RESULT_SUCCESS;
}
ResultCode SVC::UnmapProcessMemoryEx(Handle process, u32 dst_address, u32 size) {
Result SVC::UnmapProcessMemoryEx(Handle process, u32 dst_address, u32 size) {
std::shared_ptr<Process> dst_process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(process);
R_UNLESS(dst_process, ERR_INVALID_HANDLE);
@ -1983,7 +1982,7 @@ ResultCode SVC::UnmapProcessMemoryEx(Handle process, u32 dst_address, u32 size)
return RESULT_SUCCESS;
}
ResultCode SVC::ControlProcess(Handle process_handle, u32 process_OP, u32 varg2, u32 varg3) {
Result SVC::ControlProcess(Handle process_handle, u32 process_OP, u32 varg2, u32 varg3) {
std::shared_ptr<Process> process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle);
R_UNLESS(process, ERR_INVALID_HANDLE);

View File

@ -281,21 +281,21 @@ private:
};
template <typename SVCT>
struct WrapPass<SVCT, ResultCode /*empty for T, Ts...*/> {
struct WrapPass<SVCT, Result /*empty for T, Ts...*/> {
// Call function R(Context::svc)(Us...) and transfer the return value to registers
template <typename... Us>
static void Call(Context& context, SVCT svc, Us... u) {
static_assert(std::is_same_v<SVCT, ResultCode (Context::*)(Us...)>);
if constexpr (std::is_void_v<ResultCode>) {
static_assert(std::is_same_v<SVCT, Result (Context::*)(Us...)>);
if constexpr (std::is_void_v<Result>) {
(context.*svc)(u...);
} else {
ResultCode r = (context.*svc)(u...);
Result r = (context.*svc)(u...);
if (r.IsError()) {
LOG_ERROR(Kernel_SVC, "level={} summary={} module={} description={}",
r.level.ExtractValue(r.raw), r.summary.ExtractValue(r.raw),
r.module.ExtractValue(r.raw), r.description.ExtractValue(r.raw));
}
SetParam<INDEX_RETURN, ResultCode, ResultCode, Us...>(context, r);
SetParam<INDEX_RETURN, Result, Result, Us...>(context, r);
}
}
};

View File

@ -344,7 +344,7 @@ ResultVal<std::shared_ptr<Thread>> KernelSystem::CreateThread(
if (!memory.IsValidVirtualAddress(*owner_process, entry_point)) {
LOG_ERROR(Kernel_SVC, "(name={}): invalid entry {:08x}", name, entry_point);
// TODO: Verify error
return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel,
return Result(ErrorDescription::InvalidAddress, ErrorModule::Kernel,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
}
@ -445,7 +445,7 @@ void ThreadManager::Reschedule() {
SwitchContext(next);
}
void Thread::SetWaitSynchronizationResult(ResultCode result) {
void Thread::SetWaitSynchronizationResult(Result result) {
context.cpu_registers[0] = result.raw;
}

View File

@ -243,7 +243,7 @@ public:
* Sets the result after the thread awakens (from either WaitSynchronization SVC)
* @param result Value to set to the returned result
*/
void SetWaitSynchronizationResult(ResultCode result);
void SetWaitSynchronizationResult(Result result);
/**
* Sets the output parameter value after the thread awakens (from WaitSynchronizationN SVC only)

View File

@ -83,7 +83,7 @@ ResultVal<VAddr> VMManager::MapBackingMemoryToBase(VAddr base, u32 region_size,
// Do not try to allocate the block if there are no available addresses within the desired
// region.
if (vma_handle == vma_map.end() || target + size > base + region_size) {
return ResultCode(ErrorDescription::OutOfMemory, ErrorModule::Kernel,
return Result(ErrorDescription::OutOfMemory, ErrorModule::Kernel,
ErrorSummary::OutOfResource, ErrorLevel::Permanent);
}
@ -114,7 +114,7 @@ ResultVal<VMManager::VMAHandle> VMManager::MapBackingMemory(VAddr target, Memory
return MergeAdjacent(vma_handle);
}
ResultCode VMManager::ChangeMemoryState(VAddr target, u32 size, MemoryState expected_state,
Result VMManager::ChangeMemoryState(VAddr target, u32 size, MemoryState expected_state,
VMAPermission expected_perms, MemoryState new_state,
VMAPermission new_perms) {
if (is_locked) {
@ -168,7 +168,7 @@ VMManager::VMAIter VMManager::Unmap(VMAIter vma_handle) {
return MergeAdjacent(vma_handle);
}
ResultCode VMManager::UnmapRange(VAddr target, u32 size) {
Result VMManager::UnmapRange(VAddr target, u32 size) {
ASSERT(!is_locked);
CASCADE_RESULT(VMAIter vma, CarveVMARange(target, size));
@ -197,7 +197,7 @@ VMManager::VMAHandle VMManager::Reprotect(VMAHandle vma_handle, VMAPermission ne
return MergeAdjacent(iter);
}
ResultCode VMManager::ReprotectRange(VAddr target, u32 size, VMAPermission new_perms) {
Result VMManager::ReprotectRange(VAddr target, u32 size, VMAPermission new_perms) {
ASSERT(!is_locked);
CASCADE_RESULT(VMAIter vma, CarveVMARange(target, size));

View File

@ -165,18 +165,18 @@ public:
* @param new_state New MemoryState for the range.
* @param new_perms New VMAPermission for the range.
*/
ResultCode ChangeMemoryState(VAddr target, u32 size, MemoryState expected_state,
Result ChangeMemoryState(VAddr target, u32 size, MemoryState expected_state,
VMAPermission expected_perms, MemoryState new_state,
VMAPermission new_perms);
/// Unmaps a range of addresses, splitting VMAs as necessary.
ResultCode UnmapRange(VAddr target, u32 size);
Result UnmapRange(VAddr target, u32 size);
/// Changes the permissions of the given VMA.
VMAHandle Reprotect(VMAHandle vma, VMAPermission new_perms);
/// Changes the permissions of a range of addresses, splitting VMAs as necessary.
ResultCode ReprotectRange(VAddr target, u32 size, VMAPermission new_perms);
Result ReprotectRange(VAddr target, u32 size, VMAPermission new_perms);
/// Dumps the address space layout to the log, for debugging
void LogLayout(Common::Log::Level log_level) const;

View File

@ -192,7 +192,7 @@ enum class ErrorLevel : u32 {
};
/// Encapsulates a CTR-OS error code, allowing it to be separated into its constituent fields.
union ResultCode {
union Result {
u32 raw;
BitField<0, 10, u32> description;
@ -205,18 +205,18 @@ union ResultCode {
// error
BitField<31, 1, u32> is_error;
constexpr explicit ResultCode(u32 raw) : raw(raw) {}
constexpr explicit Result(u32 raw) : raw(raw) {}
constexpr ResultCode(ErrorDescription description, ErrorModule module, ErrorSummary summary,
constexpr Result(ErrorDescription description, ErrorModule module, ErrorSummary summary,
ErrorLevel level)
: ResultCode(static_cast<u32>(description), module, summary, level) {}
: Result(static_cast<u32>(description), module, summary, level) {}
constexpr ResultCode(u32 description_, ErrorModule module_, ErrorSummary summary_,
constexpr Result(u32 description_, ErrorModule module_, ErrorSummary summary_,
ErrorLevel level_)
: raw(description.FormatValue(description_) | module.FormatValue(module_) |
summary.FormatValue(summary_) | level.FormatValue(level_)) {}
constexpr ResultCode& operator=(const ResultCode& o) = default;
constexpr Result& operator=(const Result& o) = default;
constexpr bool IsSuccess() const {
return is_error.ExtractValue(raw) == 0;
@ -234,22 +234,22 @@ private:
friend class boost::serialization::access;
};
constexpr bool operator==(const ResultCode& a, const ResultCode& b) {
constexpr bool operator==(const Result& a, const Result& b) {
return a.raw == b.raw;
}
constexpr bool operator!=(const ResultCode& a, const ResultCode& b) {
constexpr bool operator!=(const Result& a, const Result& b) {
return a.raw != b.raw;
}
// Convenience functions for creating some common kinds of errors:
/// The default success `ResultCode`.
constexpr ResultCode RESULT_SUCCESS(0);
/// The default success `Result`.
constexpr Result RESULT_SUCCESS(0);
/// Might be returned instead of a dummy success for unimplemented APIs.
constexpr ResultCode UnimplementedFunction(ErrorModule module) {
return ResultCode(ErrorDescription::NotImplemented, module, ErrorSummary::NotSupported,
constexpr Result UnimplementedFunction(ErrorModule module) {
return Result(ErrorDescription::NotImplemented, module, ErrorSummary::NotSupported,
ErrorLevel::Permanent);
}
@ -259,10 +259,10 @@ constexpr ResultCode UnimplementedFunction(ErrorModule module) {
* @note This should only be used when a particular error code
* is not known yet.
*/
constexpr ResultCode RESULT_UNKNOWN(UINT32_MAX);
constexpr Result RESULT_UNKNOWN(UINT32_MAX);
/**
* This is an optional value type. It holds a `ResultCode` and, if that code is ResultSuccess, it
* This is an optional value type. It holds a `Result` and, if that code is ResultSuccess, it
* also holds a result of type `T`. If the code is an error code (not ResultSuccess), then trying
* to access the inner value with operator* is undefined behavior and will assert with Unwrap().
* Users of this class must be cognizant to check the status of the ResultVal with operator bool(),
@ -273,7 +273,7 @@ constexpr ResultCode RESULT_UNKNOWN(UINT32_MAX);
* ResultVal<int> Frobnicate(float strength) {
* if (strength < 0.f || strength > 1.0f) {
* // Can't frobnicate too weakly or too strongly
* return ResultCode(ErrorDescription::OutOfRange, ErrorModule::Common,
* return Result(ErrorDescription::OutOfRange, ErrorModule::Common,
* ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
* } else {
* // Frobnicated! Give caller a cookie
@ -297,7 +297,7 @@ class ResultVal {
public:
constexpr ResultVal() : expected{} {}
constexpr ResultVal(ResultCode code) : expected{Common::Unexpected(code)} {}
constexpr ResultVal(Result code) : expected{Common::Unexpected(code)} {}
template <typename U>
constexpr ResultVal(U&& val) : expected{std::forward<U>(val)} {}
@ -317,7 +317,7 @@ public:
return expected.has_value();
}
[[nodiscard]] constexpr ResultCode Code() const {
[[nodiscard]] constexpr Result Code() const {
return expected.has_value() ? RESULT_SUCCESS : expected.error();
}
@ -385,7 +385,7 @@ public:
private:
// TODO: Replace this with std::expected once it is standardized in the STL.
Common::Expected<T, ResultCode> expected;
Common::Expected<T, Result> expected;
};
/**
@ -401,7 +401,7 @@ private:
target = std::move(*CONCAT2(check_result_L, __LINE__))
/**
* Analogous to CASCADE_RESULT, but for a bare ResultCode. The code will be propagated if
* Analogous to CASCADE_RESULT, but for a bare Result. The code will be propagated if
* non-success, or discarded otherwise.
*/
#define CASCADE_CODE(source) \
@ -409,8 +409,8 @@ private:
if (CONCAT2(check_result_L, __LINE__).IsError()) \
return CONCAT2(check_result_L, __LINE__);
#define R_SUCCEEDED(res) (static_cast<ResultCode>(res).IsSuccess())
#define R_FAILED(res) (static_cast<ResultCode>(res).IsError())
#define R_SUCCEEDED(res) (static_cast<Result>(res).IsSuccess())
#define R_FAILED(res) (static_cast<Result>(res).IsError())
/// Evaluates a boolean expression, and returns a result unless that expression is true.
#define R_UNLESS(expr, res) \

View File

@ -93,7 +93,7 @@ ResultVal<std::size_t> CIAFile::Read(u64 offset, std::size_t length, u8* buffer)
return length;
}
ResultCode CIAFile::WriteTicket() {
Result CIAFile::WriteTicket() {
auto load_result = container.LoadTicket(data, container.GetTicketOffset());
if (load_result != Loader::ResultStatus::Success) {
LOG_ERROR(Service_AM, "Could not read ticket from CIA.");
@ -108,7 +108,7 @@ ResultCode CIAFile::WriteTicket() {
return RESULT_SUCCESS;
}
ResultCode CIAFile::WriteTitleMetadata() {
Result CIAFile::WriteTitleMetadata() {
auto load_result = container.LoadTitleMetadata(data, container.GetTitleMetadataOffset());
if (load_result != Loader::ResultStatus::Success) {
LOG_ERROR(Service_AM, "Could not read title metadata from CIA.");
@ -789,8 +789,8 @@ void Module::Interface::FindDLCContentInfos(Kernel::HLERequestContext& ctx) {
u32 tid_high = static_cast<u32>(title_id >> 32);
if (tid_high != TID_HIGH_DLC) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
rb.Push(ResultCode(ErrCodes::InvalidTIDInList, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Usage));
rb.Push(Result(ErrCodes::InvalidTIDInList, ErrorModule::AM, ErrorSummary::InvalidArgument,
ErrorLevel::Usage));
rb.PushMappedBuffer(content_requested_in);
rb.PushMappedBuffer(content_info_out);
return;
@ -854,8 +854,8 @@ void Module::Interface::ListDLCContentInfos(Kernel::HLERequestContext& ctx) {
u32 tid_high = static_cast<u32>(title_id >> 32);
if (tid_high != TID_HIGH_DLC) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(ResultCode(ErrCodes::InvalidTIDInList, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Usage));
rb.Push(Result(ErrCodes::InvalidTIDInList, ErrorModule::AM, ErrorSummary::InvalidArgument,
ErrorLevel::Usage));
rb.Push<u32>(0);
rb.PushMappedBuffer(content_info_out);
return;
@ -934,8 +934,7 @@ void Module::Interface::GetProgramList(Kernel::HLERequestContext& ctx) {
rb.PushMappedBuffer(title_ids_output);
}
ResultCode GetTitleInfoFromList(std::span<const u64> title_id_list,
Service::FS::MediaType media_type,
Result GetTitleInfoFromList(std::span<const u64> title_id_list, Service::FS::MediaType media_type,
Kernel::MappedBuffer& title_info_out) {
std::size_t write_offset = 0;
for (u32 i = 0; i < title_id_list.size(); i++) {
@ -952,8 +951,8 @@ ResultCode GetTitleInfoFromList(std::span<const u64> title_id_list,
title_info.version = tmd.GetTitleVersion();
title_info.type = tmd.GetTitleType();
} else {
return ResultCode(ErrorDescription::NotFound, ErrorModule::AM,
ErrorSummary::InvalidState, ErrorLevel::Permanent);
return Result(ErrorDescription::NotFound, ErrorModule::AM, ErrorSummary::InvalidState,
ErrorLevel::Permanent);
}
title_info_out.Write(&title_info, write_offset, sizeof(TitleInfo));
write_offset += sizeof(TitleInfo);
@ -973,7 +972,7 @@ void Module::Interface::GetProgramInfos(Kernel::HLERequestContext& ctx) {
std::vector<u64> title_id_list(title_count);
title_id_list_buffer.Read(title_id_list.data(), 0, title_count * sizeof(u64));
ResultCode result = GetTitleInfoFromList(title_id_list, media_type, title_info_out);
Result result = GetTitleInfoFromList(title_id_list, media_type, title_info_out);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
rb.Push(result);
@ -994,14 +993,14 @@ void Module::Interface::DeleteUserProgram(Kernel::HLERequestContext& ctx) {
u8 variation = static_cast<u8>(title_id & 0xFF);
if (category & CATEGORY_SYSTEM || category & CATEGORY_DLP || variation & VARIATION_SYSTEM) {
LOG_ERROR(Service_AM, "Trying to uninstall system app");
rb.Push(ResultCode(ErrCodes::TryingToUninstallSystemApp, ErrorModule::AM,
rb.Push(Result(ErrCodes::TryingToUninstallSystemApp, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Usage));
return;
}
LOG_INFO(Service_AM, "Deleting title 0x{:016x}", title_id);
std::string path = GetTitlePath(media_type, title_id);
if (!FileUtil::Exists(path)) {
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::AM, ErrorSummary::InvalidState,
rb.Push(Result(ErrorDescription::NotFound, ErrorModule::AM, ErrorSummary::InvalidState,
ErrorLevel::Permanent));
LOG_ERROR(Service_AM, "Title not found");
return;
@ -1021,7 +1020,7 @@ void Module::Interface::GetProductCode(Kernel::HLERequestContext& ctx) {
if (!FileUtil::Exists(path)) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::AM, ErrorSummary::InvalidState,
rb.Push(Result(ErrorDescription::NotFound, ErrorModule::AM, ErrorSummary::InvalidState,
ErrorLevel::Permanent));
} else {
struct ProductCode {
@ -1050,13 +1049,13 @@ void Module::Interface::GetDLCTitleInfos(Kernel::HLERequestContext& ctx) {
std::vector<u64> title_id_list(title_count);
title_id_list_buffer.Read(title_id_list.data(), 0, title_count * sizeof(u64));
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
// Validate that DLC TIDs were passed in
for (u32 i = 0; i < title_count; i++) {
u32 tid_high = static_cast<u32>(title_id_list[i] >> 32);
if (tid_high != TID_HIGH_DLC) {
result = ResultCode(ErrCodes::InvalidTIDInList, ErrorModule::AM,
result = Result(ErrCodes::InvalidTIDInList, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Usage);
break;
}
@ -1083,13 +1082,13 @@ void Module::Interface::GetPatchTitleInfos(Kernel::HLERequestContext& ctx) {
std::vector<u64> title_id_list(title_count);
title_id_list_buffer.Read(title_id_list.data(), 0, title_count * sizeof(u64));
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
// Validate that update TIDs were passed in
for (u32 i = 0; i < title_count; i++) {
u32 tid_high = static_cast<u32>(title_id_list[i] >> 32);
if (tid_high != TID_HIGH_UPDATE) {
result = ResultCode(ErrCodes::InvalidTIDInList, ErrorModule::AM,
result = Result(ErrCodes::InvalidTIDInList, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Usage);
break;
}
@ -1142,7 +1141,7 @@ void Module::Interface::GetDLCContentInfoCount(Kernel::HLERequestContext& ctx) {
u32 tid_high = static_cast<u32>(title_id >> 32);
if (tid_high != TID_HIGH_DLC) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(ResultCode(ErrCodes::InvalidTID, ErrorModule::AM, ErrorSummary::InvalidArgument,
rb.Push(Result(ErrCodes::InvalidTID, ErrorModule::AM, ErrorSummary::InvalidArgument,
ErrorLevel::Usage));
rb.Push<u32>(0);
return;
@ -1319,7 +1318,7 @@ void Module::Interface::BeginImportProgram(Kernel::HLERequestContext& ctx) {
if (am->cia_installing) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrCodes::CIACurrentlyInstalling, ErrorModule::AM,
rb.Push(Result(ErrCodes::CIACurrentlyInstalling, ErrorModule::AM,
ErrorSummary::InvalidState, ErrorLevel::Permanent));
return;
}
@ -1344,7 +1343,7 @@ void Module::Interface::BeginImportProgramTemporarily(Kernel::HLERequestContext&
if (am->cia_installing) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrCodes::CIACurrentlyInstalling, ErrorModule::AM,
rb.Push(Result(ErrCodes::CIACurrentlyInstalling, ErrorModule::AM,
ErrorSummary::InvalidState, ErrorLevel::Permanent));
return;
}
@ -1492,8 +1491,8 @@ void Module::Interface::GetProgramInfoFromCia(Kernel::HLERequestContext& ctx) {
FileSys::CIAContainer container;
if (container.Load(*file_res.Unwrap()) != Loader::ResultStatus::Success) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrCodes::InvalidCIAHeader, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidCIAHeader, ErrorModule::AM, ErrorSummary::InvalidArgument,
ErrorLevel::Permanent));
return;
}
@ -1533,8 +1532,8 @@ void Module::Interface::GetSystemMenuDataFromCia(Kernel::HLERequestContext& ctx)
FileSys::CIAContainer container;
if (container.Load(*file) != Loader::ResultStatus::Success) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(ResultCode(ErrCodes::InvalidCIAHeader, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidCIAHeader, ErrorModule::AM, ErrorSummary::InvalidArgument,
ErrorLevel::Permanent));
rb.PushMappedBuffer(output_buffer);
return;
}
@ -1545,8 +1544,8 @@ void Module::Interface::GetSystemMenuDataFromCia(Kernel::HLERequestContext& ctx)
temp.size(), temp.data());
if (read_result.Failed() || *read_result != temp.size()) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(ResultCode(ErrCodes::InvalidCIAHeader, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidCIAHeader, ErrorModule::AM, ErrorSummary::InvalidArgument,
ErrorLevel::Permanent));
rb.PushMappedBuffer(output_buffer);
return;
}
@ -1572,8 +1571,8 @@ void Module::Interface::GetDependencyListFromCia(Kernel::HLERequestContext& ctx)
FileSys::CIAContainer container;
if (container.Load(*file_res.Unwrap()) != Loader::ResultStatus::Success) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrCodes::InvalidCIAHeader, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidCIAHeader, ErrorModule::AM, ErrorSummary::InvalidArgument,
ErrorLevel::Permanent));
return;
}
@ -1599,8 +1598,8 @@ void Module::Interface::GetTransferSizeFromCia(Kernel::HLERequestContext& ctx) {
FileSys::CIAContainer container;
if (container.Load(*file_res.Unwrap()) != Loader::ResultStatus::Success) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrCodes::InvalidCIAHeader, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidCIAHeader, ErrorModule::AM, ErrorSummary::InvalidArgument,
ErrorLevel::Permanent));
return;
}
@ -1623,8 +1622,8 @@ void Module::Interface::GetCoreVersionFromCia(Kernel::HLERequestContext& ctx) {
FileSys::CIAContainer container;
if (container.Load(*file_res.Unwrap()) != Loader::ResultStatus::Success) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrCodes::InvalidCIAHeader, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidCIAHeader, ErrorModule::AM, ErrorSummary::InvalidArgument,
ErrorLevel::Permanent));
return;
}
@ -1648,8 +1647,8 @@ void Module::Interface::GetRequiredSizeFromCia(Kernel::HLERequestContext& ctx) {
FileSys::CIAContainer container;
if (container.Load(*file_res.Unwrap()) != Loader::ResultStatus::Success) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrCodes::InvalidCIAHeader, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidCIAHeader, ErrorModule::AM, ErrorSummary::InvalidArgument,
ErrorLevel::Permanent));
return;
}
@ -1661,7 +1660,7 @@ void Module::Interface::GetRequiredSizeFromCia(Kernel::HLERequestContext& ctx) {
rb.Push(container.GetTitleMetadata().GetContentSizeByIndex(FileSys::TMDContentIndex::Main));
}
ResultCode UninstallProgram(const FS::MediaType media_type, const u64 title_id) {
Result UninstallProgram(const FS::MediaType media_type, const u64 title_id) {
// Use the content folder so we don't delete the user's save data.
const auto path = GetTitlePath(media_type, title_id) + "content/";
if (!FileUtil::Exists(path)) {
@ -1713,8 +1712,8 @@ void Module::Interface::GetMetaSizeFromCia(Kernel::HLERequestContext& ctx) {
if (container.Load(*file_res.Unwrap()) != Loader::ResultStatus::Success) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrCodes::InvalidCIAHeader, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidCIAHeader, ErrorModule::AM, ErrorSummary::InvalidArgument,
ErrorLevel::Permanent));
return;
}
@ -1744,8 +1743,8 @@ void Module::Interface::GetMetaDataFromCia(Kernel::HLERequestContext& ctx) {
FileSys::CIAContainer container;
if (container.Load(*file) != Loader::ResultStatus::Success) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(ResultCode(ErrCodes::InvalidCIAHeader, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidCIAHeader, ErrorModule::AM, ErrorSummary::InvalidArgument,
ErrorLevel::Permanent));
rb.PushMappedBuffer(output_buffer);
return;
}
@ -1755,8 +1754,8 @@ void Module::Interface::GetMetaDataFromCia(Kernel::HLERequestContext& ctx) {
auto read_result = file->Read(container.GetMetadataOffset(), output_size, temp.data());
if (read_result.Failed() || *read_result != output_size) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrCodes::InvalidCIAHeader, ErrorModule::AM,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidCIAHeader, ErrorModule::AM, ErrorSummary::InvalidArgument,
ErrorLevel::Permanent));
return;
}

View File

@ -84,8 +84,8 @@ public:
~CIAFile();
ResultVal<std::size_t> Read(u64 offset, std::size_t length, u8* buffer) const override;
ResultCode WriteTicket();
ResultCode WriteTitleMetadata();
Result WriteTicket();
Result WriteTitleMetadata();
ResultVal<std::size_t> WriteContentData(u64 offset, std::size_t length, const u8* buffer);
ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
const u8* buffer) override;
@ -203,7 +203,7 @@ std::string GetMediaTitlePath(Service::FS::MediaType media_type);
* @param title_id the title ID to uninstall
* @return result of the uninstall operation
*/
ResultCode UninstallProgram(const FS::MediaType media_type, const u64 title_id);
Result UninstallProgram(const FS::MediaType media_type, const u64 title_id);
class Module final {
public:

View File

@ -261,7 +261,7 @@ void AppletManager::CancelAndSendParameter(const MessageParameter& parameter) {
}
}
ResultCode AppletManager::SendParameter(const MessageParameter& parameter) {
Result AppletManager::SendParameter(const MessageParameter& parameter) {
// A new parameter can not be sent if the previous one hasn't been consumed yet
if (next_parameter) {
LOG_WARNING(Service_APT, "Parameter from {:03X} to {:03X} blocked by pending parameter.",
@ -276,12 +276,12 @@ ResultCode AppletManager::SendParameter(const MessageParameter& parameter) {
ResultVal<MessageParameter> AppletManager::GlanceParameter(AppletId app_id) {
if (!next_parameter) {
return ResultCode(ErrorDescription::NoData, ErrorModule::Applet, ErrorSummary::InvalidState,
return Result(ErrorDescription::NoData, ErrorModule::Applet, ErrorSummary::InvalidState,
ErrorLevel::Status);
}
if (next_parameter->destination_id != app_id) {
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
return Result(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
ErrorLevel::Status);
}
@ -348,7 +348,7 @@ ResultVal<AppletManager::InitializeResult> AppletManager::Initialize(AppletId ap
auto slot_data = GetAppletSlot(slot);
if (slot_data->registered) {
LOG_WARNING(Service_APT, "Applet attempted to register in occupied slot {:02X}", slot);
return ResultCode(ErrorDescription::AlreadyExists, ErrorModule::Applet,
return Result(ErrorDescription::AlreadyExists, ErrorModule::Applet,
ErrorSummary::InvalidState, ErrorLevel::Status);
}
@ -377,7 +377,7 @@ ResultVal<AppletManager::InitializeResult> AppletManager::Initialize(AppletId ap
return InitializeResult{slot_data->notification_event, slot_data->parameter_event};
}
ResultCode AppletManager::Enable(AppletAttributes attributes) {
Result AppletManager::Enable(AppletAttributes attributes) {
auto slot = GetAppletSlotFromAttributes(attributes);
if (slot == AppletSlot::Error) {
LOG_WARNING(Service_APT,
@ -409,7 +409,7 @@ ResultCode AppletManager::Enable(AppletAttributes attributes) {
return RESULT_SUCCESS;
}
ResultCode AppletManager::Finalize(AppletId app_id) {
Result AppletManager::Finalize(AppletId app_id) {
auto slot = GetAppletSlotFromId(app_id);
if (slot == AppletSlot::Error) {
return {ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
@ -446,13 +446,13 @@ bool AppletManager::IsRegistered(AppletId app_id) {
ResultVal<AppletAttributes> AppletManager::GetAttribute(AppletId app_id) {
auto slot = GetAppletSlotFromId(app_id);
if (slot == AppletSlot::Error) {
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
return Result(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
ErrorLevel::Status);
}
auto slot_data = GetAppletSlot(slot);
if (!slot_data->registered) {
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
return Result(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
ErrorLevel::Status);
}
@ -470,11 +470,11 @@ ResultVal<Notification> AppletManager::InquireNotification(AppletId app_id) {
}
}
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
return Result(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
ErrorLevel::Status);
}
ResultCode AppletManager::SendNotification(Notification notification) {
Result AppletManager::SendNotification(Notification notification) {
if (active_slot != AppletSlot::Error) {
const auto slot_data = GetAppletSlot(active_slot);
if (slot_data->registered) {
@ -497,7 +497,7 @@ void AppletManager::SendNotificationToAll(Notification notification) {
}
}
ResultCode AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
Result AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
// The real APT service returns an error if there's a pending APT parameter when this function
// is called.
if (next_parameter) {
@ -534,7 +534,7 @@ ResultCode AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
}
}
ResultCode AppletManager::PreloadLibraryApplet(AppletId applet_id) {
Result AppletManager::PreloadLibraryApplet(AppletId applet_id) {
if (GetAppletSlot(AppletSlot::LibraryApplet)->registered) {
return {ErrorDescription::AlreadyExists, ErrorModule::Applet, ErrorSummary::InvalidState,
ErrorLevel::Status};
@ -562,14 +562,13 @@ ResultCode AppletManager::PreloadLibraryApplet(AppletId applet_id) {
}
}
ResultCode AppletManager::FinishPreloadingLibraryApplet(AppletId applet_id) {
Result AppletManager::FinishPreloadingLibraryApplet(AppletId applet_id) {
// TODO(Subv): This function should fail depending on the applet preparation state.
GetAppletSlot(AppletSlot::LibraryApplet)->loaded = true;
return RESULT_SUCCESS;
}
ResultCode AppletManager::StartLibraryApplet(AppletId applet_id,
std::shared_ptr<Kernel::Object> object,
Result AppletManager::StartLibraryApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer) {
active_slot = AppletSlot::LibraryApplet;
@ -588,8 +587,7 @@ ResultCode AppletManager::StartLibraryApplet(AppletId applet_id,
return RESULT_SUCCESS;
}
ResultCode AppletManager::PrepareToCloseLibraryApplet(bool not_pause, bool exiting,
bool jump_home) {
Result AppletManager::PrepareToCloseLibraryApplet(bool not_pause, bool exiting, bool jump_home) {
if (next_parameter) {
return {ErrCodes::ParameterPresent, ErrorModule::Applet, ErrorSummary::InvalidState,
ErrorLevel::Status};
@ -607,7 +605,7 @@ ResultCode AppletManager::PrepareToCloseLibraryApplet(bool not_pause, bool exiti
return RESULT_SUCCESS;
}
ResultCode AppletManager::CloseLibraryApplet(std::shared_ptr<Kernel::Object> object,
Result AppletManager::CloseLibraryApplet(std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer) {
auto slot = GetAppletSlot(AppletSlot::LibraryApplet);
auto destination_id = GetAppletSlotId(last_library_launcher_slot);
@ -633,7 +631,7 @@ ResultCode AppletManager::CloseLibraryApplet(std::shared_ptr<Kernel::Object> obj
return RESULT_SUCCESS;
}
ResultCode AppletManager::CancelLibraryApplet(bool app_exiting) {
Result AppletManager::CancelLibraryApplet(bool app_exiting) {
if (next_parameter) {
return {ErrCodes::ParameterPresent, ErrorModule::Applet, ErrorSummary::InvalidState,
ErrorLevel::Status};
@ -652,7 +650,7 @@ ResultCode AppletManager::CancelLibraryApplet(bool app_exiting) {
});
}
ResultCode AppletManager::SendDspSleep(AppletId from_applet_id,
Result AppletManager::SendDspSleep(AppletId from_applet_id,
std::shared_ptr<Kernel::Object> object) {
auto lib_slot = GetAppletSlotFromPos(AppletPos::Library);
auto lib_app_id =
@ -684,7 +682,7 @@ ResultCode AppletManager::SendDspSleep(AppletId from_applet_id,
return RESULT_SUCCESS;
}
ResultCode AppletManager::SendDspWakeUp(AppletId from_applet_id,
Result AppletManager::SendDspWakeUp(AppletId from_applet_id,
std::shared_ptr<Kernel::Object> object) {
auto lib_slot = GetAppletSlotFromPos(AppletPos::Library);
auto lib_app_id =
@ -717,7 +715,7 @@ ResultCode AppletManager::SendDspWakeUp(AppletId from_applet_id,
return RESULT_SUCCESS;
}
ResultCode AppletManager::PrepareToStartSystemApplet(AppletId applet_id) {
Result AppletManager::PrepareToStartSystemApplet(AppletId applet_id) {
// The real APT service returns an error if there's a pending APT parameter when this function
// is called.
if (next_parameter) {
@ -729,8 +727,7 @@ ResultCode AppletManager::PrepareToStartSystemApplet(AppletId applet_id) {
return RESULT_SUCCESS;
}
ResultCode AppletManager::StartSystemApplet(AppletId applet_id,
std::shared_ptr<Kernel::Object> object,
Result AppletManager::StartSystemApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer) {
auto source_applet_id = AppletId::None;
if (last_system_launcher_slot != AppletSlot::Error) {
@ -772,7 +769,7 @@ ResultCode AppletManager::StartSystemApplet(AppletId applet_id,
return RESULT_SUCCESS;
}
ResultCode AppletManager::PrepareToCloseSystemApplet() {
Result AppletManager::PrepareToCloseSystemApplet() {
if (next_parameter) {
return {ErrCodes::ParameterPresent, ErrorModule::Applet, ErrorSummary::InvalidState,
ErrorLevel::Status};
@ -781,7 +778,7 @@ ResultCode AppletManager::PrepareToCloseSystemApplet() {
return RESULT_SUCCESS;
}
ResultCode AppletManager::CloseSystemApplet(std::shared_ptr<Kernel::Object> object,
Result AppletManager::CloseSystemApplet(std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer) {
ASSERT_MSG(active_slot == AppletSlot::HomeMenu || active_slot == AppletSlot::SystemApplet,
"Attempting to close a system applet from a non-system applet.");
@ -809,7 +806,7 @@ ResultCode AppletManager::CloseSystemApplet(std::shared_ptr<Kernel::Object> obje
return RESULT_SUCCESS;
}
ResultCode AppletManager::OrderToCloseSystemApplet() {
Result AppletManager::OrderToCloseSystemApplet() {
if (active_slot == AppletSlot::Error) {
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
ErrorLevel::Status};
@ -846,7 +843,7 @@ ResultCode AppletManager::OrderToCloseSystemApplet() {
return RESULT_SUCCESS;
}
ResultCode AppletManager::PrepareToJumpToHomeMenu() {
Result AppletManager::PrepareToJumpToHomeMenu() {
if (next_parameter) {
return {ErrCodes::ParameterPresent, ErrorModule::Applet, ErrorSummary::InvalidState,
ErrorLevel::Status};
@ -863,7 +860,7 @@ ResultCode AppletManager::PrepareToJumpToHomeMenu() {
return RESULT_SUCCESS;
}
ResultCode AppletManager::JumpToHomeMenu(std::shared_ptr<Kernel::Object> object,
Result AppletManager::JumpToHomeMenu(std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer) {
if (last_jump_to_home_slot != AppletSlot::Error) {
auto slot_data = GetAppletSlot(last_jump_to_home_slot);
@ -913,7 +910,7 @@ ResultCode AppletManager::JumpToHomeMenu(std::shared_ptr<Kernel::Object> object,
return RESULT_SUCCESS;
}
ResultCode AppletManager::PrepareToLeaveHomeMenu() {
Result AppletManager::PrepareToLeaveHomeMenu() {
if (!GetAppletSlot(AppletSlot::Application)->registered) {
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
ErrorLevel::Status};
@ -927,7 +924,7 @@ ResultCode AppletManager::PrepareToLeaveHomeMenu() {
return RESULT_SUCCESS;
}
ResultCode AppletManager::LeaveHomeMenu(std::shared_ptr<Kernel::Object> object,
Result AppletManager::LeaveHomeMenu(std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer) {
active_slot = AppletSlot::Application;
@ -942,7 +939,7 @@ ResultCode AppletManager::LeaveHomeMenu(std::shared_ptr<Kernel::Object> object,
return RESULT_SUCCESS;
}
ResultCode AppletManager::OrderToCloseApplication() {
Result AppletManager::OrderToCloseApplication() {
if (active_slot == AppletSlot::Error) {
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
ErrorLevel::Status};
@ -967,7 +964,7 @@ ResultCode AppletManager::OrderToCloseApplication() {
return RESULT_SUCCESS;
}
ResultCode AppletManager::PrepareToCloseApplication(bool return_to_sys) {
Result AppletManager::PrepareToCloseApplication(bool return_to_sys) {
if (active_slot == AppletSlot::Error) {
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
ErrorLevel::Status};
@ -1018,7 +1015,7 @@ ResultCode AppletManager::PrepareToCloseApplication(bool return_to_sys) {
return RESULT_SUCCESS;
}
ResultCode AppletManager::CloseApplication(std::shared_ptr<Kernel::Object> object,
Result AppletManager::CloseApplication(std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer) {
ordered_to_close_application = false;
application_cancelled = false;
@ -1079,13 +1076,13 @@ ResultVal<AppletManager::AppletManInfo> AppletManager::GetAppletManInfo(
ResultVal<AppletManager::AppletInfo> AppletManager::GetAppletInfo(AppletId app_id) {
auto slot = GetAppletSlotFromId(app_id);
if (slot == AppletSlot::Error) {
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
return Result(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
ErrorLevel::Status);
}
auto slot_data = GetAppletSlot(slot);
if (!slot_data->registered) {
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
return Result(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
ErrorLevel::Status);
}
@ -1102,14 +1099,13 @@ ResultVal<AppletManager::AppletInfo> AppletManager::GetAppletInfo(AppletId app_i
ResultVal<Service::FS::MediaType> AppletManager::Unknown54(u32 in_param) {
auto slot_data = GetAppletSlot(AppletSlot::Application);
if (slot_data->applet_id == AppletId::None) {
return ResultCode{ErrCodes::AppNotRunning, ErrorModule::Applet, ErrorSummary::InvalidState,
return Result{ErrCodes::AppNotRunning, ErrorModule::Applet, ErrorSummary::InvalidState,
ErrorLevel::Permanent};
}
if (in_param >= 0x80) {
// TODO: Add error description name when the parameter is known.
return ResultCode{10, ErrorModule::Applet, ErrorSummary::InvalidArgument,
ErrorLevel::Usage};
return Result{10, ErrorModule::Applet, ErrorSummary::InvalidArgument, ErrorLevel::Usage};
}
// TODO: Figure out what this logic is actually for.
@ -1154,7 +1150,7 @@ ApplicationRunningMode AppletManager::GetApplicationRunningMode() {
}
}
ResultCode AppletManager::PrepareToDoApplicationJump(u64 title_id, FS::MediaType media_type,
Result AppletManager::PrepareToDoApplicationJump(u64 title_id, FS::MediaType media_type,
ApplicationJumpFlags flags) {
// A running application can not launch another application directly because the applet state
// for the Application slot is already in use. The way this is implemented in hardware is to
@ -1183,7 +1179,7 @@ ResultCode AppletManager::PrepareToDoApplicationJump(u64 title_id, FS::MediaType
return RESULT_SUCCESS;
}
ResultCode AppletManager::DoApplicationJump(const DeliverArg& arg) {
Result AppletManager::DoApplicationJump(const DeliverArg& arg) {
// Note: The real console uses the Home Menu to perform the application jump, it goes
// OldApplication->Home Menu->NewApplication. We do not need to use the Home Menu to do this so
// we launch the new application directly. In the real APT service, the Home Menu must be
@ -1236,7 +1232,7 @@ ResultCode AppletManager::DoApplicationJump(const DeliverArg& arg) {
}
}
ResultCode AppletManager::PrepareToStartApplication(u64 title_id, FS::MediaType media_type) {
Result AppletManager::PrepareToStartApplication(u64 title_id, FS::MediaType media_type) {
if (active_slot == AppletSlot::Error ||
GetAppletSlot(active_slot)->attributes.applet_pos != AppletPos::System) {
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
@ -1262,7 +1258,7 @@ ResultCode AppletManager::PrepareToStartApplication(u64 title_id, FS::MediaType
return RESULT_SUCCESS;
}
ResultCode AppletManager::StartApplication(const std::vector<u8>& parameter,
Result AppletManager::StartApplication(const std::vector<u8>& parameter,
const std::vector<u8>& hmac, bool paused) {
// The delivery argument is always unconditionally set.
deliver_arg.emplace(DeliverArg{parameter, hmac});
@ -1298,7 +1294,7 @@ ResultCode AppletManager::StartApplication(const std::vector<u8>& parameter,
return RESULT_SUCCESS;
}
ResultCode AppletManager::WakeupApplication(std::shared_ptr<Kernel::Object> object,
Result AppletManager::WakeupApplication(std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer) {
// Send a Wakeup signal via the apt parameter to the application once it registers itself.
// The real APT service does this by spin waiting on another thread until the application is
@ -1314,7 +1310,7 @@ ResultCode AppletManager::WakeupApplication(std::shared_ptr<Kernel::Object> obje
return RESULT_SUCCESS;
}
ResultCode AppletManager::CancelApplication() {
Result AppletManager::CancelApplication() {
auto application_slot_data = GetAppletSlot(AppletSlot::Application);
if (application_slot_data->applet_id == AppletId::None) {
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,

View File

@ -264,7 +264,7 @@ public:
*/
void CancelAndSendParameter(const MessageParameter& parameter);
ResultCode SendParameter(const MessageParameter& parameter);
Result SendParameter(const MessageParameter& parameter);
ResultVal<MessageParameter> GlanceParameter(AppletId app_id);
ResultVal<MessageParameter> ReceiveParameter(AppletId app_id);
bool CancelParameter(bool check_sender, AppletId sender_appid, bool check_receiver,
@ -283,51 +283,48 @@ public:
};
ResultVal<InitializeResult> Initialize(AppletId app_id, AppletAttributes attributes);
ResultCode Enable(AppletAttributes attributes);
ResultCode Finalize(AppletId app_id);
Result Enable(AppletAttributes attributes);
Result Finalize(AppletId app_id);
u32 CountRegisteredApplet();
bool IsRegistered(AppletId app_id);
ResultVal<AppletAttributes> GetAttribute(AppletId app_id);
ResultVal<Notification> InquireNotification(AppletId app_id);
ResultCode SendNotification(Notification notification);
Result SendNotification(Notification notification);
void SendNotificationToAll(Notification notification);
ResultCode PrepareToStartLibraryApplet(AppletId applet_id);
ResultCode PreloadLibraryApplet(AppletId applet_id);
ResultCode FinishPreloadingLibraryApplet(AppletId applet_id);
ResultCode StartLibraryApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
Result PrepareToStartLibraryApplet(AppletId applet_id);
Result PreloadLibraryApplet(AppletId applet_id);
Result FinishPreloadingLibraryApplet(AppletId applet_id);
Result StartLibraryApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer);
ResultCode PrepareToCloseLibraryApplet(bool not_pause, bool exiting, bool jump_home);
ResultCode CloseLibraryApplet(std::shared_ptr<Kernel::Object> object,
Result PrepareToCloseLibraryApplet(bool not_pause, bool exiting, bool jump_home);
Result CloseLibraryApplet(std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer);
ResultCode CancelLibraryApplet(bool app_exiting);
Result CancelLibraryApplet(bool app_exiting);
ResultCode SendDspSleep(AppletId from_applet_id, std::shared_ptr<Kernel::Object> object);
ResultCode SendDspWakeUp(AppletId from_applet_id, std::shared_ptr<Kernel::Object> object);
Result SendDspSleep(AppletId from_applet_id, std::shared_ptr<Kernel::Object> object);
Result SendDspWakeUp(AppletId from_applet_id, std::shared_ptr<Kernel::Object> object);
ResultCode PrepareToStartSystemApplet(AppletId applet_id);
ResultCode StartSystemApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
Result PrepareToStartSystemApplet(AppletId applet_id);
Result StartSystemApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer);
ResultCode PrepareToCloseSystemApplet();
ResultCode CloseSystemApplet(std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer);
ResultCode OrderToCloseSystemApplet();
Result PrepareToCloseSystemApplet();
Result CloseSystemApplet(std::shared_ptr<Kernel::Object> object, const std::vector<u8>& buffer);
Result OrderToCloseSystemApplet();
ResultCode PrepareToJumpToHomeMenu();
ResultCode JumpToHomeMenu(std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer);
ResultCode PrepareToLeaveHomeMenu();
ResultCode LeaveHomeMenu(std::shared_ptr<Kernel::Object> object, const std::vector<u8>& buffer);
Result PrepareToJumpToHomeMenu();
Result JumpToHomeMenu(std::shared_ptr<Kernel::Object> object, const std::vector<u8>& buffer);
Result PrepareToLeaveHomeMenu();
Result LeaveHomeMenu(std::shared_ptr<Kernel::Object> object, const std::vector<u8>& buffer);
ResultCode OrderToCloseApplication();
ResultCode PrepareToCloseApplication(bool return_to_sys);
ResultCode CloseApplication(std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer);
Result OrderToCloseApplication();
Result PrepareToCloseApplication(bool return_to_sys);
Result CloseApplication(std::shared_ptr<Kernel::Object> object, const std::vector<u8>& buffer);
ResultCode PrepareToDoApplicationJump(u64 title_id, FS::MediaType media_type,
Result PrepareToDoApplicationJump(u64 title_id, FS::MediaType media_type,
ApplicationJumpFlags flags);
ResultCode DoApplicationJump(const DeliverArg& arg);
Result DoApplicationJump(const DeliverArg& arg);
boost::optional<DeliverArg> ReceiveDeliverArg() {
auto arg = deliver_arg;
@ -369,12 +366,11 @@ public:
std::memcpy(&capture_buffer_info.get(), buffer.data(), sizeof(CaptureBufferInfo));
}
ResultCode PrepareToStartApplication(u64 title_id, FS::MediaType media_type);
ResultCode StartApplication(const std::vector<u8>& parameter, const std::vector<u8>& hmac,
Result PrepareToStartApplication(u64 title_id, FS::MediaType media_type);
Result StartApplication(const std::vector<u8>& parameter, const std::vector<u8>& hmac,
bool paused);
ResultCode WakeupApplication(std::shared_ptr<Kernel::Object> object,
const std::vector<u8>& buffer);
ResultCode CancelApplication();
Result WakeupApplication(std::shared_ptr<Kernel::Object> object, const std::vector<u8>& buffer);
Result CancelApplication();
struct AppletManInfo {
AppletPos active_applet_pos;

View File

@ -564,7 +564,7 @@ void Module::APTInterface::PrepareToDoApplicationJump(Kernel::HLERequestContext&
LOG_INFO(Service_APT, "called title_id={:016X}, media_type={:#01X}, flags={:#08X}", title_id,
media_type, flags);
ResultCode result = apt->applet_manager->PrepareToDoApplicationJump(
Result result = apt->applet_manager->PrepareToDoApplicationJump(
title_id, static_cast<FS::MediaType>(media_type), flags);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
@ -767,8 +767,8 @@ void Module::APTInterface::PrepareToStartNewestHomeMenu(Kernel::HLERequestContex
// This command must return an error when called, otherwise the Home Menu will try to reboot the
// system.
rb.Push(ResultCode(ErrorDescription::AlreadyExists, ErrorModule::Applet,
ErrorSummary::InvalidState, ErrorLevel::Status));
rb.Push(Result(ErrorDescription::AlreadyExists, ErrorModule::Applet, ErrorSummary::InvalidState,
ErrorLevel::Status));
}
void Module::APTInterface::PreloadLibraryApplet(Kernel::HLERequestContext& ctx) {
@ -1341,7 +1341,7 @@ void Module::APTInterface::Unwrap(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS);
} else {
LOG_ERROR(Service_APT, "Failed to decrypt data");
rb.Push(ResultCode(static_cast<ErrorDescription>(1), ErrorModule::PS,
rb.Push(Result(static_cast<ErrorDescription>(1), ErrorModule::PS,
ErrorSummary::WrongArgument, ErrorLevel::Status));
}

View File

@ -38,7 +38,7 @@ void BossTaskProperties::serialize(Archive& ar, const unsigned int) {
}
SERIALIZE_IMPL(BossTaskProperties)
ResultCode OnlineService::InitializeSession(u64 init_program_id) {
Result OnlineService::InitializeSession(u64 init_program_id) {
// The BOSS service uses three databases:
// BOSS_A: Archive? A list of program ids and some properties that are keyed on program
// BOSS_SS: Saved Strings? Includes the url and the other string properties, and also some other
@ -150,7 +150,7 @@ void OnlineService::RegisterTask(const u32 size, Kernel::MappedBuffer& buffer) {
current_props = BossTaskProperties();
}
ResultCode OnlineService::UnregisterTask(const u32 size, Kernel::MappedBuffer& buffer) {
Result OnlineService::UnregisterTask(const u32 size, Kernel::MappedBuffer& buffer) {
if (size > TASK_ID_SIZE) {
LOG_WARNING(Service_BOSS, "TaskId cannot be longer than 8");
// TODO: Proper error code.
@ -334,7 +334,7 @@ std::optional<NsDataEntry> OnlineService::GetNsDataEntryFromId(const u32 ns_data
return *entry_iter;
}
ResultCode OnlineService::GetNsDataHeaderInfo(const u32 ns_data_id, const NsDataHeaderInfoType type,
Result OnlineService::GetNsDataHeaderInfo(const u32 ns_data_id, const NsDataHeaderInfoType type,
const u32 size, Kernel::MappedBuffer& buffer) {
const auto entry = GetNsDataEntryFromId(ns_data_id);
if (!entry.has_value()) {
@ -452,7 +452,7 @@ struct overload : Ts... {
template <class... Ts>
overload(Ts...) -> overload<Ts...>;
ResultCode OnlineService::SendProperty(const u16 id, const u32 size, Kernel::MappedBuffer& buffer) {
Result OnlineService::SendProperty(const u16 id, const u32 size, Kernel::MappedBuffer& buffer) {
const auto property_id = static_cast<PropertyID>(id);
if (!current_props.properties.contains(property_id)) {
LOG_ERROR(Service_BOSS, "Unknown property with ID {:#06x} and size {}", property_id, size);
@ -492,8 +492,7 @@ ResultCode OnlineService::SendProperty(const u16 id, const u32 size, Kernel::Map
return RESULT_SUCCESS;
}
ResultCode OnlineService::ReceiveProperty(const u16 id, const u32 size,
Kernel::MappedBuffer& buffer) {
Result OnlineService::ReceiveProperty(const u16 id, const u32 size, Kernel::MappedBuffer& buffer) {
const auto property_id = static_cast<PropertyID>(id);
if (!current_props.properties.contains(property_id)) {
LOG_ERROR(Service_BOSS, "Unknown property with ID {:#06x} and size {}", property_id, size);

View File

@ -161,18 +161,18 @@ class OnlineService final {
public:
explicit OnlineService(u64 program_id_, u64 extdata_id_);
ResultCode InitializeSession(u64 init_program_id);
Result InitializeSession(u64 init_program_id);
void RegisterTask(const u32 size, Kernel::MappedBuffer& buffer);
ResultCode UnregisterTask(const u32 size, Kernel::MappedBuffer& buffer);
Result UnregisterTask(const u32 size, Kernel::MappedBuffer& buffer);
void GetTaskIdList();
u16 GetNsDataIdList(const u32 filter, const u32 max_entries, Kernel::MappedBuffer& buffer);
std::optional<NsDataEntry> GetNsDataEntryFromId(const u32 ns_data_id);
ResultCode GetNsDataHeaderInfo(const u32 ns_data_id, const NsDataHeaderInfoType type,
Result GetNsDataHeaderInfo(const u32 ns_data_id, const NsDataHeaderInfoType type,
const u32 size, Kernel::MappedBuffer& buffer);
ResultVal<size_t> ReadNsData(const u32 ns_data_id, const u64 offset, const u32 size,
Kernel::MappedBuffer& buffer);
ResultCode SendProperty(const u16 id, const u32 size, Kernel::MappedBuffer& buffer);
ResultCode ReceiveProperty(const u16 id, const u32 size, Kernel::MappedBuffer& buffer);
Result SendProperty(const u16 id, const u32 size, Kernel::MappedBuffer& buffer);
Result ReceiveProperty(const u16 id, const u32 size, Kernel::MappedBuffer& buffer);
private:
std::unique_ptr<FileSys::ArchiveBackend> OpenBossExtData();

View File

@ -77,9 +77,9 @@ constexpr std::array<int, 13> LATENCY_BY_FRAME_RATE{{
33, // Rate_30_To_10
}};
const ResultCode ERROR_INVALID_ENUM_VALUE(ErrorDescription::InvalidEnumValue, ErrorModule::CAM,
const Result ERROR_INVALID_ENUM_VALUE(ErrorDescription::InvalidEnumValue, ErrorModule::CAM,
ErrorSummary::InvalidArgument, ErrorLevel::Usage);
const ResultCode ERROR_OUT_OF_RANGE(ErrorDescription::OutOfRange, ErrorModule::CAM,
const Result ERROR_OUT_OF_RANGE(ErrorDescription::OutOfRange, ErrorModule::CAM,
ErrorSummary::InvalidArgument, ErrorLevel::Usage);
void Module::PortConfig::Clear() {
@ -476,7 +476,7 @@ void Module::Interface::GetMaxLines(Kernel::HLERequestContext& ctx) {
if (lines > height) {
lines = height;
}
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
while (height % lines != 0 || (lines * width * 2 % MIN_TRANSFER_UNIT != 0)) {
--lines;
if (lines == 0) {
@ -980,7 +980,7 @@ void Module::Interface::SetPackageParameterWithoutContext(Kernel::HLERequestCont
}
template <typename PackageParameterType>
ResultCode Module::SetPackageParameter(const PackageParameterType& package) {
Result Module::SetPackageParameter(const PackageParameterType& package) {
const CameraSet camera_select(package.camera_select);
const ContextSet context_select(package.context_select);
@ -1018,7 +1018,7 @@ void Module::Interface::SetPackageParameterWithContext(Kernel::HLERequestContext
rp.PopRaw(package);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
ResultCode result = cam->SetPackageParameter(package);
Result result = cam->SetPackageParameter(package);
rb.Push(result);
LOG_DEBUG(Service_CAM, "called");
@ -1031,7 +1031,7 @@ void Module::Interface::SetPackageParameterWithContextDetail(Kernel::HLERequestC
rp.PopRaw(package);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
ResultCode result = cam->SetPackageParameter(package);
Result result = cam->SetPackageParameter(package);
rb.Push(result);
LOG_DEBUG(Service_CAM, "called");

View File

@ -166,7 +166,7 @@ public:
* 1: u8 selected port
* Outputs:
* 0: 0x00010040
* 1: ResultCode
* 1: Result
*/
void StartCapture(Kernel::HLERequestContext& ctx);
@ -177,7 +177,7 @@ public:
* 1: u8 selected port
* Outputs:
* 0: 0x00020040
* 1: ResultCode
* 1: Result
*/
void StopCapture(Kernel::HLERequestContext& ctx);
@ -188,7 +188,7 @@ public:
* 1: u8 selected port
* Outputs:
* 0: 0x00030080
* 1: ResultCode
* 1: Result
* 2: 0 if not capturing, 1 if capturing
*/
void IsBusy(Kernel::HLERequestContext& ctx);
@ -200,7 +200,7 @@ public:
* 1: u8 selected port
* Outputs:
* 0: 0x00040040
* 2: ResultCode
* 2: Result
*/
void ClearBuffer(Kernel::HLERequestContext& ctx);
@ -211,7 +211,7 @@ public:
* 1: u8 selected port
* Outputs:
* 0: 0x00050042
* 1: ResultCode
* 1: Result
* 2: Descriptor: Handle
* 3: Event handle
*/
@ -224,7 +224,7 @@ public:
* 1: u8 selected port
* Outputs:
* 0: 0x00060042
* 1: ResultCode
* 1: Result
* 2: Descriptor: Handle
* 3: Event handle
*/
@ -244,7 +244,7 @@ public:
* 6: Handle to destination process
* Outputs:
* 0: 0x00070042
* 1: ResultCode
* 1: Result
* 2: Descriptor: Handle
* 3: Handle to event signalled when transfer finishes
*/
@ -257,7 +257,7 @@ public:
* 1: u8 selected port
* Outputs:
* 0: 0x00080080
* 1: ResultCode
* 1: Result
* 2: 0 if not finished, 1 if finished
*/
void IsFinishedReceiving(Kernel::HLERequestContext& ctx);
@ -272,7 +272,7 @@ public:
* 4: u16 Height
* Outputs:
* 0: 0x00090040
* 1: ResultCode
* 1: Result
* @todo figure out how the "buffer" actually works.
*/
void SetTransferLines(Kernel::HLERequestContext& ctx);
@ -285,7 +285,7 @@ public:
* 2: u16 Height
* Outputs:
* 0: 0x000A0080
* 1: ResultCode
* 1: Result
* 2: Maximum number of lines that fit in the buffer
* @todo figure out how the "buffer" actually works.
*/
@ -301,7 +301,7 @@ public:
* 4: u16 Height
* Outputs:
* 0: 0x000B0040
* 1: ResultCode
* 1: Result
* @todo figure out how the "buffer" actually works.
*/
void SetTransferBytes(Kernel::HLERequestContext& ctx);
@ -313,7 +313,7 @@ public:
* 1: u8 selected port
* Outputs:
* 0: 0x000C0080
* 1: ResultCode
* 1: Result
* 2: The number of bytes the buffer contains
* @todo figure out how the "buffer" actually works.
*/
@ -327,7 +327,7 @@ public:
* 2: u16 Height
* Outputs:
* 0: 0x000D0080
* 1: ResultCode
* 1: Result
* 2: Maximum number of bytes that fit in the buffer
* @todo figure out how the "buffer" actually works.
*/
@ -341,7 +341,7 @@ public:
* 2: u8 bool Enable trimming if true
* Outputs:
* 0: 0x000E0040
* 1: ResultCode
* 1: Result
*/
void SetTrimming(Kernel::HLERequestContext& ctx);
@ -352,7 +352,7 @@ public:
* 1: u8 selected port
* Outputs:
* 0: 0x000F0080
* 1: ResultCode
* 1: Result
* 2: u8 bool Enable trimming if true
*/
void IsTrimming(Kernel::HLERequestContext& ctx);
@ -368,7 +368,7 @@ public:
* 5: y end (exclusive)
* Outputs:
* 0: 0x00100040
* 1: ResultCode
* 1: Result
*/
void SetTrimmingParams(Kernel::HLERequestContext& ctx);
@ -380,7 +380,7 @@ public:
*
* Outputs:
* 0: 0x00110140
* 1: ResultCode
* 1: Result
* 2: x start
* 3: y start
* 4: x end (exclusive)
@ -400,7 +400,7 @@ public:
* 5: s16 Camera height
* Outputs:
* 0: 0x00120040
* 1: ResultCode
* 1: Result
*/
void SetTrimmingParamsCenter(Kernel::HLERequestContext& ctx);
@ -411,7 +411,7 @@ public:
* 1: u8 selected camera
* Outputs:
* 0: 0x00130040
* 1: ResultCode
* 1: Result
*/
void Activate(Kernel::HLERequestContext& ctx);
@ -423,7 +423,7 @@ public:
* 2: u8 selected context
* Outputs:
* 0: 0x00140040
* 1: ResultCode
* 1: Result
*/
void SwitchContext(Kernel::HLERequestContext& ctx);
@ -436,7 +436,7 @@ public:
* 3: u8 selected context
* Outputs:
* 0: 0x001D0040
* 1: ResultCode
* 1: Result
*/
void FlipImage(Kernel::HLERequestContext& ctx);
@ -455,7 +455,7 @@ public:
* 8: u8 selected context
* Outputs:
* 0: 0x001E0040
* 1: ResultCode
* 1: Result
*/
void SetDetailSize(Kernel::HLERequestContext& ctx);
@ -468,7 +468,7 @@ public:
* 3: u8 selected context
* Outputs:
* 0: 0x001F0040
* 1: ResultCode
* 1: Result
*/
void SetSize(Kernel::HLERequestContext& ctx);
@ -480,7 +480,7 @@ public:
* 2: u8 Camera framerate (`FrameRate` enum)
* Outputs:
* 0: 0x00200040
* 1: ResultCode
* 1: Result
*/
void SetFrameRate(Kernel::HLERequestContext& ctx);
@ -493,7 +493,7 @@ public:
* 3: u8 selected context
* Outputs:
* 0: 0x00220040
* 1: ResultCode
* 1: Result
*/
void SetEffect(Kernel::HLERequestContext& ctx);
@ -506,7 +506,7 @@ public:
* 3: u8 selected context
* Outputs:
* 0: 0x00250040
* 1: ResultCode
* 1: Result
*/
void SetOutputFormat(Kernel::HLERequestContext& ctx);
@ -518,7 +518,7 @@ public:
* 2: u8 selected camera 2
* Outputs:
* 0: 0x00280040
* 1: ResultCode
* 1: Result
*/
void SynchronizeVsyncTiming(Kernel::HLERequestContext& ctx);
@ -532,7 +532,7 @@ public:
* 65: s64* TimingsOutput
* Outputs:
* 0: 0x002A0042
* 1: ResultCode
* 1: Result
* 2-3: Output static buffer
*/
void GetLatestVsyncTiming(Kernel::HLERequestContext& ctx);
@ -545,7 +545,7 @@ public:
* 0: 0x002B0000
* Outputs:
* 0: 0x002B0440
* 1: ResultCode
* 1: Result
* 2-17: `StereoCameraCalibrationData` structure with calibration values
*/
void GetStereoCameraCalibrationData(Kernel::HLERequestContext& ctx);
@ -559,7 +559,7 @@ public:
* 8-11: unused
* Outputs:
* 0: 0x00330040
* 1: ResultCode
* 1: Result
*/
void SetPackageParameterWithoutContext(Kernel::HLERequestContext& ctx);
@ -572,7 +572,7 @@ public:
* 3-5: unused
* Outputs:
* 0: 0x00340040
* 1: ResultCode
* 1: Result
*/
void SetPackageParameterWithContext(Kernel::HLERequestContext& ctx);
@ -585,7 +585,7 @@ public:
* 5-7: unused
* Outputs:
* 0: 0x00350040
* 1: ResultCode
* 1: Result
*/
void SetPackageParameterWithContextDetail(Kernel::HLERequestContext& ctx);
@ -595,7 +595,7 @@ public:
* 0: 0x00360000
* Outputs:
* 0: 0x00360080
* 1: ResultCode
* 1: Result
* 2: ?
*/
void GetSuitableY2rStandardCoefficient(Kernel::HLERequestContext& ctx);
@ -607,7 +607,7 @@ public:
* 1: u8 Sound ID
* Outputs:
* 0: 0x00380040
* 1: ResultCode
* 1: Result
*/
void PlayShutterSound(Kernel::HLERequestContext& ctx);
@ -617,7 +617,7 @@ public:
* 0: 0x00390000
* Outputs:
* 0: 0x00390040
* 1: ResultCode
* 1: Result
*/
void DriverInitialize(Kernel::HLERequestContext& ctx);
@ -627,7 +627,7 @@ public:
* 0: 0x003A0000
* Outputs:
* 0: 0x003A0040
* 1: ResultCode
* 1: Result
*/
void DriverFinalize(Kernel::HLERequestContext& ctx);
@ -653,7 +653,7 @@ private:
void ActivatePort(int port_id, int camera_id);
template <typename PackageParameterType>
ResultCode SetPackageParameter(const PackageParameterType& package);
Result SetPackageParameter(const PackageParameterType& package);
struct ContextConfig {
Flip flip{Flip::None};

View File

@ -37,10 +37,10 @@ constexpr std::array<CoefficientSet, 4> standard_coefficients{{
{{0x12A, 0x1CA, 0x88, 0x36, 0x21C, -0x1F04, 0x99C, -0x2421}}, // ITU_Rec709_Scaling
}};
ResultCode ConversionConfiguration::SetInputLineWidth(u16 width) {
Result ConversionConfiguration::SetInputLineWidth(u16 width) {
if (width == 0 || width > 1024 || width % 8 != 0) {
return ResultCode(ErrorDescription::OutOfRange, ErrorModule::CAM,
ErrorSummary::InvalidArgument, ErrorLevel::Usage); // 0xE0E053FD
return Result(ErrorDescription::OutOfRange, ErrorModule::CAM, ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E053FD
}
// Note: The hardware uses the register value 0 to represent a width of 1024, so for a width of
@ -50,10 +50,10 @@ ResultCode ConversionConfiguration::SetInputLineWidth(u16 width) {
return RESULT_SUCCESS;
}
ResultCode ConversionConfiguration::SetInputLines(u16 lines) {
Result ConversionConfiguration::SetInputLines(u16 lines) {
if (lines == 0 || lines > 1024) {
return ResultCode(ErrorDescription::OutOfRange, ErrorModule::CAM,
ErrorSummary::InvalidArgument, ErrorLevel::Usage); // 0xE0E053FD
return Result(ErrorDescription::OutOfRange, ErrorModule::CAM, ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E053FD
}
// Note: In what appears to be a bug, the `camera` module does not set the hardware register at
@ -65,11 +65,10 @@ ResultCode ConversionConfiguration::SetInputLines(u16 lines) {
return RESULT_SUCCESS;
}
ResultCode ConversionConfiguration::SetStandardCoefficient(
StandardCoefficient standard_coefficient) {
Result ConversionConfiguration::SetStandardCoefficient(StandardCoefficient standard_coefficient) {
const auto index = static_cast<std::size_t>(standard_coefficient);
if (index >= standard_coefficients.size()) {
return ResultCode(ErrorDescription::InvalidEnumValue, ErrorModule::CAM,
return Result(ErrorDescription::InvalidEnumValue, ErrorModule::CAM,
ErrorSummary::InvalidArgument, ErrorLevel::Usage); // 0xE0E053ED
}
@ -466,7 +465,7 @@ void Y2R_U::GetStandardCoefficient(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Y2R, "called standard_coefficient={} ", index);
} else {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrorDescription::InvalidEnumValue, ErrorModule::CAM,
rb.Push(Result(ErrorDescription::InvalidEnumValue, ErrorModule::CAM,
ErrorSummary::InvalidArgument, ErrorLevel::Usage));
LOG_ERROR(Service_Y2R, "called standard_coefficient={} The argument is invalid!", index);
@ -559,7 +558,7 @@ void Y2R_U::SetPackageParameter(Kernel::HLERequestContext& ctx) {
conversion.rotation = params.rotation;
conversion.block_alignment = params.block_alignment;
ResultCode result = conversion.SetInputLineWidth(params.input_line_width);
Result result = conversion.SetInputLineWidth(params.input_line_width);
if (result.IsError())
goto cleanup;

View File

@ -120,9 +120,9 @@ struct ConversionConfiguration {
/// Output parameters for the conversion results
ConversionBuffer dst;
ResultCode SetInputLineWidth(u16 width);
ResultCode SetInputLines(u16 lines);
ResultCode SetStandardCoefficient(StandardCoefficient standard_coefficient);
Result SetInputLineWidth(u16 width);
Result SetInputLines(u16 lines);
Result SetStandardCoefficient(StandardCoefficient standard_coefficient);
private:
template <class Archive>

View File

@ -79,8 +79,8 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS);
} else {
LOG_DEBUG(Service_CECD, "Failed to open directory: {}", path.AsString());
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC,
ErrorSummary::NotFound, ErrorLevel::Status));
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status));
}
rb.Push<u32>(0); // Zero entries
} else {
@ -103,7 +103,7 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) {
auto file_result = cecd->cecd_system_save_data_archive->OpenFile(path, mode);
if (file_result.Failed()) {
LOG_DEBUG(Service_CECD, "Failed to open file: {}", path.AsString());
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status));
rb.Push<u32>(0); // No file size
} else {
@ -151,8 +151,8 @@ void Module::Interface::Read(Kernel::HLERequestContext& ctx) {
case CecDataPathType::MboxDir:
case CecDataPathType::InboxDir:
case CecDataPathType::OutboxDir:
rb.Push(ResultCode(ErrorDescription::NotAuthorized, ErrorModule::CEC,
ErrorSummary::NotFound, ErrorLevel::Status));
rb.Push(Result(ErrorDescription::NotAuthorized, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status));
rb.Push<u32>(0); // No bytes read
break;
default: // If not directory, then it is a file
@ -228,7 +228,7 @@ void Module::Interface::ReadMessage(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(bytes_read);
} else {
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status));
rb.Push<u32>(0); // zero bytes read
}
@ -320,7 +320,7 @@ void Module::Interface::ReadMessageWithHMAC(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(bytes_read);
} else {
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status));
rb.Push<u32>(0); // zero bytes read
}
@ -356,8 +356,8 @@ void Module::Interface::Write(Kernel::HLERequestContext& ctx) {
case CecDataPathType::MboxDir:
case CecDataPathType::InboxDir:
case CecDataPathType::OutboxDir:
rb.Push(ResultCode(ErrorDescription::NotAuthorized, ErrorModule::CEC,
ErrorSummary::NotFound, ErrorLevel::Status));
rb.Push(Result(ErrorDescription::NotAuthorized, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status));
break;
default: // If not directory, then it is a file
std::vector<u8> buffer(read_buffer_size);
@ -440,7 +440,7 @@ void Module::Interface::WriteMessage(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS);
} else {
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status));
}
@ -527,7 +527,7 @@ void Module::Interface::WriteMessageWithHMAC(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS);
} else {
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status));
}
@ -745,8 +745,8 @@ void Module::Interface::OpenAndWrite(Kernel::HLERequestContext& ctx) {
case CecDataPathType::MboxDir:
case CecDataPathType::InboxDir:
case CecDataPathType::OutboxDir:
rb.Push(ResultCode(ErrorDescription::NotAuthorized, ErrorModule::CEC,
ErrorSummary::NotFound, ErrorLevel::Status));
rb.Push(Result(ErrorDescription::NotAuthorized, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status));
break;
default: // If not directory, then it is a file
auto file_result = cecd->cecd_system_save_data_archive->OpenFile(path, mode);
@ -770,7 +770,7 @@ void Module::Interface::OpenAndWrite(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS);
} else {
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status));
}
}
@ -804,8 +804,8 @@ void Module::Interface::OpenAndRead(Kernel::HLERequestContext& ctx) {
case CecDataPathType::MboxDir:
case CecDataPathType::InboxDir:
case CecDataPathType::OutboxDir:
rb.Push(ResultCode(ErrorDescription::NotAuthorized, ErrorModule::CEC,
ErrorSummary::NotFound, ErrorLevel::Status));
rb.Push(Result(ErrorDescription::NotAuthorized, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status));
rb.Push<u32>(0); // No entries read
break;
default: // If not directory, then it is a file
@ -822,7 +822,7 @@ void Module::Interface::OpenAndRead(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(bytes_read);
} else {
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status));
rb.Push<u32>(0); // No bytes read
}

View File

@ -500,7 +500,7 @@ public:
* Inputs:
* 0: Header Code[0x000E0000]
* Outputs:
* 1: ResultCode
* 1: Result
* 2: CecdState
*/
void GetCecdState(Kernel::HLERequestContext& ctx);
@ -510,7 +510,7 @@ public:
* Inputs:
* 0: Header Code[0x000F0000]
* Outputs:
* 1: ResultCode
* 1: Result
* 3: Event Handle
*/
void GetCecInfoEventHandle(Kernel::HLERequestContext& ctx);
@ -520,7 +520,7 @@ public:
* Inputs:
* 0: Header Code[0x00100000]
* Outputs:
* 1: ResultCode
* 1: Result
* 3: Event Handle
*/
void GetChangeStateEventHandle(Kernel::HLERequestContext& ctx);
@ -593,7 +593,7 @@ public:
* Inputs:
* 0: Header Code[0x40020002]
* Outputs:
* 1: ResultCode
* 1: Result
* 3: Event Handle
*/
void GetCecInfoEventHandleSys(Kernel::HLERequestContext& ctx);

View File

@ -153,8 +153,8 @@ void Module::Interface::GetCountryCodeString(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
if (country_code_id >= country_codes.size() || 0 == country_codes[country_code_id]) {
LOG_ERROR(Service_CFG, "requested country code id={} is invalid", country_code_id);
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
ErrorSummary::WrongArgument, ErrorLevel::Permanent));
rb.Push(Result(ErrorDescription::NotFound, ErrorModule::Config, ErrorSummary::WrongArgument,
ErrorLevel::Permanent));
rb.Skip(1, false);
return;
}
@ -187,8 +187,8 @@ void Module::Interface::GetCountryCodeID(Kernel::HLERequestContext& ctx) {
if (0 == country_code_id) {
LOG_ERROR(Service_CFG, "requested country code name={}{} is invalid",
static_cast<char>(country_code & 0xff), static_cast<char>(country_code >> 8));
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
ErrorSummary::WrongArgument, ErrorLevel::Permanent));
rb.Push(Result(ErrorDescription::NotFound, ErrorModule::Config, ErrorSummary::WrongArgument,
ErrorLevel::Permanent));
rb.Push<u16>(0x00FF);
return;
}
@ -250,7 +250,7 @@ void Module::Interface::GetTransferableId(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
std::array<u8, 12> buffer;
const ResultCode result =
const Result result =
cfg->GetConfigBlock(ConsoleUniqueID2BlockID, 8, AccessFlag::SystemRead, buffer.data());
rb.Push(result);
if (result.IsSuccess()) {
@ -407,7 +407,7 @@ ResultVal<void*> Module::GetConfigBlockPointer(u32 block_id, u32 size, AccessFla
"Config block 0x{:X} with flags {} and size {} was not found, and no default "
"exists.",
block_id, accesss_flag, size);
return ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
return Result(ErrorDescription::NotFound, ErrorModule::Config,
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
}
}
@ -415,14 +415,14 @@ ResultVal<void*> Module::GetConfigBlockPointer(u32 block_id, u32 size, AccessFla
if (False(itr->access_flags & accesss_flag)) {
LOG_ERROR(Service_CFG, "Invalid access flag {:X} for config block 0x{:X} with size {}",
accesss_flag, block_id, size);
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::Config,
return Result(ErrorDescription::NotAuthorized, ErrorModule::Config,
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
}
if (itr->size != size) {
LOG_ERROR(Service_CFG, "Invalid size {} for config block 0x{:X} with flags {}", size,
block_id, accesss_flag);
return ResultCode(ErrorDescription::InvalidSize, ErrorModule::Config,
return Result(ErrorDescription::InvalidSize, ErrorModule::Config,
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
}
@ -437,7 +437,7 @@ ResultVal<void*> Module::GetConfigBlockPointer(u32 block_id, u32 size, AccessFla
return pointer;
}
ResultCode Module::GetConfigBlock(u32 block_id, u32 size, AccessFlag accesss_flag, void* output) {
Result Module::GetConfigBlock(u32 block_id, u32 size, AccessFlag accesss_flag, void* output) {
void* pointer = nullptr;
CASCADE_RESULT(pointer, GetConfigBlockPointer(block_id, size, accesss_flag));
std::memcpy(output, pointer, size);
@ -445,19 +445,18 @@ ResultCode Module::GetConfigBlock(u32 block_id, u32 size, AccessFlag accesss_fla
return RESULT_SUCCESS;
}
ResultCode Module::SetConfigBlock(u32 block_id, u32 size, AccessFlag accesss_flag,
const void* input) {
Result Module::SetConfigBlock(u32 block_id, u32 size, AccessFlag accesss_flag, const void* input) {
void* pointer = nullptr;
CASCADE_RESULT(pointer, GetConfigBlockPointer(block_id, size, accesss_flag));
std::memcpy(pointer, input, size);
return RESULT_SUCCESS;
}
ResultCode Module::CreateConfigBlock(u32 block_id, u16 size, AccessFlag access_flags,
Result Module::CreateConfigBlock(u32 block_id, u16 size, AccessFlag access_flags,
const void* data) {
SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
if (config->total_entries >= CONFIG_FILE_MAX_BLOCK_ENTRIES)
return ResultCode(-1); // TODO(Subv): Find the right error code
return Result(-1); // TODO(Subv): Find the right error code
// Insert the block header with offset 0 for now
config->block_entries[config->total_entries] = {block_id, 0, size, access_flags};
@ -486,12 +485,12 @@ ResultCode Module::CreateConfigBlock(u32 block_id, u16 size, AccessFlag access_f
return RESULT_SUCCESS;
}
ResultCode Module::DeleteConfigNANDSaveFile() {
Result Module::DeleteConfigNANDSaveFile() {
FileSys::Path path("/config");
return cfg_system_save_data_archive->DeleteFile(path);
}
ResultCode Module::UpdateConfigNANDSavegame() {
Result Module::UpdateConfigNANDSavegame() {
FileSys::Mode mode = {};
mode.write_flag.Assign(1);
mode.create_flag.Assign(1);
@ -507,8 +506,8 @@ ResultCode Module::UpdateConfigNANDSavegame() {
return RESULT_SUCCESS;
}
ResultCode Module::FormatConfig() {
ResultCode res = DeleteConfigNANDSaveFile();
Result Module::FormatConfig() {
Result res = DeleteConfigNANDSaveFile();
// The delete command fails if the file doesn't exist, so we have to check that too
if (!res.IsSuccess() && res != FileSys::ERROR_FILE_NOT_FOUND) {
return res;
@ -543,7 +542,7 @@ ResultCode Module::FormatConfig() {
return RESULT_SUCCESS;
}
ResultCode Module::LoadConfigNANDSaveFile() {
Result Module::LoadConfigNANDSaveFile() {
const std::string& nand_directory = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir);
FileSys::ArchiveFactory_SystemSaveData systemsavedata_factory(nand_directory);
@ -777,10 +776,10 @@ std::pair<u32, u64> Module::GenerateConsoleUniqueId() const {
return std::make_pair(random_number, console_id);
}
ResultCode Module::SetConsoleUniqueId(u32 random_number, u64 console_id) {
Result Module::SetConsoleUniqueId(u32 random_number, u64 console_id) {
u64_le console_id_le = console_id;
ResultCode res = SetConfigBlock(ConsoleUniqueID1BlockID, sizeof(console_id_le),
AccessFlag::Global, &console_id_le);
Result res = SetConfigBlock(ConsoleUniqueID1BlockID, sizeof(console_id_le), AccessFlag::Global,
&console_id_le);
if (!res.IsSuccess())
return res;

View File

@ -389,9 +389,9 @@ private:
* @param size The size of the block we want to read
* @param accesss_flag The requested block must have this access flag set
* @param output A pointer where we will write the read data
* @returns ResultCode indicating the result of the operation, 0 on success
* @returns Result indicating the result of the operation, 0 on success
*/
ResultCode GetConfigBlock(u32 block_id, u32 size, AccessFlag accesss_flag, void* output);
Result GetConfigBlock(u32 block_id, u32 size, AccessFlag accesss_flag, void* output);
/**
* Reads data from input and writes to a block with the specified id and flag
@ -402,9 +402,9 @@ private:
* @param size The size of the block we want to write
* @param accesss_flag The target block must have this access flag set
* @param input A pointer where we will read data and write to Config savegame buffer
* @returns ResultCode indicating the result of the operation, 0 on success
* @returns Result indicating the result of the operation, 0 on success
*/
ResultCode SetConfigBlock(u32 block_id, u32 size, AccessFlag accesss_flag, const void* input);
Result SetConfigBlock(u32 block_id, u32 size, AccessFlag accesss_flag, const void* input);
/**
* Creates a block with the specified id and writes the input data to the cfg savegame buffer in
@ -414,28 +414,27 @@ private:
* @param size The size of the block we want to create
* @param accesss_flags The access flags of the new block
* @param data A pointer containing the data we will write to the new block
* @returns ResultCode indicating the result of the operation, 0 on success
* @returns Result indicating the result of the operation, 0 on success
*/
ResultCode CreateConfigBlock(u32 block_id, u16 size, AccessFlag accesss_flags,
const void* data);
Result CreateConfigBlock(u32 block_id, u16 size, AccessFlag accesss_flags, const void* data);
/**
* Deletes the config savegame file from the filesystem, the buffer in memory is not affected
* @returns ResultCode indicating the result of the operation, 0 on success
* @returns Result indicating the result of the operation, 0 on success
*/
ResultCode DeleteConfigNANDSaveFile();
Result DeleteConfigNANDSaveFile();
/**
* Re-creates the config savegame file in memory and the filesystem with the default blocks
* @returns ResultCode indicating the result of the operation, 0 on success
* @returns Result indicating the result of the operation, 0 on success
*/
ResultCode FormatConfig();
Result FormatConfig();
/**
* Open the config savegame file and load it to the memory buffer
* @returns ResultCode indicating the result of the operation, 0 on success
* @returns Result indicating the result of the operation, 0 on success
*/
ResultCode LoadConfigNANDSaveFile();
Result LoadConfigNANDSaveFile();
/**
* Loads MCU specific data
@ -538,7 +537,7 @@ public:
* @param random_number the random_number to set
* @param console_id the console id to set
*/
ResultCode SetConsoleUniqueId(u32 random_number, u64 console_id);
Result SetConsoleUniqueId(u32 random_number, u64 console_id);
/**
* Gets the console unique id from config savegame.
@ -572,9 +571,9 @@ public:
/**
* Writes the config savegame memory buffer to the config savegame file in the filesystem
* @returns ResultCode indicating the result of the operation, 0 on success
* @returns Result indicating the result of the operation, 0 on success
*/
ResultCode UpdateConfigNANDSavegame();
Result UpdateConfigNANDSavegame();
/**
* Saves MCU specific data

View File

@ -240,7 +240,7 @@ void CSND_SND::ExecuteCommands(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
if (!shared_memory) {
rb.Push(ResultCode(ErrorDescription::InvalidResultValue, ErrorModule::CSND,
rb.Push(Result(ErrorDescription::InvalidResultValue, ErrorModule::CSND,
ErrorSummary::InvalidState, ErrorLevel::Status));
LOG_ERROR(Service_CSND, "called, shared memory not allocated");
return;
@ -428,7 +428,7 @@ void CSND_SND::AcquireCapUnit(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
if (capture_units[0] && capture_units[1]) {
LOG_WARNING(Service_CSND, "No more capture units available");
rb.Push(ResultCode(ErrorDescription::InvalidResultValue, ErrorModule::CSND,
rb.Push(Result(ErrorDescription::InvalidResultValue, ErrorModule::CSND,
ErrorSummary::OutOfResource, ErrorLevel::Status));
rb.Skip(1, false);
return;

View File

@ -250,7 +250,7 @@ void DSP_DSP::RegisterInterruptEvents(Kernel::HLERequestContext& ctx) {
"Ran out of space to register interrupts (Attempted to register "
"interrupt={}, channel={}, event={})",
interrupt, channel, event->GetName());
rb.Push(ResultCode(ErrorDescription::InvalidResultValue, ErrorModule::DSP,
rb.Push(Result(ErrorDescription::InvalidResultValue, ErrorModule::DSP,
ErrorSummary::OutOfResource, ErrorLevel::Status));
return;
} else {

View File

@ -155,7 +155,7 @@ static void LogGenericInfo(const ErrInfo::ErrInfoCommon& errinfo_common) {
errinfo_common.app_title_id_low);
LOG_CRITICAL(Service_ERR, "ADR: 0x{:08X}", errinfo_common.pc_address);
ResultCode result_code{errinfo_common.result_code};
Result result_code{errinfo_common.result_code};
LOG_CRITICAL(Service_ERR, "RSL: 0x{:08X}", result_code.raw);
LOG_CRITICAL(Service_ERR, " Level: {}", static_cast<u32>(result_code.level.Value()));
LOG_CRITICAL(Service_ERR, " Summary: {}", static_cast<u32>(result_code.summary.Value()));

View File

@ -66,7 +66,7 @@ ResultVal<ArchiveHandle> ArchiveManager::OpenArchive(ArchiveIdCode id_code,
return next_handle++;
}
ResultCode ArchiveManager::CloseArchive(ArchiveHandle handle) {
Result ArchiveManager::CloseArchive(ArchiveHandle handle) {
if (handle_map.erase(handle) == 0)
return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
else
@ -75,7 +75,7 @@ ResultCode ArchiveManager::CloseArchive(ArchiveHandle handle) {
// TODO(yuriks): This might be what the fs:REG service is for. See the Register/Unregister calls in
// http://3dbrew.org/wiki/Filesystem_services#ProgramRegistry_service_.22fs:REG.22
ResultCode ArchiveManager::RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFactory>&& factory,
Result ArchiveManager::RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFactory>&& factory,
ArchiveIdCode id_code) {
auto result = id_code_map.emplace(id_code, std::move(factory));
@ -106,7 +106,7 @@ ArchiveManager::OpenFileFromArchive(ArchiveHandle archive_handle, const FileSys:
return std::make_pair(std::move(file), open_timeout_ns);
}
ResultCode ArchiveManager::DeleteFileFromArchive(ArchiveHandle archive_handle,
Result ArchiveManager::DeleteFileFromArchive(ArchiveHandle archive_handle,
const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr)
@ -115,7 +115,7 @@ ResultCode ArchiveManager::DeleteFileFromArchive(ArchiveHandle archive_handle,
return archive->DeleteFile(path);
}
ResultCode ArchiveManager::RenameFileBetweenArchives(ArchiveHandle src_archive_handle,
Result ArchiveManager::RenameFileBetweenArchives(ArchiveHandle src_archive_handle,
const FileSys::Path& src_path,
ArchiveHandle dest_archive_handle,
const FileSys::Path& dest_path) {
@ -132,7 +132,7 @@ ResultCode ArchiveManager::RenameFileBetweenArchives(ArchiveHandle src_archive_h
}
}
ResultCode ArchiveManager::DeleteDirectoryFromArchive(ArchiveHandle archive_handle,
Result ArchiveManager::DeleteDirectoryFromArchive(ArchiveHandle archive_handle,
const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr)
@ -141,7 +141,7 @@ ResultCode ArchiveManager::DeleteDirectoryFromArchive(ArchiveHandle archive_hand
return archive->DeleteDirectory(path);
}
ResultCode ArchiveManager::DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle,
Result ArchiveManager::DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle,
const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr)
@ -150,8 +150,8 @@ ResultCode ArchiveManager::DeleteDirectoryRecursivelyFromArchive(ArchiveHandle a
return archive->DeleteDirectoryRecursively(path);
}
ResultCode ArchiveManager::CreateFileInArchive(ArchiveHandle archive_handle,
const FileSys::Path& path, u64 file_size) {
Result ArchiveManager::CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path,
u64 file_size) {
ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr)
return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
@ -159,7 +159,7 @@ ResultCode ArchiveManager::CreateFileInArchive(ArchiveHandle archive_handle,
return archive->CreateFile(path, file_size);
}
ResultCode ArchiveManager::CreateDirectoryFromArchive(ArchiveHandle archive_handle,
Result ArchiveManager::CreateDirectoryFromArchive(ArchiveHandle archive_handle,
const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr)
@ -168,7 +168,7 @@ ResultCode ArchiveManager::CreateDirectoryFromArchive(ArchiveHandle archive_hand
return archive->CreateDirectory(path);
}
ResultCode ArchiveManager::RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle,
Result ArchiveManager::RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle,
const FileSys::Path& src_path,
ArchiveHandle dest_archive_handle,
const FileSys::Path& dest_path) {
@ -208,7 +208,7 @@ ResultVal<u64> ArchiveManager::GetFreeBytesInArchive(ArchiveHandle archive_handl
return archive->GetFreeBytes();
}
ResultCode ArchiveManager::FormatArchive(ArchiveIdCode id_code,
Result ArchiveManager::FormatArchive(ArchiveIdCode id_code,
const FileSys::ArchiveFormatInfo& format_info,
const FileSys::Path& path, u64 program_id) {
auto archive_itr = id_code_map.find(id_code);
@ -229,7 +229,7 @@ ResultVal<FileSys::ArchiveFormatInfo> ArchiveManager::GetArchiveFormatInfo(
return archive->second->GetFormatInfo(archive_path, program_id);
}
ResultCode ArchiveManager::CreateExtSaveData(MediaType media_type, u32 high, u32 low,
Result ArchiveManager::CreateExtSaveData(MediaType media_type, u32 high, u32 low,
std::span<const u8> smdh_icon,
const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) {
@ -246,7 +246,7 @@ ResultCode ArchiveManager::CreateExtSaveData(MediaType media_type, u32 high, u32
auto ext_savedata = static_cast<FileSys::ArchiveFactory_ExtSaveData*>(archive->second.get());
ResultCode result = ext_savedata->Format(path, format_info, program_id);
Result result = ext_savedata->Format(path, format_info, program_id);
if (result.IsError()) {
return result;
}
@ -255,7 +255,7 @@ ResultCode ArchiveManager::CreateExtSaveData(MediaType media_type, u32 high, u32
return RESULT_SUCCESS;
}
ResultCode ArchiveManager::DeleteExtSaveData(MediaType media_type, u32 high, u32 low) {
Result ArchiveManager::DeleteExtSaveData(MediaType media_type, u32 high, u32 low) {
// Construct the binary path to the archive first
FileSys::Path path =
FileSys::ConstructExtDataBinaryPath(static_cast<u32>(media_type), high, low);
@ -267,7 +267,7 @@ ResultCode ArchiveManager::DeleteExtSaveData(MediaType media_type, u32 high, u32
media_type_directory = FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir);
} else {
LOG_ERROR(Service_FS, "Unsupported media type {}", media_type);
return ResultCode(-1); // TODO(Subv): Find the right error code
return Result(-1); // TODO(Subv): Find the right error code
}
// Delete all directories (/user, /boss) and the icon file.
@ -275,11 +275,11 @@ ResultCode ArchiveManager::DeleteExtSaveData(MediaType media_type, u32 high, u32
FileSys::GetExtDataContainerPath(media_type_directory, media_type == MediaType::NAND);
std::string extsavedata_path = FileSys::GetExtSaveDataPath(base_path, path);
if (FileUtil::Exists(extsavedata_path) && !FileUtil::DeleteDirRecursively(extsavedata_path))
return ResultCode(-1); // TODO(Subv): Find the right error code
return Result(-1); // TODO(Subv): Find the right error code
return RESULT_SUCCESS;
}
ResultCode ArchiveManager::DeleteSystemSaveData(u32 high, u32 low) {
Result ArchiveManager::DeleteSystemSaveData(u32 high, u32 low) {
// Construct the binary path to the archive first
const FileSys::Path path = FileSys::ConstructSystemSaveDataBinaryPath(high, low);
@ -287,13 +287,13 @@ ResultCode ArchiveManager::DeleteSystemSaveData(u32 high, u32 low) {
const std::string base_path = FileSys::GetSystemSaveDataContainerPath(nand_directory);
const std::string systemsavedata_path = FileSys::GetSystemSaveDataPath(base_path, path);
if (!FileUtil::DeleteDirRecursively(systemsavedata_path)) {
return ResultCode(-1); // TODO(Subv): Find the right error code
return Result(-1); // TODO(Subv): Find the right error code
}
return RESULT_SUCCESS;
}
ResultCode ArchiveManager::CreateSystemSaveData(u32 high, u32 low) {
Result ArchiveManager::CreateSystemSaveData(u32 high, u32 low) {
// Construct the binary path to the archive first
const FileSys::Path path = FileSys::ConstructSystemSaveDataBinaryPath(high, low);
@ -301,7 +301,7 @@ ResultCode ArchiveManager::CreateSystemSaveData(u32 high, u32 low) {
const std::string base_path = FileSys::GetSystemSaveDataContainerPath(nand_directory);
const std::string systemsavedata_path = FileSys::GetSystemSaveDataPath(base_path, path);
if (!FileUtil::CreateFullPath(systemsavedata_path)) {
return ResultCode(-1); // TODO(Subv): Find the right error code
return Result(-1); // TODO(Subv): Find the right error code
}
return RESULT_SUCCESS;

View File

@ -88,7 +88,7 @@ public:
* Closes an archive
* @param handle Handle to the archive to close
*/
ResultCode CloseArchive(ArchiveHandle handle);
Result CloseArchive(ArchiveHandle handle);
/**
* Open a File from an Archive
@ -106,7 +106,7 @@ public:
* @param path Path to the File inside of the Archive
* @return Whether deletion succeeded
*/
ResultCode DeleteFileFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path);
Result DeleteFileFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path);
/**
* Rename a File between two Archives
@ -116,7 +116,7 @@ public:
* @param dest_path Path to the File inside of the destination Archive
* @return Whether rename succeeded
*/
ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle,
Result RenameFileBetweenArchives(ArchiveHandle src_archive_handle,
const FileSys::Path& src_path,
ArchiveHandle dest_archive_handle,
const FileSys::Path& dest_path);
@ -127,7 +127,7 @@ public:
* @param path Path to the Directory inside of the Archive
* @return Whether deletion succeeded
*/
ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path);
Result DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path);
/**
* Delete a Directory and anything under it from an Archive
@ -135,7 +135,7 @@ public:
* @param path Path to the Directory inside of the Archive
* @return Whether deletion succeeded
*/
ResultCode DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle,
Result DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle,
const FileSys::Path& path);
/**
@ -145,7 +145,7 @@ public:
* @param file_size The size of the new file, filled with zeroes
* @return File creation result code
*/
ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path,
Result CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path,
u64 file_size);
/**
@ -154,7 +154,7 @@ public:
* @param path Path to the Directory inside of the Archive
* @return Whether creation of directory succeeded
*/
ResultCode CreateDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path);
Result CreateDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path);
/**
* Rename a Directory between two Archives
@ -164,7 +164,7 @@ public:
* @param dest_path Path to the Directory inside of the destination Archive
* @return Whether rename succeeded
*/
ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle,
Result RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle,
const FileSys::Path& src_path,
ArchiveHandle dest_archive_handle,
const FileSys::Path& dest_path);
@ -192,9 +192,9 @@ public:
* @param format_info Format information about the new archive
* @param path The path to the archive, if relevant.
* @param program_id the program ID of the client that requests the operation
* @return ResultCode 0 on success or the corresponding code on error
* @return Result 0 on success or the corresponding code on error
*/
ResultCode FormatArchive(ArchiveIdCode id_code, const FileSys::ArchiveFormatInfo& format_info,
Result FormatArchive(ArchiveIdCode id_code, const FileSys::ArchiveFormatInfo& format_info,
const FileSys::Path& path, u64 program_id);
/**
@ -217,10 +217,9 @@ public:
* @param smdh_icon the SMDH icon for this ExtSaveData
* @param format_info Format information about the new archive
* @param program_id the program ID of the client that requests the operation
* @return ResultCode 0 on success or the corresponding code on error
* @return Result 0 on success or the corresponding code on error
*/
ResultCode CreateExtSaveData(MediaType media_type, u32 high, u32 low,
std::span<const u8> smdh_icon,
Result CreateExtSaveData(MediaType media_type, u32 high, u32 low, std::span<const u8> smdh_icon,
const FileSys::ArchiveFormatInfo& format_info, u64 program_id);
/**
@ -228,25 +227,25 @@ public:
* @param media_type The media type of the archive to delete (NAND / SDMC)
* @param high The high word of the extdata id to delete
* @param low The low word of the extdata id to delete
* @return ResultCode 0 on success or the corresponding code on error
* @return Result 0 on success or the corresponding code on error
*/
ResultCode DeleteExtSaveData(MediaType media_type, u32 high, u32 low);
Result DeleteExtSaveData(MediaType media_type, u32 high, u32 low);
/**
* Deletes the SystemSaveData archive folder for the specified save data id
* @param high The high word of the SystemSaveData archive to delete
* @param low The low word of the SystemSaveData archive to delete
* @return ResultCode 0 on success or the corresponding code on error
* @return Result 0 on success or the corresponding code on error
*/
ResultCode DeleteSystemSaveData(u32 high, u32 low);
Result DeleteSystemSaveData(u32 high, u32 low);
/**
* Creates the SystemSaveData archive folder for the specified save data id
* @param high The high word of the SystemSaveData archive to create
* @param low The low word of the SystemSaveData archive to create
* @return ResultCode 0 on success or the corresponding code on error
* @return Result 0 on success or the corresponding code on error
*/
ResultCode CreateSystemSaveData(u32 high, u32 low);
Result CreateSystemSaveData(u32 high, u32 low);
/**
* Returns capacity and free space information about the given media type.
@ -266,7 +265,7 @@ private:
* @param factory File system backend interface to the archive
* @param id_code Id code used to access this type of archive
*/
ResultCode RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFactory>&& factory,
Result RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFactory>&& factory,
ArchiveIdCode id_code);
/// Register all archive types

View File

@ -104,7 +104,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
bool cache_ready;
// Output
ResultCode ret{0};
Result ret{0};
Kernel::MappedBuffer* buffer;
std::unique_ptr<u8*> data;
size_t read_size;

View File

@ -699,7 +699,7 @@ void FS_USER::GetProductInfo(Kernel::HLERequestContext& ctx) {
const auto product_info = GetProductInfo(process_id);
if (!product_info.has_value()) {
rb.Push(ResultCode(FileSys::ErrCodes::ArchiveNotMounted, ErrorModule::FS,
rb.Push(Result(FileSys::ErrCodes::ArchiveNotMounted, ErrorModule::FS,
ErrorSummary::NotFound, ErrorLevel::Status));
return;
}
@ -966,7 +966,7 @@ ResultVal<u16> FS_USER::GetSpecialContentIndexFromGameCard(u64 title_id, Special
if (type > SpecialContentType::DLPChild) {
// Maybe type 4 is New 3DS update/partition 6 but this needs more research
// TODO(B3N30): Find correct result code
return ResultCode(-1);
return Result(-1);
}
switch (type) {
@ -985,7 +985,7 @@ ResultVal<u16> FS_USER::GetSpecialContentIndexFromTMD(MediaType media_type, u64
SpecialContentType type) {
if (type > SpecialContentType::DLPChild) {
// TODO(B3N30): Find correct result code
return ResultCode(-1);
return Result(-1);
}
std::string tmd_path = AM::GetTitleMetadataPath(media_type, title_id);
@ -993,7 +993,7 @@ ResultVal<u16> FS_USER::GetSpecialContentIndexFromTMD(MediaType media_type, u64
FileSys::TitleMetadata tmd;
if (tmd.Load(tmd_path) != Loader::ResultStatus::Success || type == SpecialContentType::Update) {
// TODO(B3N30): Find correct result code
return ResultCode(-1);
return Result(-1);
}
// TODO(B3N30): Does real 3DS check if content exists in TMD?
@ -1007,7 +1007,7 @@ ResultVal<u16> FS_USER::GetSpecialContentIndexFromTMD(MediaType media_type, u64
ASSERT(false);
}
return ResultCode(-1);
return Result(-1);
}
FS_USER::FS_USER(Core::System& system)

View File

@ -72,7 +72,7 @@ public:
if (info != program_info_map.end()) {
return info->second;
} else {
return ResultCode(FileSys::ErrCodes::ArchiveNotMounted, ErrorModule::FS,
return Result(FileSys::ErrCodes::ArchiveNotMounted, ErrorModule::FS,
ErrorSummary::NotFound, ErrorLevel::Status);
}
}

View File

@ -37,16 +37,15 @@ enum {
};
}
constexpr ResultCode RESULT_FIRST_INITIALIZATION(ErrCodes::FirstInitialization, ErrorModule::GX,
constexpr Result RESULT_FIRST_INITIALIZATION(ErrCodes::FirstInitialization, ErrorModule::GX,
ErrorSummary::Success, ErrorLevel::Success);
constexpr ResultCode ERR_REGS_OUTOFRANGE_OR_MISALIGNED(ErrCodes::OutofRangeOrMisalignedAddress,
ErrorModule::GX,
ErrorSummary::InvalidArgument,
constexpr Result ERR_REGS_OUTOFRANGE_OR_MISALIGNED(ErrCodes::OutofRangeOrMisalignedAddress,
ErrorModule::GX, ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E02A01
constexpr ResultCode ERR_REGS_MISALIGNED(ErrorDescription::MisalignedSize, ErrorModule::GX,
constexpr Result ERR_REGS_MISALIGNED(ErrorDescription::MisalignedSize, ErrorModule::GX,
ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E02BF2
constexpr ResultCode ERR_REGS_INVALID_SIZE(ErrorDescription::InvalidSize, ErrorModule::GX,
constexpr Result ERR_REGS_INVALID_SIZE(ErrorDescription::InvalidSize, ErrorModule::GX,
ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E02BEC
@ -96,7 +95,7 @@ void GSP_GPU::ClientDisconnected(std::shared_ptr<Kernel::ServerSession> server_s
* @param data A vector containing the source data
* @return RESULT_SUCCESS if the parameters are valid, error code otherwise
*/
static ResultCode WriteHWRegs(u32 base_address, u32 size_in_bytes, std::span<const u8> data,
static Result WriteHWRegs(u32 base_address, u32 size_in_bytes, std::span<const u8> data,
VideoCore::GPU& gpu) {
// This magic number is verified to be done by the gsp module
const u32 max_size_in_bytes = 0x80;
@ -142,7 +141,7 @@ static ResultCode WriteHWRegs(u32 base_address, u32 size_in_bytes, std::span<con
* @param masks A vector containing the masks
* @return RESULT_SUCCESS if the parameters are valid, error code otherwise
*/
static ResultCode WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, std::span<const u8> data,
static Result WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, std::span<const u8> data,
std::span<const u8> masks, VideoCore::GPU& gpu) {
// This magic number is verified to be done by the gsp module
const u32 max_size_in_bytes = 0x80;

View File

@ -45,25 +45,25 @@ enum {
};
}
const ResultCode ERROR_STATE_ERROR = // 0xD8A0A066
ResultCode(ErrCodes::SessionStateError, ErrorModule::HTTP, ErrorSummary::InvalidState,
const Result ERROR_STATE_ERROR = // 0xD8A0A066
Result(ErrCodes::SessionStateError, ErrorModule::HTTP, ErrorSummary::InvalidState,
ErrorLevel::Permanent);
const ResultCode ERROR_NOT_IMPLEMENTED = // 0xD960A3F4
ResultCode(ErrCodes::NotImplemented, ErrorModule::HTTP, ErrorSummary::Internal,
const Result ERROR_NOT_IMPLEMENTED = // 0xD960A3F4
Result(ErrCodes::NotImplemented, ErrorModule::HTTP, ErrorSummary::Internal,
ErrorLevel::Permanent);
const ResultCode ERROR_TOO_MANY_CLIENT_CERTS = // 0xD8A0A0CB
ResultCode(ErrCodes::TooManyClientCerts, ErrorModule::HTTP, ErrorSummary::InvalidState,
const Result ERROR_TOO_MANY_CLIENT_CERTS = // 0xD8A0A0CB
Result(ErrCodes::TooManyClientCerts, ErrorModule::HTTP, ErrorSummary::InvalidState,
ErrorLevel::Permanent);
const ResultCode ERROR_HEADER_NOT_FOUND = ResultCode(
ErrCodes::HeaderNotFound, ErrorModule::HTTP, ErrorSummary::InvalidState, ErrorLevel::Permanent);
const ResultCode ERROR_BUFFER_SMALL = ResultCode(ErrCodes::BufferTooSmall, ErrorModule::HTTP,
const Result ERROR_HEADER_NOT_FOUND = Result(ErrCodes::HeaderNotFound, ErrorModule::HTTP,
ErrorSummary::InvalidState, ErrorLevel::Permanent);
const Result ERROR_BUFFER_SMALL = Result(ErrCodes::BufferTooSmall, ErrorModule::HTTP,
ErrorSummary::WouldBlock, ErrorLevel::Permanent);
const ResultCode ERROR_WRONG_CERT_ID = // 0xD8E0B839
ResultCode(57, ErrorModule::SSL, ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
const ResultCode ERROR_WRONG_CERT_HANDLE = // 0xD8A0A0C9
ResultCode(201, ErrorModule::HTTP, ErrorSummary::InvalidState, ErrorLevel::Permanent);
const ResultCode ERROR_CERT_ALREADY_SET = // 0xD8A0A03D
ResultCode(61, ErrorModule::HTTP, ErrorSummary::InvalidState, ErrorLevel::Permanent);
const Result ERROR_WRONG_CERT_ID = // 0xD8E0B839
Result(57, ErrorModule::SSL, ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
const Result ERROR_WRONG_CERT_HANDLE = // 0xD8A0A0C9
Result(201, ErrorModule::HTTP, ErrorSummary::InvalidState, ErrorLevel::Permanent);
const Result ERROR_CERT_ALREADY_SET = // 0xD8A0A03D
Result(61, ErrorModule::HTTP, ErrorSummary::InvalidState, ErrorLevel::Permanent);
// Splits URL into its components. Example: https://citra-emu.org:443/index.html
// is_https: true; host: citra-emu.org; port: 443; path: /index.html
@ -358,7 +358,7 @@ void HTTP_C::InitializeConnectionSession(Kernel::HLERequestContext& ctx) {
auto itr = contexts.find(context_handle);
if (itr == contexts.end()) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrCodes::ContextNotFound, ErrorModule::HTTP, ErrorSummary::InvalidState,
rb.Push(Result(ErrCodes::ContextNotFound, ErrorModule::HTTP, ErrorSummary::InvalidState,
ErrorLevel::Permanent));
return;
}
@ -462,7 +462,7 @@ void HTTP_C::ReceiveDataImpl(Kernel::HLERequestContext& ctx, bool timeout) {
Kernel::MappedBuffer* buffer;
bool is_complete;
// Output
ResultCode async_res = RESULT_SUCCESS;
Result async_res = RESULT_SUCCESS;
};
std::shared_ptr<AsyncData> async_data = std::make_shared<AsyncData>();
async_data->timeout = timeout;
@ -490,7 +490,7 @@ void HTTP_C::ReceiveDataImpl(Kernel::HLERequestContext& ctx, bool timeout) {
std::chrono::nanoseconds(async_data->timeout_nanos));
if (wait_res == std::future_status::timeout) {
async_data->async_res =
ResultCode(105, ErrorModule::HTTP, ErrorSummary::NothingHappened,
Result(105, ErrorModule::HTTP, ErrorSummary::NothingHappened,
ErrorLevel::Permanent);
}
} else {
@ -562,8 +562,8 @@ void HTTP_C::CreateContext(Kernel::HLERequestContext& ctx) {
LOG_ERROR(Service_HTTP, "Command called with a bound context");
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(ResultCode(ErrorDescription::NotImplemented, ErrorModule::HTTP,
ErrorSummary::Internal, ErrorLevel::Permanent));
rb.Push(Result(ErrorDescription::NotImplemented, ErrorModule::HTTP, ErrorSummary::Internal,
ErrorLevel::Permanent));
rb.PushMappedBuffer(buffer);
return;
}
@ -574,7 +574,7 @@ void HTTP_C::CreateContext(Kernel::HLERequestContext& ctx) {
LOG_ERROR(Service_HTTP, "Tried to open too many HTTP contexts");
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(ResultCode(ErrCodes::TooManyContexts, ErrorModule::HTTP, ErrorSummary::InvalidState,
rb.Push(Result(ErrCodes::TooManyContexts, ErrorModule::HTTP, ErrorSummary::InvalidState,
ErrorLevel::Permanent));
rb.PushMappedBuffer(buffer);
return;
@ -584,7 +584,7 @@ void HTTP_C::CreateContext(Kernel::HLERequestContext& ctx) {
LOG_ERROR(Service_HTTP, "invalid request method={}", method);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(ResultCode(ErrCodes::InvalidRequestMethod, ErrorModule::HTTP,
rb.Push(Result(ErrCodes::InvalidRequestMethod, ErrorModule::HTTP,
ErrorSummary::InvalidState, ErrorLevel::Permanent));
rb.PushMappedBuffer(buffer);
return;
@ -687,8 +687,8 @@ void HTTP_C::AddRequestHeader(Kernel::HLERequestContext& ctx) {
LOG_ERROR(Service_HTTP,
"Tried to add a request header on a context that has already been started.");
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(ResultCode(ErrCodes::InvalidRequestState, ErrorModule::HTTP,
ErrorSummary::InvalidState, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidRequestState, ErrorModule::HTTP, ErrorSummary::InvalidState,
ErrorLevel::Permanent));
rb.PushMappedBuffer(value_buffer);
return;
}
@ -728,8 +728,8 @@ void HTTP_C::AddPostDataAscii(Kernel::HLERequestContext& ctx) {
LOG_ERROR(Service_HTTP,
"Tried to add post data on a context that has already been started.");
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(ResultCode(ErrCodes::InvalidRequestState, ErrorModule::HTTP,
ErrorSummary::InvalidState, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidRequestState, ErrorModule::HTTP, ErrorSummary::InvalidState,
ErrorLevel::Permanent));
rb.PushMappedBuffer(value_buffer);
return;
}
@ -760,8 +760,8 @@ void HTTP_C::AddPostDataRaw(Kernel::HLERequestContext& ctx) {
LOG_ERROR(Service_HTTP,
"Tried to add post data on a context that has already been started.");
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(ResultCode(ErrCodes::InvalidRequestState, ErrorModule::HTTP,
ErrorSummary::InvalidState, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidRequestState, ErrorModule::HTTP, ErrorSummary::InvalidState,
ErrorLevel::Permanent));
rb.PushMappedBuffer(buffer);
return;
}
@ -859,7 +859,7 @@ void HTTP_C::GetResponseStatusCodeImpl(Kernel::HLERequestContext& ctx, bool time
bool timeout;
u64 timeout_nanos = 0;
// Output
ResultCode async_res = RESULT_SUCCESS;
Result async_res = RESULT_SUCCESS;
};
std::shared_ptr<AsyncData> async_data = std::make_shared<AsyncData>();
@ -887,7 +887,7 @@ void HTTP_C::GetResponseStatusCodeImpl(Kernel::HLERequestContext& ctx, bool time
if (wait_res == std::future_status::timeout) {
LOG_DEBUG(Service_HTTP, "Status code: {}", "timeout");
async_data->async_res =
ResultCode(105, ErrorModule::HTTP, ErrorSummary::NothingHappened,
Result(105, ErrorModule::HTTP, ErrorSummary::NothingHappened,
ErrorLevel::Permanent);
}
} else {
@ -1000,8 +1000,8 @@ void HTTP_C::SetClientCertContext(Kernel::HLERequestContext& ctx) {
LOG_ERROR(Service_HTTP,
"Tried to set a client cert on a context that has already been started.");
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrCodes::InvalidRequestState, ErrorModule::HTTP,
ErrorSummary::InvalidState, ErrorLevel::Permanent));
rb.Push(Result(ErrCodes::InvalidRequestState, ErrorModule::HTTP, ErrorSummary::InvalidState,
ErrorLevel::Permanent));
return;
}
@ -1049,7 +1049,7 @@ void HTTP_C::OpenClientCertContext(Kernel::HLERequestContext& ctx) {
auto* session_data = GetSessionData(ctx.Session());
ASSERT(session_data);
ResultCode result(RESULT_SUCCESS);
Result result(RESULT_SUCCESS);
if (!session_data->initialized) {
LOG_ERROR(Service_HTTP, "Command called without Initialize");
@ -1114,7 +1114,7 @@ void HTTP_C::OpenDefaultClientCertContext(Kernel::HLERequestContext& ctx) {
if (!ClCertA.init) {
LOG_ERROR(Service_HTTP, "called but ClCertA is missing");
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(static_cast<ResultCode>(-1));
rb.Push(static_cast<Result>(-1));
return;
}
@ -1262,8 +1262,8 @@ bool HTTP_C::PerformStateChecks(Kernel::HLERequestContext& ctx, IPC::RequestPars
LOG_ERROR(Service_HTTP, "Tried to make a request without a bound context");
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrorDescription::NotImplemented, ErrorModule::HTTP,
ErrorSummary::Internal, ErrorLevel::Permanent));
rb.Push(Result(ErrorDescription::NotImplemented, ErrorModule::HTTP, ErrorSummary::Internal,
ErrorLevel::Permanent));
return false;
}

View File

@ -402,7 +402,7 @@ void IR_USER::SendIrNop(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS);
} else {
LOG_ERROR(Service_IR, "not connected");
rb.Push(ResultCode(static_cast<ErrorDescription>(13), ErrorModule::IR,
rb.Push(Result(static_cast<ErrorDescription>(13), ErrorModule::IR,
ErrorSummary::InvalidState, ErrorLevel::Status));
}
@ -419,7 +419,7 @@ void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS);
} else {
LOG_ERROR(Service_IR, "failed to release {} packets", count);
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::IR, ErrorSummary::NotFound,
rb.Push(Result(ErrorDescription::NoData, ErrorModule::IR, ErrorSummary::NotFound,
ErrorLevel::Status));
}

View File

@ -12,12 +12,12 @@
namespace Service::LDR {
static const ResultCode ERROR_BUFFER_TOO_SMALL = // 0xE0E12C1F
ResultCode(static_cast<ErrorDescription>(31), ErrorModule::RO, ErrorSummary::InvalidArgument,
static const Result ERROR_BUFFER_TOO_SMALL = // 0xE0E12C1F
Result(static_cast<ErrorDescription>(31), ErrorModule::RO, ErrorSummary::InvalidArgument,
ErrorLevel::Usage);
static constexpr ResultCode CROFormatError(u32 description) {
return ResultCode(static_cast<ErrorDescription>(description), ErrorModule::RO,
static constexpr Result CROFormatError(u32 description) {
return Result(static_cast<ErrorDescription>(description), ErrorModule::RO,
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
}
@ -63,8 +63,8 @@ VAddr CROHelper::SegmentTagToAddress(SegmentTag segment_tag) const {
return entry.offset + segment_tag.offset_into_segment;
}
ResultCode CROHelper::ApplyRelocation(VAddr target_address, RelocationType relocation_type,
u32 addend, u32 symbol_address, u32 target_future_address) {
Result CROHelper::ApplyRelocation(VAddr target_address, RelocationType relocation_type, u32 addend,
u32 symbol_address, u32 target_future_address) {
switch (relocation_type) {
case RelocationType::Nothing:
@ -91,7 +91,7 @@ ResultCode CROHelper::ApplyRelocation(VAddr target_address, RelocationType reloc
return RESULT_SUCCESS;
}
ResultCode CROHelper::ClearRelocation(VAddr target_address, RelocationType relocation_type) {
Result CROHelper::ClearRelocation(VAddr target_address, RelocationType relocation_type) {
switch (relocation_type) {
case RelocationType::Nothing:
break;
@ -114,7 +114,7 @@ ResultCode CROHelper::ClearRelocation(VAddr target_address, RelocationType reloc
return RESULT_SUCCESS;
}
ResultCode CROHelper::ApplyRelocationBatch(VAddr batch, u32 symbol_address, bool reset) {
Result CROHelper::ApplyRelocationBatch(VAddr batch, u32 symbol_address, bool reset) {
if (symbol_address == 0 && !reset)
return CROFormatError(0x10);
@ -129,7 +129,7 @@ ResultCode CROHelper::ApplyRelocationBatch(VAddr batch, u32 symbol_address, bool
return CROFormatError(0x12);
}
ResultCode result = ApplyRelocation(relocation_target, relocation.type, relocation.addend,
Result result = ApplyRelocation(relocation_target, relocation.type, relocation.addend,
symbol_address, relocation_target);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation {:08X}", result.raw);
@ -195,8 +195,8 @@ VAddr CROHelper::FindExportNamedSymbol(const std::string& name) const {
return SegmentTagToAddress(symbol_entry.symbol_position);
}
ResultCode CROHelper::RebaseHeader(u32 cro_size) {
ResultCode error = CROFormatError(0x11);
Result CROHelper::RebaseHeader(u32 cro_size) {
Result error = CROFormatError(0x11);
// verifies magic
if (GetField(Magic) != MAGIC_CRO0)
@ -304,7 +304,7 @@ ResultVal<VAddr> CROHelper::RebaseSegmentTable(u32 cro_size, VAddr data_segment_
return prev_data_segment + module_address;
}
ResultCode CROHelper::RebaseExportNamedSymbolTable() {
Result CROHelper::RebaseExportNamedSymbolTable() {
VAddr export_strings_offset = GetField(ExportStringsOffset);
VAddr export_strings_end = export_strings_offset + GetField(ExportStringsSize);
@ -326,7 +326,7 @@ ResultCode CROHelper::RebaseExportNamedSymbolTable() {
return RESULT_SUCCESS;
}
ResultCode CROHelper::VerifyExportTreeTable() const {
Result CROHelper::VerifyExportTreeTable() const {
u32 tree_num = GetField(ExportTreeNum);
for (u32 i = 0; i < tree_num; ++i) {
ExportTreeEntry entry;
@ -339,7 +339,7 @@ ResultCode CROHelper::VerifyExportTreeTable() const {
return RESULT_SUCCESS;
}
ResultCode CROHelper::RebaseImportModuleTable() {
Result CROHelper::RebaseImportModuleTable() {
VAddr import_strings_offset = GetField(ImportStringsOffset);
VAddr import_strings_end = import_strings_offset + GetField(ImportStringsSize);
VAddr import_indexed_symbol_table_offset = GetField(ImportIndexedSymbolTableOffset);
@ -385,7 +385,7 @@ ResultCode CROHelper::RebaseImportModuleTable() {
return RESULT_SUCCESS;
}
ResultCode CROHelper::RebaseImportNamedSymbolTable() {
Result CROHelper::RebaseImportNamedSymbolTable() {
VAddr import_strings_offset = GetField(ImportStringsOffset);
VAddr import_strings_end = import_strings_offset + GetField(ImportStringsSize);
VAddr external_relocation_table_offset = GetField(ExternalRelocationTableOffset);
@ -419,7 +419,7 @@ ResultCode CROHelper::RebaseImportNamedSymbolTable() {
return RESULT_SUCCESS;
}
ResultCode CROHelper::RebaseImportIndexedSymbolTable() {
Result CROHelper::RebaseImportIndexedSymbolTable() {
VAddr external_relocation_table_offset = GetField(ExternalRelocationTableOffset);
VAddr external_relocation_table_end =
external_relocation_table_offset +
@ -443,7 +443,7 @@ ResultCode CROHelper::RebaseImportIndexedSymbolTable() {
return RESULT_SUCCESS;
}
ResultCode CROHelper::RebaseImportAnonymousSymbolTable() {
Result CROHelper::RebaseImportAnonymousSymbolTable() {
VAddr external_relocation_table_offset = GetField(ExternalRelocationTableOffset);
VAddr external_relocation_table_end =
external_relocation_table_offset +
@ -471,7 +471,7 @@ VAddr CROHelper::GetOnUnresolvedAddress() {
return SegmentTagToAddress(SegmentTag(GetField(OnUnresolvedSegmentTag)));
}
ResultCode CROHelper::ResetExternalRelocations() {
Result CROHelper::ResetExternalRelocations() {
u32 unresolved_symbol = GetOnUnresolvedAddress();
u32 external_relocation_num = GetField(ExternalRelocationNum);
ExternalRelocationEntry relocation;
@ -491,7 +491,7 @@ ResultCode CROHelper::ResetExternalRelocations() {
return CROFormatError(0x12);
}
ResultCode result = ApplyRelocation(relocation_target, relocation.type, relocation.addend,
Result result = ApplyRelocation(relocation_target, relocation.type, relocation.addend,
unresolved_symbol, relocation_target);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation {:08X}", result.raw);
@ -511,7 +511,7 @@ ResultCode CROHelper::ResetExternalRelocations() {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ClearExternalRelocations() {
Result CROHelper::ClearExternalRelocations() {
u32 external_relocation_num = GetField(ExternalRelocationNum);
ExternalRelocationEntry relocation;
@ -524,7 +524,7 @@ ResultCode CROHelper::ClearExternalRelocations() {
return CROFormatError(0x12);
}
ResultCode result = ClearRelocation(relocation_target, relocation.type);
Result result = ClearRelocation(relocation_target, relocation.type);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error clearing relocation {:08X}", result.raw);
return result;
@ -543,7 +543,7 @@ ResultCode CROHelper::ClearExternalRelocations() {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ApplyStaticAnonymousSymbolToCRS(VAddr crs_address) {
Result CROHelper::ApplyStaticAnonymousSymbolToCRS(VAddr crs_address) {
VAddr static_relocation_table_offset = GetField(StaticRelocationTableOffset);
VAddr static_relocation_table_end =
static_relocation_table_offset +
@ -566,7 +566,7 @@ ResultCode CROHelper::ApplyStaticAnonymousSymbolToCRS(VAddr crs_address) {
u32 symbol_address = SegmentTagToAddress(entry.symbol_position);
LOG_TRACE(Service_LDR, "CRO \"{}\" exports 0x{:08X} to the static module", ModuleName(),
symbol_address);
ResultCode result = crs.ApplyRelocationBatch(batch_address, symbol_address);
Result result = crs.ApplyRelocationBatch(batch_address, symbol_address);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
return result;
@ -575,7 +575,7 @@ ResultCode CROHelper::ApplyStaticAnonymousSymbolToCRS(VAddr crs_address) {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ApplyInternalRelocations(u32 old_data_segment_address) {
Result CROHelper::ApplyInternalRelocations(u32 old_data_segment_address) {
u32 segment_num = GetField(SegmentNum);
u32 internal_relocation_num = GetField(InternalRelocationNum);
for (u32 i = 0; i < internal_relocation_num; ++i) {
@ -606,7 +606,7 @@ ResultCode CROHelper::ApplyInternalRelocations(u32 old_data_segment_address) {
GetEntry(system.Memory(), relocation.symbol_segment, symbol_segment);
LOG_TRACE(Service_LDR, "Internally relocates 0x{:08X} with 0x{:08X}", target_address,
symbol_segment.offset);
ResultCode result = ApplyRelocation(target_address, relocation.type, relocation.addend,
Result result = ApplyRelocation(target_address, relocation.type, relocation.addend,
symbol_segment.offset, target_addressB);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation {:08X}", result.raw);
@ -616,7 +616,7 @@ ResultCode CROHelper::ApplyInternalRelocations(u32 old_data_segment_address) {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ClearInternalRelocations() {
Result CROHelper::ClearInternalRelocations() {
u32 internal_relocation_num = GetField(InternalRelocationNum);
for (u32 i = 0; i < internal_relocation_num; ++i) {
InternalRelocationEntry relocation;
@ -627,7 +627,7 @@ ResultCode CROHelper::ClearInternalRelocations() {
return CROFormatError(0x15);
}
ResultCode result = ClearRelocation(target_address, relocation.type);
Result result = ClearRelocation(target_address, relocation.type);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error clearing relocation {:08X}", result.raw);
return result;
@ -747,7 +747,7 @@ void CROHelper::UnrebaseHeader() {
}
}
ResultCode CROHelper::ApplyImportNamedSymbol(VAddr crs_address) {
Result CROHelper::ApplyImportNamedSymbol(VAddr crs_address) {
u32 import_strings_size = GetField(ImportStringsSize);
u32 symbol_import_num = GetField(ImportNamedSymbolNum);
for (u32 i = 0; i < symbol_import_num; ++i) {
@ -759,7 +759,7 @@ ResultCode CROHelper::ApplyImportNamedSymbol(VAddr crs_address) {
sizeof(ExternalRelocationEntry));
if (!relocation_entry.is_batch_resolved) {
ResultCode result = ForEachAutoLinkCRO(
Result result = ForEachAutoLinkCRO(
process, system, crs_address, [&](CROHelper source) -> ResultVal<bool> {
std::string symbol_name =
system.Memory().ReadCString(entry.name_offset, import_strings_size);
@ -769,7 +769,7 @@ ResultCode CROHelper::ApplyImportNamedSymbol(VAddr crs_address) {
LOG_TRACE(Service_LDR, "CRO \"{}\" imports \"{}\" from \"{}\"",
ModuleName(), symbol_name, source.ModuleName());
ResultCode result = ApplyRelocationBatch(relocation_addr, symbol_address);
Result result = ApplyRelocationBatch(relocation_addr, symbol_address);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}",
result.raw);
@ -789,7 +789,7 @@ ResultCode CROHelper::ApplyImportNamedSymbol(VAddr crs_address) {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ResetImportNamedSymbol() {
Result CROHelper::ResetImportNamedSymbol() {
u32 unresolved_symbol = GetOnUnresolvedAddress();
u32 symbol_import_num = GetField(ImportNamedSymbolNum);
@ -801,7 +801,7 @@ ResultCode CROHelper::ResetImportNamedSymbol() {
system.Memory().ReadBlock(process, relocation_addr, &relocation_entry,
sizeof(ExternalRelocationEntry));
ResultCode result = ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
Result result = ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error reseting relocation batch {:08X}", result.raw);
return result;
@ -810,7 +810,7 @@ ResultCode CROHelper::ResetImportNamedSymbol() {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ResetImportIndexedSymbol() {
Result CROHelper::ResetImportIndexedSymbol() {
u32 unresolved_symbol = GetOnUnresolvedAddress();
u32 import_num = GetField(ImportIndexedSymbolNum);
@ -822,7 +822,7 @@ ResultCode CROHelper::ResetImportIndexedSymbol() {
system.Memory().ReadBlock(process, relocation_addr, &relocation_entry,
sizeof(ExternalRelocationEntry));
ResultCode result = ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
Result result = ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error reseting relocation batch {:08X}", result.raw);
return result;
@ -831,7 +831,7 @@ ResultCode CROHelper::ResetImportIndexedSymbol() {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ResetImportAnonymousSymbol() {
Result CROHelper::ResetImportAnonymousSymbol() {
u32 unresolved_symbol = GetOnUnresolvedAddress();
u32 import_num = GetField(ImportAnonymousSymbolNum);
@ -843,7 +843,7 @@ ResultCode CROHelper::ResetImportAnonymousSymbol() {
system.Memory().ReadBlock(process, relocation_addr, &relocation_entry,
sizeof(ExternalRelocationEntry));
ResultCode result = ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
Result result = ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error reseting relocation batch {:08X}", result.raw);
return result;
@ -852,7 +852,7 @@ ResultCode CROHelper::ResetImportAnonymousSymbol() {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ApplyModuleImport(VAddr crs_address) {
Result CROHelper::ApplyModuleImport(VAddr crs_address) {
u32 import_strings_size = GetField(ImportStringsSize);
u32 import_module_num = GetField(ImportModuleNum);
@ -862,7 +862,7 @@ ResultCode CROHelper::ApplyModuleImport(VAddr crs_address) {
std::string want_cro_name =
system.Memory().ReadCString(entry.name_offset, import_strings_size);
ResultCode result = ForEachAutoLinkCRO(
Result result = ForEachAutoLinkCRO(
process, system, crs_address, [&](CROHelper source) -> ResultVal<bool> {
if (want_cro_name == source.ModuleName()) {
LOG_INFO(Service_LDR, "CRO \"{}\" imports {} indexed symbols from \"{}\"",
@ -874,7 +874,7 @@ ResultCode CROHelper::ApplyModuleImport(VAddr crs_address) {
source.GetEntry(system.Memory(), im.index, ex);
u32 symbol_address = source.SegmentTagToAddress(ex.symbol_position);
LOG_TRACE(Service_LDR, " Imports 0x{:08X}", symbol_address);
ResultCode result =
Result result =
ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}",
@ -889,7 +889,7 @@ ResultCode CROHelper::ApplyModuleImport(VAddr crs_address) {
entry.GetImportAnonymousSymbolEntry(process, system.Memory(), j, im);
u32 symbol_address = source.SegmentTagToAddress(im.symbol_position);
LOG_TRACE(Service_LDR, " Imports 0x{:08X}", symbol_address);
ResultCode result =
Result result =
ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}",
@ -908,7 +908,7 @@ ResultCode CROHelper::ApplyModuleImport(VAddr crs_address) {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ApplyExportNamedSymbol(CROHelper target) {
Result CROHelper::ApplyExportNamedSymbol(CROHelper target) {
LOG_DEBUG(Service_LDR, "CRO \"{}\" exports named symbols to \"{}\"", ModuleName(),
target.ModuleName());
u32 target_import_strings_size = target.GetField(ImportStringsSize);
@ -927,7 +927,7 @@ ResultCode CROHelper::ApplyExportNamedSymbol(CROHelper target) {
u32 symbol_address = FindExportNamedSymbol(symbol_name);
if (symbol_address != 0) {
LOG_TRACE(Service_LDR, " exports symbol \"{}\"", symbol_name);
ResultCode result = target.ApplyRelocationBatch(relocation_addr, symbol_address);
Result result = target.ApplyRelocationBatch(relocation_addr, symbol_address);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
return result;
@ -938,7 +938,7 @@ ResultCode CROHelper::ApplyExportNamedSymbol(CROHelper target) {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ResetExportNamedSymbol(CROHelper target) {
Result CROHelper::ResetExportNamedSymbol(CROHelper target) {
LOG_DEBUG(Service_LDR, "CRO \"{}\" unexports named symbols to \"{}\"", ModuleName(),
target.ModuleName());
u32 unresolved_symbol = target.GetOnUnresolvedAddress();
@ -958,7 +958,7 @@ ResultCode CROHelper::ResetExportNamedSymbol(CROHelper target) {
u32 symbol_address = FindExportNamedSymbol(symbol_name);
if (symbol_address != 0) {
LOG_TRACE(Service_LDR, " unexports symbol \"{}\"", symbol_name);
ResultCode result =
Result result =
target.ApplyRelocationBatch(relocation_addr, unresolved_symbol, true);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
@ -970,7 +970,7 @@ ResultCode CROHelper::ResetExportNamedSymbol(CROHelper target) {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ApplyModuleExport(CROHelper target) {
Result CROHelper::ApplyModuleExport(CROHelper target) {
std::string module_name = ModuleName();
u32 target_import_string_size = target.GetField(ImportStringsSize);
u32 target_import_module_num = target.GetField(ImportModuleNum);
@ -991,8 +991,7 @@ ResultCode CROHelper::ApplyModuleExport(CROHelper target) {
GetEntry(system.Memory(), im.index, ex);
u32 symbol_address = SegmentTagToAddress(ex.symbol_position);
LOG_TRACE(Service_LDR, " exports symbol 0x{:08X}", symbol_address);
ResultCode result =
target.ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
Result result = target.ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
return result;
@ -1006,8 +1005,7 @@ ResultCode CROHelper::ApplyModuleExport(CROHelper target) {
entry.GetImportAnonymousSymbolEntry(process, system.Memory(), j, im);
u32 symbol_address = SegmentTagToAddress(im.symbol_position);
LOG_TRACE(Service_LDR, " exports symbol 0x{:08X}", symbol_address);
ResultCode result =
target.ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
Result result = target.ApplyRelocationBatch(im.relocation_batch_offset, symbol_address);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
return result;
@ -1018,7 +1016,7 @@ ResultCode CROHelper::ApplyModuleExport(CROHelper target) {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ResetModuleExport(CROHelper target) {
Result CROHelper::ResetModuleExport(CROHelper target) {
u32 unresolved_symbol = target.GetOnUnresolvedAddress();
std::string module_name = ModuleName();
@ -1037,7 +1035,7 @@ ResultCode CROHelper::ResetModuleExport(CROHelper target) {
for (u32 j = 0; j < entry.import_indexed_symbol_num; ++j) {
ImportIndexedSymbolEntry im;
entry.GetImportIndexedSymbolEntry(process, system.Memory(), j, im);
ResultCode result =
Result result =
target.ApplyRelocationBatch(im.relocation_batch_offset, unresolved_symbol, true);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
@ -1050,7 +1048,7 @@ ResultCode CROHelper::ResetModuleExport(CROHelper target) {
for (u32 j = 0; j < entry.import_anonymous_symbol_num; ++j) {
ImportAnonymousSymbolEntry im;
entry.GetImportAnonymousSymbolEntry(process, system.Memory(), j, im);
ResultCode result =
Result result =
target.ApplyRelocationBatch(im.relocation_batch_offset, unresolved_symbol, true);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}", result.raw);
@ -1062,7 +1060,7 @@ ResultCode CROHelper::ResetModuleExport(CROHelper target) {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ApplyExitRelocations(VAddr crs_address) {
Result CROHelper::ApplyExitRelocations(VAddr crs_address) {
u32 import_strings_size = GetField(ImportStringsSize);
u32 symbol_import_num = GetField(ImportNamedSymbolNum);
for (u32 i = 0; i < symbol_import_num; ++i) {
@ -1075,7 +1073,7 @@ ResultCode CROHelper::ApplyExitRelocations(VAddr crs_address) {
if (system.Memory().ReadCString(entry.name_offset, import_strings_size) ==
"__aeabi_atexit") {
ResultCode result = ForEachAutoLinkCRO(
Result result = ForEachAutoLinkCRO(
process, system, crs_address, [&](CROHelper source) -> ResultVal<bool> {
u32 symbol_address = source.FindExportNamedSymbol("nnroAeabiAtexit_");
@ -1083,7 +1081,7 @@ ResultCode CROHelper::ApplyExitRelocations(VAddr crs_address) {
LOG_DEBUG(Service_LDR, "CRO \"{}\" import exit function from \"{}\"",
ModuleName(), source.ModuleName());
ResultCode result = ApplyRelocationBatch(relocation_addr, symbol_address);
Result result = ApplyRelocationBatch(relocation_addr, symbol_address);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error applying relocation batch {:08X}",
result.raw);
@ -1111,9 +1109,9 @@ ResultCode CROHelper::ApplyExitRelocations(VAddr crs_address) {
* whole string (table) is terminated properly, despite that it is not actually one string.
* @param address the virtual address of the string (table)
* @param size the size of the string (table), including the terminating 0
* @returns ResultCode RESULT_SUCCESS if the size matches, otherwise error code.
* @returns Result RESULT_SUCCESS if the size matches, otherwise error code.
*/
static ResultCode VerifyStringTableLength(Memory::MemorySystem& memory, VAddr address, u32 size) {
static Result VerifyStringTableLength(Memory::MemorySystem& memory, VAddr address, u32 size) {
if (size != 0) {
if (memory.Read8(address + size - 1) != 0)
return CROFormatError(0x0B);
@ -1121,11 +1119,11 @@ static ResultCode VerifyStringTableLength(Memory::MemorySystem& memory, VAddr ad
return RESULT_SUCCESS;
}
ResultCode CROHelper::Rebase(VAddr crs_address, u32 cro_size, VAddr data_segment_addresss,
Result CROHelper::Rebase(VAddr crs_address, u32 cro_size, VAddr data_segment_addresss,
u32 data_segment_size, VAddr bss_segment_address, u32 bss_segment_size,
bool is_crs) {
ResultCode result = RebaseHeader(cro_size);
Result result = RebaseHeader(cro_size);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error rebasing header {:08X}", result.raw);
return result;
@ -1248,13 +1246,13 @@ void CROHelper::Unrebase(bool is_crs) {
UnrebaseHeader();
}
ResultCode CROHelper::VerifyHash(u32 cro_size, VAddr crr) const {
Result CROHelper::VerifyHash(u32 cro_size, VAddr crr) const {
// TODO(wwylele): actually verify the hash
return RESULT_SUCCESS;
}
ResultCode CROHelper::Link(VAddr crs_address, bool link_on_load_bug_fix) {
ResultCode result = RESULT_SUCCESS;
Result CROHelper::Link(VAddr crs_address, bool link_on_load_bug_fix) {
Result result = RESULT_SUCCESS;
{
VAddr data_segment_address = 0;
@ -1309,7 +1307,7 @@ ResultCode CROHelper::Link(VAddr crs_address, bool link_on_load_bug_fix) {
// Exports symbols to other modules
result = ForEachAutoLinkCRO(process, system, crs_address,
[this](CROHelper target) -> ResultVal<bool> {
ResultCode result = ApplyExportNamedSymbol(target);
Result result = ApplyExportNamedSymbol(target);
if (result.IsError())
return result;
@ -1327,10 +1325,10 @@ ResultCode CROHelper::Link(VAddr crs_address, bool link_on_load_bug_fix) {
return RESULT_SUCCESS;
}
ResultCode CROHelper::Unlink(VAddr crs_address) {
Result CROHelper::Unlink(VAddr crs_address) {
// Resets all imported named symbols
ResultCode result = ResetImportNamedSymbol();
Result result = ResetImportNamedSymbol();
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error resetting symbol import {:08X}", result.raw);
return result;
@ -1354,7 +1352,7 @@ ResultCode CROHelper::Unlink(VAddr crs_address) {
// Note: the RO service seems only searching in auto-link modules
result = ForEachAutoLinkCRO(process, system, crs_address,
[this](CROHelper target) -> ResultVal<bool> {
ResultCode result = ResetExportNamedSymbol(target);
Result result = ResetExportNamedSymbol(target);
if (result.IsError())
return result;
@ -1372,8 +1370,8 @@ ResultCode CROHelper::Unlink(VAddr crs_address) {
return RESULT_SUCCESS;
}
ResultCode CROHelper::ClearRelocations() {
ResultCode result = ClearExternalRelocations();
Result CROHelper::ClearRelocations() {
Result result = ClearExternalRelocations();
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error clearing external relocations {:08X}", result.raw);
return result;

View File

@ -51,9 +51,9 @@ public:
* @param bss_segment_address the buffer address for .bss segment
* @param bss_segment_size the buffer size for .bss segment
* @param is_crs true if the module itself is the static module
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode Rebase(VAddr crs_address, u32 cro_size, VAddr data_segment_address,
Result Rebase(VAddr crs_address, u32 cro_size, VAddr data_segment_address,
u32 data_segment_size, VAddr bss_segment_address, u32 bss_segment_size,
bool is_crs);
@ -67,30 +67,30 @@ public:
* Verifies module hash by CRR.
* @param cro_size the size of the CRO
* @param crr the virtual address of the CRR
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode VerifyHash(u32 cro_size, VAddr crr) const;
Result VerifyHash(u32 cro_size, VAddr crr) const;
/**
* Links this module with all registered auto-link module.
* @param crs_address the virtual address of the static module
* @param link_on_load_bug_fix true if links when loading and fixes the bug
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode Link(VAddr crs_address, bool link_on_load_bug_fix);
Result Link(VAddr crs_address, bool link_on_load_bug_fix);
/**
* Unlinks this module with other modules.
* @param crs_address the virtual address of the static module
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode Unlink(VAddr crs_address);
Result Unlink(VAddr crs_address);
/**
* Clears all relocations to zero.
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ClearRelocations();
Result ClearRelocations();
/// Initialize this module as the static module (CRS)
void InitCRS();
@ -465,12 +465,12 @@ private:
* CROHelper and returns ResultVal<bool>. It should return true to continue the
* iteration,
* false to stop the iteration, or an error code (which will also stop the iteration).
* @returns ResultCode indicating the result of the operation, RESULT_SUCCESS if all iteration
* @returns Result indicating the result of the operation, RESULT_SUCCESS if all iteration
* success,
* otherwise error code of the last iteration.
*/
template <typename FunctionObject>
static ResultCode ForEachAutoLinkCRO(Kernel::Process& process, Core::System& system,
static Result ForEachAutoLinkCRO(Kernel::Process& process, Core::System& system,
VAddr crs_address, FunctionObject func) {
VAddr current = crs_address;
while (current != 0) {
@ -491,18 +491,18 @@ private:
* @param symbol_address the symbol address to be relocated with
* @param target_future_address the future address of the target.
* Usually equals to target_address, but will be different for a target in .data segment
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ApplyRelocation(VAddr target_address, RelocationType relocation_type, u32 addend,
Result ApplyRelocation(VAddr target_address, RelocationType relocation_type, u32 addend,
u32 symbol_address, u32 target_future_address);
/**
* Clears a relocation to zero
* @param target_address where to apply the relocation
* @param relocation_type the type of the relocation
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ClearRelocation(VAddr target_address, RelocationType relocation_type);
Result ClearRelocation(VAddr target_address, RelocationType relocation_type);
/**
* Applies or resets a batch of relocations
@ -510,9 +510,9 @@ private:
* @param symbol_address the symbol address to be relocated with
* @param reset false to set the batch to resolved state, true to reset the batch to unresolved
* state
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ApplyRelocationBatch(VAddr batch, u32 symbol_address, bool reset = false);
Result ApplyRelocationBatch(VAddr batch, u32 symbol_address, bool reset = false);
/**
* Finds an exported named symbol in this module.
@ -524,10 +524,10 @@ private:
/**
* Rebases offsets in module header according to module address.
* @param cro_size the size of the CRO file
* @returns ResultCode RESULT_SUCCESS if all offsets are verified as valid, otherwise error
* @returns Result RESULT_SUCCESS if all offsets are verified as valid, otherwise error
* code.
*/
ResultCode RebaseHeader(u32 cro_size);
Result RebaseHeader(u32 cro_size);
/**
* Rebases offsets in segment table according to module address.
@ -544,45 +544,45 @@ private:
/**
* Rebases offsets in exported named symbol table according to module address.
* @returns ResultCode RESULT_SUCCESS if all offsets are verified as valid, otherwise error
* @returns Result RESULT_SUCCESS if all offsets are verified as valid, otherwise error
* code.
*/
ResultCode RebaseExportNamedSymbolTable();
Result RebaseExportNamedSymbolTable();
/**
* Verifies indices in export tree table.
* @returns ResultCode RESULT_SUCCESS if all indices are verified as valid, otherwise error
* @returns Result RESULT_SUCCESS if all indices are verified as valid, otherwise error
* code.
*/
ResultCode VerifyExportTreeTable() const;
Result VerifyExportTreeTable() const;
/**
* Rebases offsets in exported module table according to module address.
* @returns ResultCode RESULT_SUCCESS if all offsets are verified as valid, otherwise error
* @returns Result RESULT_SUCCESS if all offsets are verified as valid, otherwise error
* code.
*/
ResultCode RebaseImportModuleTable();
Result RebaseImportModuleTable();
/**
* Rebases offsets in imported named symbol table according to module address.
* @returns ResultCode RESULT_SUCCESS if all offsets are verified as valid, otherwise error
* @returns Result RESULT_SUCCESS if all offsets are verified as valid, otherwise error
* code.
*/
ResultCode RebaseImportNamedSymbolTable();
Result RebaseImportNamedSymbolTable();
/**
* Rebases offsets in imported indexed symbol table according to module address.
* @returns ResultCode RESULT_SUCCESS if all offsets are verified as valid, otherwise error
* @returns Result RESULT_SUCCESS if all offsets are verified as valid, otherwise error
* code.
*/
ResultCode RebaseImportIndexedSymbolTable();
Result RebaseImportIndexedSymbolTable();
/**
* Rebases offsets in imported anonymous symbol table according to module address.
* @returns ResultCode RESULT_SUCCESS if all offsets are verified as valid, otherwise error
* @returns Result RESULT_SUCCESS if all offsets are verified as valid, otherwise error
* code.
*/
ResultCode RebaseImportAnonymousSymbolTable();
Result RebaseImportAnonymousSymbolTable();
/**
* Gets the address of OnUnresolved function in this module.
@ -593,35 +593,35 @@ private:
/**
* Resets all external relocations to unresolved state.
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ResetExternalRelocations();
Result ResetExternalRelocations();
/**
* Clears all external relocations to zero.
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ClearExternalRelocations();
Result ClearExternalRelocations();
/**
* Applies all static anonymous symbol to the static module.
* @param crs_address the virtual address of the static module
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ApplyStaticAnonymousSymbolToCRS(VAddr crs_address);
Result ApplyStaticAnonymousSymbolToCRS(VAddr crs_address);
/**
* Applies all internal relocations to the module itself.
* @param old_data_segment_address the virtual address of data segment in CRO buffer
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ApplyInternalRelocations(u32 old_data_segment_address);
Result ApplyInternalRelocations(u32 old_data_segment_address);
/**
* Clears all internal relocations to zero.
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ClearInternalRelocations();
Result ClearInternalRelocations();
/// Unrebases offsets in imported anonymous symbol table
void UnrebaseImportAnonymousSymbolTable();
@ -648,71 +648,71 @@ private:
* Looks up all imported named symbols of this module in all registered auto-link modules, and
* resolves them if found.
* @param crs_address the virtual address of the static module
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ApplyImportNamedSymbol(VAddr crs_address);
Result ApplyImportNamedSymbol(VAddr crs_address);
/**
* Resets all imported named symbols of this module to unresolved state.
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ResetImportNamedSymbol();
Result ResetImportNamedSymbol();
/**
* Resets all imported indexed symbols of this module to unresolved state.
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ResetImportIndexedSymbol();
Result ResetImportIndexedSymbol();
/**
* Resets all imported anonymous symbols of this module to unresolved state.
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ResetImportAnonymousSymbol();
Result ResetImportAnonymousSymbol();
/**
* Finds registered auto-link modules that this module imports, and resolves indexed and
* anonymous symbols exported by them.
* @param crs_address the virtual address of the static module
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ApplyModuleImport(VAddr crs_address);
Result ApplyModuleImport(VAddr crs_address);
/**
* Resolves target module's imported named symbols that exported by this module.
* @param target the module to resolve.
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ApplyExportNamedSymbol(CROHelper target);
Result ApplyExportNamedSymbol(CROHelper target);
/**
* Resets target's named symbols imported from this module to unresolved state.
* @param target the module to reset.
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ResetExportNamedSymbol(CROHelper target);
Result ResetExportNamedSymbol(CROHelper target);
/**
* Resolves imported indexed and anonymous symbols in the target module which imports this
* module.
* @param target the module to resolve.
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ApplyModuleExport(CROHelper target);
Result ApplyModuleExport(CROHelper target);
/**
* Resets target's indexed and anonymous symbol imported from this module to unresolved state.
* @param target the module to reset.
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ResetModuleExport(CROHelper target);
Result ResetModuleExport(CROHelper target);
/**
* Resolves the exit function in this module
* @param crs_address the virtual address of the static module.
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
* @returns Result RESULT_SUCCESS on success, otherwise error code.
*/
ResultCode ApplyExitRelocations(VAddr crs_address);
Result ApplyExitRelocations(VAddr crs_address);
};
} // namespace Service::LDR

View File

@ -19,29 +19,29 @@ SERIALIZE_EXPORT_IMPL(Service::LDR::ClientSlot)
namespace Service::LDR {
static const ResultCode ERROR_ALREADY_INITIALIZED = // 0xD9612FF9
ResultCode(ErrorDescription::AlreadyInitialized, ErrorModule::RO, ErrorSummary::Internal,
static const Result ERROR_ALREADY_INITIALIZED = // 0xD9612FF9
Result(ErrorDescription::AlreadyInitialized, ErrorModule::RO, ErrorSummary::Internal,
ErrorLevel::Permanent);
static const ResultCode ERROR_NOT_INITIALIZED = // 0xD9612FF8
ResultCode(ErrorDescription::NotInitialized, ErrorModule::RO, ErrorSummary::Internal,
static const Result ERROR_NOT_INITIALIZED = // 0xD9612FF8
Result(ErrorDescription::NotInitialized, ErrorModule::RO, ErrorSummary::Internal,
ErrorLevel::Permanent);
static const ResultCode ERROR_BUFFER_TOO_SMALL = // 0xE0E12C1F
ResultCode(static_cast<ErrorDescription>(31), ErrorModule::RO, ErrorSummary::InvalidArgument,
static const Result ERROR_BUFFER_TOO_SMALL = // 0xE0E12C1F
Result(static_cast<ErrorDescription>(31), ErrorModule::RO, ErrorSummary::InvalidArgument,
ErrorLevel::Usage);
static const ResultCode ERROR_MISALIGNED_ADDRESS = // 0xD9012FF1
ResultCode(ErrorDescription::MisalignedAddress, ErrorModule::RO, ErrorSummary::WrongArgument,
static const Result ERROR_MISALIGNED_ADDRESS = // 0xD9012FF1
Result(ErrorDescription::MisalignedAddress, ErrorModule::RO, ErrorSummary::WrongArgument,
ErrorLevel::Permanent);
static const ResultCode ERROR_MISALIGNED_SIZE = // 0xD9012FF2
ResultCode(ErrorDescription::MisalignedSize, ErrorModule::RO, ErrorSummary::WrongArgument,
static const Result ERROR_MISALIGNED_SIZE = // 0xD9012FF2
Result(ErrorDescription::MisalignedSize, ErrorModule::RO, ErrorSummary::WrongArgument,
ErrorLevel::Permanent);
static const ResultCode ERROR_ILLEGAL_ADDRESS = // 0xE1612C0F
ResultCode(static_cast<ErrorDescription>(15), ErrorModule::RO, ErrorSummary::Internal,
static const Result ERROR_ILLEGAL_ADDRESS = // 0xE1612C0F
Result(static_cast<ErrorDescription>(15), ErrorModule::RO, ErrorSummary::Internal,
ErrorLevel::Usage);
static const ResultCode ERROR_INVALID_MEMORY_STATE = // 0xD8A12C08
ResultCode(static_cast<ErrorDescription>(8), ErrorModule::RO, ErrorSummary::InvalidState,
static const Result ERROR_INVALID_MEMORY_STATE = // 0xD8A12C08
Result(static_cast<ErrorDescription>(8), ErrorModule::RO, ErrorSummary::InvalidState,
ErrorLevel::Permanent);
static const ResultCode ERROR_NOT_LOADED = // 0xD8A12C0D
ResultCode(static_cast<ErrorDescription>(13), ErrorModule::RO, ErrorSummary::InvalidState,
static const Result ERROR_NOT_LOADED = // 0xD8A12C0D
Result(static_cast<ErrorDescription>(13), ErrorModule::RO, ErrorSummary::InvalidState,
ErrorLevel::Permanent);
static bool VerifyBufferState(Kernel::Process& process, VAddr buffer_ptr, u32 size) {
@ -118,7 +118,7 @@ void RO::Initialize(Kernel::HLERequestContext& ctx) {
return;
}
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
result = process->Map(crs_address, crs_buffer_ptr, crs_size, Kernel::VMAPermission::Read, true);
if (result.IsError()) {
@ -245,13 +245,13 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
if (zero) {
LOG_ERROR(Service_LDR, "Zero is not zero {}", zero);
rb.Push(ResultCode(static_cast<ErrorDescription>(29), ErrorModule::RO,
ErrorSummary::Internal, ErrorLevel::Usage));
rb.Push(Result(static_cast<ErrorDescription>(29), ErrorModule::RO, ErrorSummary::Internal,
ErrorLevel::Usage));
rb.Push<u32>(0);
return;
}
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
result = process->Map(cro_address, cro_buffer_ptr, cro_size, Kernel::VMAPermission::Read, true);
if (result.IsError()) {
@ -372,7 +372,7 @@ void RO::UnloadCRO(Kernel::HLERequestContext& ctx) {
cro.Unregister(slot->loaded_crs);
ResultCode result = cro.Unlink(slot->loaded_crs);
Result result = cro.Unlink(slot->loaded_crs);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error unlinking CRO {:08X}", result.raw);
rb.Push(result);
@ -435,7 +435,7 @@ void RO::LinkCRO(Kernel::HLERequestContext& ctx) {
LOG_INFO(Service_LDR, "Linking CRO \"{}\"", cro.ModuleName());
ResultCode result = cro.Link(slot->loaded_crs, false);
Result result = cro.Link(slot->loaded_crs, false);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error linking CRO {:08X}", result.raw);
}
@ -475,7 +475,7 @@ void RO::UnlinkCRO(Kernel::HLERequestContext& ctx) {
LOG_INFO(Service_LDR, "Unlinking CRO \"{}\"", cro.ModuleName());
ResultCode result = cro.Unlink(slot->loaded_crs);
Result result = cro.Unlink(slot->loaded_crs);
if (result.IsError()) {
LOG_ERROR(Service_LDR, "Error unlinking CRO {:08X}", result.raw);
}
@ -502,7 +502,7 @@ void RO::Shutdown(Kernel::HLERequestContext& ctx) {
CROHelper crs(slot->loaded_crs, *process, system);
crs.Unrebase(true);
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
result = process->Unmap(slot->loaded_crs, crs_buffer_ptr, crs.GetFileSize(),
Kernel::VMAPermission::ReadWrite, true);

View File

@ -34,7 +34,7 @@ void Module::Interface::Initialize(Kernel::HLERequestContext& ctx) {
return;
}
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
switch (communication_mode) {
case CommunicationMode::Ntag:
case CommunicationMode::Amiibo:
@ -68,7 +68,7 @@ void Module::Interface::Finalize(Kernel::HLERequestContext& ctx) {
return;
}
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
switch (communication_mode) {
case CommunicationMode::Ntag:
case CommunicationMode::Amiibo:
@ -129,7 +129,7 @@ void Module::Interface::StartDetection(Kernel::HLERequestContext& ctx) {
LOG_INFO(Service_NFC, "called, in_val={:04x}", in_val);
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
switch (nfc->nfc_mode) {
case CommunicationMode::Ntag:
case CommunicationMode::Amiibo:
@ -150,7 +150,7 @@ void Module::Interface::StopDetection(Kernel::HLERequestContext& ctx) {
LOG_INFO(Service_NFC, "called");
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
switch (nfc->nfc_mode) {
case CommunicationMode::Ntag:
case CommunicationMode::Amiibo:
@ -175,7 +175,7 @@ void Module::Interface::Mount(Kernel::HLERequestContext& ctx) {
nfc->device->RescheduleTagRemoveEvent();
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
switch (nfc->nfc_mode) {
case CommunicationMode::Ntag:
result = nfc->device->Mount();
@ -197,7 +197,7 @@ void Module::Interface::Unmount(Kernel::HLERequestContext& ctx) {
LOG_INFO(Service_NFC, "called");
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
switch (nfc->nfc_mode) {
case CommunicationMode::Ntag:
case CommunicationMode::Amiibo:
@ -217,7 +217,7 @@ void Module::Interface::Flush(Kernel::HLERequestContext& ctx) {
LOG_INFO(Service_NFC, "called");
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
switch (nfc->nfc_mode) {
case CommunicationMode::Ntag:
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
@ -514,7 +514,7 @@ void Module::Interface::MountRom(Kernel::HLERequestContext& ctx) {
LOG_INFO(Service_NFC, "called");
ResultCode result = RESULT_SUCCESS;
Result result = RESULT_SUCCESS;
switch (nfc->nfc_mode) {
case CommunicationMode::Ntag:
result = nfc->device->PartiallyMount();

View File

@ -166,7 +166,7 @@ void NfcDevice::Finalize() {
is_initalized = false;
}
ResultCode NfcDevice::StartCommunication() {
Result NfcDevice::StartCommunication() {
const auto connection_result = CheckConnectionState();
if (connection_result.IsError()) {
return connection_result;
@ -184,7 +184,7 @@ ResultCode NfcDevice::StartCommunication() {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::StopCommunication() {
Result NfcDevice::StopCommunication() {
const auto connection_result = CheckConnectionState();
if (connection_result.IsError()) {
return connection_result;
@ -204,7 +204,7 @@ ResultCode NfcDevice::StopCommunication() {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::StartDetection(TagProtocol allowed_protocol) {
Result NfcDevice::StartDetection(TagProtocol allowed_protocol) {
const auto connection_result = CheckConnectionState();
if (connection_result.IsError()) {
return connection_result;
@ -230,7 +230,7 @@ ResultCode NfcDevice::StartDetection(TagProtocol allowed_protocol) {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::StopDetection() {
Result NfcDevice::StopDetection() {
const auto connection_result = CheckConnectionState();
if (connection_result.IsError()) {
return connection_result;
@ -257,7 +257,7 @@ ResultCode NfcDevice::StopDetection() {
return ResultInvalidOperation;
}
ResultCode NfcDevice::Flush() {
Result NfcDevice::Flush() {
if (device_state != DeviceState::TagMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -327,7 +327,7 @@ ResultCode NfcDevice::Flush() {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::Mount() {
Result NfcDevice::Mount() {
if (device_state != DeviceState::TagFound) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -357,7 +357,7 @@ ResultCode NfcDevice::Mount() {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::MountAmiibo() {
Result NfcDevice::MountAmiibo() {
TagInfo tag_info{};
const auto result = GetTagInfo(tag_info);
@ -372,7 +372,7 @@ ResultCode NfcDevice::MountAmiibo() {
return Mount();
}
ResultCode NfcDevice::PartiallyMount() {
Result NfcDevice::PartiallyMount() {
if (device_state != DeviceState::TagFound) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -402,7 +402,7 @@ ResultCode NfcDevice::PartiallyMount() {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::PartiallyMountAmiibo() {
Result NfcDevice::PartiallyMountAmiibo() {
TagInfo tag_info{};
const auto result = GetTagInfo(tag_info);
@ -416,7 +416,7 @@ ResultCode NfcDevice::PartiallyMountAmiibo() {
return PartiallyMount();
}
ResultCode NfcDevice::ResetTagScanState() {
Result NfcDevice::ResetTagScanState() {
if (device_state != DeviceState::TagMounted &&
device_state != DeviceState::TagPartiallyMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
@ -433,7 +433,7 @@ ResultCode NfcDevice::ResetTagScanState() {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::GetTagInfo2(TagInfo2& tag_info) const {
Result NfcDevice::GetTagInfo2(TagInfo2& tag_info) const {
tag_info = {
.uuid_length = static_cast<u16>(encrypted_tag.file.uuid.uid.size()),
.tag_type = PackedTagType::Type2,
@ -446,7 +446,7 @@ ResultCode NfcDevice::GetTagInfo2(TagInfo2& tag_info) const {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::GetTagInfo(TagInfo& tag_info) const {
Result NfcDevice::GetTagInfo(TagInfo& tag_info) const {
if (device_state != DeviceState::TagFound && device_state != DeviceState::TagMounted &&
device_state != DeviceState::TagPartiallyMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
@ -468,7 +468,7 @@ ResultCode NfcDevice::GetTagInfo(TagInfo& tag_info) const {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::GetCommonInfo(CommonInfo& common_info) const {
Result NfcDevice::GetCommonInfo(CommonInfo& common_info) const {
if (device_state != DeviceState::TagMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -497,7 +497,7 @@ ResultCode NfcDevice::GetCommonInfo(CommonInfo& common_info) const {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::GetModelInfo(ModelInfo& model_info) const {
Result NfcDevice::GetModelInfo(ModelInfo& model_info) const {
if (device_state != DeviceState::TagMounted &&
device_state != DeviceState::TagPartiallyMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
@ -520,7 +520,7 @@ ResultCode NfcDevice::GetModelInfo(ModelInfo& model_info) const {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::GetRegisterInfo(RegisterInfo& register_info) const {
Result NfcDevice::GetRegisterInfo(RegisterInfo& register_info) const {
if (device_state != DeviceState::TagMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -548,7 +548,7 @@ ResultCode NfcDevice::GetRegisterInfo(RegisterInfo& register_info) const {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::GetAdminInfo(AdminInfo& admin_info) const {
Result NfcDevice::GetAdminInfo(AdminInfo& admin_info) const {
if (device_state != DeviceState::TagMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -607,7 +607,7 @@ ResultCode NfcDevice::GetAdminInfo(AdminInfo& admin_info) const {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::DeleteRegisterInfo() {
Result NfcDevice::DeleteRegisterInfo() {
// This is a hack to get around a HW issue
if (device_state == DeviceState::TagFound) {
Mount();
@ -645,7 +645,7 @@ ResultCode NfcDevice::DeleteRegisterInfo() {
return Flush();
}
ResultCode NfcDevice::SetRegisterInfoPrivate(const RegisterInfoPrivate& register_info) {
Result NfcDevice::SetRegisterInfoPrivate(const RegisterInfoPrivate& register_info) {
if (device_state != DeviceState::TagMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -677,7 +677,7 @@ ResultCode NfcDevice::SetRegisterInfoPrivate(const RegisterInfoPrivate& register
return Flush();
}
ResultCode NfcDevice::RestoreAmiibo() {
Result NfcDevice::RestoreAmiibo() {
if (device_state != DeviceState::TagMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -692,22 +692,22 @@ ResultCode NfcDevice::RestoreAmiibo() {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::Format() {
auto ResultCode = DeleteApplicationArea();
auto ResultCode2 = DeleteRegisterInfo();
Result NfcDevice::Format() {
auto Result = DeleteApplicationArea();
auto Result2 = DeleteRegisterInfo();
if (ResultCode.IsError()) {
return ResultCode;
if (Result.IsError()) {
return Result;
}
if (ResultCode2.IsError()) {
return ResultCode2;
if (Result2.IsError()) {
return Result2;
}
return RESULT_SUCCESS;
}
ResultCode NfcDevice::OpenApplicationArea(u32 access_id) {
Result NfcDevice::OpenApplicationArea(u32 access_id) {
if (device_state != DeviceState::TagMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -732,7 +732,7 @@ ResultCode NfcDevice::OpenApplicationArea(u32 access_id) {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::GetApplicationAreaId(u32& application_area_id) const {
Result NfcDevice::GetApplicationAreaId(u32& application_area_id) const {
application_area_id = {};
if (device_state != DeviceState::TagMounted) {
@ -754,7 +754,7 @@ ResultCode NfcDevice::GetApplicationAreaId(u32& application_area_id) const {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::GetApplicationArea(std::vector<u8>& data) const {
Result NfcDevice::GetApplicationArea(std::vector<u8>& data) const {
if (device_state != DeviceState::TagMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -783,7 +783,7 @@ ResultCode NfcDevice::GetApplicationArea(std::vector<u8>& data) const {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::SetApplicationArea(std::span<const u8> data) {
Result NfcDevice::SetApplicationArea(std::span<const u8> data) {
if (device_state != DeviceState::TagMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -831,7 +831,7 @@ ResultCode NfcDevice::SetApplicationArea(std::span<const u8> data) {
return RESULT_SUCCESS;
}
ResultCode NfcDevice::CreateApplicationArea(u32 access_id, std::span<const u8> data) {
Result NfcDevice::CreateApplicationArea(u32 access_id, std::span<const u8> data) {
if (device_state != DeviceState::TagMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -849,7 +849,7 @@ ResultCode NfcDevice::CreateApplicationArea(u32 access_id, std::span<const u8> d
return RecreateApplicationArea(access_id, data);
}
ResultCode NfcDevice::RecreateApplicationArea(u32 access_id, std::span<const u8> data) {
Result NfcDevice::RecreateApplicationArea(u32 access_id, std::span<const u8> data) {
if (device_state != DeviceState::TagMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -900,7 +900,7 @@ ResultCode NfcDevice::RecreateApplicationArea(u32 access_id, std::span<const u8>
return Flush();
}
ResultCode NfcDevice::DeleteApplicationArea() {
Result NfcDevice::DeleteApplicationArea() {
// This is a hack to get around a HW issue
if (device_state == DeviceState::TagFound) {
Mount();
@ -943,7 +943,7 @@ ResultCode NfcDevice::DeleteApplicationArea() {
return Flush();
}
ResultCode NfcDevice::ApplicationAreaExist(bool& has_application_area) {
Result NfcDevice::ApplicationAreaExist(bool& has_application_area) {
if (device_state != DeviceState::TagMounted) {
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
const auto connection_result = CheckConnectionState();
@ -966,7 +966,7 @@ DeviceState NfcDevice::GetCurrentState() const {
return device_state;
}
ResultCode NfcDevice::GetCommunicationStatus(CommunicationState& status) const {
Result NfcDevice::GetCommunicationStatus(CommunicationState& status) const {
if (communication_state == CommunicationState::Idle ||
communication_state == CommunicationState::SearchingForAdapter) {
status = communication_state;
@ -982,7 +982,7 @@ ResultCode NfcDevice::GetCommunicationStatus(CommunicationState& status) const {
return ResultInvalidOperation;
}
ResultCode NfcDevice::CheckConnectionState() const {
Result NfcDevice::CheckConnectionState() const {
if (connection_state == ConnectionState::Lost) {
return ResultSleep;
}

View File

@ -31,42 +31,42 @@ public:
void Initialize();
void Finalize();
ResultCode StartCommunication();
ResultCode StopCommunication();
ResultCode StartDetection(TagProtocol allowed_protocol);
ResultCode StopDetection();
ResultCode Mount();
ResultCode MountAmiibo();
ResultCode PartiallyMount();
ResultCode PartiallyMountAmiibo();
ResultCode ResetTagScanState();
ResultCode Flush();
Result StartCommunication();
Result StopCommunication();
Result StartDetection(TagProtocol allowed_protocol);
Result StopDetection();
Result Mount();
Result MountAmiibo();
Result PartiallyMount();
Result PartiallyMountAmiibo();
Result ResetTagScanState();
Result Flush();
ResultCode GetTagInfo2(TagInfo2& tag_info) const;
ResultCode GetTagInfo(TagInfo& tag_info) const;
ResultCode GetCommonInfo(CommonInfo& common_info) const;
ResultCode GetModelInfo(ModelInfo& model_info) const;
ResultCode GetRegisterInfo(RegisterInfo& register_info) const;
ResultCode GetAdminInfo(AdminInfo& admin_info) const;
Result GetTagInfo2(TagInfo2& tag_info) const;
Result GetTagInfo(TagInfo& tag_info) const;
Result GetCommonInfo(CommonInfo& common_info) const;
Result GetModelInfo(ModelInfo& model_info) const;
Result GetRegisterInfo(RegisterInfo& register_info) const;
Result GetAdminInfo(AdminInfo& admin_info) const;
ResultCode DeleteRegisterInfo();
ResultCode SetRegisterInfoPrivate(const RegisterInfoPrivate& register_info);
ResultCode RestoreAmiibo();
ResultCode Format();
Result DeleteRegisterInfo();
Result SetRegisterInfoPrivate(const RegisterInfoPrivate& register_info);
Result RestoreAmiibo();
Result Format();
ResultCode OpenApplicationArea(u32 access_id);
ResultCode GetApplicationAreaId(u32& application_area_id) const;
ResultCode GetApplicationArea(std::vector<u8>& data) const;
ResultCode SetApplicationArea(std::span<const u8> data);
ResultCode CreateApplicationArea(u32 access_id, std::span<const u8> data);
ResultCode RecreateApplicationArea(u32 access_id, std::span<const u8> data);
ResultCode DeleteApplicationArea();
ResultCode ApplicationAreaExist(bool& has_application_area);
Result OpenApplicationArea(u32 access_id);
Result GetApplicationAreaId(u32& application_area_id) const;
Result GetApplicationArea(std::vector<u8>& data) const;
Result SetApplicationArea(std::span<const u8> data);
Result CreateApplicationArea(u32 access_id, std::span<const u8> data);
Result RecreateApplicationArea(u32 access_id, std::span<const u8> data);
Result DeleteApplicationArea();
Result ApplicationAreaExist(bool& has_application_area);
constexpr u32 GetApplicationAreaSize() const;
DeviceState GetCurrentState() const;
ResultCode GetCommunicationStatus(CommunicationState& status) const;
ResultCode CheckConnectionState() const;
Result GetCommunicationStatus(CommunicationState& status) const;
Result CheckConnectionState() const;
std::shared_ptr<Kernel::Event> GetActivateEvent() const;
std::shared_ptr<Kernel::Event> GetDeactivateEvent() const;

View File

@ -43,29 +43,29 @@ enum {
};
} // namespace ErrCodes
constexpr ResultCode ResultInvalidArgumentValue(ErrCodes::InvalidArgumentValue, ErrorModule::NFC,
constexpr Result ResultInvalidArgumentValue(ErrCodes::InvalidArgumentValue, ErrorModule::NFC,
ErrorSummary::InvalidArgument, ErrorLevel::Status);
constexpr ResultCode ResultInvalidArgument(ErrCodes::InvalidArgument, ErrorModule::NFC,
constexpr Result ResultInvalidArgument(ErrCodes::InvalidArgument, ErrorModule::NFC,
ErrorSummary::InvalidArgument, ErrorLevel::Status);
constexpr ResultCode ResultInvalidOperation(ErrCodes::InvalidOperation, ErrorModule::NFC,
constexpr Result ResultInvalidOperation(ErrCodes::InvalidOperation, ErrorModule::NFC,
ErrorSummary::InvalidState, ErrorLevel::Status);
constexpr ResultCode ResultNotSupported(ErrCodes::NotSupported, ErrorModule::NFC,
constexpr Result ResultNotSupported(ErrCodes::NotSupported, ErrorModule::NFC,
ErrorSummary::InvalidState, ErrorLevel::Status);
constexpr ResultCode ResultNeedFormat(ErrCodes::NeedFormat, ErrorModule::NFC,
constexpr Result ResultNeedFormat(ErrCodes::NeedFormat, ErrorModule::NFC,
ErrorSummary::InvalidState, ErrorLevel::Status);
constexpr ResultCode ResultOperationFailed(ErrCodes::OperationFailed, ErrorModule::NFC,
constexpr Result ResultOperationFailed(ErrCodes::OperationFailed, ErrorModule::NFC,
ErrorSummary::InvalidState, ErrorLevel::Status);
constexpr ResultCode ResultNeedCreate(ErrCodes::NeedCreate, ErrorModule::NFC,
constexpr Result ResultNeedCreate(ErrCodes::NeedCreate, ErrorModule::NFC,
ErrorSummary::InvalidState, ErrorLevel::Status);
constexpr ResultCode ResultNeedRegister(ErrCodes::NeedRegister, ErrorModule::NFC,
constexpr Result ResultNeedRegister(ErrCodes::NeedRegister, ErrorModule::NFC,
ErrorSummary::InvalidState, ErrorLevel::Status);
constexpr ResultCode ResultAlreadyCreated(ErrCodes::AlreadyCreated, ErrorModule::NFC,
constexpr Result ResultAlreadyCreated(ErrCodes::AlreadyCreated, ErrorModule::NFC,
ErrorSummary::InvalidState, ErrorLevel::Status);
constexpr ResultCode ResultAccessIdMisMatch(ErrCodes::AccessIdMisMatch, ErrorModule::NFC,
constexpr Result ResultAccessIdMisMatch(ErrCodes::AccessIdMisMatch, ErrorModule::NFC,
ErrorSummary::InvalidState, ErrorLevel::Status);
constexpr ResultCode ResultSleep(ErrCodes::Sleep, ErrorModule::NFC, ErrorSummary::InvalidState,
constexpr Result ResultSleep(ErrCodes::Sleep, ErrorModule::NFC, ErrorSummary::InvalidState,
ErrorLevel::Status);
constexpr ResultCode ResultWifiOff(ErrCodes::WifiOff, ErrorModule::NFC, ErrorSummary::InvalidState,
constexpr Result ResultWifiOff(ErrCodes::WifiOff, ErrorModule::NFC, ErrorSummary::InvalidState,
ErrorLevel::Status);
} // namespace Service::NFC

Some files were not shown because too many files have changed in this diff Show More