mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-12-25 01:11:48 +01:00
kernel: Update to use atmosphere macros and correct Result (#7242)
* kernel: Switch to atmosphere style macros * code: Rename ResultCode to Result * code: Result constants are lower case * Address review comments * core: Remove CASCADE_CODE * R_TRY replaces completely * core: Run clang format
This commit is contained in:
parent
811303ea54
commit
5a7f615da1
@ -49,7 +49,7 @@ QString IPCRecorderWidget::GetStatusStr(const IPCDebugger::RequestRecord& record
|
||||
case IPCDebugger::RequestStatus::Handling:
|
||||
return tr("Handling");
|
||||
case IPCDebugger::RequestStatus::Handled:
|
||||
if (record.translated_reply_cmdbuf[1] == RESULT_SUCCESS.raw) {
|
||||
if (record.translated_reply_cmdbuf[1] == ResultSuccess.raw) {
|
||||
return tr("Success");
|
||||
}
|
||||
return tr("Error");
|
||||
@ -88,7 +88,7 @@ void IPCRecorderWidget::OnEntryUpdated(IPCDebugger::RequestRecord record) {
|
||||
|
||||
if (record.status == IPCDebugger::RequestStatus::HLEUnimplemented ||
|
||||
(record.status == IPCDebugger::RequestStatus::Handled &&
|
||||
record.translated_reply_cmdbuf[1] != RESULT_SUCCESS.raw)) { // Unimplemented / Error
|
||||
record.translated_reply_cmdbuf[1] != ResultSuccess.raw)) { // Unimplemented / Error
|
||||
|
||||
auto item = ui->main->invisibleRootItem()->child(row_id);
|
||||
for (int column = 0; column < item->columnCount(); ++column) {
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
|
||||
const u8* buffer) override {
|
||||
if (offset > size) {
|
||||
return ERR_WRITE_BEYOND_END;
|
||||
return ResultWriteBeyondEnd;
|
||||
} else if (offset == size) {
|
||||
return 0ULL;
|
||||
}
|
||||
@ -108,17 +108,17 @@ public:
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
if (mode.hex == 0) {
|
||||
LOG_ERROR(Service_FS, "Empty open mode");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
if (mode.create_flag) {
|
||||
LOG_ERROR(Service_FS, "Create flag is not supported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
const auto full_path = path_parser.BuildHostPath(mount_point);
|
||||
@ -126,17 +126,17 @@ public:
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
return ResultFileNotFound;
|
||||
case PathParser::PathNotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
return ResultPathNotFound;
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::DirectoryFound:
|
||||
LOG_ERROR(Service_FS, "Unexpected file or directory in {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||
return ResultUnexpectedFileOrDirectory;
|
||||
case PathParser::NotFound:
|
||||
LOG_ERROR(Service_FS, "{} not found", full_path);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
return ResultFileNotFound;
|
||||
case PathParser::FileFound:
|
||||
break; // Expected 'success' case
|
||||
}
|
||||
@ -144,7 +144,7 @@ public:
|
||||
FileUtil::IOFile file(full_path, "r+b");
|
||||
if (!file.IsOpen()) {
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
return ResultFileNotFound;
|
||||
}
|
||||
|
||||
Mode rwmode;
|
||||
@ -155,10 +155,10 @@ 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;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
return SaveDataArchive::CreateFile(path, size);
|
||||
}
|
||||
@ -250,16 +250,16 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_ExtSaveData::Open(cons
|
||||
// TODO(Subv): Verify the archive behavior of SharedExtSaveData compared to ExtSaveData.
|
||||
// ExtSaveData seems to return FS_NotFound (120) when the archive doesn't exist.
|
||||
if (type != ExtSaveDataType::Shared) {
|
||||
return ERR_NOT_FOUND_INVALID_STATE;
|
||||
return ResultNotFoundInvalidState;
|
||||
} else {
|
||||
return ERR_NOT_FORMATTED;
|
||||
return ResultNotFormatted;
|
||||
}
|
||||
}
|
||||
std::unique_ptr<DelayGenerator> delay_generator = std::make_unique<ExtSaveDataDelayGenerator>();
|
||||
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);
|
||||
@ -276,11 +276,11 @@ ResultCode ArchiveFactory_ExtSaveData::Format(const Path& path,
|
||||
|
||||
if (!file.IsOpen()) {
|
||||
// TODO(Subv): Find the correct error code
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
file.WriteBytes(&format_info, sizeof(format_info));
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_ExtSaveData::GetFormatInfo(const Path& path,
|
||||
@ -291,7 +291,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_ExtSaveData::GetFormatInfo(const Pat
|
||||
if (!file.IsOpen()) {
|
||||
LOG_ERROR(Service_FS, "Could not open metadata information for archive");
|
||||
// TODO(Subv): Verify error code
|
||||
return ERR_NOT_FORMATTED;
|
||||
return ResultNotFormatted;
|
||||
}
|
||||
|
||||
ArchiveFormatInfo info = {};
|
||||
|
@ -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;
|
||||
|
||||
|
@ -73,13 +73,13 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
|
||||
const Mode& mode) const {
|
||||
if (path.GetType() != LowPathType::Binary) {
|
||||
LOG_ERROR(Service_FS, "Path need to be Binary");
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
std::vector<u8> binary = path.AsBinary();
|
||||
if (binary.size() != sizeof(NCCHFilePath)) {
|
||||
LOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
NCCHFilePath openfile_path;
|
||||
@ -174,63 +174,63 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
|
||||
return std::make_unique<IVFCFileInMemory>(std::move(archive_data), romfs_offset,
|
||||
romfs_size, std::move(delay_generator));
|
||||
}
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
ResultVal<std::unique_ptr<DirectoryBackend>> NCCHArchive::OpenDirectory(const Path& path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to open a directory within an NCCH archive ({}).",
|
||||
GetName().c_str());
|
||||
// TODO(shinyquagsire23): Use correct error code
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
u64 NCCHArchive::GetFreeBytes() const {
|
||||
@ -276,13 +276,13 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path&
|
||||
u64 program_id) {
|
||||
if (path.GetType() != LowPathType::Binary) {
|
||||
LOG_ERROR(Service_FS, "Path need to be Binary");
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
std::vector<u8> binary = path.AsBinary();
|
||||
if (binary.size() != sizeof(NCCHArchivePath)) {
|
||||
LOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
NCCHArchivePath open_path;
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -305,7 +304,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_NCCH::GetFormatInfo(const Path& path
|
||||
u64 program_id) const {
|
||||
// TODO(Subv): Implement
|
||||
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
} // namespace FileSys
|
||||
|
@ -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;
|
||||
|
||||
|
@ -25,14 +25,14 @@ template <typename T>
|
||||
ResultVal<std::tuple<MediaType, u64>> ParsePath(const Path& path, T program_id_reader) {
|
||||
if (path.GetType() != LowPathType::Binary) {
|
||||
LOG_ERROR(Service_FS, "Wrong path type {}", path.GetType());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
std::vector<u8> vec_data = path.AsBinary();
|
||||
|
||||
if (vec_data.size() != 12) {
|
||||
LOG_ERROR(Service_FS, "Wrong path length {}", vec_data.size());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const u32* data = reinterpret_cast<const u32*>(vec_data.data());
|
||||
@ -42,7 +42,7 @@ ResultVal<std::tuple<MediaType, u64>> ParsePath(const Path& path, T program_id_r
|
||||
LOG_ERROR(Service_FS, "Unsupported media type {}", media_type);
|
||||
|
||||
// Note: this is strange, but the error code was verified with a real 3DS
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
return std::make_tuple(media_type, program_id_reader(data));
|
||||
@ -72,16 +72,17 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_OtherSaveDataPermitted
|
||||
|
||||
if (media_type == MediaType::GameCard) {
|
||||
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
return ERROR_GAMECARD_NOT_INSERTED;
|
||||
return ResultGamecardNotInserted;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_OtherSaveDataPermitted::GetFormatInfo(
|
||||
@ -92,7 +93,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_OtherSaveDataPermitted::GetFormatInf
|
||||
|
||||
if (media_type == MediaType::GameCard) {
|
||||
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
return ERROR_GAMECARD_NOT_INSERTED;
|
||||
return ResultGamecardNotInserted;
|
||||
}
|
||||
|
||||
return sd_savedata_source->GetFormatInfo(program_id);
|
||||
@ -110,21 +111,22 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_OtherSaveDataGeneral::
|
||||
|
||||
if (media_type == MediaType::GameCard) {
|
||||
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
return ERROR_GAMECARD_NOT_INSERTED;
|
||||
return ResultGamecardNotInserted;
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
if (media_type == MediaType::GameCard) {
|
||||
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
return ERROR_GAMECARD_NOT_INSERTED;
|
||||
return ResultGamecardNotInserted;
|
||||
}
|
||||
|
||||
return sd_savedata_source->Format(program_id, format_info);
|
||||
@ -138,7 +140,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_OtherSaveDataGeneral::GetFormatInfo(
|
||||
|
||||
if (media_type == MediaType::GameCard) {
|
||||
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
return ERROR_GAMECARD_NOT_INSERTED;
|
||||
return ResultGamecardNotInserted;
|
||||
}
|
||||
|
||||
return sd_savedata_source->GetFormatInfo(program_id);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -62,17 +62,17 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& pa
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
if (mode.hex == 0) {
|
||||
LOG_ERROR(Service_FS, "Empty open mode");
|
||||
return ERROR_INVALID_OPEN_FLAGS;
|
||||
return ResultInvalidOpenFlags;
|
||||
}
|
||||
|
||||
if (mode.create_flag && !mode.write_flag) {
|
||||
LOG_ERROR(Service_FS, "Create flag set but write flag not set");
|
||||
return ERROR_INVALID_OPEN_FLAGS;
|
||||
return ResultInvalidOpenFlags;
|
||||
}
|
||||
|
||||
const auto full_path = path_parser.BuildHostPath(mount_point);
|
||||
@ -80,19 +80,19 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& pa
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::FileInPath:
|
||||
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
case PathParser::DirectoryFound:
|
||||
LOG_ERROR(Service_FS, "{} is not a file", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||
return ResultUnexpectedFileOrDirectorySdmc;
|
||||
case PathParser::NotFound:
|
||||
if (!mode.create_flag) {
|
||||
LOG_ERROR(Service_FS, "Non-existing file {} can't be open without mode create.",
|
||||
full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
} else {
|
||||
// Create the file
|
||||
FileUtil::CreateEmptyFile(full_path);
|
||||
@ -105,19 +105,19 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& pa
|
||||
FileUtil::IOFile file(full_path, mode.write_flag ? "r+b" : "rb");
|
||||
if (!file.IsOpen()) {
|
||||
LOG_CRITICAL(Service_FS, "Error opening {}: {}", full_path, Common::GetLastErrorMsg());
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
}
|
||||
|
||||
std::unique_ptr<DelayGenerator> delay_generator = std::make_unique<SDMCDelayGenerator>();
|
||||
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()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const auto full_path = path_parser.BuildHostPath(mount_point);
|
||||
@ -125,110 +125,109 @@ ResultCode SDMCArchive::DeleteFile(const Path& path) const {
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::NotFound:
|
||||
LOG_DEBUG(Service_FS, "{} not found", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
case PathParser::DirectoryFound:
|
||||
LOG_ERROR(Service_FS, "{} is not a file", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||
return ResultUnexpectedFileOrDirectorySdmc;
|
||||
case PathParser::FileFound:
|
||||
break; // Expected 'success' case
|
||||
}
|
||||
|
||||
if (FileUtil::Delete(full_path)) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting {}", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
}
|
||||
|
||||
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
|
||||
if (!path_parser_src.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const PathParser path_parser_dest(dest_path);
|
||||
|
||||
if (!path_parser_dest.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const auto src_path_full = path_parser_src.BuildHostPath(mount_point);
|
||||
const auto dest_path_full = path_parser_dest.BuildHostPath(mount_point);
|
||||
|
||||
if (FileUtil::Rename(src_path_full, dest_path_full)) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
// 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()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
if (path_parser.IsRootDirectory())
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
|
||||
const auto full_path = path_parser.BuildHostPath(mount_point);
|
||||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::NotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||
return ResultUnexpectedFileOrDirectorySdmc;
|
||||
case PathParser::DirectoryFound:
|
||||
break; // Expected 'success' case
|
||||
}
|
||||
|
||||
if (deleter(full_path)) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
LOG_ERROR(Service_FS, "Directory not empty {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||
return ResultUnexpectedFileOrDirectorySdmc;
|
||||
}
|
||||
|
||||
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()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const auto full_path = path_parser.BuildHostPath(mount_point);
|
||||
@ -236,44 +235,44 @@ ResultCode SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const {
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::FileInPath:
|
||||
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
case PathParser::DirectoryFound:
|
||||
LOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||
return ResultUnexpectedFileOrDirectorySdmc;
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||
return ERROR_ALREADY_EXISTS;
|
||||
return ResultAlreadyExists;
|
||||
case PathParser::NotFound:
|
||||
break; // Expected 'success' case
|
||||
}
|
||||
|
||||
if (size == 0) {
|
||||
FileUtil::CreateEmptyFile(full_path);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
FileUtil::IOFile file(full_path, "wb");
|
||||
// Creates a sparse file (or a normal file on filesystems without the concept of sparse files)
|
||||
// We do this by seeking to the right size, then writing a single null byte.
|
||||
if (file.Seek(size - 1, SEEK_SET) && file.WriteBytes("", 1) == 1) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const auto full_path = path_parser.BuildHostPath(mount_point);
|
||||
@ -281,54 +280,54 @@ ResultCode SDMCArchive::CreateDirectory(const Path& path) const {
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::FileInPath:
|
||||
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
case PathParser::DirectoryFound:
|
||||
case PathParser::FileFound:
|
||||
LOG_DEBUG(Service_FS, "{} already exists", full_path);
|
||||
return ERROR_ALREADY_EXISTS;
|
||||
return ResultAlreadyExists;
|
||||
case PathParser::NotFound:
|
||||
break; // Expected 'success' case
|
||||
}
|
||||
|
||||
if (FileUtil::CreateDir(mount_point + path.AsString())) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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
|
||||
if (!path_parser_src.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const PathParser path_parser_dest(dest_path);
|
||||
|
||||
if (!path_parser_dest.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const auto src_path_full = path_parser_src.BuildHostPath(mount_point);
|
||||
const auto dest_path_full = path_parser_dest.BuildHostPath(mount_point);
|
||||
|
||||
if (FileUtil::Rename(src_path_full, dest_path_full)) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
@ -337,7 +336,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SDMCArchive::OpenDirectory(const Pa
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const auto full_path = path_parser.BuildHostPath(mount_point);
|
||||
@ -345,15 +344,15 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SDMCArchive::OpenDirectory(const Pa
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::NotFound:
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "{} not found", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
case PathParser::FileInPath:
|
||||
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||
return ResultUnexpectedFileOrDirectorySdmc;
|
||||
case PathParser::DirectoryFound:
|
||||
break; // Expected 'success' case
|
||||
}
|
||||
@ -392,18 +391,17 @@ 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;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMC::GetFormatInfo(const Path& path,
|
||||
u64 program_id) const {
|
||||
// TODO(Subv): Implement
|
||||
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
} // namespace FileSys
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -44,7 +44,7 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Pat
|
||||
const Mode& mode) const {
|
||||
if (mode.read_flag) {
|
||||
LOG_ERROR(Service_FS, "Read flag is not supported");
|
||||
return ERROR_INVALID_READ_FLAG;
|
||||
return ResultInvalidReadFlag;
|
||||
}
|
||||
return SDMCArchive::OpenFileBase(path, mode);
|
||||
}
|
||||
@ -52,7 +52,7 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Pat
|
||||
ResultVal<std::unique_ptr<DirectoryBackend>> SDMCWriteOnlyArchive::OpenDirectory(
|
||||
const Path& path) const {
|
||||
LOG_ERROR(Service_FS, "Not supported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
ArchiveFactory_SDMCWriteOnly::ArchiveFactory_SDMCWriteOnly(const std::string& mount_point)
|
||||
@ -81,19 +81,19 @@ 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
|
||||
LOG_ERROR(Service_FS, "Attempted to format a SDMC write-only archive.");
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMCWriteOnly::GetFormatInfo(const Path& path,
|
||||
u64 program_id) const {
|
||||
// TODO(Subv): Implement
|
||||
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
} // namespace FileSys
|
||||
|
@ -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;
|
||||
|
||||
|
@ -39,12 +39,12 @@ public:
|
||||
ResultVal<std::size_t> Read(u64 offset, std::size_t length, u8* buffer) const override {
|
||||
if (offset != 0) {
|
||||
LOG_ERROR(Service_FS, "offset must be zero!");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
if (length != data->size()) {
|
||||
LOG_ERROR(Service_FS, "size must match the file size!");
|
||||
return ERROR_INCORRECT_EXEFS_READ_SIZE;
|
||||
return ResultIncorrectExefsReadSize;
|
||||
}
|
||||
|
||||
std::memcpy(buffer, data->data(), data->size());
|
||||
@ -54,7 +54,7 @@ public:
|
||||
ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
|
||||
const u8* buffer) override {
|
||||
LOG_ERROR(Service_FS, "The file is read-only!");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
u64 GetSize() const override {
|
||||
@ -99,13 +99,13 @@ public:
|
||||
|
||||
if (path.GetType() != LowPathType::Binary) {
|
||||
LOG_ERROR(Service_FS, "Path need to be Binary");
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
std::vector<u8> binary = path.AsBinary();
|
||||
if (binary.size() != sizeof(SelfNCCHFilePath)) {
|
||||
LOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
SelfNCCHFilePath file_path;
|
||||
@ -120,7 +120,7 @@ public:
|
||||
|
||||
case SelfNCCHFilePathType::Code:
|
||||
LOG_ERROR(Service_FS, "Reading the code section is not supported!");
|
||||
return ERROR_COMMAND_NOT_ALLOWED;
|
||||
return ResultCommandNotAllowed;
|
||||
|
||||
case SelfNCCHFilePathType::ExeFS: {
|
||||
const auto& raw = file_path.exefs_filename;
|
||||
@ -130,48 +130,48 @@ public:
|
||||
}
|
||||
default:
|
||||
LOG_ERROR(Service_FS, "Unknown file type {}!", file_path.type);
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
}
|
||||
|
||||
ResultCode DeleteFile(const Path& path) const override {
|
||||
Result DeleteFile(const Path& path) const override {
|
||||
LOG_ERROR(Service_FS, "Unsupported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
ResultCode DeleteDirectory(const Path& path) const override {
|
||||
Result DeleteDirectory(const Path& path) const override {
|
||||
LOG_ERROR(Service_FS, "Unsupported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
ResultCode DeleteDirectoryRecursively(const Path& path) const override {
|
||||
Result DeleteDirectoryRecursively(const Path& path) const override {
|
||||
LOG_ERROR(Service_FS, "Unsupported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
ResultCode CreateDirectory(const Path& path) const override {
|
||||
Result CreateDirectory(const Path& path) const override {
|
||||
LOG_ERROR(Service_FS, "Unsupported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override {
|
||||
LOG_ERROR(Service_FS, "Unsupported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
u64 GetFreeBytes() const override {
|
||||
@ -186,7 +186,7 @@ private:
|
||||
return std::make_unique<IVFCFile>(ncch_data.romfs_file, std::move(delay_generator));
|
||||
} else {
|
||||
LOG_INFO(Service_FS, "Unable to read RomFS");
|
||||
return ERROR_ROMFS_NOT_FOUND;
|
||||
return ResultRomfsNotFound;
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ private:
|
||||
std::move(delay_generator));
|
||||
} else {
|
||||
LOG_INFO(Service_FS, "Unable to read update RomFS");
|
||||
return ERROR_ROMFS_NOT_FOUND;
|
||||
return ResultRomfsNotFound;
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ private:
|
||||
}
|
||||
|
||||
LOG_WARNING(Service_FS, "Unable to read icon");
|
||||
return ERROR_EXEFS_SECTION_NOT_FOUND;
|
||||
return ResultExefsSectionNotFound;
|
||||
}
|
||||
|
||||
if (filename == "logo") {
|
||||
@ -218,7 +218,7 @@ private:
|
||||
}
|
||||
|
||||
LOG_WARNING(Service_FS, "Unable to read logo");
|
||||
return ERROR_EXEFS_SECTION_NOT_FOUND;
|
||||
return ResultExefsSectionNotFound;
|
||||
}
|
||||
|
||||
if (filename == "banner") {
|
||||
@ -227,11 +227,11 @@ private:
|
||||
}
|
||||
|
||||
LOG_WARNING(Service_FS, "Unable to read banner");
|
||||
return ERROR_EXEFS_SECTION_NOT_FOUND;
|
||||
return ResultExefsSectionNotFound;
|
||||
}
|
||||
|
||||
LOG_ERROR(Service_FS, "Unknown ExeFS section {}!", filename);
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
NCCHData ncch_data;
|
||||
@ -296,16 +296,16 @@ 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;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SelfNCCH::GetFormatInfo(const Path&,
|
||||
u64 program_id) const {
|
||||
LOG_ERROR(Service_FS, "Attempted to get format info of a SelfNCCH archive");
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
} // namespace FileSys
|
||||
|
@ -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;
|
||||
|
||||
|
@ -47,13 +47,13 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveSource_SDSaveData::Open(u64 pr
|
||||
// save file/directory structure expected by the game has not yet been initialized.
|
||||
// Returning the NotFormatted error code will signal the game to provision the SaveData
|
||||
// archive with the files and folders that it expects.
|
||||
return ERR_NOT_FORMATTED;
|
||||
return ResultNotFormatted;
|
||||
}
|
||||
|
||||
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);
|
||||
@ -65,9 +65,9 @@ ResultCode ArchiveSource_SDSaveData::Format(u64 program_id,
|
||||
|
||||
if (file.IsOpen()) {
|
||||
file.WriteBytes(&format_info, sizeof(format_info));
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultVal<ArchiveFormatInfo> ArchiveSource_SDSaveData::GetFormatInfo(u64 program_id) const {
|
||||
@ -77,7 +77,7 @@ ResultVal<ArchiveFormatInfo> ArchiveSource_SDSaveData::GetFormatInfo(u64 program
|
||||
if (!file.IsOpen()) {
|
||||
LOG_ERROR(Service_FS, "Could not open metadata information for archive");
|
||||
// TODO(Subv): Verify error code
|
||||
return ERR_NOT_FORMATTED;
|
||||
return ResultNotFormatted;
|
||||
}
|
||||
|
||||
ArchiveFormatInfo info = {};
|
||||
|
@ -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);
|
||||
|
@ -57,25 +57,25 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SystemSaveData::Open(c
|
||||
std::string fullpath = GetSystemSaveDataPath(base_path, path);
|
||||
if (!FileUtil::Exists(fullpath)) {
|
||||
// TODO(Subv): Check error code, this one is probably wrong
|
||||
return ERROR_NOT_FOUND;
|
||||
return ResultNotFound;
|
||||
}
|
||||
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);
|
||||
FileUtil::DeleteDirRecursively(fullpath);
|
||||
FileUtil::CreateFullPath(fullpath);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SystemSaveData::GetFormatInfo(const Path& path,
|
||||
u64 program_id) const {
|
||||
// TODO(Subv): Implement
|
||||
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
} // namespace FileSys
|
||||
|
@ -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;
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace FileSys {
|
||||
ResultVal<std::size_t> DiskFile::Read(const u64 offset, const std::size_t length,
|
||||
u8* buffer) const {
|
||||
if (!mode.read_flag)
|
||||
return ERROR_INVALID_OPEN_FLAGS;
|
||||
return ResultInvalidOpenFlags;
|
||||
|
||||
file->Seek(offset, SEEK_SET);
|
||||
return file->ReadBytes(buffer, length);
|
||||
@ -28,7 +28,7 @@ ResultVal<std::size_t> DiskFile::Read(const u64 offset, const std::size_t length
|
||||
ResultVal<std::size_t> DiskFile::Write(const u64 offset, const std::size_t length, const bool flush,
|
||||
const u8* buffer) {
|
||||
if (!mode.write_flag)
|
||||
return ERROR_INVALID_OPEN_FLAGS;
|
||||
return ResultInvalidOpenFlags;
|
||||
|
||||
file->Seek(offset, SEEK_SET);
|
||||
std::size_t written = file->WriteBytes(buffer, length);
|
||||
|
@ -35,63 +35,60 @@ enum {
|
||||
};
|
||||
}
|
||||
|
||||
constexpr ResultCode ERROR_INVALID_PATH(ErrCodes::InvalidPath, ErrorModule::FS,
|
||||
constexpr Result ResultInvalidPath(ErrCodes::InvalidPath, ErrorModule::FS,
|
||||
ErrorSummary::InvalidArgument, ErrorLevel::Usage);
|
||||
constexpr ResultCode ERROR_UNSUPPORTED_OPEN_FLAGS(ErrCodes::UnsupportedOpenFlags, ErrorModule::FS,
|
||||
constexpr Result ResultUnsupportedOpenFlags(ErrCodes::UnsupportedOpenFlags, ErrorModule::FS,
|
||||
ErrorSummary::NotSupported, ErrorLevel::Usage);
|
||||
constexpr ResultCode ERROR_INVALID_OPEN_FLAGS(ErrCodes::InvalidOpenFlags, ErrorModule::FS,
|
||||
constexpr Result ResultInvalidOpenFlags(ErrCodes::InvalidOpenFlags, ErrorModule::FS,
|
||||
ErrorSummary::Canceled, ErrorLevel::Status);
|
||||
constexpr ResultCode ERROR_INVALID_READ_FLAG(ErrCodes::InvalidReadFlag, ErrorModule::FS,
|
||||
constexpr Result ResultInvalidReadFlag(ErrCodes::InvalidReadFlag, ErrorModule::FS,
|
||||
ErrorSummary::InvalidArgument, ErrorLevel::Usage);
|
||||
constexpr ResultCode ERROR_FILE_NOT_FOUND(ErrCodes::FileNotFound, ErrorModule::FS,
|
||||
ErrorSummary::NotFound, ErrorLevel::Status);
|
||||
constexpr ResultCode 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 ResultFileNotFound(ErrCodes::FileNotFound, ErrorModule::FS, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
constexpr ResultCode ERROR_UNEXPECTED_FILE_OR_DIRECTORY(ErrCodes::UnexpectedFileOrDirectory,
|
||||
constexpr Result ResultPathNotFound(ErrCodes::PathNotFound, ErrorModule::FS, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
constexpr Result ResultNotFound(ErrCodes::NotFound, ErrorModule::FS, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
constexpr Result ResultUnexpectedFileOrDirectory(ErrCodes::UnexpectedFileOrDirectory,
|
||||
ErrorModule::FS, ErrorSummary::NotSupported,
|
||||
ErrorLevel::Usage);
|
||||
constexpr ResultCode 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,
|
||||
ErrorSummary::NothingHappened, ErrorLevel::Status);
|
||||
constexpr ResultCode ERROR_ALREADY_EXISTS(ErrCodes::AlreadyExists, ErrorModule::FS,
|
||||
ErrorSummary::NothingHappened, ErrorLevel::Status);
|
||||
constexpr ResultCode ERROR_DIRECTORY_NOT_EMPTY(ErrCodes::DirectoryNotEmpty, ErrorModule::FS,
|
||||
constexpr Result ResultUnexpectedFileOrDirectorySdmc(ErrCodes::NotAFile, ErrorModule::FS,
|
||||
ErrorSummary::Canceled, ErrorLevel::Status);
|
||||
constexpr ResultCode ERROR_GAMECARD_NOT_INSERTED(ErrCodes::GameCardNotInserted, ErrorModule::FS,
|
||||
constexpr Result ResultDirectoryAlreadyExists(ErrCodes::DirectoryAlreadyExists, ErrorModule::FS,
|
||||
ErrorSummary::NothingHappened, ErrorLevel::Status);
|
||||
constexpr Result ResultFileAlreadyExists(ErrCodes::FileAlreadyExists, ErrorModule::FS,
|
||||
ErrorSummary::NothingHappened, ErrorLevel::Status);
|
||||
constexpr Result ResultAlreadyExists(ErrCodes::AlreadyExists, ErrorModule::FS,
|
||||
ErrorSummary::NothingHappened, ErrorLevel::Status);
|
||||
constexpr Result ResultDirectoryNotEmpty(ErrCodes::DirectoryNotEmpty, ErrorModule::FS,
|
||||
ErrorSummary::Canceled, ErrorLevel::Status);
|
||||
constexpr Result ResultGamecardNotInserted(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 ResultIncorrectExefsReadSize(ErrCodes::IncorrectExeFSReadSize, ErrorModule::FS,
|
||||
ErrorSummary::NotSupported, ErrorLevel::Usage);
|
||||
constexpr Result ResultRomfsNotFound(ErrCodes::RomFSNotFound, ErrorModule::FS,
|
||||
ErrorSummary::NotFound, ErrorLevel::Status);
|
||||
constexpr ResultCode ERROR_COMMAND_NOT_ALLOWED(ErrCodes::CommandNotAllowed, ErrorModule::FS,
|
||||
constexpr Result ResultCommandNotAllowed(ErrCodes::CommandNotAllowed, ErrorModule::FS,
|
||||
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
|
||||
constexpr ResultCode ERROR_EXEFS_SECTION_NOT_FOUND(ErrCodes::ExeFSSectionNotFound, ErrorModule::FS,
|
||||
constexpr Result ResultExefsSectionNotFound(ErrCodes::ExeFSSectionNotFound, ErrorModule::FS,
|
||||
ErrorSummary::NotFound, ErrorLevel::Status);
|
||||
constexpr ResultCode ERROR_INSUFFICIENT_SPACE(ErrCodes::InsufficientSpace, ErrorModule::FS,
|
||||
constexpr Result ResultInsufficientSpace(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 ResultInvalidArchiveHandle(ErrCodes::ArchiveNotMounted, ErrorModule::FS,
|
||||
ErrorSummary::NotFound,
|
||||
ErrorLevel::Status); // 0xC8804465
|
||||
constexpr ResultCode ERR_WRITE_BEYOND_END(ErrCodes::WriteBeyondEnd, ErrorModule::FS,
|
||||
constexpr Result ResultWriteBeyondEnd(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
|
||||
* Variant of ResultNotFound 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 ResultNotFoundInvalidState(ErrCodes::NotFound, ErrorModule::FS,
|
||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
constexpr ResultCode ERR_NOT_FORMATTED(ErrCodes::NotFormatted, ErrorModule::FS,
|
||||
constexpr Result ResultNotFormatted(ErrCodes::NotFormatted, ErrorModule::FS,
|
||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
|
||||
} // namespace FileSys
|
||||
|
@ -34,50 +34,50 @@ 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;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
ResultVal<std::unique_ptr<DirectoryBackend>> IVFCArchive::OpenDirectory(const Path& path) const {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -43,17 +43,17 @@ ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& pa
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
if (mode.hex == 0) {
|
||||
LOG_ERROR(Service_FS, "Empty open mode");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
if (mode.create_flag && !mode.write_flag) {
|
||||
LOG_ERROR(Service_FS, "Create flag set but write flag not set");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
return ResultUnsupportedOpenFlags;
|
||||
}
|
||||
|
||||
const auto full_path = path_parser.BuildHostPath(mount_point);
|
||||
@ -61,19 +61,19 @@ ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& pa
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
return ResultFileNotFound;
|
||||
case PathParser::PathNotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
return ResultPathNotFound;
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::DirectoryFound:
|
||||
LOG_ERROR(Service_FS, "Unexpected file or directory in {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||
return ResultUnexpectedFileOrDirectory;
|
||||
case PathParser::NotFound:
|
||||
if (!mode.create_flag) {
|
||||
LOG_ERROR(Service_FS, "Non-existing file {} can't be open without mode create.",
|
||||
full_path);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
return ResultFileNotFound;
|
||||
} else {
|
||||
// Create the file
|
||||
FileUtil::CreateEmptyFile(full_path);
|
||||
@ -86,19 +86,19 @@ ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& pa
|
||||
FileUtil::IOFile file(full_path, mode.write_flag ? "r+b" : "rb");
|
||||
if (!file.IsOpen()) {
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
return ResultFileNotFound;
|
||||
}
|
||||
|
||||
std::unique_ptr<DelayGenerator> delay_generator = std::make_unique<SaveDataDelayGenerator>();
|
||||
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()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const auto full_path = path_parser.BuildHostPath(mount_point);
|
||||
@ -106,110 +106,109 @@ ResultCode SaveDataArchive::DeleteFile(const Path& path) const {
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
return ResultFileNotFound;
|
||||
case PathParser::PathNotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
return ResultPathNotFound;
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::DirectoryFound:
|
||||
case PathParser::NotFound:
|
||||
LOG_ERROR(Service_FS, "File not found {}", full_path);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
return ResultFileNotFound;
|
||||
case PathParser::FileFound:
|
||||
break; // Expected 'success' case
|
||||
}
|
||||
|
||||
if (FileUtil::Delete(full_path)) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting {}", full_path);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
return ResultFileNotFound;
|
||||
}
|
||||
|
||||
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
|
||||
if (!path_parser_src.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const PathParser path_parser_dest(dest_path);
|
||||
|
||||
if (!path_parser_dest.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const auto src_path_full = path_parser_src.BuildHostPath(mount_point);
|
||||
const auto dest_path_full = path_parser_dest.BuildHostPath(mount_point);
|
||||
|
||||
if (FileUtil::Rename(src_path_full, dest_path_full)) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
// 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()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
if (path_parser.IsRootDirectory())
|
||||
return ERROR_DIRECTORY_NOT_EMPTY;
|
||||
return ResultDirectoryNotEmpty;
|
||||
|
||||
const auto full_path = path_parser.BuildHostPath(mount_point);
|
||||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
return ResultPathNotFound;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::NotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
return ResultPathNotFound;
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "Unexpected file or directory {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||
return ResultUnexpectedFileOrDirectory;
|
||||
case PathParser::DirectoryFound:
|
||||
break; // Expected 'success' case
|
||||
}
|
||||
|
||||
if (deleter(full_path)) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
LOG_ERROR(Service_FS, "Directory not empty {}", full_path);
|
||||
return ERROR_DIRECTORY_NOT_EMPTY;
|
||||
return ResultDirectoryNotEmpty;
|
||||
}
|
||||
|
||||
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()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const auto full_path = path_parser.BuildHostPath(mount_point);
|
||||
@ -217,44 +216,44 @@ ResultCode SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) cons
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
return ResultFileNotFound;
|
||||
case PathParser::PathNotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
return ResultPathNotFound;
|
||||
case PathParser::FileInPath:
|
||||
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||
return ResultUnexpectedFileOrDirectory;
|
||||
case PathParser::DirectoryFound:
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||
return ERROR_FILE_ALREADY_EXISTS;
|
||||
return ResultFileAlreadyExists;
|
||||
case PathParser::NotFound:
|
||||
break; // Expected 'success' case
|
||||
}
|
||||
|
||||
if (size == 0) {
|
||||
FileUtil::CreateEmptyFile(full_path);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
FileUtil::IOFile file(full_path, "wb");
|
||||
// Creates a sparse file (or a normal file on filesystems without the concept of sparse files)
|
||||
// We do this by seeking to the right size, then writing a single null byte.
|
||||
if (file.Seek(size - 1, SEEK_SET) && file.WriteBytes("", 1) == 1) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const auto full_path = path_parser.BuildHostPath(mount_point);
|
||||
@ -262,56 +261,56 @@ ResultCode SaveDataArchive::CreateDirectory(const Path& path) const {
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
return ResultFileNotFound;
|
||||
case PathParser::PathNotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
return ResultPathNotFound;
|
||||
case PathParser::FileInPath:
|
||||
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||
return ResultUnexpectedFileOrDirectory;
|
||||
case PathParser::DirectoryFound:
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||
return ERROR_DIRECTORY_ALREADY_EXISTS;
|
||||
return ResultDirectoryAlreadyExists;
|
||||
case PathParser::NotFound:
|
||||
break; // Expected 'success' case
|
||||
}
|
||||
|
||||
if (FileUtil::CreateDir(mount_point + path.AsString())) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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
|
||||
if (!path_parser_src.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const PathParser path_parser_dest(dest_path);
|
||||
|
||||
if (!path_parser_dest.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const auto src_path_full = path_parser_src.BuildHostPath(mount_point);
|
||||
const auto dest_path_full = path_parser_dest.BuildHostPath(mount_point);
|
||||
|
||||
if (FileUtil::Rename(src_path_full, dest_path_full)) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
@ -321,7 +320,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SaveDataArchive::OpenDirectory(
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
return ResultInvalidPath;
|
||||
}
|
||||
|
||||
const auto full_path = path_parser.BuildHostPath(mount_point);
|
||||
@ -329,15 +328,15 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SaveDataArchive::OpenDirectory(
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
return ResultFileNotFound;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::NotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
return ResultPathNotFound;
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||
return ResultUnexpectedFileOrDirectory;
|
||||
case PathParser::DirectoryFound:
|
||||
break; // Expected 'success' case
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
@ -66,7 +66,7 @@ ResultCode Applet::Create(Service::APT::AppletId id, Service::APT::AppletId pare
|
||||
// Schedule the update event
|
||||
Core::System::GetInstance().CoreTiming().ScheduleEvent(
|
||||
usToCycles(applet_update_interval_us), applet_update_event, static_cast<u64>(id));
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
std::shared_ptr<Applet> Applet::Get(Service::APT::AppletId id) {
|
||||
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 ResultUnknown;
|
||||
}
|
||||
|
||||
// The LibAppJustStarted message contains a buffer with the size of the framebuffer shared
|
||||
@ -40,10 +40,10 @@ ResultCode ErrEula::ReceiveParameterImpl(const Service::APT::MessageParameter& p
|
||||
.object = framebuffer_memory,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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
|
||||
@ -52,14 +52,14 @@ ResultCode ErrEula::Start(const Service::APT::MessageParameter& parameter) {
|
||||
|
||||
// Let the application know that we're closing.
|
||||
Finalize();
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode ErrEula::Finalize() {
|
||||
Result ErrEula::Finalize() {
|
||||
std::vector<u8> buffer(startup_param.size());
|
||||
std::fill(buffer.begin(), buffer.end(), 0);
|
||||
CloseApplet(nullptr, buffer);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void ErrEula::Update() {}
|
||||
|
@ -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:
|
||||
|
@ -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 ResultUnknown;
|
||||
}
|
||||
|
||||
// The LibAppJustStarted message contains a buffer with the size of the framebuffer shared
|
||||
@ -47,10 +47,10 @@ ResultCode MiiSelector::ReceiveParameterImpl(const Service::APT::MessageParamete
|
||||
.object = framebuffer_memory,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
@ -63,7 +63,7 @@ ResultCode MiiSelector::Start(const Service::APT::MessageParameter& parameter) {
|
||||
MiiSelectorConfig frontend_config = ToFrontendConfig(config);
|
||||
frontend_applet->Setup(frontend_config);
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void MiiSelector::Update() {
|
||||
@ -78,11 +78,11 @@ 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);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
MiiResult MiiSelector::GetStandardMiiResult() {
|
||||
|
@ -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();
|
||||
|
@ -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 ResultUnknown;
|
||||
}
|
||||
|
||||
// The Request message contains a buffer with the size of the framebuffer shared
|
||||
@ -40,10 +40,10 @@ ResultCode Mint::ReceiveParameterImpl(const Service::APT::MessageParameter& para
|
||||
.object = framebuffer_memory,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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
|
||||
@ -52,14 +52,14 @@ ResultCode Mint::Start(const Service::APT::MessageParameter& parameter) {
|
||||
|
||||
// Let the application know that we're closing
|
||||
Finalize();
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode Mint::Finalize() {
|
||||
Result Mint::Finalize() {
|
||||
std::vector<u8> buffer(startup_param.size());
|
||||
std::fill(buffer.begin(), buffer.end(), 0);
|
||||
CloseApplet(nullptr, buffer);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void Mint::Update() {}
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
@ -44,7 +44,7 @@ ResultCode SoftwareKeyboard::ReceiveParameterImpl(Service::APT::MessageParameter
|
||||
.object = framebuffer_memory,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
case Service::APT::SignalType::Message: {
|
||||
@ -58,7 +58,7 @@ ResultCode SoftwareKeyboard::ReceiveParameterImpl(Service::APT::MessageParameter
|
||||
case SoftwareKeyboardCallbackResult::OK:
|
||||
// Finish execution
|
||||
Finalize();
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
|
||||
case SoftwareKeyboardCallbackResult::Close:
|
||||
// Let the frontend display error and quit
|
||||
@ -66,14 +66,14 @@ ResultCode SoftwareKeyboard::ReceiveParameterImpl(Service::APT::MessageParameter
|
||||
config.return_code = SoftwareKeyboardResult::BannedInput;
|
||||
config.text_offset = config.text_length = 0;
|
||||
Finalize();
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
|
||||
case SoftwareKeyboardCallbackResult::Continue:
|
||||
// Let the frontend display error and get input again
|
||||
// The input will be sent for validation again on next Update().
|
||||
frontend_applet->ShowError(Common::UTF16BufferToUTF8(config.callback_msg));
|
||||
frontend_applet->Execute(ToFrontendConfig(config));
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -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 ResultUnknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
@ -104,7 +104,7 @@ ResultCode SoftwareKeyboard::Start(Service::APT::MessageParameter const& paramet
|
||||
|
||||
frontend_applet->Execute(ToFrontendConfig(config));
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void SoftwareKeyboard::Update() {
|
||||
@ -166,12 +166,12 @@ 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);
|
||||
text_memory = nullptr;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig(
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -20,8 +20,8 @@ constexpr std::size_t MAX_STATIC_BUFFERS = 16;
|
||||
// These errors are commonly returned by invalid IPC translations, so alias them here for
|
||||
// convenience.
|
||||
// TODO(yuriks): These will probably go away once translation is implemented inside the kernel.
|
||||
using Kernel::ERR_INVALID_BUFFER_DESCRIPTOR;
|
||||
constexpr auto ERR_INVALID_HANDLE = Kernel::ERR_INVALID_HANDLE_OS;
|
||||
using Kernel::ResultInvalidBufferDescriptor;
|
||||
constexpr auto ResultInvalidHandle = Kernel::ResultInvalidHandleOs;
|
||||
|
||||
enum DescriptorType : u32 {
|
||||
// Buffer related descriptors types (mask : 0x0F)
|
||||
|
@ -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>
|
||||
|
@ -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) {
|
||||
|
||||
@ -171,17 +171,16 @@ ResultCode AddressArbiter::ArbitrateAddress(std::shared_ptr<Thread> thread, Arbi
|
||||
|
||||
default:
|
||||
LOG_ERROR(Kernel, "unknown type={}", type);
|
||||
return ERR_INVALID_ENUM_VALUE_FND;
|
||||
return ResultInvalidEnumValueFnd;
|
||||
}
|
||||
|
||||
// The calls that use a timeout seem to always return a Timeout error even if they did not put
|
||||
// the thread to sleep
|
||||
if (type == ArbitrationType::WaitIfLessThanWithTimeout ||
|
||||
type == ArbitrationType::DecrementAndWaitIfLessThanWithTimeout) {
|
||||
|
||||
return RESULT_TIMEOUT;
|
||||
return ResultTimeout;
|
||||
}
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
} // namespace Kernel
|
||||
|
@ -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;
|
||||
|
@ -20,32 +20,31 @@ namespace Kernel {
|
||||
ClientPort::ClientPort(KernelSystem& kernel) : Object(kernel), kernel(kernel) {}
|
||||
ClientPort::~ClientPort() = default;
|
||||
|
||||
ResultVal<std::shared_ptr<ClientSession>> ClientPort::Connect() {
|
||||
Result ClientPort::Connect(std::shared_ptr<ClientSession>* out_client_session) {
|
||||
// Note: Threads do not wait for the server endpoint to call
|
||||
// AcceptSession before returning from this call.
|
||||
|
||||
if (active_sessions >= max_sessions) {
|
||||
return ERR_MAX_CONNECTIONS_REACHED;
|
||||
}
|
||||
R_UNLESS(active_sessions < max_sessions, ResultMaxConnectionsReached);
|
||||
active_sessions++;
|
||||
|
||||
// Create a new session pair, let the created sessions inherit the parent port's HLE handler.
|
||||
auto [server, client] = kernel.CreateSessionPair(server_port->GetName(), SharedFrom(this));
|
||||
|
||||
if (server_port->hle_handler)
|
||||
if (server_port->hle_handler) {
|
||||
server_port->hle_handler->ClientConnected(server);
|
||||
else
|
||||
} else {
|
||||
server_port->pending_sessions.push_back(server);
|
||||
}
|
||||
|
||||
// Wake the threads waiting on the ServerPort
|
||||
server_port->WakeupAllWaitingThreads();
|
||||
|
||||
return client;
|
||||
*out_client_session = client;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void ClientPort::ConnectionClosed() {
|
||||
ASSERT(active_sessions > 0);
|
||||
|
||||
--active_sessions;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
* waiting on it to awake.
|
||||
* @returns ClientSession The client endpoint of the created Session pair, or error code.
|
||||
*/
|
||||
ResultVal<std::shared_ptr<ClientSession>> Connect();
|
||||
Result Connect(std::shared_ptr<ClientSession>* out_client_session);
|
||||
|
||||
/**
|
||||
* Signifies that a previously active connection has been closed,
|
||||
|
@ -44,11 +44,10 @@ 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);
|
||||
if (server == nullptr)
|
||||
return ERR_SESSION_CLOSED_BY_REMOTE;
|
||||
R_UNLESS(server, ResultSessionClosed);
|
||||
|
||||
// Signal the server session that new data is available
|
||||
return server->HandleSyncRequest(std::move(thread));
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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 ResultOutOfHandles(ErrCodes::OutOfHandles, ErrorModule::Kernel,
|
||||
ErrorSummary::OutOfResource,
|
||||
ErrorLevel::Permanent); // 0xD8600413
|
||||
constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(ErrCodes::SessionClosedByRemote, ErrorModule::OS,
|
||||
constexpr Result ResultSessionClosed(ErrCodes::SessionClosedByRemote, ErrorModule::OS,
|
||||
ErrorSummary::Canceled,
|
||||
ErrorLevel::Status); // 0xC920181A
|
||||
constexpr ResultCode ERR_PORT_NAME_TOO_LONG(ErrCodes::PortNameTooLong, ErrorModule::OS,
|
||||
constexpr Result ResultPortNameTooLong(ErrCodes::PortNameTooLong, ErrorModule::OS,
|
||||
ErrorSummary::InvalidArgument,
|
||||
ErrorLevel::Usage); // 0xE0E0181E
|
||||
constexpr ResultCode ERR_WRONG_PERMISSION(ErrCodes::WrongPermission, ErrorModule::OS,
|
||||
constexpr Result ResultWrongPermission(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 ResultInvalidBufferDescriptor(ErrCodes::InvalidBufferDescriptor, ErrorModule::OS,
|
||||
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
|
||||
constexpr Result ResultMaxConnectionsReached(ErrCodes::MaxConnectionsReached, ErrorModule::OS,
|
||||
ErrorSummary::WouldBlock,
|
||||
ErrorLevel::Temporary); // 0xD0401834
|
||||
|
||||
constexpr ResultCode ERR_NOT_AUTHORIZED(ErrorDescription::NotAuthorized, ErrorModule::OS,
|
||||
constexpr Result ResultNotAuthorized(ErrorDescription::NotAuthorized, ErrorModule::OS,
|
||||
ErrorSummary::WrongArgument,
|
||||
ErrorLevel::Permanent); // 0xD9001BEA
|
||||
constexpr ResultCode ERR_INVALID_ENUM_VALUE(ErrorDescription::InvalidEnumValue, ErrorModule::Kernel,
|
||||
constexpr Result ResultInvalidEnumValue(ErrorDescription::InvalidEnumValue, ErrorModule::Kernel,
|
||||
ErrorSummary::InvalidArgument,
|
||||
ErrorLevel::Permanent); // 0xD8E007ED
|
||||
constexpr ResultCode ERR_INVALID_ENUM_VALUE_FND(ErrorDescription::InvalidEnumValue,
|
||||
ErrorModule::FND, ErrorSummary::InvalidArgument,
|
||||
constexpr Result ResultInvalidEnumValueFnd(ErrorDescription::InvalidEnumValue, ErrorModule::FND,
|
||||
ErrorSummary::InvalidArgument,
|
||||
ErrorLevel::Permanent); // 0xD8E093ED
|
||||
constexpr ResultCode ERR_INVALID_COMBINATION(ErrorDescription::InvalidCombination, ErrorModule::OS,
|
||||
constexpr Result ResultInvalidCombination(ErrorDescription::InvalidCombination, ErrorModule::OS,
|
||||
ErrorSummary::InvalidArgument,
|
||||
ErrorLevel::Usage); // 0xE0E01BEE
|
||||
constexpr ResultCode ERR_INVALID_COMBINATION_KERNEL(ErrorDescription::InvalidCombination,
|
||||
ErrorModule::Kernel,
|
||||
ErrorSummary::WrongArgument,
|
||||
constexpr Result ResultInvalidCombinationKernel(ErrorDescription::InvalidCombination,
|
||||
ErrorModule::Kernel, ErrorSummary::WrongArgument,
|
||||
ErrorLevel::Permanent); // 0xD90007EE
|
||||
constexpr ResultCode ERR_MISALIGNED_ADDRESS(ErrorDescription::MisalignedAddress, ErrorModule::OS,
|
||||
constexpr Result ResultMisalignedAddress(ErrorDescription::MisalignedAddress, ErrorModule::OS,
|
||||
ErrorSummary::InvalidArgument,
|
||||
ErrorLevel::Usage); // 0xE0E01BF1
|
||||
constexpr ResultCode ERR_MISALIGNED_SIZE(ErrorDescription::MisalignedSize, ErrorModule::OS,
|
||||
constexpr Result ResultMisalignedSize(ErrorDescription::MisalignedSize, ErrorModule::OS,
|
||||
ErrorSummary::InvalidArgument,
|
||||
ErrorLevel::Usage); // 0xE0E01BF2
|
||||
constexpr ResultCode ERR_OUT_OF_MEMORY(ErrorDescription::OutOfMemory, ErrorModule::Kernel,
|
||||
constexpr Result ResultOutOfMemory(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 ResultOutOfHeapMemory(ErrorDescription::OutOfMemory, ErrorModule::OS,
|
||||
ErrorSummary::OutOfResource,
|
||||
ErrorLevel::Status); // 0xC860180A
|
||||
constexpr ResultCode ERR_NOT_IMPLEMENTED(ErrorDescription::NotImplemented, ErrorModule::OS,
|
||||
constexpr Result ResultNotImplemented(ErrorDescription::NotImplemented, ErrorModule::OS,
|
||||
ErrorSummary::InvalidArgument,
|
||||
ErrorLevel::Usage); // 0xE0E01BF4
|
||||
constexpr ResultCode ERR_INVALID_ADDRESS(ErrorDescription::InvalidAddress, ErrorModule::OS,
|
||||
constexpr Result ResultInvalidAddress(ErrorDescription::InvalidAddress, ErrorModule::OS,
|
||||
ErrorSummary::InvalidArgument,
|
||||
ErrorLevel::Usage); // 0xE0E01BF5
|
||||
constexpr ResultCode ERR_INVALID_ADDRESS_STATE(ErrorDescription::InvalidAddress, ErrorModule::OS,
|
||||
constexpr Result ResultInvalidAddressState(ErrorDescription::InvalidAddress, ErrorModule::OS,
|
||||
ErrorSummary::InvalidState,
|
||||
ErrorLevel::Usage); // 0xE0A01BF5
|
||||
constexpr ResultCode ERR_INVALID_POINTER(ErrorDescription::InvalidPointer, ErrorModule::Kernel,
|
||||
constexpr Result ResultInvalidPointer(ErrorDescription::InvalidPointer, ErrorModule::Kernel,
|
||||
ErrorSummary::InvalidArgument,
|
||||
ErrorLevel::Permanent); // 0xD8E007F6
|
||||
constexpr ResultCode ERR_INVALID_HANDLE(ErrorDescription::InvalidHandle, ErrorModule::Kernel,
|
||||
constexpr Result ResultInvalidHandle(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,
|
||||
/// Alternate code returned instead of ResultInvalidHandle in some code paths.
|
||||
constexpr Result ResultInvalidHandleOs(ErrorDescription::InvalidHandle, ErrorModule::OS,
|
||||
ErrorSummary::WrongArgument,
|
||||
ErrorLevel::Permanent); // 0xD9001BF7
|
||||
constexpr ResultCode ERR_NOT_FOUND(ErrorDescription::NotFound, ErrorModule::Kernel,
|
||||
constexpr Result ResultNotFound(ErrorDescription::NotFound, ErrorModule::Kernel,
|
||||
ErrorSummary::NotFound, ErrorLevel::Permanent); // 0xD88007FA
|
||||
constexpr ResultCode ERR_OUT_OF_RANGE(ErrorDescription::OutOfRange, ErrorModule::OS,
|
||||
constexpr Result ResultOutOfRange(ErrorDescription::OutOfRange, ErrorModule::OS,
|
||||
ErrorSummary::InvalidArgument,
|
||||
ErrorLevel::Usage); // 0xE0E01BFD
|
||||
constexpr ResultCode ERR_OUT_OF_RANGE_KERNEL(ErrorDescription::OutOfRange, ErrorModule::Kernel,
|
||||
constexpr Result ResultOutOfRangeKernel(ErrorDescription::OutOfRange, ErrorModule::Kernel,
|
||||
ErrorSummary::InvalidArgument,
|
||||
ErrorLevel::Permanent); // 0xD8E007FD
|
||||
constexpr ResultCode RESULT_TIMEOUT(ErrorDescription::Timeout, ErrorModule::OS,
|
||||
constexpr Result ResultTimeout(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 ResultNoPendingSessions(ErrCodes::NoPendingSessions, ErrorModule::OS,
|
||||
ErrorSummary::WouldBlock,
|
||||
ErrorLevel::Permanent); // 0xD8401823
|
||||
|
||||
|
@ -36,9 +36,10 @@ bool Event::ShouldWait(const Thread* thread) const {
|
||||
void Event::Acquire(Thread* thread) {
|
||||
ASSERT_MSG(!ShouldWait(thread), "object unavailable!");
|
||||
|
||||
if (reset_type == ResetType::OneShot)
|
||||
if (reset_type == ResetType::OneShot) {
|
||||
signaled = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Event::Signal() {
|
||||
signaled = true;
|
||||
@ -52,8 +53,9 @@ void Event::Clear() {
|
||||
void Event::WakeupAllWaitingThreads() {
|
||||
WaitObject::WakeupAllWaitingThreads();
|
||||
|
||||
if (reset_type == ResetType::Pulse)
|
||||
if (reset_type == ResetType::Pulse) {
|
||||
signaled = false;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Kernel
|
||||
|
@ -28,56 +28,48 @@ HandleTable::HandleTable(KernelSystem& kernel) : kernel(kernel) {
|
||||
|
||||
HandleTable::~HandleTable() = default;
|
||||
|
||||
ResultVal<Handle> HandleTable::Create(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;
|
||||
if (slot >= generations.size()) {
|
||||
LOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use.");
|
||||
return ERR_OUT_OF_HANDLES;
|
||||
}
|
||||
R_UNLESS(slot < generations.size(), ResultOutOfHandles);
|
||||
next_free_slot = generations[slot];
|
||||
|
||||
u16 generation = next_generation++;
|
||||
|
||||
// Overflow count so it fits in the 15 bits dedicated to the generation in the handle.
|
||||
// CTR-OS doesn't use generation 0, so skip straight to 1.
|
||||
if (next_generation >= (1 << 15))
|
||||
if (next_generation >= (1 << 15)) {
|
||||
next_generation = 1;
|
||||
}
|
||||
|
||||
generations[slot] = generation;
|
||||
objects[slot] = std::move(obj);
|
||||
|
||||
Handle handle = generation | (slot << 15);
|
||||
return handle;
|
||||
*out_handle = generation | (slot << 15);
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultVal<Handle> HandleTable::Duplicate(Handle handle) {
|
||||
Result HandleTable::Duplicate(Handle* out_handle, Handle handle) {
|
||||
std::shared_ptr<Object> object = GetGeneric(handle);
|
||||
if (object == nullptr) {
|
||||
LOG_ERROR(Kernel, "Tried to duplicate invalid handle: {:08X}", handle);
|
||||
return ERR_INVALID_HANDLE;
|
||||
}
|
||||
return Create(std::move(object));
|
||||
R_UNLESS(object, ResultInvalidHandle);
|
||||
return Create(out_handle, std::move(object));
|
||||
}
|
||||
|
||||
ResultCode HandleTable::Close(Handle handle) {
|
||||
if (!IsValid(handle))
|
||||
return ERR_INVALID_HANDLE;
|
||||
|
||||
u16 slot = GetSlot(handle);
|
||||
Result HandleTable::Close(Handle handle) {
|
||||
R_UNLESS(IsValid(handle), ResultInvalidHandle);
|
||||
|
||||
const u16 slot = GetSlot(handle);
|
||||
objects[slot] = nullptr;
|
||||
|
||||
generations[slot] = next_free_slot;
|
||||
next_free_slot = slot;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
bool HandleTable::IsValid(Handle handle) const {
|
||||
std::size_t slot = GetSlot(handle);
|
||||
u16 generation = GetGeneration(handle);
|
||||
|
||||
const u16 slot = GetSlot(handle);
|
||||
const u16 generation = GetGeneration(handle);
|
||||
return slot < MAX_COUNT && objects[slot] != nullptr && generations[slot] == generation;
|
||||
}
|
||||
|
||||
|
@ -51,24 +51,24 @@ public:
|
||||
/**
|
||||
* Allocates a handle for the given object.
|
||||
* @return The created Handle or one of the following errors:
|
||||
* - `ERR_OUT_OF_HANDLES`: the maximum number of handles has been exceeded.
|
||||
* - `ResultOutOfHandles`: the maximum number of handles has been exceeded.
|
||||
*/
|
||||
ResultVal<Handle> Create(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.
|
||||
* @return The duplicated Handle or one of the following errors:
|
||||
* - `ERR_INVALID_HANDLE`: an invalid handle was passed in.
|
||||
* - `ResultInvalidHandle`: an invalid handle was passed in.
|
||||
* - Any errors returned by `Create()`.
|
||||
*/
|
||||
ResultVal<Handle> Duplicate(Handle handle);
|
||||
Result Duplicate(Handle* out_handle, 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.
|
||||
* @return `ResultSuccess` or one of the following errors:
|
||||
* - `ResultInvalidHandle`: 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;
|
||||
|
@ -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]};
|
||||
|
||||
@ -203,10 +203,10 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(
|
||||
std::move(translated_cmdbuf));
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf,
|
||||
Result HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf,
|
||||
Process& dst_process) const {
|
||||
IPC::Header header{cmd_buf[0]};
|
||||
|
||||
@ -239,7 +239,7 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf,
|
||||
Handle handle = 0;
|
||||
if (object != nullptr) {
|
||||
// TODO(yuriks): Figure out the proper error handling for if this fails
|
||||
handle = dst_process.handle_table.Create(object).Unwrap();
|
||||
R_ASSERT(dst_process.handle_table.Create(std::addressof(handle), object));
|
||||
}
|
||||
dst_cmdbuf[i++] = handle;
|
||||
}
|
||||
@ -281,7 +281,7 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf,
|
||||
std::move(translated_cmdbuf));
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
MappedBuffer& HLERequestContext::GetMappedBuffer(u32 id_from_cmdbuf) {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
@ -88,8 +87,8 @@ ResultCode TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySy
|
||||
continue;
|
||||
}
|
||||
|
||||
auto result = dst_process->handle_table.Create(std::move(object));
|
||||
cmd_buf[i++] = result.ValueOr(0);
|
||||
R_ASSERT(dst_process->handle_table.Create(std::addressof(cmd_buf[i++]),
|
||||
std::move(object)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -180,10 +179,10 @@ 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);
|
||||
ASSERT(result == ResultSuccess);
|
||||
|
||||
mapped_buffer_context.erase(found);
|
||||
|
||||
@ -216,11 +215,11 @@ ResultCode TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySy
|
||||
ASSERT(dst_process->vm_manager.ChangeMemoryState(
|
||||
low_guard_address, Memory::CITRA_PAGE_SIZE, Kernel::MemoryState::Shared,
|
||||
Kernel::VMAPermission::ReadWrite, Kernel::MemoryState::Reserved,
|
||||
Kernel::VMAPermission::None) == RESULT_SUCCESS);
|
||||
Kernel::VMAPermission::None) == ResultSuccess);
|
||||
ASSERT(dst_process->vm_manager.ChangeMemoryState(
|
||||
high_guard_address, Memory::CITRA_PAGE_SIZE, Kernel::MemoryState::Shared,
|
||||
Kernel::VMAPermission::ReadWrite, Kernel::MemoryState::Reserved,
|
||||
Kernel::VMAPermission::None) == RESULT_SUCCESS);
|
||||
Kernel::VMAPermission::None) == ResultSuccess);
|
||||
|
||||
// Get proper mapped buffer address and store it in the cmd buffer.
|
||||
target_address += Memory::CITRA_PAGE_SIZE;
|
||||
@ -249,6 +248,6 @@ ResultCode TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySy
|
||||
|
||||
memory.WriteBlock(*dst_process, dst_address, cmd_buf.data(), command_size * sizeof(u32));
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
} // namespace Kernel
|
||||
|
@ -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
|
||||
|
@ -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--;
|
||||
@ -96,7 +96,7 @@ ResultCode Mutex::Release(Thread* thread) {
|
||||
kernel.PrepareReschedule();
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void Mutex::AddWaitingThread(std::shared_ptr<Thread> thread) {
|
||||
|
@ -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;
|
||||
|
@ -192,9 +192,12 @@ void Process::Run(s32 main_thread_priority, u32 stack_size) {
|
||||
return;
|
||||
}
|
||||
|
||||
VAddr out_addr{};
|
||||
|
||||
auto MapSegment = [&](CodeSet::Segment& segment, VMAPermission permissions,
|
||||
MemoryState memory_state) {
|
||||
HeapAllocate(segment.addr, segment.size, permissions, memory_state, true);
|
||||
HeapAllocate(std::addressof(out_addr), segment.addr, segment.size, permissions,
|
||||
memory_state, true);
|
||||
kernel.memory.WriteBlock(*this, segment.addr, codeset->memory.data() + segment.offset,
|
||||
segment.size);
|
||||
};
|
||||
@ -205,8 +208,8 @@ void Process::Run(s32 main_thread_priority, u32 stack_size) {
|
||||
MapSegment(codeset->DataSegment(), VMAPermission::ReadWrite, MemoryState::Private);
|
||||
|
||||
// Allocate and map stack
|
||||
HeapAllocate(Memory::HEAP_VADDR_END - stack_size, stack_size, VMAPermission::ReadWrite,
|
||||
MemoryState::Locked, true);
|
||||
HeapAllocate(std::addressof(out_addr), Memory::HEAP_VADDR_END - stack_size, stack_size,
|
||||
VMAPermission::ReadWrite, MemoryState::Locked, true);
|
||||
|
||||
// Map special address mappings
|
||||
kernel.MapSharedPages(vm_manager);
|
||||
@ -246,14 +249,14 @@ VAddr Process::GetLinearHeapLimit() const {
|
||||
return GetLinearHeapBase() + memory_region->size;
|
||||
}
|
||||
|
||||
ResultVal<VAddr> Process::HeapAllocate(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 ||
|
||||
target + size < target) {
|
||||
if (!skip_range_check) {
|
||||
LOG_ERROR(Kernel, "Invalid heap address");
|
||||
return ERR_INVALID_ADDRESS;
|
||||
return ResultInvalidAddress;
|
||||
}
|
||||
}
|
||||
{
|
||||
@ -261,13 +264,13 @@ ResultVal<VAddr> Process::HeapAllocate(VAddr target, u32 size, VMAPermission per
|
||||
if (vma->second.type != VMAType::Free ||
|
||||
vma->second.base + vma->second.size < target + size) {
|
||||
LOG_ERROR(Kernel, "Trying to allocate already allocated memory");
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
return ResultInvalidAddressState;
|
||||
}
|
||||
}
|
||||
auto allocated_fcram = memory_region->HeapAllocate(size);
|
||||
if (allocated_fcram.empty()) {
|
||||
LOG_ERROR(Kernel, "Not enough space");
|
||||
return ERR_OUT_OF_HEAP_MEMORY;
|
||||
return ResultOutOfHeapMemory;
|
||||
}
|
||||
|
||||
// Maps heap block by block
|
||||
@ -290,20 +293,19 @@ ResultVal<VAddr> Process::HeapAllocate(VAddr target, u32 size, VMAPermission per
|
||||
memory_used += size;
|
||||
resource_limit->Reserve(ResourceLimitType::Commit, size);
|
||||
|
||||
return target;
|
||||
*out_addr = target;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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) {
|
||||
LOG_ERROR(Kernel, "Invalid heap address");
|
||||
return ERR_INVALID_ADDRESS;
|
||||
return ResultInvalidAddress;
|
||||
}
|
||||
|
||||
if (size == 0) {
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
R_SUCCEED_IF(size == 0);
|
||||
|
||||
// Free heaps block by block
|
||||
CASCADE_RESULT(auto backing_blocks, vm_manager.GetBackingBlocksForRange(target, size));
|
||||
@ -313,23 +315,23 @@ 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;
|
||||
resource_limit->Release(ResourceLimitType::Commit, size);
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultVal<VAddr> Process::LinearAllocate(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) {
|
||||
auto offset = memory_region->LinearAllocate(size);
|
||||
if (!offset) {
|
||||
LOG_ERROR(Kernel, "Not enough space");
|
||||
return ERR_OUT_OF_HEAP_MEMORY;
|
||||
return ResultOutOfHeapMemory;
|
||||
}
|
||||
physical_offset = *offset;
|
||||
target = physical_offset + GetLinearHeapAreaAddress();
|
||||
@ -337,7 +339,7 @@ ResultVal<VAddr> Process::LinearAllocate(VAddr target, u32 size, VMAPermission p
|
||||
if (target < GetLinearHeapBase() || target + size > GetLinearHeapLimit() ||
|
||||
target + size < target) {
|
||||
LOG_ERROR(Kernel, "Invalid linear heap address");
|
||||
return ERR_INVALID_ADDRESS;
|
||||
return ResultInvalidAddress;
|
||||
}
|
||||
|
||||
// Kernel would crash/return error when target doesn't meet some requirement.
|
||||
@ -350,7 +352,7 @@ ResultVal<VAddr> Process::LinearAllocate(VAddr target, u32 size, VMAPermission p
|
||||
physical_offset = target - GetLinearHeapAreaAddress(); // relative to FCRAM
|
||||
if (!memory_region->LinearAllocate(physical_offset, size)) {
|
||||
LOG_ERROR(Kernel, "Trying to allocate already allocated memory");
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
return ResultInvalidAddressState;
|
||||
}
|
||||
}
|
||||
|
||||
@ -366,26 +368,20 @@ ResultVal<VAddr> Process::LinearAllocate(VAddr target, u32 size, VMAPermission p
|
||||
resource_limit->Reserve(ResourceLimitType::Commit, size);
|
||||
|
||||
LOG_DEBUG(Kernel, "Allocated at target={:08X}", target);
|
||||
return target;
|
||||
*out_addr = target;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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) {
|
||||
LOG_ERROR(Kernel, "Invalid linear heap address");
|
||||
return ERR_INVALID_ADDRESS;
|
||||
return ResultInvalidAddress;
|
||||
}
|
||||
|
||||
if (size == 0) {
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ResultCode result = vm_manager.UnmapRange(target, size);
|
||||
if (result.IsError()) {
|
||||
LOG_ERROR(Kernel, "Trying to free already freed memory");
|
||||
return result;
|
||||
}
|
||||
R_SUCCEED_IF(size == 0);
|
||||
R_TRY(vm_manager.UnmapRange(target, size));
|
||||
|
||||
u32 physical_offset = target - GetLinearHeapAreaAddress(); // relative to FCRAM
|
||||
memory_region->Free(physical_offset, size);
|
||||
@ -394,7 +390,7 @@ ResultCode Process::LinearFree(VAddr target, u32 size) {
|
||||
memory_used -= size;
|
||||
resource_limit->Release(ResourceLimitType::Commit, size);
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultVal<VAddr> Process::AllocateThreadLocalStorage() {
|
||||
@ -435,7 +431,7 @@ ResultVal<VAddr> Process::AllocateThreadLocalStorage() {
|
||||
if (!offset) {
|
||||
LOG_ERROR(Kernel_SVC,
|
||||
"Not enough space in BASE linear region to allocate a new TLS page");
|
||||
return ERR_OUT_OF_MEMORY;
|
||||
return ResultOutOfMemory;
|
||||
}
|
||||
|
||||
holding_tls_memory +=
|
||||
@ -467,14 +463,13 @@ 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 ||
|
||||
source + size < source)) {
|
||||
LOG_ERROR(Kernel, "Invalid source address");
|
||||
return ERR_INVALID_ADDRESS;
|
||||
return ResultInvalidAddress;
|
||||
}
|
||||
|
||||
// TODO(wwylele): check target address range. Is it also restricted to heap region?
|
||||
@ -489,17 +484,17 @@ ResultCode Process::Map(VAddr target, VAddr source, u32 size, VMAPermission perm
|
||||
VMAPermission::ReadWrite,
|
||||
MemoryState::AliasCode, perms);
|
||||
} else {
|
||||
return ERR_INVALID_ADDRESS;
|
||||
return ResultInvalidAddress;
|
||||
}
|
||||
} else {
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
return ResultInvalidAddressState;
|
||||
}
|
||||
}
|
||||
|
||||
auto vma = vm_manager.FindVMA(target);
|
||||
if (vma->second.type != VMAType::Free || vma->second.base + vma->second.size < target + size) {
|
||||
LOG_ERROR(Kernel, "Trying to map to already allocated memory");
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
return ResultInvalidAddressState;
|
||||
}
|
||||
|
||||
MemoryState source_state = privileged ? MemoryState::Locked : MemoryState::Aliased;
|
||||
@ -507,8 +502,8 @@ ResultCode Process::Map(VAddr target, VAddr source, u32 size, VMAPermission perm
|
||||
VMAPermission source_perm = privileged ? VMAPermission::None : VMAPermission::ReadWrite;
|
||||
|
||||
// Mark source region as Aliased
|
||||
CASCADE_CODE(vm_manager.ChangeMemoryState(source, size, MemoryState::Private,
|
||||
VMAPermission::ReadWrite, source_state, source_perm));
|
||||
R_TRY(vm_manager.ChangeMemoryState(source, size, MemoryState::Private, VMAPermission::ReadWrite,
|
||||
source_state, source_perm));
|
||||
|
||||
CASCADE_RESULT(auto backing_blocks, vm_manager.GetBackingBlocksForRange(source, size));
|
||||
VAddr interval_target = target;
|
||||
@ -520,16 +515,15 @@ ResultCode Process::Map(VAddr target, VAddr source, u32 size, VMAPermission perm
|
||||
interval_target += block_size;
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
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 ||
|
||||
source + size < source)) {
|
||||
LOG_ERROR(Kernel, "Invalid source address");
|
||||
return ERR_INVALID_ADDRESS;
|
||||
return ResultInvalidAddress;
|
||||
}
|
||||
|
||||
// TODO(wwylele): check target address range. Is it also restricted to heap region?
|
||||
@ -543,10 +537,10 @@ ResultCode Process::Unmap(VAddr target, VAddr source, u32 size, VMAPermission pe
|
||||
VMAPermission::None, MemoryState::Private,
|
||||
perms);
|
||||
} else {
|
||||
return ERR_INVALID_ADDRESS;
|
||||
return ResultInvalidAddress;
|
||||
}
|
||||
} else {
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
return ResultInvalidAddressState;
|
||||
}
|
||||
}
|
||||
|
||||
@ -555,13 +549,13 @@ ResultCode Process::Unmap(VAddr target, VAddr source, u32 size, VMAPermission pe
|
||||
|
||||
MemoryState source_state = privileged ? MemoryState::Locked : MemoryState::Aliased;
|
||||
|
||||
CASCADE_CODE(vm_manager.UnmapRange(target, size));
|
||||
R_TRY(vm_manager.UnmapRange(target, size));
|
||||
|
||||
// Change back source region state. Note that the permission is reprotected according to param
|
||||
CASCADE_CODE(vm_manager.ChangeMemoryState(source, size, source_state, VMAPermission::None,
|
||||
R_TRY(vm_manager.ChangeMemoryState(source, size, source_state, VMAPermission::None,
|
||||
MemoryState::Private, perms));
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void Process::FreeAllMemory() {
|
||||
|
@ -231,19 +231,18 @@ public:
|
||||
VAddr GetLinearHeapBase() const;
|
||||
VAddr GetLinearHeapLimit() const;
|
||||
|
||||
ResultVal<VAddr> HeapAllocate(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);
|
||||
|
||||
ResultVal<VAddr> LinearAllocate(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:
|
||||
|
@ -26,9 +26,7 @@ ResultVal<std::shared_ptr<Semaphore>> KernelSystem::CreateSemaphore(s32 initial_
|
||||
s32 max_count,
|
||||
std::string name) {
|
||||
|
||||
if (initial_count > max_count) {
|
||||
return ERR_INVALID_COMBINATION_KERNEL;
|
||||
}
|
||||
R_UNLESS(initial_count <= max_count, ResultInvalidCombinationKernel);
|
||||
|
||||
// When the semaphore is created, some slots are reserved for other threads,
|
||||
// and the rest is reserved for the caller thread
|
||||
@ -44,21 +42,20 @@ bool Semaphore::ShouldWait(const Thread* thread) const {
|
||||
}
|
||||
|
||||
void Semaphore::Acquire(Thread* thread) {
|
||||
if (available_count <= 0)
|
||||
if (available_count <= 0) {
|
||||
return;
|
||||
}
|
||||
--available_count;
|
||||
}
|
||||
|
||||
ResultVal<s32> Semaphore::Release(s32 release_count) {
|
||||
if (max_count - available_count < release_count)
|
||||
return ERR_OUT_OF_RANGE_KERNEL;
|
||||
Result Semaphore::Release(s32* out_count, s32 release_count) {
|
||||
R_UNLESS(max_count >= release_count + available_count, ResultOutOfRangeKernel);
|
||||
|
||||
s32 previous_count = available_count;
|
||||
*out_count = available_count;
|
||||
available_count += release_count;
|
||||
|
||||
WakeupAllWaitingThreads();
|
||||
|
||||
return previous_count;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
} // namespace Kernel
|
||||
|
@ -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
|
||||
*/
|
||||
ResultVal<s32> Release(s32 release_count);
|
||||
Result Release(s32* out_count, s32 release_count);
|
||||
|
||||
private:
|
||||
friend class boost::serialization::access;
|
||||
|
@ -24,14 +24,12 @@ namespace Kernel {
|
||||
ServerPort::ServerPort(KernelSystem& kernel) : WaitObject(kernel) {}
|
||||
ServerPort::~ServerPort() {}
|
||||
|
||||
ResultVal<std::shared_ptr<ServerSession>> ServerPort::Accept() {
|
||||
if (pending_sessions.empty()) {
|
||||
return ERR_NO_PENDING_SESSIONS;
|
||||
}
|
||||
Result ServerPort::Accept(std::shared_ptr<ServerSession>* out_server_session) {
|
||||
R_UNLESS(!pending_sessions.empty(), ResultNoPendingSessions);
|
||||
|
||||
auto session = std::move(pending_sessions.back());
|
||||
*out_server_session = std::move(pending_sessions.back());
|
||||
pending_sessions.pop_back();
|
||||
return session;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
bool ServerPort::ShouldWait(const Thread* thread) const {
|
||||
|
@ -39,9 +39,9 @@ public:
|
||||
|
||||
/**
|
||||
* Accepts a pending incoming connection on this port. If there are no pending sessions, will
|
||||
* return ERR_NO_PENDING_SESSIONS.
|
||||
* return ResultNoPendingSessions.
|
||||
*/
|
||||
ResultVal<std::shared_ptr<ServerSession>> Accept();
|
||||
Result Accept(std::shared_ptr<ServerSession>* out_server_session);
|
||||
|
||||
/**
|
||||
* Sets the HLE handler template for the port. ServerSessions crated by connecting to this port
|
||||
|
@ -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.
|
||||
@ -136,7 +136,7 @@ ResultCode ServerSession::HandleSyncRequest(std::shared_ptr<Thread> thread) {
|
||||
// If this ServerSession does not have an HLE implementation, just wake up the threads waiting
|
||||
// on it.
|
||||
WakeupAllWaitingThreads();
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
KernelSystem::SessionPair KernelSystem::CreateSessionPair(const std::string& name,
|
||||
|
@ -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;
|
||||
|
||||
|
@ -67,7 +67,7 @@ ResultVal<std::shared_ptr<SharedMemory>> KernelSystem::CreateSharedMemory(
|
||||
auto& vm_manager = owner_process->vm_manager;
|
||||
// The memory is already available and mapped in the owner process.
|
||||
|
||||
CASCADE_CODE(vm_manager.ChangeMemoryState(address, size, MemoryState::Private,
|
||||
R_TRY(vm_manager.ChangeMemoryState(address, size, MemoryState::Private,
|
||||
VMAPermission::ReadWrite, MemoryState::Locked,
|
||||
SharedMemory::ConvertPermissions(permissions)));
|
||||
|
||||
@ -107,7 +107,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 =
|
||||
@ -115,21 +115,21 @@ ResultCode SharedMemory::Map(Process& target_process, VAddr address, MemoryPermi
|
||||
|
||||
// Automatically allocated memory blocks can only be mapped with other_permissions = DontCare
|
||||
if (base_address == 0 && other_permissions != MemoryPermission::DontCare) {
|
||||
return ERR_INVALID_COMBINATION;
|
||||
return ResultInvalidCombination;
|
||||
}
|
||||
|
||||
// Error out if the requested permissions don't match what the creator process allows.
|
||||
if (static_cast<u32>(permissions) & ~static_cast<u32>(own_other_permissions)) {
|
||||
LOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, permissions don't match",
|
||||
GetObjectId(), address, name);
|
||||
return ERR_INVALID_COMBINATION;
|
||||
return ResultInvalidCombination;
|
||||
}
|
||||
|
||||
// Heap-backed memory blocks can not be mapped with other_permissions = DontCare
|
||||
if (base_address != 0 && other_permissions == MemoryPermission::DontCare) {
|
||||
LOG_ERROR(Kernel, "cannot map id={}, address=0x{08X} name={}, permissions don't match",
|
||||
GetObjectId(), address, name);
|
||||
return ERR_INVALID_COMBINATION;
|
||||
return ResultInvalidCombination;
|
||||
}
|
||||
|
||||
// Error out if the provided permissions are not compatible with what the creator process needs.
|
||||
@ -137,12 +137,12 @@ ResultCode SharedMemory::Map(Process& target_process, VAddr address, MemoryPermi
|
||||
static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) {
|
||||
LOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, permissions don't match",
|
||||
GetObjectId(), address, name);
|
||||
return ERR_WRONG_PERMISSION;
|
||||
return ResultWrongPermission;
|
||||
}
|
||||
|
||||
// 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);
|
||||
}*/
|
||||
|
||||
@ -153,7 +153,7 @@ ResultCode SharedMemory::Map(Process& target_process, VAddr address, MemoryPermi
|
||||
if (address < Memory::HEAP_VADDR || address + size >= Memory::SHARED_MEMORY_VADDR_END) {
|
||||
LOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, invalid address",
|
||||
GetObjectId(), address, name);
|
||||
return ERR_INVALID_ADDRESS;
|
||||
return ResultInvalidAddress;
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ ResultCode SharedMemory::Map(Process& target_process, VAddr address, MemoryPermi
|
||||
Kernel,
|
||||
"cannot map id={}, address=0x{:08X} name={}, mapping to already allocated memory",
|
||||
GetObjectId(), address, name);
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
return ResultInvalidAddressState;
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,10 +188,10 @@ ResultCode SharedMemory::Map(Process& target_process, VAddr address, MemoryPermi
|
||||
interval_target += interval.second;
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -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
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -332,19 +332,19 @@ ResultVal<std::shared_ptr<Thread>> KernelSystem::CreateThread(
|
||||
// Check if priority is in ranged. Lowest priority -> highest priority id.
|
||||
if (priority > ThreadPrioLowest) {
|
||||
LOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority);
|
||||
return ERR_OUT_OF_RANGE;
|
||||
return ResultOutOfRange;
|
||||
}
|
||||
|
||||
if (processor_id > ThreadProcessorIdMax) {
|
||||
LOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id);
|
||||
return ERR_OUT_OF_RANGE_KERNEL;
|
||||
return ResultOutOfRangeKernel;
|
||||
}
|
||||
|
||||
// TODO(yuriks): Other checks, returning 0xD9001BEA
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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,11 +114,11 @@ 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) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
VAddr target_end = target + size;
|
||||
@ -126,16 +126,16 @@ ResultCode VMManager::ChangeMemoryState(VAddr target, u32 size, MemoryState expe
|
||||
VMAIter i_end = vma_map.lower_bound(target_end);
|
||||
|
||||
if (begin_vma == vma_map.end())
|
||||
return ERR_INVALID_ADDRESS;
|
||||
return ResultInvalidAddress;
|
||||
|
||||
for (auto i = begin_vma; i != i_end; ++i) {
|
||||
auto& vma = i->second;
|
||||
if (vma.meminfo_state != expected_state) {
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
return ResultInvalidAddressState;
|
||||
}
|
||||
u32 perms = static_cast<u32>(expected_perms);
|
||||
if ((static_cast<u32>(vma.permissions) & perms) != perms) {
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
return ResultInvalidAddressState;
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ ResultCode VMManager::ChangeMemoryState(VAddr target, u32 size, MemoryState expe
|
||||
vma = std::next(MergeAdjacent(vma));
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
VMManager::VMAIter VMManager::Unmap(VMAIter vma_handle) {
|
||||
@ -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));
|
||||
@ -182,7 +182,7 @@ ResultCode VMManager::UnmapRange(VAddr target, u32 size) {
|
||||
}
|
||||
|
||||
ASSERT(FindVMA(target)->second.size >= size);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
VMManager::VMAHandle VMManager::Reprotect(VMAHandle vma_handle, VMAPermission new_perms) {
|
||||
@ -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));
|
||||
@ -210,7 +210,7 @@ ResultCode VMManager::ReprotectRange(VAddr target, u32 size, VMAPermission new_p
|
||||
vma = std::next(StripIterConstness(Reprotect(vma, new_perms)));
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void VMManager::LogLayout(Common::Log::Level log_level) const {
|
||||
@ -242,13 +242,13 @@ ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u32 size) {
|
||||
VMAIter vma_handle = StripIterConstness(FindVMA(base));
|
||||
if (vma_handle == vma_map.end()) {
|
||||
// Target address is outside the range managed by the kernel
|
||||
return ERR_INVALID_ADDRESS;
|
||||
return ResultInvalidAddress;
|
||||
}
|
||||
|
||||
const VirtualMemoryArea& vma = vma_handle->second;
|
||||
if (vma.type != VMAType::Free) {
|
||||
// Region is already allocated
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
return ResultInvalidAddressState;
|
||||
}
|
||||
|
||||
const VAddr start_in_vma = base - vma.base;
|
||||
@ -256,7 +256,7 @@ ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u32 size) {
|
||||
|
||||
if (end_in_vma > vma.size) {
|
||||
// Requested allocation doesn't fit inside VMA
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
return ResultInvalidAddressState;
|
||||
}
|
||||
|
||||
if (end_in_vma != vma.size) {
|
||||
@ -284,7 +284,7 @@ ResultVal<VMManager::VMAIter> VMManager::CarveVMARange(VAddr target, u32 size) {
|
||||
const VMAIter i_end = vma_map.lower_bound(target_end);
|
||||
if (std::any_of(begin_vma, i_end,
|
||||
[](const auto& entry) { return entry.second.type == VMAType::Free; })) {
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
return ResultInvalidAddressState;
|
||||
}
|
||||
|
||||
if (target != begin_vma->second.base) {
|
||||
@ -367,7 +367,7 @@ ResultVal<std::vector<std::pair<MemoryRef, u32>>> VMManager::GetBackingBlocksFor
|
||||
auto vma = FindVMA(interval_target);
|
||||
if (vma->second.type != VMAType::BackingMemory) {
|
||||
LOG_ERROR(Kernel, "Trying to use already freed memory");
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
return ResultInvalidAddressState;
|
||||
}
|
||||
|
||||
VAddr interval_end = std::min(address + size, vma->second.base + vma->second.size);
|
||||
|
@ -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;
|
||||
|
@ -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 ResultSuccess(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 ResultUnknown(std::numeric_limits<u32>::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,8 +317,8 @@ public:
|
||||
return expected.has_value();
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr ResultCode Code() const {
|
||||
return expected.has_value() ? RESULT_SUCCESS : expected.error();
|
||||
[[nodiscard]] constexpr Result Code() const {
|
||||
return expected.has_value() ? ResultSuccess : expected.error();
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr bool Succeeded() const {
|
||||
@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -400,11 +400,28 @@ private:
|
||||
return CONCAT2(check_result_L, __LINE__).Code(); \
|
||||
target = std::move(*CONCAT2(check_result_L, __LINE__))
|
||||
|
||||
/**
|
||||
* Analogous to CASCADE_RESULT, but for a bare ResultCode. The code will be propagated if
|
||||
* non-success, or discarded otherwise.
|
||||
*/
|
||||
#define CASCADE_CODE(source) \
|
||||
auto CONCAT2(check_result_L, __LINE__) = source; \
|
||||
if (CONCAT2(check_result_L, __LINE__).IsError()) \
|
||||
return CONCAT2(check_result_L, __LINE__);
|
||||
#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) \
|
||||
{ \
|
||||
if (!(expr)) { \
|
||||
return (res); \
|
||||
} \
|
||||
}
|
||||
|
||||
/// Evaluates an expression that returns a result, and returns the result if it would fail.
|
||||
#define R_TRY(res_expr) \
|
||||
{ \
|
||||
const auto _tmp_r_try_rc = (res_expr); \
|
||||
if (R_FAILED(_tmp_r_try_rc)) { \
|
||||
return (_tmp_r_try_rc); \
|
||||
} \
|
||||
}
|
||||
|
||||
/// Evaluates a boolean expression, and succeeds if that expression is true.
|
||||
#define R_SUCCEED_IF(expr) R_UNLESS(!(expr), ResultSuccess)
|
||||
|
||||
/// Evaluates a boolean expression, and asserts if that expression is false.
|
||||
#define R_ASSERT(expr) ASSERT(R_SUCCEEDED(expr))
|
||||
|
@ -28,7 +28,7 @@ void Module::Interface::CreateDefaultConfig(Kernel::HLERequestContext& ctx) {
|
||||
std::memcpy(buffer.data(), &ac->default_config, buffer.size());
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushStaticBuffer(std::move(buffer), 0);
|
||||
|
||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||
@ -48,7 +48,7 @@ void Module::Interface::ConnectAsync(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||
}
|
||||
@ -58,7 +58,7 @@ void Module::Interface::GetConnectResult(Kernel::HLERequestContext& ctx) {
|
||||
rp.Skip(2, false); // ProcessId descriptor
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::Interface::CloseAsync(Kernel::HLERequestContext& ctx) {
|
||||
@ -79,7 +79,7 @@ void Module::Interface::CloseAsync(Kernel::HLERequestContext& ctx) {
|
||||
ac->ac_connected = false;
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::Interface::GetCloseResult(Kernel::HLERequestContext& ctx) {
|
||||
@ -87,7 +87,7 @@ void Module::Interface::GetCloseResult(Kernel::HLERequestContext& ctx) {
|
||||
rp.Skip(2, false); // ProcessId descriptor
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||
}
|
||||
@ -102,7 +102,7 @@ void Module::Interface::GetWifiStatus(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(static_cast<u32>(can_reach_internet ? (Settings::values.is_new_3ds
|
||||
? WifiStatus::STATUS_CONNECTED_N3DS
|
||||
: WifiStatus::STATUS_CONNECTED_O3DS)
|
||||
@ -114,7 +114,7 @@ void Module::Interface::GetInfraPriority(Kernel::HLERequestContext& ctx) {
|
||||
[[maybe_unused]] const std::vector<u8>& ac_config = rp.PopStaticBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(0); // Infra Priority, default 0
|
||||
|
||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||
@ -131,7 +131,7 @@ void Module::Interface::SetRequestEulaVersion(Kernel::HLERequestContext& ctx) {
|
||||
// TODO(Subv): Copy over the input ACConfig to the stored ACConfig.
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushStaticBuffer(std::move(ac_config), 0);
|
||||
|
||||
LOG_WARNING(Service_AC, "(STUBBED) called, major={}, minor={}", major, minor);
|
||||
@ -147,7 +147,7 @@ void Module::Interface::RegisterDisconnectEvent(Kernel::HLERequestContext& ctx)
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||
}
|
||||
@ -157,7 +157,7 @@ void Module::Interface::GetConnectingProxyEnable(Kernel::HLERequestContext& ctx)
|
||||
constexpr bool proxy_enabled = false;
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(proxy_enabled);
|
||||
|
||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||
@ -170,7 +170,7 @@ void Module::Interface::IsConnected(Kernel::HLERequestContext& ctx) {
|
||||
u32 unk_param = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(ac->ac_connected);
|
||||
|
||||
LOG_WARNING(Service_AC, "(STUBBED) called unk=0x{:08X} descriptor=0x{:08X} param=0x{:08X}", unk,
|
||||
@ -186,7 +186,7 @@ void Module::Interface::SetClientVersion(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_AC, "(STUBBED) called, version: 0x{:08X}", version);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
Module::Interface::Interface(std::shared_ptr<Module> ac, const char* name, u32 max_session)
|
||||
|
@ -28,7 +28,7 @@ void Module::Interface::Initialize(Kernel::HLERequestContext& ctx) {
|
||||
sdk_version, shared_memory_size, caller_pid);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::Interface::GetAccountDataBlock(Kernel::HLERequestContext& ctx) {
|
||||
@ -42,7 +42,7 @@ void Module::Interface::GetAccountDataBlock(Kernel::HLERequestContext& ctx) {
|
||||
size, block_id);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void InstallInterfaces(Core::System& system) {
|
||||
|
@ -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.");
|
||||
@ -105,10 +105,10 @@ ResultCode CIAFile::WriteTicket() {
|
||||
// TODO: Write out .tik files to nand?
|
||||
|
||||
install_state = CIAInstallState::TicketLoaded;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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.");
|
||||
@ -138,7 +138,7 @@ ResultCode CIAFile::WriteTitleMetadata() {
|
||||
if (tmd.Save(tmd_path) != Loader::ResultStatus::Success) {
|
||||
LOG_ERROR(Service_AM, "Failed to install title metadata file from CIA.");
|
||||
// TODO: Correct result code.
|
||||
return FileSys::ERROR_FILE_NOT_FOUND;
|
||||
return FileSys::ResultFileNotFound;
|
||||
}
|
||||
|
||||
// Create any other .app folders which may not exist yet
|
||||
@ -158,7 +158,7 @@ ResultCode CIAFile::WriteTitleMetadata() {
|
||||
if (!file.IsOpen()) {
|
||||
LOG_ERROR(Service_AM, "Could not open output file '{}' for content {}.", path, i);
|
||||
// TODO: Correct error code.
|
||||
return FileSys::ERROR_FILE_NOT_FOUND;
|
||||
return FileSys::ResultFileNotFound;
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ ResultCode CIAFile::WriteTitleMetadata() {
|
||||
} else {
|
||||
LOG_ERROR(Service_AM, "Could not read title key from ticket for encrypted CIA.");
|
||||
// TODO: Correct error code.
|
||||
return FileSys::ERROR_FILE_NOT_FOUND;
|
||||
return FileSys::ResultFileNotFound;
|
||||
}
|
||||
} else {
|
||||
LOG_INFO(Service_AM,
|
||||
@ -182,7 +182,7 @@ ResultCode CIAFile::WriteTitleMetadata() {
|
||||
|
||||
install_state = CIAInstallState::TMDLoaded;
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultVal<std::size_t> CIAFile::WriteContentData(u64 offset, std::size_t length, const u8* buffer) {
|
||||
@ -772,7 +772,7 @@ void Module::Interface::GetNumPrograms(Kernel::HLERequestContext& ctx) {
|
||||
u32 media_type = rp.Pop<u8>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(static_cast<u32>(am->am_title_list[media_type].size()));
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -836,7 +836,7 @@ void Module::Interface::FindDLCContentInfos(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(content_requested_in);
|
||||
rb.PushMappedBuffer(content_info_out);
|
||||
}
|
||||
@ -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;
|
||||
@ -889,7 +889,7 @@ void Module::Interface::ListDLCContentInfos(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(copied);
|
||||
rb.PushMappedBuffer(content_info_out);
|
||||
}
|
||||
@ -902,7 +902,7 @@ void Module::Interface::DeleteContents(Kernel::HLERequestContext& ctx) {
|
||||
auto& content_ids_in = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(content_ids_in);
|
||||
LOG_WARNING(Service_AM, "(STUBBED) media_type={}, title_id=0x{:016x}, content_count={}",
|
||||
media_type, title_id, content_count);
|
||||
@ -929,13 +929,12 @@ void Module::Interface::GetProgramList(Kernel::HLERequestContext& ctx) {
|
||||
title_ids_output.Write(am->am_title_list[media_type].data(), 0, copied * sizeof(u64));
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(copied);
|
||||
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,14 +951,14 @@ 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);
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void Module::Interface::GetProgramInfos(Kernel::HLERequestContext& ctx) {
|
||||
@ -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,21 +993,21 @@ 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;
|
||||
}
|
||||
bool success = FileUtil::DeleteDirRecursively(path);
|
||||
am->ScanForAllTitles();
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
if (!success)
|
||||
LOG_ERROR(Service_AM, "FileUtil::DeleteDirRecursively unexpectedly failed");
|
||||
}
|
||||
@ -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 {
|
||||
@ -1034,7 +1033,7 @@ void Module::Interface::GetProductCode(Kernel::HLERequestContext& ctx) {
|
||||
FileSys::NCCHContainer ncch(path);
|
||||
ncch.Load();
|
||||
std::memcpy(&product_code.code, &ncch.ncch_header.product_code, 0x10);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(product_code);
|
||||
}
|
||||
}
|
||||
@ -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 = ResultSuccess;
|
||||
|
||||
// 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 = ResultSuccess;
|
||||
|
||||
// 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;
|
||||
}
|
||||
@ -1124,7 +1123,7 @@ void Module::Interface::ListDataTitleTicketInfos(Kernel::HLERequestContext& ctx)
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(ticket_count);
|
||||
rb.PushMappedBuffer(ticket_info_out);
|
||||
|
||||
@ -1142,14 +1141,14 @@ 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;
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
|
||||
std::string tmd_path = GetTitleMetadataPath(media_type, title_id);
|
||||
|
||||
@ -1168,7 +1167,7 @@ void Module::Interface::DeleteTicket(Kernel::HLERequestContext& ctx) {
|
||||
u64 title_id = rp.Pop<u64>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
LOG_WARNING(Service_AM, "(STUBBED) called title_id=0x{:016x}", title_id);
|
||||
}
|
||||
|
||||
@ -1181,7 +1180,7 @@ void Module::Interface::GetNumTickets(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(ticket_count);
|
||||
LOG_WARNING(Service_AM, "(STUBBED) called ticket_count=0x{:08x}", ticket_count);
|
||||
}
|
||||
@ -1202,7 +1201,7 @@ void Module::Interface::GetTicketList(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(tickets_written);
|
||||
rb.PushMappedBuffer(ticket_tids_out);
|
||||
LOG_WARNING(Service_AM, "(STUBBED) ticket_list_count=0x{:08x}, ticket_index=0x{:08x}",
|
||||
@ -1216,7 +1215,7 @@ void Module::Interface::NeedsCleanup(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_AM, "(STUBBED) media_type=0x{:02x}", media_type);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<bool>(false);
|
||||
}
|
||||
|
||||
@ -1227,7 +1226,7 @@ void Module::Interface::DoCleanup(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_AM, "(STUBBED) called, media_type={:#02x}", media_type);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::Interface::QueryAvailableTitleDatabase(Kernel::HLERequestContext& ctx) {
|
||||
@ -1235,7 +1234,7 @@ void Module::Interface::QueryAvailableTitleDatabase(Kernel::HLERequestContext& c
|
||||
u8 media_type = rp.Pop<u8>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(true);
|
||||
|
||||
LOG_WARNING(Service_AM, "(STUBBED) media_type={}", media_type);
|
||||
@ -1247,7 +1246,7 @@ void Module::Interface::GetPersonalizedTicketInfoList(Kernel::HLERequestContext&
|
||||
[[maybe_unused]] auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(0);
|
||||
|
||||
LOG_WARNING(Service_AM, "(STUBBED) called, ticket_count={}", ticket_count);
|
||||
@ -1259,7 +1258,7 @@ void Module::Interface::GetNumImportTitleContextsFiltered(Kernel::HLERequestCont
|
||||
u8 filter = rp.Pop<u8>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(0);
|
||||
|
||||
LOG_WARNING(Service_AM, "(STUBBED) called, media_type={}, filter={}", media_type, filter);
|
||||
@ -1273,7 +1272,7 @@ void Module::Interface::GetImportTitleContextListFiltered(Kernel::HLERequestCont
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(0);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
@ -1291,7 +1290,7 @@ void Module::Interface::CheckContentRights(Kernel::HLERequestContext& ctx) {
|
||||
FileUtil::Exists(GetTitleContentPath(Service::FS::MediaType::SDMC, tid, content_index));
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(has_rights);
|
||||
|
||||
LOG_WARNING(Service_AM, "(STUBBED) tid={:016x}, content_index={}", tid, content_index);
|
||||
@ -1307,7 +1306,7 @@ void Module::Interface::CheckContentRightsIgnorePlatform(Kernel::HLERequestConte
|
||||
FileUtil::Exists(GetTitleContentPath(Service::FS::MediaType::SDMC, tid, content_index));
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(has_rights);
|
||||
|
||||
LOG_WARNING(Service_AM, "(STUBBED) tid={:016x}, content_index={}", tid, content_index);
|
||||
@ -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;
|
||||
}
|
||||
@ -1333,7 +1332,7 @@ void Module::Interface::BeginImportProgram(Kernel::HLERequestContext& ctx) {
|
||||
am->cia_installing = true;
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.PushCopyObjects(file->Connect());
|
||||
|
||||
LOG_WARNING(Service_AM, "(STUBBED) media_type={}", media_type);
|
||||
@ -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;
|
||||
}
|
||||
@ -1360,7 +1359,7 @@ void Module::Interface::BeginImportProgramTemporarily(Kernel::HLERequestContext&
|
||||
am->cia_installing = true;
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.PushCopyObjects(file->Connect());
|
||||
|
||||
LOG_WARNING(Service_AM, "(STUBBED)");
|
||||
@ -1374,7 +1373,7 @@ void Module::Interface::EndImportProgram(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
am->cia_installing = false;
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::Interface::EndImportProgramWithoutCommit(Kernel::HLERequestContext& ctx) {
|
||||
@ -1387,7 +1386,7 @@ void Module::Interface::EndImportProgramWithoutCommit(Kernel::HLERequestContext&
|
||||
|
||||
am->cia_installing = false;
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::Interface::CommitImportPrograms(Kernel::HLERequestContext& ctx) {
|
||||
@ -1402,7 +1401,7 @@ void Module::Interface::CommitImportPrograms(Kernel::HLERequestContext& ctx) {
|
||||
am->ScanForAllTitles();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
}
|
||||
|
||||
@ -1445,14 +1444,14 @@ ResultVal<std::unique_ptr<AMFileWrapper>> GetFileFromSession(
|
||||
|
||||
if (file_session->parent == nullptr) {
|
||||
LOG_WARNING(Service_AM, "Invalid file handle!");
|
||||
return Kernel::ERR_INVALID_HANDLE;
|
||||
return Kernel::ResultInvalidHandle;
|
||||
}
|
||||
|
||||
std::shared_ptr<Kernel::ServerSession> server =
|
||||
Kernel::SharedFrom(file_session->parent->server);
|
||||
if (server == nullptr) {
|
||||
LOG_WARNING(Service_AM, "File handle ServerSession disconnected!");
|
||||
return Kernel::ERR_SESSION_CLOSED_BY_REMOTE;
|
||||
return Kernel::ResultSessionClosed;
|
||||
}
|
||||
|
||||
if (server->hle_handler != nullptr) {
|
||||
@ -1468,13 +1467,13 @@ ResultVal<std::unique_ptr<AMFileWrapper>> GetFileFromSession(
|
||||
}
|
||||
|
||||
LOG_ERROR(Service_AM, "Failed to cast handle to FSFile!");
|
||||
return Kernel::ERR_INVALID_HANDLE;
|
||||
return Kernel::ResultInvalidHandle;
|
||||
}
|
||||
|
||||
// Probably the best bet if someone is LLEing the fs service is to just have them LLE AM
|
||||
// while they're at it, so not implemented.
|
||||
LOG_ERROR(Service_AM, "Given file handle does not have an HLE handler!");
|
||||
return Kernel::ERR_NOT_IMPLEMENTED;
|
||||
return Kernel::ResultNotImplemented;
|
||||
}
|
||||
|
||||
void Module::Interface::GetProgramInfoFromCia(Kernel::HLERequestContext& ctx) {
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -1510,7 +1509,7 @@ void Module::Interface::GetProgramInfoFromCia(Kernel::HLERequestContext& ctx) {
|
||||
title_info.type = tmd.GetTitleType();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(8, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<TitleInfo>(title_info);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -1554,7 +1553,7 @@ void Module::Interface::GetSystemMenuDataFromCia(Kernel::HLERequestContext& ctx)
|
||||
output_buffer.Write(temp.data(), 0, temp.size());
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(output_buffer);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -1581,7 +1580,7 @@ void Module::Interface::GetDependencyListFromCia(Kernel::HLERequestContext& ctx)
|
||||
std::memcpy(buffer.data(), container.GetDependencies().data(), buffer.size());
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushStaticBuffer(std::move(buffer), 0);
|
||||
}
|
||||
|
||||
@ -1599,13 +1598,13 @@ 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;
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(container.GetMetadataOffset());
|
||||
}
|
||||
|
||||
@ -1623,13 +1622,13 @@ 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;
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(container.GetCoreVersion());
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -1657,11 +1656,11 @@ void Module::Interface::GetRequiredSizeFromCia(Kernel::HLERequestContext& ctx) {
|
||||
// on some mediatypes. Since this is more of a required install size we'll report
|
||||
// what Citra needs, but it would be good to be more accurate here.
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
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)) {
|
||||
@ -1673,7 +1672,7 @@ ResultCode UninstallProgram(const FS::MediaType media_type, const u64 title_id)
|
||||
return {ErrorDescription::NotFound, ErrorModule::AM, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Permanent};
|
||||
}
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void Module::Interface::DeleteProgram(Kernel::HLERequestContext& ctx) {
|
||||
@ -1694,7 +1693,7 @@ void Module::Interface::GetSystemUpdaterMutex(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(am->system_updater_mutex);
|
||||
}
|
||||
|
||||
@ -1713,13 +1712,13 @@ 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;
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(container.GetMetadataSize());
|
||||
}
|
||||
|
||||
@ -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,14 +1754,14 @@ 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;
|
||||
}
|
||||
|
||||
output_buffer.Write(temp.data(), 0, output_size);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(output_buffer);
|
||||
}
|
||||
|
||||
@ -1774,7 +1773,7 @@ void Module::Interface::BeginImportTicket(Kernel::HLERequestContext& ctx) {
|
||||
FileSys::Path{});
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.PushCopyObjects(file->Connect());
|
||||
|
||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
||||
@ -1785,7 +1784,7 @@ void Module::Interface::EndImportTicket(Kernel::HLERequestContext& ctx) {
|
||||
[[maybe_unused]] const auto ticket = rp.PopObject<Kernel::ClientSession>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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.",
|
||||
@ -271,17 +271,17 @@ ResultCode AppletManager::SendParameter(const MessageParameter& parameter) {
|
||||
}
|
||||
|
||||
CancelAndSendParameter(parameter);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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,
|
||||
@ -406,10 +406,10 @@ ResultCode AppletManager::Enable(AppletAttributes attributes) {
|
||||
delayed_parameter.reset();
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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,
|
||||
@ -430,7 +430,7 @@ ResultCode AppletManager::Finalize(AppletId app_id) {
|
||||
active_slot = GetAppletSlotFromPos(AppletPos::System);
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
u32 AppletManager::CountRegisteredApplet() {
|
||||
@ -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,17 +470,17 @@ 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) {
|
||||
slot_data->notification = notification;
|
||||
slot_data->notification_event->Signal();
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
@ -519,14 +519,14 @@ ResultCode AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
|
||||
auto process =
|
||||
NS::LaunchTitle(FS::MediaType::NAND, GetTitleIdForApplet(applet_id, cfg->GetRegionValue()));
|
||||
if (process) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
// If we weren't able to load the native applet title, try to fallback to an HLE implementation.
|
||||
auto applet = HLE::Applets::Applet::Get(applet_id);
|
||||
if (applet) {
|
||||
LOG_WARNING(Service_APT, "applet has already been started id={:03X}", applet_id);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
} else {
|
||||
auto parent = GetAppletSlotId(last_library_launcher_slot);
|
||||
LOG_DEBUG(Service_APT, "Creating HLE applet {:03X} with parent {:03X}", applet_id, parent);
|
||||
@ -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};
|
||||
@ -547,14 +547,14 @@ ResultCode AppletManager::PreloadLibraryApplet(AppletId applet_id) {
|
||||
auto process =
|
||||
NS::LaunchTitle(FS::MediaType::NAND, GetTitleIdForApplet(applet_id, cfg->GetRegionValue()));
|
||||
if (process) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
// If we weren't able to load the native applet title, try to fallback to an HLE implementation.
|
||||
auto applet = HLE::Applets::Applet::Get(applet_id);
|
||||
if (applet) {
|
||||
LOG_WARNING(Service_APT, "applet has already been started id={:08X}", applet_id);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
} else {
|
||||
auto parent = GetAppletSlotId(last_library_launcher_slot);
|
||||
LOG_DEBUG(Service_APT, "Creating HLE applet {:03X} with parent {:03X}", applet_id, parent);
|
||||
@ -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;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -585,11 +584,10 @@ ResultCode AppletManager::StartLibraryApplet(AppletId applet_id,
|
||||
return send_res;
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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};
|
||||
@ -604,10 +602,10 @@ ResultCode AppletManager::PrepareToCloseLibraryApplet(bool not_pause, bool exiti
|
||||
else
|
||||
library_applet_closing_command = SignalType::WakeupByExit;
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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);
|
||||
@ -630,10 +628,10 @@ ResultCode AppletManager::CloseLibraryApplet(std::shared_ptr<Kernel::Object> obj
|
||||
SendParameter(param);
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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 =
|
||||
@ -681,10 +679,10 @@ ResultCode AppletManager::SendDspSleep(AppletId from_applet_id,
|
||||
});
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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 =
|
||||
@ -714,10 +712,10 @@ ResultCode AppletManager::SendDspWakeUp(AppletId from_applet_id,
|
||||
}
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -726,11 +724,10 @@ ResultCode AppletManager::PrepareToStartSystemApplet(AppletId applet_id) {
|
||||
}
|
||||
|
||||
last_system_launcher_slot = active_slot;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -769,19 +766,19 @@ ResultCode AppletManager::StartSystemApplet(AppletId applet_id,
|
||||
.buffer = buffer,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::PrepareToCloseSystemApplet() {
|
||||
Result AppletManager::PrepareToCloseSystemApplet() {
|
||||
if (next_parameter) {
|
||||
return {ErrCodes::ParameterPresent, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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.");
|
||||
@ -806,10 +803,10 @@ ResultCode AppletManager::CloseSystemApplet(std::shared_ptr<Kernel::Object> obje
|
||||
}
|
||||
|
||||
// TODO: Terminate the running applet title
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::OrderToCloseSystemApplet() {
|
||||
Result AppletManager::OrderToCloseSystemApplet() {
|
||||
if (active_slot == AppletSlot::Error) {
|
||||
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
@ -843,10 +840,10 @@ ResultCode AppletManager::OrderToCloseSystemApplet() {
|
||||
.signal = SignalType::WakeupByCancel,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::PrepareToJumpToHomeMenu() {
|
||||
Result AppletManager::PrepareToJumpToHomeMenu() {
|
||||
if (next_parameter) {
|
||||
return {ErrCodes::ParameterPresent, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
@ -860,10 +857,10 @@ ResultCode AppletManager::PrepareToJumpToHomeMenu() {
|
||||
EnsureHomeMenuLoaded();
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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);
|
||||
@ -910,10 +907,10 @@ ResultCode AppletManager::JumpToHomeMenu(std::shared_ptr<Kernel::Object> object,
|
||||
}
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::PrepareToLeaveHomeMenu() {
|
||||
Result AppletManager::PrepareToLeaveHomeMenu() {
|
||||
if (!GetAppletSlot(AppletSlot::Application)->registered) {
|
||||
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
@ -924,10 +921,10 @@ ResultCode AppletManager::PrepareToLeaveHomeMenu() {
|
||||
ErrorLevel::Status};
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -939,10 +936,10 @@ ResultCode AppletManager::LeaveHomeMenu(std::shared_ptr<Kernel::Object> object,
|
||||
.buffer = buffer,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::OrderToCloseApplication() {
|
||||
Result AppletManager::OrderToCloseApplication() {
|
||||
if (active_slot == AppletSlot::Error) {
|
||||
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
@ -964,10 +961,10 @@ ResultCode AppletManager::OrderToCloseApplication() {
|
||||
.signal = SignalType::WakeupByCancel,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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};
|
||||
@ -1015,10 +1012,10 @@ ResultCode AppletManager::PrepareToCloseApplication(bool return_to_sys) {
|
||||
// EnsureHomeMenuLoaded();
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1044,7 +1041,7 @@ ResultCode AppletManager::CloseApplication(std::shared_ptr<Kernel::Object> objec
|
||||
}
|
||||
|
||||
// TODO: Terminate the application process.
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultVal<AppletManager::AppletManInfo> AppletManager::GetAppletManInfo(
|
||||
@ -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
|
||||
@ -1180,10 +1176,10 @@ ResultCode AppletManager::PrepareToDoApplicationJump(u64 title_id, FS::MediaType
|
||||
// Note: The real console uses the Home Menu to perform the application jump, therefore the menu
|
||||
// needs to be running. The real APT module starts the Home Menu here if it's not already
|
||||
// running, we don't have to do this. See `EnsureHomeMenuLoaded` for launching the Home Menu.
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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
|
||||
@ -1212,7 +1208,7 @@ ResultCode AppletManager::DoApplicationJump(const DeliverArg& arg) {
|
||||
});
|
||||
|
||||
// TODO: APT terminates the application here, usually it will exit itself properly though.
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
} else {
|
||||
// Otherwise, work around the missing home menu by launching the title directly.
|
||||
|
||||
@ -1227,16 +1223,16 @@ ResultCode AppletManager::DoApplicationJump(const DeliverArg& arg) {
|
||||
LOG_CRITICAL(Service_APT, "Failed to launch title during application jump, exiting.");
|
||||
system.RequestShutdown();
|
||||
}
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
*/
|
||||
|
||||
NS::RebootToTitle(system, app_jump_parameters.next_media_type,
|
||||
app_jump_parameters.next_title_id);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
@ -1259,10 +1255,10 @@ ResultCode AppletManager::PrepareToStartApplication(u64 title_id, FS::MediaType
|
||||
|
||||
capture_buffer_info.reset();
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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});
|
||||
@ -1295,10 +1291,10 @@ ResultCode AppletManager::StartApplication(const std::vector<u8>& parameter,
|
||||
return WakeupApplication(nullptr, {});
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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
|
||||
@ -1311,10 +1307,10 @@ ResultCode AppletManager::WakeupApplication(std::shared_ptr<Kernel::Object> obje
|
||||
.buffer = buffer,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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,
|
||||
@ -1330,7 +1326,7 @@ ResultCode AppletManager::CancelApplication() {
|
||||
.signal = SignalType::WakeupByCancel,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void AppletManager::SendApplicationParameterAfterRegistration(const MessageParameter& parameter) {
|
||||
|
@ -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;
|
||||
|
@ -70,7 +70,7 @@ void Module::NSInterface::SetWirelessRebootInfo(Kernel::HLERequestContext& ctx)
|
||||
apt->wireless_reboot_info = std::move(buffer);
|
||||
|
||||
auto rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_APT, "called size={}", size);
|
||||
}
|
||||
@ -83,7 +83,7 @@ void Module::NSInterface::ShutdownAsync(Kernel::HLERequestContext& ctx) {
|
||||
apt->system.RequestShutdown();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::NSInterface::RebootSystem(Kernel::HLERequestContext& ctx) {
|
||||
@ -107,7 +107,7 @@ void Module::NSInterface::RebootSystem(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::NSInterface::RebootSystemClean(Kernel::HLERequestContext& ctx) {
|
||||
@ -118,7 +118,7 @@ void Module::NSInterface::RebootSystemClean(Kernel::HLERequestContext& ctx) {
|
||||
apt->system.RequestReset();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::Initialize(Kernel::HLERequestContext& ctx) {
|
||||
@ -134,7 +134,7 @@ void Module::APTInterface::Initialize(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(result.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 3);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(result->notification_event, result->parameter_event);
|
||||
}
|
||||
}
|
||||
@ -314,7 +314,7 @@ void Module::APTInterface::GetSharedFont(Kernel::HLERequestContext& ctx) {
|
||||
apt->shared_font_relocated = true;
|
||||
}
|
||||
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
// Since the SharedMemory interface doesn't provide the address at which the memory was
|
||||
// allocated, the real APT service calculates this address by scanning the entire address space
|
||||
// (using svcQueryMemory) and searches for an allocation of the same size as the Shared Font.
|
||||
@ -329,7 +329,7 @@ void Module::APTInterface::GetWirelessRebootInfo(Kernel::HLERequestContext& ctx)
|
||||
LOG_WARNING(Service_APT, "called size={:08X}", size);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushStaticBuffer(apt->wireless_reboot_info, 0);
|
||||
}
|
||||
|
||||
@ -338,7 +338,7 @@ void Module::APTInterface::NotifyToWait(Kernel::HLERequestContext& ctx) {
|
||||
const auto app_id = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
|
||||
LOG_WARNING(Service_APT, "(STUBBED) app_id={}", app_id);
|
||||
}
|
||||
@ -359,7 +359,7 @@ void Module::APTInterface::GetLockHandle(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(result.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(result->corrected_attributes);
|
||||
rb.Push<u32>(result->state);
|
||||
rb.PushCopyObjects(result->lock);
|
||||
@ -398,7 +398,7 @@ void Module::APTInterface::GetAppletManInfo(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(info.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(info->active_applet_pos);
|
||||
rb.PushEnum(info->requested_applet_id);
|
||||
rb.PushEnum(info->home_menu_applet_id);
|
||||
@ -412,7 +412,7 @@ void Module::APTInterface::CountRegisteredApplet(Kernel::HLERequestContext& ctx)
|
||||
LOG_DEBUG(Service_APT, "called");
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(apt->applet_manager->CountRegisteredApplet());
|
||||
}
|
||||
|
||||
@ -421,7 +421,7 @@ void Module::APTInterface::IsRegistered(Kernel::HLERequestContext& ctx) {
|
||||
const auto app_id = rp.PopEnum<AppletId>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(apt->applet_manager->IsRegistered(app_id));
|
||||
|
||||
LOG_DEBUG(Service_APT, "called app_id={:#010X}", app_id);
|
||||
@ -439,7 +439,7 @@ void Module::APTInterface::GetAttribute(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(applet_attr.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(applet_attr.Unwrap().raw);
|
||||
}
|
||||
}
|
||||
@ -456,7 +456,7 @@ void Module::APTInterface::InquireNotification(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(notification.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(static_cast<u32>(notification.Unwrap()));
|
||||
}
|
||||
}
|
||||
@ -502,7 +502,7 @@ void Module::APTInterface::ReceiveParameter(Kernel::HLERequestContext& ctx) {
|
||||
buffer_size); // APT always push a buffer with the maximum size
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(4, 4);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.PushEnum(next_parameter->sender_id);
|
||||
rb.PushEnum(next_parameter->signal); // Signal type
|
||||
rb.Push(size); // Parameter buffer size
|
||||
@ -528,7 +528,7 @@ void Module::APTInterface::GlanceParameter(Kernel::HLERequestContext& ctx) {
|
||||
buffer_size); // APT always push a buffer with the maximum size
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(4, 4);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.PushEnum(next_parameter->sender_id);
|
||||
rb.PushEnum(next_parameter->signal); // Signal type
|
||||
rb.Push(size); // Parameter buffer size
|
||||
@ -550,7 +550,7 @@ void Module::APTInterface::CancelParameter(Kernel::HLERequestContext& ctx) {
|
||||
check_sender, sender_appid, check_receiver, receiver_appid);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(apt->applet_manager->CancelParameter(check_sender, sender_appid, check_receiver,
|
||||
receiver_appid));
|
||||
}
|
||||
@ -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);
|
||||
@ -592,7 +592,7 @@ void Module::APTInterface::GetProgramIdOnApplicationJump(Kernel::HLERequestConte
|
||||
const auto parameters = apt->applet_manager->GetApplicationJumpParameters();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(7, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u64>(parameters.current_title_id);
|
||||
rb.Push(static_cast<u8>(parameters.current_media_type));
|
||||
rb.Push<u64>(parameters.next_title_id);
|
||||
@ -611,7 +611,7 @@ void Module::APTInterface::SendDeliverArg(Kernel::HLERequestContext& ctx) {
|
||||
apt->applet_manager->SetDeliverArg(DeliverArg{param, hmac});
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::ReceiveDeliverArg(Kernel::HLERequestContext& ctx) {
|
||||
@ -626,7 +626,7 @@ void Module::APTInterface::ReceiveDeliverArg(Kernel::HLERequestContext& ctx) {
|
||||
arg.hmac.resize(std::min<std::size_t>(hmac_size, 0x20));
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(4, 4);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(arg.source_program_id);
|
||||
rb.Push<u8>(1);
|
||||
rb.PushStaticBuffer(std::move(arg.param), 0);
|
||||
@ -702,8 +702,8 @@ void Module::APTInterface::AppletUtility(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(RESULT_SUCCESS); // Utility function result
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(ResultSuccess); // Utility function result
|
||||
rb.PushStaticBuffer(out, 0);
|
||||
}
|
||||
|
||||
@ -720,7 +720,7 @@ void Module::APTInterface::SetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
||||
apt->cpu_percent = value;
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
}
|
||||
|
||||
void Module::APTInterface::GetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
||||
@ -733,7 +733,7 @@ void Module::APTInterface::GetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(apt->cpu_percent);
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
@ -944,7 +944,7 @@ void Module::APTInterface::ReplySleepQuery(Kernel::HLERequestContext& ctx) {
|
||||
from_app_id, reply_value);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::ReplySleepNotificationComplete(Kernel::HLERequestContext& ctx) {
|
||||
@ -954,7 +954,7 @@ void Module::APTInterface::ReplySleepNotificationComplete(Kernel::HLERequestCont
|
||||
LOG_WARNING(Service_APT, "(STUBBED) called, from_app_id={:08X}", from_app_id);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::PrepareToJumpToHomeMenu(Kernel::HLERequestContext& ctx) {
|
||||
@ -1010,7 +1010,7 @@ void Module::APTInterface::LoadSysMenuArg(Kernel::HLERequestContext& ctx) {
|
||||
std::copy_n(apt->sys_menu_arg_buffer.cbegin(), size, buffer.begin());
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushStaticBuffer(std::move(buffer), 0);
|
||||
}
|
||||
|
||||
@ -1025,7 +1025,7 @@ void Module::APTInterface::StoreSysMenuArg(Kernel::HLERequestContext& ctx) {
|
||||
std::copy_n(buffer.cbegin(), size, apt->sys_menu_arg_buffer.begin());
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
|
||||
@ -1038,7 +1038,7 @@ void Module::APTInterface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx)
|
||||
apt->applet_manager->SendCaptureBufferInfo(buffer);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::ReceiveCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
|
||||
@ -1052,7 +1052,7 @@ void Module::APTInterface::ReceiveCaptureBufferInfo(Kernel::HLERequestContext& c
|
||||
screen_capture_buffer.resize(size);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(real_size);
|
||||
rb.PushStaticBuffer(std::move(screen_capture_buffer), 0);
|
||||
}
|
||||
@ -1068,7 +1068,7 @@ void Module::APTInterface::GetCaptureInfo(Kernel::HLERequestContext& ctx) {
|
||||
screen_capture_buffer.resize(size);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(real_size);
|
||||
rb.PushStaticBuffer(std::move(screen_capture_buffer), 0);
|
||||
}
|
||||
@ -1085,7 +1085,7 @@ void Module::APTInterface::Unknown54(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(media_type.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(media_type.Unwrap());
|
||||
}
|
||||
}
|
||||
@ -1099,7 +1099,7 @@ void Module::APTInterface::SetScreenCapturePostPermission(Kernel::HLERequestCont
|
||||
apt->screen_capture_post_permission = static_cast<ScreencapPostPermission>(permission & 0xF);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
}
|
||||
|
||||
void Module::APTInterface::GetScreenCapturePostPermission(Kernel::HLERequestContext& ctx) {
|
||||
@ -1108,7 +1108,7 @@ void Module::APTInterface::GetScreenCapturePostPermission(Kernel::HLERequestCont
|
||||
LOG_DEBUG(Service_APT, "called");
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(static_cast<u32>(apt->screen_capture_post_permission));
|
||||
}
|
||||
|
||||
@ -1131,7 +1131,7 @@ void Module::APTInterface::GetProgramId(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_APT, "called process_id={}", process_id);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
auto fs_user =
|
||||
Core::System::GetInstance().ServiceManager().GetService<Service::FS::FS_USER>("fs:USER");
|
||||
@ -1161,7 +1161,7 @@ void Module::APTInterface::GetProgramInfo(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
// TODO: Proper error code
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_UNKNOWN);
|
||||
rb.Push(ResultUnknown);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1171,7 +1171,7 @@ void Module::APTInterface::GetProgramInfo(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
// TODO: Proper error code
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_UNKNOWN);
|
||||
rb.Push(ResultUnknown);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1181,12 +1181,12 @@ void Module::APTInterface::GetProgramInfo(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
// TODO: Proper error code
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_UNKNOWN);
|
||||
rb.Push(ResultUnknown);
|
||||
return;
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(static_cast<u8>(memory_mode.first.value()));
|
||||
rb.Push(core_version.first.value());
|
||||
}
|
||||
@ -1203,7 +1203,7 @@ void Module::APTInterface::GetAppletInfo(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(info.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(7, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(info->title_id);
|
||||
rb.Push(static_cast<u8>(info->media_type));
|
||||
rb.Push(info->registered);
|
||||
@ -1248,7 +1248,7 @@ void Module::APTInterface::GetStartupArgument(Kernel::HLERequestContext& ctx) {
|
||||
param.resize(std::min(parameter_size, max_parameter_size));
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(exists);
|
||||
rb.PushStaticBuffer(std::move(param), 0);
|
||||
}
|
||||
@ -1292,7 +1292,7 @@ void Module::APTInterface::Wrap(Kernel::HLERequestContext& ctx) {
|
||||
output.Write(cipher.data(), nonce_size, cipher.size());
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
// Unmap buffer
|
||||
rb.PushMappedBuffer(input);
|
||||
rb.PushMappedBuffer(output);
|
||||
@ -1338,10 +1338,10 @@ void Module::APTInterface::Unwrap(Kernel::HLERequestContext& ctx) {
|
||||
output.Write(nonce.data(), nonce_offset, nonce_size);
|
||||
output.Write(pdata.data() + nonce_offset, nonce_offset + nonce_size,
|
||||
pdata.size() - nonce_offset);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} 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));
|
||||
}
|
||||
|
||||
@ -1366,7 +1366,7 @@ void Module::APTInterface::Reboot(Kernel::HLERequestContext& ctx) {
|
||||
NS::RebootToTitle(apt->system, media_type, title_id);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::HardwareResetAsync(Kernel::HLERequestContext& ctx) {
|
||||
@ -1377,7 +1377,7 @@ void Module::APTInterface::HardwareResetAsync(Kernel::HLERequestContext& ctx) {
|
||||
apt->system.RequestReset();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::GetTargetPlatform(Kernel::HLERequestContext& ctx) {
|
||||
@ -1386,7 +1386,7 @@ void Module::APTInterface::GetTargetPlatform(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_APT, "called");
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(apt->applet_manager->GetTargetPlatform());
|
||||
}
|
||||
|
||||
@ -1405,7 +1405,7 @@ void Module::APTInterface::GetApplicationRunningMode(Kernel::HLERequestContext&
|
||||
LOG_DEBUG(Service_APT, "called");
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(apt->applet_manager->GetApplicationRunningMode());
|
||||
}
|
||||
|
||||
@ -1425,7 +1425,7 @@ void Module::APTInterface::IsStandardMemoryLayout(Kernel::HLERequestContext& ctx
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(is_standard);
|
||||
}
|
||||
|
||||
@ -1439,7 +1439,7 @@ void Module::APTInterface::IsTitleAllowed(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
// We allow all titles to be launched, so this function is a no-op
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(true);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ std::shared_ptr<OnlineService> Module::Interface::GetSessionService(
|
||||
// TODO: Error code for uninitialized session.
|
||||
IPC::RequestParser rp(ctx);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_UNKNOWN);
|
||||
rb.Push(ResultUnknown);
|
||||
return nullptr;
|
||||
}
|
||||
return session_data->online_service;
|
||||
@ -80,7 +80,7 @@ void Module::Interface::SetStorageInfo(Kernel::HLERequestContext& ctx) {
|
||||
const u8 extdata_type = rp.Pop<u8>(); /// 0 = NAND, 1 = SD
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_BOSS,
|
||||
"(STUBBED) extdata_id={:#018x}, boss_size={:#010x}, extdata_type={:#04x}",
|
||||
@ -91,7 +91,7 @@ void Module::Interface::UnregisterStorage(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) called");
|
||||
}
|
||||
@ -100,7 +100,7 @@ void Module::Interface::GetStorageInfo(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(0);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) called");
|
||||
@ -112,7 +112,7 @@ void Module::Interface::RegisterPrivateRootCa(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED)");
|
||||
@ -126,7 +126,7 @@ void Module::Interface::RegisterPrivateClientCert(Kernel::HLERequestContext& ctx
|
||||
auto& buffer2 = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer1);
|
||||
rb.PushMappedBuffer(buffer2);
|
||||
|
||||
@ -138,7 +138,7 @@ void Module::Interface::GetNewArrivalFlag(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(boss->new_arrival_flag);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) new_arrival_flag={}", boss->new_arrival_flag);
|
||||
@ -149,7 +149,7 @@ void Module::Interface::RegisterNewArrivalEvent(Kernel::HLERequestContext& ctx)
|
||||
[[maybe_unused]] const auto event = rp.PopObject<Kernel::Event>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED)");
|
||||
}
|
||||
@ -159,7 +159,7 @@ void Module::Interface::SetOptoutFlag(Kernel::HLERequestContext& ctx) {
|
||||
boss->output_flag = rp.Pop<u8>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "output_flag={}", boss->output_flag);
|
||||
}
|
||||
@ -168,7 +168,7 @@ void Module::Interface::GetOptoutFlag(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(boss->output_flag);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "output_flag={}", boss->output_flag);
|
||||
@ -188,7 +188,7 @@ void Module::Interface::RegisterTask(Kernel::HLERequestContext& ctx) {
|
||||
online_service->RegisterTask(size, buffer);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_DEBUG(Service_BOSS, "called, size={:#010x}, unk_param2={:#04x}, unk_param3={:#04x}", size,
|
||||
@ -221,7 +221,7 @@ void Module::Interface::ReconfigureTask(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}, unk_param2={:#04x}", size, unk_param2);
|
||||
@ -237,7 +237,7 @@ void Module::Interface::GetTaskIdList(Kernel::HLERequestContext& ctx) {
|
||||
online_service->GetTaskIdList();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_BOSS, "called");
|
||||
}
|
||||
@ -248,7 +248,7 @@ void Module::Interface::GetStepIdList(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size);
|
||||
@ -269,7 +269,7 @@ void Module::Interface::GetNsDataIdList(Kernel::HLERequestContext& ctx) {
|
||||
const u16 entries_count = online_service->GetNsDataIdList(filter, max_entries, buffer);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u16>(entries_count); /// Actual number of output entries
|
||||
rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list.
|
||||
rb.PushMappedBuffer(buffer);
|
||||
@ -295,7 +295,7 @@ void Module::Interface::GetNsDataIdList1(Kernel::HLERequestContext& ctx) {
|
||||
const u16 entries_count = online_service->GetNsDataIdList(filter, max_entries, buffer);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u16>(entries_count); /// Actual number of output entries
|
||||
rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list.
|
||||
rb.PushMappedBuffer(buffer);
|
||||
@ -321,7 +321,7 @@ void Module::Interface::GetNsDataIdList2(Kernel::HLERequestContext& ctx) {
|
||||
const u16 entries_count = online_service->GetNsDataIdList(filter, max_entries, buffer);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u16>(entries_count); /// Actual number of output entries
|
||||
rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list.
|
||||
rb.PushMappedBuffer(buffer);
|
||||
@ -347,7 +347,7 @@ void Module::Interface::GetNsDataIdList3(Kernel::HLERequestContext& ctx) {
|
||||
const u16 entries_count = online_service->GetNsDataIdList(filter, max_entries, buffer);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u16>(entries_count); /// Actual number of output entries
|
||||
rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list.
|
||||
rb.PushMappedBuffer(buffer);
|
||||
@ -383,7 +383,7 @@ void Module::Interface::SendPropertyHandle(Kernel::HLERequestContext& ctx) {
|
||||
[[maybe_unused]] const std::shared_ptr<Kernel::Object> object = rp.PopGenericObject();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) property_id={:#06x}", property_id);
|
||||
}
|
||||
@ -415,7 +415,7 @@ void Module::Interface::UpdateTaskInterval(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}, unk_param2={:#06x}", size, unk_param2);
|
||||
@ -431,7 +431,7 @@ void Module::Interface::UpdateTaskCount(Kernel::HLERequestContext& ctx) {
|
||||
buffer.Read(task_id.data(), 0, size);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}, unk_param2={:#010x}, task_id={}", size,
|
||||
@ -444,7 +444,7 @@ void Module::Interface::GetTaskInterval(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(0); // stub 0 ( 32bit value)
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
@ -460,7 +460,7 @@ void Module::Interface::GetTaskCount(Kernel::HLERequestContext& ctx) {
|
||||
buffer.Read(task_id.data(), 0, size);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(0); // stub 0 ( 32bit value)
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
@ -477,7 +477,7 @@ void Module::Interface::GetTaskServiceStatus(Kernel::HLERequestContext& ctx) {
|
||||
constexpr u8 task_service_status = 1;
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(task_service_status);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
@ -490,7 +490,7 @@ void Module::Interface::StartTask(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size);
|
||||
@ -502,7 +502,7 @@ void Module::Interface::StartTaskImmediate(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size);
|
||||
@ -514,7 +514,7 @@ void Module::Interface::CancelTask(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size);
|
||||
@ -524,7 +524,7 @@ void Module::Interface::GetTaskFinishHandle(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects<Kernel::Event>(boss->task_finish_event);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) called");
|
||||
@ -537,7 +537,7 @@ void Module::Interface::GetTaskState(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(4, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(0); /// TaskStatus
|
||||
rb.Push<u32>(0); /// Current state value for task PropertyID 0x4
|
||||
rb.Push<u8>(0); /// unknown, usually 0
|
||||
@ -552,7 +552,7 @@ void Module::Interface::GetTaskResult(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(4, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(0); // stub 0 (8 bit value)
|
||||
rb.Push<u32>(0); // stub 0 (32 bit value)
|
||||
rb.Push<u8>(0); // stub 0 (8 bit value)
|
||||
@ -567,7 +567,7 @@ void Module::Interface::GetTaskCommErrorCode(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(4, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(0); // stub 0 (32 bit value)
|
||||
rb.Push<u32>(0); // stub 0 (32 bit value)
|
||||
rb.Push<u8>(0); // stub 0 (8 bit value)
|
||||
@ -584,7 +584,7 @@ void Module::Interface::GetTaskStatus(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(0); // stub 0 (8 bit value)
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
@ -599,7 +599,7 @@ void Module::Interface::GetTaskError(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(0); // stub 0 (8 bit value)
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
@ -613,7 +613,7 @@ void Module::Interface::GetTaskInfo(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}, unk_param2={:#04x}", size, unk_param2);
|
||||
@ -624,7 +624,7 @@ void Module::Interface::DeleteNsData(Kernel::HLERequestContext& ctx) {
|
||||
const u32 ns_data_id = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) ns_data_id={:#010x}", ns_data_id);
|
||||
}
|
||||
@ -684,7 +684,7 @@ void Module::Interface::SetNsDataAdditionalInfo(Kernel::HLERequestContext& ctx)
|
||||
const u32 unk_param2 = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010x}, unk_param2={:#010x}", unk_param1,
|
||||
unk_param2);
|
||||
@ -695,7 +695,7 @@ void Module::Interface::GetNsDataAdditionalInfo(Kernel::HLERequestContext& ctx)
|
||||
const u32 unk_param1 = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(0); // stub 0 (32bit value)
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010x}", unk_param1);
|
||||
@ -707,7 +707,7 @@ void Module::Interface::SetNsDataNewFlag(Kernel::HLERequestContext& ctx) {
|
||||
boss->ns_data_new_flag = rp.Pop<u8>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010x}, ns_data_new_flag={:#04x}", unk_param1,
|
||||
boss->ns_data_new_flag);
|
||||
@ -718,7 +718,7 @@ void Module::Interface::GetNsDataNewFlag(Kernel::HLERequestContext& ctx) {
|
||||
const u32 unk_param1 = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(boss->ns_data_new_flag);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010x}, ns_data_new_flag={:#04x}", unk_param1,
|
||||
@ -738,12 +738,12 @@ void Module::Interface::GetNsDataLastUpdate(Kernel::HLERequestContext& ctx) {
|
||||
if (!entry.has_value()) {
|
||||
// TODO: Proper error code.
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_UNKNOWN);
|
||||
rb.Push(ResultUnknown);
|
||||
return;
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(0);
|
||||
rb.Push<u32>(entry->header.download_date); // return the download date from the ns data
|
||||
|
||||
@ -755,7 +755,7 @@ void Module::Interface::GetErrorCode(Kernel::HLERequestContext& ctx) {
|
||||
const u8 input = rp.Pop<u8>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(0); /// output value
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) input={:#010x}", input);
|
||||
@ -770,7 +770,7 @@ void Module::Interface::RegisterStorageEntry(Kernel::HLERequestContext& ctx) {
|
||||
const u8 unk_param5 = rp.Pop<u8>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_BOSS,
|
||||
"(STUBBED) unk_param1={:#010x}, unk_param2={:#010x}, unk_param3={:#010x}, "
|
||||
@ -782,7 +782,7 @@ void Module::Interface::GetStorageEntryInfo(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(0); // stub 0 (32bit value)
|
||||
rb.Push<u16>(0); // stub 0 (16bit value)
|
||||
|
||||
@ -797,7 +797,7 @@ void Module::Interface::SetStorageOption(Kernel::HLERequestContext& ctx) {
|
||||
const u16 unk_param4 = rp.Pop<u16>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_BOSS,
|
||||
"(STUBBED) unk_param1={:#04x}, unk_param2={:#010x}, "
|
||||
@ -809,7 +809,7 @@ void Module::Interface::GetStorageOption(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(0); // stub 0 (32bit value)
|
||||
rb.Push<u8>(0); // stub 0 (8bit value)
|
||||
rb.Push<u16>(0); // stub 0 (16bit value)
|
||||
@ -824,7 +824,7 @@ void Module::Interface::StartBgImmediate(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size);
|
||||
@ -836,7 +836,7 @@ void Module::Interface::GetTaskProperty0(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(0); /// current state of PropertyID 0x0 stub 0 (8bit value)
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
@ -851,7 +851,7 @@ void Module::Interface::RegisterImmediateTask(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}, unk_param2={:#04x}, unk_param3={:#04x}",
|
||||
@ -866,7 +866,7 @@ void Module::Interface::SetTaskQuery(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer2 = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer1);
|
||||
rb.PushMappedBuffer(buffer2);
|
||||
|
||||
@ -882,7 +882,7 @@ void Module::Interface::GetTaskQuery(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer2 = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer1);
|
||||
rb.PushMappedBuffer(buffer2);
|
||||
|
||||
@ -896,7 +896,7 @@ void Module::Interface::InitializeSessionPrivileged(Kernel::HLERequestContext& c
|
||||
rp.PopPID();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) programID={:#018x}", programID);
|
||||
}
|
||||
@ -906,7 +906,7 @@ void Module::Interface::GetAppNewFlag(Kernel::HLERequestContext& ctx) {
|
||||
const u64 programID = rp.Pop<u64>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(0); // 0 = nothing new, 1 = new content
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) programID={:#018x}", programID);
|
||||
@ -922,7 +922,7 @@ void Module::Interface::GetNsDataIdListPrivileged(Kernel::HLERequestContext& ctx
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u16>(0); /// Actual number of output entries
|
||||
rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list.
|
||||
rb.PushMappedBuffer(buffer);
|
||||
@ -943,7 +943,7 @@ void Module::Interface::GetNsDataIdListPrivileged1(Kernel::HLERequestContext& ct
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u16>(0); /// Actual number of output entries
|
||||
rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list.
|
||||
rb.PushMappedBuffer(buffer);
|
||||
@ -961,7 +961,7 @@ void Module::Interface::SendPropertyPrivileged(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) property_id={:#06x}, size={:#010x}", property_id, size);
|
||||
@ -973,7 +973,7 @@ void Module::Interface::DeleteNsDataPrivileged(Kernel::HLERequestContext& ctx) {
|
||||
const u32 ns_data_id = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_BOSS, "(STUBBED) programID={:#018x}, ns_data_id={:#010x}", programID,
|
||||
ns_data_id);
|
||||
@ -988,7 +988,7 @@ void Module::Interface::GetNsDataHeaderInfoPrivileged(Kernel::HLERequestContext&
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_WARNING(Service_BOSS,
|
||||
@ -1005,7 +1005,7 @@ void Module::Interface::ReadNsDataPrivileged(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(size); /// Should be actual read size
|
||||
rb.Push<u32>(0); /// unknown
|
||||
rb.PushMappedBuffer(buffer);
|
||||
@ -1022,7 +1022,7 @@ void Module::Interface::SetNsDataNewFlagPrivileged(Kernel::HLERequestContext& ct
|
||||
boss->ns_data_new_flag_privileged = rp.Pop<u8>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(
|
||||
Service_BOSS,
|
||||
@ -1036,7 +1036,7 @@ void Module::Interface::GetNsDataNewFlagPrivileged(Kernel::HLERequestContext& ct
|
||||
const u32 unk_param1 = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(boss->ns_data_new_flag_privileged);
|
||||
|
||||
LOG_WARNING(
|
||||
|
@ -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
|
||||
@ -65,7 +65,7 @@ ResultCode OnlineService::InitializeSession(u64 init_program_id) {
|
||||
std::unique_ptr<FileSys::ArchiveBackend> boss_system_save_data_archive;
|
||||
if (archive_result.Succeeded()) {
|
||||
boss_system_save_data_archive = std::move(archive_result).Unwrap();
|
||||
} else if (archive_result.Code() == FileSys::ERROR_NOT_FOUND) {
|
||||
} else if (archive_result.Code() == FileSys::ResultNotFound) {
|
||||
// If the archive didn't exist, create the files inside
|
||||
systemsavedata_factory.Format(archive_path, FileSys::ArchiveFormatInfo(), 0);
|
||||
|
||||
@ -74,13 +74,13 @@ ResultCode OnlineService::InitializeSession(u64 init_program_id) {
|
||||
if (!create_archive_result.Succeeded()) {
|
||||
LOG_ERROR(Service_BOSS, "Could not open BOSS savedata");
|
||||
// TODO: Proper error code.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
boss_system_save_data_archive = std::move(create_archive_result).Unwrap();
|
||||
} else {
|
||||
LOG_ERROR(Service_BOSS, "Could not open BOSS savedata");
|
||||
// TODO: Proper error code.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
FileSys::Mode open_mode = {};
|
||||
@ -94,7 +94,7 @@ ResultCode OnlineService::InitializeSession(u64 init_program_id) {
|
||||
boss_system_save_data_archive->OpenFile(FileSys::Path("/BOSS_SS.db"), open_mode);
|
||||
if (!boss_sv_result.Succeeded() || !boss_ss_result.Succeeded()) {
|
||||
LOG_ERROR(Service_BOSS, "Could not open BOSS database.");
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
auto boss_sv = std::move(boss_sv_result).Unwrap();
|
||||
@ -103,7 +103,7 @@ ResultCode OnlineService::InitializeSession(u64 init_program_id) {
|
||||
((boss_sv->GetSize() - BOSS_SAVE_HEADER_SIZE) % BOSS_S_ENTRY_SIZE) == 0 &&
|
||||
boss_sv->GetSize() == boss_ss->GetSize())) {
|
||||
LOG_ERROR(Service_BOSS, "BOSS database has incorrect size.");
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
// Read the files if they already exist
|
||||
@ -135,7 +135,7 @@ ResultCode OnlineService::InitializeSession(u64 init_program_id) {
|
||||
current_props = BossTaskProperties();
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void OnlineService::RegisterTask(const u32 size, Kernel::MappedBuffer& buffer) {
|
||||
@ -150,11 +150,11 @@ 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.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
std::string task_id(size, 0);
|
||||
@ -162,10 +162,10 @@ ResultCode OnlineService::UnregisterTask(const u32 size, Kernel::MappedBuffer& b
|
||||
if (task_id_list.erase(task_id) == 0) {
|
||||
LOG_WARNING(Service_BOSS, "TaskId not in list");
|
||||
// TODO: Proper error code.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void OnlineService::GetTaskIdList() {
|
||||
@ -334,13 +334,13 @@ 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()) {
|
||||
LOG_WARNING(Service_BOSS, "Failed to find NsData entry for ID {:#010X}", ns_data_id);
|
||||
// TODO: Proper error code.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
static constexpr std::array EXPECTED_NS_DATA_HEADER_INFO_SIZES = {
|
||||
@ -355,31 +355,31 @@ ResultCode OnlineService::GetNsDataHeaderInfo(const u32 ns_data_id, const NsData
|
||||
if (size != EXPECTED_NS_DATA_HEADER_INFO_SIZES[static_cast<u8>(type)]) {
|
||||
LOG_WARNING(Service_BOSS, "Invalid size {} for type {}", size, type);
|
||||
// TODO: Proper error code.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case NsDataHeaderInfoType::ProgramId:
|
||||
buffer.Write(&entry->header.program_id, 0, size);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
case NsDataHeaderInfoType::Unknown: {
|
||||
// TODO: Figure out what this is. Stubbed to zero for now.
|
||||
const u32 zero = 0;
|
||||
buffer.Write(&zero, 0, size);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
case NsDataHeaderInfoType::Datatype:
|
||||
buffer.Write(&entry->header.datatype, 0, size);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
case NsDataHeaderInfoType::PayloadSize:
|
||||
buffer.Write(&entry->header.payload_size, 0, size);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
case NsDataHeaderInfoType::NsDataId:
|
||||
buffer.Write(&entry->header.ns_data_id, 0, size);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
case NsDataHeaderInfoType::Version:
|
||||
buffer.Write(&entry->header.version, 0, size);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
case NsDataHeaderInfoType::Everything: {
|
||||
const NsDataHeaderInfo info = {
|
||||
.program_id = entry->header.program_id,
|
||||
@ -389,12 +389,12 @@ ResultCode OnlineService::GetNsDataHeaderInfo(const u32 ns_data_id, const NsData
|
||||
.version = entry->header.version,
|
||||
};
|
||||
buffer.Write(&info, 0, size);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
default:
|
||||
LOG_WARNING(Service_BOSS, "Unknown header info type {}", type);
|
||||
// TODO: Proper error code.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,7 +404,7 @@ ResultVal<size_t> OnlineService::ReadNsData(const u32 ns_data_id, const u64 offs
|
||||
if (!entry.has_value()) {
|
||||
LOG_WARNING(Service_BOSS, "Failed to find NsData entry for ID {:#010X}", ns_data_id);
|
||||
// TODO: Proper error code.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
if (entry->header.payload_size < size + offset) {
|
||||
@ -413,13 +413,13 @@ ResultVal<size_t> OnlineService::ReadNsData(const u32 ns_data_id, const u64 offs
|
||||
"length is {:#010X}",
|
||||
size, offset, static_cast<u32>(entry->header.payload_size));
|
||||
// TODO: Proper error code.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
auto boss_archive = OpenBossExtData();
|
||||
if (!boss_archive) {
|
||||
// TODO: Proper error code.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
FileSys::Path file_path = fmt::format("/{}", entry->filename);
|
||||
@ -429,7 +429,7 @@ ResultVal<size_t> OnlineService::ReadNsData(const u32 ns_data_id, const u64 offs
|
||||
if (!file_result.Succeeded()) {
|
||||
LOG_WARNING(Service_BOSS, "Failed to open SpotPass extdata file '{}'.", entry->filename);
|
||||
// TODO: Proper error code.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
auto file = std::move(file_result).Unwrap();
|
||||
@ -438,7 +438,7 @@ ResultVal<size_t> OnlineService::ReadNsData(const u32 ns_data_id, const u64 offs
|
||||
if (!read_result.Succeeded()) {
|
||||
LOG_WARNING(Service_BOSS, "Failed to read SpotPass extdata file '{}'.", entry->filename);
|
||||
// TODO: Proper error code.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
buffer.Write(ns_data_array.data(), 0, size);
|
||||
@ -452,12 +452,12 @@ 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);
|
||||
// TODO: Proper error code.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
auto& prop = current_props.properties[property_id];
|
||||
@ -489,16 +489,15 @@ ResultCode OnlineService::SendProperty(const u16 id, const u32 size, Kernel::Map
|
||||
[&](std::vector<u32>& cur_prop) { read_vector(cur_prop); }},
|
||||
prop);
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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);
|
||||
// TODO: Proper error code.
|
||||
return RESULT_UNKNOWN;
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
auto write_pod = [&]<typename T>(T& cur_prop) {
|
||||
@ -526,7 +525,7 @@ ResultCode OnlineService::ReceiveProperty(const u16 id, const u32 size,
|
||||
[&](std::vector<u32>& cur_prop) { write_vector(cur_prop); }},
|
||||
prop);
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
} // namespace Service::BOSS
|
||||
|
@ -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();
|
||||
|
@ -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() {
|
||||
@ -278,7 +278,7 @@ void Module::Interface::StartCapture(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_CAM, "port {} already started", i);
|
||||
}
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||
@ -303,7 +303,7 @@ void Module::Interface::StopCapture(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_CAM, "port {} already stopped", i);
|
||||
}
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||
@ -324,7 +324,7 @@ void Module::Interface::IsBusy(Kernel::HLERequestContext& ctx) {
|
||||
for (int i : port_select) {
|
||||
is_busy &= cam->ports[i].is_busy;
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(is_busy);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
@ -340,7 +340,7 @@ void Module::Interface::ClearBuffer(Kernel::HLERequestContext& ctx) {
|
||||
const PortSet port_select(rp.Pop<u8>());
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_CAM, "(STUBBED) called, port_select={}", port_select.m_val);
|
||||
}
|
||||
@ -352,7 +352,7 @@ void Module::Interface::GetVsyncInterruptEvent(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
if (port_select.IsSingle()) {
|
||||
int port = *port_select.begin();
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(cam->ports[port].vsync_interrupt_event);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
@ -370,7 +370,7 @@ void Module::Interface::GetBufferErrorInterruptEvent(Kernel::HLERequestContext&
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
if (port_select.IsSingle()) {
|
||||
int port = *port_select.begin();
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(cam->ports[port].buffer_error_interrupt_event);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
@ -405,7 +405,7 @@ void Module::Interface::SetReceiving(Kernel::HLERequestContext& ctx) {
|
||||
port.is_pending_receiving = true;
|
||||
}
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(port.completion_event);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
@ -425,7 +425,7 @@ void Module::Interface::IsFinishedReceiving(Kernel::HLERequestContext& ctx) {
|
||||
if (port_select.IsSingle()) {
|
||||
int port = *port_select.begin();
|
||||
bool is_busy = cam->ports[port].is_receiving || cam->ports[port].is_pending_receiving;
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(!is_busy);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
@ -448,7 +448,7 @@ void Module::Interface::SetTransferLines(Kernel::HLERequestContext& ctx) {
|
||||
for (int i : port_select) {
|
||||
cam->ports[i].transfer_bytes = transfer_lines * width * 2;
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||
@ -476,7 +476,7 @@ void Module::Interface::GetMaxLines(Kernel::HLERequestContext& ctx) {
|
||||
if (lines > height) {
|
||||
lines = height;
|
||||
}
|
||||
ResultCode result = RESULT_SUCCESS;
|
||||
Result result = ResultSuccess;
|
||||
while (height % lines != 0 || (lines * width * 2 % MIN_TRANSFER_UNIT != 0)) {
|
||||
--lines;
|
||||
if (lines == 0) {
|
||||
@ -503,7 +503,7 @@ void Module::Interface::SetTransferBytes(Kernel::HLERequestContext& ctx) {
|
||||
for (int i : port_select) {
|
||||
cam->ports[i].transfer_bytes = transfer_bytes;
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||
@ -520,7 +520,7 @@ void Module::Interface::GetTransferBytes(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
if (port_select.IsSingle()) {
|
||||
int port = *port_select.begin();
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(cam->ports[port].transfer_bytes);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
@ -551,7 +551,7 @@ void Module::Interface::GetMaxBytes(Kernel::HLERequestContext& ctx) {
|
||||
bytes -= MIN_TRANSFER_UNIT;
|
||||
}
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(bytes);
|
||||
}
|
||||
|
||||
@ -568,7 +568,7 @@ void Module::Interface::SetTrimming(Kernel::HLERequestContext& ctx) {
|
||||
for (int i : port_select) {
|
||||
cam->ports[i].is_trimming = trim;
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||
@ -584,7 +584,7 @@ void Module::Interface::IsTrimming(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
if (port_select.IsSingle()) {
|
||||
int port = *port_select.begin();
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(cam->ports[port].is_trimming);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
@ -611,7 +611,7 @@ void Module::Interface::SetTrimmingParams(Kernel::HLERequestContext& ctx) {
|
||||
cam->ports[i].x1 = x1;
|
||||
cam->ports[i].y1 = y1;
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||
@ -628,7 +628,7 @@ void Module::Interface::GetTrimmingParams(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
if (port_select.IsSingle()) {
|
||||
int port = *port_select.begin();
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(cam->ports[port].x0);
|
||||
rb.Push(cam->ports[port].y0);
|
||||
rb.Push(cam->ports[port].x1);
|
||||
@ -658,7 +658,7 @@ void Module::Interface::SetTrimmingParamsCenter(Kernel::HLERequestContext& ctx)
|
||||
cam->ports[i].x1 = cam->ports[i].x0 + trim_w;
|
||||
cam->ports[i].y1 = cam->ports[i].y0 + trim_h;
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
|
||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||
@ -684,7 +684,7 @@ void Module::Interface::Activate(Kernel::HLERequestContext& ctx) {
|
||||
cam->ports[i].is_active = false;
|
||||
cam->system.CoreTiming().UnscheduleEvent(cam->vsync_interrupt_event_callback, i);
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else if (camera_select[0] && camera_select[1]) {
|
||||
LOG_ERROR(Service_CAM, "camera 0 and 1 can't be both activated");
|
||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||
@ -698,7 +698,7 @@ void Module::Interface::Activate(Kernel::HLERequestContext& ctx) {
|
||||
if (camera_select[2]) {
|
||||
cam->ActivatePort(1, 2);
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid camera_select={}", camera_select.m_val);
|
||||
@ -724,7 +724,7 @@ void Module::Interface::SwitchContext(Kernel::HLERequestContext& ctx) {
|
||||
cam->cameras[camera].impl->SetFormat(context_config.format);
|
||||
cam->cameras[camera].impl->SetResolution(context_config.resolution);
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
||||
context_select.m_val);
|
||||
@ -751,7 +751,7 @@ void Module::Interface::FlipImage(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
}
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
||||
context_select.m_val);
|
||||
@ -784,7 +784,7 @@ void Module::Interface::SetDetailSize(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
}
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
||||
context_select.m_val);
|
||||
@ -814,7 +814,7 @@ void Module::Interface::SetSize(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
}
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
||||
context_select.m_val);
|
||||
@ -836,7 +836,7 @@ void Module::Interface::SetFrameRate(Kernel::HLERequestContext& ctx) {
|
||||
cam->cameras[camera].frame_rate = frame_rate;
|
||||
cam->cameras[camera].impl->SetFrameRate(frame_rate);
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid camera_select={}", camera_select.m_val);
|
||||
rb.Push(ERROR_INVALID_ENUM_VALUE);
|
||||
@ -862,7 +862,7 @@ void Module::Interface::SetEffect(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
}
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
||||
context_select.m_val);
|
||||
@ -889,7 +889,7 @@ void Module::Interface::SetOutputFormat(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
}
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
|
||||
context_select.m_val);
|
||||
@ -906,7 +906,7 @@ void Module::Interface::SynchronizeVsyncTiming(Kernel::HLERequestContext& ctx) {
|
||||
const u8 camera_select2 = rp.Pop<u8>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_CAM, "(STUBBED) called, camera_select1={}, camera_select2={}",
|
||||
camera_select1, camera_select2);
|
||||
@ -925,7 +925,7 @@ void Module::Interface::GetLatestVsyncTiming(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
const std::size_t port_id = port_select.m_val == 1 ? 0 : 1;
|
||||
std::vector<u8> out(count * sizeof(s64_le));
|
||||
@ -961,7 +961,7 @@ void Module::Interface::GetStereoCameraCalibrationData(Kernel::HLERequestContext
|
||||
data.imageWidth = 640;
|
||||
data.imageHeight = 480;
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(data);
|
||||
|
||||
LOG_TRACE(Service_CAM, "called");
|
||||
@ -974,13 +974,13 @@ void Module::Interface::SetPackageParameterWithoutContext(Kernel::HLERequestCont
|
||||
rp.PopRaw(package);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_CAM, "(STUBBED) called");
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@ -999,7 +999,7 @@ ResultCode Module::SetPackageParameter(const PackageParameterType& package) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
} else {
|
||||
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", package.camera_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");
|
||||
@ -1040,7 +1040,7 @@ void Module::Interface::SetPackageParameterWithContextDetail(Kernel::HLERequestC
|
||||
void Module::Interface::GetSuitableY2rStandardCoefficient(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(0);
|
||||
|
||||
LOG_WARNING(Service_CAM, "(STUBBED) called");
|
||||
@ -1051,7 +1051,7 @@ void Module::Interface::PlayShutterSound(Kernel::HLERequestContext& ctx) {
|
||||
u8 sound_id = rp.Pop<u8>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_CAM, "(STUBBED) called, sound_id={}", sound_id);
|
||||
}
|
||||
@ -1081,7 +1081,7 @@ void Module::Interface::DriverInitialize(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
cam->initialized = true;
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_CAM, "called");
|
||||
}
|
||||
@ -1099,7 +1099,7 @@ void Module::Interface::DriverFinalize(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
cam->initialized = false;
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_CAM, "called");
|
||||
}
|
||||
|
@ -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};
|
||||
|
@ -37,23 +37,23 @@ 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
|
||||
// 1024 the `camera` module would set the value 0 here, but we don't need to emulate this
|
||||
// internal detail.
|
||||
this->input_line_width = width;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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
|
||||
@ -62,19 +62,18 @@ ResultCode ConversionConfiguration::SetInputLines(u16 lines) {
|
||||
if (lines != 1024) {
|
||||
this->input_lines = lines;
|
||||
}
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
std::memcpy(coefficients.data(), standard_coefficients[index].data(), sizeof(coefficients));
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void Y2R_U::SetInputFormat(Kernel::HLERequestContext& ctx) {
|
||||
@ -83,7 +82,7 @@ void Y2R_U::SetInputFormat(Kernel::HLERequestContext& ctx) {
|
||||
conversion.input_format = rp.PopEnum<InputFormat>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called input_format={}", conversion.input_format);
|
||||
}
|
||||
@ -92,7 +91,7 @@ void Y2R_U::GetInputFormat(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(conversion.input_format);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called input_format={}", conversion.input_format);
|
||||
@ -104,7 +103,7 @@ void Y2R_U::SetOutputFormat(Kernel::HLERequestContext& ctx) {
|
||||
conversion.output_format = rp.PopEnum<OutputFormat>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called output_format={}", conversion.output_format);
|
||||
}
|
||||
@ -113,7 +112,7 @@ void Y2R_U::GetOutputFormat(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(conversion.output_format);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called output_format={}", conversion.output_format);
|
||||
@ -125,7 +124,7 @@ void Y2R_U::SetRotation(Kernel::HLERequestContext& ctx) {
|
||||
conversion.rotation = rp.PopEnum<Rotation>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called rotation={}", conversion.rotation);
|
||||
}
|
||||
@ -134,7 +133,7 @@ void Y2R_U::GetRotation(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(conversion.rotation);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called rotation={}", conversion.rotation);
|
||||
@ -146,7 +145,7 @@ void Y2R_U::SetBlockAlignment(Kernel::HLERequestContext& ctx) {
|
||||
conversion.block_alignment = rp.PopEnum<BlockAlignment>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called block_alignment={}", conversion.block_alignment);
|
||||
}
|
||||
@ -155,7 +154,7 @@ void Y2R_U::GetBlockAlignment(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(conversion.block_alignment);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called block_alignment={}", conversion.block_alignment);
|
||||
@ -167,7 +166,7 @@ void Y2R_U::SetSpacialDithering(Kernel::HLERequestContext& ctx) {
|
||||
spacial_dithering_enabled = rp.Pop<bool>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "(STUBBED) called");
|
||||
}
|
||||
@ -176,7 +175,7 @@ void Y2R_U::GetSpacialDithering(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(spacial_dithering_enabled);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "(STUBBED) called");
|
||||
@ -187,7 +186,7 @@ void Y2R_U::SetTemporalDithering(Kernel::HLERequestContext& ctx) {
|
||||
temporal_dithering_enabled = rp.Pop<bool>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "(STUBBED) called");
|
||||
}
|
||||
@ -196,7 +195,7 @@ void Y2R_U::GetTemporalDithering(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(temporal_dithering_enabled);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "(STUBBED) called");
|
||||
@ -207,7 +206,7 @@ void Y2R_U::SetTransferEndInterrupt(Kernel::HLERequestContext& ctx) {
|
||||
transfer_end_interrupt_enabled = rp.Pop<bool>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "(STUBBED) called");
|
||||
}
|
||||
@ -216,7 +215,7 @@ void Y2R_U::GetTransferEndInterrupt(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(transfer_end_interrupt_enabled);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "(STUBBED) called");
|
||||
@ -226,7 +225,7 @@ void Y2R_U::GetTransferEndEvent(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(completion_event);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called");
|
||||
@ -242,7 +241,7 @@ void Y2R_U::SetSendingY(Kernel::HLERequestContext& ctx) {
|
||||
// TODO (wwylele): pass process handle to y2r engine or convert VAddr to PAddr
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R,
|
||||
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
|
||||
@ -261,7 +260,7 @@ void Y2R_U::SetSendingU(Kernel::HLERequestContext& ctx) {
|
||||
// TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R,
|
||||
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
|
||||
@ -281,7 +280,7 @@ void Y2R_U::SetSendingV(Kernel::HLERequestContext& ctx) {
|
||||
// TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R,
|
||||
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
|
||||
@ -301,7 +300,7 @@ void Y2R_U::SetSendingYUYV(Kernel::HLERequestContext& ctx) {
|
||||
// TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R,
|
||||
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
|
||||
@ -314,7 +313,7 @@ void Y2R_U::IsFinishedSendingYuv(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(1);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "(STUBBED) called");
|
||||
@ -324,7 +323,7 @@ void Y2R_U::IsFinishedSendingY(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(1);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "(STUBBED) called");
|
||||
@ -334,7 +333,7 @@ void Y2R_U::IsFinishedSendingU(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(1);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "(STUBBED) called");
|
||||
@ -344,7 +343,7 @@ void Y2R_U::IsFinishedSendingV(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(1);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "(STUBBED) called");
|
||||
@ -361,7 +360,7 @@ void Y2R_U::SetReceiving(Kernel::HLERequestContext& ctx) {
|
||||
// TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R,
|
||||
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
|
||||
@ -374,7 +373,7 @@ void Y2R_U::IsFinishedReceiving(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(1);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "(STUBBED) called");
|
||||
@ -394,7 +393,7 @@ void Y2R_U::GetInputLineWidth(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(conversion.input_line_width);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called input_line_width={}", conversion.input_line_width);
|
||||
@ -414,7 +413,7 @@ void Y2R_U::GetInputLines(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(static_cast<u32>(conversion.input_lines));
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called input_lines={}", conversion.input_lines);
|
||||
@ -426,7 +425,7 @@ void Y2R_U::SetCoefficient(Kernel::HLERequestContext& ctx) {
|
||||
rp.PopRaw<CoefficientSet>(conversion.coefficients);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called coefficients=[{:X}, {:X}, {:X}, {:X}, {:X}, {:X}, {:X}, {:X}]",
|
||||
conversion.coefficients[0], conversion.coefficients[1], conversion.coefficients[2],
|
||||
@ -438,7 +437,7 @@ void Y2R_U::GetCoefficient(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(conversion.coefficients);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called");
|
||||
@ -460,13 +459,13 @@ void Y2R_U::GetStandardCoefficient(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
if (index < standard_coefficients.size()) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(standard_coefficients[index]);
|
||||
|
||||
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);
|
||||
@ -478,7 +477,7 @@ void Y2R_U::SetAlpha(Kernel::HLERequestContext& ctx) {
|
||||
conversion.alpha = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called alpha={}", conversion.alpha);
|
||||
}
|
||||
@ -487,7 +486,7 @@ void Y2R_U::GetAlpha(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(conversion.alpha);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called alpha={}", conversion.alpha);
|
||||
@ -497,7 +496,7 @@ void Y2R_U::SetDitheringWeightParams(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
rp.PopRaw(dithering_weight_params);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called");
|
||||
}
|
||||
@ -506,7 +505,7 @@ void Y2R_U::GetDitheringWeightParams(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(9, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(dithering_weight_params);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called");
|
||||
@ -526,7 +525,7 @@ void Y2R_U::StartConversion(Kernel::HLERequestContext& ctx) {
|
||||
completion_event->Signal();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called");
|
||||
}
|
||||
@ -535,7 +534,7 @@ void Y2R_U::StopConversion(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called");
|
||||
}
|
||||
@ -544,7 +543,7 @@ void Y2R_U::IsBusyConversion(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(0); // StartConversion always finishes immediately
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called");
|
||||
@ -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;
|
||||
@ -593,7 +592,7 @@ void Y2R_U::PingProcess(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(0);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "(STUBBED) called");
|
||||
@ -621,7 +620,7 @@ void Y2R_U::DriverInitialize(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
completion_event->Clear();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called");
|
||||
}
|
||||
@ -630,7 +629,7 @@ void Y2R_U::DriverFinalize(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called");
|
||||
}
|
||||
@ -639,7 +638,7 @@ void Y2R_U::GetPackageParameter(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(4, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(conversion);
|
||||
|
||||
LOG_DEBUG(Service_Y2R, "called");
|
||||
|
@ -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>
|
||||
|
@ -76,11 +76,11 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) {
|
||||
if (dir_result.Failed()) {
|
||||
if (open_mode.create) {
|
||||
cecd->cecd_system_save_data_archive->CreateDirectory(path);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} 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 {
|
||||
@ -93,7 +93,7 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
LOG_DEBUG(Service_CECD, "Number of entries found: {}", entry_count);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(entry_count); // Entry count
|
||||
directory->Close();
|
||||
}
|
||||
@ -103,12 +103,12 @@ 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 {
|
||||
session_data->file = std::move(file_result).Unwrap();
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(static_cast<u32>(session_data->file->GetSize())); // Return file size
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -163,7 +163,7 @@ void Module::Interface::Read(Kernel::HLERequestContext& ctx) {
|
||||
write_buffer.Write(buffer.data(), 0, write_buffer_size);
|
||||
session_data->file->Close();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(bytes_read);
|
||||
}
|
||||
rb.PushMappedBuffer(write_buffer);
|
||||
@ -225,10 +225,10 @@ void Module::Interface::ReadMessage(Kernel::HLERequestContext& ctx) {
|
||||
msg_header.sender_id, msg_header.sender_id2, msg_header.send_count,
|
||||
msg_header.forward_count, msg_header.user_data);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
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
|
||||
}
|
||||
@ -317,10 +317,10 @@ void Module::Interface::ReadMessageWithHMAC(Kernel::HLERequestContext& ctx) {
|
||||
else
|
||||
LOG_DEBUG(Service_CECD, "Verification failed");
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
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);
|
||||
@ -376,7 +376,7 @@ void Module::Interface::Write(Kernel::HLERequestContext& ctx) {
|
||||
session_data->file->Write(0, buffer.size(), true, buffer.data()).Unwrap());
|
||||
session_data->file->Close();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
rb.PushMappedBuffer(read_buffer);
|
||||
|
||||
@ -438,9 +438,9 @@ void Module::Interface::WriteMessage(Kernel::HLERequestContext& ctx) {
|
||||
static_cast<u32>(message->Write(0, buffer_size, true, buffer.data()).Unwrap());
|
||||
message->Close();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
}
|
||||
|
||||
@ -525,9 +525,9 @@ void Module::Interface::WriteMessageWithHMAC(Kernel::HLERequestContext& ctx) {
|
||||
static_cast<u32>(message->Write(0, buffer_size, true, buffer.data()).Unwrap());
|
||||
message->Close();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
}
|
||||
|
||||
@ -613,7 +613,7 @@ void Module::Interface::SetData(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(read_buffer);
|
||||
|
||||
LOG_DEBUG(Service_CECD, "called, ncch_program_id={:#010x}, buffer_size={:#x}, option={:#x}",
|
||||
@ -651,7 +651,7 @@ void Module::Interface::ReadData(Kernel::HLERequestContext& ctx) {
|
||||
dest_buffer.Write(buffer.data(), 0,
|
||||
std::min(static_cast<size_t>(dest_buffer_size), buffer.size()));
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(param_buffer);
|
||||
rb.PushMappedBuffer(dest_buffer);
|
||||
|
||||
@ -665,7 +665,7 @@ void Module::Interface::Start(Kernel::HLERequestContext& ctx) {
|
||||
const CecCommand command = rp.PopEnum<CecCommand>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_CECD, "(STUBBED) called, command={}", cecd->GetCecCommandAsString(command));
|
||||
}
|
||||
@ -675,7 +675,7 @@ void Module::Interface::Stop(Kernel::HLERequestContext& ctx) {
|
||||
const CecCommand command = rp.PopEnum<CecCommand>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_CECD, "(STUBBED) called, command={}", cecd->GetCecCommandAsString(command));
|
||||
}
|
||||
@ -687,7 +687,7 @@ void Module::Interface::GetCecInfoBuffer(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_DEBUG(Service_CECD, "called, buffer_size={}, possible_info_type={}", buffer_size,
|
||||
@ -698,7 +698,7 @@ void Module::Interface::GetCecdState(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(CecdState::NdmStatusIdle);
|
||||
|
||||
LOG_WARNING(Service_CECD, "(STUBBED) called");
|
||||
@ -708,7 +708,7 @@ void Module::Interface::GetCecInfoEventHandle(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(cecd->cecinfo_event);
|
||||
|
||||
LOG_WARNING(Service_CECD, "(STUBBED) called");
|
||||
@ -718,7 +718,7 @@ void Module::Interface::GetChangeStateEventHandle(Kernel::HLERequestContext& ctx
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(cecd->change_state_event);
|
||||
|
||||
LOG_WARNING(Service_CECD, "(STUBBED) called");
|
||||
@ -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);
|
||||
@ -768,9 +768,9 @@ void Module::Interface::OpenAndWrite(Kernel::HLERequestContext& ctx) {
|
||||
static_cast<u32>(file->Write(0, buffer.size(), true, buffer.data()).Unwrap());
|
||||
file->Close();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} 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
|
||||
@ -819,10 +819,10 @@ void Module::Interface::OpenAndRead(Kernel::HLERequestContext& ctx) {
|
||||
write_buffer.Write(buffer.data(), 0, buffer_size);
|
||||
file->Close();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
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
|
||||
}
|
||||
@ -842,7 +842,7 @@ void Module::Interface::GetCecInfoEventHandleSys(Kernel::HLERequestContext& ctx)
|
||||
rp.PopPID();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(cecd->cecinfosys_event);
|
||||
|
||||
LOG_WARNING(Service_CECD, "(STUBBED) called");
|
||||
@ -1404,7 +1404,7 @@ Module::Module(Core::System& system) : system(system) {
|
||||
auto archive_result = systemsavedata_factory.Open(archive_path, 0);
|
||||
|
||||
// If the archive didn't exist, create the files inside
|
||||
if (archive_result.Code() != FileSys::ERROR_NOT_FOUND) {
|
||||
if (archive_result.Code() != FileSys::ResultNotFound) {
|
||||
ASSERT_MSG(archive_result.Succeeded(), "Could not open the CECD SystemSaveData archive!");
|
||||
cecd_system_save_data_archive = std::move(archive_result).Unwrap();
|
||||
} else {
|
||||
|
@ -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);
|
||||
|
@ -153,13 +153,13 @@ 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;
|
||||
}
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
// the real CFG service copies only three bytes (including the null-terminator) here
|
||||
rb.Push<u32>(country_codes[country_code_id]);
|
||||
}
|
||||
@ -187,13 +187,13 @@ 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;
|
||||
}
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u16>(country_code_id);
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ void Module::Interface::GetRegion(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u8>(static_cast<u8>(cfg->GetRegionValue()));
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ void Module::Interface::SecureInfoGetByte101(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_CFG, "(STUBBED) called");
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
// According to 3dbrew this is normally 0.
|
||||
rb.Push<u8>(0);
|
||||
}
|
||||
@ -232,14 +232,14 @@ void Module::Interface::SetUUIDClockSequence(Kernel::HLERequestContext& ctx) {
|
||||
cfg->SaveMCUConfig();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::Interface::GetUUIDClockSequence(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u16>(static_cast<u16>(cfg->mcu_data.clock_sequence));
|
||||
}
|
||||
|
||||
@ -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()) {
|
||||
@ -274,7 +274,7 @@ void Module::Interface::IsCoppacsSupported(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
u8 canada_or_usa = 1;
|
||||
if (canada_or_usa == cfg->GetRegionValue()) {
|
||||
@ -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,27 +437,26 @@ 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);
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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 ResultUnknown; // 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};
|
||||
@ -483,15 +482,15 @@ ResultCode Module::CreateConfigBlock(u32 block_id, u16 size, AccessFlag access_f
|
||||
}
|
||||
|
||||
++config->total_entries;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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);
|
||||
@ -504,13 +503,13 @@ ResultCode Module::UpdateConfigNANDSavegame() {
|
||||
auto config = std::move(config_result).Unwrap();
|
||||
config->Write(0, CONFIG_SAVEFILE_SIZE, 1, cfg_config_file_buffer.data());
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!res.IsSuccess() && res != FileSys::ResultFileNotFound) {
|
||||
return res;
|
||||
}
|
||||
// Delete the old data
|
||||
@ -540,10 +539,10 @@ ResultCode Module::FormatConfig() {
|
||||
return res;
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode Module::LoadConfigNANDSaveFile() {
|
||||
Result Module::LoadConfigNANDSaveFile() {
|
||||
const std::string& nand_directory = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir);
|
||||
FileSys::ArchiveFactory_SystemSaveData systemsavedata_factory(nand_directory);
|
||||
|
||||
@ -552,7 +551,7 @@ ResultCode Module::LoadConfigNANDSaveFile() {
|
||||
auto archive_result = systemsavedata_factory.Open(archive_path, 0);
|
||||
|
||||
// If the archive didn't exist, create the files inside
|
||||
if (archive_result.Code() == FileSys::ERROR_NOT_FOUND) {
|
||||
if (archive_result.Code() == FileSys::ResultNotFound) {
|
||||
// Format the archive to create the directories
|
||||
systemsavedata_factory.Format(archive_path, FileSys::ArchiveFormatInfo(), 0);
|
||||
|
||||
@ -574,7 +573,7 @@ ResultCode Module::LoadConfigNANDSaveFile() {
|
||||
if (config_result.Succeeded()) {
|
||||
auto config = std::move(config_result).Unwrap();
|
||||
config->Read(0, CONFIG_SAVEFILE_SIZE, cfg_config_file_buffer.data());
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
return FormatConfig();
|
||||
@ -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;
|
||||
|
||||
@ -795,7 +794,7 @@ ResultCode Module::SetConsoleUniqueId(u32 random_number, u64 console_id) {
|
||||
if (!res.IsSuccess())
|
||||
return res;
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
u64 Module::GetConsoleUniqueId() {
|
||||
|
@ -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
|
||||
|
@ -208,7 +208,7 @@ void CSND_SND::Initialize(Kernel::HLERequestContext& ctx) {
|
||||
.Unwrap();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 3);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(mutex, shared_memory);
|
||||
|
||||
LOG_WARNING(Service_CSND,
|
||||
@ -228,7 +228,7 @@ void CSND_SND::Shutdown(Kernel::HLERequestContext& ctx) {
|
||||
shared_memory = nullptr;
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_CSND, "(STUBBED) called");
|
||||
}
|
||||
@ -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;
|
||||
@ -394,7 +394,7 @@ void CSND_SND::ExecuteCommands(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
*shared_memory->GetPointer(addr + offsetof(Type0Command, finished)) = 1;
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void CSND_SND::AcquireSoundChannels(Kernel::HLERequestContext& ctx) {
|
||||
@ -405,7 +405,7 @@ void CSND_SND::AcquireSoundChannels(Kernel::HLERequestContext& ctx) {
|
||||
acquired_channel_mask = 0xFFFFFF00;
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(acquired_channel_mask);
|
||||
|
||||
LOG_WARNING(Service_CSND, "(STUBBED) called");
|
||||
@ -417,7 +417,7 @@ void CSND_SND::ReleaseSoundChannels(Kernel::HLERequestContext& ctx) {
|
||||
acquired_channel_mask = 0;
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_CSND, "(STUBBED) called");
|
||||
}
|
||||
@ -428,12 +428,12 @@ 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;
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
if (capture_units[0]) {
|
||||
capture_units[1] = true;
|
||||
@ -453,7 +453,7 @@ void CSND_SND::ReleaseCapUnit(Kernel::HLERequestContext& ctx) {
|
||||
capture_units[index] = false;
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_CSND, "(STUBBED) called, capture_unit_index={}", index);
|
||||
}
|
||||
@ -465,7 +465,7 @@ void CSND_SND::FlushDataCache(Kernel::HLERequestContext& ctx) {
|
||||
const auto process = rp.PopObject<Kernel::Process>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_TRACE(Service_CSND, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address,
|
||||
size, process->process_id);
|
||||
@ -478,7 +478,7 @@ void CSND_SND::StoreDataCache(Kernel::HLERequestContext& ctx) {
|
||||
const auto process = rp.PopObject<Kernel::Process>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_TRACE(Service_CSND, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address,
|
||||
size, process->process_id);
|
||||
@ -491,7 +491,7 @@ void CSND_SND::InvalidateDataCache(Kernel::HLERequestContext& ctx) {
|
||||
const auto process = rp.PopObject<Kernel::Process>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_TRACE(Service_CSND, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address,
|
||||
size, process->process_id);
|
||||
@ -501,7 +501,7 @@ void CSND_SND::Reset(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_CSND, "(STUBBED) called");
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ void DLP_SRVR::IsChild(Kernel::HLERequestContext& ctx) {
|
||||
rp.Skip(1, false);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(false);
|
||||
|
||||
LOG_WARNING(Service_DLP, "(STUBBED) called");
|
||||
|
@ -28,7 +28,7 @@ void DSP_DSP::RecvData(Kernel::HLERequestContext& ctx) {
|
||||
const u32 register_number = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(system.DSP().RecvData(register_number));
|
||||
|
||||
LOG_DEBUG(Service_DSP, "register_number={}", register_number);
|
||||
@ -39,7 +39,7 @@ void DSP_DSP::RecvDataIsReady(Kernel::HLERequestContext& ctx) {
|
||||
const u32 register_number = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(system.DSP().RecvDataIsReady(register_number));
|
||||
|
||||
LOG_DEBUG(Service_DSP, "register_number={}", register_number);
|
||||
@ -52,7 +52,7 @@ void DSP_DSP::SetSemaphore(Kernel::HLERequestContext& ctx) {
|
||||
system.DSP().SetSemaphore(semaphore_value);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_INFO(Service_DSP, "called, semaphore_value={:04X}", semaphore_value);
|
||||
}
|
||||
@ -62,7 +62,7 @@ void DSP_DSP::ConvertProcessAddressFromDspDram(Kernel::HLERequestContext& ctx) {
|
||||
const u32 address = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
// TODO(merry): There is a per-region offset missing in this calculation (that seems to be
|
||||
// always zero).
|
||||
@ -103,7 +103,7 @@ void DSP_DSP::WriteProcessPipe(Kernel::HLERequestContext& ctx) {
|
||||
system.DSP().PipeWrite(pipe, buffer);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_DSP, "channel={}, size=0x{:X}, buffer_size={:X}", channel, size,
|
||||
buffer.size());
|
||||
@ -125,7 +125,7 @@ void DSP_DSP::ReadPipe(Kernel::HLERequestContext& ctx) {
|
||||
UNREACHABLE(); // No more data is in pipe. Hardware hangs in this case; Should never happen.
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushStaticBuffer(std::move(pipe_buffer), 0);
|
||||
|
||||
LOG_DEBUG(Service_DSP, "channel={}, peer={}, size=0x{:04X}, pipe_readable_size=0x{:04X}",
|
||||
@ -141,7 +141,7 @@ void DSP_DSP::GetPipeReadableSize(Kernel::HLERequestContext& ctx) {
|
||||
const u16 pipe_readable_size = static_cast<u16>(system.DSP().GetPipeReadableSize(pipe));
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u16>(pipe_readable_size);
|
||||
|
||||
LOG_DEBUG(Service_DSP, "channel={}, peer={}, return pipe_readable_size=0x{:04X}", channel, peer,
|
||||
@ -163,7 +163,7 @@ void DSP_DSP::ReadPipeIfPossible(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u16>(static_cast<u16>(pipe_buffer.size()));
|
||||
rb.PushStaticBuffer(std::move(pipe_buffer), 0);
|
||||
|
||||
@ -179,7 +179,7 @@ void DSP_DSP::LoadComponent(Kernel::HLERequestContext& ctx) {
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(true);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
@ -198,7 +198,7 @@ void DSP_DSP::UnloadComponent(Kernel::HLERequestContext& ctx) {
|
||||
system.DSP().UnloadComponent();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_INFO(Service_DSP, "(STUBBED)");
|
||||
}
|
||||
@ -210,7 +210,7 @@ void DSP_DSP::FlushDataCache(Kernel::HLERequestContext& ctx) {
|
||||
const auto process = rp.PopObject<Kernel::Process>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_TRACE(Service_DSP, "called address=0x{:08X}, size=0x{:X}, process={}", address, size,
|
||||
process->process_id);
|
||||
@ -223,7 +223,7 @@ void DSP_DSP::InvalidateDataCache(Kernel::HLERequestContext& ctx) {
|
||||
const auto process = rp.PopObject<Kernel::Process>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_TRACE(Service_DSP, "called address=0x{:08X}, size=0x{:X}, process={}", address, size,
|
||||
process->process_id);
|
||||
@ -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 {
|
||||
@ -262,14 +262,14 @@ void DSP_DSP::RegisterInterruptEvents(Kernel::HLERequestContext& ctx) {
|
||||
GetInterruptEvent(type, pipe) = nullptr;
|
||||
LOG_INFO(Service_DSP, "Unregistered interrupt={}, channel={}", interrupt, channel);
|
||||
}
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void DSP_DSP::GetSemaphoreEventHandle(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(semaphore_event);
|
||||
|
||||
LOG_WARNING(Service_DSP, "(STUBBED) called");
|
||||
@ -280,7 +280,7 @@ void DSP_DSP::SetSemaphoreMask(Kernel::HLERequestContext& ctx) {
|
||||
preset_semaphore = rp.Pop<u16>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_DSP, "(STUBBED) called mask=0x{:04X}", preset_semaphore);
|
||||
}
|
||||
@ -289,7 +289,7 @@ void DSP_DSP::GetHeadphoneStatus(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(false); /// u8, 0 = not inserted, 1 = inserted
|
||||
|
||||
LOG_DEBUG(Service_DSP, "called");
|
||||
@ -300,7 +300,7 @@ void DSP_DSP::ForceHeadphoneOut(Kernel::HLERequestContext& ctx) {
|
||||
const u8 force = rp.Pop<u8>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_DSP, "(STUBBED) called, force={}", force);
|
||||
}
|
||||
|
@ -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()));
|
||||
@ -244,7 +244,7 @@ void ERR_F::ThrowFatalError(Kernel::HLERequestContext& ctx) {
|
||||
} // switch FatalErrType
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
ERR_F::ERR_F(Core::System& system) : ServiceFramework("err:f", 1), system(system) {
|
||||
|
@ -35,7 +35,7 @@ void Module::Interface::GetMyPresence(Kernel::HLERequestContext& ctx) {
|
||||
std::memcpy(buffer.data(), &frd->my_presence, buffer.size());
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushStaticBuffer(std::move(buffer), 0);
|
||||
|
||||
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||
@ -49,7 +49,7 @@ void Module::Interface::GetFriendKeyList(Kernel::HLERequestContext& ctx) {
|
||||
std::vector<u8> buffer(sizeof(FriendKey) * frd_count, 0);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(0); // 0 friends
|
||||
rb.PushStaticBuffer(std::move(buffer), 0);
|
||||
|
||||
@ -65,7 +65,7 @@ void Module::Interface::GetFriendProfile(Kernel::HLERequestContext& ctx) {
|
||||
std::vector<u8> buffer(sizeof(Profile) * count, 0);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushStaticBuffer(std::move(buffer), 0);
|
||||
|
||||
LOG_WARNING(Service_FRD, "(STUBBED) called, count={}", count);
|
||||
@ -80,7 +80,7 @@ void Module::Interface::GetFriendAttributeFlags(Kernel::HLERequestContext& ctx)
|
||||
// TODO:(mailwl) figure out AttributeFlag size and zero all buffer. Assume 1 byte
|
||||
std::vector<u8> buffer(1 * count, 0);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushStaticBuffer(std::move(buffer), 0);
|
||||
|
||||
LOG_WARNING(Service_FRD, "(STUBBED) called, count={}", count);
|
||||
@ -89,7 +89,7 @@ void Module::Interface::GetFriendAttributeFlags(Kernel::HLERequestContext& ctx)
|
||||
void Module::Interface::GetMyFriendKey(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(frd->my_friend_key);
|
||||
|
||||
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||
@ -105,7 +105,7 @@ void Module::Interface::GetMyScreenName(Kernel::HLERequestContext& ctx) {
|
||||
ScreenName screen_name{};
|
||||
std::memcpy(screen_name.name.data(), username.data(), username.length() * sizeof(char16_t));
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(screen_name);
|
||||
rb.Push(0);
|
||||
|
||||
@ -118,7 +118,7 @@ void Module::Interface::GetMyComment(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
constexpr Comment comment{.name = {u'H', u'e', u'y', '!'}};
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<Comment>(comment);
|
||||
rb.Push(0);
|
||||
|
||||
@ -133,7 +133,7 @@ void Module::Interface::GetMyMii(Kernel::HLERequestContext& ctx) {
|
||||
Mii::ChecksummedMiiData mii{};
|
||||
mii.SetMiiData(mii_data);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<Mii::ChecksummedMiiData>(mii);
|
||||
|
||||
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||
@ -145,7 +145,7 @@ void Module::Interface::GetMyProfile(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
constexpr Profile profile{.region = 1, .country = 1, .area = 1, .language = 1, .platform = 1};
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<Profile>(profile);
|
||||
|
||||
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||
@ -157,7 +157,7 @@ void Module::Interface::GetMyFavoriteGame(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
constexpr Game game{.title_id = 0x0004000E00030700, .version = 1};
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<Game>(game);
|
||||
|
||||
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||
@ -169,7 +169,7 @@ void Module::Interface::GetMyPlayingGame(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
constexpr Game game{.title_id = 0x0004000E00030700, .version = 1};
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<Game>(game);
|
||||
|
||||
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||
@ -183,7 +183,7 @@ void Module::Interface::GetMyPreference(Kernel::HLERequestContext& ctx) {
|
||||
constexpr u32 show_game = 1;
|
||||
constexpr u32 show_history = 0;
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(is_public);
|
||||
rb.Push<u32>(show_game);
|
||||
rb.Push<u32>(show_history);
|
||||
@ -218,7 +218,7 @@ void Module::Interface::UnscrambleLocalFriendCode(Kernel::HLERequestContext& ctx
|
||||
|
||||
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushStaticBuffer(std::move(unscrambled_friend_codes), 0);
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ void Module::Interface::SetClientSdkVersion(Kernel::HLERequestContext& ctx) {
|
||||
rp.PopPID();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_FRD, "(STUBBED) called, version: 0x{:08X}", version);
|
||||
}
|
||||
@ -237,7 +237,7 @@ void Module::Interface::IsOnline(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(frd->logged_in);
|
||||
|
||||
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||
@ -248,7 +248,7 @@ void Module::Interface::HasLoggedIn(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
IPC::RequestParser rp(ctx);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(frd->logged_in);
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ void Module::Interface::Login(Kernel::HLERequestContext& ctx) {
|
||||
frd->system.CoreTiming().ScheduleEvent(msToCycles(login_delay_ms), frd->login_delay_event);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::Interface::GetLastResponseResult(Kernel::HLERequestContext& ctx) {
|
||||
@ -278,7 +278,7 @@ void Module::Interface::GetLastResponseResult(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
IPC::RequestParser rp(ctx);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
Module::Module(Core::System& system) : system(system){};
|
||||
|
@ -52,7 +52,7 @@ ResultVal<ArchiveHandle> ArchiveManager::OpenArchive(ArchiveIdCode id_code,
|
||||
|
||||
auto itr = id_code_map.find(id_code);
|
||||
if (itr == id_code_map.end()) {
|
||||
return FileSys::ERROR_NOT_FOUND;
|
||||
return FileSys::ResultNotFound;
|
||||
}
|
||||
|
||||
CASCADE_RESULT(std::unique_ptr<ArchiveBackend> res,
|
||||
@ -66,16 +66,16 @@ 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;
|
||||
return FileSys::ResultInvalidArchiveHandle;
|
||||
else
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
// 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));
|
||||
|
||||
@ -85,7 +85,7 @@ ResultCode ArchiveManager::RegisterArchiveType(std::unique_ptr<FileSys::ArchiveF
|
||||
auto& archive = result.first->second;
|
||||
LOG_DEBUG(Service_FS, "Registered archive {} with id code 0x{:08X}", archive->GetName(),
|
||||
id_code);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
std::pair<ResultVal<std::shared_ptr<File>>, std::chrono::nanoseconds>
|
||||
@ -93,7 +93,7 @@ ArchiveManager::OpenFileFromArchive(ArchiveHandle archive_handle, const FileSys:
|
||||
const FileSys::Mode mode) {
|
||||
ArchiveBackend* archive = GetArchive(archive_handle);
|
||||
if (archive == nullptr) {
|
||||
return std::make_pair(FileSys::ERR_INVALID_ARCHIVE_HANDLE, std::chrono::nanoseconds{0});
|
||||
return std::make_pair(FileSys::ResultInvalidArchiveHandle, std::chrono::nanoseconds{0});
|
||||
}
|
||||
|
||||
const std::chrono::nanoseconds open_timeout_ns{archive->GetOpenDelayNs()};
|
||||
@ -106,23 +106,23 @@ 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)
|
||||
return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
|
||||
return FileSys::ResultInvalidArchiveHandle;
|
||||
|
||||
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) {
|
||||
ArchiveBackend* src_archive = GetArchive(src_archive_handle);
|
||||
ArchiveBackend* dest_archive = GetArchive(dest_archive_handle);
|
||||
if (src_archive == nullptr || dest_archive == nullptr)
|
||||
return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
|
||||
return FileSys::ResultInvalidArchiveHandle;
|
||||
|
||||
if (src_archive == dest_archive) {
|
||||
return src_archive->RenameFile(src_path, dest_path);
|
||||
@ -132,50 +132,50 @@ 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)
|
||||
return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
|
||||
return FileSys::ResultInvalidArchiveHandle;
|
||||
|
||||
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)
|
||||
return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
|
||||
return FileSys::ResultInvalidArchiveHandle;
|
||||
|
||||
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;
|
||||
return FileSys::ResultInvalidArchiveHandle;
|
||||
|
||||
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)
|
||||
return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
|
||||
return FileSys::ResultInvalidArchiveHandle;
|
||||
|
||||
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) {
|
||||
ArchiveBackend* src_archive = GetArchive(src_archive_handle);
|
||||
ArchiveBackend* dest_archive = GetArchive(dest_archive_handle);
|
||||
if (src_archive == nullptr || dest_archive == nullptr)
|
||||
return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
|
||||
return FileSys::ResultInvalidArchiveHandle;
|
||||
|
||||
if (src_archive == dest_archive) {
|
||||
return src_archive->RenameDirectory(src_path, dest_path);
|
||||
@ -189,7 +189,7 @@ ResultVal<std::shared_ptr<Directory>> ArchiveManager::OpenDirectoryFromArchive(
|
||||
ArchiveHandle archive_handle, const FileSys::Path& path) {
|
||||
ArchiveBackend* archive = GetArchive(archive_handle);
|
||||
if (archive == nullptr) {
|
||||
return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
|
||||
return FileSys::ResultInvalidArchiveHandle;
|
||||
}
|
||||
|
||||
auto backend = archive->OpenDirectory(path);
|
||||
@ -203,12 +203,12 @@ ResultVal<std::shared_ptr<Directory>> ArchiveManager::OpenDirectoryFromArchive(
|
||||
ResultVal<u64> ArchiveManager::GetFreeBytesInArchive(ArchiveHandle archive_handle) {
|
||||
const ArchiveBackend* archive = GetArchive(archive_handle);
|
||||
if (archive == nullptr) {
|
||||
return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
|
||||
return FileSys::ResultInvalidArchiveHandle;
|
||||
}
|
||||
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,16 +246,16 @@ 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;
|
||||
}
|
||||
|
||||
ext_savedata->WriteIcon(path, smdh_icon);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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 ResultUnknown; // 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_SUCCESS;
|
||||
return ResultUnknown; // TODO(Subv): Find the right error code
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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 ResultUnknown; // TODO(Subv): Find the right error code
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
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,10 +301,10 @@ 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 ResultUnknown; // TODO(Subv): Find the right error code
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultVal<ArchiveResource> ArchiveManager::GetArchiveResource(MediaType media_type) const {
|
||||
|
@ -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
|
||||
|
@ -51,7 +51,7 @@ void Directory::Read(Kernel::HLERequestContext& ctx) {
|
||||
buffer.Write(entries.data(), 0, read * sizeof(FileSys::Entry));
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(read);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
}
|
||||
@ -62,7 +62,7 @@ void Directory::Close(Kernel::HLERequestContext& ctx) {
|
||||
backend->Close();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
} // namespace Service::FS
|
||||
|
@ -86,7 +86,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push<u32>(0);
|
||||
} else {
|
||||
buffer.Write(*data, 0, *read);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(static_cast<u32>(*read));
|
||||
}
|
||||
rb.PushMappedBuffer(buffer);
|
||||
@ -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;
|
||||
@ -130,7 +130,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
|
||||
async_data->ret = read.Code();
|
||||
async_data->read_size = 0;
|
||||
} else {
|
||||
async_data->ret = RESULT_SUCCESS;
|
||||
async_data->ret = ResultSuccess;
|
||||
async_data->read_size = *read;
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push<u32>(0);
|
||||
} else {
|
||||
async_data->buffer->Write(*async_data->data, 0, async_data->read_size);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(static_cast<u32>(async_data->read_size));
|
||||
}
|
||||
rb.PushMappedBuffer(*async_data->buffer);
|
||||
@ -180,7 +180,7 @@ void File::Write(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
// Subfiles can not be written to
|
||||
if (file->subfile) {
|
||||
rb.Push(FileSys::ERROR_UNSUPPORTED_OPEN_FLAGS);
|
||||
rb.Push(FileSys::ResultUnsupportedOpenFlags);
|
||||
rb.Push<u32>(0);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
return;
|
||||
@ -197,7 +197,7 @@ void File::Write(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(written.Code());
|
||||
rb.Push<u32>(0);
|
||||
} else {
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(static_cast<u32>(*written));
|
||||
}
|
||||
rb.PushMappedBuffer(buffer);
|
||||
@ -209,7 +209,7 @@ void File::GetSize(Kernel::HLERequestContext& ctx) {
|
||||
const FileSessionSlot* file = GetSessionData(ctx.Session());
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u64>(file->size);
|
||||
}
|
||||
|
||||
@ -223,13 +223,13 @@ void File::SetSize(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
// SetSize can not be called on subfiles.
|
||||
if (file->subfile) {
|
||||
rb.Push(FileSys::ERROR_UNSUPPORTED_OPEN_FLAGS);
|
||||
rb.Push(FileSys::ResultUnsupportedOpenFlags);
|
||||
return;
|
||||
}
|
||||
|
||||
file->size = size;
|
||||
backend->SetSize(size);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void File::Close(Kernel::HLERequestContext& ctx) {
|
||||
@ -242,7 +242,7 @@ void File::Close(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
backend->Close();
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void File::Flush(Kernel::HLERequestContext& ctx) {
|
||||
@ -254,12 +254,12 @@ void File::Flush(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
// Subfiles can not be flushed.
|
||||
if (file->subfile) {
|
||||
rb.Push(FileSys::ERROR_UNSUPPORTED_OPEN_FLAGS);
|
||||
rb.Push(FileSys::ResultUnsupportedOpenFlags);
|
||||
return;
|
||||
}
|
||||
|
||||
backend->Flush();
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void File::SetPriority(Kernel::HLERequestContext& ctx) {
|
||||
@ -269,7 +269,7 @@ void File::SetPriority(Kernel::HLERequestContext& ctx) {
|
||||
file->priority = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void File::GetPriority(Kernel::HLERequestContext& ctx) {
|
||||
@ -277,7 +277,7 @@ void File::GetPriority(Kernel::HLERequestContext& ctx) {
|
||||
const FileSessionSlot* file = GetSessionData(ctx.Session());
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(file->priority);
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ void File::OpenLinkFile(Kernel::HLERequestContext& ctx) {
|
||||
slot->size = backend->GetSize();
|
||||
slot->subfile = false;
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMoveObjects(client);
|
||||
}
|
||||
|
||||
@ -313,21 +313,21 @@ void File::OpenSubFile(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
if (original_file->subfile) {
|
||||
// OpenSubFile can not be called on a file which is already as subfile
|
||||
rb.Push(FileSys::ERROR_UNSUPPORTED_OPEN_FLAGS);
|
||||
rb.Push(FileSys::ResultUnsupportedOpenFlags);
|
||||
return;
|
||||
}
|
||||
|
||||
if (offset < 0 || size < 0) {
|
||||
rb.Push(FileSys::ERR_WRITE_BEYOND_END);
|
||||
rb.Push(FileSys::ResultWriteBeyondEnd);
|
||||
return;
|
||||
}
|
||||
|
||||
std::size_t end = offset + size;
|
||||
|
||||
// TODO(Subv): Check for overflow and return ERR_WRITE_BEYOND_END
|
||||
// TODO(Subv): Check for overflow and return ResultWriteBeyondEnd
|
||||
|
||||
if (end > original_file->size) {
|
||||
rb.Push(FileSys::ERR_WRITE_BEYOND_END);
|
||||
rb.Push(FileSys::ResultWriteBeyondEnd);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -342,7 +342,7 @@ void File::OpenSubFile(Kernel::HLERequestContext& ctx) {
|
||||
slot->size = size;
|
||||
slot->subfile = true;
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMoveObjects(client);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ void FS_USER::Initialize(Kernel::HLERequestContext& ctx) {
|
||||
slot->program_id = system.Kernel().GetProcessById(pid)->codeset->program_id;
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void FS_USER::OpenFile(Kernel::HLERequestContext& ctx) {
|
||||
@ -349,7 +349,7 @@ void FS_USER::ControlArchive(Kernel::HLERequestContext& ctx) {
|
||||
archive_handle, action, input_size, output_size);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void FS_USER::CloseArchive(Kernel::HLERequestContext& ctx) {
|
||||
@ -363,14 +363,14 @@ void FS_USER::CloseArchive(Kernel::HLERequestContext& ctx) {
|
||||
void FS_USER::IsSdmcDetected(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(Settings::values.use_virtual_sd.GetValue());
|
||||
}
|
||||
|
||||
void FS_USER::IsSdmcWriteable(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
// If the SD isn't enabled, it can't be writeable...else, stubbed true
|
||||
rb.Push(Settings::values.use_virtual_sd.GetValue());
|
||||
LOG_DEBUG(Service_FS, " (STUBBED)");
|
||||
@ -398,7 +398,7 @@ void FS_USER::FormatSaveData(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
if (archive_id != FS::ArchiveIdCode::SaveData) {
|
||||
LOG_ERROR(Service_FS, "tried to format an archive different than SaveData, {}", archive_id);
|
||||
rb.Push(FileSys::ERROR_INVALID_PATH);
|
||||
rb.Push(FileSys::ResultInvalidPath);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -471,7 +471,7 @@ void FS_USER::GetSdmcArchiveResource(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(*resource);
|
||||
}
|
||||
|
||||
@ -488,7 +488,7 @@ void FS_USER::GetNandArchiveResource(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(*resource);
|
||||
}
|
||||
|
||||
@ -544,7 +544,7 @@ void FS_USER::DeleteExtSaveData(Kernel::HLERequestContext& ctx) {
|
||||
void FS_USER::CardSlotIsInserted(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(false);
|
||||
LOG_WARNING(Service_FS, "(STUBBED) called");
|
||||
}
|
||||
@ -614,7 +614,7 @@ void FS_USER::InitializeWithSdkVersion(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_FS, "(STUBBED) called, version: 0x{:08X}", version);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void FS_USER::SetPriority(Kernel::HLERequestContext& ctx) {
|
||||
@ -623,7 +623,7 @@ void FS_USER::SetPriority(Kernel::HLERequestContext& ctx) {
|
||||
priority = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_DEBUG(Service_FS, "called priority=0x{:X}", priority);
|
||||
}
|
||||
@ -636,7 +636,7 @@ void FS_USER::GetPriority(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(priority);
|
||||
|
||||
LOG_DEBUG(Service_FS, "called priority=0x{:X}", priority);
|
||||
@ -656,7 +656,7 @@ void FS_USER::GetArchiveResource(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(*resource);
|
||||
}
|
||||
|
||||
@ -699,12 +699,12 @@ 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;
|
||||
}
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<ProductInfo>(product_info.value());
|
||||
}
|
||||
|
||||
@ -737,7 +737,7 @@ void FS_USER::GetProgramLaunchInfo(Kernel::HLERequestContext& ctx) {
|
||||
program_info.media_type = MediaType::SDMC;
|
||||
}
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<ProgramInfo>(program_info);
|
||||
}
|
||||
|
||||
@ -801,7 +801,7 @@ void FS_USER::GetSpecialContentIndex(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
if (index.Succeeded()) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(index.Unwrap());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
@ -812,7 +812,7 @@ void FS_USER::GetSpecialContentIndex(Kernel::HLERequestContext& ctx) {
|
||||
void FS_USER::GetNumSeeds(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(FileSys::GetSeedCount());
|
||||
}
|
||||
|
||||
@ -822,7 +822,7 @@ void FS_USER::AddSeed(Kernel::HLERequestContext& ctx) {
|
||||
FileSys::Seed::Data seed{rp.PopRaw<FileSys::Seed::Data>()};
|
||||
FileSys::AddSeed({title_id, seed, {}});
|
||||
IPC::RequestBuilder rb{rp.MakeBuilder(1, 0)};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void FS_USER::ObsoletedSetSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
|
||||
@ -841,7 +841,7 @@ void FS_USER::ObsoletedSetSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void FS_USER::ObsoletedGetSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
|
||||
@ -857,7 +857,7 @@ void FS_USER::ObsoletedGetSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(4, 0);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
// TODO: Implement Secure Value Lookup & Generation
|
||||
|
||||
@ -877,7 +877,7 @@ void FS_USER::SetThisSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void FS_USER::GetThisSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
|
||||
@ -888,7 +888,7 @@ void FS_USER::GetThisSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
// TODO: Implement Secure Value Lookup & Generation
|
||||
|
||||
@ -913,7 +913,7 @@ void FS_USER::SetSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void FS_USER::GetSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
|
||||
@ -926,7 +926,7 @@ void FS_USER::GetSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
// TODO: Implement Secure Value Lookup & Generation
|
||||
|
||||
@ -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 ResultUnknown;
|
||||
}
|
||||
|
||||
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 ResultUnknown;
|
||||
}
|
||||
|
||||
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 ResultUnknown;
|
||||
}
|
||||
|
||||
// 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 ResultUnknown;
|
||||
}
|
||||
|
||||
FS_USER::FS_USER(Core::System& system)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user