code: Result constants are lower case

This commit is contained in:
GPUCode
2023-12-12 00:13:23 +02:00
parent 3ae8431aef
commit 475c01e053
85 changed files with 1400 additions and 1404 deletions

View File

@ -49,7 +49,7 @@ QString IPCRecorderWidget::GetStatusStr(const IPCDebugger::RequestRecord& record
case IPCDebugger::RequestStatus::Handling: case IPCDebugger::RequestStatus::Handling:
return tr("Handling"); return tr("Handling");
case IPCDebugger::RequestStatus::Handled: 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("Success");
} }
return tr("Error"); return tr("Error");
@ -88,7 +88,7 @@ void IPCRecorderWidget::OnEntryUpdated(IPCDebugger::RequestRecord record) {
if (record.status == IPCDebugger::RequestStatus::HLEUnimplemented || if (record.status == IPCDebugger::RequestStatus::HLEUnimplemented ||
(record.status == IPCDebugger::RequestStatus::Handled && (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); auto item = ui->main->invisibleRootItem()->child(row_id);
for (int column = 0; column < item->columnCount(); ++column) { for (int column = 0; column < item->columnCount(); ++column) {

View File

@ -40,7 +40,7 @@ public:
ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush, ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
const u8* buffer) override { const u8* buffer) override {
if (offset > size) { if (offset > size) {
return ERR_WRITE_BEYOND_END; return ResultWriteBeyondEnd;
} else if (offset == size) { } else if (offset == size) {
return 0ULL; return 0ULL;
} }
@ -108,17 +108,17 @@ public:
if (!path_parser.IsValid()) { if (!path_parser.IsValid()) {
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr()); LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
if (mode.hex == 0) { if (mode.hex == 0) {
LOG_ERROR(Service_FS, "Empty open mode"); LOG_ERROR(Service_FS, "Empty open mode");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
if (mode.create_flag) { if (mode.create_flag) {
LOG_ERROR(Service_FS, "Create flag is not supported"); 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); const auto full_path = path_parser.BuildHostPath(mount_point);
@ -126,17 +126,17 @@ public:
switch (path_parser.GetHostStatus(mount_point)) { switch (path_parser.GetHostStatus(mount_point)) {
case PathParser::InvalidMountPoint: case PathParser::InvalidMountPoint:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ERROR_FILE_NOT_FOUND; return ResultFileNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
LOG_ERROR(Service_FS, "Path not found {}", full_path); LOG_ERROR(Service_FS, "Path not found {}", full_path);
return ERROR_PATH_NOT_FOUND; return ResultPathNotFound;
case PathParser::FileInPath: case PathParser::FileInPath:
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
LOG_ERROR(Service_FS, "Unexpected file or directory in {}", full_path); LOG_ERROR(Service_FS, "Unexpected file or directory in {}", full_path);
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY; return ResultUnexpectedFileOrDirectory;
case PathParser::NotFound: case PathParser::NotFound:
LOG_ERROR(Service_FS, "{} not found", full_path); LOG_ERROR(Service_FS, "{} not found", full_path);
return ERROR_FILE_NOT_FOUND; return ResultFileNotFound;
case PathParser::FileFound: case PathParser::FileFound:
break; // Expected 'success' case break; // Expected 'success' case
} }
@ -144,7 +144,7 @@ public:
FileUtil::IOFile file(full_path, "r+b"); FileUtil::IOFile file(full_path, "r+b");
if (!file.IsOpen()) { if (!file.IsOpen()) {
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path); LOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path);
return ERROR_FILE_NOT_FOUND; return ResultFileNotFound;
} }
Mode rwmode; Mode rwmode;
@ -158,7 +158,7 @@ public:
Result CreateFile(const Path& path, u64 size) const override { Result CreateFile(const Path& path, u64 size) const override {
if (size == 0) { if (size == 0) {
LOG_ERROR(Service_FS, "Zero-size file is not supported"); LOG_ERROR(Service_FS, "Zero-size file is not supported");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
return SaveDataArchive::CreateFile(path, size); return SaveDataArchive::CreateFile(path, size);
} }
@ -250,9 +250,9 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_ExtSaveData::Open(cons
// TODO(Subv): Verify the archive behavior of SharedExtSaveData compared to ExtSaveData. // TODO(Subv): Verify the archive behavior of SharedExtSaveData compared to ExtSaveData.
// ExtSaveData seems to return FS_NotFound (120) when the archive doesn't exist. // ExtSaveData seems to return FS_NotFound (120) when the archive doesn't exist.
if (type != ExtSaveDataType::Shared) { if (type != ExtSaveDataType::Shared) {
return ERR_NOT_FOUND_INVALID_STATE; return ResultNotFoundInvalidState;
} else { } else {
return ERR_NOT_FORMATTED; return ResultNotFormatted;
} }
} }
std::unique_ptr<DelayGenerator> delay_generator = std::make_unique<ExtSaveDataDelayGenerator>(); std::unique_ptr<DelayGenerator> delay_generator = std::make_unique<ExtSaveDataDelayGenerator>();
@ -276,11 +276,11 @@ Result ArchiveFactory_ExtSaveData::Format(const Path& path,
if (!file.IsOpen()) { if (!file.IsOpen()) {
// TODO(Subv): Find the correct error code // TODO(Subv): Find the correct error code
return RESULT_UNKNOWN; return ResultUnknown;
} }
file.WriteBytes(&format_info, sizeof(format_info)); file.WriteBytes(&format_info, sizeof(format_info));
return RESULT_SUCCESS; return ResultSuccess;
} }
ResultVal<ArchiveFormatInfo> ArchiveFactory_ExtSaveData::GetFormatInfo(const Path& path, ResultVal<ArchiveFormatInfo> ArchiveFactory_ExtSaveData::GetFormatInfo(const Path& path,
@ -291,7 +291,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_ExtSaveData::GetFormatInfo(const Pat
if (!file.IsOpen()) { if (!file.IsOpen()) {
LOG_ERROR(Service_FS, "Could not open metadata information for archive"); LOG_ERROR(Service_FS, "Could not open metadata information for archive");
// TODO(Subv): Verify error code // TODO(Subv): Verify error code
return ERR_NOT_FORMATTED; return ResultNotFormatted;
} }
ArchiveFormatInfo info = {}; ArchiveFormatInfo info = {};

View File

@ -73,13 +73,13 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
const Mode& mode) const { const Mode& mode) const {
if (path.GetType() != LowPathType::Binary) { if (path.GetType() != LowPathType::Binary) {
LOG_ERROR(Service_FS, "Path need to be Binary"); LOG_ERROR(Service_FS, "Path need to be Binary");
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
std::vector<u8> binary = path.AsBinary(); std::vector<u8> binary = path.AsBinary();
if (binary.size() != sizeof(NCCHFilePath)) { if (binary.size() != sizeof(NCCHFilePath)) {
LOG_ERROR(Service_FS, "Wrong path size {}", binary.size()); LOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
NCCHFilePath openfile_path; NCCHFilePath openfile_path;
@ -174,7 +174,7 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
return std::make_unique<IVFCFileInMemory>(std::move(archive_data), romfs_offset, return std::make_unique<IVFCFileInMemory>(std::move(archive_data), romfs_offset,
romfs_size, std::move(delay_generator)); romfs_size, std::move(delay_generator));
} }
return ERROR_NOT_FOUND; return ResultNotFound;
} }
return file; return file;
@ -190,21 +190,21 @@ Result NCCHArchive::DeleteFile(const Path& path) const {
Result 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()); LOG_CRITICAL(Service_FS, "Attempted to rename a file within an NCCH archive ({}).", GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return RESULT_UNKNOWN; return ResultUnknown;
} }
Result 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 ({}).", LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an NCCH archive ({}).",
GetName()); GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return RESULT_UNKNOWN; return ResultUnknown;
} }
Result 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 ({}).", LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an NCCH archive ({}).",
GetName()); GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return RESULT_UNKNOWN; return ResultUnknown;
} }
Result NCCHArchive::CreateFile(const Path& path, u64 size) const { Result NCCHArchive::CreateFile(const Path& path, u64 size) const {
@ -217,20 +217,20 @@ Result NCCHArchive::CreateFile(const Path& path, u64 size) const {
Result 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()); LOG_CRITICAL(Service_FS, "Attempted to create a directory in an NCCH archive ({}).", GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return RESULT_UNKNOWN; return ResultUnknown;
} }
Result 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()); LOG_CRITICAL(Service_FS, "Attempted to rename a file within an NCCH archive ({}).", GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return RESULT_UNKNOWN; return ResultUnknown;
} }
ResultVal<std::unique_ptr<DirectoryBackend>> NCCHArchive::OpenDirectory(const Path& path) const { ResultVal<std::unique_ptr<DirectoryBackend>> NCCHArchive::OpenDirectory(const Path& path) const {
LOG_CRITICAL(Service_FS, "Attempted to open a directory within an NCCH archive ({}).", LOG_CRITICAL(Service_FS, "Attempted to open a directory within an NCCH archive ({}).",
GetName().c_str()); GetName().c_str());
// TODO(shinyquagsire23): Use correct error code // TODO(shinyquagsire23): Use correct error code
return RESULT_UNKNOWN; return ResultUnknown;
} }
u64 NCCHArchive::GetFreeBytes() const { u64 NCCHArchive::GetFreeBytes() const {
@ -276,13 +276,13 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path&
u64 program_id) { u64 program_id) {
if (path.GetType() != LowPathType::Binary) { if (path.GetType() != LowPathType::Binary) {
LOG_ERROR(Service_FS, "Path need to be Binary"); LOG_ERROR(Service_FS, "Path need to be Binary");
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
std::vector<u8> binary = path.AsBinary(); std::vector<u8> binary = path.AsBinary();
if (binary.size() != sizeof(NCCHArchivePath)) { if (binary.size() != sizeof(NCCHArchivePath)) {
LOG_ERROR(Service_FS, "Wrong path size {}", binary.size()); LOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
NCCHArchivePath open_path; NCCHArchivePath open_path;
@ -304,7 +304,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_NCCH::GetFormatInfo(const Path& path
u64 program_id) const { u64 program_id) const {
// TODO(Subv): Implement // TODO(Subv): Implement
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName()); LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
return RESULT_UNKNOWN; return ResultUnknown;
} }
} // namespace FileSys } // namespace FileSys

View File

@ -25,14 +25,14 @@ template <typename T>
ResultVal<std::tuple<MediaType, u64>> ParsePath(const Path& path, T program_id_reader) { ResultVal<std::tuple<MediaType, u64>> ParsePath(const Path& path, T program_id_reader) {
if (path.GetType() != LowPathType::Binary) { if (path.GetType() != LowPathType::Binary) {
LOG_ERROR(Service_FS, "Wrong path type {}", path.GetType()); LOG_ERROR(Service_FS, "Wrong path type {}", path.GetType());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
std::vector<u8> vec_data = path.AsBinary(); std::vector<u8> vec_data = path.AsBinary();
if (vec_data.size() != 12) { if (vec_data.size() != 12) {
LOG_ERROR(Service_FS, "Wrong path length {}", vec_data.size()); 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()); 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); LOG_ERROR(Service_FS, "Unsupported media type {}", media_type);
// Note: this is strange, but the error code was verified with a real 3DS // 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)); return std::make_tuple(media_type, program_id_reader(data));
@ -72,7 +72,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_OtherSaveDataPermitted
if (media_type == MediaType::GameCard) { if (media_type == MediaType::GameCard) {
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard"); LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
return ERROR_GAMECARD_NOT_INSERTED; return ResultGamecardNotInserted;
} }
return sd_savedata_source->Open(program_id); return sd_savedata_source->Open(program_id);
@ -82,7 +82,7 @@ Result ArchiveFactory_OtherSaveDataPermitted::Format(const Path& path,
const FileSys::ArchiveFormatInfo& format_info, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) { u64 program_id) {
LOG_ERROR(Service_FS, "Attempted to format a OtherSaveDataPermitted archive."); LOG_ERROR(Service_FS, "Attempted to format a OtherSaveDataPermitted archive.");
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
ResultVal<ArchiveFormatInfo> ArchiveFactory_OtherSaveDataPermitted::GetFormatInfo( ResultVal<ArchiveFormatInfo> ArchiveFactory_OtherSaveDataPermitted::GetFormatInfo(
@ -93,7 +93,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_OtherSaveDataPermitted::GetFormatInf
if (media_type == MediaType::GameCard) { if (media_type == MediaType::GameCard) {
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard"); LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
return ERROR_GAMECARD_NOT_INSERTED; return ResultGamecardNotInserted;
} }
return sd_savedata_source->GetFormatInfo(program_id); return sd_savedata_source->GetFormatInfo(program_id);
@ -111,7 +111,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_OtherSaveDataGeneral::
if (media_type == MediaType::GameCard) { if (media_type == MediaType::GameCard) {
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard"); LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
return ERROR_GAMECARD_NOT_INSERTED; return ResultGamecardNotInserted;
} }
return sd_savedata_source->Open(program_id); return sd_savedata_source->Open(program_id);
@ -126,7 +126,7 @@ Result ArchiveFactory_OtherSaveDataGeneral::Format(const Path& path,
if (media_type == MediaType::GameCard) { if (media_type == MediaType::GameCard) {
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type 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); return sd_savedata_source->Format(program_id, format_info);
@ -140,7 +140,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_OtherSaveDataGeneral::GetFormatInfo(
if (media_type == MediaType::GameCard) { if (media_type == MediaType::GameCard) {
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard"); LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
return ERROR_GAMECARD_NOT_INSERTED; return ResultGamecardNotInserted;
} }
return sd_savedata_source->GetFormatInfo(program_id); return sd_savedata_source->GetFormatInfo(program_id);

View File

@ -62,17 +62,17 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& pa
if (!path_parser.IsValid()) { if (!path_parser.IsValid()) {
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr()); LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
if (mode.hex == 0) { if (mode.hex == 0) {
LOG_ERROR(Service_FS, "Empty open mode"); LOG_ERROR(Service_FS, "Empty open mode");
return ERROR_INVALID_OPEN_FLAGS; return ResultInvalidOpenFlags;
} }
if (mode.create_flag && !mode.write_flag) { if (mode.create_flag && !mode.write_flag) {
LOG_ERROR(Service_FS, "Create flag set but write flag not set"); 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); 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)) { switch (path_parser.GetHostStatus(mount_point)) {
case PathParser::InvalidMountPoint: case PathParser::InvalidMountPoint:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ERROR_NOT_FOUND; return ResultNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
case PathParser::FileInPath: case PathParser::FileInPath:
LOG_ERROR(Service_FS, "Path not found {}", full_path); LOG_ERROR(Service_FS, "Path not found {}", full_path);
return ERROR_NOT_FOUND; return ResultNotFound;
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
LOG_ERROR(Service_FS, "{} is not a file", full_path); LOG_ERROR(Service_FS, "{} is not a file", full_path);
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC; return ResultUnexpectedFileOrDirectorySdmc;
case PathParser::NotFound: case PathParser::NotFound:
if (!mode.create_flag) { if (!mode.create_flag) {
LOG_ERROR(Service_FS, "Non-existing file {} can't be open without mode create.", LOG_ERROR(Service_FS, "Non-existing file {} can't be open without mode create.",
full_path); full_path);
return ERROR_NOT_FOUND; return ResultNotFound;
} else { } else {
// Create the file // Create the file
FileUtil::CreateEmptyFile(full_path); FileUtil::CreateEmptyFile(full_path);
@ -105,7 +105,7 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& pa
FileUtil::IOFile file(full_path, mode.write_flag ? "r+b" : "rb"); FileUtil::IOFile file(full_path, mode.write_flag ? "r+b" : "rb");
if (!file.IsOpen()) { if (!file.IsOpen()) {
LOG_CRITICAL(Service_FS, "Error opening {}: {}", full_path, Common::GetLastErrorMsg()); 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>(); std::unique_ptr<DelayGenerator> delay_generator = std::make_unique<SDMCDelayGenerator>();
@ -117,7 +117,7 @@ Result SDMCArchive::DeleteFile(const Path& path) const {
if (!path_parser.IsValid()) { if (!path_parser.IsValid()) {
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr()); LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
const auto full_path = path_parser.BuildHostPath(mount_point); const auto full_path = path_parser.BuildHostPath(mount_point);
@ -125,25 +125,25 @@ Result SDMCArchive::DeleteFile(const Path& path) const {
switch (path_parser.GetHostStatus(mount_point)) { switch (path_parser.GetHostStatus(mount_point)) {
case PathParser::InvalidMountPoint: case PathParser::InvalidMountPoint:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ERROR_NOT_FOUND; return ResultNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
case PathParser::FileInPath: case PathParser::FileInPath:
case PathParser::NotFound: case PathParser::NotFound:
LOG_DEBUG(Service_FS, "{} not found", full_path); LOG_DEBUG(Service_FS, "{} not found", full_path);
return ERROR_NOT_FOUND; return ResultNotFound;
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
LOG_ERROR(Service_FS, "{} is not a file", full_path); LOG_ERROR(Service_FS, "{} is not a file", full_path);
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC; return ResultUnexpectedFileOrDirectorySdmc;
case PathParser::FileFound: case PathParser::FileFound:
break; // Expected 'success' case break; // Expected 'success' case
} }
if (FileUtil::Delete(full_path)) { if (FileUtil::Delete(full_path)) {
return RESULT_SUCCESS; return ResultSuccess;
} }
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting {}", full_path); LOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting {}", full_path);
return ERROR_NOT_FOUND; return ResultNotFound;
} }
Result SDMCArchive::RenameFile(const Path& src_path, const Path& dest_path) const { Result SDMCArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
@ -152,21 +152,21 @@ Result SDMCArchive::RenameFile(const Path& src_path, const Path& dest_path) cons
// TODO: Verify these return codes with HW // TODO: Verify these return codes with HW
if (!path_parser_src.IsValid()) { if (!path_parser_src.IsValid()) {
LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr()); LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
const PathParser path_parser_dest(dest_path); const PathParser path_parser_dest(dest_path);
if (!path_parser_dest.IsValid()) { if (!path_parser_dest.IsValid()) {
LOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr()); 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 src_path_full = path_parser_src.BuildHostPath(mount_point);
const auto dest_path_full = path_parser_dest.BuildHostPath(mount_point); const auto dest_path_full = path_parser_dest.BuildHostPath(mount_point);
if (FileUtil::Rename(src_path_full, dest_path_full)) { 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 // TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't
@ -181,36 +181,36 @@ static Result DeleteDirectoryHelper(const Path& path, const std::string& mount_p
if (!path_parser.IsValid()) { if (!path_parser.IsValid()) {
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr()); LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
if (path_parser.IsRootDirectory()) if (path_parser.IsRootDirectory())
return ERROR_NOT_FOUND; return ResultNotFound;
const auto full_path = path_parser.BuildHostPath(mount_point); const auto full_path = path_parser.BuildHostPath(mount_point);
switch (path_parser.GetHostStatus(mount_point)) { switch (path_parser.GetHostStatus(mount_point)) {
case PathParser::InvalidMountPoint: case PathParser::InvalidMountPoint:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ERROR_NOT_FOUND; return ResultNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
case PathParser::NotFound: case PathParser::NotFound:
LOG_ERROR(Service_FS, "Path not found {}", full_path); LOG_ERROR(Service_FS, "Path not found {}", full_path);
return ERROR_NOT_FOUND; return ResultNotFound;
case PathParser::FileInPath: case PathParser::FileInPath:
case PathParser::FileFound: case PathParser::FileFound:
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path); LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC; return ResultUnexpectedFileOrDirectorySdmc;
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
break; // Expected 'success' case break; // Expected 'success' case
} }
if (deleter(full_path)) { if (deleter(full_path)) {
return RESULT_SUCCESS; return ResultSuccess;
} }
LOG_ERROR(Service_FS, "Directory not empty {}", full_path); LOG_ERROR(Service_FS, "Directory not empty {}", full_path);
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC; return ResultUnexpectedFileOrDirectorySdmc;
} }
Result SDMCArchive::DeleteDirectory(const Path& path) const { Result SDMCArchive::DeleteDirectory(const Path& path) const {
@ -227,7 +227,7 @@ Result SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const {
if (!path_parser.IsValid()) { if (!path_parser.IsValid()) {
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr()); LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
const auto full_path = path_parser.BuildHostPath(mount_point); const auto full_path = path_parser.BuildHostPath(mount_point);
@ -235,31 +235,31 @@ Result SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const {
switch (path_parser.GetHostStatus(mount_point)) { switch (path_parser.GetHostStatus(mount_point)) {
case PathParser::InvalidMountPoint: case PathParser::InvalidMountPoint:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ERROR_NOT_FOUND; return ResultNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
case PathParser::FileInPath: case PathParser::FileInPath:
LOG_ERROR(Service_FS, "Path not found {}", full_path); LOG_ERROR(Service_FS, "Path not found {}", full_path);
return ERROR_NOT_FOUND; return ResultNotFound;
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
LOG_ERROR(Service_FS, "{} already exists", full_path); LOG_ERROR(Service_FS, "{} already exists", full_path);
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC; return ResultUnexpectedFileOrDirectorySdmc;
case PathParser::FileFound: case PathParser::FileFound:
LOG_ERROR(Service_FS, "{} already exists", full_path); LOG_ERROR(Service_FS, "{} already exists", full_path);
return ERROR_ALREADY_EXISTS; return ResultAlreadyExists;
case PathParser::NotFound: case PathParser::NotFound:
break; // Expected 'success' case break; // Expected 'success' case
} }
if (size == 0) { if (size == 0) {
FileUtil::CreateEmptyFile(full_path); FileUtil::CreateEmptyFile(full_path);
return RESULT_SUCCESS; return ResultSuccess;
} }
FileUtil::IOFile file(full_path, "wb"); FileUtil::IOFile file(full_path, "wb");
// Creates a sparse file (or a normal file on filesystems without the concept of sparse files) // 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. // 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) { if (file.Seek(size - 1, SEEK_SET) && file.WriteBytes("", 1) == 1) {
return RESULT_SUCCESS; return ResultSuccess;
} }
LOG_ERROR(Service_FS, "Too large file"); LOG_ERROR(Service_FS, "Too large file");
@ -272,7 +272,7 @@ Result SDMCArchive::CreateDirectory(const Path& path) const {
if (!path_parser.IsValid()) { if (!path_parser.IsValid()) {
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr()); LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
const auto full_path = path_parser.BuildHostPath(mount_point); const auto full_path = path_parser.BuildHostPath(mount_point);
@ -280,21 +280,21 @@ Result SDMCArchive::CreateDirectory(const Path& path) const {
switch (path_parser.GetHostStatus(mount_point)) { switch (path_parser.GetHostStatus(mount_point)) {
case PathParser::InvalidMountPoint: case PathParser::InvalidMountPoint:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ERROR_NOT_FOUND; return ResultNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
case PathParser::FileInPath: case PathParser::FileInPath:
LOG_ERROR(Service_FS, "Path not found {}", full_path); LOG_ERROR(Service_FS, "Path not found {}", full_path);
return ERROR_NOT_FOUND; return ResultNotFound;
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
case PathParser::FileFound: case PathParser::FileFound:
LOG_DEBUG(Service_FS, "{} already exists", full_path); LOG_DEBUG(Service_FS, "{} already exists", full_path);
return ERROR_ALREADY_EXISTS; return ResultAlreadyExists;
case PathParser::NotFound: case PathParser::NotFound:
break; // Expected 'success' case break; // Expected 'success' case
} }
if (FileUtil::CreateDir(mount_point + path.AsString())) { if (FileUtil::CreateDir(mount_point + path.AsString())) {
return RESULT_SUCCESS; return ResultSuccess;
} }
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", mount_point);
@ -308,21 +308,21 @@ Result SDMCArchive::RenameDirectory(const Path& src_path, const Path& dest_path)
// TODO: Verify these return codes with HW // TODO: Verify these return codes with HW
if (!path_parser_src.IsValid()) { if (!path_parser_src.IsValid()) {
LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr()); LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
const PathParser path_parser_dest(dest_path); const PathParser path_parser_dest(dest_path);
if (!path_parser_dest.IsValid()) { if (!path_parser_dest.IsValid()) {
LOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr()); 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 src_path_full = path_parser_src.BuildHostPath(mount_point);
const auto dest_path_full = path_parser_dest.BuildHostPath(mount_point); const auto dest_path_full = path_parser_dest.BuildHostPath(mount_point);
if (FileUtil::Rename(src_path_full, dest_path_full)) { 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 // TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't
@ -336,7 +336,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SDMCArchive::OpenDirectory(const Pa
if (!path_parser.IsValid()) { if (!path_parser.IsValid()) {
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr()); LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
const auto full_path = path_parser.BuildHostPath(mount_point); const auto full_path = path_parser.BuildHostPath(mount_point);
@ -344,15 +344,15 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SDMCArchive::OpenDirectory(const Pa
switch (path_parser.GetHostStatus(mount_point)) { switch (path_parser.GetHostStatus(mount_point)) {
case PathParser::InvalidMountPoint: case PathParser::InvalidMountPoint:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ERROR_NOT_FOUND; return ResultNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
case PathParser::NotFound: case PathParser::NotFound:
case PathParser::FileFound: case PathParser::FileFound:
LOG_ERROR(Service_FS, "{} not found", full_path); LOG_ERROR(Service_FS, "{} not found", full_path);
return ERROR_NOT_FOUND; return ResultNotFound;
case PathParser::FileInPath: case PathParser::FileInPath:
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path); LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC; return ResultUnexpectedFileOrDirectorySdmc;
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
break; // Expected 'success' case break; // Expected 'success' case
} }
@ -394,14 +394,14 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SDMC::Open(const Path&
Result 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) { u64 program_id) {
// This is kind of an undesirable operation, so let's just ignore it. :) // 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, ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMC::GetFormatInfo(const Path& path,
u64 program_id) const { u64 program_id) const {
// TODO(Subv): Implement // TODO(Subv): Implement
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName()); LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
return RESULT_UNKNOWN; return ResultUnknown;
} }
} // namespace FileSys } // namespace FileSys

View File

@ -44,7 +44,7 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Pat
const Mode& mode) const { const Mode& mode) const {
if (mode.read_flag) { if (mode.read_flag) {
LOG_ERROR(Service_FS, "Read flag is not supported"); LOG_ERROR(Service_FS, "Read flag is not supported");
return ERROR_INVALID_READ_FLAG; return ResultInvalidReadFlag;
} }
return SDMCArchive::OpenFileBase(path, mode); 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( ResultVal<std::unique_ptr<DirectoryBackend>> SDMCWriteOnlyArchive::OpenDirectory(
const Path& path) const { const Path& path) const {
LOG_ERROR(Service_FS, "Not supported"); LOG_ERROR(Service_FS, "Not supported");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
ArchiveFactory_SDMCWriteOnly::ArchiveFactory_SDMCWriteOnly(const std::string& mount_point) ArchiveFactory_SDMCWriteOnly::ArchiveFactory_SDMCWriteOnly(const std::string& mount_point)
@ -86,14 +86,14 @@ Result ArchiveFactory_SDMCWriteOnly::Format(const Path& path,
u64 program_id) { u64 program_id) {
// TODO(wwylele): hwtest this // TODO(wwylele): hwtest this
LOG_ERROR(Service_FS, "Attempted to format a SDMC write-only archive."); 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, ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMCWriteOnly::GetFormatInfo(const Path& path,
u64 program_id) const { u64 program_id) const {
// TODO(Subv): Implement // TODO(Subv): Implement
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName()); LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
return RESULT_UNKNOWN; return ResultUnknown;
} }
} // namespace FileSys } // namespace FileSys

View File

@ -39,12 +39,12 @@ public:
ResultVal<std::size_t> Read(u64 offset, std::size_t length, u8* buffer) const override { ResultVal<std::size_t> Read(u64 offset, std::size_t length, u8* buffer) const override {
if (offset != 0) { if (offset != 0) {
LOG_ERROR(Service_FS, "offset must be zero!"); LOG_ERROR(Service_FS, "offset must be zero!");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
if (length != data->size()) { if (length != data->size()) {
LOG_ERROR(Service_FS, "size must match the file 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()); 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, ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
const u8* buffer) override { const u8* buffer) override {
LOG_ERROR(Service_FS, "The file is read-only!"); LOG_ERROR(Service_FS, "The file is read-only!");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
u64 GetSize() const override { u64 GetSize() const override {
@ -99,13 +99,13 @@ public:
if (path.GetType() != LowPathType::Binary) { if (path.GetType() != LowPathType::Binary) {
LOG_ERROR(Service_FS, "Path need to be Binary"); LOG_ERROR(Service_FS, "Path need to be Binary");
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
std::vector<u8> binary = path.AsBinary(); std::vector<u8> binary = path.AsBinary();
if (binary.size() != sizeof(SelfNCCHFilePath)) { if (binary.size() != sizeof(SelfNCCHFilePath)) {
LOG_ERROR(Service_FS, "Wrong path size {}", binary.size()); LOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
SelfNCCHFilePath file_path; SelfNCCHFilePath file_path;
@ -120,7 +120,7 @@ public:
case SelfNCCHFilePathType::Code: case SelfNCCHFilePathType::Code:
LOG_ERROR(Service_FS, "Reading the code section is not supported!"); LOG_ERROR(Service_FS, "Reading the code section is not supported!");
return ERROR_COMMAND_NOT_ALLOWED; return ResultCommandNotAllowed;
case SelfNCCHFilePathType::ExeFS: { case SelfNCCHFilePathType::ExeFS: {
const auto& raw = file_path.exefs_filename; const auto& raw = file_path.exefs_filename;
@ -130,48 +130,48 @@ public:
} }
default: default:
LOG_ERROR(Service_FS, "Unknown file type {}!", file_path.type); LOG_ERROR(Service_FS, "Unknown file type {}!", file_path.type);
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
} }
Result DeleteFile(const Path& path) const override { Result DeleteFile(const Path& path) const override {
LOG_ERROR(Service_FS, "Unsupported"); LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
Result 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"); LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
Result DeleteDirectory(const Path& path) const override { Result DeleteDirectory(const Path& path) const override {
LOG_ERROR(Service_FS, "Unsupported"); LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
Result DeleteDirectoryRecursively(const Path& path) const override { Result DeleteDirectoryRecursively(const Path& path) const override {
LOG_ERROR(Service_FS, "Unsupported"); LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
Result CreateFile(const Path& path, u64 size) const override { Result CreateFile(const Path& path, u64 size) const override {
LOG_ERROR(Service_FS, "Unsupported"); LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
Result CreateDirectory(const Path& path) const override { Result CreateDirectory(const Path& path) const override {
LOG_ERROR(Service_FS, "Unsupported"); LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
Result 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"); LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override { ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override {
LOG_ERROR(Service_FS, "Unsupported"); LOG_ERROR(Service_FS, "Unsupported");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
u64 GetFreeBytes() const override { u64 GetFreeBytes() const override {
@ -186,7 +186,7 @@ private:
return std::make_unique<IVFCFile>(ncch_data.romfs_file, std::move(delay_generator)); return std::make_unique<IVFCFile>(ncch_data.romfs_file, std::move(delay_generator));
} else { } else {
LOG_INFO(Service_FS, "Unable to read RomFS"); LOG_INFO(Service_FS, "Unable to read RomFS");
return ERROR_ROMFS_NOT_FOUND; return ResultRomfsNotFound;
} }
} }
@ -198,7 +198,7 @@ private:
std::move(delay_generator)); std::move(delay_generator));
} else { } else {
LOG_INFO(Service_FS, "Unable to read update RomFS"); 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"); LOG_WARNING(Service_FS, "Unable to read icon");
return ERROR_EXEFS_SECTION_NOT_FOUND; return ResultExefsSectionNotFound;
} }
if (filename == "logo") { if (filename == "logo") {
@ -218,7 +218,7 @@ private:
} }
LOG_WARNING(Service_FS, "Unable to read logo"); LOG_WARNING(Service_FS, "Unable to read logo");
return ERROR_EXEFS_SECTION_NOT_FOUND; return ResultExefsSectionNotFound;
} }
if (filename == "banner") { if (filename == "banner") {
@ -227,11 +227,11 @@ private:
} }
LOG_WARNING(Service_FS, "Unable to read banner"); LOG_WARNING(Service_FS, "Unable to read banner");
return ERROR_EXEFS_SECTION_NOT_FOUND; return ResultExefsSectionNotFound;
} }
LOG_ERROR(Service_FS, "Unknown ExeFS section {}!", filename); LOG_ERROR(Service_FS, "Unknown ExeFS section {}!", filename);
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
NCCHData ncch_data; NCCHData ncch_data;
@ -299,13 +299,13 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SelfNCCH::Open(const P
Result ArchiveFactory_SelfNCCH::Format(const Path&, const FileSys::ArchiveFormatInfo&, Result ArchiveFactory_SelfNCCH::Format(const Path&, const FileSys::ArchiveFormatInfo&,
u64 program_id) { u64 program_id) {
LOG_ERROR(Service_FS, "Attempted to format a SelfNCCH archive."); LOG_ERROR(Service_FS, "Attempted to format a SelfNCCH archive.");
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
ResultVal<ArchiveFormatInfo> ArchiveFactory_SelfNCCH::GetFormatInfo(const Path&, ResultVal<ArchiveFormatInfo> ArchiveFactory_SelfNCCH::GetFormatInfo(const Path&,
u64 program_id) const { u64 program_id) const {
LOG_ERROR(Service_FS, "Attempted to get format info of a SelfNCCH archive"); LOG_ERROR(Service_FS, "Attempted to get format info of a SelfNCCH archive");
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
} // namespace FileSys } // namespace FileSys

View File

@ -47,7 +47,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveSource_SDSaveData::Open(u64 pr
// save file/directory structure expected by the game has not yet been initialized. // 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 // Returning the NotFormatted error code will signal the game to provision the SaveData
// archive with the files and folders that it expects. // 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)); return std::make_unique<SaveDataArchive>(std::move(concrete_mount_point));
@ -65,9 +65,9 @@ Result ArchiveSource_SDSaveData::Format(u64 program_id,
if (file.IsOpen()) { if (file.IsOpen()) {
file.WriteBytes(&format_info, sizeof(format_info)); 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 { ResultVal<ArchiveFormatInfo> ArchiveSource_SDSaveData::GetFormatInfo(u64 program_id) const {
@ -77,7 +77,7 @@ ResultVal<ArchiveFormatInfo> ArchiveSource_SDSaveData::GetFormatInfo(u64 program
if (!file.IsOpen()) { if (!file.IsOpen()) {
LOG_ERROR(Service_FS, "Could not open metadata information for archive"); LOG_ERROR(Service_FS, "Could not open metadata information for archive");
// TODO(Subv): Verify error code // TODO(Subv): Verify error code
return ERR_NOT_FORMATTED; return ResultNotFormatted;
} }
ArchiveFormatInfo info = {}; ArchiveFormatInfo info = {};

View File

@ -57,7 +57,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SystemSaveData::Open(c
std::string fullpath = GetSystemSaveDataPath(base_path, path); std::string fullpath = GetSystemSaveDataPath(base_path, path);
if (!FileUtil::Exists(fullpath)) { if (!FileUtil::Exists(fullpath)) {
// TODO(Subv): Check error code, this one is probably wrong // TODO(Subv): Check error code, this one is probably wrong
return ERROR_NOT_FOUND; return ResultNotFound;
} }
return std::make_unique<SaveDataArchive>(fullpath); return std::make_unique<SaveDataArchive>(fullpath);
} }
@ -68,14 +68,14 @@ Result ArchiveFactory_SystemSaveData::Format(const Path& path,
std::string fullpath = GetSystemSaveDataPath(base_path, path); std::string fullpath = GetSystemSaveDataPath(base_path, path);
FileUtil::DeleteDirRecursively(fullpath); FileUtil::DeleteDirRecursively(fullpath);
FileUtil::CreateFullPath(fullpath); FileUtil::CreateFullPath(fullpath);
return RESULT_SUCCESS; return ResultSuccess;
} }
ResultVal<ArchiveFormatInfo> ArchiveFactory_SystemSaveData::GetFormatInfo(const Path& path, ResultVal<ArchiveFormatInfo> ArchiveFactory_SystemSaveData::GetFormatInfo(const Path& path,
u64 program_id) const { u64 program_id) const {
// TODO(Subv): Implement // TODO(Subv): Implement
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName()); LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
return RESULT_UNKNOWN; return ResultUnknown;
} }
} // namespace FileSys } // namespace FileSys

View File

@ -19,7 +19,7 @@ namespace FileSys {
ResultVal<std::size_t> DiskFile::Read(const u64 offset, const std::size_t length, ResultVal<std::size_t> DiskFile::Read(const u64 offset, const std::size_t length,
u8* buffer) const { u8* buffer) const {
if (!mode.read_flag) if (!mode.read_flag)
return ERROR_INVALID_OPEN_FLAGS; return ResultInvalidOpenFlags;
file->Seek(offset, SEEK_SET); file->Seek(offset, SEEK_SET);
return file->ReadBytes(buffer, length); 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, ResultVal<std::size_t> DiskFile::Write(const u64 offset, const std::size_t length, const bool flush,
const u8* buffer) { const u8* buffer) {
if (!mode.write_flag) if (!mode.write_flag)
return ERROR_INVALID_OPEN_FLAGS; return ResultInvalidOpenFlags;
file->Seek(offset, SEEK_SET); file->Seek(offset, SEEK_SET);
std::size_t written = file->WriteBytes(buffer, length); std::size_t written = file->WriteBytes(buffer, length);

View File

@ -35,61 +35,60 @@ enum {
}; };
} }
constexpr Result ERROR_INVALID_PATH(ErrCodes::InvalidPath, ErrorModule::FS, constexpr Result ResultInvalidPath(ErrCodes::InvalidPath, ErrorModule::FS,
ErrorSummary::InvalidArgument, ErrorLevel::Usage); ErrorSummary::InvalidArgument, ErrorLevel::Usage);
constexpr Result ERROR_UNSUPPORTED_OPEN_FLAGS(ErrCodes::UnsupportedOpenFlags, ErrorModule::FS, constexpr Result ResultUnsupportedOpenFlags(ErrCodes::UnsupportedOpenFlags, ErrorModule::FS,
ErrorSummary::NotSupported, ErrorLevel::Usage);
constexpr Result ResultInvalidOpenFlags(ErrCodes::InvalidOpenFlags, ErrorModule::FS,
ErrorSummary::Canceled, ErrorLevel::Status);
constexpr Result ResultInvalidReadFlag(ErrCodes::InvalidReadFlag, ErrorModule::FS,
ErrorSummary::InvalidArgument, ErrorLevel::Usage);
constexpr Result ResultFileNotFound(ErrCodes::FileNotFound, ErrorModule::FS, ErrorSummary::NotFound,
ErrorLevel::Status);
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 Result ResultUnexpectedFileOrDirectorySdmc(ErrCodes::NotAFile, ErrorModule::FS,
ErrorSummary::Canceled, ErrorLevel::Status);
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 Result ResultIncorrectExefsReadSize(ErrCodes::IncorrectExeFSReadSize, ErrorModule::FS,
ErrorSummary::NotSupported, ErrorLevel::Usage); ErrorSummary::NotSupported, ErrorLevel::Usage);
constexpr Result ERROR_INVALID_OPEN_FLAGS(ErrCodes::InvalidOpenFlags, ErrorModule::FS, constexpr Result ResultRomfsNotFound(ErrCodes::RomFSNotFound, ErrorModule::FS,
ErrorSummary::Canceled, ErrorLevel::Status); ErrorSummary::NotFound, ErrorLevel::Status);
constexpr Result ERROR_INVALID_READ_FLAG(ErrCodes::InvalidReadFlag, ErrorModule::FS, constexpr Result ResultCommandNotAllowed(ErrCodes::CommandNotAllowed, ErrorModule::FS,
ErrorSummary::InvalidArgument, ErrorLevel::Usage); ErrorSummary::WrongArgument, ErrorLevel::Permanent);
constexpr Result ERROR_FILE_NOT_FOUND(ErrCodes::FileNotFound, ErrorModule::FS, constexpr Result ResultExefsSectionNotFound(ErrCodes::ExeFSSectionNotFound, ErrorModule::FS,
ErrorSummary::NotFound, ErrorLevel::Status); ErrorSummary::NotFound, ErrorLevel::Status);
constexpr Result ERROR_PATH_NOT_FOUND(ErrCodes::PathNotFound, ErrorModule::FS, constexpr Result ResultInsufficientSpace(ErrCodes::InsufficientSpace, ErrorModule::FS,
ErrorSummary::NotFound, ErrorLevel::Status); ErrorSummary::OutOfResource, ErrorLevel::Status);
constexpr Result ERROR_NOT_FOUND(ErrCodes::NotFound, ErrorModule::FS, ErrorSummary::NotFound,
ErrorLevel::Status);
constexpr Result ERROR_UNEXPECTED_FILE_OR_DIRECTORY(ErrCodes::UnexpectedFileOrDirectory,
ErrorModule::FS, ErrorSummary::NotSupported,
ErrorLevel::Usage);
constexpr Result ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC(ErrCodes::NotAFile, ErrorModule::FS,
ErrorSummary::Canceled,
ErrorLevel::Status);
constexpr Result ERROR_DIRECTORY_ALREADY_EXISTS(ErrCodes::DirectoryAlreadyExists, ErrorModule::FS,
ErrorSummary::NothingHappened, ErrorLevel::Status);
constexpr Result ERROR_FILE_ALREADY_EXISTS(ErrCodes::FileAlreadyExists, ErrorModule::FS,
ErrorSummary::NothingHappened, ErrorLevel::Status);
constexpr Result ERROR_ALREADY_EXISTS(ErrCodes::AlreadyExists, ErrorModule::FS,
ErrorSummary::NothingHappened, ErrorLevel::Status);
constexpr Result ERROR_DIRECTORY_NOT_EMPTY(ErrCodes::DirectoryNotEmpty, ErrorModule::FS,
ErrorSummary::Canceled, ErrorLevel::Status);
constexpr Result ERROR_GAMECARD_NOT_INSERTED(ErrCodes::GameCardNotInserted, ErrorModule::FS,
ErrorSummary::NotFound, ErrorLevel::Status);
constexpr Result ERROR_INCORRECT_EXEFS_READ_SIZE(ErrCodes::IncorrectExeFSReadSize, ErrorModule::FS,
ErrorSummary::NotSupported, ErrorLevel::Usage);
constexpr Result ERROR_ROMFS_NOT_FOUND(ErrCodes::RomFSNotFound, ErrorModule::FS,
ErrorSummary::NotFound, ErrorLevel::Status);
constexpr Result ERROR_COMMAND_NOT_ALLOWED(ErrCodes::CommandNotAllowed, ErrorModule::FS,
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
constexpr Result ERROR_EXEFS_SECTION_NOT_FOUND(ErrCodes::ExeFSSectionNotFound, ErrorModule::FS,
ErrorSummary::NotFound, ErrorLevel::Status);
constexpr Result ERROR_INSUFFICIENT_SPACE(ErrCodes::InsufficientSpace, ErrorModule::FS,
ErrorSummary::OutOfResource, ErrorLevel::Status);
/// Returned when a function is passed an invalid archive handle. /// Returned when a function is passed an invalid archive handle.
constexpr Result ERR_INVALID_ARCHIVE_HANDLE(ErrCodes::ArchiveNotMounted, ErrorModule::FS, constexpr Result ResultInvalidArchiveHandle(ErrCodes::ArchiveNotMounted, ErrorModule::FS,
ErrorSummary::NotFound, ErrorSummary::NotFound,
ErrorLevel::Status); // 0xC8804465 ErrorLevel::Status); // 0xC8804465
constexpr Result ERR_WRITE_BEYOND_END(ErrCodes::WriteBeyondEnd, ErrorModule::FS, constexpr Result ResultWriteBeyondEnd(ErrCodes::WriteBeyondEnd, ErrorModule::FS,
ErrorSummary::InvalidArgument, ErrorLevel::Usage); 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. * correct or a bug.
*/ */
constexpr Result ERR_NOT_FOUND_INVALID_STATE(ErrCodes::NotFound, ErrorModule::FS, constexpr Result ResultNotFoundInvalidState(ErrCodes::NotFound, ErrorModule::FS,
ErrorSummary::InvalidState, ErrorLevel::Status); ErrorSummary::InvalidState, ErrorLevel::Status);
constexpr Result ERR_NOT_FORMATTED(ErrCodes::NotFormatted, ErrorModule::FS, constexpr Result ResultNotFormatted(ErrCodes::NotFormatted, ErrorModule::FS,
ErrorSummary::InvalidState, ErrorLevel::Status); ErrorSummary::InvalidState, ErrorLevel::Status);
} // namespace FileSys } // namespace FileSys

View File

@ -44,21 +44,21 @@ Result IVFCArchive::DeleteFile(const Path& path) const {
Result 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()); LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive ({}).", GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return RESULT_UNKNOWN; return ResultUnknown;
} }
Result 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 ({}).", LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive ({}).",
GetName()); GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return RESULT_UNKNOWN; return ResultUnknown;
} }
Result 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 ({}).", LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive ({}).",
GetName()); GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return RESULT_UNKNOWN; return ResultUnknown;
} }
Result IVFCArchive::CreateFile(const Path& path, u64 size) const { Result IVFCArchive::CreateFile(const Path& path, u64 size) const {
@ -71,13 +71,13 @@ Result IVFCArchive::CreateFile(const Path& path, u64 size) const {
Result 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()); LOG_CRITICAL(Service_FS, "Attempted to create a directory in an IVFC archive ({}).", GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return RESULT_UNKNOWN; return ResultUnknown;
} }
Result 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()); LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive ({}).", GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return RESULT_UNKNOWN; return ResultUnknown;
} }
ResultVal<std::unique_ptr<DirectoryBackend>> IVFCArchive::OpenDirectory(const Path& path) const { ResultVal<std::unique_ptr<DirectoryBackend>> IVFCArchive::OpenDirectory(const Path& path) const {

View File

@ -43,17 +43,17 @@ ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& pa
if (!path_parser.IsValid()) { if (!path_parser.IsValid()) {
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr()); LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
if (mode.hex == 0) { if (mode.hex == 0) {
LOG_ERROR(Service_FS, "Empty open mode"); LOG_ERROR(Service_FS, "Empty open mode");
return ERROR_UNSUPPORTED_OPEN_FLAGS; return ResultUnsupportedOpenFlags;
} }
if (mode.create_flag && !mode.write_flag) { if (mode.create_flag && !mode.write_flag) {
LOG_ERROR(Service_FS, "Create flag set but write flag not set"); 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); 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)) { switch (path_parser.GetHostStatus(mount_point)) {
case PathParser::InvalidMountPoint: case PathParser::InvalidMountPoint:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ERROR_FILE_NOT_FOUND; return ResultFileNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
LOG_ERROR(Service_FS, "Path not found {}", full_path); LOG_ERROR(Service_FS, "Path not found {}", full_path);
return ERROR_PATH_NOT_FOUND; return ResultPathNotFound;
case PathParser::FileInPath: case PathParser::FileInPath:
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
LOG_ERROR(Service_FS, "Unexpected file or directory in {}", full_path); LOG_ERROR(Service_FS, "Unexpected file or directory in {}", full_path);
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY; return ResultUnexpectedFileOrDirectory;
case PathParser::NotFound: case PathParser::NotFound:
if (!mode.create_flag) { if (!mode.create_flag) {
LOG_ERROR(Service_FS, "Non-existing file {} can't be open without mode create.", LOG_ERROR(Service_FS, "Non-existing file {} can't be open without mode create.",
full_path); full_path);
return ERROR_FILE_NOT_FOUND; return ResultFileNotFound;
} else { } else {
// Create the file // Create the file
FileUtil::CreateEmptyFile(full_path); FileUtil::CreateEmptyFile(full_path);
@ -86,7 +86,7 @@ ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& pa
FileUtil::IOFile file(full_path, mode.write_flag ? "r+b" : "rb"); FileUtil::IOFile file(full_path, mode.write_flag ? "r+b" : "rb");
if (!file.IsOpen()) { if (!file.IsOpen()) {
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path); 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>(); std::unique_ptr<DelayGenerator> delay_generator = std::make_unique<SaveDataDelayGenerator>();
@ -98,7 +98,7 @@ Result SaveDataArchive::DeleteFile(const Path& path) const {
if (!path_parser.IsValid()) { if (!path_parser.IsValid()) {
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr()); LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
const auto full_path = path_parser.BuildHostPath(mount_point); const auto full_path = path_parser.BuildHostPath(mount_point);
@ -106,25 +106,25 @@ Result SaveDataArchive::DeleteFile(const Path& path) const {
switch (path_parser.GetHostStatus(mount_point)) { switch (path_parser.GetHostStatus(mount_point)) {
case PathParser::InvalidMountPoint: case PathParser::InvalidMountPoint:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ERROR_FILE_NOT_FOUND; return ResultFileNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
LOG_ERROR(Service_FS, "Path not found {}", full_path); LOG_ERROR(Service_FS, "Path not found {}", full_path);
return ERROR_PATH_NOT_FOUND; return ResultPathNotFound;
case PathParser::FileInPath: case PathParser::FileInPath:
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
case PathParser::NotFound: case PathParser::NotFound:
LOG_ERROR(Service_FS, "File not found {}", full_path); LOG_ERROR(Service_FS, "File not found {}", full_path);
return ERROR_FILE_NOT_FOUND; return ResultFileNotFound;
case PathParser::FileFound: case PathParser::FileFound:
break; // Expected 'success' case break; // Expected 'success' case
} }
if (FileUtil::Delete(full_path)) { if (FileUtil::Delete(full_path)) {
return RESULT_SUCCESS; return ResultSuccess;
} }
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting {}", full_path); LOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting {}", full_path);
return ERROR_FILE_NOT_FOUND; return ResultFileNotFound;
} }
Result SaveDataArchive::RenameFile(const Path& src_path, const Path& dest_path) const { Result SaveDataArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
@ -133,21 +133,21 @@ Result SaveDataArchive::RenameFile(const Path& src_path, const Path& dest_path)
// TODO: Verify these return codes with HW // TODO: Verify these return codes with HW
if (!path_parser_src.IsValid()) { if (!path_parser_src.IsValid()) {
LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr()); LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
const PathParser path_parser_dest(dest_path); const PathParser path_parser_dest(dest_path);
if (!path_parser_dest.IsValid()) { if (!path_parser_dest.IsValid()) {
LOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr()); 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 src_path_full = path_parser_src.BuildHostPath(mount_point);
const auto dest_path_full = path_parser_dest.BuildHostPath(mount_point); const auto dest_path_full = path_parser_dest.BuildHostPath(mount_point);
if (FileUtil::Rename(src_path_full, dest_path_full)) { 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 // TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't
@ -162,36 +162,36 @@ static Result DeleteDirectoryHelper(const Path& path, const std::string& mount_p
if (!path_parser.IsValid()) { if (!path_parser.IsValid()) {
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr()); LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
if (path_parser.IsRootDirectory()) if (path_parser.IsRootDirectory())
return ERROR_DIRECTORY_NOT_EMPTY; return ResultDirectoryNotEmpty;
const auto full_path = path_parser.BuildHostPath(mount_point); const auto full_path = path_parser.BuildHostPath(mount_point);
switch (path_parser.GetHostStatus(mount_point)) { switch (path_parser.GetHostStatus(mount_point)) {
case PathParser::InvalidMountPoint: case PathParser::InvalidMountPoint:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ERROR_PATH_NOT_FOUND; return ResultPathNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
case PathParser::NotFound: case PathParser::NotFound:
LOG_ERROR(Service_FS, "Path not found {}", full_path); LOG_ERROR(Service_FS, "Path not found {}", full_path);
return ERROR_PATH_NOT_FOUND; return ResultPathNotFound;
case PathParser::FileInPath: case PathParser::FileInPath:
case PathParser::FileFound: case PathParser::FileFound:
LOG_ERROR(Service_FS, "Unexpected file or directory {}", full_path); LOG_ERROR(Service_FS, "Unexpected file or directory {}", full_path);
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY; return ResultUnexpectedFileOrDirectory;
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
break; // Expected 'success' case break; // Expected 'success' case
} }
if (deleter(full_path)) { if (deleter(full_path)) {
return RESULT_SUCCESS; return ResultSuccess;
} }
LOG_ERROR(Service_FS, "Directory not empty {}", full_path); LOG_ERROR(Service_FS, "Directory not empty {}", full_path);
return ERROR_DIRECTORY_NOT_EMPTY; return ResultDirectoryNotEmpty;
} }
Result SaveDataArchive::DeleteDirectory(const Path& path) const { Result SaveDataArchive::DeleteDirectory(const Path& path) const {
@ -208,7 +208,7 @@ Result SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) const {
if (!path_parser.IsValid()) { if (!path_parser.IsValid()) {
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr()); LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
const auto full_path = path_parser.BuildHostPath(mount_point); const auto full_path = path_parser.BuildHostPath(mount_point);
@ -216,31 +216,31 @@ Result SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) const {
switch (path_parser.GetHostStatus(mount_point)) { switch (path_parser.GetHostStatus(mount_point)) {
case PathParser::InvalidMountPoint: case PathParser::InvalidMountPoint:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ERROR_FILE_NOT_FOUND; return ResultFileNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
LOG_ERROR(Service_FS, "Path not found {}", full_path); LOG_ERROR(Service_FS, "Path not found {}", full_path);
return ERROR_PATH_NOT_FOUND; return ResultPathNotFound;
case PathParser::FileInPath: case PathParser::FileInPath:
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path); LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY; return ResultUnexpectedFileOrDirectory;
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
case PathParser::FileFound: case PathParser::FileFound:
LOG_ERROR(Service_FS, "{} already exists", full_path); LOG_ERROR(Service_FS, "{} already exists", full_path);
return ERROR_FILE_ALREADY_EXISTS; return ResultFileAlreadyExists;
case PathParser::NotFound: case PathParser::NotFound:
break; // Expected 'success' case break; // Expected 'success' case
} }
if (size == 0) { if (size == 0) {
FileUtil::CreateEmptyFile(full_path); FileUtil::CreateEmptyFile(full_path);
return RESULT_SUCCESS; return ResultSuccess;
} }
FileUtil::IOFile file(full_path, "wb"); FileUtil::IOFile file(full_path, "wb");
// Creates a sparse file (or a normal file on filesystems without the concept of sparse files) // 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. // 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) { if (file.Seek(size - 1, SEEK_SET) && file.WriteBytes("", 1) == 1) {
return RESULT_SUCCESS; return ResultSuccess;
} }
LOG_ERROR(Service_FS, "Too large file"); LOG_ERROR(Service_FS, "Too large file");
@ -253,7 +253,7 @@ Result SaveDataArchive::CreateDirectory(const Path& path) const {
if (!path_parser.IsValid()) { if (!path_parser.IsValid()) {
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr()); LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
const auto full_path = path_parser.BuildHostPath(mount_point); const auto full_path = path_parser.BuildHostPath(mount_point);
@ -261,23 +261,23 @@ Result SaveDataArchive::CreateDirectory(const Path& path) const {
switch (path_parser.GetHostStatus(mount_point)) { switch (path_parser.GetHostStatus(mount_point)) {
case PathParser::InvalidMountPoint: case PathParser::InvalidMountPoint:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ERROR_FILE_NOT_FOUND; return ResultFileNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
LOG_ERROR(Service_FS, "Path not found {}", full_path); LOG_ERROR(Service_FS, "Path not found {}", full_path);
return ERROR_PATH_NOT_FOUND; return ResultPathNotFound;
case PathParser::FileInPath: case PathParser::FileInPath:
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path); LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY; return ResultUnexpectedFileOrDirectory;
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
case PathParser::FileFound: case PathParser::FileFound:
LOG_ERROR(Service_FS, "{} already exists", full_path); LOG_ERROR(Service_FS, "{} already exists", full_path);
return ERROR_DIRECTORY_ALREADY_EXISTS; return ResultDirectoryAlreadyExists;
case PathParser::NotFound: case PathParser::NotFound:
break; // Expected 'success' case break; // Expected 'success' case
} }
if (FileUtil::CreateDir(mount_point + path.AsString())) { if (FileUtil::CreateDir(mount_point + path.AsString())) {
return RESULT_SUCCESS; return ResultSuccess;
} }
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", mount_point);
@ -291,21 +291,21 @@ Result SaveDataArchive::RenameDirectory(const Path& src_path, const Path& dest_p
// TODO: Verify these return codes with HW // TODO: Verify these return codes with HW
if (!path_parser_src.IsValid()) { if (!path_parser_src.IsValid()) {
LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr()); LOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
const PathParser path_parser_dest(dest_path); const PathParser path_parser_dest(dest_path);
if (!path_parser_dest.IsValid()) { if (!path_parser_dest.IsValid()) {
LOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr()); 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 src_path_full = path_parser_src.BuildHostPath(mount_point);
const auto dest_path_full = path_parser_dest.BuildHostPath(mount_point); const auto dest_path_full = path_parser_dest.BuildHostPath(mount_point);
if (FileUtil::Rename(src_path_full, dest_path_full)) { 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 // TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't
@ -320,7 +320,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SaveDataArchive::OpenDirectory(
if (!path_parser.IsValid()) { if (!path_parser.IsValid()) {
LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr()); LOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
return ERROR_INVALID_PATH; return ResultInvalidPath;
} }
const auto full_path = path_parser.BuildHostPath(mount_point); const auto full_path = path_parser.BuildHostPath(mount_point);
@ -328,15 +328,15 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SaveDataArchive::OpenDirectory(
switch (path_parser.GetHostStatus(mount_point)) { switch (path_parser.GetHostStatus(mount_point)) {
case PathParser::InvalidMountPoint: case PathParser::InvalidMountPoint:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ERROR_FILE_NOT_FOUND; return ResultFileNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
case PathParser::NotFound: case PathParser::NotFound:
LOG_ERROR(Service_FS, "Path not found {}", full_path); LOG_ERROR(Service_FS, "Path not found {}", full_path);
return ERROR_PATH_NOT_FOUND; return ResultPathNotFound;
case PathParser::FileInPath: case PathParser::FileInPath:
case PathParser::FileFound: case PathParser::FileFound:
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path); LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY; return ResultUnexpectedFileOrDirectory;
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
break; // Expected 'success' case break; // Expected 'success' case
} }

View File

@ -66,7 +66,7 @@ Result Applet::Create(Service::APT::AppletId id, Service::APT::AppletId parent,
// Schedule the update event // Schedule the update event
Core::System::GetInstance().CoreTiming().ScheduleEvent( Core::System::GetInstance().CoreTiming().ScheduleEvent(
usToCycles(applet_update_interval_us), applet_update_event, static_cast<u64>(id)); 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) { std::shared_ptr<Applet> Applet::Get(Service::APT::AppletId id) {

View File

@ -14,7 +14,7 @@ Result ErrEula::ReceiveParameterImpl(const Service::APT::MessageParameter& param
LOG_ERROR(Service_APT, "unsupported signal {}", parameter.signal); LOG_ERROR(Service_APT, "unsupported signal {}", parameter.signal);
UNIMPLEMENTED(); UNIMPLEMENTED();
// TODO(Subv): Find the right error code // TODO(Subv): Find the right error code
return Result(-1); return ResultUnknown;
} }
// The LibAppJustStarted message contains a buffer with the size of the framebuffer shared // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared
@ -40,7 +40,7 @@ Result ErrEula::ReceiveParameterImpl(const Service::APT::MessageParameter& param
.object = framebuffer_memory, .object = framebuffer_memory,
}); });
return RESULT_SUCCESS; return ResultSuccess;
} }
Result ErrEula::Start(const Service::APT::MessageParameter& parameter) { Result ErrEula::Start(const Service::APT::MessageParameter& parameter) {
@ -52,14 +52,14 @@ Result ErrEula::Start(const Service::APT::MessageParameter& parameter) {
// Let the application know that we're closing. // Let the application know that we're closing.
Finalize(); Finalize();
return RESULT_SUCCESS; return ResultSuccess;
} }
Result ErrEula::Finalize() { Result ErrEula::Finalize() {
std::vector<u8> buffer(startup_param.size()); std::vector<u8> buffer(startup_param.size());
std::fill(buffer.begin(), buffer.end(), 0); std::fill(buffer.begin(), buffer.end(), 0);
CloseApplet(nullptr, buffer); CloseApplet(nullptr, buffer);
return RESULT_SUCCESS; return ResultSuccess;
} }
void ErrEula::Update() {} void ErrEula::Update() {}

View File

@ -22,7 +22,7 @@ Result MiiSelector::ReceiveParameterImpl(const Service::APT::MessageParameter& p
LOG_ERROR(Service_APT, "unsupported signal {}", parameter.signal); LOG_ERROR(Service_APT, "unsupported signal {}", parameter.signal);
UNIMPLEMENTED(); UNIMPLEMENTED();
// TODO(Subv): Find the right error code // TODO(Subv): Find the right error code
return Result(-1); return ResultUnknown;
} }
// The LibAppJustStarted message contains a buffer with the size of the framebuffer shared // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared
@ -47,7 +47,7 @@ Result MiiSelector::ReceiveParameterImpl(const Service::APT::MessageParameter& p
.object = framebuffer_memory, .object = framebuffer_memory,
}); });
return RESULT_SUCCESS; return ResultSuccess;
} }
Result MiiSelector::Start(const Service::APT::MessageParameter& parameter) { Result MiiSelector::Start(const Service::APT::MessageParameter& parameter) {
@ -63,7 +63,7 @@ Result MiiSelector::Start(const Service::APT::MessageParameter& parameter) {
MiiSelectorConfig frontend_config = ToFrontendConfig(config); MiiSelectorConfig frontend_config = ToFrontendConfig(config);
frontend_applet->Setup(frontend_config); frontend_applet->Setup(frontend_config);
return RESULT_SUCCESS; return ResultSuccess;
} }
void MiiSelector::Update() { void MiiSelector::Update() {
@ -82,7 +82,7 @@ Result MiiSelector::Finalize() {
std::vector<u8> buffer(sizeof(MiiResult)); std::vector<u8> buffer(sizeof(MiiResult));
std::memcpy(buffer.data(), &result, buffer.size()); std::memcpy(buffer.data(), &result, buffer.size());
CloseApplet(nullptr, buffer); CloseApplet(nullptr, buffer);
return RESULT_SUCCESS; return ResultSuccess;
} }
MiiResult MiiSelector::GetStandardMiiResult() { MiiResult MiiSelector::GetStandardMiiResult() {

View File

@ -14,7 +14,7 @@ Result Mint::ReceiveParameterImpl(const Service::APT::MessageParameter& paramete
LOG_ERROR(Service_APT, "unsupported signal {}", parameter.signal); LOG_ERROR(Service_APT, "unsupported signal {}", parameter.signal);
UNIMPLEMENTED(); UNIMPLEMENTED();
// TODO(Subv): Find the right error code // TODO(Subv): Find the right error code
return Result(-1); return ResultUnknown;
} }
// The Request message contains a buffer with the size of the framebuffer shared // The Request message contains a buffer with the size of the framebuffer shared
@ -40,7 +40,7 @@ Result Mint::ReceiveParameterImpl(const Service::APT::MessageParameter& paramete
.object = framebuffer_memory, .object = framebuffer_memory,
}); });
return RESULT_SUCCESS; return ResultSuccess;
} }
Result Mint::Start(const Service::APT::MessageParameter& parameter) { Result Mint::Start(const Service::APT::MessageParameter& parameter) {
@ -52,14 +52,14 @@ Result Mint::Start(const Service::APT::MessageParameter& parameter) {
// Let the application know that we're closing // Let the application know that we're closing
Finalize(); Finalize();
return RESULT_SUCCESS; return ResultSuccess;
} }
Result Mint::Finalize() { Result Mint::Finalize() {
std::vector<u8> buffer(startup_param.size()); std::vector<u8> buffer(startup_param.size());
std::fill(buffer.begin(), buffer.end(), 0); std::fill(buffer.begin(), buffer.end(), 0);
CloseApplet(nullptr, buffer); CloseApplet(nullptr, buffer);
return RESULT_SUCCESS; return ResultSuccess;
} }
void Mint::Update() {} void Mint::Update() {}

View File

@ -44,7 +44,7 @@ Result SoftwareKeyboard::ReceiveParameterImpl(Service::APT::MessageParameter con
.object = framebuffer_memory, .object = framebuffer_memory,
}); });
return RESULT_SUCCESS; return ResultSuccess;
} }
case Service::APT::SignalType::Message: { case Service::APT::SignalType::Message: {
@ -58,7 +58,7 @@ Result SoftwareKeyboard::ReceiveParameterImpl(Service::APT::MessageParameter con
case SoftwareKeyboardCallbackResult::OK: case SoftwareKeyboardCallbackResult::OK:
// Finish execution // Finish execution
Finalize(); Finalize();
return RESULT_SUCCESS; return ResultSuccess;
case SoftwareKeyboardCallbackResult::Close: case SoftwareKeyboardCallbackResult::Close:
// Let the frontend display error and quit // Let the frontend display error and quit
@ -66,14 +66,14 @@ Result SoftwareKeyboard::ReceiveParameterImpl(Service::APT::MessageParameter con
config.return_code = SoftwareKeyboardResult::BannedInput; config.return_code = SoftwareKeyboardResult::BannedInput;
config.text_offset = config.text_length = 0; config.text_offset = config.text_length = 0;
Finalize(); Finalize();
return RESULT_SUCCESS; return ResultSuccess;
case SoftwareKeyboardCallbackResult::Continue: case SoftwareKeyboardCallbackResult::Continue:
// Let the frontend display error and get input again // Let the frontend display error and get input again
// The input will be sent for validation again on next Update(). // The input will be sent for validation again on next Update().
frontend_applet->ShowError(Common::UTF16BufferToUTF8(config.callback_msg)); frontend_applet->ShowError(Common::UTF16BufferToUTF8(config.callback_msg));
frontend_applet->Execute(ToFrontendConfig(config)); frontend_applet->Execute(ToFrontendConfig(config));
return RESULT_SUCCESS; return ResultSuccess;
default: default:
UNREACHABLE(); UNREACHABLE();
@ -84,7 +84,7 @@ Result SoftwareKeyboard::ReceiveParameterImpl(Service::APT::MessageParameter con
LOG_ERROR(Service_APT, "unsupported signal {}", parameter.signal); LOG_ERROR(Service_APT, "unsupported signal {}", parameter.signal);
UNIMPLEMENTED(); UNIMPLEMENTED();
// TODO(Subv): Find the right error code // TODO(Subv): Find the right error code
return Result(-1); return ResultUnknown;
} }
} }
} }
@ -104,7 +104,7 @@ Result SoftwareKeyboard::Start(Service::APT::MessageParameter const& parameter)
frontend_applet->Execute(ToFrontendConfig(config)); frontend_applet->Execute(ToFrontendConfig(config));
return RESULT_SUCCESS; return ResultSuccess;
} }
void SoftwareKeyboard::Update() { void SoftwareKeyboard::Update() {
@ -171,7 +171,7 @@ Result SoftwareKeyboard::Finalize() {
std::memcpy(buffer.data(), &config, buffer.size()); std::memcpy(buffer.data(), &config, buffer.size());
CloseApplet(nullptr, buffer); CloseApplet(nullptr, buffer);
text_memory = nullptr; text_memory = nullptr;
return RESULT_SUCCESS; return ResultSuccess;
} }
Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig( Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig(

View File

@ -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 // These errors are commonly returned by invalid IPC translations, so alias them here for
// convenience. // convenience.
// TODO(yuriks): These will probably go away once translation is implemented inside the kernel. // TODO(yuriks): These will probably go away once translation is implemented inside the kernel.
using Kernel::ERR_INVALID_BUFFER_DESCRIPTOR; using Kernel::ResultInvalidBufferDescriptor;
constexpr auto ERR_INVALID_HANDLE = Kernel::ERR_INVALID_HANDLE_OS; constexpr auto ResultInvalidHandle = Kernel::ResultInvalidHandleOs;
enum DescriptorType : u32 { enum DescriptorType : u32 {
// Buffer related descriptors types (mask : 0x0F) // Buffer related descriptors types (mask : 0x0F)

View File

@ -171,16 +171,16 @@ Result AddressArbiter::ArbitrateAddress(std::shared_ptr<Thread> thread, Arbitrat
default: default:
LOG_ERROR(Kernel, "unknown type={}", type); 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 calls that use a timeout seem to always return a Timeout error even if they did not put
// the thread to sleep // the thread to sleep
if (type == ArbitrationType::WaitIfLessThanWithTimeout || if (type == ArbitrationType::WaitIfLessThanWithTimeout ||
type == ArbitrationType::DecrementAndWaitIfLessThanWithTimeout) { type == ArbitrationType::DecrementAndWaitIfLessThanWithTimeout) {
return RESULT_TIMEOUT; return ResultTimeout;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
} // namespace Kernel } // namespace Kernel

View File

@ -24,7 +24,7 @@ Result ClientPort::Connect(std::shared_ptr<ClientSession>& client_session) {
// Note: Threads do not wait for the server endpoint to call // Note: Threads do not wait for the server endpoint to call
// AcceptSession before returning from this call. // AcceptSession before returning from this call.
R_UNLESS(active_sessions < max_sessions, ERR_MAX_CONNECTIONS_REACHED); R_UNLESS(active_sessions < max_sessions, ResultMaxConnectionsReached);
active_sessions++; active_sessions++;
// Create a new session pair, let the created sessions inherit the parent port's HLE handler. // Create a new session pair, let the created sessions inherit the parent port's HLE handler.
@ -40,7 +40,7 @@ Result ClientPort::Connect(std::shared_ptr<ClientSession>& client_session) {
server_port->WakeupAllWaitingThreads(); server_port->WakeupAllWaitingThreads();
client_session = client; client_session = client;
return RESULT_SUCCESS; return ResultSuccess;
} }
void ClientPort::ConnectionClosed() { void ClientPort::ConnectionClosed() {

View File

@ -47,7 +47,7 @@ ClientSession::~ClientSession() {
Result 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. // Keep ServerSession alive until we're done working with it.
std::shared_ptr<ServerSession> server = SharedFrom(parent->server); std::shared_ptr<ServerSession> server = SharedFrom(parent->server);
R_UNLESS(server, ERR_SESSION_CLOSED_BY_REMOTE); R_UNLESS(server, ResultSessionClosed);
// Signal the server session that new data is available // Signal the server session that new data is available
return server->HandleSyncRequest(std::move(thread)); return server->HandleSyncRequest(std::move(thread));

View File

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

View File

@ -32,7 +32,7 @@ Result HandleTable::Create(Handle* out_handle, std::shared_ptr<Object> obj) {
DEBUG_ASSERT(obj != nullptr); DEBUG_ASSERT(obj != nullptr);
u16 slot = next_free_slot; u16 slot = next_free_slot;
R_UNLESS(slot < generations.size(), ERR_OUT_OF_HANDLES); R_UNLESS(slot < generations.size(), ResultOutOfHandles);
next_free_slot = generations[slot]; next_free_slot = generations[slot];
u16 generation = next_generation++; u16 generation = next_generation++;
@ -47,24 +47,24 @@ Result HandleTable::Create(Handle* out_handle, std::shared_ptr<Object> obj) {
objects[slot] = std::move(obj); objects[slot] = std::move(obj);
*out_handle = generation | (slot << 15); *out_handle = generation | (slot << 15);
return RESULT_SUCCESS; return ResultSuccess;
} }
Result HandleTable::Duplicate(Handle* out, Handle handle) { Result HandleTable::Duplicate(Handle* out, Handle handle) {
std::shared_ptr<Object> object = GetGeneric(handle); std::shared_ptr<Object> object = GetGeneric(handle);
R_UNLESS(object, ERR_INVALID_HANDLE); R_UNLESS(object, ResultInvalidHandle);
return Create(out, std::move(object)); return Create(out, std::move(object));
} }
Result HandleTable::Close(Handle handle) { Result HandleTable::Close(Handle handle) {
R_UNLESS(IsValid(handle), ERR_INVALID_HANDLE); R_UNLESS(IsValid(handle), ResultInvalidHandle);
const u16 slot = GetSlot(handle); const u16 slot = GetSlot(handle);
objects[slot] = nullptr; objects[slot] = nullptr;
generations[slot] = next_free_slot; generations[slot] = next_free_slot;
next_free_slot = slot; next_free_slot = slot;
return RESULT_SUCCESS; return ResultSuccess;
} }
bool HandleTable::IsValid(Handle handle) const { bool HandleTable::IsValid(Handle handle) const {

View File

@ -51,22 +51,22 @@ public:
/** /**
* Allocates a handle for the given object. * Allocates a handle for the given object.
* @return The created Handle or one of the following errors: * @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.
*/ */
Result Create(Handle* out_handle, std::shared_ptr<Object> obj); Result Create(Handle* out_handle, std::shared_ptr<Object> obj);
/** /**
* Returns a new handle that points to the same object as the passed in handle. * 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: * @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()`. * - Any errors returned by `Create()`.
*/ */
Result Duplicate(Handle* out, Handle handle); Result Duplicate(Handle* out, Handle handle);
/** /**
* Closes a handle, removing it from the table and decreasing the object's ref-count. * Closes a handle, removing it from the table and decreasing the object's ref-count.
* @return `RESULT_SUCCESS` or one of the following errors: * @return `ResultSuccess` or one of the following errors:
* - `ERR_INVALID_HANDLE`: an invalid handle was passed in. * - `ResultInvalidHandle`: an invalid handle was passed in.
*/ */
Result Close(Handle handle); Result Close(Handle handle);

View File

@ -203,7 +203,7 @@ Result HLERequestContext::PopulateFromIncomingCommandBuffer(const u32_le* src_cm
std::move(translated_cmdbuf)); std::move(translated_cmdbuf));
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, Result HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf,
@ -281,7 +281,7 @@ Result HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf,
std::move(translated_cmdbuf)); std::move(translated_cmdbuf));
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
MappedBuffer& HLERequestContext::GetMappedBuffer(u32 id_from_cmdbuf) { MappedBuffer& HLERequestContext::GetMappedBuffer(u32 id_from_cmdbuf) {

View File

@ -182,7 +182,7 @@ Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem
Result result = Result result =
src_process->vm_manager.UnmapRange(page_start - Memory::CITRA_PAGE_SIZE, src_process->vm_manager.UnmapRange(page_start - Memory::CITRA_PAGE_SIZE,
(num_pages + 2) * Memory::CITRA_PAGE_SIZE); (num_pages + 2) * Memory::CITRA_PAGE_SIZE);
ASSERT(result == RESULT_SUCCESS); ASSERT(result == ResultSuccess);
mapped_buffer_context.erase(found); mapped_buffer_context.erase(found);
@ -215,11 +215,11 @@ Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem
ASSERT(dst_process->vm_manager.ChangeMemoryState( ASSERT(dst_process->vm_manager.ChangeMemoryState(
low_guard_address, Memory::CITRA_PAGE_SIZE, Kernel::MemoryState::Shared, low_guard_address, Memory::CITRA_PAGE_SIZE, Kernel::MemoryState::Shared,
Kernel::VMAPermission::ReadWrite, Kernel::MemoryState::Reserved, Kernel::VMAPermission::ReadWrite, Kernel::MemoryState::Reserved,
Kernel::VMAPermission::None) == RESULT_SUCCESS); Kernel::VMAPermission::None) == ResultSuccess);
ASSERT(dst_process->vm_manager.ChangeMemoryState( ASSERT(dst_process->vm_manager.ChangeMemoryState(
high_guard_address, Memory::CITRA_PAGE_SIZE, Kernel::MemoryState::Shared, high_guard_address, Memory::CITRA_PAGE_SIZE, Kernel::MemoryState::Shared,
Kernel::VMAPermission::ReadWrite, Kernel::MemoryState::Reserved, 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. // Get proper mapped buffer address and store it in the cmd buffer.
target_address += Memory::CITRA_PAGE_SIZE; target_address += Memory::CITRA_PAGE_SIZE;
@ -248,6 +248,6 @@ Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem
memory.WriteBlock(*dst_process, dst_address, cmd_buf.data(), command_size * sizeof(u32)); memory.WriteBlock(*dst_process, dst_address, cmd_buf.data(), command_size * sizeof(u32));
return RESULT_SUCCESS; return ResultSuccess;
} }
} // namespace Kernel } // namespace Kernel

View File

@ -96,7 +96,7 @@ Result Mutex::Release(Thread* thread) {
kernel.PrepareReschedule(); kernel.PrepareReschedule();
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
void Mutex::AddWaitingThread(std::shared_ptr<Thread> thread) { void Mutex::AddWaitingThread(std::shared_ptr<Thread> thread) {

View File

@ -256,7 +256,7 @@ Result Process::HeapAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermiss
target + size < target) { target + size < target) {
if (!skip_range_check) { if (!skip_range_check) {
LOG_ERROR(Kernel, "Invalid heap address"); LOG_ERROR(Kernel, "Invalid heap address");
return ERR_INVALID_ADDRESS; return ResultInvalidAddress;
} }
} }
{ {
@ -264,13 +264,13 @@ Result Process::HeapAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermiss
if (vma->second.type != VMAType::Free || if (vma->second.type != VMAType::Free ||
vma->second.base + vma->second.size < target + size) { vma->second.base + vma->second.size < target + size) {
LOG_ERROR(Kernel, "Trying to allocate already allocated memory"); LOG_ERROR(Kernel, "Trying to allocate already allocated memory");
return ERR_INVALID_ADDRESS_STATE; return ResultInvalidAddressState;
} }
} }
auto allocated_fcram = memory_region->HeapAllocate(size); auto allocated_fcram = memory_region->HeapAllocate(size);
if (allocated_fcram.empty()) { if (allocated_fcram.empty()) {
LOG_ERROR(Kernel, "Not enough space"); LOG_ERROR(Kernel, "Not enough space");
return ERR_OUT_OF_HEAP_MEMORY; return ResultOutOfHeapMemory;
} }
// Maps heap block by block // Maps heap block by block
@ -294,7 +294,7 @@ Result Process::HeapAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermiss
resource_limit->Reserve(ResourceLimitType::Commit, size); resource_limit->Reserve(ResourceLimitType::Commit, size);
*out_addr = target; *out_addr = target;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result Process::HeapFree(VAddr target, u32 size) { Result Process::HeapFree(VAddr target, u32 size) {
@ -302,7 +302,7 @@ Result Process::HeapFree(VAddr target, u32 size) {
if (target < Memory::HEAP_VADDR || target + size > Memory::HEAP_VADDR_END || if (target < Memory::HEAP_VADDR || target + size > Memory::HEAP_VADDR_END ||
target + size < target) { target + size < target) {
LOG_ERROR(Kernel, "Invalid heap address"); LOG_ERROR(Kernel, "Invalid heap address");
return ERR_INVALID_ADDRESS; return ResultInvalidAddress;
} }
R_SUCCEED_IF(size == 0); R_SUCCEED_IF(size == 0);
@ -321,7 +321,7 @@ Result Process::HeapFree(VAddr target, u32 size) {
memory_used -= size; memory_used -= size;
resource_limit->Release(ResourceLimitType::Commit, size); resource_limit->Release(ResourceLimitType::Commit, size);
return RESULT_SUCCESS; return ResultSuccess;
} }
Result Process::LinearAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermission perms) { Result Process::LinearAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermission perms) {
@ -331,7 +331,7 @@ Result Process::LinearAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermi
auto offset = memory_region->LinearAllocate(size); auto offset = memory_region->LinearAllocate(size);
if (!offset) { if (!offset) {
LOG_ERROR(Kernel, "Not enough space"); LOG_ERROR(Kernel, "Not enough space");
return ERR_OUT_OF_HEAP_MEMORY; return ResultOutOfHeapMemory;
} }
physical_offset = *offset; physical_offset = *offset;
target = physical_offset + GetLinearHeapAreaAddress(); target = physical_offset + GetLinearHeapAreaAddress();
@ -339,7 +339,7 @@ Result Process::LinearAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermi
if (target < GetLinearHeapBase() || target + size > GetLinearHeapLimit() || if (target < GetLinearHeapBase() || target + size > GetLinearHeapLimit() ||
target + size < target) { target + size < target) {
LOG_ERROR(Kernel, "Invalid linear heap address"); 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. // Kernel would crash/return error when target doesn't meet some requirement.
@ -352,7 +352,7 @@ Result Process::LinearAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermi
physical_offset = target - GetLinearHeapAreaAddress(); // relative to FCRAM physical_offset = target - GetLinearHeapAreaAddress(); // relative to FCRAM
if (!memory_region->LinearAllocate(physical_offset, size)) { if (!memory_region->LinearAllocate(physical_offset, size)) {
LOG_ERROR(Kernel, "Trying to allocate already allocated memory"); LOG_ERROR(Kernel, "Trying to allocate already allocated memory");
return ERR_INVALID_ADDRESS_STATE; return ResultInvalidAddressState;
} }
} }
@ -369,7 +369,7 @@ Result Process::LinearAllocate(VAddr* out_addr, VAddr target, u32 size, VMAPermi
LOG_DEBUG(Kernel, "Allocated at target={:08X}", target); LOG_DEBUG(Kernel, "Allocated at target={:08X}", target);
*out_addr = target; *out_addr = target;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result Process::LinearFree(VAddr target, u32 size) { Result Process::LinearFree(VAddr target, u32 size) {
@ -377,7 +377,7 @@ Result Process::LinearFree(VAddr target, u32 size) {
if (target < GetLinearHeapBase() || target + size > GetLinearHeapLimit() || if (target < GetLinearHeapBase() || target + size > GetLinearHeapLimit() ||
target + size < target) { target + size < target) {
LOG_ERROR(Kernel, "Invalid linear heap address"); LOG_ERROR(Kernel, "Invalid linear heap address");
return ERR_INVALID_ADDRESS; return ResultInvalidAddress;
} }
R_SUCCEED_IF(size == 0); R_SUCCEED_IF(size == 0);
@ -390,7 +390,7 @@ Result Process::LinearFree(VAddr target, u32 size) {
memory_used -= size; memory_used -= size;
resource_limit->Release(ResourceLimitType::Commit, size); resource_limit->Release(ResourceLimitType::Commit, size);
return RESULT_SUCCESS; return ResultSuccess;
} }
ResultVal<VAddr> Process::AllocateThreadLocalStorage() { ResultVal<VAddr> Process::AllocateThreadLocalStorage() {
@ -431,7 +431,7 @@ ResultVal<VAddr> Process::AllocateThreadLocalStorage() {
if (!offset) { if (!offset) {
LOG_ERROR(Kernel_SVC, LOG_ERROR(Kernel_SVC,
"Not enough space in BASE linear region to allocate a new TLS page"); "Not enough space in BASE linear region to allocate a new TLS page");
return ERR_OUT_OF_MEMORY; return ResultOutOfMemory;
} }
holding_tls_memory += holding_tls_memory +=
@ -469,7 +469,7 @@ Result Process::Map(VAddr target, VAddr source, u32 size, VMAPermission perms, b
if (!privileged && (source < Memory::HEAP_VADDR || source + size > Memory::HEAP_VADDR_END || if (!privileged && (source < Memory::HEAP_VADDR || source + size > Memory::HEAP_VADDR_END ||
source + size < source)) { source + size < source)) {
LOG_ERROR(Kernel, "Invalid source address"); 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? // TODO(wwylele): check target address range. Is it also restricted to heap region?
@ -484,17 +484,17 @@ Result Process::Map(VAddr target, VAddr source, u32 size, VMAPermission perms, b
VMAPermission::ReadWrite, VMAPermission::ReadWrite,
MemoryState::AliasCode, perms); MemoryState::AliasCode, perms);
} else { } else {
return ERR_INVALID_ADDRESS; return ResultInvalidAddress;
} }
} else { } else {
return ERR_INVALID_ADDRESS_STATE; return ResultInvalidAddressState;
} }
} }
auto vma = vm_manager.FindVMA(target); auto vma = vm_manager.FindVMA(target);
if (vma->second.type != VMAType::Free || vma->second.base + vma->second.size < target + size) { if (vma->second.type != VMAType::Free || vma->second.base + vma->second.size < target + size) {
LOG_ERROR(Kernel, "Trying to map to already allocated memory"); 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; MemoryState source_state = privileged ? MemoryState::Locked : MemoryState::Aliased;
@ -515,7 +515,7 @@ Result Process::Map(VAddr target, VAddr source, u32 size, VMAPermission perms, b
interval_target += block_size; interval_target += block_size;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result 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}", LOG_DEBUG(Kernel, "Unmap memory target={:08X}, source={:08X}, size={:08X}, perms={:08X}",
@ -523,7 +523,7 @@ Result Process::Unmap(VAddr target, VAddr source, u32 size, VMAPermission perms,
if (!privileged && (source < Memory::HEAP_VADDR || source + size > Memory::HEAP_VADDR_END || if (!privileged && (source < Memory::HEAP_VADDR || source + size > Memory::HEAP_VADDR_END ||
source + size < source)) { source + size < source)) {
LOG_ERROR(Kernel, "Invalid source address"); 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? // TODO(wwylele): check target address range. Is it also restricted to heap region?
@ -537,10 +537,10 @@ Result Process::Unmap(VAddr target, VAddr source, u32 size, VMAPermission perms,
VMAPermission::None, MemoryState::Private, VMAPermission::None, MemoryState::Private,
perms); perms);
} else { } else {
return ERR_INVALID_ADDRESS; return ResultInvalidAddress;
} }
} else { } else {
return ERR_INVALID_ADDRESS_STATE; return ResultInvalidAddressState;
} }
} }
@ -555,7 +555,7 @@ Result Process::Unmap(VAddr target, VAddr source, u32 size, VMAPermission perms,
CASCADE_CODE(vm_manager.ChangeMemoryState(source, size, source_state, VMAPermission::None, CASCADE_CODE(vm_manager.ChangeMemoryState(source, size, source_state, VMAPermission::None,
MemoryState::Private, perms)); MemoryState::Private, perms));
return RESULT_SUCCESS; return ResultSuccess;
} }
void Process::FreeAllMemory() { void Process::FreeAllMemory() {

View File

@ -26,7 +26,7 @@ ResultVal<std::shared_ptr<Semaphore>> KernelSystem::CreateSemaphore(s32 initial_
s32 max_count, s32 max_count,
std::string name) { std::string name) {
R_UNLESS(initial_count <= max_count, ERR_INVALID_COMBINATION_KERNEL); R_UNLESS(initial_count <= max_count, ResultInvalidCombinationKernel);
// When the semaphore is created, some slots are reserved for other threads, // When the semaphore is created, some slots are reserved for other threads,
// and the rest is reserved for the caller thread // and the rest is reserved for the caller thread
@ -49,13 +49,13 @@ void Semaphore::Acquire(Thread* thread) {
} }
Result Semaphore::Release(s32* count, s32 release_count) { Result Semaphore::Release(s32* count, s32 release_count) {
R_UNLESS(max_count >= release_count + available_count, ERR_OUT_OF_RANGE_KERNEL); R_UNLESS(max_count >= release_count + available_count, ResultOutOfRangeKernel);
*count = available_count; *count = available_count;
available_count += release_count; available_count += release_count;
WakeupAllWaitingThreads(); WakeupAllWaitingThreads();
return RESULT_SUCCESS; return ResultSuccess;
} }
} // namespace Kernel } // namespace Kernel

View File

@ -25,11 +25,11 @@ ServerPort::ServerPort(KernelSystem& kernel) : WaitObject(kernel) {}
ServerPort::~ServerPort() {} ServerPort::~ServerPort() {}
Result ServerPort::Accept(std::shared_ptr<ServerSession>& session) { Result ServerPort::Accept(std::shared_ptr<ServerSession>& session) {
R_UNLESS(!pending_sessions.empty(), ERR_NO_PENDING_SESSIONS); R_UNLESS(!pending_sessions.empty(), ResultNoPendingSessions);
session = std::move(pending_sessions.back()); session = std::move(pending_sessions.back());
pending_sessions.pop_back(); pending_sessions.pop_back();
return RESULT_SUCCESS; return ResultSuccess;
} }
bool ServerPort::ShouldWait(const Thread* thread) const { bool ServerPort::ShouldWait(const Thread* thread) const {

View File

@ -39,7 +39,7 @@ public:
/** /**
* Accepts a pending incoming connection on this port. If there are no pending sessions, will * Accepts a pending incoming connection on this port. If there are no pending sessions, will
* return ERR_NO_PENDING_SESSIONS. * return ResultNoPendingSessions.
*/ */
Result Accept(std::shared_ptr<ServerSession>& session); Result Accept(std::shared_ptr<ServerSession>& session);

View File

@ -136,7 +136,7 @@ Result ServerSession::HandleSyncRequest(std::shared_ptr<Thread> thread) {
// If this ServerSession does not have an HLE implementation, just wake up the threads waiting // If this ServerSession does not have an HLE implementation, just wake up the threads waiting
// on it. // on it.
WakeupAllWaitingThreads(); WakeupAllWaitingThreads();
return RESULT_SUCCESS; return ResultSuccess;
} }
KernelSystem::SessionPair KernelSystem::CreateSessionPair(const std::string& name, KernelSystem::SessionPair KernelSystem::CreateSessionPair(const std::string& name,

View File

@ -114,21 +114,21 @@ Result SharedMemory::Map(Process& target_process, VAddr address, MemoryPermissio
// Automatically allocated memory blocks can only be mapped with other_permissions = DontCare // Automatically allocated memory blocks can only be mapped with other_permissions = DontCare
if (base_address == 0 && other_permissions != MemoryPermission::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. // 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)) { 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", LOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, permissions don't match",
GetObjectId(), address, name); GetObjectId(), address, name);
return ERR_INVALID_COMBINATION; return ResultInvalidCombination;
} }
// Heap-backed memory blocks can not be mapped with other_permissions = DontCare // Heap-backed memory blocks can not be mapped with other_permissions = DontCare
if (base_address != 0 && other_permissions == MemoryPermission::DontCare) { if (base_address != 0 && other_permissions == MemoryPermission::DontCare) {
LOG_ERROR(Kernel, "cannot map id={}, address=0x{08X} name={}, permissions don't match", LOG_ERROR(Kernel, "cannot map id={}, address=0x{08X} name={}, permissions don't match",
GetObjectId(), address, name); GetObjectId(), address, name);
return ERR_INVALID_COMBINATION; return ResultInvalidCombination;
} }
// Error out if the provided permissions are not compatible with what the creator process needs. // Error out if the provided permissions are not compatible with what the creator process needs.
@ -136,7 +136,7 @@ Result SharedMemory::Map(Process& target_process, VAddr address, MemoryPermissio
static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) { static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) {
LOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, permissions don't match", LOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, permissions don't match",
GetObjectId(), address, name); GetObjectId(), address, name);
return ERR_WRONG_PERMISSION; return ResultWrongPermission;
} }
// TODO(Subv): Check for the Shared Device Mem flag in the creator process. // TODO(Subv): Check for the Shared Device Mem flag in the creator process.
@ -152,7 +152,7 @@ Result SharedMemory::Map(Process& target_process, VAddr address, MemoryPermissio
if (address < Memory::HEAP_VADDR || address + size >= Memory::SHARED_MEMORY_VADDR_END) { if (address < Memory::HEAP_VADDR || address + size >= Memory::SHARED_MEMORY_VADDR_END) {
LOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, invalid address", LOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, invalid address",
GetObjectId(), address, name); GetObjectId(), address, name);
return ERR_INVALID_ADDRESS; return ResultInvalidAddress;
} }
} }
@ -173,7 +173,7 @@ Result SharedMemory::Map(Process& target_process, VAddr address, MemoryPermissio
Kernel, Kernel,
"cannot map id={}, address=0x{:08X} name={}, mapping to already allocated memory", "cannot map id={}, address=0x{:08X} name={}, mapping to already allocated memory",
GetObjectId(), address, name); GetObjectId(), address, name);
return ERR_INVALID_ADDRESS_STATE; return ResultInvalidAddressState;
} }
} }
@ -187,7 +187,7 @@ Result SharedMemory::Map(Process& target_process, VAddr address, MemoryPermissio
interval_target += interval.second; interval_target += interval.second;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result SharedMemory::Unmap(Process& target_process, VAddr address) { Result SharedMemory::Unmap(Process& target_process, VAddr address) {

View File

@ -459,9 +459,9 @@ Result SVC::ControlMemory(u32* out_addr, u32 addr0, u32 addr1, u32 size, u32 ope
"size=0x{:X}, permissions=0x{:08X}", "size=0x{:X}, permissions=0x{:08X}",
operation, addr0, addr1, size, permissions); operation, addr0, addr1, size, permissions);
R_UNLESS((addr0 & Memory::CITRA_PAGE_MASK) == 0, ERR_MISALIGNED_ADDRESS); R_UNLESS((addr0 & Memory::CITRA_PAGE_MASK) == 0, ResultMisalignedAddress);
R_UNLESS((addr1 & Memory::CITRA_PAGE_MASK) == 0, ERR_MISALIGNED_ADDRESS); R_UNLESS((addr1 & Memory::CITRA_PAGE_MASK) == 0, ResultMisalignedAddress);
R_UNLESS((size & Memory::CITRA_PAGE_MASK) == 0, ERR_MISALIGNED_SIZE); R_UNLESS((size & Memory::CITRA_PAGE_MASK) == 0, ResultMisalignedSize);
const u32 region = operation & MEMOP_REGION_MASK; const u32 region = operation & MEMOP_REGION_MASK;
operation &= ~MEMOP_REGION_MASK; operation &= ~MEMOP_REGION_MASK;
@ -472,7 +472,7 @@ Result SVC::ControlMemory(u32* out_addr, u32 addr0, u32 addr1, u32 size, u32 ope
} }
if ((permissions & (u32)MemoryPermission::ReadWrite) != permissions) { if ((permissions & (u32)MemoryPermission::ReadWrite) != permissions) {
return ERR_INVALID_COMBINATION; return ResultInvalidCombination;
} }
VMAPermission vma_permissions = (VMAPermission)permissions; VMAPermission vma_permissions = (VMAPermission)permissions;
@ -487,7 +487,7 @@ Result SVC::ControlMemory(u32* out_addr, u32 addr0, u32 addr1, u32 size, u32 ope
} else if (addr0 >= process.GetLinearHeapBase() && addr0 < process.GetLinearHeapLimit()) { } else if (addr0 >= process.GetLinearHeapBase() && addr0 < process.GetLinearHeapLimit()) {
R_TRY(process.LinearFree(addr0, size)); R_TRY(process.LinearFree(addr0, size));
} else { } else {
return ERR_INVALID_ADDRESS; return ResultInvalidAddress;
} }
*out_addr = addr0; *out_addr = addr0;
break; break;
@ -511,10 +511,10 @@ Result SVC::ControlMemory(u32* out_addr, u32 addr0, u32 addr1, u32 size, u32 ope
} }
default: default:
LOG_ERROR(Kernel_SVC, "unknown operation=0x{:08X}", operation); LOG_ERROR(Kernel_SVC, "unknown operation=0x{:08X}", operation);
return ERR_INVALID_COMBINATION; return ResultInvalidCombination;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
void SVC::ExitProcess() { void SVC::ExitProcess() {
@ -524,10 +524,10 @@ void SVC::ExitProcess() {
Result SVC::TerminateProcess(Handle handle) { Result SVC::TerminateProcess(Handle handle) {
std::shared_ptr<Process> process = std::shared_ptr<Process> process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(handle); kernel.GetCurrentProcess()->handle_table.Get<Process>(handle);
R_UNLESS(process, ERR_INVALID_HANDLE); R_UNLESS(process, ResultInvalidHandle);
kernel.TerminateProcess(process); kernel.TerminateProcess(process);
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Maps a memory block to specified address /// Maps a memory block to specified address
@ -539,7 +539,7 @@ Result SVC::MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_p
std::shared_ptr<SharedMemory> shared_memory = std::shared_ptr<SharedMemory> shared_memory =
kernel.GetCurrentProcess()->handle_table.Get<SharedMemory>(handle); kernel.GetCurrentProcess()->handle_table.Get<SharedMemory>(handle);
R_UNLESS(shared_memory, ERR_INVALID_HANDLE); R_UNLESS(shared_memory, ResultInvalidHandle);
MemoryPermission permissions_type = static_cast<MemoryPermission>(permissions); MemoryPermission permissions_type = static_cast<MemoryPermission>(permissions);
switch (permissions_type) { switch (permissions_type) {
@ -557,7 +557,7 @@ Result SVC::MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_p
LOG_ERROR(Kernel_SVC, "unknown permissions=0x{:08X}", permissions); LOG_ERROR(Kernel_SVC, "unknown permissions=0x{:08X}", permissions);
} }
return ERR_INVALID_COMBINATION; return ResultInvalidCombination;
} }
Result SVC::UnmapMemoryBlock(Handle handle, u32 addr) { Result SVC::UnmapMemoryBlock(Handle handle, u32 addr) {
@ -568,7 +568,7 @@ Result SVC::UnmapMemoryBlock(Handle handle, u32 addr) {
std::shared_ptr<Process> current_process = kernel.GetCurrentProcess(); std::shared_ptr<Process> current_process = kernel.GetCurrentProcess();
std::shared_ptr<SharedMemory> shared_memory = std::shared_ptr<SharedMemory> shared_memory =
current_process->handle_table.Get<SharedMemory>(handle); current_process->handle_table.Get<SharedMemory>(handle);
R_UNLESS(shared_memory, ERR_INVALID_HANDLE); R_UNLESS(shared_memory, ResultInvalidHandle);
return shared_memory->Unmap(*current_process, addr); return shared_memory->Unmap(*current_process, addr);
} }
@ -576,17 +576,17 @@ Result SVC::UnmapMemoryBlock(Handle handle, u32 addr) {
/// Connect to an OS service given the port name, returns the handle to the port to out /// Connect to an OS service given the port name, returns the handle to the port to out
Result SVC::ConnectToPort(Handle* out_handle, VAddr port_name_address) { Result SVC::ConnectToPort(Handle* out_handle, VAddr port_name_address) {
R_UNLESS(memory.IsValidVirtualAddress(*kernel.GetCurrentProcess(), port_name_address), R_UNLESS(memory.IsValidVirtualAddress(*kernel.GetCurrentProcess(), port_name_address),
ERR_NOT_FOUND); ResultNotFound);
static constexpr std::size_t PortNameMaxLength = 11; static constexpr std::size_t PortNameMaxLength = 11;
// Read 1 char beyond the max allowed port name to detect names that are too long. // Read 1 char beyond the max allowed port name to detect names that are too long.
std::string port_name = memory.ReadCString(port_name_address, PortNameMaxLength + 1); std::string port_name = memory.ReadCString(port_name_address, PortNameMaxLength + 1);
R_UNLESS(port_name.size() <= PortNameMaxLength, ERR_PORT_NAME_TOO_LONG); R_UNLESS(port_name.size() <= PortNameMaxLength, ResultPortNameTooLong);
LOG_TRACE(Kernel_SVC, "called port_name={}", port_name); LOG_TRACE(Kernel_SVC, "called port_name={}", port_name);
auto it = kernel.named_ports.find(port_name); auto it = kernel.named_ports.find(port_name);
R_UNLESS(it != kernel.named_ports.end(), ERR_NOT_FOUND); R_UNLESS(it != kernel.named_ports.end(), ResultNotFound);
auto client_port = it->second; auto client_port = it->second;
std::shared_ptr<ClientSession> client_session; std::shared_ptr<ClientSession> client_session;
@ -600,7 +600,7 @@ Result SVC::ConnectToPort(Handle* out_handle, VAddr port_name_address) {
Result SVC::SendSyncRequest(Handle handle) { Result SVC::SendSyncRequest(Handle handle) {
std::shared_ptr<ClientSession> session = std::shared_ptr<ClientSession> session =
kernel.GetCurrentProcess()->handle_table.Get<ClientSession>(handle); kernel.GetCurrentProcess()->handle_table.Get<ClientSession>(handle);
R_UNLESS(session, ERR_INVALID_HANDLE); R_UNLESS(session, ResultInvalidHandle);
LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName()); LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName());
@ -636,7 +636,7 @@ Result SVC::OpenThread(Handle* out_handle, Handle process_handle, u32 thread_id)
std::shared_ptr<Process> process = std::shared_ptr<Process> process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle); kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle);
R_UNLESS(process, ERR_INVALID_HANDLE); R_UNLESS(process, ResultInvalidHandle);
for (u32 core_id = 0; core_id < system.GetNumCores(); core_id++) { for (u32 core_id = 0; core_id < system.GetNumCores(); core_id++) {
const auto thread_list = kernel.GetThreadManager(core_id).GetThreadList(); const auto thread_list = kernel.GetThreadManager(core_id).GetThreadList();
@ -666,13 +666,13 @@ public:
std::shared_ptr<WaitObject> object) { std::shared_ptr<WaitObject> object) {
if (reason == ThreadWakeupReason::Timeout) { if (reason == ThreadWakeupReason::Timeout) {
thread->SetWaitSynchronizationResult(RESULT_TIMEOUT); thread->SetWaitSynchronizationResult(ResultTimeout);
return; return;
} }
ASSERT(reason == ThreadWakeupReason::Signal); ASSERT(reason == ThreadWakeupReason::Signal);
thread->SetWaitSynchronizationResult(RESULT_SUCCESS); thread->SetWaitSynchronizationResult(ResultSuccess);
// The wait_all case does not update the output index. // The wait_all case does not update the output index.
if (do_output) { if (do_output) {
@ -702,7 +702,7 @@ public:
ASSERT(thread->status == ThreadStatus::WaitSynchAny); ASSERT(thread->status == ThreadStatus::WaitSynchAny);
ASSERT(reason == ThreadWakeupReason::Signal); ASSERT(reason == ThreadWakeupReason::Signal);
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
if (object->GetHandleType() == HandleType::ServerSession) { if (object->GetHandleType() == HandleType::ServerSession) {
auto server_session = DynamicObjectCast<ServerSession>(object); auto server_session = DynamicObjectCast<ServerSession>(object);
@ -729,13 +729,13 @@ private:
Result SVC::WaitSynchronization1(Handle handle, s64 nano_seconds) { Result SVC::WaitSynchronization1(Handle handle, s64 nano_seconds) {
auto object = kernel.GetCurrentProcess()->handle_table.Get<WaitObject>(handle); auto object = kernel.GetCurrentProcess()->handle_table.Get<WaitObject>(handle);
Thread* thread = kernel.GetCurrentThreadManager().GetCurrentThread(); Thread* thread = kernel.GetCurrentThreadManager().GetCurrentThread();
R_UNLESS(object, ERR_INVALID_HANDLE); R_UNLESS(object, ResultInvalidHandle);
LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({}:{}), nanoseconds={}", handle, LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({}:{}), nanoseconds={}", handle,
object->GetTypeName(), object->GetName(), nano_seconds); object->GetTypeName(), object->GetName(), nano_seconds);
if (object->ShouldWait(thread)) { if (object->ShouldWait(thread)) {
R_UNLESS(nano_seconds != 0, RESULT_TIMEOUT); R_UNLESS(nano_seconds != 0, ResultTimeout);
thread->wait_objects = {object}; thread->wait_objects = {object};
object->AddWaitingThread(SharedFrom(thread)); object->AddWaitingThread(SharedFrom(thread));
@ -748,14 +748,14 @@ Result SVC::WaitSynchronization1(Handle handle, s64 nano_seconds) {
system.PrepareReschedule(); system.PrepareReschedule();
// Note: The output of this SVC will be set to RESULT_SUCCESS if the thread // Note: The output of this SVC will be set to ResultSuccess if the thread
// resumes due to a signal in its wait objects. // resumes due to a signal in its wait objects.
// Otherwise we retain the default value of timeout. // Otherwise we retain the default value of timeout.
return RESULT_TIMEOUT; return ResultTimeout;
} }
object->Acquire(thread); object->Acquire(thread);
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Wait for the given handles to synchronize, timeout after the specified nanoseconds /// Wait for the given handles to synchronize, timeout after the specified nanoseconds
@ -763,14 +763,14 @@ Result SVC::WaitSynchronizationN(s32* out, VAddr handles_address, s32 handle_cou
s64 nano_seconds) { s64 nano_seconds) {
Thread* thread = kernel.GetCurrentThreadManager().GetCurrentThread(); Thread* thread = kernel.GetCurrentThreadManager().GetCurrentThread();
R_UNLESS(memory.IsValidVirtualAddress(*kernel.GetCurrentProcess(), handles_address), R_UNLESS(memory.IsValidVirtualAddress(*kernel.GetCurrentProcess(), handles_address),
ERR_INVALID_POINTER); ResultInvalidPointer);
// NOTE: on real hardware, there is no nullptr check for 'out' (tested with firmware 4.4). If // NOTE: on real hardware, there is no nullptr check for 'out' (tested with firmware 4.4). If
// this happens, the running application will crash. // this happens, the running application will crash.
ASSERT_MSG(out != nullptr, "invalid output pointer specified!"); ASSERT_MSG(out != nullptr, "invalid output pointer specified!");
// Check if 'handle_count' is invalid // Check if 'handle_count' is invalid
R_UNLESS(handle_count >= 0, ERR_OUT_OF_RANGE); R_UNLESS(handle_count >= 0, ResultOutOfRange);
using ObjectPtr = std::shared_ptr<WaitObject>; using ObjectPtr = std::shared_ptr<WaitObject>;
std::vector<ObjectPtr> objects(handle_count); std::vector<ObjectPtr> objects(handle_count);
@ -778,7 +778,7 @@ Result SVC::WaitSynchronizationN(s32* out, VAddr handles_address, s32 handle_cou
for (int i = 0; i < handle_count; ++i) { for (int i = 0; i < handle_count; ++i) {
Handle handle = memory.Read32(handles_address + i * sizeof(Handle)); Handle handle = memory.Read32(handles_address + i * sizeof(Handle));
auto object = kernel.GetCurrentProcess()->handle_table.Get<WaitObject>(handle); auto object = kernel.GetCurrentProcess()->handle_table.Get<WaitObject>(handle);
R_UNLESS(object, ERR_INVALID_HANDLE); R_UNLESS(object, ResultInvalidHandle);
objects[i] = object; objects[i] = object;
} }
@ -792,14 +792,14 @@ Result SVC::WaitSynchronizationN(s32* out, VAddr handles_address, s32 handle_cou
object->Acquire(thread); object->Acquire(thread);
// Note: In this case, the `out` parameter is not set, // Note: In this case, the `out` parameter is not set,
// and retains whatever value it had before. // and retains whatever value it had before.
return RESULT_SUCCESS; return ResultSuccess;
} }
// Not all objects were available right now, prepare to suspend the thread. // Not all objects were available right now, prepare to suspend the thread.
// If a timeout value of 0 was provided, just return the Timeout error code instead of // If a timeout value of 0 was provided, just return the Timeout error code instead of
// suspending the thread. // suspending the thread.
R_UNLESS(nano_seconds != 0, RESULT_TIMEOUT); R_UNLESS(nano_seconds != 0, ResultTimeout);
// Put the thread to sleep // Put the thread to sleep
thread->status = ThreadStatus::WaitSynchAll; thread->status = ThreadStatus::WaitSynchAll;
@ -820,9 +820,9 @@ Result SVC::WaitSynchronizationN(s32* out, VAddr handles_address, s32 handle_cou
// This value gets set to -1 by default in this case, it is not modified after this. // This value gets set to -1 by default in this case, it is not modified after this.
*out = -1; *out = -1;
// Note: The output of this SVC will be set to RESULT_SUCCESS if the thread resumes due to // Note: The output of this SVC will be set to ResultSuccess if the thread resumes due to
// a signal in one of its wait objects. // a signal in one of its wait objects.
return RESULT_TIMEOUT; return ResultTimeout;
} else { } else {
// Find the first object that is acquirable in the provided list of objects // Find the first object that is acquirable in the provided list of objects
auto itr = std::find_if(objects.begin(), objects.end(), [thread](const ObjectPtr& object) { auto itr = std::find_if(objects.begin(), objects.end(), [thread](const ObjectPtr& object) {
@ -834,14 +834,14 @@ Result SVC::WaitSynchronizationN(s32* out, VAddr handles_address, s32 handle_cou
WaitObject* object = itr->get(); WaitObject* object = itr->get();
object->Acquire(thread); object->Acquire(thread);
*out = static_cast<s32>(std::distance(objects.begin(), itr)); *out = static_cast<s32>(std::distance(objects.begin(), itr));
return RESULT_SUCCESS; return ResultSuccess;
} }
// No objects were ready to be acquired, prepare to suspend the thread. // No objects were ready to be acquired, prepare to suspend the thread.
// If a timeout value of 0 was provided, just return the Timeout error code instead of // If a timeout value of 0 was provided, just return the Timeout error code instead of
// suspending the thread. // suspending the thread.
R_UNLESS(nano_seconds != 0, RESULT_TIMEOUT); R_UNLESS(nano_seconds != 0, ResultTimeout);
// Put the thread to sleep // Put the thread to sleep
thread->status = ThreadStatus::WaitSynchAny; thread->status = ThreadStatus::WaitSynchAny;
@ -864,18 +864,18 @@ Result SVC::WaitSynchronizationN(s32* out, VAddr handles_address, s32 handle_cou
system.PrepareReschedule(); system.PrepareReschedule();
// Note: The output of this SVC will be set to RESULT_SUCCESS if the thread resumes due to a // Note: The output of this SVC will be set to ResultSuccess if the thread resumes due to a
// signal in one of its wait objects. // signal in one of its wait objects.
// Otherwise we retain the default value of timeout, and -1 in the out parameter // Otherwise we retain the default value of timeout, and -1 in the out parameter
*out = -1; *out = -1;
return RESULT_TIMEOUT; return ResultTimeout;
} }
} }
static Result ReceiveIPCRequest(Kernel::KernelSystem& kernel, Memory::MemorySystem& memory, static Result ReceiveIPCRequest(Kernel::KernelSystem& kernel, Memory::MemorySystem& memory,
std::shared_ptr<ServerSession> server_session, std::shared_ptr<ServerSession> server_session,
std::shared_ptr<Thread> thread) { std::shared_ptr<Thread> thread) {
R_UNLESS(server_session->parent->client, ERR_SESSION_CLOSED_BY_REMOTE); R_UNLESS(server_session->parent->client, ResultSessionClosed);
VAddr target_address = thread->GetCommandBufferAddress(); VAddr target_address = thread->GetCommandBufferAddress();
VAddr source_address = server_session->currently_handling->GetCommandBufferAddress(); VAddr source_address = server_session->currently_handling->GetCommandBufferAddress();
@ -903,10 +903,10 @@ static Result ReceiveIPCRequest(Kernel::KernelSystem& kernel, Memory::MemorySyst
Result SVC::ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_count, Result SVC::ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_count,
Handle reply_target) { Handle reply_target) {
R_UNLESS(memory.IsValidVirtualAddress(*kernel.GetCurrentProcess(), handles_address), R_UNLESS(memory.IsValidVirtualAddress(*kernel.GetCurrentProcess(), handles_address),
ERR_INVALID_POINTER); ResultInvalidPointer);
// Check if 'handle_count' is invalid // Check if 'handle_count' is invalid
R_UNLESS(handle_count >= 0, ERR_OUT_OF_RANGE); R_UNLESS(handle_count >= 0, ResultOutOfRange);
using ObjectPtr = std::shared_ptr<WaitObject>; using ObjectPtr = std::shared_ptr<WaitObject>;
std::vector<ObjectPtr> objects(handle_count); std::vector<ObjectPtr> objects(handle_count);
@ -916,7 +916,7 @@ Result SVC::ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_count,
for (int i = 0; i < handle_count; ++i) { for (int i = 0; i < handle_count; ++i) {
Handle handle = memory.Read32(handles_address + i * sizeof(Handle)); Handle handle = memory.Read32(handles_address + i * sizeof(Handle));
auto object = current_process->handle_table.Get<WaitObject>(handle); auto object = current_process->handle_table.Get<WaitObject>(handle);
R_UNLESS(object, ERR_INVALID_HANDLE); R_UNLESS(object, ResultInvalidHandle);
objects[i] = object; objects[i] = object;
} }
@ -927,7 +927,7 @@ Result SVC::ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_count,
IPC::Header header{cmd_buff_header}; IPC::Header header{cmd_buff_header};
if (reply_target != 0 && header.command_id != 0xFFFF) { if (reply_target != 0 && header.command_id != 0xFFFF) {
auto session = current_process->handle_table.Get<ServerSession>(reply_target); auto session = current_process->handle_table.Get<ServerSession>(reply_target);
R_UNLESS(session, ERR_INVALID_HANDLE); R_UNLESS(session, ResultInvalidHandle);
auto request_thread = std::move(session->currently_handling); auto request_thread = std::move(session->currently_handling);
@ -938,7 +938,7 @@ Result SVC::ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_count,
// TODO(Subv): Is the same error code (ClosedByRemote) returned for both of these cases? // TODO(Subv): Is the same error code (ClosedByRemote) returned for both of these cases?
if (request_thread == nullptr || session->parent->client == nullptr) { if (request_thread == nullptr || session->parent->client == nullptr) {
*index = -1; *index = -1;
return ERR_SESSION_CLOSED_BY_REMOTE; return ResultSessionClosed;
} }
VAddr source_address = thread->GetCommandBufferAddress(); VAddr source_address = thread->GetCommandBufferAddress();
@ -998,11 +998,11 @@ Result SVC::ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_count,
system.PrepareReschedule(); system.PrepareReschedule();
// Note: The output of this SVC will be set to RESULT_SUCCESS if the thread resumes due to a // Note: The output of this SVC will be set to ResultSuccess if the thread resumes due to a
// signal in one of its wait objects, or to 0xC8A01836 if there was a translation error. // signal in one of its wait objects, or to 0xC8A01836 if there was a translation error.
// By default the index is set to -1. // By default the index is set to -1.
*index = -1; *index = -1;
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Create an address arbiter (to allocate access to shared resources) /// Create an address arbiter (to allocate access to shared resources)
@ -1028,7 +1028,7 @@ Result SVC::ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value, s6
std::shared_ptr<AddressArbiter> arbiter = std::shared_ptr<AddressArbiter> arbiter =
kernel.GetCurrentProcess()->handle_table.Get<AddressArbiter>(handle); kernel.GetCurrentProcess()->handle_table.Get<AddressArbiter>(handle);
R_UNLESS(arbiter, ERR_INVALID_HANDLE); R_UNLESS(arbiter, ResultInvalidHandle);
auto res = auto res =
arbiter->ArbitrateAddress(SharedFrom(kernel.GetCurrentThreadManager().GetCurrentThread()), arbiter->ArbitrateAddress(SharedFrom(kernel.GetCurrentThreadManager().GetCurrentThread()),
@ -1089,7 +1089,7 @@ Result SVC::GetResourceLimit(Handle* resource_limit, Handle process_handle) {
std::shared_ptr<Process> current_process = kernel.GetCurrentProcess(); std::shared_ptr<Process> current_process = kernel.GetCurrentProcess();
std::shared_ptr<Process> process = current_process->handle_table.Get<Process>(process_handle); std::shared_ptr<Process> process = current_process->handle_table.Get<Process>(process_handle);
R_UNLESS(process, ERR_INVALID_HANDLE); R_UNLESS(process, ResultInvalidHandle);
return current_process->handle_table.Create(resource_limit, process->resource_limit); return current_process->handle_table.Create(resource_limit, process->resource_limit);
} }
@ -1102,7 +1102,7 @@ Result SVC::GetResourceLimitCurrentValues(VAddr values, Handle resource_limit_ha
const auto resource_limit = const auto resource_limit =
kernel.GetCurrentProcess()->handle_table.Get<ResourceLimit>(resource_limit_handle); kernel.GetCurrentProcess()->handle_table.Get<ResourceLimit>(resource_limit_handle);
R_UNLESS(resource_limit, ERR_INVALID_HANDLE); R_UNLESS(resource_limit, ResultInvalidHandle);
for (u32 i = 0; i < name_count; ++i) { for (u32 i = 0; i < name_count; ++i) {
const u32 name = memory.Read32(names + i * sizeof(u32)); const u32 name = memory.Read32(names + i * sizeof(u32));
@ -1110,7 +1110,7 @@ Result SVC::GetResourceLimitCurrentValues(VAddr values, Handle resource_limit_ha
memory.Write64(values + i * sizeof(u64), value); memory.Write64(values + i * sizeof(u64), value);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Get resource limit max values /// Get resource limit max values
@ -1121,16 +1121,16 @@ Result SVC::GetResourceLimitLimitValues(VAddr values, Handle resource_limit_hand
const auto resource_limit = const auto resource_limit =
kernel.GetCurrentProcess()->handle_table.Get<ResourceLimit>(resource_limit_handle); kernel.GetCurrentProcess()->handle_table.Get<ResourceLimit>(resource_limit_handle);
R_UNLESS(resource_limit, ERR_INVALID_HANDLE); R_UNLESS(resource_limit, ResultInvalidHandle);
for (u32 i = 0; i < name_count; ++i) { for (u32 i = 0; i < name_count; ++i) {
const auto name = static_cast<ResourceLimitType>(memory.Read32(names + i * sizeof(u32))); const auto name = static_cast<ResourceLimitType>(memory.Read32(names + i * sizeof(u32)));
R_UNLESS(name < ResourceLimitType::Max, ERR_INVALID_ENUM_VALUE); R_UNLESS(name < ResourceLimitType::Max, ResultInvalidEnumValue);
const s64 value = resource_limit->GetLimitValue(name); const s64 value = resource_limit->GetLimitValue(name);
memory.Write64(values + i * sizeof(u64), value); memory.Write64(values + i * sizeof(u64), value);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result SVC::SetResourceLimitLimitValues(Handle res_limit, VAddr names, VAddr resource_list, Result SVC::SetResourceLimitLimitValues(Handle res_limit, VAddr names, VAddr resource_list,
@ -1140,15 +1140,15 @@ Result SVC::SetResourceLimitLimitValues(Handle res_limit, VAddr names, VAddr res
const auto resource_limit = const auto resource_limit =
kernel.GetCurrentProcess()->handle_table.Get<ResourceLimit>(res_limit); kernel.GetCurrentProcess()->handle_table.Get<ResourceLimit>(res_limit);
R_UNLESS(resource_limit, ERR_INVALID_HANDLE); R_UNLESS(resource_limit, ResultInvalidHandle);
for (u32 i = 0; i < name_count; ++i) { for (u32 i = 0; i < name_count; ++i) {
const auto name = static_cast<ResourceLimitType>(memory.Read32(names + i * sizeof(u32))); const auto name = static_cast<ResourceLimitType>(memory.Read32(names + i * sizeof(u32)));
R_UNLESS(name < ResourceLimitType::Max, ERR_INVALID_ENUM_VALUE); R_UNLESS(name < ResourceLimitType::Max, ResultInvalidEnumValue);
const s64 value = memory.Read64(resource_list + i * sizeof(u64)); const s64 value = memory.Read64(resource_list + i * sizeof(u64));
const s32 value_high = value >> 32; const s32 value_high = value >> 32;
R_UNLESS(value_high >= 0, ERR_OUT_OF_RANGE_KERNEL); R_UNLESS(value_high >= 0, ResultOutOfRangeKernel);
if (name == ResourceLimitType::Commit && value_high != 0) { if (name == ResourceLimitType::Commit && value_high != 0) {
auto& config_mem = kernel.GetConfigMemHandler().GetConfigMem(); auto& config_mem = kernel.GetConfigMemHandler().GetConfigMem();
@ -1157,19 +1157,19 @@ Result SVC::SetResourceLimitLimitValues(Handle res_limit, VAddr names, VAddr res
resource_limit->SetLimitValue(name, static_cast<s32>(value)); resource_limit->SetLimitValue(name, static_cast<s32>(value));
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Creates a new thread /// Creates a new thread
Result SVC::CreateThread(Handle* out_handle, u32 entry_point, u32 arg, VAddr stack_top, Result SVC::CreateThread(Handle* out_handle, u32 entry_point, u32 arg, VAddr stack_top,
u32 priority, s32 processor_id) { u32 priority, s32 processor_id) {
R_UNLESS(priority <= ThreadPrioLowest, ERR_OUT_OF_RANGE); R_UNLESS(priority <= ThreadPrioLowest, ResultOutOfRange);
const auto current_process = kernel.GetCurrentProcess(); const auto current_process = kernel.GetCurrentProcess();
const auto& resource_limit = current_process->resource_limit; const auto& resource_limit = current_process->resource_limit;
const u32 max_priority = resource_limit->GetLimitValue(ResourceLimitType::Priority); const u32 max_priority = resource_limit->GetLimitValue(ResourceLimitType::Priority);
R_UNLESS(max_priority <= priority || current_process->no_thread_restrictions, R_UNLESS(max_priority <= priority || current_process->no_thread_restrictions,
ERR_NOT_AUTHORIZED); ResultNotAuthorized);
if (processor_id == ThreadProcessorIdDefault) { if (processor_id == ThreadProcessorIdDefault) {
// Set the target CPU to the one specified in the process' exheader. // Set the target CPU to the one specified in the process' exheader.
@ -1195,7 +1195,7 @@ Result SVC::CreateThread(Handle* out_handle, u32 entry_point, u32 arg, VAddr sta
// processorid. If this is implemented, make sure to check process->no_thread_restrictions. // processorid. If this is implemented, make sure to check process->no_thread_restrictions.
break; break;
default: default:
return ERR_OUT_OF_RANGE; return ResultOutOfRange;
break; break;
} }
@ -1236,24 +1236,24 @@ void SVC::ExitThread() {
Result SVC::GetThreadPriority(u32* priority, Handle handle) { Result SVC::GetThreadPriority(u32* priority, Handle handle) {
const std::shared_ptr<Thread> thread = const std::shared_ptr<Thread> thread =
kernel.GetCurrentProcess()->handle_table.Get<Thread>(handle); kernel.GetCurrentProcess()->handle_table.Get<Thread>(handle);
R_UNLESS(thread, ERR_INVALID_HANDLE); R_UNLESS(thread, ResultInvalidHandle);
*priority = thread->GetPriority(); *priority = thread->GetPriority();
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Sets the priority for the specified thread /// Sets the priority for the specified thread
Result SVC::SetThreadPriority(Handle handle, u32 priority) { Result SVC::SetThreadPriority(Handle handle, u32 priority) {
R_UNLESS(priority <= ThreadPrioLowest, ERR_OUT_OF_RANGE); R_UNLESS(priority <= ThreadPrioLowest, ResultOutOfRange);
const auto thread = kernel.GetCurrentProcess()->handle_table.Get<Thread>(handle); const auto thread = kernel.GetCurrentProcess()->handle_table.Get<Thread>(handle);
R_UNLESS(thread, ERR_INVALID_HANDLE); R_UNLESS(thread, ResultInvalidHandle);
// Note: The kernel uses the current process's resource limit instead of // Note: The kernel uses the current process's resource limit instead of
// the one from the thread owner's resource limit. // the one from the thread owner's resource limit.
const auto& resource_limit = kernel.GetCurrentProcess()->resource_limit; const auto& resource_limit = kernel.GetCurrentProcess()->resource_limit;
const u32 max_priority = resource_limit->GetLimitValue(ResourceLimitType::Priority); const u32 max_priority = resource_limit->GetLimitValue(ResourceLimitType::Priority);
R_UNLESS(max_priority <= priority, ERR_NOT_AUTHORIZED); R_UNLESS(max_priority <= priority, ResultNotAuthorized);
thread->SetPriority(priority); thread->SetPriority(priority);
thread->UpdatePriority(); thread->UpdatePriority();
@ -1264,7 +1264,7 @@ Result SVC::SetThreadPriority(Handle handle, u32 priority) {
} }
system.PrepareReschedule(); system.PrepareReschedule();
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Create a mutex /// Create a mutex
@ -1289,7 +1289,7 @@ Result SVC::ReleaseMutex(Handle handle) {
LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}", handle); LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}", handle);
std::shared_ptr<Mutex> mutex = kernel.GetCurrentProcess()->handle_table.Get<Mutex>(handle); std::shared_ptr<Mutex> mutex = kernel.GetCurrentProcess()->handle_table.Get<Mutex>(handle);
R_UNLESS(mutex, ERR_INVALID_HANDLE); R_UNLESS(mutex, ResultInvalidHandle);
return mutex->Release(kernel.GetCurrentThreadManager().GetCurrentThread()); return mutex->Release(kernel.GetCurrentThreadManager().GetCurrentThread());
} }
@ -1300,10 +1300,10 @@ Result SVC::GetProcessId(u32* process_id, Handle process_handle) {
const std::shared_ptr<Process> process = const std::shared_ptr<Process> process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle); kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle);
R_UNLESS(process, ERR_INVALID_HANDLE); R_UNLESS(process, ResultInvalidHandle);
*process_id = process->process_id; *process_id = process->process_id;
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Get the ID of the process that owns the specified thread /// Get the ID of the process that owns the specified thread
@ -1312,13 +1312,13 @@ Result SVC::GetProcessIdOfThread(u32* process_id, Handle thread_handle) {
const std::shared_ptr<Thread> thread = const std::shared_ptr<Thread> thread =
kernel.GetCurrentProcess()->handle_table.Get<Thread>(thread_handle); kernel.GetCurrentProcess()->handle_table.Get<Thread>(thread_handle);
R_UNLESS(thread, ERR_INVALID_HANDLE); R_UNLESS(thread, ResultInvalidHandle);
const std::shared_ptr<Process> process = thread->owner_process.lock(); const std::shared_ptr<Process> process = thread->owner_process.lock();
ASSERT_MSG(process != nullptr, "Invalid parent process for thread={:#010X}", thread_handle); ASSERT_MSG(process != nullptr, "Invalid parent process for thread={:#010X}", thread_handle);
*process_id = process->process_id; *process_id = process->process_id;
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Get the ID for the specified thread. /// Get the ID for the specified thread.
@ -1327,10 +1327,10 @@ Result SVC::GetThreadId(u32* thread_id, Handle handle) {
const std::shared_ptr<Thread> thread = const std::shared_ptr<Thread> thread =
kernel.GetCurrentProcess()->handle_table.Get<Thread>(handle); kernel.GetCurrentProcess()->handle_table.Get<Thread>(handle);
R_UNLESS(thread, ERR_INVALID_HANDLE); R_UNLESS(thread, ResultInvalidHandle);
*thread_id = thread->GetThreadId(); *thread_id = thread->GetThreadId();
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Creates a semaphore /// Creates a semaphore
@ -1357,7 +1357,7 @@ Result SVC::ReleaseSemaphore(s32* count, Handle handle, s32 release_count) {
std::shared_ptr<Semaphore> semaphore = std::shared_ptr<Semaphore> semaphore =
kernel.GetCurrentProcess()->handle_table.Get<Semaphore>(handle); kernel.GetCurrentProcess()->handle_table.Get<Semaphore>(handle);
R_UNLESS(semaphore, ERR_INVALID_HANDLE); R_UNLESS(semaphore, ResultInvalidHandle);
return semaphore->Release(count, release_count); return semaphore->Release(count, release_count);
} }
@ -1374,7 +1374,7 @@ Result SVC::KernelSetState(u32 kernel_state, u32 varg1, u32 varg2) {
LOG_ERROR(Kernel_SVC, "Unknown KernelSetState state={} varg1={} varg2={}", kernel_state, LOG_ERROR(Kernel_SVC, "Unknown KernelSetState state={} varg1={} varg2={}", kernel_state,
varg1, varg2); varg1, varg2);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Query process memory /// Query process memory
@ -1382,10 +1382,10 @@ Result SVC::QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_info, Han
u32 addr) { u32 addr) {
std::shared_ptr<Process> process = std::shared_ptr<Process> process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle); kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle);
R_UNLESS(process, ERR_INVALID_HANDLE); R_UNLESS(process, ResultInvalidHandle);
auto vma = process->vm_manager.FindVMA(addr); auto vma = process->vm_manager.FindVMA(addr);
R_UNLESS(vma != process->vm_manager.vma_map.end(), ERR_INVALID_ADDRESS); R_UNLESS(vma != process->vm_manager.vma_map.end(), ResultInvalidAddress);
auto permissions = vma->second.permissions; auto permissions = vma->second.permissions;
auto state = vma->second.meminfo_state; auto state = vma->second.meminfo_state;
@ -1411,7 +1411,7 @@ Result SVC::QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_info, Han
page_info->flags = 0; page_info->flags = 0;
LOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr=0x{:08X}", process_handle, addr); LOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr=0x{:08X}", process_handle, addr);
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Query memory /// Query memory
@ -1446,10 +1446,10 @@ Result SVC::SignalEvent(Handle handle) {
LOG_TRACE(Kernel_SVC, "called event=0x{:08X}", handle); LOG_TRACE(Kernel_SVC, "called event=0x{:08X}", handle);
std::shared_ptr<Event> evt = kernel.GetCurrentProcess()->handle_table.Get<Event>(handle); std::shared_ptr<Event> evt = kernel.GetCurrentProcess()->handle_table.Get<Event>(handle);
R_UNLESS(evt, ERR_INVALID_HANDLE); R_UNLESS(evt, ResultInvalidHandle);
evt->Signal(); evt->Signal();
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Clears an event /// Clears an event
@ -1457,10 +1457,10 @@ Result SVC::ClearEvent(Handle handle) {
LOG_TRACE(Kernel_SVC, "called event=0x{:08X}", handle); LOG_TRACE(Kernel_SVC, "called event=0x{:08X}", handle);
std::shared_ptr<Event> evt = kernel.GetCurrentProcess()->handle_table.Get<Event>(handle); std::shared_ptr<Event> evt = kernel.GetCurrentProcess()->handle_table.Get<Event>(handle);
R_UNLESS(evt, ERR_INVALID_HANDLE); R_UNLESS(evt, ResultInvalidHandle);
evt->Clear(); evt->Clear();
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Creates a timer /// Creates a timer
@ -1485,24 +1485,24 @@ Result SVC::ClearTimer(Handle handle) {
LOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle); LOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle);
std::shared_ptr<Timer> timer = kernel.GetCurrentProcess()->handle_table.Get<Timer>(handle); std::shared_ptr<Timer> timer = kernel.GetCurrentProcess()->handle_table.Get<Timer>(handle);
R_UNLESS(timer, ERR_INVALID_HANDLE); R_UNLESS(timer, ResultInvalidHandle);
timer->Clear(); timer->Clear();
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Starts a timer /// Starts a timer
Result SVC::SetTimer(Handle handle, s64 initial, s64 interval) { Result SVC::SetTimer(Handle handle, s64 initial, s64 interval) {
LOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle); LOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle);
R_UNLESS(initial >= 0 && interval >= 0, ERR_OUT_OF_RANGE_KERNEL); R_UNLESS(initial >= 0 && interval >= 0, ResultOutOfRangeKernel);
std::shared_ptr<Timer> timer = kernel.GetCurrentProcess()->handle_table.Get<Timer>(handle); std::shared_ptr<Timer> timer = kernel.GetCurrentProcess()->handle_table.Get<Timer>(handle);
R_UNLESS(timer, ERR_INVALID_HANDLE); R_UNLESS(timer, ResultInvalidHandle);
timer->Set(initial, interval); timer->Set(initial, interval);
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Cancels a timer /// Cancels a timer
@ -1510,10 +1510,10 @@ Result SVC::CancelTimer(Handle handle) {
LOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle); LOG_TRACE(Kernel_SVC, "called timer=0x{:08X}", handle);
std::shared_ptr<Timer> timer = kernel.GetCurrentProcess()->handle_table.Get<Timer>(handle); std::shared_ptr<Timer> timer = kernel.GetCurrentProcess()->handle_table.Get<Timer>(handle);
R_UNLESS(timer, ERR_INVALID_HANDLE); R_UNLESS(timer, ResultInvalidHandle);
timer->Cancel(); timer->Cancel();
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Sleep the current thread /// Sleep the current thread
@ -1550,7 +1550,7 @@ s64 SVC::GetSystemTick() {
// Returns information of the specified handle // Returns information of the specified handle
Result SVC::GetHandleInfo(s64* out, Handle handle, u32 type) { Result SVC::GetHandleInfo(s64* out, Handle handle, u32 type) {
std::shared_ptr<Object> object = kernel.GetCurrentProcess()->handle_table.GetGeneric(handle); std::shared_ptr<Object> object = kernel.GetCurrentProcess()->handle_table.GetGeneric(handle);
R_UNLESS(object, ERR_INVALID_HANDLE); R_UNLESS(object, ResultInvalidHandle);
// Not initialized in real kernel, but we don't want to leak memory. // Not initialized in real kernel, but we don't want to leak memory.
s64 value = 0; s64 value = 0;
@ -1573,16 +1573,16 @@ Result SVC::GetHandleInfo(s64* out, Handle handle, u32 type) {
case HandleInfoType::STUBBED_2: case HandleInfoType::STUBBED_2:
break; break;
default: default:
return ERR_INVALID_ENUM_VALUE; return ResultInvalidEnumValue;
} }
*out = value; *out = value;
return RESULT_SUCCESS; return ResultSuccess;
} }
/// Creates a memory block at the specified address with the specified permissions and size /// Creates a memory block at the specified address with the specified permissions and size
Result SVC::CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my_permission, Result SVC::CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my_permission,
u32 other_permission) { u32 other_permission) {
R_UNLESS(size % Memory::CITRA_PAGE_SIZE == 0, ERR_MISALIGNED_SIZE); R_UNLESS(size % Memory::CITRA_PAGE_SIZE == 0, ResultMisalignedSize);
std::shared_ptr<SharedMemory> shared_memory = nullptr; std::shared_ptr<SharedMemory> shared_memory = nullptr;
@ -1601,16 +1601,16 @@ Result SVC::CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my_per
}; };
R_UNLESS(VerifyPermissions(static_cast<MemoryPermission>(my_permission)), R_UNLESS(VerifyPermissions(static_cast<MemoryPermission>(my_permission)),
ERR_INVALID_COMBINATION); ResultInvalidCombination);
R_UNLESS(VerifyPermissions(static_cast<MemoryPermission>(other_permission)), R_UNLESS(VerifyPermissions(static_cast<MemoryPermission>(other_permission)),
ERR_INVALID_COMBINATION); ResultInvalidCombination);
// TODO(Subv): Processes with memory type APPLICATION are not allowed // TODO(Subv): Processes with memory type APPLICATION are not allowed
// to create memory blocks with addr = 0, any attempts to do so // to create memory blocks with addr = 0, any attempts to do so
// should return error 0xD92007EA. // should return error 0xD92007EA.
if ((addr < Memory::PROCESS_IMAGE_VADDR || addr + size > Memory::SHARED_MEMORY_VADDR_END) && if ((addr < Memory::PROCESS_IMAGE_VADDR || addr + size > Memory::SHARED_MEMORY_VADDR_END) &&
addr != 0) { addr != 0) {
return ERR_INVALID_ADDRESS; return ResultInvalidAddress;
} }
// Update shared memory count in resource limit. // Update shared memory count in resource limit.
@ -1656,7 +1656,7 @@ Result SVC::CreateSessionToPort(Handle* out_client_session, Handle client_port_h
std::shared_ptr<Process> current_process = kernel.GetCurrentProcess(); std::shared_ptr<Process> current_process = kernel.GetCurrentProcess();
std::shared_ptr<ClientPort> client_port = std::shared_ptr<ClientPort> client_port =
current_process->handle_table.Get<ClientPort>(client_port_handle); current_process->handle_table.Get<ClientPort>(client_port_handle);
R_UNLESS(client_port, ERR_INVALID_HANDLE); R_UNLESS(client_port, ResultInvalidHandle);
std::shared_ptr<ClientSession> session; std::shared_ptr<ClientSession> session;
R_TRY(client_port->Connect(session)); R_TRY(client_port->Connect(session));
@ -1678,7 +1678,7 @@ Result SVC::AcceptSession(Handle* out_server_session, Handle server_port_handle)
std::shared_ptr<Process> current_process = kernel.GetCurrentProcess(); std::shared_ptr<Process> current_process = kernel.GetCurrentProcess();
std::shared_ptr<ServerPort> server_port = std::shared_ptr<ServerPort> server_port =
current_process->handle_table.Get<ServerPort>(server_port_handle); current_process->handle_table.Get<ServerPort>(server_port_handle);
R_UNLESS(server_port, ERR_INVALID_HANDLE); R_UNLESS(server_port, ResultInvalidHandle);
std::shared_ptr<ServerSession> session; std::shared_ptr<ServerSession> session;
R_TRY(server_port->Accept(session)); R_TRY(server_port->Accept(session));
@ -1734,7 +1734,7 @@ Result SVC::GetSystemInfo(s64* out, u32 type, s32 param) {
// this doesn't return an error in n3ds to know the system type // this doesn't return an error in n3ds to know the system type
LOG_ERROR(Kernel_SVC, "unimplemented GetSystemInfo type=65537 param={}", param); LOG_ERROR(Kernel_SVC, "unimplemented GetSystemInfo type=65537 param={}", param);
*out = 0; *out = 0;
return (system.GetNumCores() == 4) ? RESULT_SUCCESS : ERR_INVALID_ENUM_VALUE; return (system.GetNumCores() == 4) ? ResultSuccess : ResultInvalidEnumValue;
case SystemInfoType::CITRA_INFORMATION: case SystemInfoType::CITRA_INFORMATION:
switch ((SystemInfoCitraInformation)param) { switch ((SystemInfoCitraInformation)param) {
case SystemInfoCitraInformation::IS_CITRA: case SystemInfoCitraInformation::IS_CITRA:
@ -1791,7 +1791,7 @@ Result SVC::GetSystemInfo(s64* out, u32 type, s32 param) {
} }
// This function never returns an error, even if invalid parameters were passed. // This function never returns an error, even if invalid parameters were passed.
return RESULT_SUCCESS; return ResultSuccess;
} }
Result SVC::GetProcessInfo(s64* out, Handle process_handle, u32 type) { Result SVC::GetProcessInfo(s64* out, Handle process_handle, u32 type) {
@ -1799,7 +1799,7 @@ Result SVC::GetProcessInfo(s64* out, Handle process_handle, u32 type) {
std::shared_ptr<Process> process = std::shared_ptr<Process> process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle); kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle);
R_UNLESS(process, ERR_INVALID_HANDLE); R_UNLESS(process, ResultInvalidHandle);
switch (static_cast<ProcessInfoType>(type)) { switch (static_cast<ProcessInfoType>(type)) {
case ProcessInfoType::PRIVATE_AND_SHARED_USED_MEMORY: case ProcessInfoType::PRIVATE_AND_SHARED_USED_MEMORY:
@ -1809,7 +1809,7 @@ Result SVC::GetProcessInfo(s64* out, Handle process_handle, u32 type) {
*out = process->memory_used; *out = process->memory_used;
if (*out % Memory::CITRA_PAGE_SIZE != 0) { if (*out % Memory::CITRA_PAGE_SIZE != 0) {
LOG_ERROR(Kernel_SVC, "called, memory size not page-aligned"); LOG_ERROR(Kernel_SVC, "called, memory size not page-aligned");
return ERR_MISALIGNED_SIZE; return ResultMisalignedSize;
} }
break; break;
case ProcessInfoType::SUPERVISOR_AND_HANDLE_USED_MEMORY: case ProcessInfoType::SUPERVISOR_AND_HANDLE_USED_MEMORY:
@ -1830,7 +1830,7 @@ Result SVC::GetProcessInfo(s64* out, Handle process_handle, u32 type) {
case ProcessInfoType::QTM_MEMORY_SIZE: case ProcessInfoType::QTM_MEMORY_SIZE:
// These return a different error value than higher invalid values // These return a different error value than higher invalid values
LOG_ERROR(Kernel_SVC, "unknown GetProcessInfo type={}", type); LOG_ERROR(Kernel_SVC, "unknown GetProcessInfo type={}", type);
return ERR_NOT_IMPLEMENTED; return ResultNotImplemented;
// Here start the custom ones, taken from Luma3DS for 3GX support // Here start the custom ones, taken from Luma3DS for 3GX support
case ProcessInfoType::LUMA_CUSTOM_PROCESS_NAME: case ProcessInfoType::LUMA_CUSTOM_PROCESS_NAME:
// Get process name // Get process name
@ -1861,10 +1861,10 @@ Result SVC::GetProcessInfo(s64* out, Handle process_handle, u32 type) {
default: default:
LOG_ERROR(Kernel_SVC, "unknown GetProcessInfo type={}", type); LOG_ERROR(Kernel_SVC, "unknown GetProcessInfo type={}", type);
return ERR_INVALID_ENUM_VALUE; return ResultInvalidEnumValue;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result SVC::GetThreadInfo(s64* out, Handle thread_handle, u32 type) { Result SVC::GetThreadInfo(s64* out, Handle thread_handle, u32 type) {
@ -1872,7 +1872,7 @@ Result SVC::GetThreadInfo(s64* out, Handle thread_handle, u32 type) {
std::shared_ptr<Thread> thread = std::shared_ptr<Thread> thread =
kernel.GetCurrentProcess()->handle_table.Get<Thread>(thread_handle); kernel.GetCurrentProcess()->handle_table.Get<Thread>(thread_handle);
R_UNLESS(thread, ERR_INVALID_HANDLE); R_UNLESS(thread, ResultInvalidHandle);
switch (type) { switch (type) {
case 0x10000: case 0x10000:
@ -1880,16 +1880,16 @@ Result SVC::GetThreadInfo(s64* out, Handle thread_handle, u32 type) {
break; break;
default: default:
LOG_ERROR(Kernel_SVC, "unknown GetThreadInfo type={}", type); LOG_ERROR(Kernel_SVC, "unknown GetThreadInfo type={}", type);
return ERR_INVALID_ENUM_VALUE; return ResultInvalidEnumValue;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result SVC::GetProcessList(s32* process_count, VAddr out_process_array, Result SVC::GetProcessList(s32* process_count, VAddr out_process_array,
s32 out_process_array_count) { s32 out_process_array_count) {
R_UNLESS(memory.IsValidVirtualAddress(*kernel.GetCurrentProcess(), out_process_array), R_UNLESS(memory.IsValidVirtualAddress(*kernel.GetCurrentProcess(), out_process_array),
ERR_INVALID_POINTER); ResultInvalidPointer);
s32 written = 0; s32 written = 0;
for (const auto& process : kernel.GetProcessList()) { for (const auto& process : kernel.GetProcessList()) {
@ -1901,17 +1901,17 @@ Result SVC::GetProcessList(s32* process_count, VAddr out_process_array,
} }
} }
*process_count = written; *process_count = written;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result SVC::InvalidateInstructionCacheRange(u32 addr, u32 size) { Result SVC::InvalidateInstructionCacheRange(u32 addr, u32 size) {
system.GetRunningCore().InvalidateCacheRange(addr, size); system.GetRunningCore().InvalidateCacheRange(addr, size);
return RESULT_SUCCESS; return ResultSuccess;
} }
Result SVC::InvalidateEntireInstructionCache() { Result SVC::InvalidateEntireInstructionCache() {
system.GetRunningCore().ClearInstructionCache(); system.GetRunningCore().ClearInstructionCache();
return RESULT_SUCCESS; return ResultSuccess;
} }
u32 SVC::ConvertVaToPa(u32 addr) { u32 SVC::ConvertVaToPa(u32 addr) {
@ -1932,7 +1932,7 @@ Result SVC::MapProcessMemoryEx(Handle dst_process_handle, u32 dst_address,
std::shared_ptr<Process> src_process = std::shared_ptr<Process> src_process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(src_process_handle); kernel.GetCurrentProcess()->handle_table.Get<Process>(src_process_handle);
R_UNLESS(dst_process && src_process, ERR_INVALID_HANDLE); R_UNLESS(dst_process && src_process, ResultInvalidHandle);
if (size & 0xFFF) { if (size & 0xFFF) {
size = (size & ~0xFFF) + Memory::CITRA_PAGE_SIZE; size = (size & ~0xFFF) + Memory::CITRA_PAGE_SIZE;
@ -1943,10 +1943,10 @@ Result SVC::MapProcessMemoryEx(Handle dst_process_handle, u32 dst_address,
R_UNLESS(vma != src_process->vm_manager.vma_map.end() && R_UNLESS(vma != src_process->vm_manager.vma_map.end() &&
vma->second.type == VMAType::BackingMemory && vma->second.type == VMAType::BackingMemory &&
vma->second.meminfo_state == MemoryState::Continuous, vma->second.meminfo_state == MemoryState::Continuous,
ERR_INVALID_ADDRESS); ResultInvalidAddress);
const u32 offset = src_address - vma->second.base; const u32 offset = src_address - vma->second.base;
R_UNLESS(offset + size <= vma->second.size, ERR_INVALID_ADDRESS); R_UNLESS(offset + size <= vma->second.size, ResultInvalidAddress);
auto vma_res = dst_process->vm_manager.MapBackingMemory( auto vma_res = dst_process->vm_manager.MapBackingMemory(
dst_address, dst_address,
@ -1955,17 +1955,17 @@ Result SVC::MapProcessMemoryEx(Handle dst_process_handle, u32 dst_address,
size, Kernel::MemoryState::Continuous); size, Kernel::MemoryState::Continuous);
if (!vma_res.Succeeded()) { if (!vma_res.Succeeded()) {
return ERR_INVALID_ADDRESS_STATE; return ResultInvalidAddressState;
} }
dst_process->vm_manager.Reprotect(vma_res.Unwrap(), Kernel::VMAPermission::ReadWriteExecute); dst_process->vm_manager.Reprotect(vma_res.Unwrap(), Kernel::VMAPermission::ReadWriteExecute);
return RESULT_SUCCESS; return ResultSuccess;
} }
Result SVC::UnmapProcessMemoryEx(Handle process, u32 dst_address, u32 size) { Result SVC::UnmapProcessMemoryEx(Handle process, u32 dst_address, u32 size) {
std::shared_ptr<Process> dst_process = std::shared_ptr<Process> dst_process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(process); kernel.GetCurrentProcess()->handle_table.Get<Process>(process);
R_UNLESS(dst_process, ERR_INVALID_HANDLE); R_UNLESS(dst_process, ResultInvalidHandle);
if (size & 0xFFF) { if (size & 0xFFF) {
size = (size & ~0xFFF) + Memory::CITRA_PAGE_SIZE; size = (size & ~0xFFF) + Memory::CITRA_PAGE_SIZE;
@ -1976,16 +1976,16 @@ Result SVC::UnmapProcessMemoryEx(Handle process, u32 dst_address, u32 size) {
R_UNLESS(vma != dst_process->vm_manager.vma_map.end() && R_UNLESS(vma != dst_process->vm_manager.vma_map.end() &&
vma->second.type == VMAType::BackingMemory && vma->second.type == VMAType::BackingMemory &&
vma->second.meminfo_state == MemoryState::Continuous, vma->second.meminfo_state == MemoryState::Continuous,
ERR_INVALID_ADDRESS); ResultInvalidAddress);
dst_process->vm_manager.UnmapRange(dst_address, size); dst_process->vm_manager.UnmapRange(dst_address, size);
return RESULT_SUCCESS; return ResultSuccess;
} }
Result SVC::ControlProcess(Handle process_handle, u32 process_OP, u32 varg2, u32 varg3) { Result SVC::ControlProcess(Handle process_handle, u32 process_OP, u32 varg2, u32 varg3) {
std::shared_ptr<Process> process = std::shared_ptr<Process> process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle); kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle);
R_UNLESS(process, ERR_INVALID_HANDLE); R_UNLESS(process, ResultInvalidHandle);
switch (static_cast<ControlProcessOP>(process_OP)) { switch (static_cast<ControlProcessOP>(process_OP)) {
case ControlProcessOP::PROCESSOP_SET_MMU_TO_RWX: { case ControlProcessOP::PROCESSOP_SET_MMU_TO_RWX: {
@ -1994,11 +1994,11 @@ Result SVC::ControlProcess(Handle process_handle, u32 process_OP, u32 varg2, u32
if (it->second.meminfo_state != MemoryState::Free) if (it->second.meminfo_state != MemoryState::Free)
process->vm_manager.Reprotect(it, Kernel::VMAPermission::ReadWriteExecute); process->vm_manager.Reprotect(it, Kernel::VMAPermission::ReadWriteExecute);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
case ControlProcessOP::PROCESSOP_GET_ON_MEMORY_CHANGE_EVENT: { case ControlProcessOP::PROCESSOP_GET_ON_MEMORY_CHANGE_EVENT: {
auto plgldr = Service::PLGLDR::GetService(system); auto plgldr = Service::PLGLDR::GetService(system);
R_UNLESS(plgldr, ERR_NOT_FOUND); R_UNLESS(plgldr, ResultNotFound);
ResultVal<Handle> out = plgldr->GetMemoryChangedHandle(kernel); ResultVal<Handle> out = plgldr->GetMemoryChangedHandle(kernel);
if (out.Failed()) { if (out.Failed()) {
@ -2006,7 +2006,7 @@ Result SVC::ControlProcess(Handle process_handle, u32 process_OP, u32 varg2, u32
} }
memory.Write32(varg2, out.Unwrap()); memory.Write32(varg2, out.Unwrap());
return RESULT_SUCCESS; return ResultSuccess;
} }
case ControlProcessOP::PROCESSOP_SCHEDULE_THREADS_WITHOUT_TLS_MAGIC: { case ControlProcessOP::PROCESSOP_SCHEDULE_THREADS_WITHOUT_TLS_MAGIC: {
for (u32 core_id = 0; core_id < system.GetNumCores(); core_id++) { for (u32 core_id = 0; core_id < system.GetNumCores(); core_id++) {
@ -2025,11 +2025,11 @@ Result SVC::ControlProcess(Handle process_handle, u32 process_OP, u32 varg2, u32
thread.get()->can_schedule = !varg2; thread.get()->can_schedule = !varg2;
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
case ControlProcessOP::PROCESSOP_DISABLE_CREATE_THREAD_RESTRICTIONS: { case ControlProcessOP::PROCESSOP_DISABLE_CREATE_THREAD_RESTRICTIONS: {
process->no_thread_restrictions = varg2 == 1; process->no_thread_restrictions = varg2 == 1;
return RESULT_SUCCESS; return ResultSuccess;
} }
case ControlProcessOP::PROCESSOP_GET_ALL_HANDLES: case ControlProcessOP::PROCESSOP_GET_ALL_HANDLES:
case ControlProcessOP::PROCESSOP_GET_PA_FROM_VA: case ControlProcessOP::PROCESSOP_GET_PA_FROM_VA:
@ -2037,7 +2037,7 @@ Result SVC::ControlProcess(Handle process_handle, u32 process_OP, u32 varg2, u32
case ControlProcessOP::PROCESSOP_SCHEDULE_THREADS: case ControlProcessOP::PROCESSOP_SCHEDULE_THREADS:
default: default:
LOG_ERROR(Kernel_SVC, "Unknown ControlProcessOp type={}", process_OP); LOG_ERROR(Kernel_SVC, "Unknown ControlProcessOp type={}", process_OP);
return ERR_NOT_IMPLEMENTED; return ResultNotImplemented;
} }
} }

View File

@ -332,12 +332,12 @@ ResultVal<std::shared_ptr<Thread>> KernelSystem::CreateThread(
// Check if priority is in ranged. Lowest priority -> highest priority id. // Check if priority is in ranged. Lowest priority -> highest priority id.
if (priority > ThreadPrioLowest) { if (priority > ThreadPrioLowest) {
LOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority); LOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority);
return ERR_OUT_OF_RANGE; return ResultOutOfRange;
} }
if (processor_id > ThreadProcessorIdMax) { if (processor_id > ThreadProcessorIdMax) {
LOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id); LOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id);
return ERR_OUT_OF_RANGE_KERNEL; return ResultOutOfRangeKernel;
} }
// TODO(yuriks): Other checks, returning 0xD9001BEA // TODO(yuriks): Other checks, returning 0xD9001BEA

View File

@ -118,7 +118,7 @@ Result VMManager::ChangeMemoryState(VAddr target, u32 size, MemoryState expected
VMAPermission expected_perms, MemoryState new_state, VMAPermission expected_perms, MemoryState new_state,
VMAPermission new_perms) { VMAPermission new_perms) {
if (is_locked) { if (is_locked) {
return RESULT_SUCCESS; return ResultSuccess;
} }
VAddr target_end = target + size; VAddr target_end = target + size;
@ -126,16 +126,16 @@ Result VMManager::ChangeMemoryState(VAddr target, u32 size, MemoryState expected
VMAIter i_end = vma_map.lower_bound(target_end); VMAIter i_end = vma_map.lower_bound(target_end);
if (begin_vma == vma_map.end()) if (begin_vma == vma_map.end())
return ERR_INVALID_ADDRESS; return ResultInvalidAddress;
for (auto i = begin_vma; i != i_end; ++i) { for (auto i = begin_vma; i != i_end; ++i) {
auto& vma = i->second; auto& vma = i->second;
if (vma.meminfo_state != expected_state) { if (vma.meminfo_state != expected_state) {
return ERR_INVALID_ADDRESS_STATE; return ResultInvalidAddressState;
} }
u32 perms = static_cast<u32>(expected_perms); u32 perms = static_cast<u32>(expected_perms);
if ((static_cast<u32>(vma.permissions) & perms) != perms) { if ((static_cast<u32>(vma.permissions) & perms) != perms) {
return ERR_INVALID_ADDRESS_STATE; return ResultInvalidAddressState;
} }
} }
@ -151,7 +151,7 @@ Result VMManager::ChangeMemoryState(VAddr target, u32 size, MemoryState expected
vma = std::next(MergeAdjacent(vma)); vma = std::next(MergeAdjacent(vma));
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
VMManager::VMAIter VMManager::Unmap(VMAIter vma_handle) { VMManager::VMAIter VMManager::Unmap(VMAIter vma_handle) {
@ -182,7 +182,7 @@ Result VMManager::UnmapRange(VAddr target, u32 size) {
} }
ASSERT(FindVMA(target)->second.size >= size); ASSERT(FindVMA(target)->second.size >= size);
return RESULT_SUCCESS; return ResultSuccess;
} }
VMManager::VMAHandle VMManager::Reprotect(VMAHandle vma_handle, VMAPermission new_perms) { VMManager::VMAHandle VMManager::Reprotect(VMAHandle vma_handle, VMAPermission new_perms) {
@ -210,7 +210,7 @@ Result VMManager::ReprotectRange(VAddr target, u32 size, VMAPermission new_perms
vma = std::next(StripIterConstness(Reprotect(vma, new_perms))); vma = std::next(StripIterConstness(Reprotect(vma, new_perms)));
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
void VMManager::LogLayout(Common::Log::Level log_level) const { 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)); VMAIter vma_handle = StripIterConstness(FindVMA(base));
if (vma_handle == vma_map.end()) { if (vma_handle == vma_map.end()) {
// Target address is outside the range managed by the kernel // Target address is outside the range managed by the kernel
return ERR_INVALID_ADDRESS; return ResultInvalidAddress;
} }
const VirtualMemoryArea& vma = vma_handle->second; const VirtualMemoryArea& vma = vma_handle->second;
if (vma.type != VMAType::Free) { if (vma.type != VMAType::Free) {
// Region is already allocated // Region is already allocated
return ERR_INVALID_ADDRESS_STATE; return ResultInvalidAddressState;
} }
const VAddr start_in_vma = base - vma.base; 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) { if (end_in_vma > vma.size) {
// Requested allocation doesn't fit inside VMA // Requested allocation doesn't fit inside VMA
return ERR_INVALID_ADDRESS_STATE; return ResultInvalidAddressState;
} }
if (end_in_vma != vma.size) { 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); const VMAIter i_end = vma_map.lower_bound(target_end);
if (std::any_of(begin_vma, i_end, if (std::any_of(begin_vma, i_end,
[](const auto& entry) { return entry.second.type == VMAType::Free; })) { [](const auto& entry) { return entry.second.type == VMAType::Free; })) {
return ERR_INVALID_ADDRESS_STATE; return ResultInvalidAddressState;
} }
if (target != begin_vma->second.base) { if (target != begin_vma->second.base) {
@ -367,7 +367,7 @@ ResultVal<std::vector<std::pair<MemoryRef, u32>>> VMManager::GetBackingBlocksFor
auto vma = FindVMA(interval_target); auto vma = FindVMA(interval_target);
if (vma->second.type != VMAType::BackingMemory) { if (vma->second.type != VMAType::BackingMemory) {
LOG_ERROR(Kernel, "Trying to use already freed memory"); 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); VAddr interval_end = std::min(address + size, vma->second.base + vma->second.size);

View File

@ -245,7 +245,7 @@ constexpr bool operator!=(const Result& a, const Result& b) {
// Convenience functions for creating some common kinds of errors: // Convenience functions for creating some common kinds of errors:
/// The default success `Result`. /// The default success `Result`.
constexpr Result RESULT_SUCCESS(0); constexpr Result ResultSuccess(0);
/// Might be returned instead of a dummy success for unimplemented APIs. /// Might be returned instead of a dummy success for unimplemented APIs.
constexpr Result UnimplementedFunction(ErrorModule module) { constexpr Result UnimplementedFunction(ErrorModule module) {
@ -259,7 +259,7 @@ constexpr Result UnimplementedFunction(ErrorModule module) {
* @note This should only be used when a particular error code * @note This should only be used when a particular error code
* is not known yet. * is not known yet.
*/ */
constexpr Result RESULT_UNKNOWN(UINT32_MAX); constexpr Result ResultUnknown(std::numeric_limits<u32>::max());
/** /**
* This is an optional value type. It holds a `Result` and, if that code is ResultSuccess, it * This is an optional value type. It holds a `Result` and, if that code is ResultSuccess, it
@ -318,7 +318,7 @@ public:
} }
[[nodiscard]] constexpr Result Code() const { [[nodiscard]] constexpr Result Code() const {
return expected.has_value() ? RESULT_SUCCESS : expected.error(); return expected.has_value() ? ResultSuccess : expected.error();
} }
[[nodiscard]] constexpr bool Succeeded() const { [[nodiscard]] constexpr bool Succeeded() const {
@ -430,7 +430,7 @@ private:
} }
/// Evaluates a boolean expression, and succeeds if that expression is true. /// Evaluates a boolean expression, and succeeds if that expression is true.
#define R_SUCCEED_IF(expr) R_UNLESS(!(expr), RESULT_SUCCESS) #define R_SUCCEED_IF(expr) R_UNLESS(!(expr), ResultSuccess)
/// Evaluates a boolean expression, and asserts if that expression is false. /// Evaluates a boolean expression, and asserts if that expression is false.
#define R_ASSERT(expr) ASSERT(R_SUCCEEDED(expr)) #define R_ASSERT(expr) ASSERT(R_SUCCEEDED(expr))

View File

@ -28,7 +28,7 @@ void Module::Interface::CreateDefaultConfig(Kernel::HLERequestContext& ctx) {
std::memcpy(buffer.data(), &ac->default_config, buffer.size()); std::memcpy(buffer.data(), &ac->default_config, buffer.size());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushStaticBuffer(std::move(buffer), 0); rb.PushStaticBuffer(std::move(buffer), 0);
LOG_WARNING(Service_AC, "(STUBBED) called"); LOG_WARNING(Service_AC, "(STUBBED) called");
@ -48,7 +48,7 @@ void Module::Interface::ConnectAsync(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_AC, "(STUBBED) called"); LOG_WARNING(Service_AC, "(STUBBED) called");
} }
@ -58,7 +58,7 @@ void Module::Interface::GetConnectResult(Kernel::HLERequestContext& ctx) {
rp.Skip(2, false); // ProcessId descriptor rp.Skip(2, false); // ProcessId descriptor
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::Interface::CloseAsync(Kernel::HLERequestContext& ctx) { void Module::Interface::CloseAsync(Kernel::HLERequestContext& ctx) {
@ -79,7 +79,7 @@ void Module::Interface::CloseAsync(Kernel::HLERequestContext& ctx) {
ac->ac_connected = false; ac->ac_connected = false;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::Interface::GetCloseResult(Kernel::HLERequestContext& ctx) { void Module::Interface::GetCloseResult(Kernel::HLERequestContext& ctx) {
@ -87,7 +87,7 @@ void Module::Interface::GetCloseResult(Kernel::HLERequestContext& ctx) {
rp.Skip(2, false); // ProcessId descriptor rp.Skip(2, false); // ProcessId descriptor
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_AC, "(STUBBED) called"); LOG_WARNING(Service_AC, "(STUBBED) called");
} }
@ -102,7 +102,7 @@ void Module::Interface::GetWifiStatus(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); 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 rb.Push<u32>(static_cast<u32>(can_reach_internet ? (Settings::values.is_new_3ds
? WifiStatus::STATUS_CONNECTED_N3DS ? WifiStatus::STATUS_CONNECTED_N3DS
: WifiStatus::STATUS_CONNECTED_O3DS) : 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(); [[maybe_unused]] const std::vector<u8>& ac_config = rp.PopStaticBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); // Infra Priority, default 0 rb.Push<u32>(0); // Infra Priority, default 0
LOG_WARNING(Service_AC, "(STUBBED) called"); 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. // TODO(Subv): Copy over the input ACConfig to the stored ACConfig.
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushStaticBuffer(std::move(ac_config), 0); rb.PushStaticBuffer(std::move(ac_config), 0);
LOG_WARNING(Service_AC, "(STUBBED) called, major={}, minor={}", major, minor); 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); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_AC, "(STUBBED) called"); LOG_WARNING(Service_AC, "(STUBBED) called");
} }
@ -157,7 +157,7 @@ void Module::Interface::GetConnectingProxyEnable(Kernel::HLERequestContext& ctx)
constexpr bool proxy_enabled = false; constexpr bool proxy_enabled = false;
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(proxy_enabled); rb.Push(proxy_enabled);
LOG_WARNING(Service_AC, "(STUBBED) called"); LOG_WARNING(Service_AC, "(STUBBED) called");
@ -170,7 +170,7 @@ void Module::Interface::IsConnected(Kernel::HLERequestContext& ctx) {
u32 unk_param = rp.Pop<u32>(); u32 unk_param = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ac->ac_connected); rb.Push(ac->ac_connected);
LOG_WARNING(Service_AC, "(STUBBED) called unk=0x{:08X} descriptor=0x{:08X} param=0x{:08X}", unk, 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); LOG_WARNING(Service_AC, "(STUBBED) called, version: 0x{:08X}", version);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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) Module::Interface::Interface(std::shared_ptr<Module> ac, const char* name, u32 max_session)

View File

@ -28,7 +28,7 @@ void Module::Interface::Initialize(Kernel::HLERequestContext& ctx) {
sdk_version, shared_memory_size, caller_pid); sdk_version, shared_memory_size, caller_pid);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::Interface::GetAccountDataBlock(Kernel::HLERequestContext& ctx) { void Module::Interface::GetAccountDataBlock(Kernel::HLERequestContext& ctx) {
@ -42,7 +42,7 @@ void Module::Interface::GetAccountDataBlock(Kernel::HLERequestContext& ctx) {
size, block_id); size, block_id);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void InstallInterfaces(Core::System& system) { void InstallInterfaces(Core::System& system) {

View File

@ -105,7 +105,7 @@ Result CIAFile::WriteTicket() {
// TODO: Write out .tik files to nand? // TODO: Write out .tik files to nand?
install_state = CIAInstallState::TicketLoaded; install_state = CIAInstallState::TicketLoaded;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CIAFile::WriteTitleMetadata() { Result CIAFile::WriteTitleMetadata() {
@ -138,7 +138,7 @@ Result CIAFile::WriteTitleMetadata() {
if (tmd.Save(tmd_path) != Loader::ResultStatus::Success) { if (tmd.Save(tmd_path) != Loader::ResultStatus::Success) {
LOG_ERROR(Service_AM, "Failed to install title metadata file from CIA."); LOG_ERROR(Service_AM, "Failed to install title metadata file from CIA.");
// TODO: Correct result code. // TODO: Correct result code.
return FileSys::ERROR_FILE_NOT_FOUND; return FileSys::ResultFileNotFound;
} }
// Create any other .app folders which may not exist yet // Create any other .app folders which may not exist yet
@ -158,7 +158,7 @@ Result CIAFile::WriteTitleMetadata() {
if (!file.IsOpen()) { if (!file.IsOpen()) {
LOG_ERROR(Service_AM, "Could not open output file '{}' for content {}.", path, i); LOG_ERROR(Service_AM, "Could not open output file '{}' for content {}.", path, i);
// TODO: Correct error code. // TODO: Correct error code.
return FileSys::ERROR_FILE_NOT_FOUND; return FileSys::ResultFileNotFound;
} }
} }
@ -173,7 +173,7 @@ Result CIAFile::WriteTitleMetadata() {
} else { } else {
LOG_ERROR(Service_AM, "Could not read title key from ticket for encrypted CIA."); LOG_ERROR(Service_AM, "Could not read title key from ticket for encrypted CIA.");
// TODO: Correct error code. // TODO: Correct error code.
return FileSys::ERROR_FILE_NOT_FOUND; return FileSys::ResultFileNotFound;
} }
} else { } else {
LOG_INFO(Service_AM, LOG_INFO(Service_AM,
@ -182,7 +182,7 @@ Result CIAFile::WriteTitleMetadata() {
install_state = CIAInstallState::TMDLoaded; install_state = CIAInstallState::TMDLoaded;
return RESULT_SUCCESS; return ResultSuccess;
} }
ResultVal<std::size_t> CIAFile::WriteContentData(u64 offset, std::size_t length, const u8* buffer) { 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>(); u32 media_type = rp.Pop<u8>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); 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())); rb.Push<u32>(static_cast<u32>(am->am_title_list[media_type].size()));
} }
@ -836,7 +836,7 @@ void Module::Interface::FindDLCContentInfos(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4); IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(content_requested_in); rb.PushMappedBuffer(content_requested_in);
rb.PushMappedBuffer(content_info_out); rb.PushMappedBuffer(content_info_out);
} }
@ -889,7 +889,7 @@ void Module::Interface::ListDLCContentInfos(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(copied); rb.Push(copied);
rb.PushMappedBuffer(content_info_out); rb.PushMappedBuffer(content_info_out);
} }
@ -902,7 +902,7 @@ void Module::Interface::DeleteContents(Kernel::HLERequestContext& ctx) {
auto& content_ids_in = rp.PopMappedBuffer(); auto& content_ids_in = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(content_ids_in); rb.PushMappedBuffer(content_ids_in);
LOG_WARNING(Service_AM, "(STUBBED) media_type={}, title_id=0x{:016x}, content_count={}", LOG_WARNING(Service_AM, "(STUBBED) media_type={}, title_id=0x{:016x}, content_count={}",
media_type, title_id, content_count); media_type, title_id, content_count);
@ -929,7 +929,7 @@ void Module::Interface::GetProgramList(Kernel::HLERequestContext& ctx) {
title_ids_output.Write(am->am_title_list[media_type].data(), 0, copied * sizeof(u64)); title_ids_output.Write(am->am_title_list[media_type].data(), 0, copied * sizeof(u64));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(copied); rb.Push(copied);
rb.PushMappedBuffer(title_ids_output); rb.PushMappedBuffer(title_ids_output);
} }
@ -958,7 +958,7 @@ Result GetTitleInfoFromList(std::span<const u64> title_id_list, Service::FS::Med
write_offset += sizeof(TitleInfo); write_offset += sizeof(TitleInfo);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
void Module::Interface::GetProgramInfos(Kernel::HLERequestContext& ctx) { void Module::Interface::GetProgramInfos(Kernel::HLERequestContext& ctx) {
@ -1007,7 +1007,7 @@ void Module::Interface::DeleteUserProgram(Kernel::HLERequestContext& ctx) {
} }
bool success = FileUtil::DeleteDirRecursively(path); bool success = FileUtil::DeleteDirRecursively(path);
am->ScanForAllTitles(); am->ScanForAllTitles();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
if (!success) if (!success)
LOG_ERROR(Service_AM, "FileUtil::DeleteDirRecursively unexpectedly failed"); LOG_ERROR(Service_AM, "FileUtil::DeleteDirRecursively unexpectedly failed");
} }
@ -1033,7 +1033,7 @@ void Module::Interface::GetProductCode(Kernel::HLERequestContext& ctx) {
FileSys::NCCHContainer ncch(path); FileSys::NCCHContainer ncch(path);
ncch.Load(); ncch.Load();
std::memcpy(&product_code.code, &ncch.ncch_header.product_code, 0x10); std::memcpy(&product_code.code, &ncch.ncch_header.product_code, 0x10);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(product_code); rb.PushRaw(product_code);
} }
} }
@ -1049,7 +1049,7 @@ void Module::Interface::GetDLCTitleInfos(Kernel::HLERequestContext& ctx) {
std::vector<u64> title_id_list(title_count); std::vector<u64> title_id_list(title_count);
title_id_list_buffer.Read(title_id_list.data(), 0, title_count * sizeof(u64)); title_id_list_buffer.Read(title_id_list.data(), 0, title_count * sizeof(u64));
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
// Validate that DLC TIDs were passed in // Validate that DLC TIDs were passed in
for (u32 i = 0; i < title_count; i++) { for (u32 i = 0; i < title_count; i++) {
@ -1082,7 +1082,7 @@ void Module::Interface::GetPatchTitleInfos(Kernel::HLERequestContext& ctx) {
std::vector<u64> title_id_list(title_count); std::vector<u64> title_id_list(title_count);
title_id_list_buffer.Read(title_id_list.data(), 0, title_count * sizeof(u64)); title_id_list_buffer.Read(title_id_list.data(), 0, title_count * sizeof(u64));
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
// Validate that update TIDs were passed in // Validate that update TIDs were passed in
for (u32 i = 0; i < title_count; i++) { for (u32 i = 0; i < title_count; i++) {
@ -1123,7 +1123,7 @@ void Module::Interface::ListDataTitleTicketInfos(Kernel::HLERequestContext& ctx)
} }
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ticket_count); rb.Push(ticket_count);
rb.PushMappedBuffer(ticket_info_out); rb.PushMappedBuffer(ticket_info_out);
@ -1148,7 +1148,7 @@ void Module::Interface::GetDLCContentInfoCount(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); 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); std::string tmd_path = GetTitleMetadataPath(media_type, title_id);
@ -1167,7 +1167,7 @@ void Module::Interface::DeleteTicket(Kernel::HLERequestContext& ctx) {
u64 title_id = rp.Pop<u64>(); u64 title_id = rp.Pop<u64>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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); LOG_WARNING(Service_AM, "(STUBBED) called title_id=0x{:016x}", title_id);
} }
@ -1180,7 +1180,7 @@ void Module::Interface::GetNumTickets(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ticket_count); rb.Push(ticket_count);
LOG_WARNING(Service_AM, "(STUBBED) called ticket_count=0x{:08x}", ticket_count); LOG_WARNING(Service_AM, "(STUBBED) called ticket_count=0x{:08x}", ticket_count);
} }
@ -1201,7 +1201,7 @@ void Module::Interface::GetTicketList(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(tickets_written); rb.Push(tickets_written);
rb.PushMappedBuffer(ticket_tids_out); rb.PushMappedBuffer(ticket_tids_out);
LOG_WARNING(Service_AM, "(STUBBED) ticket_list_count=0x{:08x}, ticket_index=0x{:08x}", LOG_WARNING(Service_AM, "(STUBBED) ticket_list_count=0x{:08x}, ticket_index=0x{:08x}",
@ -1215,7 +1215,7 @@ void Module::Interface::NeedsCleanup(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "(STUBBED) media_type=0x{:02x}", media_type); LOG_DEBUG(Service_AM, "(STUBBED) media_type=0x{:02x}", media_type);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<bool>(false); rb.Push<bool>(false);
} }
@ -1226,7 +1226,7 @@ void Module::Interface::DoCleanup(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "(STUBBED) called, media_type={:#02x}", media_type); LOG_DEBUG(Service_AM, "(STUBBED) called, media_type={:#02x}", media_type);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::Interface::QueryAvailableTitleDatabase(Kernel::HLERequestContext& ctx) { void Module::Interface::QueryAvailableTitleDatabase(Kernel::HLERequestContext& ctx) {
@ -1234,7 +1234,7 @@ void Module::Interface::QueryAvailableTitleDatabase(Kernel::HLERequestContext& c
u8 media_type = rp.Pop<u8>(); u8 media_type = rp.Pop<u8>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); // No error rb.Push(ResultSuccess); // No error
rb.Push(true); rb.Push(true);
LOG_WARNING(Service_AM, "(STUBBED) media_type={}", media_type); LOG_WARNING(Service_AM, "(STUBBED) media_type={}", media_type);
@ -1246,7 +1246,7 @@ void Module::Interface::GetPersonalizedTicketInfoList(Kernel::HLERequestContext&
[[maybe_unused]] auto& buffer = rp.PopMappedBuffer(); [[maybe_unused]] auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); // No error rb.Push(ResultSuccess); // No error
rb.Push(0); rb.Push(0);
LOG_WARNING(Service_AM, "(STUBBED) called, ticket_count={}", ticket_count); LOG_WARNING(Service_AM, "(STUBBED) called, ticket_count={}", ticket_count);
@ -1258,7 +1258,7 @@ void Module::Interface::GetNumImportTitleContextsFiltered(Kernel::HLERequestCont
u8 filter = rp.Pop<u8>(); u8 filter = rp.Pop<u8>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); // No error rb.Push(ResultSuccess); // No error
rb.Push(0); rb.Push(0);
LOG_WARNING(Service_AM, "(STUBBED) called, media_type={}, filter={}", media_type, filter); LOG_WARNING(Service_AM, "(STUBBED) called, media_type={}, filter={}", media_type, filter);
@ -1272,7 +1272,7 @@ void Module::Interface::GetImportTitleContextListFiltered(Kernel::HLERequestCont
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); // No error rb.Push(ResultSuccess); // No error
rb.Push(0); rb.Push(0);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -1290,7 +1290,7 @@ void Module::Interface::CheckContentRights(Kernel::HLERequestContext& ctx) {
FileUtil::Exists(GetTitleContentPath(Service::FS::MediaType::SDMC, tid, content_index)); FileUtil::Exists(GetTitleContentPath(Service::FS::MediaType::SDMC, tid, content_index));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); // No error rb.Push(ResultSuccess); // No error
rb.Push(has_rights); rb.Push(has_rights);
LOG_WARNING(Service_AM, "(STUBBED) tid={:016x}, content_index={}", tid, content_index); LOG_WARNING(Service_AM, "(STUBBED) tid={:016x}, content_index={}", tid, content_index);
@ -1306,7 +1306,7 @@ void Module::Interface::CheckContentRightsIgnorePlatform(Kernel::HLERequestConte
FileUtil::Exists(GetTitleContentPath(Service::FS::MediaType::SDMC, tid, content_index)); FileUtil::Exists(GetTitleContentPath(Service::FS::MediaType::SDMC, tid, content_index));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); // No error rb.Push(ResultSuccess); // No error
rb.Push(has_rights); rb.Push(has_rights);
LOG_WARNING(Service_AM, "(STUBBED) tid={:016x}, content_index={}", tid, content_index); LOG_WARNING(Service_AM, "(STUBBED) tid={:016x}, content_index={}", tid, content_index);
@ -1332,7 +1332,7 @@ void Module::Interface::BeginImportProgram(Kernel::HLERequestContext& ctx) {
am->cia_installing = true; am->cia_installing = true;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); // No error rb.Push(ResultSuccess); // No error
rb.PushCopyObjects(file->Connect()); rb.PushCopyObjects(file->Connect());
LOG_WARNING(Service_AM, "(STUBBED) media_type={}", media_type); LOG_WARNING(Service_AM, "(STUBBED) media_type={}", media_type);
@ -1359,7 +1359,7 @@ void Module::Interface::BeginImportProgramTemporarily(Kernel::HLERequestContext&
am->cia_installing = true; am->cia_installing = true;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); // No error rb.Push(ResultSuccess); // No error
rb.PushCopyObjects(file->Connect()); rb.PushCopyObjects(file->Connect());
LOG_WARNING(Service_AM, "(STUBBED)"); LOG_WARNING(Service_AM, "(STUBBED)");
@ -1373,7 +1373,7 @@ void Module::Interface::EndImportProgram(Kernel::HLERequestContext& ctx) {
am->cia_installing = false; am->cia_installing = false;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::Interface::EndImportProgramWithoutCommit(Kernel::HLERequestContext& ctx) { void Module::Interface::EndImportProgramWithoutCommit(Kernel::HLERequestContext& ctx) {
@ -1386,7 +1386,7 @@ void Module::Interface::EndImportProgramWithoutCommit(Kernel::HLERequestContext&
am->cia_installing = false; am->cia_installing = false;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::Interface::CommitImportPrograms(Kernel::HLERequestContext& ctx) { void Module::Interface::CommitImportPrograms(Kernel::HLERequestContext& ctx) {
@ -1401,7 +1401,7 @@ void Module::Interface::CommitImportPrograms(Kernel::HLERequestContext& ctx) {
am->ScanForAllTitles(); am->ScanForAllTitles();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
} }
@ -1444,14 +1444,14 @@ ResultVal<std::unique_ptr<AMFileWrapper>> GetFileFromSession(
if (file_session->parent == nullptr) { if (file_session->parent == nullptr) {
LOG_WARNING(Service_AM, "Invalid file handle!"); LOG_WARNING(Service_AM, "Invalid file handle!");
return Kernel::ERR_INVALID_HANDLE; return Kernel::ResultInvalidHandle;
} }
std::shared_ptr<Kernel::ServerSession> server = std::shared_ptr<Kernel::ServerSession> server =
Kernel::SharedFrom(file_session->parent->server); Kernel::SharedFrom(file_session->parent->server);
if (server == nullptr) { if (server == nullptr) {
LOG_WARNING(Service_AM, "File handle ServerSession disconnected!"); LOG_WARNING(Service_AM, "File handle ServerSession disconnected!");
return Kernel::ERR_SESSION_CLOSED_BY_REMOTE; return Kernel::ResultSessionClosed;
} }
if (server->hle_handler != nullptr) { if (server->hle_handler != nullptr) {
@ -1467,13 +1467,13 @@ ResultVal<std::unique_ptr<AMFileWrapper>> GetFileFromSession(
} }
LOG_ERROR(Service_AM, "Failed to cast handle to FSFile!"); 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 // 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. // while they're at it, so not implemented.
LOG_ERROR(Service_AM, "Given file handle does not have an HLE handler!"); 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) { void Module::Interface::GetProgramInfoFromCia(Kernel::HLERequestContext& ctx) {
@ -1509,7 +1509,7 @@ void Module::Interface::GetProgramInfoFromCia(Kernel::HLERequestContext& ctx) {
title_info.type = tmd.GetTitleType(); title_info.type = tmd.GetTitleType();
IPC::RequestBuilder rb = rp.MakeBuilder(8, 0); IPC::RequestBuilder rb = rp.MakeBuilder(8, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<TitleInfo>(title_info); rb.PushRaw<TitleInfo>(title_info);
} }
@ -1553,7 +1553,7 @@ void Module::Interface::GetSystemMenuDataFromCia(Kernel::HLERequestContext& ctx)
output_buffer.Write(temp.data(), 0, temp.size()); output_buffer.Write(temp.data(), 0, temp.size());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(output_buffer); rb.PushMappedBuffer(output_buffer);
} }
@ -1580,7 +1580,7 @@ void Module::Interface::GetDependencyListFromCia(Kernel::HLERequestContext& ctx)
std::memcpy(buffer.data(), container.GetDependencies().data(), buffer.size()); std::memcpy(buffer.data(), container.GetDependencies().data(), buffer.size());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushStaticBuffer(std::move(buffer), 0); rb.PushStaticBuffer(std::move(buffer), 0);
} }
@ -1604,7 +1604,7 @@ void Module::Interface::GetTransferSizeFromCia(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(container.GetMetadataOffset()); rb.Push(container.GetMetadataOffset());
} }
@ -1628,7 +1628,7 @@ void Module::Interface::GetCoreVersionFromCia(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(container.GetCoreVersion()); rb.Push(container.GetCoreVersion());
} }
@ -1656,7 +1656,7 @@ void Module::Interface::GetRequiredSizeFromCia(Kernel::HLERequestContext& ctx) {
// on some mediatypes. Since this is more of a required install size we'll report // 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. // what Citra needs, but it would be good to be more accurate here.
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(container.GetTitleMetadata().GetContentSizeByIndex(FileSys::TMDContentIndex::Main)); rb.Push(container.GetTitleMetadata().GetContentSizeByIndex(FileSys::TMDContentIndex::Main));
} }
@ -1672,7 +1672,7 @@ Result UninstallProgram(const FS::MediaType media_type, const u64 title_id) {
return {ErrorDescription::NotFound, ErrorModule::AM, ErrorSummary::InvalidState, return {ErrorDescription::NotFound, ErrorModule::AM, ErrorSummary::InvalidState,
ErrorLevel::Permanent}; ErrorLevel::Permanent};
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
void Module::Interface::DeleteProgram(Kernel::HLERequestContext& ctx) { void Module::Interface::DeleteProgram(Kernel::HLERequestContext& ctx) {
@ -1693,7 +1693,7 @@ void Module::Interface::GetSystemUpdaterMutex(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(am->system_updater_mutex); rb.PushCopyObjects(am->system_updater_mutex);
} }
@ -1718,7 +1718,7 @@ void Module::Interface::GetMetaSizeFromCia(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(container.GetMetadataSize()); rb.Push(container.GetMetadataSize());
} }
@ -1761,7 +1761,7 @@ void Module::Interface::GetMetaDataFromCia(Kernel::HLERequestContext& ctx) {
output_buffer.Write(temp.data(), 0, output_size); output_buffer.Write(temp.data(), 0, output_size);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(output_buffer); rb.PushMappedBuffer(output_buffer);
} }
@ -1773,7 +1773,7 @@ void Module::Interface::BeginImportTicket(Kernel::HLERequestContext& ctx) {
FileSys::Path{}); FileSys::Path{});
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); // No error rb.Push(ResultSuccess); // No error
rb.PushCopyObjects(file->Connect()); rb.PushCopyObjects(file->Connect());
LOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
@ -1784,7 +1784,7 @@ void Module::Interface::EndImportTicket(Kernel::HLERequestContext& ctx) {
[[maybe_unused]] const auto ticket = rp.PopObject<Kernel::ClientSession>(); [[maybe_unused]] const auto ticket = rp.PopObject<Kernel::ClientSession>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }

View File

@ -271,7 +271,7 @@ Result AppletManager::SendParameter(const MessageParameter& parameter) {
} }
CancelAndSendParameter(parameter); CancelAndSendParameter(parameter);
return RESULT_SUCCESS; return ResultSuccess;
} }
ResultVal<MessageParameter> AppletManager::GlanceParameter(AppletId app_id) { ResultVal<MessageParameter> AppletManager::GlanceParameter(AppletId app_id) {
@ -406,7 +406,7 @@ Result AppletManager::Enable(AppletAttributes attributes) {
delayed_parameter.reset(); delayed_parameter.reset();
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::Finalize(AppletId app_id) { Result AppletManager::Finalize(AppletId app_id) {
@ -430,7 +430,7 @@ Result AppletManager::Finalize(AppletId app_id) {
active_slot = GetAppletSlotFromPos(AppletPos::System); active_slot = GetAppletSlotFromPos(AppletPos::System);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
u32 AppletManager::CountRegisteredApplet() { u32 AppletManager::CountRegisteredApplet() {
@ -480,7 +480,7 @@ Result AppletManager::SendNotification(Notification notification) {
if (slot_data->registered) { if (slot_data->registered) {
slot_data->notification = notification; slot_data->notification = notification;
slot_data->notification_event->Signal(); slot_data->notification_event->Signal();
return RESULT_SUCCESS; return ResultSuccess;
} }
} }
@ -519,14 +519,14 @@ Result AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
auto process = auto process =
NS::LaunchTitle(FS::MediaType::NAND, GetTitleIdForApplet(applet_id, cfg->GetRegionValue())); NS::LaunchTitle(FS::MediaType::NAND, GetTitleIdForApplet(applet_id, cfg->GetRegionValue()));
if (process) { 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. // 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); auto applet = HLE::Applets::Applet::Get(applet_id);
if (applet) { if (applet) {
LOG_WARNING(Service_APT, "applet has already been started id={:03X}", applet_id); LOG_WARNING(Service_APT, "applet has already been started id={:03X}", applet_id);
return RESULT_SUCCESS; return ResultSuccess;
} else { } else {
auto parent = GetAppletSlotId(last_library_launcher_slot); auto parent = GetAppletSlotId(last_library_launcher_slot);
LOG_DEBUG(Service_APT, "Creating HLE applet {:03X} with parent {:03X}", applet_id, parent); LOG_DEBUG(Service_APT, "Creating HLE applet {:03X} with parent {:03X}", applet_id, parent);
@ -547,14 +547,14 @@ Result AppletManager::PreloadLibraryApplet(AppletId applet_id) {
auto process = auto process =
NS::LaunchTitle(FS::MediaType::NAND, GetTitleIdForApplet(applet_id, cfg->GetRegionValue())); NS::LaunchTitle(FS::MediaType::NAND, GetTitleIdForApplet(applet_id, cfg->GetRegionValue()));
if (process) { 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. // 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); auto applet = HLE::Applets::Applet::Get(applet_id);
if (applet) { if (applet) {
LOG_WARNING(Service_APT, "applet has already been started id={:08X}", applet_id); LOG_WARNING(Service_APT, "applet has already been started id={:08X}", applet_id);
return RESULT_SUCCESS; return ResultSuccess;
} else { } else {
auto parent = GetAppletSlotId(last_library_launcher_slot); auto parent = GetAppletSlotId(last_library_launcher_slot);
LOG_DEBUG(Service_APT, "Creating HLE applet {:03X} with parent {:03X}", applet_id, parent); LOG_DEBUG(Service_APT, "Creating HLE applet {:03X} with parent {:03X}", applet_id, parent);
@ -565,7 +565,7 @@ Result AppletManager::PreloadLibraryApplet(AppletId applet_id) {
Result AppletManager::FinishPreloadingLibraryApplet(AppletId applet_id) { Result AppletManager::FinishPreloadingLibraryApplet(AppletId applet_id) {
// TODO(Subv): This function should fail depending on the applet preparation state. // TODO(Subv): This function should fail depending on the applet preparation state.
GetAppletSlot(AppletSlot::LibraryApplet)->loaded = true; GetAppletSlot(AppletSlot::LibraryApplet)->loaded = true;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::StartLibraryApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object, Result AppletManager::StartLibraryApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
@ -584,7 +584,7 @@ Result AppletManager::StartLibraryApplet(AppletId applet_id, std::shared_ptr<Ker
return send_res; return send_res;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::PrepareToCloseLibraryApplet(bool not_pause, bool exiting, bool jump_home) { Result AppletManager::PrepareToCloseLibraryApplet(bool not_pause, bool exiting, bool jump_home) {
@ -602,7 +602,7 @@ Result AppletManager::PrepareToCloseLibraryApplet(bool not_pause, bool exiting,
else else
library_applet_closing_command = SignalType::WakeupByExit; library_applet_closing_command = SignalType::WakeupByExit;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::CloseLibraryApplet(std::shared_ptr<Kernel::Object> object, Result AppletManager::CloseLibraryApplet(std::shared_ptr<Kernel::Object> object,
@ -628,7 +628,7 @@ Result AppletManager::CloseLibraryApplet(std::shared_ptr<Kernel::Object> object,
SendParameter(param); SendParameter(param);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::CancelLibraryApplet(bool app_exiting) { Result AppletManager::CancelLibraryApplet(bool app_exiting) {
@ -679,7 +679,7 @@ Result AppletManager::SendDspSleep(AppletId from_applet_id,
}); });
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::SendDspWakeUp(AppletId from_applet_id, Result AppletManager::SendDspWakeUp(AppletId from_applet_id,
@ -712,7 +712,7 @@ Result AppletManager::SendDspWakeUp(AppletId from_applet_id,
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::PrepareToStartSystemApplet(AppletId applet_id) { Result AppletManager::PrepareToStartSystemApplet(AppletId applet_id) {
@ -724,7 +724,7 @@ Result AppletManager::PrepareToStartSystemApplet(AppletId applet_id) {
} }
last_system_launcher_slot = active_slot; last_system_launcher_slot = active_slot;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::StartSystemApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object, Result AppletManager::StartSystemApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
@ -766,7 +766,7 @@ Result AppletManager::StartSystemApplet(AppletId applet_id, std::shared_ptr<Kern
.buffer = buffer, .buffer = buffer,
}); });
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::PrepareToCloseSystemApplet() { Result AppletManager::PrepareToCloseSystemApplet() {
@ -775,7 +775,7 @@ Result AppletManager::PrepareToCloseSystemApplet() {
ErrorLevel::Status}; ErrorLevel::Status};
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::CloseSystemApplet(std::shared_ptr<Kernel::Object> object, Result AppletManager::CloseSystemApplet(std::shared_ptr<Kernel::Object> object,
@ -803,7 +803,7 @@ Result AppletManager::CloseSystemApplet(std::shared_ptr<Kernel::Object> object,
} }
// TODO: Terminate the running applet title // TODO: Terminate the running applet title
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::OrderToCloseSystemApplet() { Result AppletManager::OrderToCloseSystemApplet() {
@ -840,7 +840,7 @@ Result AppletManager::OrderToCloseSystemApplet() {
.signal = SignalType::WakeupByCancel, .signal = SignalType::WakeupByCancel,
}); });
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::PrepareToJumpToHomeMenu() { Result AppletManager::PrepareToJumpToHomeMenu() {
@ -857,7 +857,7 @@ Result AppletManager::PrepareToJumpToHomeMenu() {
EnsureHomeMenuLoaded(); EnsureHomeMenuLoaded();
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::JumpToHomeMenu(std::shared_ptr<Kernel::Object> object, Result AppletManager::JumpToHomeMenu(std::shared_ptr<Kernel::Object> object,
@ -907,7 +907,7 @@ Result AppletManager::JumpToHomeMenu(std::shared_ptr<Kernel::Object> object,
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::PrepareToLeaveHomeMenu() { Result AppletManager::PrepareToLeaveHomeMenu() {
@ -921,7 +921,7 @@ Result AppletManager::PrepareToLeaveHomeMenu() {
ErrorLevel::Status}; ErrorLevel::Status};
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::LeaveHomeMenu(std::shared_ptr<Kernel::Object> object, Result AppletManager::LeaveHomeMenu(std::shared_ptr<Kernel::Object> object,
@ -936,7 +936,7 @@ Result AppletManager::LeaveHomeMenu(std::shared_ptr<Kernel::Object> object,
.buffer = buffer, .buffer = buffer,
}); });
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::OrderToCloseApplication() { Result AppletManager::OrderToCloseApplication() {
@ -961,7 +961,7 @@ Result AppletManager::OrderToCloseApplication() {
.signal = SignalType::WakeupByCancel, .signal = SignalType::WakeupByCancel,
}); });
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::PrepareToCloseApplication(bool return_to_sys) { Result AppletManager::PrepareToCloseApplication(bool return_to_sys) {
@ -1012,7 +1012,7 @@ Result AppletManager::PrepareToCloseApplication(bool return_to_sys) {
// EnsureHomeMenuLoaded(); // EnsureHomeMenuLoaded();
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::CloseApplication(std::shared_ptr<Kernel::Object> object, Result AppletManager::CloseApplication(std::shared_ptr<Kernel::Object> object,
@ -1041,7 +1041,7 @@ Result AppletManager::CloseApplication(std::shared_ptr<Kernel::Object> object,
} }
// TODO: Terminate the application process. // TODO: Terminate the application process.
return RESULT_SUCCESS; return ResultSuccess;
} }
ResultVal<AppletManager::AppletManInfo> AppletManager::GetAppletManInfo( ResultVal<AppletManager::AppletManInfo> AppletManager::GetAppletManInfo(
@ -1176,7 +1176,7 @@ Result AppletManager::PrepareToDoApplicationJump(u64 title_id, FS::MediaType med
// Note: The real console uses the Home Menu to perform the application jump, therefore the menu // 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 // 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. // running, we don't have to do this. See `EnsureHomeMenuLoaded` for launching the Home Menu.
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::DoApplicationJump(const DeliverArg& arg) { Result AppletManager::DoApplicationJump(const DeliverArg& arg) {
@ -1208,7 +1208,7 @@ Result AppletManager::DoApplicationJump(const DeliverArg& arg) {
}); });
// TODO: APT terminates the application here, usually it will exit itself properly though. // TODO: APT terminates the application here, usually it will exit itself properly though.
return RESULT_SUCCESS; return ResultSuccess;
} else { } else {
// Otherwise, work around the missing home menu by launching the title directly. // Otherwise, work around the missing home menu by launching the title directly.
@ -1223,12 +1223,12 @@ Result AppletManager::DoApplicationJump(const DeliverArg& arg) {
LOG_CRITICAL(Service_APT, "Failed to launch title during application jump, exiting."); LOG_CRITICAL(Service_APT, "Failed to launch title during application jump, exiting.");
system.RequestShutdown(); system.RequestShutdown();
} }
return RESULT_SUCCESS; return ResultSuccess;
*/ */
NS::RebootToTitle(system, app_jump_parameters.next_media_type, NS::RebootToTitle(system, app_jump_parameters.next_media_type,
app_jump_parameters.next_title_id); app_jump_parameters.next_title_id);
return RESULT_SUCCESS; return ResultSuccess;
} }
} }
@ -1255,7 +1255,7 @@ Result AppletManager::PrepareToStartApplication(u64 title_id, FS::MediaType medi
capture_buffer_info.reset(); capture_buffer_info.reset();
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::StartApplication(const std::vector<u8>& parameter, Result AppletManager::StartApplication(const std::vector<u8>& parameter,
@ -1291,7 +1291,7 @@ Result AppletManager::StartApplication(const std::vector<u8>& parameter,
return WakeupApplication(nullptr, {}); return WakeupApplication(nullptr, {});
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::WakeupApplication(std::shared_ptr<Kernel::Object> object, Result AppletManager::WakeupApplication(std::shared_ptr<Kernel::Object> object,
@ -1307,7 +1307,7 @@ Result AppletManager::WakeupApplication(std::shared_ptr<Kernel::Object> object,
.buffer = buffer, .buffer = buffer,
}); });
return RESULT_SUCCESS; return ResultSuccess;
} }
Result AppletManager::CancelApplication() { Result AppletManager::CancelApplication() {
@ -1326,7 +1326,7 @@ Result AppletManager::CancelApplication() {
.signal = SignalType::WakeupByCancel, .signal = SignalType::WakeupByCancel,
}); });
return RESULT_SUCCESS; return ResultSuccess;
} }
void AppletManager::SendApplicationParameterAfterRegistration(const MessageParameter& parameter) { void AppletManager::SendApplicationParameterAfterRegistration(const MessageParameter& parameter) {

View File

@ -70,7 +70,7 @@ void Module::NSInterface::SetWirelessRebootInfo(Kernel::HLERequestContext& ctx)
apt->wireless_reboot_info = std::move(buffer); apt->wireless_reboot_info = std::move(buffer);
auto rb = rp.MakeBuilder(1, 0); auto rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_APT, "called size={}", size); LOG_WARNING(Service_APT, "called size={}", size);
} }
@ -83,7 +83,7 @@ void Module::NSInterface::ShutdownAsync(Kernel::HLERequestContext& ctx) {
apt->system.RequestShutdown(); apt->system.RequestShutdown();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::NSInterface::RebootSystem(Kernel::HLERequestContext& ctx) { 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); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::NSInterface::RebootSystemClean(Kernel::HLERequestContext& ctx) { void Module::NSInterface::RebootSystemClean(Kernel::HLERequestContext& ctx) {
@ -118,7 +118,7 @@ void Module::NSInterface::RebootSystemClean(Kernel::HLERequestContext& ctx) {
apt->system.RequestReset(); apt->system.RequestReset();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::APTInterface::Initialize(Kernel::HLERequestContext& ctx) { void Module::APTInterface::Initialize(Kernel::HLERequestContext& ctx) {
@ -134,7 +134,7 @@ void Module::APTInterface::Initialize(Kernel::HLERequestContext& ctx) {
rb.Push(result.Code()); rb.Push(result.Code());
} else { } else {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 3); IPC::RequestBuilder rb = rp.MakeBuilder(1, 3);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(result->notification_event, result->parameter_event); rb.PushCopyObjects(result->notification_event, result->parameter_event);
} }
} }
@ -314,7 +314,7 @@ void Module::APTInterface::GetSharedFont(Kernel::HLERequestContext& ctx) {
apt->shared_font_relocated = true; 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 // 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 // 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. // (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); LOG_WARNING(Service_APT, "called size={:08X}", size);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushStaticBuffer(apt->wireless_reboot_info, 0); 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>(); const auto app_id = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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); LOG_WARNING(Service_APT, "(STUBBED) app_id={}", app_id);
} }
@ -359,7 +359,7 @@ void Module::APTInterface::GetLockHandle(Kernel::HLERequestContext& ctx) {
rb.Push(result.Code()); rb.Push(result.Code());
} else { } else {
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(result->corrected_attributes); rb.PushRaw(result->corrected_attributes);
rb.Push<u32>(result->state); rb.Push<u32>(result->state);
rb.PushCopyObjects(result->lock); rb.PushCopyObjects(result->lock);
@ -398,7 +398,7 @@ void Module::APTInterface::GetAppletManInfo(Kernel::HLERequestContext& ctx) {
rb.Push(info.Code()); rb.Push(info.Code());
} else { } else {
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(info->active_applet_pos); rb.PushEnum(info->active_applet_pos);
rb.PushEnum(info->requested_applet_id); rb.PushEnum(info->requested_applet_id);
rb.PushEnum(info->home_menu_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"); LOG_DEBUG(Service_APT, "called");
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(apt->applet_manager->CountRegisteredApplet()); rb.Push(apt->applet_manager->CountRegisteredApplet());
} }
@ -421,7 +421,7 @@ void Module::APTInterface::IsRegistered(Kernel::HLERequestContext& ctx) {
const auto app_id = rp.PopEnum<AppletId>(); const auto app_id = rp.PopEnum<AppletId>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); 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)); rb.Push(apt->applet_manager->IsRegistered(app_id));
LOG_DEBUG(Service_APT, "called app_id={:#010X}", 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()); rb.Push(applet_attr.Code());
} else { } else {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(applet_attr.Unwrap().raw); rb.Push(applet_attr.Unwrap().raw);
} }
} }
@ -456,7 +456,7 @@ void Module::APTInterface::InquireNotification(Kernel::HLERequestContext& ctx) {
rb.Push(notification.Code()); rb.Push(notification.Code());
} else { } else {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(notification.Unwrap())); 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 buffer_size); // APT always push a buffer with the maximum size
IPC::RequestBuilder rb = rp.MakeBuilder(4, 4); 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->sender_id);
rb.PushEnum(next_parameter->signal); // Signal type rb.PushEnum(next_parameter->signal); // Signal type
rb.Push(size); // Parameter buffer size 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 buffer_size); // APT always push a buffer with the maximum size
IPC::RequestBuilder rb = rp.MakeBuilder(4, 4); 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->sender_id);
rb.PushEnum(next_parameter->signal); // Signal type rb.PushEnum(next_parameter->signal); // Signal type
rb.Push(size); // Parameter buffer size 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); check_sender, sender_appid, check_receiver, receiver_appid);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); 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, rb.Push(apt->applet_manager->CancelParameter(check_sender, sender_appid, check_receiver,
receiver_appid)); receiver_appid));
} }
@ -592,7 +592,7 @@ void Module::APTInterface::GetProgramIdOnApplicationJump(Kernel::HLERequestConte
const auto parameters = apt->applet_manager->GetApplicationJumpParameters(); const auto parameters = apt->applet_manager->GetApplicationJumpParameters();
IPC::RequestBuilder rb = rp.MakeBuilder(7, 0); IPC::RequestBuilder rb = rp.MakeBuilder(7, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u64>(parameters.current_title_id); rb.Push<u64>(parameters.current_title_id);
rb.Push(static_cast<u8>(parameters.current_media_type)); rb.Push(static_cast<u8>(parameters.current_media_type));
rb.Push<u64>(parameters.next_title_id); 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}); apt->applet_manager->SetDeliverArg(DeliverArg{param, hmac});
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::APTInterface::ReceiveDeliverArg(Kernel::HLERequestContext& ctx) { 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)); arg.hmac.resize(std::min<std::size_t>(hmac_size, 0x20));
IPC::RequestBuilder rb = rp.MakeBuilder(4, 4); IPC::RequestBuilder rb = rp.MakeBuilder(4, 4);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(arg.source_program_id); rb.Push(arg.source_program_id);
rb.Push<u8>(1); rb.Push<u8>(1);
rb.PushStaticBuffer(std::move(arg.param), 0); 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); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); // No error rb.Push(ResultSuccess); // No error
rb.Push(RESULT_SUCCESS); // Utility function result rb.Push(ResultSuccess); // Utility function result
rb.PushStaticBuffer(out, 0); rb.PushStaticBuffer(out, 0);
} }
@ -720,7 +720,7 @@ void Module::APTInterface::SetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
apt->cpu_percent = value; apt->cpu_percent = value;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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) { 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); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); // No error rb.Push(ResultSuccess); // No error
rb.Push(apt->cpu_percent); rb.Push(apt->cpu_percent);
} }
@ -944,7 +944,7 @@ void Module::APTInterface::ReplySleepQuery(Kernel::HLERequestContext& ctx) {
from_app_id, reply_value); from_app_id, reply_value);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::APTInterface::ReplySleepNotificationComplete(Kernel::HLERequestContext& ctx) { 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); LOG_WARNING(Service_APT, "(STUBBED) called, from_app_id={:08X}", from_app_id);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::APTInterface::PrepareToJumpToHomeMenu(Kernel::HLERequestContext& ctx) { 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()); std::copy_n(apt->sys_menu_arg_buffer.cbegin(), size, buffer.begin());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushStaticBuffer(std::move(buffer), 0); 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()); std::copy_n(buffer.cbegin(), size, apt->sys_menu_arg_buffer.begin());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::APTInterface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx) { void Module::APTInterface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
@ -1038,7 +1038,7 @@ void Module::APTInterface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx)
apt->applet_manager->SendCaptureBufferInfo(buffer); apt->applet_manager->SendCaptureBufferInfo(buffer);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::APTInterface::ReceiveCaptureBufferInfo(Kernel::HLERequestContext& ctx) { void Module::APTInterface::ReceiveCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
@ -1052,7 +1052,7 @@ void Module::APTInterface::ReceiveCaptureBufferInfo(Kernel::HLERequestContext& c
screen_capture_buffer.resize(size); screen_capture_buffer.resize(size);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(real_size); rb.Push(real_size);
rb.PushStaticBuffer(std::move(screen_capture_buffer), 0); rb.PushStaticBuffer(std::move(screen_capture_buffer), 0);
} }
@ -1068,7 +1068,7 @@ void Module::APTInterface::GetCaptureInfo(Kernel::HLERequestContext& ctx) {
screen_capture_buffer.resize(size); screen_capture_buffer.resize(size);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(real_size); rb.Push(real_size);
rb.PushStaticBuffer(std::move(screen_capture_buffer), 0); rb.PushStaticBuffer(std::move(screen_capture_buffer), 0);
} }
@ -1085,7 +1085,7 @@ void Module::APTInterface::Unknown54(Kernel::HLERequestContext& ctx) {
rb.Push(media_type.Code()); rb.Push(media_type.Code());
} else { } else {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(media_type.Unwrap()); 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); apt->screen_capture_post_permission = static_cast<ScreencapPostPermission>(permission & 0xF);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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) { void Module::APTInterface::GetScreenCapturePostPermission(Kernel::HLERequestContext& ctx) {
@ -1108,7 +1108,7 @@ void Module::APTInterface::GetScreenCapturePostPermission(Kernel::HLERequestCont
LOG_DEBUG(Service_APT, "called"); LOG_DEBUG(Service_APT, "called");
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); 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)); 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); LOG_DEBUG(Service_APT, "called process_id={}", process_id);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
auto fs_user = auto fs_user =
Core::System::GetInstance().ServiceManager().GetService<Service::FS::FS_USER>("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 // TODO: Proper error code
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_UNKNOWN); rb.Push(ResultUnknown);
return; return;
} }
@ -1171,7 +1171,7 @@ void Module::APTInterface::GetProgramInfo(Kernel::HLERequestContext& ctx) {
// TODO: Proper error code // TODO: Proper error code
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_UNKNOWN); rb.Push(ResultUnknown);
return; return;
} }
@ -1181,12 +1181,12 @@ void Module::APTInterface::GetProgramInfo(Kernel::HLERequestContext& ctx) {
// TODO: Proper error code // TODO: Proper error code
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_UNKNOWN); rb.Push(ResultUnknown);
return; return;
} }
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); 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(static_cast<u8>(memory_mode.first.value()));
rb.Push(core_version.first.value()); rb.Push(core_version.first.value());
} }
@ -1203,7 +1203,7 @@ void Module::APTInterface::GetAppletInfo(Kernel::HLERequestContext& ctx) {
rb.Push(info.Code()); rb.Push(info.Code());
} else { } else {
IPC::RequestBuilder rb = rp.MakeBuilder(7, 0); IPC::RequestBuilder rb = rp.MakeBuilder(7, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(info->title_id); rb.Push(info->title_id);
rb.Push(static_cast<u8>(info->media_type)); rb.Push(static_cast<u8>(info->media_type));
rb.Push(info->registered); rb.Push(info->registered);
@ -1248,7 +1248,7 @@ void Module::APTInterface::GetStartupArgument(Kernel::HLERequestContext& ctx) {
param.resize(std::min(parameter_size, max_parameter_size)); param.resize(std::min(parameter_size, max_parameter_size));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(exists); rb.Push(exists);
rb.PushStaticBuffer(std::move(param), 0); 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()); output.Write(cipher.data(), nonce_size, cipher.size());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4); IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
// Unmap buffer // Unmap buffer
rb.PushMappedBuffer(input); rb.PushMappedBuffer(input);
rb.PushMappedBuffer(output); rb.PushMappedBuffer(output);
@ -1338,7 +1338,7 @@ void Module::APTInterface::Unwrap(Kernel::HLERequestContext& ctx) {
output.Write(nonce.data(), nonce_offset, nonce_size); output.Write(nonce.data(), nonce_offset, nonce_size);
output.Write(pdata.data() + nonce_offset, nonce_offset + nonce_size, output.Write(pdata.data() + nonce_offset, nonce_offset + nonce_size,
pdata.size() - nonce_offset); pdata.size() - nonce_offset);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
LOG_ERROR(Service_APT, "Failed to decrypt data"); LOG_ERROR(Service_APT, "Failed to decrypt data");
rb.Push(Result(static_cast<ErrorDescription>(1), ErrorModule::PS, rb.Push(Result(static_cast<ErrorDescription>(1), ErrorModule::PS,
@ -1366,7 +1366,7 @@ void Module::APTInterface::Reboot(Kernel::HLERequestContext& ctx) {
NS::RebootToTitle(apt->system, media_type, title_id); NS::RebootToTitle(apt->system, media_type, title_id);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::APTInterface::HardwareResetAsync(Kernel::HLERequestContext& ctx) { void Module::APTInterface::HardwareResetAsync(Kernel::HLERequestContext& ctx) {
@ -1377,7 +1377,7 @@ void Module::APTInterface::HardwareResetAsync(Kernel::HLERequestContext& ctx) {
apt->system.RequestReset(); apt->system.RequestReset();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::APTInterface::GetTargetPlatform(Kernel::HLERequestContext& ctx) { void Module::APTInterface::GetTargetPlatform(Kernel::HLERequestContext& ctx) {
@ -1386,7 +1386,7 @@ void Module::APTInterface::GetTargetPlatform(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_APT, "called"); LOG_DEBUG(Service_APT, "called");
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(apt->applet_manager->GetTargetPlatform()); rb.PushEnum(apt->applet_manager->GetTargetPlatform());
} }
@ -1405,7 +1405,7 @@ void Module::APTInterface::GetApplicationRunningMode(Kernel::HLERequestContext&
LOG_DEBUG(Service_APT, "called"); LOG_DEBUG(Service_APT, "called");
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(apt->applet_manager->GetApplicationRunningMode()); rb.PushEnum(apt->applet_manager->GetApplicationRunningMode());
} }
@ -1425,7 +1425,7 @@ void Module::APTInterface::IsStandardMemoryLayout(Kernel::HLERequestContext& ctx
} }
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(is_standard); 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 // We allow all titles to be launched, so this function is a no-op
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(true); rb.Push(true);
} }

View File

@ -43,7 +43,7 @@ std::shared_ptr<OnlineService> Module::Interface::GetSessionService(
// TODO: Error code for uninitialized session. // TODO: Error code for uninitialized session.
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_UNKNOWN); rb.Push(ResultUnknown);
return nullptr; return nullptr;
} }
return session_data->online_service; 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 const u8 extdata_type = rp.Pop<u8>(); /// 0 = NAND, 1 = SD
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_BOSS, LOG_WARNING(Service_BOSS,
"(STUBBED) extdata_id={:#018x}, boss_size={:#010x}, extdata_type={:#04x}", "(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::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_BOSS, "(STUBBED) called"); LOG_WARNING(Service_BOSS, "(STUBBED) called");
} }
@ -100,7 +100,7 @@ void Module::Interface::GetStorageInfo(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); rb.Push<u32>(0);
LOG_WARNING(Service_BOSS, "(STUBBED) called"); LOG_WARNING(Service_BOSS, "(STUBBED) called");
@ -112,7 +112,7 @@ void Module::Interface::RegisterPrivateRootCa(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_BOSS, "(STUBBED)"); LOG_WARNING(Service_BOSS, "(STUBBED)");
@ -126,7 +126,7 @@ void Module::Interface::RegisterPrivateClientCert(Kernel::HLERequestContext& ctx
auto& buffer2 = rp.PopMappedBuffer(); auto& buffer2 = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4); IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer1); rb.PushMappedBuffer(buffer1);
rb.PushMappedBuffer(buffer2); rb.PushMappedBuffer(buffer2);
@ -138,7 +138,7 @@ void Module::Interface::GetNewArrivalFlag(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(boss->new_arrival_flag); rb.Push<u8>(boss->new_arrival_flag);
LOG_WARNING(Service_BOSS, "(STUBBED) new_arrival_flag={}", 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>(); [[maybe_unused]] const auto event = rp.PopObject<Kernel::Event>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_BOSS, "(STUBBED)"); LOG_WARNING(Service_BOSS, "(STUBBED)");
} }
@ -159,7 +159,7 @@ void Module::Interface::SetOptoutFlag(Kernel::HLERequestContext& ctx) {
boss->output_flag = rp.Pop<u8>(); boss->output_flag = rp.Pop<u8>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_BOSS, "output_flag={}", boss->output_flag); 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::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(boss->output_flag); rb.Push<u8>(boss->output_flag);
LOG_WARNING(Service_BOSS, "output_flag={}", 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); online_service->RegisterTask(size, buffer);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_DEBUG(Service_BOSS, "called, size={:#010x}, unk_param2={:#04x}, unk_param3={:#04x}", size, 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(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}, unk_param2={:#04x}", size, unk_param2); 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(); online_service->GetTaskIdList();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_BOSS, "called"); LOG_DEBUG(Service_BOSS, "called");
} }
@ -248,7 +248,7 @@ void Module::Interface::GetStepIdList(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size); 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); const u16 entries_count = online_service->GetNsDataIdList(filter, max_entries, buffer);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); 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>(entries_count); /// Actual number of output entries
rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list. rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list.
rb.PushMappedBuffer(buffer); 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); const u16 entries_count = online_service->GetNsDataIdList(filter, max_entries, buffer);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); 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>(entries_count); /// Actual number of output entries
rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list. rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list.
rb.PushMappedBuffer(buffer); 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); const u16 entries_count = online_service->GetNsDataIdList(filter, max_entries, buffer);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); 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>(entries_count); /// Actual number of output entries
rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list. rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list.
rb.PushMappedBuffer(buffer); 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); const u16 entries_count = online_service->GetNsDataIdList(filter, max_entries, buffer);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); 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>(entries_count); /// Actual number of output entries
rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list. rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list.
rb.PushMappedBuffer(buffer); 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(); [[maybe_unused]] const std::shared_ptr<Kernel::Object> object = rp.PopGenericObject();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_BOSS, "(STUBBED) property_id={:#06x}", property_id); 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(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}, unk_param2={:#06x}", size, unk_param2); 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); buffer.Read(task_id.data(), 0, size);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}, unk_param2={:#010x}, task_id={}", size, 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(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); // stub 0 ( 32bit value) rb.Push<u32>(0); // stub 0 ( 32bit value)
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -460,7 +460,7 @@ void Module::Interface::GetTaskCount(Kernel::HLERequestContext& ctx) {
buffer.Read(task_id.data(), 0, size); buffer.Read(task_id.data(), 0, size);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); // stub 0 ( 32bit value) rb.Push<u32>(0); // stub 0 ( 32bit value)
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -477,7 +477,7 @@ void Module::Interface::GetTaskServiceStatus(Kernel::HLERequestContext& ctx) {
constexpr u8 task_service_status = 1; constexpr u8 task_service_status = 1;
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(task_service_status); rb.Push<u8>(task_service_status);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -490,7 +490,7 @@ void Module::Interface::StartTask(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size); LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size);
@ -502,7 +502,7 @@ void Module::Interface::StartTaskImmediate(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size); LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size);
@ -514,7 +514,7 @@ void Module::Interface::CancelTask(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size); LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size);
@ -524,7 +524,7 @@ void Module::Interface::GetTaskFinishHandle(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects<Kernel::Event>(boss->task_finish_event); rb.PushCopyObjects<Kernel::Event>(boss->task_finish_event);
LOG_WARNING(Service_BOSS, "(STUBBED) called"); LOG_WARNING(Service_BOSS, "(STUBBED) called");
@ -537,7 +537,7 @@ void Module::Interface::GetTaskState(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(4, 2); IPC::RequestBuilder rb = rp.MakeBuilder(4, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(0); /// TaskStatus rb.Push<u8>(0); /// TaskStatus
rb.Push<u32>(0); /// Current state value for task PropertyID 0x4 rb.Push<u32>(0); /// Current state value for task PropertyID 0x4
rb.Push<u8>(0); /// unknown, usually 0 rb.Push<u8>(0); /// unknown, usually 0
@ -552,7 +552,7 @@ void Module::Interface::GetTaskResult(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(4, 2); 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<u8>(0); // stub 0 (8 bit value)
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) rb.Push<u8>(0); // stub 0 (8 bit value)
@ -567,7 +567,7 @@ void Module::Interface::GetTaskCommErrorCode(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(4, 2); 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<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) rb.Push<u8>(0); // stub 0 (8 bit value)
@ -584,7 +584,7 @@ void Module::Interface::GetTaskStatus(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(0); // stub 0 (8 bit value) rb.Push<u8>(0); // stub 0 (8 bit value)
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -599,7 +599,7 @@ void Module::Interface::GetTaskError(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(0); // stub 0 (8 bit value) rb.Push<u8>(0); // stub 0 (8 bit value)
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -613,7 +613,7 @@ void Module::Interface::GetTaskInfo(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}, unk_param2={:#04x}", size, unk_param2); 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>(); const u32 ns_data_id = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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); 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>(); const u32 unk_param2 = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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, LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010x}, unk_param2={:#010x}", unk_param1,
unk_param2); unk_param2);
@ -695,7 +695,7 @@ void Module::Interface::GetNsDataAdditionalInfo(Kernel::HLERequestContext& ctx)
const u32 unk_param1 = rp.Pop<u32>(); const u32 unk_param1 = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); // stub 0 (32bit value) rb.Push<u32>(0); // stub 0 (32bit value)
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010x}", unk_param1); 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>(); boss->ns_data_new_flag = rp.Pop<u8>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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, LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010x}, ns_data_new_flag={:#04x}", unk_param1,
boss->ns_data_new_flag); boss->ns_data_new_flag);
@ -718,7 +718,7 @@ void Module::Interface::GetNsDataNewFlag(Kernel::HLERequestContext& ctx) {
const u32 unk_param1 = rp.Pop<u32>(); const u32 unk_param1 = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(boss->ns_data_new_flag); rb.Push<u8>(boss->ns_data_new_flag);
LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010x}, ns_data_new_flag={:#04x}", unk_param1, 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()) { if (!entry.has_value()) {
// TODO: Proper error code. // TODO: Proper error code.
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_UNKNOWN); rb.Push(ResultUnknown);
return; return;
} }
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); rb.Push<u32>(0);
rb.Push<u32>(entry->header.download_date); // return the download date from the ns data 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>(); const u8 input = rp.Pop<u8>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); /// output value rb.Push<u32>(0); /// output value
LOG_WARNING(Service_BOSS, "(STUBBED) input={:#010x}", input); 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>(); const u8 unk_param5 = rp.Pop<u8>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_BOSS, LOG_WARNING(Service_BOSS,
"(STUBBED) unk_param1={:#010x}, unk_param2={:#010x}, unk_param3={:#010x}, " "(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::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); // stub 0 (32bit value) rb.Push<u32>(0); // stub 0 (32bit value)
rb.Push<u16>(0); // stub 0 (16bit 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>(); const u16 unk_param4 = rp.Pop<u16>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_BOSS, LOG_WARNING(Service_BOSS,
"(STUBBED) unk_param1={:#04x}, unk_param2={:#010x}, " "(STUBBED) unk_param1={:#04x}, unk_param2={:#010x}, "
@ -809,7 +809,7 @@ void Module::Interface::GetStorageOption(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); // stub 0 (32bit value) rb.Push<u32>(0); // stub 0 (32bit value)
rb.Push<u8>(0); // stub 0 (8bit value) rb.Push<u8>(0); // stub 0 (8bit value)
rb.Push<u16>(0); // stub 0 (16bit value) rb.Push<u16>(0); // stub 0 (16bit value)
@ -824,7 +824,7 @@ void Module::Interface::StartBgImmediate(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size); LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}", size);
@ -836,7 +836,7 @@ void Module::Interface::GetTaskProperty0(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); 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.Push<u8>(0); /// current state of PropertyID 0x0 stub 0 (8bit value)
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -851,7 +851,7 @@ void Module::Interface::RegisterImmediateTask(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010x}, unk_param2={:#04x}, unk_param3={:#04x}", 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(); auto& buffer2 = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4); IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer1); rb.PushMappedBuffer(buffer1);
rb.PushMappedBuffer(buffer2); rb.PushMappedBuffer(buffer2);
@ -882,7 +882,7 @@ void Module::Interface::GetTaskQuery(Kernel::HLERequestContext& ctx) {
auto& buffer2 = rp.PopMappedBuffer(); auto& buffer2 = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4); IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer1); rb.PushMappedBuffer(buffer1);
rb.PushMappedBuffer(buffer2); rb.PushMappedBuffer(buffer2);
@ -896,7 +896,7 @@ void Module::Interface::InitializeSessionPrivileged(Kernel::HLERequestContext& c
rp.PopPID(); rp.PopPID();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_BOSS, "(STUBBED) programID={:#018x}", programID); 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>(); const u64 programID = rp.Pop<u64>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(0); // 0 = nothing new, 1 = new content rb.Push<u8>(0); // 0 = nothing new, 1 = new content
LOG_WARNING(Service_BOSS, "(STUBBED) programID={:#018x}", programID); LOG_WARNING(Service_BOSS, "(STUBBED) programID={:#018x}", programID);
@ -922,7 +922,7 @@ void Module::Interface::GetNsDataIdListPrivileged(Kernel::HLERequestContext& ctx
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); 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); /// Actual number of output entries
rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list. rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list.
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -943,7 +943,7 @@ void Module::Interface::GetNsDataIdListPrivileged1(Kernel::HLERequestContext& ct
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); 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); /// Actual number of output entries
rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list. rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list.
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -961,7 +961,7 @@ void Module::Interface::SendPropertyPrivileged(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_BOSS, "(STUBBED) property_id={:#06x}, size={:#010x}", property_id, size); 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>(); const u32 ns_data_id = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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, LOG_WARNING(Service_BOSS, "(STUBBED) programID={:#018x}, ns_data_id={:#010x}", programID,
ns_data_id); ns_data_id);
@ -988,7 +988,7 @@ void Module::Interface::GetNsDataHeaderInfoPrivileged(Kernel::HLERequestContext&
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_BOSS, LOG_WARNING(Service_BOSS,
@ -1005,7 +1005,7 @@ void Module::Interface::ReadNsDataPrivileged(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); 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>(size); /// Should be actual read size
rb.Push<u32>(0); /// unknown rb.Push<u32>(0); /// unknown
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -1022,7 +1022,7 @@ void Module::Interface::SetNsDataNewFlagPrivileged(Kernel::HLERequestContext& ct
boss->ns_data_new_flag_privileged = rp.Pop<u8>(); boss->ns_data_new_flag_privileged = rp.Pop<u8>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING( LOG_WARNING(
Service_BOSS, Service_BOSS,
@ -1036,7 +1036,7 @@ void Module::Interface::GetNsDataNewFlagPrivileged(Kernel::HLERequestContext& ct
const u32 unk_param1 = rp.Pop<u32>(); const u32 unk_param1 = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(boss->ns_data_new_flag_privileged); rb.Push<u8>(boss->ns_data_new_flag_privileged);
LOG_WARNING( LOG_WARNING(

View File

@ -65,7 +65,7 @@ Result OnlineService::InitializeSession(u64 init_program_id) {
std::unique_ptr<FileSys::ArchiveBackend> boss_system_save_data_archive; std::unique_ptr<FileSys::ArchiveBackend> boss_system_save_data_archive;
if (archive_result.Succeeded()) { if (archive_result.Succeeded()) {
boss_system_save_data_archive = std::move(archive_result).Unwrap(); 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 // If the archive didn't exist, create the files inside
systemsavedata_factory.Format(archive_path, FileSys::ArchiveFormatInfo(), 0); systemsavedata_factory.Format(archive_path, FileSys::ArchiveFormatInfo(), 0);
@ -74,13 +74,13 @@ Result OnlineService::InitializeSession(u64 init_program_id) {
if (!create_archive_result.Succeeded()) { if (!create_archive_result.Succeeded()) {
LOG_ERROR(Service_BOSS, "Could not open BOSS savedata"); LOG_ERROR(Service_BOSS, "Could not open BOSS savedata");
// TODO: Proper error code. // TODO: Proper error code.
return RESULT_UNKNOWN; return ResultUnknown;
} }
boss_system_save_data_archive = std::move(create_archive_result).Unwrap(); boss_system_save_data_archive = std::move(create_archive_result).Unwrap();
} else { } else {
LOG_ERROR(Service_BOSS, "Could not open BOSS savedata"); LOG_ERROR(Service_BOSS, "Could not open BOSS savedata");
// TODO: Proper error code. // TODO: Proper error code.
return RESULT_UNKNOWN; return ResultUnknown;
} }
FileSys::Mode open_mode = {}; FileSys::Mode open_mode = {};
@ -94,7 +94,7 @@ Result OnlineService::InitializeSession(u64 init_program_id) {
boss_system_save_data_archive->OpenFile(FileSys::Path("/BOSS_SS.db"), open_mode); boss_system_save_data_archive->OpenFile(FileSys::Path("/BOSS_SS.db"), open_mode);
if (!boss_sv_result.Succeeded() || !boss_ss_result.Succeeded()) { if (!boss_sv_result.Succeeded() || !boss_ss_result.Succeeded()) {
LOG_ERROR(Service_BOSS, "Could not open BOSS database."); LOG_ERROR(Service_BOSS, "Could not open BOSS database.");
return RESULT_SUCCESS; return ResultSuccess;
} }
auto boss_sv = std::move(boss_sv_result).Unwrap(); auto boss_sv = std::move(boss_sv_result).Unwrap();
@ -103,7 +103,7 @@ Result OnlineService::InitializeSession(u64 init_program_id) {
((boss_sv->GetSize() - BOSS_SAVE_HEADER_SIZE) % BOSS_S_ENTRY_SIZE) == 0 && ((boss_sv->GetSize() - BOSS_SAVE_HEADER_SIZE) % BOSS_S_ENTRY_SIZE) == 0 &&
boss_sv->GetSize() == boss_ss->GetSize())) { boss_sv->GetSize() == boss_ss->GetSize())) {
LOG_ERROR(Service_BOSS, "BOSS database has incorrect size."); LOG_ERROR(Service_BOSS, "BOSS database has incorrect size.");
return RESULT_SUCCESS; return ResultSuccess;
} }
// Read the files if they already exist // Read the files if they already exist
@ -135,7 +135,7 @@ Result OnlineService::InitializeSession(u64 init_program_id) {
current_props = BossTaskProperties(); current_props = BossTaskProperties();
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
void OnlineService::RegisterTask(const u32 size, Kernel::MappedBuffer& buffer) { void OnlineService::RegisterTask(const u32 size, Kernel::MappedBuffer& buffer) {
@ -154,7 +154,7 @@ Result OnlineService::UnregisterTask(const u32 size, Kernel::MappedBuffer& buffe
if (size > TASK_ID_SIZE) { if (size > TASK_ID_SIZE) {
LOG_WARNING(Service_BOSS, "TaskId cannot be longer than 8"); LOG_WARNING(Service_BOSS, "TaskId cannot be longer than 8");
// TODO: Proper error code. // TODO: Proper error code.
return RESULT_UNKNOWN; return ResultUnknown;
} }
std::string task_id(size, 0); std::string task_id(size, 0);
@ -162,10 +162,10 @@ Result OnlineService::UnregisterTask(const u32 size, Kernel::MappedBuffer& buffe
if (task_id_list.erase(task_id) == 0) { if (task_id_list.erase(task_id) == 0) {
LOG_WARNING(Service_BOSS, "TaskId not in list"); LOG_WARNING(Service_BOSS, "TaskId not in list");
// TODO: Proper error code. // TODO: Proper error code.
return RESULT_UNKNOWN; return ResultUnknown;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
void OnlineService::GetTaskIdList() { void OnlineService::GetTaskIdList() {
@ -340,7 +340,7 @@ Result OnlineService::GetNsDataHeaderInfo(const u32 ns_data_id, const NsDataHead
if (!entry.has_value()) { if (!entry.has_value()) {
LOG_WARNING(Service_BOSS, "Failed to find NsData entry for ID {:#010X}", ns_data_id); LOG_WARNING(Service_BOSS, "Failed to find NsData entry for ID {:#010X}", ns_data_id);
// TODO: Proper error code. // TODO: Proper error code.
return RESULT_UNKNOWN; return ResultUnknown;
} }
static constexpr std::array EXPECTED_NS_DATA_HEADER_INFO_SIZES = { static constexpr std::array EXPECTED_NS_DATA_HEADER_INFO_SIZES = {
@ -355,31 +355,31 @@ Result OnlineService::GetNsDataHeaderInfo(const u32 ns_data_id, const NsDataHead
if (size != EXPECTED_NS_DATA_HEADER_INFO_SIZES[static_cast<u8>(type)]) { if (size != EXPECTED_NS_DATA_HEADER_INFO_SIZES[static_cast<u8>(type)]) {
LOG_WARNING(Service_BOSS, "Invalid size {} for type {}", size, type); LOG_WARNING(Service_BOSS, "Invalid size {} for type {}", size, type);
// TODO: Proper error code. // TODO: Proper error code.
return RESULT_UNKNOWN; return ResultUnknown;
} }
switch (type) { switch (type) {
case NsDataHeaderInfoType::ProgramId: case NsDataHeaderInfoType::ProgramId:
buffer.Write(&entry->header.program_id, 0, size); buffer.Write(&entry->header.program_id, 0, size);
return RESULT_SUCCESS; return ResultSuccess;
case NsDataHeaderInfoType::Unknown: { case NsDataHeaderInfoType::Unknown: {
// TODO: Figure out what this is. Stubbed to zero for now. // TODO: Figure out what this is. Stubbed to zero for now.
const u32 zero = 0; const u32 zero = 0;
buffer.Write(&zero, 0, size); buffer.Write(&zero, 0, size);
return RESULT_SUCCESS; return ResultSuccess;
} }
case NsDataHeaderInfoType::Datatype: case NsDataHeaderInfoType::Datatype:
buffer.Write(&entry->header.datatype, 0, size); buffer.Write(&entry->header.datatype, 0, size);
return RESULT_SUCCESS; return ResultSuccess;
case NsDataHeaderInfoType::PayloadSize: case NsDataHeaderInfoType::PayloadSize:
buffer.Write(&entry->header.payload_size, 0, size); buffer.Write(&entry->header.payload_size, 0, size);
return RESULT_SUCCESS; return ResultSuccess;
case NsDataHeaderInfoType::NsDataId: case NsDataHeaderInfoType::NsDataId:
buffer.Write(&entry->header.ns_data_id, 0, size); buffer.Write(&entry->header.ns_data_id, 0, size);
return RESULT_SUCCESS; return ResultSuccess;
case NsDataHeaderInfoType::Version: case NsDataHeaderInfoType::Version:
buffer.Write(&entry->header.version, 0, size); buffer.Write(&entry->header.version, 0, size);
return RESULT_SUCCESS; return ResultSuccess;
case NsDataHeaderInfoType::Everything: { case NsDataHeaderInfoType::Everything: {
const NsDataHeaderInfo info = { const NsDataHeaderInfo info = {
.program_id = entry->header.program_id, .program_id = entry->header.program_id,
@ -389,12 +389,12 @@ Result OnlineService::GetNsDataHeaderInfo(const u32 ns_data_id, const NsDataHead
.version = entry->header.version, .version = entry->header.version,
}; };
buffer.Write(&info, 0, size); buffer.Write(&info, 0, size);
return RESULT_SUCCESS; return ResultSuccess;
} }
default: default:
LOG_WARNING(Service_BOSS, "Unknown header info type {}", type); LOG_WARNING(Service_BOSS, "Unknown header info type {}", type);
// TODO: Proper error code. // 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()) { if (!entry.has_value()) {
LOG_WARNING(Service_BOSS, "Failed to find NsData entry for ID {:#010X}", ns_data_id); LOG_WARNING(Service_BOSS, "Failed to find NsData entry for ID {:#010X}", ns_data_id);
// TODO: Proper error code. // TODO: Proper error code.
return RESULT_UNKNOWN; return ResultUnknown;
} }
if (entry->header.payload_size < size + offset) { 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}", "length is {:#010X}",
size, offset, static_cast<u32>(entry->header.payload_size)); size, offset, static_cast<u32>(entry->header.payload_size));
// TODO: Proper error code. // TODO: Proper error code.
return RESULT_UNKNOWN; return ResultUnknown;
} }
auto boss_archive = OpenBossExtData(); auto boss_archive = OpenBossExtData();
if (!boss_archive) { if (!boss_archive) {
// TODO: Proper error code. // TODO: Proper error code.
return RESULT_UNKNOWN; return ResultUnknown;
} }
FileSys::Path file_path = fmt::format("/{}", entry->filename); 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()) { if (!file_result.Succeeded()) {
LOG_WARNING(Service_BOSS, "Failed to open SpotPass extdata file '{}'.", entry->filename); LOG_WARNING(Service_BOSS, "Failed to open SpotPass extdata file '{}'.", entry->filename);
// TODO: Proper error code. // TODO: Proper error code.
return RESULT_UNKNOWN; return ResultUnknown;
} }
auto file = std::move(file_result).Unwrap(); 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()) { if (!read_result.Succeeded()) {
LOG_WARNING(Service_BOSS, "Failed to read SpotPass extdata file '{}'.", entry->filename); LOG_WARNING(Service_BOSS, "Failed to read SpotPass extdata file '{}'.", entry->filename);
// TODO: Proper error code. // TODO: Proper error code.
return RESULT_UNKNOWN; return ResultUnknown;
} }
buffer.Write(ns_data_array.data(), 0, size); buffer.Write(ns_data_array.data(), 0, size);
@ -457,7 +457,7 @@ Result OnlineService::SendProperty(const u16 id, const u32 size, Kernel::MappedB
if (!current_props.properties.contains(property_id)) { if (!current_props.properties.contains(property_id)) {
LOG_ERROR(Service_BOSS, "Unknown property with ID {:#06x} and size {}", property_id, size); LOG_ERROR(Service_BOSS, "Unknown property with ID {:#06x} and size {}", property_id, size);
// TODO: Proper error code. // TODO: Proper error code.
return RESULT_UNKNOWN; return ResultUnknown;
} }
auto& prop = current_props.properties[property_id]; auto& prop = current_props.properties[property_id];
@ -489,7 +489,7 @@ Result OnlineService::SendProperty(const u16 id, const u32 size, Kernel::MappedB
[&](std::vector<u32>& cur_prop) { read_vector(cur_prop); }}, [&](std::vector<u32>& cur_prop) { read_vector(cur_prop); }},
prop); prop);
return RESULT_SUCCESS; return ResultSuccess;
} }
Result OnlineService::ReceiveProperty(const u16 id, const u32 size, Kernel::MappedBuffer& buffer) { Result OnlineService::ReceiveProperty(const u16 id, const u32 size, Kernel::MappedBuffer& buffer) {
@ -497,7 +497,7 @@ Result OnlineService::ReceiveProperty(const u16 id, const u32 size, Kernel::Mapp
if (!current_props.properties.contains(property_id)) { if (!current_props.properties.contains(property_id)) {
LOG_ERROR(Service_BOSS, "Unknown property with ID {:#06x} and size {}", property_id, size); LOG_ERROR(Service_BOSS, "Unknown property with ID {:#06x} and size {}", property_id, size);
// TODO: Proper error code. // TODO: Proper error code.
return RESULT_UNKNOWN; return ResultUnknown;
} }
auto write_pod = [&]<typename T>(T& cur_prop) { auto write_pod = [&]<typename T>(T& cur_prop) {
@ -525,7 +525,7 @@ Result OnlineService::ReceiveProperty(const u16 id, const u32 size, Kernel::Mapp
[&](std::vector<u32>& cur_prop) { write_vector(cur_prop); }}, [&](std::vector<u32>& cur_prop) { write_vector(cur_prop); }},
prop); prop);
return RESULT_SUCCESS; return ResultSuccess;
} }
} // namespace Service::BOSS } // namespace Service::BOSS

View File

@ -278,7 +278,7 @@ void Module::Interface::StartCapture(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_CAM, "port {} already started", i); LOG_WARNING(Service_CAM, "port {} already started", i);
} }
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
rb.Push(ERROR_INVALID_ENUM_VALUE); 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); LOG_WARNING(Service_CAM, "port {} already stopped", i);
} }
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
rb.Push(ERROR_INVALID_ENUM_VALUE); rb.Push(ERROR_INVALID_ENUM_VALUE);
@ -324,7 +324,7 @@ void Module::Interface::IsBusy(Kernel::HLERequestContext& ctx) {
for (int i : port_select) { for (int i : port_select) {
is_busy &= cam->ports[i].is_busy; is_busy &= cam->ports[i].is_busy;
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(is_busy); rb.Push(is_busy);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); 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>()); const PortSet port_select(rp.Pop<u8>());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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); 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); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
if (port_select.IsSingle()) { if (port_select.IsSingle()) {
int port = *port_select.begin(); int port = *port_select.begin();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(cam->ports[port].vsync_interrupt_event); rb.PushCopyObjects(cam->ports[port].vsync_interrupt_event);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); 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); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
if (port_select.IsSingle()) { if (port_select.IsSingle()) {
int port = *port_select.begin(); int port = *port_select.begin();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(cam->ports[port].buffer_error_interrupt_event); rb.PushCopyObjects(cam->ports[port].buffer_error_interrupt_event);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); 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; port.is_pending_receiving = true;
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(port.completion_event); rb.PushCopyObjects(port.completion_event);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); 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()) { if (port_select.IsSingle()) {
int port = *port_select.begin(); int port = *port_select.begin();
bool is_busy = cam->ports[port].is_receiving || cam->ports[port].is_pending_receiving; 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); rb.Push(!is_busy);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); 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) { for (int i : port_select) {
cam->ports[i].transfer_bytes = transfer_lines * width * 2; cam->ports[i].transfer_bytes = transfer_lines * width * 2;
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
rb.Push(ERROR_INVALID_ENUM_VALUE); rb.Push(ERROR_INVALID_ENUM_VALUE);
@ -476,7 +476,7 @@ void Module::Interface::GetMaxLines(Kernel::HLERequestContext& ctx) {
if (lines > height) { if (lines > height) {
lines = height; lines = height;
} }
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
while (height % lines != 0 || (lines * width * 2 % MIN_TRANSFER_UNIT != 0)) { while (height % lines != 0 || (lines * width * 2 % MIN_TRANSFER_UNIT != 0)) {
--lines; --lines;
if (lines == 0) { if (lines == 0) {
@ -503,7 +503,7 @@ void Module::Interface::SetTransferBytes(Kernel::HLERequestContext& ctx) {
for (int i : port_select) { for (int i : port_select) {
cam->ports[i].transfer_bytes = transfer_bytes; cam->ports[i].transfer_bytes = transfer_bytes;
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
rb.Push(ERROR_INVALID_ENUM_VALUE); rb.Push(ERROR_INVALID_ENUM_VALUE);
@ -520,7 +520,7 @@ void Module::Interface::GetTransferBytes(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
if (port_select.IsSingle()) { if (port_select.IsSingle()) {
int port = *port_select.begin(); int port = *port_select.begin();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(cam->ports[port].transfer_bytes); rb.Push(cam->ports[port].transfer_bytes);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); 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; bytes -= MIN_TRANSFER_UNIT;
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(bytes); rb.Push(bytes);
} }
@ -568,7 +568,7 @@ void Module::Interface::SetTrimming(Kernel::HLERequestContext& ctx) {
for (int i : port_select) { for (int i : port_select) {
cam->ports[i].is_trimming = trim; cam->ports[i].is_trimming = trim;
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
rb.Push(ERROR_INVALID_ENUM_VALUE); rb.Push(ERROR_INVALID_ENUM_VALUE);
@ -584,7 +584,7 @@ void Module::Interface::IsTrimming(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
if (port_select.IsSingle()) { if (port_select.IsSingle()) {
int port = *port_select.begin(); int port = *port_select.begin();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(cam->ports[port].is_trimming); rb.Push(cam->ports[port].is_trimming);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); 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].x1 = x1;
cam->ports[i].y1 = y1; cam->ports[i].y1 = y1;
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
rb.Push(ERROR_INVALID_ENUM_VALUE); rb.Push(ERROR_INVALID_ENUM_VALUE);
@ -628,7 +628,7 @@ void Module::Interface::GetTrimmingParams(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
if (port_select.IsSingle()) { if (port_select.IsSingle()) {
int port = *port_select.begin(); int port = *port_select.begin();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(cam->ports[port].x0); rb.Push(cam->ports[port].x0);
rb.Push(cam->ports[port].y0); rb.Push(cam->ports[port].y0);
rb.Push(cam->ports[port].x1); 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].x1 = cam->ports[i].x0 + trim_w;
cam->ports[i].y1 = cam->ports[i].y0 + trim_h; cam->ports[i].y1 = cam->ports[i].y0 + trim_h;
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val); LOG_ERROR(Service_CAM, "invalid port_select={}", port_select.m_val);
rb.Push(ERROR_INVALID_ENUM_VALUE); rb.Push(ERROR_INVALID_ENUM_VALUE);
@ -684,7 +684,7 @@ void Module::Interface::Activate(Kernel::HLERequestContext& ctx) {
cam->ports[i].is_active = false; cam->ports[i].is_active = false;
cam->system.CoreTiming().UnscheduleEvent(cam->vsync_interrupt_event_callback, i); 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]) { } else if (camera_select[0] && camera_select[1]) {
LOG_ERROR(Service_CAM, "camera 0 and 1 can't be both activated"); LOG_ERROR(Service_CAM, "camera 0 and 1 can't be both activated");
rb.Push(ERROR_INVALID_ENUM_VALUE); rb.Push(ERROR_INVALID_ENUM_VALUE);
@ -698,7 +698,7 @@ void Module::Interface::Activate(Kernel::HLERequestContext& ctx) {
if (camera_select[2]) { if (camera_select[2]) {
cam->ActivatePort(1, 2); cam->ActivatePort(1, 2);
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
} else { } else {
LOG_ERROR(Service_CAM, "invalid camera_select={}", camera_select.m_val); 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->SetFormat(context_config.format);
cam->cameras[camera].impl->SetResolution(context_config.resolution); cam->cameras[camera].impl->SetResolution(context_config.resolution);
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val, LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
context_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 { } else {
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val, LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
context_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 { } else {
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val, LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
context_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 { } else {
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val, LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
context_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].frame_rate = frame_rate;
cam->cameras[camera].impl->SetFrameRate(frame_rate); cam->cameras[camera].impl->SetFrameRate(frame_rate);
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
LOG_ERROR(Service_CAM, "invalid camera_select={}", camera_select.m_val); LOG_ERROR(Service_CAM, "invalid camera_select={}", camera_select.m_val);
rb.Push(ERROR_INVALID_ENUM_VALUE); 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 { } else {
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val, LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
context_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 { } else {
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val, LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", camera_select.m_val,
context_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>(); const u8 camera_select2 = rp.Pop<u8>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_CAM, "(STUBBED) called, camera_select1={}, camera_select2={}", LOG_WARNING(Service_CAM, "(STUBBED) called, camera_select1={}, camera_select2={}",
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); 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; const std::size_t port_id = port_select.m_val == 1 ? 0 : 1;
std::vector<u8> out(count * sizeof(s64_le)); std::vector<u8> out(count * sizeof(s64_le));
@ -961,7 +961,7 @@ void Module::Interface::GetStereoCameraCalibrationData(Kernel::HLERequestContext
data.imageWidth = 640; data.imageWidth = 640;
data.imageHeight = 480; data.imageHeight = 480;
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(data); rb.PushRaw(data);
LOG_TRACE(Service_CAM, "called"); LOG_TRACE(Service_CAM, "called");
@ -974,7 +974,7 @@ void Module::Interface::SetPackageParameterWithoutContext(Kernel::HLERequestCont
rp.PopRaw(package); rp.PopRaw(package);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_CAM, "(STUBBED) called"); LOG_WARNING(Service_CAM, "(STUBBED) called");
} }
@ -999,7 +999,7 @@ Result Module::SetPackageParameter(const PackageParameterType& package) {
} }
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} else { } else {
LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", package.camera_select, LOG_ERROR(Service_CAM, "invalid camera_select={}, context_select={}", package.camera_select,
package.context_select); package.context_select);
@ -1040,7 +1040,7 @@ void Module::Interface::SetPackageParameterWithContextDetail(Kernel::HLERequestC
void Module::Interface::GetSuitableY2rStandardCoefficient(Kernel::HLERequestContext& ctx) { void Module::Interface::GetSuitableY2rStandardCoefficient(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); rb.Push<u32>(0);
LOG_WARNING(Service_CAM, "(STUBBED) called"); LOG_WARNING(Service_CAM, "(STUBBED) called");
@ -1051,7 +1051,7 @@ void Module::Interface::PlayShutterSound(Kernel::HLERequestContext& ctx) {
u8 sound_id = rp.Pop<u8>(); u8 sound_id = rp.Pop<u8>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_CAM, "(STUBBED) called, sound_id={}", sound_id); LOG_WARNING(Service_CAM, "(STUBBED) called, sound_id={}", sound_id);
} }
@ -1081,7 +1081,7 @@ void Module::Interface::DriverInitialize(Kernel::HLERequestContext& ctx) {
cam->initialized = true; cam->initialized = true;
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_CAM, "called"); LOG_DEBUG(Service_CAM, "called");
} }
@ -1099,7 +1099,7 @@ void Module::Interface::DriverFinalize(Kernel::HLERequestContext& ctx) {
cam->initialized = false; cam->initialized = false;
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_CAM, "called"); LOG_DEBUG(Service_CAM, "called");
} }

View File

@ -47,7 +47,7 @@ Result ConversionConfiguration::SetInputLineWidth(u16 width) {
// 1024 the `camera` module would set the value 0 here, but we don't need to emulate this // 1024 the `camera` module would set the value 0 here, but we don't need to emulate this
// internal detail. // internal detail.
this->input_line_width = width; this->input_line_width = width;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result ConversionConfiguration::SetInputLines(u16 lines) { Result ConversionConfiguration::SetInputLines(u16 lines) {
@ -62,7 +62,7 @@ Result ConversionConfiguration::SetInputLines(u16 lines) {
if (lines != 1024) { if (lines != 1024) {
this->input_lines = lines; this->input_lines = lines;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result ConversionConfiguration::SetStandardCoefficient(StandardCoefficient standard_coefficient) { Result ConversionConfiguration::SetStandardCoefficient(StandardCoefficient standard_coefficient) {
@ -73,7 +73,7 @@ Result ConversionConfiguration::SetStandardCoefficient(StandardCoefficient stand
} }
std::memcpy(coefficients.data(), standard_coefficients[index].data(), sizeof(coefficients)); std::memcpy(coefficients.data(), standard_coefficients[index].data(), sizeof(coefficients));
return RESULT_SUCCESS; return ResultSuccess;
} }
void Y2R_U::SetInputFormat(Kernel::HLERequestContext& ctx) { void Y2R_U::SetInputFormat(Kernel::HLERequestContext& ctx) {
@ -82,7 +82,7 @@ void Y2R_U::SetInputFormat(Kernel::HLERequestContext& ctx) {
conversion.input_format = rp.PopEnum<InputFormat>(); conversion.input_format = rp.PopEnum<InputFormat>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, "called input_format={}", conversion.input_format); LOG_DEBUG(Service_Y2R, "called input_format={}", conversion.input_format);
} }
@ -91,7 +91,7 @@ void Y2R_U::GetInputFormat(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(conversion.input_format); rb.PushEnum(conversion.input_format);
LOG_DEBUG(Service_Y2R, "called input_format={}", conversion.input_format); LOG_DEBUG(Service_Y2R, "called input_format={}", conversion.input_format);
@ -103,7 +103,7 @@ void Y2R_U::SetOutputFormat(Kernel::HLERequestContext& ctx) {
conversion.output_format = rp.PopEnum<OutputFormat>(); conversion.output_format = rp.PopEnum<OutputFormat>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, "called output_format={}", conversion.output_format); LOG_DEBUG(Service_Y2R, "called output_format={}", conversion.output_format);
} }
@ -112,7 +112,7 @@ void Y2R_U::GetOutputFormat(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(conversion.output_format); rb.PushEnum(conversion.output_format);
LOG_DEBUG(Service_Y2R, "called output_format={}", conversion.output_format); LOG_DEBUG(Service_Y2R, "called output_format={}", conversion.output_format);
@ -124,7 +124,7 @@ void Y2R_U::SetRotation(Kernel::HLERequestContext& ctx) {
conversion.rotation = rp.PopEnum<Rotation>(); conversion.rotation = rp.PopEnum<Rotation>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, "called rotation={}", conversion.rotation); LOG_DEBUG(Service_Y2R, "called rotation={}", conversion.rotation);
} }
@ -133,7 +133,7 @@ void Y2R_U::GetRotation(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(conversion.rotation); rb.PushEnum(conversion.rotation);
LOG_DEBUG(Service_Y2R, "called rotation={}", conversion.rotation); LOG_DEBUG(Service_Y2R, "called rotation={}", conversion.rotation);
@ -145,7 +145,7 @@ void Y2R_U::SetBlockAlignment(Kernel::HLERequestContext& ctx) {
conversion.block_alignment = rp.PopEnum<BlockAlignment>(); conversion.block_alignment = rp.PopEnum<BlockAlignment>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, "called block_alignment={}", conversion.block_alignment); LOG_DEBUG(Service_Y2R, "called block_alignment={}", conversion.block_alignment);
} }
@ -154,7 +154,7 @@ void Y2R_U::GetBlockAlignment(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(conversion.block_alignment); rb.PushEnum(conversion.block_alignment);
LOG_DEBUG(Service_Y2R, "called block_alignment={}", conversion.block_alignment); LOG_DEBUG(Service_Y2R, "called block_alignment={}", conversion.block_alignment);
@ -166,7 +166,7 @@ void Y2R_U::SetSpacialDithering(Kernel::HLERequestContext& ctx) {
spacial_dithering_enabled = rp.Pop<bool>(); spacial_dithering_enabled = rp.Pop<bool>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, "(STUBBED) called"); LOG_DEBUG(Service_Y2R, "(STUBBED) called");
} }
@ -175,7 +175,7 @@ void Y2R_U::GetSpacialDithering(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(spacial_dithering_enabled); rb.Push(spacial_dithering_enabled);
LOG_DEBUG(Service_Y2R, "(STUBBED) called"); LOG_DEBUG(Service_Y2R, "(STUBBED) called");
@ -186,7 +186,7 @@ void Y2R_U::SetTemporalDithering(Kernel::HLERequestContext& ctx) {
temporal_dithering_enabled = rp.Pop<bool>(); temporal_dithering_enabled = rp.Pop<bool>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, "(STUBBED) called"); LOG_DEBUG(Service_Y2R, "(STUBBED) called");
} }
@ -195,7 +195,7 @@ void Y2R_U::GetTemporalDithering(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(temporal_dithering_enabled); rb.Push(temporal_dithering_enabled);
LOG_DEBUG(Service_Y2R, "(STUBBED) called"); LOG_DEBUG(Service_Y2R, "(STUBBED) called");
@ -206,7 +206,7 @@ void Y2R_U::SetTransferEndInterrupt(Kernel::HLERequestContext& ctx) {
transfer_end_interrupt_enabled = rp.Pop<bool>(); transfer_end_interrupt_enabled = rp.Pop<bool>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, "(STUBBED) called"); LOG_DEBUG(Service_Y2R, "(STUBBED) called");
} }
@ -215,7 +215,7 @@ void Y2R_U::GetTransferEndInterrupt(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(transfer_end_interrupt_enabled); rb.Push(transfer_end_interrupt_enabled);
LOG_DEBUG(Service_Y2R, "(STUBBED) called"); LOG_DEBUG(Service_Y2R, "(STUBBED) called");
@ -225,7 +225,7 @@ void Y2R_U::GetTransferEndEvent(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(completion_event); rb.PushCopyObjects(completion_event);
LOG_DEBUG(Service_Y2R, "called"); LOG_DEBUG(Service_Y2R, "called");
@ -241,7 +241,7 @@ void Y2R_U::SetSendingY(Kernel::HLERequestContext& ctx) {
// TODO (wwylele): pass process handle to y2r engine or convert VAddr to PAddr // TODO (wwylele): pass process handle to y2r engine or convert VAddr to PAddr
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, LOG_DEBUG(Service_Y2R,
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, " "called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
@ -260,7 +260,7 @@ void Y2R_U::SetSendingU(Kernel::HLERequestContext& ctx) {
// TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr // TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, LOG_DEBUG(Service_Y2R,
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, " "called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
@ -280,7 +280,7 @@ void Y2R_U::SetSendingV(Kernel::HLERequestContext& ctx) {
// TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr // TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, LOG_DEBUG(Service_Y2R,
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, " "called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
@ -300,7 +300,7 @@ void Y2R_U::SetSendingYUYV(Kernel::HLERequestContext& ctx) {
// TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr // TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, LOG_DEBUG(Service_Y2R,
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, " "called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
@ -313,7 +313,7 @@ void Y2R_U::IsFinishedSendingYuv(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(1); rb.Push<u8>(1);
LOG_DEBUG(Service_Y2R, "(STUBBED) called"); LOG_DEBUG(Service_Y2R, "(STUBBED) called");
@ -323,7 +323,7 @@ void Y2R_U::IsFinishedSendingY(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(1); rb.Push<u8>(1);
LOG_DEBUG(Service_Y2R, "(STUBBED) called"); LOG_DEBUG(Service_Y2R, "(STUBBED) called");
@ -333,7 +333,7 @@ void Y2R_U::IsFinishedSendingU(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(1); rb.Push<u8>(1);
LOG_DEBUG(Service_Y2R, "(STUBBED) called"); LOG_DEBUG(Service_Y2R, "(STUBBED) called");
@ -343,7 +343,7 @@ void Y2R_U::IsFinishedSendingV(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(1); rb.Push<u8>(1);
LOG_DEBUG(Service_Y2R, "(STUBBED) called"); LOG_DEBUG(Service_Y2R, "(STUBBED) called");
@ -360,7 +360,7 @@ void Y2R_U::SetReceiving(Kernel::HLERequestContext& ctx) {
// TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr // TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, LOG_DEBUG(Service_Y2R,
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, " "called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
@ -373,7 +373,7 @@ void Y2R_U::IsFinishedReceiving(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(1); rb.Push<u8>(1);
LOG_DEBUG(Service_Y2R, "(STUBBED) called"); LOG_DEBUG(Service_Y2R, "(STUBBED) called");
@ -393,7 +393,7 @@ void Y2R_U::GetInputLineWidth(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(conversion.input_line_width); rb.Push(conversion.input_line_width);
LOG_DEBUG(Service_Y2R, "called input_line_width={}", conversion.input_line_width); LOG_DEBUG(Service_Y2R, "called input_line_width={}", conversion.input_line_width);
@ -413,7 +413,7 @@ void Y2R_U::GetInputLines(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(conversion.input_lines)); rb.Push(static_cast<u32>(conversion.input_lines));
LOG_DEBUG(Service_Y2R, "called input_lines={}", conversion.input_lines); LOG_DEBUG(Service_Y2R, "called input_lines={}", conversion.input_lines);
@ -425,7 +425,7 @@ void Y2R_U::SetCoefficient(Kernel::HLERequestContext& ctx) {
rp.PopRaw<CoefficientSet>(conversion.coefficients); rp.PopRaw<CoefficientSet>(conversion.coefficients);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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}]", LOG_DEBUG(Service_Y2R, "called coefficients=[{:X}, {:X}, {:X}, {:X}, {:X}, {:X}, {:X}, {:X}]",
conversion.coefficients[0], conversion.coefficients[1], conversion.coefficients[2], conversion.coefficients[0], conversion.coefficients[1], conversion.coefficients[2],
@ -437,7 +437,7 @@ void Y2R_U::GetCoefficient(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(conversion.coefficients); rb.PushRaw(conversion.coefficients);
LOG_DEBUG(Service_Y2R, "called"); LOG_DEBUG(Service_Y2R, "called");
@ -459,7 +459,7 @@ void Y2R_U::GetStandardCoefficient(Kernel::HLERequestContext& ctx) {
if (index < standard_coefficients.size()) { if (index < standard_coefficients.size()) {
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(standard_coefficients[index]); rb.PushRaw(standard_coefficients[index]);
LOG_DEBUG(Service_Y2R, "called standard_coefficient={} ", index); LOG_DEBUG(Service_Y2R, "called standard_coefficient={} ", index);
@ -477,7 +477,7 @@ void Y2R_U::SetAlpha(Kernel::HLERequestContext& ctx) {
conversion.alpha = rp.Pop<u32>(); conversion.alpha = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, "called alpha={}", conversion.alpha); LOG_DEBUG(Service_Y2R, "called alpha={}", conversion.alpha);
} }
@ -486,7 +486,7 @@ void Y2R_U::GetAlpha(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(conversion.alpha); rb.Push(conversion.alpha);
LOG_DEBUG(Service_Y2R, "called alpha={}", conversion.alpha); LOG_DEBUG(Service_Y2R, "called alpha={}", conversion.alpha);
@ -496,7 +496,7 @@ void Y2R_U::SetDitheringWeightParams(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
rp.PopRaw(dithering_weight_params); rp.PopRaw(dithering_weight_params);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, "called"); LOG_DEBUG(Service_Y2R, "called");
} }
@ -505,7 +505,7 @@ void Y2R_U::GetDitheringWeightParams(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(9, 0); IPC::RequestBuilder rb = rp.MakeBuilder(9, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(dithering_weight_params); rb.PushRaw(dithering_weight_params);
LOG_DEBUG(Service_Y2R, "called"); LOG_DEBUG(Service_Y2R, "called");
@ -525,7 +525,7 @@ void Y2R_U::StartConversion(Kernel::HLERequestContext& ctx) {
completion_event->Signal(); completion_event->Signal();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, "called"); LOG_DEBUG(Service_Y2R, "called");
} }
@ -534,7 +534,7 @@ void Y2R_U::StopConversion(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, "called"); LOG_DEBUG(Service_Y2R, "called");
} }
@ -543,7 +543,7 @@ void Y2R_U::IsBusyConversion(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(0); // StartConversion always finishes immediately rb.Push<u8>(0); // StartConversion always finishes immediately
LOG_DEBUG(Service_Y2R, "called"); LOG_DEBUG(Service_Y2R, "called");
@ -592,7 +592,7 @@ void Y2R_U::PingProcess(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(0); rb.Push<u8>(0);
LOG_DEBUG(Service_Y2R, "(STUBBED) called"); LOG_DEBUG(Service_Y2R, "(STUBBED) called");
@ -620,7 +620,7 @@ void Y2R_U::DriverInitialize(Kernel::HLERequestContext& ctx) {
completion_event->Clear(); completion_event->Clear();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, "called"); LOG_DEBUG(Service_Y2R, "called");
} }
@ -629,7 +629,7 @@ void Y2R_U::DriverFinalize(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_Y2R, "called"); LOG_DEBUG(Service_Y2R, "called");
} }
@ -638,7 +638,7 @@ void Y2R_U::GetPackageParameter(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(4, 0); IPC::RequestBuilder rb = rp.MakeBuilder(4, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(conversion); rb.PushRaw(conversion);
LOG_DEBUG(Service_Y2R, "called"); LOG_DEBUG(Service_Y2R, "called");

View File

@ -76,7 +76,7 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) {
if (dir_result.Failed()) { if (dir_result.Failed()) {
if (open_mode.create) { if (open_mode.create) {
cecd->cecd_system_save_data_archive->CreateDirectory(path); cecd->cecd_system_save_data_archive->CreateDirectory(path);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
LOG_DEBUG(Service_CECD, "Failed to open directory: {}", path.AsString()); LOG_DEBUG(Service_CECD, "Failed to open directory: {}", path.AsString());
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound, rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
@ -93,7 +93,7 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_CECD, "Number of entries found: {}", entry_count); LOG_DEBUG(Service_CECD, "Number of entries found: {}", entry_count);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(entry_count); // Entry count rb.Push<u32>(entry_count); // Entry count
directory->Close(); directory->Close();
} }
@ -108,7 +108,7 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0); // No file size rb.Push<u32>(0); // No file size
} else { } else {
session_data->file = std::move(file_result).Unwrap(); 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 rb.Push<u32>(static_cast<u32>(session_data->file->GetSize())); // Return file size
} }
@ -163,7 +163,7 @@ void Module::Interface::Read(Kernel::HLERequestContext& ctx) {
write_buffer.Write(buffer.data(), 0, write_buffer_size); write_buffer.Write(buffer.data(), 0, write_buffer_size);
session_data->file->Close(); session_data->file->Close();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(bytes_read); rb.Push<u32>(bytes_read);
} }
rb.PushMappedBuffer(write_buffer); rb.PushMappedBuffer(write_buffer);
@ -225,7 +225,7 @@ void Module::Interface::ReadMessage(Kernel::HLERequestContext& ctx) {
msg_header.sender_id, msg_header.sender_id2, msg_header.send_count, msg_header.sender_id, msg_header.sender_id2, msg_header.send_count,
msg_header.forward_count, msg_header.user_data); msg_header.forward_count, msg_header.user_data);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(bytes_read); rb.Push<u32>(bytes_read);
} else { } else {
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound, rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
@ -317,7 +317,7 @@ void Module::Interface::ReadMessageWithHMAC(Kernel::HLERequestContext& ctx) {
else else
LOG_DEBUG(Service_CECD, "Verification failed"); LOG_DEBUG(Service_CECD, "Verification failed");
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(bytes_read); rb.Push<u32>(bytes_read);
} else { } else {
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound, rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
@ -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->Write(0, buffer.size(), true, buffer.data()).Unwrap());
session_data->file->Close(); session_data->file->Close();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
rb.PushMappedBuffer(read_buffer); rb.PushMappedBuffer(read_buffer);
@ -438,7 +438,7 @@ void Module::Interface::WriteMessage(Kernel::HLERequestContext& ctx) {
static_cast<u32>(message->Write(0, buffer_size, true, buffer.data()).Unwrap()); static_cast<u32>(message->Write(0, buffer_size, true, buffer.data()).Unwrap());
message->Close(); message->Close();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound, rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status)); ErrorLevel::Status));
@ -525,7 +525,7 @@ void Module::Interface::WriteMessageWithHMAC(Kernel::HLERequestContext& ctx) {
static_cast<u32>(message->Write(0, buffer_size, true, buffer.data()).Unwrap()); static_cast<u32>(message->Write(0, buffer_size, true, buffer.data()).Unwrap());
message->Close(); message->Close();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound, rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status)); ErrorLevel::Status));
@ -613,7 +613,7 @@ void Module::Interface::SetData(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(read_buffer); rb.PushMappedBuffer(read_buffer);
LOG_DEBUG(Service_CECD, "called, ncch_program_id={:#010x}, buffer_size={:#x}, option={:#x}", 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, dest_buffer.Write(buffer.data(), 0,
std::min(static_cast<size_t>(dest_buffer_size), buffer.size())); std::min(static_cast<size_t>(dest_buffer_size), buffer.size()));
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(param_buffer); rb.PushMappedBuffer(param_buffer);
rb.PushMappedBuffer(dest_buffer); rb.PushMappedBuffer(dest_buffer);
@ -665,7 +665,7 @@ void Module::Interface::Start(Kernel::HLERequestContext& ctx) {
const CecCommand command = rp.PopEnum<CecCommand>(); const CecCommand command = rp.PopEnum<CecCommand>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_CECD, "(STUBBED) called, command={}", cecd->GetCecCommandAsString(command)); 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>(); const CecCommand command = rp.PopEnum<CecCommand>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_CECD, "(STUBBED) called, command={}", cecd->GetCecCommandAsString(command)); 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(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_DEBUG(Service_CECD, "called, buffer_size={}, possible_info_type={}", buffer_size, 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::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(CecdState::NdmStatusIdle); rb.PushEnum(CecdState::NdmStatusIdle);
LOG_WARNING(Service_CECD, "(STUBBED) called"); LOG_WARNING(Service_CECD, "(STUBBED) called");
@ -708,7 +708,7 @@ void Module::Interface::GetCecInfoEventHandle(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(cecd->cecinfo_event); rb.PushCopyObjects(cecd->cecinfo_event);
LOG_WARNING(Service_CECD, "(STUBBED) called"); LOG_WARNING(Service_CECD, "(STUBBED) called");
@ -718,7 +718,7 @@ void Module::Interface::GetChangeStateEventHandle(Kernel::HLERequestContext& ctx
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(cecd->change_state_event); rb.PushCopyObjects(cecd->change_state_event);
LOG_WARNING(Service_CECD, "(STUBBED) called"); LOG_WARNING(Service_CECD, "(STUBBED) called");
@ -768,7 +768,7 @@ void Module::Interface::OpenAndWrite(Kernel::HLERequestContext& ctx) {
static_cast<u32>(file->Write(0, buffer.size(), true, buffer.data()).Unwrap()); static_cast<u32>(file->Write(0, buffer.size(), true, buffer.data()).Unwrap());
file->Close(); file->Close();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound, rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
ErrorLevel::Status)); ErrorLevel::Status));
@ -819,7 +819,7 @@ void Module::Interface::OpenAndRead(Kernel::HLERequestContext& ctx) {
write_buffer.Write(buffer.data(), 0, buffer_size); write_buffer.Write(buffer.data(), 0, buffer_size);
file->Close(); file->Close();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(bytes_read); rb.Push<u32>(bytes_read);
} else { } else {
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound, rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
@ -1404,7 +1404,7 @@ Module::Module(Core::System& system) : system(system) {
auto archive_result = systemsavedata_factory.Open(archive_path, 0); auto archive_result = systemsavedata_factory.Open(archive_path, 0);
// If the archive didn't exist, create the files inside // 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!"); ASSERT_MSG(archive_result.Succeeded(), "Could not open the CECD SystemSaveData archive!");
cecd_system_save_data_archive = std::move(archive_result).Unwrap(); cecd_system_save_data_archive = std::move(archive_result).Unwrap();
} else { } else {

View File

@ -159,7 +159,7 @@ void Module::Interface::GetCountryCodeString(Kernel::HLERequestContext& ctx) {
return; return;
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
// the real CFG service copies only three bytes (including the null-terminator) here // the real CFG service copies only three bytes (including the null-terminator) here
rb.Push<u32>(country_codes[country_code_id]); rb.Push<u32>(country_codes[country_code_id]);
} }
@ -193,7 +193,7 @@ void Module::Interface::GetCountryCodeID(Kernel::HLERequestContext& ctx) {
return; return;
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u16>(country_code_id); rb.Push<u16>(country_code_id);
} }
@ -210,7 +210,7 @@ void Module::Interface::GetRegion(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(static_cast<u8>(cfg->GetRegionValue())); 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"); LOG_DEBUG(Service_CFG, "(STUBBED) called");
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
// According to 3dbrew this is normally 0. // According to 3dbrew this is normally 0.
rb.Push<u8>(0); rb.Push<u8>(0);
} }
@ -232,14 +232,14 @@ void Module::Interface::SetUUIDClockSequence(Kernel::HLERequestContext& ctx) {
cfg->SaveMCUConfig(); cfg->SaveMCUConfig();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::Interface::GetUUIDClockSequence(Kernel::HLERequestContext& ctx) { void Module::Interface::GetUUIDClockSequence(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); 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)); rb.Push<u16>(static_cast<u16>(cfg->mcu_data.clock_sequence));
} }
@ -274,7 +274,7 @@ void Module::Interface::IsCoppacsSupported(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
u8 canada_or_usa = 1; u8 canada_or_usa = 1;
if (canada_or_usa == cfg->GetRegionValue()) { if (canada_or_usa == cfg->GetRegionValue()) {
@ -442,21 +442,21 @@ Result Module::GetConfigBlock(u32 block_id, u32 size, AccessFlag accesss_flag, v
CASCADE_RESULT(pointer, GetConfigBlockPointer(block_id, size, accesss_flag)); CASCADE_RESULT(pointer, GetConfigBlockPointer(block_id, size, accesss_flag));
std::memcpy(output, pointer, size); std::memcpy(output, pointer, size);
return RESULT_SUCCESS; return ResultSuccess;
} }
Result 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; void* pointer = nullptr;
CASCADE_RESULT(pointer, GetConfigBlockPointer(block_id, size, accesss_flag)); CASCADE_RESULT(pointer, GetConfigBlockPointer(block_id, size, accesss_flag));
std::memcpy(pointer, input, size); std::memcpy(pointer, input, size);
return RESULT_SUCCESS; return ResultSuccess;
} }
Result Module::CreateConfigBlock(u32 block_id, u16 size, AccessFlag access_flags, Result Module::CreateConfigBlock(u32 block_id, u16 size, AccessFlag access_flags,
const void* data) { const void* data) {
SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data()); SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
if (config->total_entries >= CONFIG_FILE_MAX_BLOCK_ENTRIES) if (config->total_entries >= CONFIG_FILE_MAX_BLOCK_ENTRIES)
return Result(-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 // Insert the block header with offset 0 for now
config->block_entries[config->total_entries] = {block_id, 0, size, access_flags}; config->block_entries[config->total_entries] = {block_id, 0, size, access_flags};
@ -482,7 +482,7 @@ Result Module::CreateConfigBlock(u32 block_id, u16 size, AccessFlag access_flags
} }
++config->total_entries; ++config->total_entries;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result Module::DeleteConfigNANDSaveFile() { Result Module::DeleteConfigNANDSaveFile() {
@ -503,13 +503,13 @@ Result Module::UpdateConfigNANDSavegame() {
auto config = std::move(config_result).Unwrap(); auto config = std::move(config_result).Unwrap();
config->Write(0, CONFIG_SAVEFILE_SIZE, 1, cfg_config_file_buffer.data()); config->Write(0, CONFIG_SAVEFILE_SIZE, 1, cfg_config_file_buffer.data());
return RESULT_SUCCESS; return ResultSuccess;
} }
Result Module::FormatConfig() { Result Module::FormatConfig() {
Result res = DeleteConfigNANDSaveFile(); Result res = DeleteConfigNANDSaveFile();
// The delete command fails if the file doesn't exist, so we have to check that too // 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; return res;
} }
// Delete the old data // Delete the old data
@ -539,7 +539,7 @@ Result Module::FormatConfig() {
return res; return res;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result Module::LoadConfigNANDSaveFile() { Result Module::LoadConfigNANDSaveFile() {
@ -551,7 +551,7 @@ Result Module::LoadConfigNANDSaveFile() {
auto archive_result = systemsavedata_factory.Open(archive_path, 0); auto archive_result = systemsavedata_factory.Open(archive_path, 0);
// If the archive didn't exist, create the files inside // 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 // Format the archive to create the directories
systemsavedata_factory.Format(archive_path, FileSys::ArchiveFormatInfo(), 0); systemsavedata_factory.Format(archive_path, FileSys::ArchiveFormatInfo(), 0);
@ -573,7 +573,7 @@ Result Module::LoadConfigNANDSaveFile() {
if (config_result.Succeeded()) { if (config_result.Succeeded()) {
auto config = std::move(config_result).Unwrap(); auto config = std::move(config_result).Unwrap();
config->Read(0, CONFIG_SAVEFILE_SIZE, cfg_config_file_buffer.data()); config->Read(0, CONFIG_SAVEFILE_SIZE, cfg_config_file_buffer.data());
return RESULT_SUCCESS; return ResultSuccess;
} }
return FormatConfig(); return FormatConfig();
@ -794,7 +794,7 @@ Result Module::SetConsoleUniqueId(u32 random_number, u64 console_id) {
if (!res.IsSuccess()) if (!res.IsSuccess())
return res; return res;
return RESULT_SUCCESS; return ResultSuccess;
} }
u64 Module::GetConsoleUniqueId() { u64 Module::GetConsoleUniqueId() {

View File

@ -208,7 +208,7 @@ void CSND_SND::Initialize(Kernel::HLERequestContext& ctx) {
.Unwrap(); .Unwrap();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 3); IPC::RequestBuilder rb = rp.MakeBuilder(1, 3);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(mutex, shared_memory); rb.PushCopyObjects(mutex, shared_memory);
LOG_WARNING(Service_CSND, LOG_WARNING(Service_CSND,
@ -228,7 +228,7 @@ void CSND_SND::Shutdown(Kernel::HLERequestContext& ctx) {
shared_memory = nullptr; shared_memory = nullptr;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_CSND, "(STUBBED) called"); LOG_WARNING(Service_CSND, "(STUBBED) called");
} }
@ -394,7 +394,7 @@ void CSND_SND::ExecuteCommands(Kernel::HLERequestContext& ctx) {
*shared_memory->GetPointer(addr + offsetof(Type0Command, finished)) = 1; *shared_memory->GetPointer(addr + offsetof(Type0Command, finished)) = 1;
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void CSND_SND::AcquireSoundChannels(Kernel::HLERequestContext& ctx) { void CSND_SND::AcquireSoundChannels(Kernel::HLERequestContext& ctx) {
@ -405,7 +405,7 @@ void CSND_SND::AcquireSoundChannels(Kernel::HLERequestContext& ctx) {
acquired_channel_mask = 0xFFFFFF00; acquired_channel_mask = 0xFFFFFF00;
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(acquired_channel_mask); rb.Push(acquired_channel_mask);
LOG_WARNING(Service_CSND, "(STUBBED) called"); LOG_WARNING(Service_CSND, "(STUBBED) called");
@ -417,7 +417,7 @@ void CSND_SND::ReleaseSoundChannels(Kernel::HLERequestContext& ctx) {
acquired_channel_mask = 0; acquired_channel_mask = 0;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_CSND, "(STUBBED) called"); LOG_WARNING(Service_CSND, "(STUBBED) called");
} }
@ -433,7 +433,7 @@ void CSND_SND::AcquireCapUnit(Kernel::HLERequestContext& ctx) {
rb.Skip(1, false); rb.Skip(1, false);
return; return;
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
if (capture_units[0]) { if (capture_units[0]) {
capture_units[1] = true; capture_units[1] = true;
@ -453,7 +453,7 @@ void CSND_SND::ReleaseCapUnit(Kernel::HLERequestContext& ctx) {
capture_units[index] = false; capture_units[index] = false;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_CSND, "(STUBBED) called, capture_unit_index={}", index); 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>(); const auto process = rp.PopObject<Kernel::Process>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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, LOG_TRACE(Service_CSND, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address,
size, process->process_id); size, process->process_id);
@ -478,7 +478,7 @@ void CSND_SND::StoreDataCache(Kernel::HLERequestContext& ctx) {
const auto process = rp.PopObject<Kernel::Process>(); const auto process = rp.PopObject<Kernel::Process>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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, LOG_TRACE(Service_CSND, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address,
size, process->process_id); size, process->process_id);
@ -491,7 +491,7 @@ void CSND_SND::InvalidateDataCache(Kernel::HLERequestContext& ctx) {
const auto process = rp.PopObject<Kernel::Process>(); const auto process = rp.PopObject<Kernel::Process>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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, LOG_TRACE(Service_CSND, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address,
size, process->process_id); size, process->process_id);
@ -501,7 +501,7 @@ void CSND_SND::Reset(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_CSND, "(STUBBED) called"); LOG_WARNING(Service_CSND, "(STUBBED) called");
} }

View File

@ -18,7 +18,7 @@ void DLP_SRVR::IsChild(Kernel::HLERequestContext& ctx) {
rp.Skip(1, false); rp.Skip(1, false);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(false); rb.Push(false);
LOG_WARNING(Service_DLP, "(STUBBED) called"); LOG_WARNING(Service_DLP, "(STUBBED) called");

View File

@ -28,7 +28,7 @@ void DSP_DSP::RecvData(Kernel::HLERequestContext& ctx) {
const u32 register_number = rp.Pop<u32>(); const u32 register_number = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(system.DSP().RecvData(register_number)); rb.Push(system.DSP().RecvData(register_number));
LOG_DEBUG(Service_DSP, "register_number={}", 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>(); const u32 register_number = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(system.DSP().RecvDataIsReady(register_number)); rb.Push(system.DSP().RecvDataIsReady(register_number));
LOG_DEBUG(Service_DSP, "register_number={}", 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); system.DSP().SetSemaphore(semaphore_value);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_INFO(Service_DSP, "called, semaphore_value={:04X}", semaphore_value); 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>(); const u32 address = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); 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 // TODO(merry): There is a per-region offset missing in this calculation (that seems to be
// always zero). // always zero).
@ -103,7 +103,7 @@ void DSP_DSP::WriteProcessPipe(Kernel::HLERequestContext& ctx) {
system.DSP().PipeWrite(pipe, buffer); system.DSP().PipeWrite(pipe, buffer);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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, LOG_DEBUG(Service_DSP, "channel={}, size=0x{:X}, buffer_size={:X}", channel, size,
buffer.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. UNREACHABLE(); // No more data is in pipe. Hardware hangs in this case; Should never happen.
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushStaticBuffer(std::move(pipe_buffer), 0); rb.PushStaticBuffer(std::move(pipe_buffer), 0);
LOG_DEBUG(Service_DSP, "channel={}, peer={}, size=0x{:04X}, pipe_readable_size=0x{:04X}", 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)); const u16 pipe_readable_size = static_cast<u16>(system.DSP().GetPipeReadableSize(pipe));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u16>(pipe_readable_size); rb.Push<u16>(pipe_readable_size);
LOG_DEBUG(Service_DSP, "channel={}, peer={}, return pipe_readable_size=0x{:04X}", channel, peer, 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); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u16>(static_cast<u16>(pipe_buffer.size())); rb.Push<u16>(static_cast<u16>(pipe_buffer.size()));
rb.PushStaticBuffer(std::move(pipe_buffer), 0); rb.PushStaticBuffer(std::move(pipe_buffer), 0);
@ -179,7 +179,7 @@ void DSP_DSP::LoadComponent(Kernel::HLERequestContext& ctx) {
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(true); rb.Push(true);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -198,7 +198,7 @@ void DSP_DSP::UnloadComponent(Kernel::HLERequestContext& ctx) {
system.DSP().UnloadComponent(); system.DSP().UnloadComponent();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_INFO(Service_DSP, "(STUBBED)"); LOG_INFO(Service_DSP, "(STUBBED)");
} }
@ -210,7 +210,7 @@ void DSP_DSP::FlushDataCache(Kernel::HLERequestContext& ctx) {
const auto process = rp.PopObject<Kernel::Process>(); const auto process = rp.PopObject<Kernel::Process>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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, LOG_TRACE(Service_DSP, "called address=0x{:08X}, size=0x{:X}, process={}", address, size,
process->process_id); process->process_id);
@ -223,7 +223,7 @@ void DSP_DSP::InvalidateDataCache(Kernel::HLERequestContext& ctx) {
const auto process = rp.PopObject<Kernel::Process>(); const auto process = rp.PopObject<Kernel::Process>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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, LOG_TRACE(Service_DSP, "called address=0x{:08X}, size=0x{:X}, process={}", address, size,
process->process_id); process->process_id);
@ -262,14 +262,14 @@ void DSP_DSP::RegisterInterruptEvents(Kernel::HLERequestContext& ctx) {
GetInterruptEvent(type, pipe) = nullptr; GetInterruptEvent(type, pipe) = nullptr;
LOG_INFO(Service_DSP, "Unregistered interrupt={}, channel={}", interrupt, channel); LOG_INFO(Service_DSP, "Unregistered interrupt={}, channel={}", interrupt, channel);
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void DSP_DSP::GetSemaphoreEventHandle(Kernel::HLERequestContext& ctx) { void DSP_DSP::GetSemaphoreEventHandle(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(semaphore_event); rb.PushCopyObjects(semaphore_event);
LOG_WARNING(Service_DSP, "(STUBBED) called"); LOG_WARNING(Service_DSP, "(STUBBED) called");
@ -280,7 +280,7 @@ void DSP_DSP::SetSemaphoreMask(Kernel::HLERequestContext& ctx) {
preset_semaphore = rp.Pop<u16>(); preset_semaphore = rp.Pop<u16>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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); 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::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(false); /// u8, 0 = not inserted, 1 = inserted rb.Push(false); /// u8, 0 = not inserted, 1 = inserted
LOG_DEBUG(Service_DSP, "called"); LOG_DEBUG(Service_DSP, "called");
@ -300,7 +300,7 @@ void DSP_DSP::ForceHeadphoneOut(Kernel::HLERequestContext& ctx) {
const u8 force = rp.Pop<u8>(); const u8 force = rp.Pop<u8>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_DSP, "(STUBBED) called, force={}", force); LOG_DEBUG(Service_DSP, "(STUBBED) called, force={}", force);
} }

View File

@ -244,7 +244,7 @@ void ERR_F::ThrowFatalError(Kernel::HLERequestContext& ctx) {
} // switch FatalErrType } // switch FatalErrType
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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) { ERR_F::ERR_F(Core::System& system) : ServiceFramework("err:f", 1), system(system) {

View File

@ -35,7 +35,7 @@ void Module::Interface::GetMyPresence(Kernel::HLERequestContext& ctx) {
std::memcpy(buffer.data(), &frd->my_presence, buffer.size()); std::memcpy(buffer.data(), &frd->my_presence, buffer.size());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushStaticBuffer(std::move(buffer), 0); rb.PushStaticBuffer(std::move(buffer), 0);
LOG_WARNING(Service_FRD, "(STUBBED) called"); 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); std::vector<u8> buffer(sizeof(FriendKey) * frd_count, 0);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); // 0 friends rb.Push<u32>(0); // 0 friends
rb.PushStaticBuffer(std::move(buffer), 0); 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); std::vector<u8> buffer(sizeof(Profile) * count, 0);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushStaticBuffer(std::move(buffer), 0); rb.PushStaticBuffer(std::move(buffer), 0);
LOG_WARNING(Service_FRD, "(STUBBED) called, count={}", count); 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 // TODO:(mailwl) figure out AttributeFlag size and zero all buffer. Assume 1 byte
std::vector<u8> buffer(1 * count, 0); std::vector<u8> buffer(1 * count, 0);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushStaticBuffer(std::move(buffer), 0); rb.PushStaticBuffer(std::move(buffer), 0);
LOG_WARNING(Service_FRD, "(STUBBED) called, count={}", count); 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) { void Module::Interface::GetMyFriendKey(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(frd->my_friend_key); rb.PushRaw(frd->my_friend_key);
LOG_WARNING(Service_FRD, "(STUBBED) called"); LOG_WARNING(Service_FRD, "(STUBBED) called");
@ -105,7 +105,7 @@ void Module::Interface::GetMyScreenName(Kernel::HLERequestContext& ctx) {
ScreenName screen_name{}; ScreenName screen_name{};
std::memcpy(screen_name.name.data(), username.data(), username.length() * sizeof(char16_t)); 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.PushRaw(screen_name);
rb.Push(0); rb.Push(0);
@ -118,7 +118,7 @@ void Module::Interface::GetMyComment(Kernel::HLERequestContext& ctx) {
constexpr Comment comment{.name = {u'H', u'e', u'y', '!'}}; constexpr Comment comment{.name = {u'H', u'e', u'y', '!'}};
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<Comment>(comment); rb.PushRaw<Comment>(comment);
rb.Push(0); rb.Push(0);
@ -133,7 +133,7 @@ void Module::Interface::GetMyMii(Kernel::HLERequestContext& ctx) {
Mii::ChecksummedMiiData mii{}; Mii::ChecksummedMiiData mii{};
mii.SetMiiData(mii_data); mii.SetMiiData(mii_data);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<Mii::ChecksummedMiiData>(mii); rb.PushRaw<Mii::ChecksummedMiiData>(mii);
LOG_WARNING(Service_FRD, "(STUBBED) called"); 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}; constexpr Profile profile{.region = 1, .country = 1, .area = 1, .language = 1, .platform = 1};
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<Profile>(profile); rb.PushRaw<Profile>(profile);
LOG_WARNING(Service_FRD, "(STUBBED) called"); 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}; constexpr Game game{.title_id = 0x0004000E00030700, .version = 1};
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<Game>(game); rb.PushRaw<Game>(game);
LOG_WARNING(Service_FRD, "(STUBBED) called"); 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}; constexpr Game game{.title_id = 0x0004000E00030700, .version = 1};
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<Game>(game); rb.PushRaw<Game>(game);
LOG_WARNING(Service_FRD, "(STUBBED) called"); 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_game = 1;
constexpr u32 show_history = 0; constexpr u32 show_history = 0;
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(is_public); rb.Push<u32>(is_public);
rb.Push<u32>(show_game); rb.Push<u32>(show_game);
rb.Push<u32>(show_history); rb.Push<u32>(show_history);
@ -218,7 +218,7 @@ void Module::Interface::UnscrambleLocalFriendCode(Kernel::HLERequestContext& ctx
LOG_WARNING(Service_FRD, "(STUBBED) called"); LOG_WARNING(Service_FRD, "(STUBBED) called");
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushStaticBuffer(std::move(unscrambled_friend_codes), 0); rb.PushStaticBuffer(std::move(unscrambled_friend_codes), 0);
} }
@ -228,7 +228,7 @@ void Module::Interface::SetClientSdkVersion(Kernel::HLERequestContext& ctx) {
rp.PopPID(); rp.PopPID();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_FRD, "(STUBBED) called, version: 0x{:08X}", version); 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::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(frd->logged_in); rb.Push(frd->logged_in);
LOG_WARNING(Service_FRD, "(STUBBED) called"); LOG_WARNING(Service_FRD, "(STUBBED) called");
@ -248,7 +248,7 @@ void Module::Interface::HasLoggedIn(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(frd->logged_in); 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); frd->system.CoreTiming().ScheduleEvent(msToCycles(login_delay_ms), frd->login_delay_event);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void Module::Interface::GetLastResponseResult(Kernel::HLERequestContext& ctx) { void Module::Interface::GetLastResponseResult(Kernel::HLERequestContext& ctx) {
@ -278,7 +278,7 @@ void Module::Interface::GetLastResponseResult(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
Module::Module(Core::System& system) : system(system){}; Module::Module(Core::System& system) : system(system){};

View File

@ -52,7 +52,7 @@ ResultVal<ArchiveHandle> ArchiveManager::OpenArchive(ArchiveIdCode id_code,
auto itr = id_code_map.find(id_code); auto itr = id_code_map.find(id_code);
if (itr == id_code_map.end()) { if (itr == id_code_map.end()) {
return FileSys::ERROR_NOT_FOUND; return FileSys::ResultNotFound;
} }
CASCADE_RESULT(std::unique_ptr<ArchiveBackend> res, CASCADE_RESULT(std::unique_ptr<ArchiveBackend> res,
@ -68,9 +68,9 @@ ResultVal<ArchiveHandle> ArchiveManager::OpenArchive(ArchiveIdCode id_code,
Result ArchiveManager::CloseArchive(ArchiveHandle handle) { Result ArchiveManager::CloseArchive(ArchiveHandle handle) {
if (handle_map.erase(handle) == 0) if (handle_map.erase(handle) == 0)
return FileSys::ERR_INVALID_ARCHIVE_HANDLE; return FileSys::ResultInvalidArchiveHandle;
else else
return RESULT_SUCCESS; return ResultSuccess;
} }
// TODO(yuriks): This might be what the fs:REG service is for. See the Register/Unregister calls in // TODO(yuriks): This might be what the fs:REG service is for. See the Register/Unregister calls in
@ -85,7 +85,7 @@ Result ArchiveManager::RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFacto
auto& archive = result.first->second; auto& archive = result.first->second;
LOG_DEBUG(Service_FS, "Registered archive {} with id code 0x{:08X}", archive->GetName(), LOG_DEBUG(Service_FS, "Registered archive {} with id code 0x{:08X}", archive->GetName(),
id_code); id_code);
return RESULT_SUCCESS; return ResultSuccess;
} }
std::pair<ResultVal<std::shared_ptr<File>>, std::chrono::nanoseconds> 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) { const FileSys::Mode mode) {
ArchiveBackend* archive = GetArchive(archive_handle); ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr) { 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()}; const std::chrono::nanoseconds open_timeout_ns{archive->GetOpenDelayNs()};
@ -110,7 +110,7 @@ Result ArchiveManager::DeleteFileFromArchive(ArchiveHandle archive_handle,
const FileSys::Path& path) { const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle); ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr) if (archive == nullptr)
return FileSys::ERR_INVALID_ARCHIVE_HANDLE; return FileSys::ResultInvalidArchiveHandle;
return archive->DeleteFile(path); return archive->DeleteFile(path);
} }
@ -122,7 +122,7 @@ Result ArchiveManager::RenameFileBetweenArchives(ArchiveHandle src_archive_handl
ArchiveBackend* src_archive = GetArchive(src_archive_handle); ArchiveBackend* src_archive = GetArchive(src_archive_handle);
ArchiveBackend* dest_archive = GetArchive(dest_archive_handle); ArchiveBackend* dest_archive = GetArchive(dest_archive_handle);
if (src_archive == nullptr || dest_archive == nullptr) if (src_archive == nullptr || dest_archive == nullptr)
return FileSys::ERR_INVALID_ARCHIVE_HANDLE; return FileSys::ResultInvalidArchiveHandle;
if (src_archive == dest_archive) { if (src_archive == dest_archive) {
return src_archive->RenameFile(src_path, dest_path); return src_archive->RenameFile(src_path, dest_path);
@ -136,7 +136,7 @@ Result ArchiveManager::DeleteDirectoryFromArchive(ArchiveHandle archive_handle,
const FileSys::Path& path) { const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle); ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr) if (archive == nullptr)
return FileSys::ERR_INVALID_ARCHIVE_HANDLE; return FileSys::ResultInvalidArchiveHandle;
return archive->DeleteDirectory(path); return archive->DeleteDirectory(path);
} }
@ -145,7 +145,7 @@ Result ArchiveManager::DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archi
const FileSys::Path& path) { const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle); ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr) if (archive == nullptr)
return FileSys::ERR_INVALID_ARCHIVE_HANDLE; return FileSys::ResultInvalidArchiveHandle;
return archive->DeleteDirectoryRecursively(path); return archive->DeleteDirectoryRecursively(path);
} }
@ -154,7 +154,7 @@ Result ArchiveManager::CreateFileInArchive(ArchiveHandle archive_handle, const F
u64 file_size) { u64 file_size) {
ArchiveBackend* archive = GetArchive(archive_handle); ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr) if (archive == nullptr)
return FileSys::ERR_INVALID_ARCHIVE_HANDLE; return FileSys::ResultInvalidArchiveHandle;
return archive->CreateFile(path, file_size); return archive->CreateFile(path, file_size);
} }
@ -163,7 +163,7 @@ Result ArchiveManager::CreateDirectoryFromArchive(ArchiveHandle archive_handle,
const FileSys::Path& path) { const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle); ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr) if (archive == nullptr)
return FileSys::ERR_INVALID_ARCHIVE_HANDLE; return FileSys::ResultInvalidArchiveHandle;
return archive->CreateDirectory(path); return archive->CreateDirectory(path);
} }
@ -175,7 +175,7 @@ Result ArchiveManager::RenameDirectoryBetweenArchives(ArchiveHandle src_archive_
ArchiveBackend* src_archive = GetArchive(src_archive_handle); ArchiveBackend* src_archive = GetArchive(src_archive_handle);
ArchiveBackend* dest_archive = GetArchive(dest_archive_handle); ArchiveBackend* dest_archive = GetArchive(dest_archive_handle);
if (src_archive == nullptr || dest_archive == nullptr) if (src_archive == nullptr || dest_archive == nullptr)
return FileSys::ERR_INVALID_ARCHIVE_HANDLE; return FileSys::ResultInvalidArchiveHandle;
if (src_archive == dest_archive) { if (src_archive == dest_archive) {
return src_archive->RenameDirectory(src_path, dest_path); 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) { ArchiveHandle archive_handle, const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle); ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr) { if (archive == nullptr) {
return FileSys::ERR_INVALID_ARCHIVE_HANDLE; return FileSys::ResultInvalidArchiveHandle;
} }
auto backend = archive->OpenDirectory(path); auto backend = archive->OpenDirectory(path);
@ -203,7 +203,7 @@ ResultVal<std::shared_ptr<Directory>> ArchiveManager::OpenDirectoryFromArchive(
ResultVal<u64> ArchiveManager::GetFreeBytesInArchive(ArchiveHandle archive_handle) { ResultVal<u64> ArchiveManager::GetFreeBytesInArchive(ArchiveHandle archive_handle) {
const ArchiveBackend* archive = GetArchive(archive_handle); const ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr) { if (archive == nullptr) {
return FileSys::ERR_INVALID_ARCHIVE_HANDLE; return FileSys::ResultInvalidArchiveHandle;
} }
return archive->GetFreeBytes(); return archive->GetFreeBytes();
} }
@ -252,7 +252,7 @@ Result ArchiveManager::CreateExtSaveData(MediaType media_type, u32 high, u32 low
} }
ext_savedata->WriteIcon(path, smdh_icon); ext_savedata->WriteIcon(path, smdh_icon);
return RESULT_SUCCESS; return ResultSuccess;
} }
Result ArchiveManager::DeleteExtSaveData(MediaType media_type, u32 high, u32 low) { Result ArchiveManager::DeleteExtSaveData(MediaType media_type, u32 high, u32 low) {
@ -267,7 +267,7 @@ Result ArchiveManager::DeleteExtSaveData(MediaType media_type, u32 high, u32 low
media_type_directory = FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir); media_type_directory = FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir);
} else { } else {
LOG_ERROR(Service_FS, "Unsupported media type {}", media_type); LOG_ERROR(Service_FS, "Unsupported media type {}", media_type);
return Result(-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. // Delete all directories (/user, /boss) and the icon file.
@ -275,8 +275,8 @@ Result ArchiveManager::DeleteExtSaveData(MediaType media_type, u32 high, u32 low
FileSys::GetExtDataContainerPath(media_type_directory, media_type == MediaType::NAND); FileSys::GetExtDataContainerPath(media_type_directory, media_type == MediaType::NAND);
std::string extsavedata_path = FileSys::GetExtSaveDataPath(base_path, path); std::string extsavedata_path = FileSys::GetExtSaveDataPath(base_path, path);
if (FileUtil::Exists(extsavedata_path) && !FileUtil::DeleteDirRecursively(extsavedata_path)) if (FileUtil::Exists(extsavedata_path) && !FileUtil::DeleteDirRecursively(extsavedata_path))
return Result(-1); // TODO(Subv): Find the right error code return ResultUnknown; // TODO(Subv): Find the right error code
return RESULT_SUCCESS; return ResultSuccess;
} }
Result ArchiveManager::DeleteSystemSaveData(u32 high, u32 low) { Result ArchiveManager::DeleteSystemSaveData(u32 high, u32 low) {
@ -287,10 +287,10 @@ Result ArchiveManager::DeleteSystemSaveData(u32 high, u32 low) {
const std::string base_path = FileSys::GetSystemSaveDataContainerPath(nand_directory); const std::string base_path = FileSys::GetSystemSaveDataContainerPath(nand_directory);
const std::string systemsavedata_path = FileSys::GetSystemSaveDataPath(base_path, path); const std::string systemsavedata_path = FileSys::GetSystemSaveDataPath(base_path, path);
if (!FileUtil::DeleteDirRecursively(systemsavedata_path)) { if (!FileUtil::DeleteDirRecursively(systemsavedata_path)) {
return Result(-1); // TODO(Subv): Find the right error code return ResultUnknown; // TODO(Subv): Find the right error code
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result ArchiveManager::CreateSystemSaveData(u32 high, u32 low) { Result ArchiveManager::CreateSystemSaveData(u32 high, u32 low) {
@ -301,10 +301,10 @@ Result ArchiveManager::CreateSystemSaveData(u32 high, u32 low) {
const std::string base_path = FileSys::GetSystemSaveDataContainerPath(nand_directory); const std::string base_path = FileSys::GetSystemSaveDataContainerPath(nand_directory);
const std::string systemsavedata_path = FileSys::GetSystemSaveDataPath(base_path, path); const std::string systemsavedata_path = FileSys::GetSystemSaveDataPath(base_path, path);
if (!FileUtil::CreateFullPath(systemsavedata_path)) { if (!FileUtil::CreateFullPath(systemsavedata_path)) {
return Result(-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 { ResultVal<ArchiveResource> ArchiveManager::GetArchiveResource(MediaType media_type) const {

View File

@ -51,7 +51,7 @@ void Directory::Read(Kernel::HLERequestContext& ctx) {
buffer.Write(entries.data(), 0, read * sizeof(FileSys::Entry)); buffer.Write(entries.data(), 0, read * sizeof(FileSys::Entry));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(read); rb.Push(read);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
} }
@ -62,7 +62,7 @@ void Directory::Close(Kernel::HLERequestContext& ctx) {
backend->Close(); backend->Close();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
} // namespace Service::FS } // namespace Service::FS

View File

@ -86,7 +86,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0); rb.Push<u32>(0);
} else { } else {
buffer.Write(*data, 0, *read); buffer.Write(*data, 0, *read);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(static_cast<u32>(*read)); rb.Push<u32>(static_cast<u32>(*read));
} }
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -130,7 +130,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
async_data->ret = read.Code(); async_data->ret = read.Code();
async_data->read_size = 0; async_data->read_size = 0;
} else { } else {
async_data->ret = RESULT_SUCCESS; async_data->ret = ResultSuccess;
async_data->read_size = *read; async_data->read_size = *read;
} }
@ -157,7 +157,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0); rb.Push<u32>(0);
} else { } else {
async_data->buffer->Write(*async_data->data, 0, async_data->read_size); 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.Push<u32>(static_cast<u32>(async_data->read_size));
} }
rb.PushMappedBuffer(*async_data->buffer); rb.PushMappedBuffer(*async_data->buffer);
@ -180,7 +180,7 @@ void File::Write(Kernel::HLERequestContext& ctx) {
// Subfiles can not be written to // Subfiles can not be written to
if (file->subfile) { if (file->subfile) {
rb.Push(FileSys::ERROR_UNSUPPORTED_OPEN_FLAGS); rb.Push(FileSys::ResultUnsupportedOpenFlags);
rb.Push<u32>(0); rb.Push<u32>(0);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
return; return;
@ -197,7 +197,7 @@ void File::Write(Kernel::HLERequestContext& ctx) {
rb.Push(written.Code()); rb.Push(written.Code());
rb.Push<u32>(0); rb.Push<u32>(0);
} else { } else {
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(static_cast<u32>(*written)); rb.Push<u32>(static_cast<u32>(*written));
} }
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
@ -209,7 +209,7 @@ void File::GetSize(Kernel::HLERequestContext& ctx) {
const FileSessionSlot* file = GetSessionData(ctx.Session()); const FileSessionSlot* file = GetSessionData(ctx.Session());
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u64>(file->size); rb.Push<u64>(file->size);
} }
@ -223,13 +223,13 @@ void File::SetSize(Kernel::HLERequestContext& ctx) {
// SetSize can not be called on subfiles. // SetSize can not be called on subfiles.
if (file->subfile) { if (file->subfile) {
rb.Push(FileSys::ERROR_UNSUPPORTED_OPEN_FLAGS); rb.Push(FileSys::ResultUnsupportedOpenFlags);
return; return;
} }
file->size = size; file->size = size;
backend->SetSize(size); backend->SetSize(size);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void File::Close(Kernel::HLERequestContext& ctx) { void File::Close(Kernel::HLERequestContext& ctx) {
@ -242,7 +242,7 @@ void File::Close(Kernel::HLERequestContext& ctx) {
backend->Close(); backend->Close();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void File::Flush(Kernel::HLERequestContext& ctx) { void File::Flush(Kernel::HLERequestContext& ctx) {
@ -254,12 +254,12 @@ void File::Flush(Kernel::HLERequestContext& ctx) {
// Subfiles can not be flushed. // Subfiles can not be flushed.
if (file->subfile) { if (file->subfile) {
rb.Push(FileSys::ERROR_UNSUPPORTED_OPEN_FLAGS); rb.Push(FileSys::ResultUnsupportedOpenFlags);
return; return;
} }
backend->Flush(); backend->Flush();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void File::SetPriority(Kernel::HLERequestContext& ctx) { void File::SetPriority(Kernel::HLERequestContext& ctx) {
@ -269,7 +269,7 @@ void File::SetPriority(Kernel::HLERequestContext& ctx) {
file->priority = rp.Pop<u32>(); file->priority = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void File::GetPriority(Kernel::HLERequestContext& ctx) { void File::GetPriority(Kernel::HLERequestContext& ctx) {
@ -277,7 +277,7 @@ void File::GetPriority(Kernel::HLERequestContext& ctx) {
const FileSessionSlot* file = GetSessionData(ctx.Session()); const FileSessionSlot* file = GetSessionData(ctx.Session());
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(file->priority); rb.Push(file->priority);
} }
@ -298,7 +298,7 @@ void File::OpenLinkFile(Kernel::HLERequestContext& ctx) {
slot->size = backend->GetSize(); slot->size = backend->GetSize();
slot->subfile = false; slot->subfile = false;
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMoveObjects(client); rb.PushMoveObjects(client);
} }
@ -313,21 +313,21 @@ void File::OpenSubFile(Kernel::HLERequestContext& ctx) {
if (original_file->subfile) { if (original_file->subfile) {
// OpenSubFile can not be called on a file which is already as 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; return;
} }
if (offset < 0 || size < 0) { if (offset < 0 || size < 0) {
rb.Push(FileSys::ERR_WRITE_BEYOND_END); rb.Push(FileSys::ResultWriteBeyondEnd);
return; return;
} }
std::size_t end = offset + size; 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) { if (end > original_file->size) {
rb.Push(FileSys::ERR_WRITE_BEYOND_END); rb.Push(FileSys::ResultWriteBeyondEnd);
return; return;
} }
@ -342,7 +342,7 @@ void File::OpenSubFile(Kernel::HLERequestContext& ctx) {
slot->size = size; slot->size = size;
slot->subfile = true; slot->subfile = true;
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMoveObjects(client); rb.PushMoveObjects(client);
} }

View File

@ -43,7 +43,7 @@ void FS_USER::Initialize(Kernel::HLERequestContext& ctx) {
slot->program_id = system.Kernel().GetProcessById(pid)->codeset->program_id; slot->program_id = system.Kernel().GetProcessById(pid)->codeset->program_id;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void FS_USER::OpenFile(Kernel::HLERequestContext& ctx) { 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); archive_handle, action, input_size, output_size);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void FS_USER::CloseArchive(Kernel::HLERequestContext& ctx) { 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) { void FS_USER::IsSdmcDetected(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(Settings::values.use_virtual_sd.GetValue()); rb.Push(Settings::values.use_virtual_sd.GetValue());
} }
void FS_USER::IsSdmcWriteable(Kernel::HLERequestContext& ctx) { void FS_USER::IsSdmcWriteable(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); 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 // If the SD isn't enabled, it can't be writeable...else, stubbed true
rb.Push(Settings::values.use_virtual_sd.GetValue()); rb.Push(Settings::values.use_virtual_sd.GetValue());
LOG_DEBUG(Service_FS, " (STUBBED)"); LOG_DEBUG(Service_FS, " (STUBBED)");
@ -398,7 +398,7 @@ void FS_USER::FormatSaveData(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
if (archive_id != FS::ArchiveIdCode::SaveData) { if (archive_id != FS::ArchiveIdCode::SaveData) {
LOG_ERROR(Service_FS, "tried to format an archive different than SaveData, {}", archive_id); 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; return;
} }
@ -471,7 +471,7 @@ void FS_USER::GetSdmcArchiveResource(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(*resource); rb.PushRaw(*resource);
} }
@ -488,7 +488,7 @@ void FS_USER::GetNandArchiveResource(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(*resource); rb.PushRaw(*resource);
} }
@ -544,7 +544,7 @@ void FS_USER::DeleteExtSaveData(Kernel::HLERequestContext& ctx) {
void FS_USER::CardSlotIsInserted(Kernel::HLERequestContext& ctx) { void FS_USER::CardSlotIsInserted(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(false); rb.Push(false);
LOG_WARNING(Service_FS, "(STUBBED) called"); 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); LOG_WARNING(Service_FS, "(STUBBED) called, version: 0x{:08X}", version);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void FS_USER::SetPriority(Kernel::HLERequestContext& ctx) { void FS_USER::SetPriority(Kernel::HLERequestContext& ctx) {
@ -623,7 +623,7 @@ void FS_USER::SetPriority(Kernel::HLERequestContext& ctx) {
priority = rp.Pop<u32>(); priority = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_FS, "called priority=0x{:X}", priority); 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); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(priority); rb.Push(priority);
LOG_DEBUG(Service_FS, "called priority=0x{:X}", 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); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(*resource); rb.PushRaw(*resource);
} }
@ -704,7 +704,7 @@ void FS_USER::GetProductInfo(Kernel::HLERequestContext& ctx) {
return; return;
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<ProductInfo>(product_info.value()); rb.PushRaw<ProductInfo>(product_info.value());
} }
@ -737,7 +737,7 @@ void FS_USER::GetProgramLaunchInfo(Kernel::HLERequestContext& ctx) {
program_info.media_type = MediaType::SDMC; program_info.media_type = MediaType::SDMC;
} }
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<ProgramInfo>(program_info); rb.PushRaw<ProgramInfo>(program_info);
} }
@ -801,7 +801,7 @@ void FS_USER::GetSpecialContentIndex(Kernel::HLERequestContext& ctx) {
if (index.Succeeded()) { if (index.Succeeded()) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(index.Unwrap()); rb.Push(index.Unwrap());
} else { } else {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); 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) { void FS_USER::GetNumSeeds(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(FileSys::GetSeedCount()); 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::Seed::Data seed{rp.PopRaw<FileSys::Seed::Data>()};
FileSys::AddSeed({title_id, seed, {}}); FileSys::AddSeed({title_id, seed, {}});
IPC::RequestBuilder rb{rp.MakeBuilder(1, 0)}; IPC::RequestBuilder rb{rp.MakeBuilder(1, 0)};
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void FS_USER::ObsoletedSetSaveDataSecureValue(Kernel::HLERequestContext& ctx) { 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); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void FS_USER::ObsoletedGetSaveDataSecureValue(Kernel::HLERequestContext& ctx) { 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); IPC::RequestBuilder rb = rp.MakeBuilder(4, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
// TODO: Implement Secure Value Lookup & Generation // TODO: Implement Secure Value Lookup & Generation
@ -877,7 +877,7 @@ void FS_USER::SetThisSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void FS_USER::GetThisSaveDataSecureValue(Kernel::HLERequestContext& ctx) { 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); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
// TODO: Implement Secure Value Lookup & Generation // TODO: Implement Secure Value Lookup & Generation
@ -913,7 +913,7 @@ void FS_USER::SetSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void FS_USER::GetSaveDataSecureValue(Kernel::HLERequestContext& ctx) { 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); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
// TODO: Implement Secure Value Lookup & Generation // TODO: Implement Secure Value Lookup & Generation
@ -966,7 +966,7 @@ ResultVal<u16> FS_USER::GetSpecialContentIndexFromGameCard(u64 title_id, Special
if (type > SpecialContentType::DLPChild) { if (type > SpecialContentType::DLPChild) {
// Maybe type 4 is New 3DS update/partition 6 but this needs more research // Maybe type 4 is New 3DS update/partition 6 but this needs more research
// TODO(B3N30): Find correct result code // TODO(B3N30): Find correct result code
return Result(-1); return ResultUnknown;
} }
switch (type) { switch (type) {
@ -985,7 +985,7 @@ ResultVal<u16> FS_USER::GetSpecialContentIndexFromTMD(MediaType media_type, u64
SpecialContentType type) { SpecialContentType type) {
if (type > SpecialContentType::DLPChild) { if (type > SpecialContentType::DLPChild) {
// TODO(B3N30): Find correct result code // TODO(B3N30): Find correct result code
return Result(-1); return ResultUnknown;
} }
std::string tmd_path = AM::GetTitleMetadataPath(media_type, title_id); 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; FileSys::TitleMetadata tmd;
if (tmd.Load(tmd_path) != Loader::ResultStatus::Success || type == SpecialContentType::Update) { if (tmd.Load(tmd_path) != Loader::ResultStatus::Success || type == SpecialContentType::Update) {
// TODO(B3N30): Find correct result code // TODO(B3N30): Find correct result code
return Result(-1); return ResultUnknown;
} }
// TODO(B3N30): Does real 3DS check if content exists in TMD? // 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); ASSERT(false);
} }
return Result(-1); return ResultUnknown;
} }
FS_USER::FS_USER(Core::System& system) FS_USER::FS_USER(Core::System& system)

View File

@ -37,15 +37,15 @@ enum {
}; };
} }
constexpr Result RESULT_FIRST_INITIALIZATION(ErrCodes::FirstInitialization, ErrorModule::GX, constexpr Result ResultFirstInitialization(ErrCodes::FirstInitialization, ErrorModule::GX,
ErrorSummary::Success, ErrorLevel::Success); ErrorSummary::Success, ErrorLevel::Success);
constexpr Result ERR_REGS_OUTOFRANGE_OR_MISALIGNED(ErrCodes::OutofRangeOrMisalignedAddress, constexpr Result ResultRegsOutOfRangeOrMisaligned(ErrCodes::OutofRangeOrMisalignedAddress,
ErrorModule::GX, ErrorSummary::InvalidArgument, ErrorModule::GX, ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E02A01 ErrorLevel::Usage); // 0xE0E02A01
constexpr Result ERR_REGS_MISALIGNED(ErrorDescription::MisalignedSize, ErrorModule::GX, constexpr Result ResultRegsMisaligned(ErrorDescription::MisalignedSize, ErrorModule::GX,
ErrorSummary::InvalidArgument, ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E02BF2 ErrorLevel::Usage); // 0xE0E02BF2
constexpr Result ERR_REGS_INVALID_SIZE(ErrorDescription::InvalidSize, ErrorModule::GX, constexpr Result ResultRegsInvalidSize(ErrorDescription::InvalidSize, ErrorModule::GX,
ErrorSummary::InvalidArgument, ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E02BEC ErrorLevel::Usage); // 0xE0E02BEC
@ -93,7 +93,7 @@ void GSP_GPU::ClientDisconnected(std::shared_ptr<Kernel::ServerSession> server_s
* @param base_address The address of the first register in the sequence * @param base_address The address of the first register in the sequence
* @param size_in_bytes The number of registers to update (size of data) * @param size_in_bytes The number of registers to update (size of data)
* @param data A vector containing the source data * @param data A vector containing the source data
* @return RESULT_SUCCESS if the parameters are valid, error code otherwise * @return ResultSuccess if the parameters are valid, error code otherwise
*/ */
static Result WriteHWRegs(u32 base_address, u32 size_in_bytes, std::span<const u8> data, static Result WriteHWRegs(u32 base_address, u32 size_in_bytes, std::span<const u8> data,
VideoCore::GPU& gpu) { VideoCore::GPU& gpu) {
@ -104,17 +104,17 @@ static Result WriteHWRegs(u32 base_address, u32 size_in_bytes, std::span<const u
LOG_ERROR(Service_GSP, LOG_ERROR(Service_GSP,
"Write address was out of range or misaligned! (address=0x{:08x}, size=0x{:08x})", "Write address was out of range or misaligned! (address=0x{:08x}, size=0x{:08x})",
base_address, size_in_bytes); base_address, size_in_bytes);
return ERR_REGS_OUTOFRANGE_OR_MISALIGNED; return ResultRegsOutOfRangeOrMisaligned;
} }
if (size_in_bytes > max_size_in_bytes) { if (size_in_bytes > max_size_in_bytes) {
LOG_ERROR(Service_GSP, "Out of range size 0x{:08x}", size_in_bytes); LOG_ERROR(Service_GSP, "Out of range size 0x{:08x}", size_in_bytes);
return ERR_REGS_INVALID_SIZE; return ResultRegsInvalidSize;
} }
if (size_in_bytes & 3) { if (size_in_bytes & 3) {
LOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes); LOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes);
return ERR_REGS_MISALIGNED; return ResultRegsMisaligned;
} }
std::size_t offset = 0; std::size_t offset = 0;
@ -128,7 +128,7 @@ static Result WriteHWRegs(u32 base_address, u32 size_in_bytes, std::span<const u
base_address += 4; base_address += 4;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
/** /**
@ -139,7 +139,7 @@ static Result WriteHWRegs(u32 base_address, u32 size_in_bytes, std::span<const u
* @param size_in_bytes The number of registers to update (size of data) * @param size_in_bytes The number of registers to update (size of data)
* @param data A vector containing the data to write * @param data A vector containing the data to write
* @param masks A vector containing the masks * @param masks A vector containing the masks
* @return RESULT_SUCCESS if the parameters are valid, error code otherwise * @return ResultSuccess if the parameters are valid, error code otherwise
*/ */
static Result WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, std::span<const u8> data, static Result WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, std::span<const u8> data,
std::span<const u8> masks, VideoCore::GPU& gpu) { std::span<const u8> masks, VideoCore::GPU& gpu) {
@ -150,17 +150,17 @@ static Result WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, std::span
LOG_ERROR(Service_GSP, LOG_ERROR(Service_GSP,
"Write address was out of range or misaligned! (address=0x{:08x}, size=0x{:08x})", "Write address was out of range or misaligned! (address=0x{:08x}, size=0x{:08x})",
base_address, size_in_bytes); base_address, size_in_bytes);
return ERR_REGS_OUTOFRANGE_OR_MISALIGNED; return ResultRegsOutOfRangeOrMisaligned;
} }
if (size_in_bytes > max_size_in_bytes) { if (size_in_bytes > max_size_in_bytes) {
LOG_ERROR(Service_GSP, "Out of range size 0x{:08x}", size_in_bytes); LOG_ERROR(Service_GSP, "Out of range size 0x{:08x}", size_in_bytes);
return ERR_REGS_INVALID_SIZE; return ResultRegsInvalidSize;
} }
if (size_in_bytes & 3) { if (size_in_bytes & 3) {
LOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes); LOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes);
return ERR_REGS_MISALIGNED; return ResultRegsMisaligned;
} }
std::size_t offset = 0; std::size_t offset = 0;
@ -181,7 +181,7 @@ static Result WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, std::span
base_address += 4; base_address += 4;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
void GSP_GPU::WriteHWRegs(Kernel::HLERequestContext& ctx) { void GSP_GPU::WriteHWRegs(Kernel::HLERequestContext& ctx) {
@ -215,7 +215,7 @@ void GSP_GPU::ReadHWRegs(Kernel::HLERequestContext& ctx) {
if ((reg_addr % 4) != 0 || reg_addr >= 0x420000) { if ((reg_addr % 4) != 0 || reg_addr >= 0x420000) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ERR_REGS_OUTOFRANGE_OR_MISALIGNED); rb.Push(ResultRegsOutOfRangeOrMisaligned);
LOG_ERROR(Service_GSP, "Invalid address 0x{:08x}", reg_addr); LOG_ERROR(Service_GSP, "Invalid address 0x{:08x}", reg_addr);
return; return;
} }
@ -223,7 +223,7 @@ void GSP_GPU::ReadHWRegs(Kernel::HLERequestContext& ctx) {
// Size should be word-aligned // Size should be word-aligned
if ((size % 4) != 0) { if ((size % 4) != 0) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ERR_REGS_MISALIGNED); rb.Push(ResultRegsMisaligned);
LOG_ERROR(Service_GSP, "Invalid size 0x{:08x}", size); LOG_ERROR(Service_GSP, "Invalid size 0x{:08x}", size);
return; return;
} }
@ -235,7 +235,7 @@ void GSP_GPU::ReadHWRegs(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushStaticBuffer(std::move(buffer), 0); rb.PushStaticBuffer(std::move(buffer), 0);
} }
@ -247,7 +247,7 @@ void GSP_GPU::SetBufferSwap(Kernel::HLERequestContext& ctx) {
system.GPU().SetBufferSwap(screen_id, fb_info); system.GPU().SetBufferSwap(screen_id, fb_info);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void GSP_GPU::FlushDataCache(Kernel::HLERequestContext& ctx) { void GSP_GPU::FlushDataCache(Kernel::HLERequestContext& ctx) {
@ -259,7 +259,7 @@ void GSP_GPU::FlushDataCache(Kernel::HLERequestContext& ctx) {
// TODO(purpasmart96): Verify return header on HW // TODO(purpasmart96): Verify return header on HW
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_TRACE(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address, LOG_TRACE(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address,
size, process->process_id); size, process->process_id);
@ -274,7 +274,7 @@ void GSP_GPU::InvalidateDataCache(Kernel::HLERequestContext& ctx) {
// TODO(purpasmart96): Verify return header on HW // TODO(purpasmart96): Verify return header on HW
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_TRACE(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address, LOG_TRACE(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address,
size, process->process_id); size, process->process_id);
@ -285,7 +285,7 @@ void GSP_GPU::SetAxiConfigQoSMode(Kernel::HLERequestContext& ctx) {
u32 mode = rp.Pop<u32>(); u32 mode = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_GSP, "(STUBBED) called mode=0x{:08X}", mode); LOG_DEBUG(Service_GSP, "(STUBBED) called mode=0x{:08X}", mode);
} }
@ -308,9 +308,9 @@ void GSP_GPU::RegisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) {
if (first_initialization) { if (first_initialization) {
// This specific code is required for a successful initialization, rather than 0 // This specific code is required for a successful initialization, rather than 0
first_initialization = false; first_initialization = false;
rb.Push(RESULT_FIRST_INITIALIZATION); rb.Push(ResultFirstInitialization);
} else { } else {
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
rb.Push(session_data->thread_id); rb.Push(session_data->thread_id);
@ -327,7 +327,7 @@ void GSP_GPU::UnregisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) {
session_data->registered = false; session_data->registered = false;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_GSP, "called"); LOG_DEBUG(Service_GSP, "called");
} }
@ -402,7 +402,7 @@ void GSP_GPU::SetLcdForceBlack(Kernel::HLERequestContext& ctx) {
system.GPU().SetColorFill(data); system.GPU().SetColorFill(data);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void GSP_GPU::TriggerCmdReqQueue(Kernel::HLERequestContext& ctx) { void GSP_GPU::TriggerCmdReqQueue(Kernel::HLERequestContext& ctx) {
@ -422,7 +422,7 @@ void GSP_GPU::TriggerCmdReqQueue(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void GSP_GPU::ImportDisplayCaptureInfo(Kernel::HLERequestContext& ctx) { void GSP_GPU::ImportDisplayCaptureInfo(Kernel::HLERequestContext& ctx) {
@ -461,7 +461,7 @@ void GSP_GPU::ImportDisplayCaptureInfo(Kernel::HLERequestContext& ctx) {
bottom_entry.stride = bottom_screen->framebuffer_info[bottom_screen->index].stride; bottom_entry.stride = bottom_screen->framebuffer_info[bottom_screen->index].stride;
IPC::RequestBuilder rb = rp.MakeBuilder(9, 0); IPC::RequestBuilder rb = rp.MakeBuilder(9, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(top_entry); rb.PushRaw(top_entry);
rb.PushRaw(bottom_entry); rb.PushRaw(bottom_entry);
@ -536,7 +536,7 @@ void GSP_GPU::SaveVramSysArea(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void GSP_GPU::RestoreVramSysArea(Kernel::HLERequestContext& ctx) { void GSP_GPU::RestoreVramSysArea(Kernel::HLERequestContext& ctx) {
@ -553,10 +553,10 @@ void GSP_GPU::RestoreVramSysArea(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
ResultCode GSP_GPU::AcquireGpuRight(const Kernel::HLERequestContext& ctx, Result GSP_GPU::AcquireGpuRight(const Kernel::HLERequestContext& ctx,
const std::shared_ptr<Kernel::Process>& process, u32 flag, const std::shared_ptr<Kernel::Process>& process, u32 flag,
bool blocking) { bool blocking) {
const auto session_data = GetSessionData(ctx.Session()); const auto session_data = GetSessionData(ctx.Session());
@ -579,7 +579,7 @@ ResultCode GSP_GPU::AcquireGpuRight(const Kernel::HLERequestContext& ctx,
} }
active_thread_id = session_data->thread_id; active_thread_id = session_data->thread_id;
return RESULT_SUCCESS; return ResultSuccess;
} }
void GSP_GPU::TryAcquireRight(Kernel::HLERequestContext& ctx) { void GSP_GPU::TryAcquireRight(Kernel::HLERequestContext& ctx) {
@ -616,7 +616,7 @@ void GSP_GPU::ReleaseRight(Kernel::HLERequestContext& ctx) {
ReleaseRight(session_data); ReleaseRight(session_data);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_GSP, "called"); LOG_WARNING(Service_GSP, "called");
} }
@ -629,7 +629,7 @@ void GSP_GPU::StoreDataCache(Kernel::HLERequestContext& ctx) {
auto process = rp.PopObject<Kernel::Process>(); auto process = rp.PopObject<Kernel::Process>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_TRACE(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address, LOG_TRACE(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}", address,
size, process->process_id); size, process->process_id);
@ -643,7 +643,7 @@ void GSP_GPU::SetLedForceOff(Kernel::HLERequestContext& ctx) {
system.Kernel().GetSharedPageHandler().Set3DLed(state); system.Kernel().GetSharedPageHandler().Set3DLed(state);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_GSP, "(STUBBED) called"); LOG_DEBUG(Service_GSP, "(STUBBED) called");
} }

View File

@ -308,7 +308,7 @@ void Module::UpdateGyroscopeCallback(std::uintptr_t user_data, s64 cycles_late)
void Module::Interface::GetIPCHandles(Kernel::HLERequestContext& ctx) { void Module::Interface::GetIPCHandles(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 7); IPC::RequestBuilder rb = rp.MakeBuilder(1, 7);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(hid->shared_mem, hid->event_pad_or_touch_1, hid->event_pad_or_touch_2, rb.PushCopyObjects(hid->shared_mem, hid->event_pad_or_touch_1, hid->event_pad_or_touch_2,
hid->event_accelerometer, hid->event_gyroscope, hid->event_debug_pad); hid->event_accelerometer, hid->event_gyroscope, hid->event_debug_pad);
} }
@ -325,7 +325,7 @@ void Module::Interface::EnableAccelerometer(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_HID, "called"); LOG_DEBUG(Service_HID, "called");
} }
@ -341,7 +341,7 @@ void Module::Interface::DisableAccelerometer(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_HID, "called"); LOG_DEBUG(Service_HID, "called");
} }
@ -357,7 +357,7 @@ void Module::Interface::EnableGyroscopeLow(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_HID, "called"); LOG_DEBUG(Service_HID, "called");
} }
@ -373,7 +373,7 @@ void Module::Interface::DisableGyroscopeLow(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_HID, "called"); LOG_DEBUG(Service_HID, "called");
} }
@ -382,7 +382,7 @@ void Module::Interface::GetGyroscopeLowRawToDpsCoefficient(Kernel::HLERequestCon
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(gyroscope_coef); rb.Push(gyroscope_coef);
} }
@ -390,7 +390,7 @@ void Module::Interface::GetGyroscopeLowCalibrateParam(Kernel::HLERequestContext&
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(6, 0); IPC::RequestBuilder rb = rp.MakeBuilder(6, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
const s16 param_unit = 6700; // an approximate value taken from hw const s16 param_unit = 6700; // an approximate value taken from hw
GyroscopeCalibrateParam param = { GyroscopeCalibrateParam param = {
@ -409,7 +409,7 @@ void Module::Interface::GetSoundVolume(Kernel::HLERequestContext& ctx) {
const u8 volume = static_cast<u8>(0x3F * Settings::values.volume.GetValue()); const u8 volume = static_cast<u8>(0x3F * Settings::values.volume.GetValue());
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(volume); rb.Push(volume);
} }

View File

@ -334,7 +334,7 @@ void HTTP_C::Initialize(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
// This returns 0xd8a0a046 if no network connection is available. // This returns 0xd8a0a046 if no network connection is available.
// Just assume we are always connected. // Just assume we are always connected.
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void HTTP_C::InitializeConnectionSession(Kernel::HLERequestContext& ctx) { void HTTP_C::InitializeConnectionSession(Kernel::HLERequestContext& ctx) {
@ -369,7 +369,7 @@ void HTTP_C::InitializeConnectionSession(Kernel::HLERequestContext& ctx) {
session_data->current_http_context = context_handle; session_data->current_http_context = context_handle;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void HTTP_C::BeginRequest(Kernel::HLERequestContext& ctx) { void HTTP_C::BeginRequest(Kernel::HLERequestContext& ctx) {
@ -404,7 +404,7 @@ void HTTP_C::BeginRequest(Kernel::HLERequestContext& ctx) {
http_context.current_copied_data = 0; http_context.current_copied_data = 0;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void HTTP_C::BeginRequestAsync(Kernel::HLERequestContext& ctx) { void HTTP_C::BeginRequestAsync(Kernel::HLERequestContext& ctx) {
@ -439,7 +439,7 @@ void HTTP_C::BeginRequestAsync(Kernel::HLERequestContext& ctx) {
http_context.current_copied_data = 0; http_context.current_copied_data = 0;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void HTTP_C::ReceiveData(Kernel::HLERequestContext& ctx) { void HTTP_C::ReceiveData(Kernel::HLERequestContext& ctx) {
@ -462,7 +462,7 @@ void HTTP_C::ReceiveDataImpl(Kernel::HLERequestContext& ctx, bool timeout) {
Kernel::MappedBuffer* buffer; Kernel::MappedBuffer* buffer;
bool is_complete; bool is_complete;
// Output // Output
Result async_res = RESULT_SUCCESS; Result async_res = ResultSuccess;
}; };
std::shared_ptr<AsyncData> async_data = std::make_shared<AsyncData>(); std::shared_ptr<AsyncData> async_data = std::make_shared<AsyncData>();
async_data->timeout = timeout; async_data->timeout = timeout;
@ -502,7 +502,7 @@ void HTTP_C::ReceiveDataImpl(Kernel::HLERequestContext& ctx, bool timeout) {
[this, async_data](Kernel::HLERequestContext& ctx) { [this, async_data](Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb(ctx, static_cast<u16>(ctx.CommandHeader().command_id.Value()), 1, IPC::RequestBuilder rb(ctx, static_cast<u16>(ctx.CommandHeader().command_id.Value()), 1,
0); 0);
if (async_data->async_res != RESULT_SUCCESS) { if (async_data->async_res != ResultSuccess) {
rb.Push(async_data->async_res); rb.Push(async_data->async_res);
return; return;
} }
@ -516,7 +516,7 @@ void HTTP_C::ReceiveDataImpl(Kernel::HLERequestContext& ctx, bool timeout) {
http_context.current_copied_data, http_context.current_copied_data,
0, remaining_data); 0, remaining_data);
http_context.current_copied_data += remaining_data; http_context.current_copied_data += remaining_data;
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
async_data->buffer->Write(http_context.response.body.data() + async_data->buffer->Write(http_context.response.body.data() +
http_context.current_copied_data, http_context.current_copied_data,
@ -537,7 +537,7 @@ void HTTP_C::SetProxyDefault(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_HTTP, "(STUBBED) called, handle={}", context_handle); LOG_WARNING(Service_HTTP, "(STUBBED) called, handle={}", context_handle);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void HTTP_C::CreateContext(Kernel::HLERequestContext& ctx) { void HTTP_C::CreateContext(Kernel::HLERequestContext& ctx) {
@ -602,7 +602,7 @@ void HTTP_C::CreateContext(Kernel::HLERequestContext& ctx) {
session_data->num_http_contexts++; session_data->num_http_contexts++;
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(context_counter); rb.Push<u32>(context_counter);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
} }
@ -626,7 +626,7 @@ void HTTP_C::CloseContext(Kernel::HLERequestContext& ctx) {
if (itr == contexts.end()) { if (itr == contexts.end()) {
// The real HTTP module just silently fails in this case. // The real HTTP module just silently fails in this case.
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_ERROR(Service_HTTP, "called, context {} not found", context_handle); LOG_ERROR(Service_HTTP, "called, context {} not found", context_handle);
return; return;
} }
@ -639,7 +639,7 @@ void HTTP_C::CloseContext(Kernel::HLERequestContext& ctx) {
session_data->num_http_contexts--; session_data->num_http_contexts--;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void HTTP_C::CancelConnection(Kernel::HLERequestContext& ctx) { void HTTP_C::CancelConnection(Kernel::HLERequestContext& ctx) {
@ -656,7 +656,7 @@ void HTTP_C::CancelConnection(Kernel::HLERequestContext& ctx) {
[[maybe_unused]] Context& http_context = GetContext(context_handle); [[maybe_unused]] Context& http_context = GetContext(context_handle);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void HTTP_C::AddRequestHeader(Kernel::HLERequestContext& ctx) { void HTTP_C::AddRequestHeader(Kernel::HLERequestContext& ctx) {
@ -696,7 +696,7 @@ void HTTP_C::AddRequestHeader(Kernel::HLERequestContext& ctx) {
http_context.headers.emplace_back(name, value); http_context.headers.emplace_back(name, value);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(value_buffer); rb.PushMappedBuffer(value_buffer);
} }
@ -737,7 +737,7 @@ void HTTP_C::AddPostDataAscii(Kernel::HLERequestContext& ctx) {
http_context.post_data.emplace(name, value); http_context.post_data.emplace(name, value);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(value_buffer); rb.PushMappedBuffer(value_buffer);
} }
@ -770,7 +770,7 @@ void HTTP_C::AddPostDataRaw(Kernel::HLERequestContext& ctx) {
buffer.Read(http_context.post_data_raw.data(), 0, buffer.GetSize()); buffer.Read(http_context.post_data_raw.data(), 0, buffer.GetSize());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
} }
@ -836,7 +836,7 @@ void HTTP_C::GetResponseHeader(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb(ctx, static_cast<u16>(ctx.CommandHeader().command_id.Value()), 2, IPC::RequestBuilder rb(ctx, static_cast<u16>(ctx.CommandHeader().command_id.Value()), 2,
2); 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(copied_size); rb.Push(copied_size);
rb.PushMappedBuffer(*async_data->value_buffer); rb.PushMappedBuffer(*async_data->value_buffer);
}); });
@ -859,7 +859,7 @@ void HTTP_C::GetResponseStatusCodeImpl(Kernel::HLERequestContext& ctx, bool time
bool timeout; bool timeout;
u64 timeout_nanos = 0; u64 timeout_nanos = 0;
// Output // Output
Result async_res = RESULT_SUCCESS; Result async_res = ResultSuccess;
}; };
std::shared_ptr<AsyncData> async_data = std::make_shared<AsyncData>(); std::shared_ptr<AsyncData> async_data = std::make_shared<AsyncData>();
@ -896,7 +896,7 @@ void HTTP_C::GetResponseStatusCodeImpl(Kernel::HLERequestContext& ctx, bool time
return 0; return 0;
}, },
[this, async_data](Kernel::HLERequestContext& ctx) { [this, async_data](Kernel::HLERequestContext& ctx) {
if (async_data->async_res != RESULT_SUCCESS) { if (async_data->async_res != ResultSuccess) {
IPC::RequestBuilder rb( IPC::RequestBuilder rb(
ctx, static_cast<u16>(ctx.CommandHeader().command_id.Value()), 1, 0); ctx, static_cast<u16>(ctx.CommandHeader().command_id.Value()), 1, 0);
rb.Push(async_data->async_res); rb.Push(async_data->async_res);
@ -910,7 +910,7 @@ void HTTP_C::GetResponseStatusCodeImpl(Kernel::HLERequestContext& ctx, bool time
IPC::RequestBuilder rb(ctx, static_cast<u16>(ctx.CommandHeader().command_id.Value()), 2, IPC::RequestBuilder rb(ctx, static_cast<u16>(ctx.CommandHeader().command_id.Value()), 2,
0); 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(response_code); rb.Push(response_code);
}); });
} }
@ -924,7 +924,7 @@ void HTTP_C::AddTrustedRootCA(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_HTTP, "(STUBBED) called, handle={}", context_handle); LOG_WARNING(Service_HTTP, "(STUBBED) called, handle={}", context_handle);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(root_ca_data); rb.PushMappedBuffer(root_ca_data);
} }
@ -937,7 +937,7 @@ void HTTP_C::AddDefaultCert(Kernel::HLERequestContext& ctx) {
certificate_id); certificate_id);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void HTTP_C::SetDefaultClientCert(Kernel::HLERequestContext& ctx) { void HTTP_C::SetDefaultClientCert(Kernel::HLERequestContext& ctx) {
@ -963,7 +963,7 @@ void HTTP_C::SetDefaultClientCert(Kernel::HLERequestContext& ctx) {
http_context.clcert_data = &GetClCertA(); http_context.clcert_data = &GetClCertA();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void HTTP_C::SetClientCertContext(Kernel::HLERequestContext& ctx) { void HTTP_C::SetClientCertContext(Kernel::HLERequestContext& ctx) {
@ -1007,7 +1007,7 @@ void HTTP_C::SetClientCertContext(Kernel::HLERequestContext& ctx) {
http_context.ssl_config.client_cert_ctx = cert_context_itr->second; http_context.ssl_config.client_cert_ctx = cert_context_itr->second;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void HTTP_C::GetSSLError(Kernel::HLERequestContext& ctx) { void HTTP_C::GetSSLError(Kernel::HLERequestContext& ctx) {
@ -1020,7 +1020,7 @@ void HTTP_C::GetSSLError(Kernel::HLERequestContext& ctx) {
[[maybe_unused]] Context& http_context = GetContext(context_handle); [[maybe_unused]] Context& http_context = GetContext(context_handle);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
// Since we create the actual http/ssl context only when the request is submitted we can't check // Since we create the actual http/ssl context only when the request is submitted we can't check
// for SSL Errors here. Just submit no error. // for SSL Errors here. Just submit no error.
rb.Push<u32>(0); rb.Push<u32>(0);
@ -1034,7 +1034,7 @@ void HTTP_C::SetSSLOpt(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_HTTP, "(STUBBED) called, context_handle={}, opts={}", context_handle, opts); LOG_WARNING(Service_HTTP, "(STUBBED) called, context_handle={}, opts={}", context_handle, opts);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void HTTP_C::OpenClientCertContext(Kernel::HLERequestContext& ctx) { void HTTP_C::OpenClientCertContext(Kernel::HLERequestContext& ctx) {
@ -1049,7 +1049,7 @@ void HTTP_C::OpenClientCertContext(Kernel::HLERequestContext& ctx) {
auto* session_data = GetSessionData(ctx.Session()); auto* session_data = GetSessionData(ctx.Session());
ASSERT(session_data); ASSERT(session_data);
Result result(RESULT_SUCCESS); Result result(ResultSuccess);
if (!session_data->initialized) { if (!session_data->initialized) {
LOG_ERROR(Service_HTTP, "Command called without Initialize"); LOG_ERROR(Service_HTTP, "Command called without Initialize");
@ -1126,7 +1126,7 @@ void HTTP_C::OpenDefaultClientCertContext(Kernel::HLERequestContext& ctx) {
if (it != client_certs.end()) { if (it != client_certs.end()) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(it->first); rb.Push<u32>(it->first);
LOG_DEBUG(Service_HTTP, "called, with an already loaded cert_id={}", cert_id); LOG_DEBUG(Service_HTTP, "called, with an already loaded cert_id={}", cert_id);
@ -1141,7 +1141,7 @@ void HTTP_C::OpenDefaultClientCertContext(Kernel::HLERequestContext& ctx) {
++session_data->num_client_certs; ++session_data->num_client_certs;
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(client_certs_counter); rb.Push<u32>(client_certs_counter);
} }
@ -1158,7 +1158,7 @@ void HTTP_C::CloseClientCertContext(Kernel::HLERequestContext& ctx) {
LOG_ERROR(Service_HTTP, "Command called with a unkown client cert handle {}", cert_handle); LOG_ERROR(Service_HTTP, "Command called with a unkown client cert handle {}", cert_handle);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
// This just return success without doing anything // This just return success without doing anything
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
return; return;
} }
@ -1166,7 +1166,7 @@ void HTTP_C::CloseClientCertContext(Kernel::HLERequestContext& ctx) {
LOG_ERROR(Service_HTTP, "called from another main session"); LOG_ERROR(Service_HTTP, "called from another main session");
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
// This just return success without doing anything // This just return success without doing anything
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
return; return;
} }
@ -1174,7 +1174,7 @@ void HTTP_C::CloseClientCertContext(Kernel::HLERequestContext& ctx) {
session_data->num_client_certs--; session_data->num_client_certs--;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void HTTP_C::SetKeepAlive(Kernel::HLERequestContext& ctx) { void HTTP_C::SetKeepAlive(Kernel::HLERequestContext& ctx) {
@ -1185,7 +1185,7 @@ void HTTP_C::SetKeepAlive(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_HTTP, "(STUBBED) called, handle={}, option={}", context_handle, option); LOG_WARNING(Service_HTTP, "(STUBBED) called, handle={}, option={}", context_handle, option);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void HTTP_C::Finalize(Kernel::HLERequestContext& ctx) { void HTTP_C::Finalize(Kernel::HLERequestContext& ctx) {
@ -1194,7 +1194,7 @@ void HTTP_C::Finalize(Kernel::HLERequestContext& ctx) {
shared_memory = nullptr; shared_memory = nullptr;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_HTTP, "(STUBBED) called"); LOG_WARNING(Service_HTTP, "(STUBBED) called");
} }
@ -1230,7 +1230,7 @@ void HTTP_C::GetDownloadSizeState(Kernel::HLERequestContext& ctx) {
content_length); content_length);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(http_context.current_copied_data)); rb.Push(static_cast<u32>(http_context.current_copied_data));
rb.Push(content_length); rb.Push(content_length);
} }

View File

@ -130,7 +130,7 @@ void IR_RST::UpdateCallback(std::uintptr_t user_data, s64 cycles_late) {
void IR_RST::GetHandles(Kernel::HLERequestContext& ctx) { void IR_RST::GetHandles(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 3); IPC::RequestBuilder rb = rp.MakeBuilder(1, 3);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMoveObjects(shared_memory, update_event); rb.PushMoveObjects(shared_memory, update_event);
} }
@ -147,7 +147,7 @@ void IR_RST::Initialize(Kernel::HLERequestContext& ctx) {
system.CoreTiming().ScheduleEvent(msToCycles(update_period), update_callback_id); system.CoreTiming().ScheduleEvent(msToCycles(update_period), update_callback_id);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_IR, "called. update_period={}, raw_c_stick={}", update_period, raw_c_stick); LOG_DEBUG(Service_IR, "called. update_period={}, raw_c_stick={}", update_period, raw_c_stick);
} }
@ -159,7 +159,7 @@ void IR_RST::Shutdown(Kernel::HLERequestContext& ctx) {
UnloadInputDevices(); UnloadInputDevices();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_IR, "called"); LOG_DEBUG(Service_IR, "called");
} }

View File

@ -293,7 +293,7 @@ void IR_USER::InitializeIrNopShared(Kernel::HLERequestContext& ctx) {
shared_memory_init.initialized = 1; shared_memory_init.initialized = 1;
std::memcpy(shared_memory->GetPointer(), &shared_memory_init, sizeof(SharedMemoryHeader)); std::memcpy(shared_memory->GetPointer(), &shared_memory_init, sizeof(SharedMemoryHeader));
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_INFO(Service_IR, LOG_INFO(Service_IR,
"called, shared_buff_size={}, recv_buff_size={}, " "called, shared_buff_size={}, recv_buff_size={}, "
@ -325,7 +325,7 @@ void IR_USER::RequireConnection(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_INFO(Service_IR, "called, device_id = {}", device_id); LOG_INFO(Service_IR, "called, device_id = {}", device_id);
} }
@ -333,7 +333,7 @@ void IR_USER::RequireConnection(Kernel::HLERequestContext& ctx) {
void IR_USER::GetReceiveEvent(Kernel::HLERequestContext& ctx) { void IR_USER::GetReceiveEvent(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb(ctx, 0x0A, 1, 2); IPC::RequestBuilder rb(ctx, 0x0A, 1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(receive_event); rb.PushCopyObjects(receive_event);
LOG_INFO(Service_IR, "called"); LOG_INFO(Service_IR, "called");
@ -342,7 +342,7 @@ void IR_USER::GetReceiveEvent(Kernel::HLERequestContext& ctx) {
void IR_USER::GetSendEvent(Kernel::HLERequestContext& ctx) { void IR_USER::GetSendEvent(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb(ctx, 0x0B, 1, 2); IPC::RequestBuilder rb(ctx, 0x0B, 1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(send_event); rb.PushCopyObjects(send_event);
LOG_INFO(Service_IR, "called"); LOG_INFO(Service_IR, "called");
@ -360,7 +360,7 @@ void IR_USER::Disconnect(Kernel::HLERequestContext& ctx) {
shared_memory_ptr[offsetof(SharedMemoryHeader, connected)] = 0; shared_memory_ptr[offsetof(SharedMemoryHeader, connected)] = 0;
IPC::RequestBuilder rb(ctx, 0x09, 1, 0); IPC::RequestBuilder rb(ctx, 0x09, 1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_INFO(Service_IR, "called"); LOG_INFO(Service_IR, "called");
} }
@ -368,7 +368,7 @@ void IR_USER::Disconnect(Kernel::HLERequestContext& ctx) {
void IR_USER::GetConnectionStatusEvent(Kernel::HLERequestContext& ctx) { void IR_USER::GetConnectionStatusEvent(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb(ctx, 0x0C, 1, 2); IPC::RequestBuilder rb(ctx, 0x0C, 1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(conn_status_event); rb.PushCopyObjects(conn_status_event);
LOG_INFO(Service_IR, "called"); LOG_INFO(Service_IR, "called");
@ -384,7 +384,7 @@ void IR_USER::FinalizeIrNop(Kernel::HLERequestContext& ctx) {
receive_buffer = nullptr; receive_buffer = nullptr;
IPC::RequestBuilder rb(ctx, 0x02, 1, 0); IPC::RequestBuilder rb(ctx, 0x02, 1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_INFO(Service_IR, "called"); LOG_INFO(Service_IR, "called");
} }
@ -399,7 +399,7 @@ void IR_USER::SendIrNop(Kernel::HLERequestContext& ctx) {
if (connected_device) { if (connected_device) {
extra_hid->OnReceive(buffer); extra_hid->OnReceive(buffer);
send_event->Signal(); send_event->Signal();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
LOG_ERROR(Service_IR, "not connected"); LOG_ERROR(Service_IR, "not connected");
rb.Push(Result(static_cast<ErrorDescription>(13), ErrorModule::IR, rb.Push(Result(static_cast<ErrorDescription>(13), ErrorModule::IR,
@ -416,7 +416,7 @@ void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
if (receive_buffer->Release(count)) { if (receive_buffer->Release(count)) {
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} else { } else {
LOG_ERROR(Service_IR, "failed to release {} packets", count); LOG_ERROR(Service_IR, "failed to release {} packets", count);
rb.Push(Result(ErrorDescription::NoData, ErrorModule::IR, ErrorSummary::NotFound, rb.Push(Result(ErrorDescription::NoData, ErrorModule::IR, ErrorSummary::NotFound,

View File

@ -88,7 +88,7 @@ Result CROHelper::ApplyRelocation(VAddr target_address, RelocationType relocatio
default: default:
return CROFormatError(0x22); return CROFormatError(0x22);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ClearRelocation(VAddr target_address, RelocationType relocation_type) { Result CROHelper::ClearRelocation(VAddr target_address, RelocationType relocation_type) {
@ -111,7 +111,7 @@ Result CROHelper::ClearRelocation(VAddr target_address, RelocationType relocatio
default: default:
return CROFormatError(0x22); return CROFormatError(0x22);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ApplyRelocationBatch(VAddr batch, u32 symbol_address, bool reset) { Result CROHelper::ApplyRelocationBatch(VAddr batch, u32 symbol_address, bool reset) {
@ -146,7 +146,7 @@ Result CROHelper::ApplyRelocationBatch(VAddr batch, u32 symbol_address, bool res
system.Memory().ReadBlock(process, batch, &relocation, sizeof(RelocationEntry)); system.Memory().ReadBlock(process, batch, &relocation, sizeof(RelocationEntry));
relocation.is_batch_resolved = reset ? 0 : 1; relocation.is_batch_resolved = reset ? 0 : 1;
system.Memory().WriteBlock(process, batch, &relocation, sizeof(RelocationEntry)); system.Memory().WriteBlock(process, batch, &relocation, sizeof(RelocationEntry));
return RESULT_SUCCESS; return ResultSuccess;
} }
VAddr CROHelper::FindExportNamedSymbol(const std::string& name) const { VAddr CROHelper::FindExportNamedSymbol(const std::string& name) const {
@ -269,7 +269,7 @@ Result CROHelper::RebaseHeader(u32 cro_size) {
return error; return error;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
ResultVal<VAddr> CROHelper::RebaseSegmentTable(u32 cro_size, VAddr data_segment_address, ResultVal<VAddr> CROHelper::RebaseSegmentTable(u32 cro_size, VAddr data_segment_address,
@ -323,7 +323,7 @@ Result CROHelper::RebaseExportNamedSymbolTable() {
SetEntry(system.Memory(), i, entry); SetEntry(system.Memory(), i, entry);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::VerifyExportTreeTable() const { Result CROHelper::VerifyExportTreeTable() const {
@ -336,7 +336,7 @@ Result CROHelper::VerifyExportTreeTable() const {
return CROFormatError(0x11); return CROFormatError(0x11);
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::RebaseImportModuleTable() { Result CROHelper::RebaseImportModuleTable() {
@ -382,7 +382,7 @@ Result CROHelper::RebaseImportModuleTable() {
SetEntry(system.Memory(), i, entry); SetEntry(system.Memory(), i, entry);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::RebaseImportNamedSymbolTable() { Result CROHelper::RebaseImportNamedSymbolTable() {
@ -416,7 +416,7 @@ Result CROHelper::RebaseImportNamedSymbolTable() {
SetEntry(system.Memory(), i, entry); SetEntry(system.Memory(), i, entry);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::RebaseImportIndexedSymbolTable() { Result CROHelper::RebaseImportIndexedSymbolTable() {
@ -440,7 +440,7 @@ Result CROHelper::RebaseImportIndexedSymbolTable() {
SetEntry(system.Memory(), i, entry); SetEntry(system.Memory(), i, entry);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::RebaseImportAnonymousSymbolTable() { Result CROHelper::RebaseImportAnonymousSymbolTable() {
@ -464,7 +464,7 @@ Result CROHelper::RebaseImportAnonymousSymbolTable() {
SetEntry(system.Memory(), i, entry); SetEntry(system.Memory(), i, entry);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
VAddr CROHelper::GetOnUnresolvedAddress() { VAddr CROHelper::GetOnUnresolvedAddress() {
@ -508,7 +508,7 @@ Result CROHelper::ResetExternalRelocations() {
batch_begin = relocation.is_batch_end != 0; batch_begin = relocation.is_batch_end != 0;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ClearExternalRelocations() { Result CROHelper::ClearExternalRelocations() {
@ -540,7 +540,7 @@ Result CROHelper::ClearExternalRelocations() {
batch_begin = relocation.is_batch_end != 0; batch_begin = relocation.is_batch_end != 0;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ApplyStaticAnonymousSymbolToCRS(VAddr crs_address) { Result CROHelper::ApplyStaticAnonymousSymbolToCRS(VAddr crs_address) {
@ -572,7 +572,7 @@ Result CROHelper::ApplyStaticAnonymousSymbolToCRS(VAddr crs_address) {
return result; return result;
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ApplyInternalRelocations(u32 old_data_segment_address) { Result CROHelper::ApplyInternalRelocations(u32 old_data_segment_address) {
@ -613,7 +613,7 @@ Result CROHelper::ApplyInternalRelocations(u32 old_data_segment_address) {
return result; return result;
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ClearInternalRelocations() { Result CROHelper::ClearInternalRelocations() {
@ -633,7 +633,7 @@ Result CROHelper::ClearInternalRelocations() {
return result; return result;
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
void CROHelper::UnrebaseImportAnonymousSymbolTable() { void CROHelper::UnrebaseImportAnonymousSymbolTable() {
@ -786,7 +786,7 @@ Result CROHelper::ApplyImportNamedSymbol(VAddr crs_address) {
} }
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ResetImportNamedSymbol() { Result CROHelper::ResetImportNamedSymbol() {
@ -807,7 +807,7 @@ Result CROHelper::ResetImportNamedSymbol() {
return result; return result;
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ResetImportIndexedSymbol() { Result CROHelper::ResetImportIndexedSymbol() {
@ -828,7 +828,7 @@ Result CROHelper::ResetImportIndexedSymbol() {
return result; return result;
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ResetImportAnonymousSymbol() { Result CROHelper::ResetImportAnonymousSymbol() {
@ -849,7 +849,7 @@ Result CROHelper::ResetImportAnonymousSymbol() {
return result; return result;
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ApplyModuleImport(VAddr crs_address) { Result CROHelper::ApplyModuleImport(VAddr crs_address) {
@ -905,7 +905,7 @@ Result CROHelper::ApplyModuleImport(VAddr crs_address) {
return result; return result;
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ApplyExportNamedSymbol(CROHelper target) { Result CROHelper::ApplyExportNamedSymbol(CROHelper target) {
@ -935,7 +935,7 @@ Result CROHelper::ApplyExportNamedSymbol(CROHelper target) {
} }
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ResetExportNamedSymbol(CROHelper target) { Result CROHelper::ResetExportNamedSymbol(CROHelper target) {
@ -967,7 +967,7 @@ Result CROHelper::ResetExportNamedSymbol(CROHelper target) {
} }
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ApplyModuleExport(CROHelper target) { Result CROHelper::ApplyModuleExport(CROHelper target) {
@ -1013,7 +1013,7 @@ Result CROHelper::ApplyModuleExport(CROHelper target) {
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ResetModuleExport(CROHelper target) { Result CROHelper::ResetModuleExport(CROHelper target) {
@ -1057,7 +1057,7 @@ Result CROHelper::ResetModuleExport(CROHelper target) {
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ApplyExitRelocations(VAddr crs_address) { Result CROHelper::ApplyExitRelocations(VAddr crs_address) {
@ -1099,7 +1099,7 @@ Result CROHelper::ApplyExitRelocations(VAddr crs_address) {
} }
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
/** /**
@ -1109,14 +1109,14 @@ Result CROHelper::ApplyExitRelocations(VAddr crs_address) {
* whole string (table) is terminated properly, despite that it is not actually one string. * whole string (table) is terminated properly, despite that it is not actually one string.
* @param address the virtual address of the string (table) * @param address the virtual address of the string (table)
* @param size the size of the string (table), including the terminating 0 * @param size the size of the string (table), including the terminating 0
* @returns Result RESULT_SUCCESS if the size matches, otherwise error code. * @returns Result ResultSuccess if the size matches, otherwise error code.
*/ */
static Result VerifyStringTableLength(Memory::MemorySystem& memory, VAddr address, u32 size) { static Result VerifyStringTableLength(Memory::MemorySystem& memory, VAddr address, u32 size) {
if (size != 0) { if (size != 0) {
if (memory.Read8(address + size - 1) != 0) if (memory.Read8(address + size - 1) != 0)
return CROFormatError(0x0B); return CROFormatError(0x0B);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::Rebase(VAddr crs_address, u32 cro_size, VAddr data_segment_addresss, Result CROHelper::Rebase(VAddr crs_address, u32 cro_size, VAddr data_segment_addresss,
@ -1225,7 +1225,7 @@ Result CROHelper::Rebase(VAddr crs_address, u32 cro_size, VAddr data_segment_add
} }
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
void CROHelper::Unrebase(bool is_crs) { void CROHelper::Unrebase(bool is_crs) {
@ -1248,11 +1248,11 @@ void CROHelper::Unrebase(bool is_crs) {
Result CROHelper::VerifyHash(u32 cro_size, VAddr crr) const { Result CROHelper::VerifyHash(u32 cro_size, VAddr crr) const {
// TODO(wwylele): actually verify the hash // TODO(wwylele): actually verify the hash
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::Link(VAddr crs_address, bool link_on_load_bug_fix) { Result CROHelper::Link(VAddr crs_address, bool link_on_load_bug_fix) {
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
{ {
VAddr data_segment_address = 0; VAddr data_segment_address = 0;
@ -1322,7 +1322,7 @@ Result CROHelper::Link(VAddr crs_address, bool link_on_load_bug_fix) {
return result; return result;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::Unlink(VAddr crs_address) { Result CROHelper::Unlink(VAddr crs_address) {
@ -1367,7 +1367,7 @@ Result CROHelper::Unlink(VAddr crs_address) {
return result; return result;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result CROHelper::ClearRelocations() { Result CROHelper::ClearRelocations() {
@ -1382,7 +1382,7 @@ Result CROHelper::ClearRelocations() {
LOG_ERROR(Service_LDR, "Error clearing internal relocations {:08X}", result.raw); LOG_ERROR(Service_LDR, "Error clearing internal relocations {:08X}", result.raw);
return result; return result;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
void CROHelper::InitCRS() { void CROHelper::InitCRS() {

View File

@ -51,7 +51,7 @@ public:
* @param bss_segment_address the buffer address for .bss segment * @param bss_segment_address the buffer address for .bss segment
* @param bss_segment_size the buffer size for .bss segment * @param bss_segment_size the buffer size for .bss segment
* @param is_crs true if the module itself is the static module * @param is_crs true if the module itself is the static module
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result Rebase(VAddr crs_address, u32 cro_size, VAddr data_segment_address, Result Rebase(VAddr crs_address, u32 cro_size, VAddr data_segment_address,
u32 data_segment_size, VAddr bss_segment_address, u32 bss_segment_size, u32 data_segment_size, VAddr bss_segment_address, u32 bss_segment_size,
@ -67,7 +67,7 @@ public:
* Verifies module hash by CRR. * Verifies module hash by CRR.
* @param cro_size the size of the CRO * @param cro_size the size of the CRO
* @param crr the virtual address of the CRR * @param crr the virtual address of the CRR
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result VerifyHash(u32 cro_size, VAddr crr) const; Result VerifyHash(u32 cro_size, VAddr crr) const;
@ -75,20 +75,20 @@ public:
* Links this module with all registered auto-link module. * Links this module with all registered auto-link module.
* @param crs_address the virtual address of the static module * @param crs_address the virtual address of the static module
* @param link_on_load_bug_fix true if links when loading and fixes the bug * @param link_on_load_bug_fix true if links when loading and fixes the bug
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result Link(VAddr crs_address, bool link_on_load_bug_fix); Result Link(VAddr crs_address, bool link_on_load_bug_fix);
/** /**
* Unlinks this module with other modules. * Unlinks this module with other modules.
* @param crs_address the virtual address of the static module * @param crs_address the virtual address of the static module
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result Unlink(VAddr crs_address); Result Unlink(VAddr crs_address);
/** /**
* Clears all relocations to zero. * Clears all relocations to zero.
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ClearRelocations(); Result ClearRelocations();
@ -465,7 +465,7 @@ private:
* CROHelper and returns ResultVal<bool>. It should return true to continue the * CROHelper and returns ResultVal<bool>. It should return true to continue the
* iteration, * iteration,
* false to stop the iteration, or an error code (which will also stop the iteration). * false to stop the iteration, or an error code (which will also stop the iteration).
* @returns Result indicating the result of the operation, RESULT_SUCCESS if all iteration * @returns Result indicating the result of the operation, ResultSuccess if all iteration
* success, * success,
* otherwise error code of the last iteration. * otherwise error code of the last iteration.
*/ */
@ -480,7 +480,7 @@ private:
break; break;
current = cro.NextModule(); current = cro.NextModule();
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
/** /**
@ -491,7 +491,7 @@ private:
* @param symbol_address the symbol address to be relocated with * @param symbol_address the symbol address to be relocated with
* @param target_future_address the future address of the target. * @param target_future_address the future address of the target.
* Usually equals to target_address, but will be different for a target in .data segment * Usually equals to target_address, but will be different for a target in .data segment
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ApplyRelocation(VAddr target_address, RelocationType relocation_type, u32 addend, Result ApplyRelocation(VAddr target_address, RelocationType relocation_type, u32 addend,
u32 symbol_address, u32 target_future_address); u32 symbol_address, u32 target_future_address);
@ -500,7 +500,7 @@ private:
* Clears a relocation to zero * Clears a relocation to zero
* @param target_address where to apply the relocation * @param target_address where to apply the relocation
* @param relocation_type the type of the relocation * @param relocation_type the type of the relocation
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ClearRelocation(VAddr target_address, RelocationType relocation_type); Result ClearRelocation(VAddr target_address, RelocationType relocation_type);
@ -510,7 +510,7 @@ private:
* @param symbol_address the symbol address to be relocated with * @param symbol_address the symbol address to be relocated with
* @param reset false to set the batch to resolved state, true to reset the batch to unresolved * @param reset false to set the batch to resolved state, true to reset the batch to unresolved
* state * state
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ApplyRelocationBatch(VAddr batch, u32 symbol_address, bool reset = false); Result ApplyRelocationBatch(VAddr batch, u32 symbol_address, bool reset = false);
@ -524,7 +524,7 @@ private:
/** /**
* Rebases offsets in module header according to module address. * Rebases offsets in module header according to module address.
* @param cro_size the size of the CRO file * @param cro_size the size of the CRO file
* @returns Result RESULT_SUCCESS if all offsets are verified as valid, otherwise error * @returns Result ResultSuccess if all offsets are verified as valid, otherwise error
* code. * code.
*/ */
Result RebaseHeader(u32 cro_size); Result RebaseHeader(u32 cro_size);
@ -544,42 +544,42 @@ private:
/** /**
* Rebases offsets in exported named symbol table according to module address. * Rebases offsets in exported named symbol table according to module address.
* @returns Result RESULT_SUCCESS if all offsets are verified as valid, otherwise error * @returns Result ResultSuccess if all offsets are verified as valid, otherwise error
* code. * code.
*/ */
Result RebaseExportNamedSymbolTable(); Result RebaseExportNamedSymbolTable();
/** /**
* Verifies indices in export tree table. * Verifies indices in export tree table.
* @returns Result RESULT_SUCCESS if all indices are verified as valid, otherwise error * @returns Result ResultSuccess if all indices are verified as valid, otherwise error
* code. * code.
*/ */
Result VerifyExportTreeTable() const; Result VerifyExportTreeTable() const;
/** /**
* Rebases offsets in exported module table according to module address. * Rebases offsets in exported module table according to module address.
* @returns Result RESULT_SUCCESS if all offsets are verified as valid, otherwise error * @returns Result ResultSuccess if all offsets are verified as valid, otherwise error
* code. * code.
*/ */
Result RebaseImportModuleTable(); Result RebaseImportModuleTable();
/** /**
* Rebases offsets in imported named symbol table according to module address. * Rebases offsets in imported named symbol table according to module address.
* @returns Result RESULT_SUCCESS if all offsets are verified as valid, otherwise error * @returns Result ResultSuccess if all offsets are verified as valid, otherwise error
* code. * code.
*/ */
Result RebaseImportNamedSymbolTable(); Result RebaseImportNamedSymbolTable();
/** /**
* Rebases offsets in imported indexed symbol table according to module address. * Rebases offsets in imported indexed symbol table according to module address.
* @returns Result RESULT_SUCCESS if all offsets are verified as valid, otherwise error * @returns Result ResultSuccess if all offsets are verified as valid, otherwise error
* code. * code.
*/ */
Result RebaseImportIndexedSymbolTable(); Result RebaseImportIndexedSymbolTable();
/** /**
* Rebases offsets in imported anonymous symbol table according to module address. * Rebases offsets in imported anonymous symbol table according to module address.
* @returns Result RESULT_SUCCESS if all offsets are verified as valid, otherwise error * @returns Result ResultSuccess if all offsets are verified as valid, otherwise error
* code. * code.
*/ */
Result RebaseImportAnonymousSymbolTable(); Result RebaseImportAnonymousSymbolTable();
@ -593,33 +593,33 @@ private:
/** /**
* Resets all external relocations to unresolved state. * Resets all external relocations to unresolved state.
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ResetExternalRelocations(); Result ResetExternalRelocations();
/** /**
* Clears all external relocations to zero. * Clears all external relocations to zero.
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ClearExternalRelocations(); Result ClearExternalRelocations();
/** /**
* Applies all static anonymous symbol to the static module. * Applies all static anonymous symbol to the static module.
* @param crs_address the virtual address of the static module * @param crs_address the virtual address of the static module
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ApplyStaticAnonymousSymbolToCRS(VAddr crs_address); Result ApplyStaticAnonymousSymbolToCRS(VAddr crs_address);
/** /**
* Applies all internal relocations to the module itself. * Applies all internal relocations to the module itself.
* @param old_data_segment_address the virtual address of data segment in CRO buffer * @param old_data_segment_address the virtual address of data segment in CRO buffer
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ApplyInternalRelocations(u32 old_data_segment_address); Result ApplyInternalRelocations(u32 old_data_segment_address);
/** /**
* Clears all internal relocations to zero. * Clears all internal relocations to zero.
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ClearInternalRelocations(); Result ClearInternalRelocations();
@ -648,25 +648,25 @@ private:
* Looks up all imported named symbols of this module in all registered auto-link modules, and * Looks up all imported named symbols of this module in all registered auto-link modules, and
* resolves them if found. * resolves them if found.
* @param crs_address the virtual address of the static module * @param crs_address the virtual address of the static module
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ApplyImportNamedSymbol(VAddr crs_address); Result ApplyImportNamedSymbol(VAddr crs_address);
/** /**
* Resets all imported named symbols of this module to unresolved state. * Resets all imported named symbols of this module to unresolved state.
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ResetImportNamedSymbol(); Result ResetImportNamedSymbol();
/** /**
* Resets all imported indexed symbols of this module to unresolved state. * Resets all imported indexed symbols of this module to unresolved state.
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ResetImportIndexedSymbol(); Result ResetImportIndexedSymbol();
/** /**
* Resets all imported anonymous symbols of this module to unresolved state. * Resets all imported anonymous symbols of this module to unresolved state.
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ResetImportAnonymousSymbol(); Result ResetImportAnonymousSymbol();
@ -674,21 +674,21 @@ private:
* Finds registered auto-link modules that this module imports, and resolves indexed and * Finds registered auto-link modules that this module imports, and resolves indexed and
* anonymous symbols exported by them. * anonymous symbols exported by them.
* @param crs_address the virtual address of the static module * @param crs_address the virtual address of the static module
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ApplyModuleImport(VAddr crs_address); Result ApplyModuleImport(VAddr crs_address);
/** /**
* Resolves target module's imported named symbols that exported by this module. * Resolves target module's imported named symbols that exported by this module.
* @param target the module to resolve. * @param target the module to resolve.
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ApplyExportNamedSymbol(CROHelper target); Result ApplyExportNamedSymbol(CROHelper target);
/** /**
* Resets target's named symbols imported from this module to unresolved state. * Resets target's named symbols imported from this module to unresolved state.
* @param target the module to reset. * @param target the module to reset.
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ResetExportNamedSymbol(CROHelper target); Result ResetExportNamedSymbol(CROHelper target);
@ -696,21 +696,21 @@ private:
* Resolves imported indexed and anonymous symbols in the target module which imports this * Resolves imported indexed and anonymous symbols in the target module which imports this
* module. * module.
* @param target the module to resolve. * @param target the module to resolve.
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ApplyModuleExport(CROHelper target); Result ApplyModuleExport(CROHelper target);
/** /**
* Resets target's indexed and anonymous symbol imported from this module to unresolved state. * Resets target's indexed and anonymous symbol imported from this module to unresolved state.
* @param target the module to reset. * @param target the module to reset.
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ResetModuleExport(CROHelper target); Result ResetModuleExport(CROHelper target);
/** /**
* Resolves the exit function in this module * Resolves the exit function in this module
* @param crs_address the virtual address of the static module. * @param crs_address the virtual address of the static module.
* @returns Result RESULT_SUCCESS on success, otherwise error code. * @returns Result ResultSuccess on success, otherwise error code.
*/ */
Result ApplyExitRelocations(VAddr crs_address); Result ApplyExitRelocations(VAddr crs_address);
}; };

View File

@ -118,7 +118,7 @@ void RO::Initialize(Kernel::HLERequestContext& ctx) {
return; return;
} }
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
result = process->Map(crs_address, crs_buffer_ptr, crs_size, Kernel::VMAPermission::Read, true); result = process->Map(crs_address, crs_buffer_ptr, crs_size, Kernel::VMAPermission::Read, true);
if (result.IsError()) { if (result.IsError()) {
@ -139,7 +139,7 @@ void RO::Initialize(Kernel::HLERequestContext& ctx) {
slot->loaded_crs = crs_address; slot->loaded_crs = crs_address;
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void RO::LoadCRR(Kernel::HLERequestContext& ctx) { void RO::LoadCRR(Kernel::HLERequestContext& ctx) {
@ -149,7 +149,7 @@ void RO::LoadCRR(Kernel::HLERequestContext& ctx) {
auto process = rp.PopObject<Kernel::Process>(); auto process = rp.PopObject<Kernel::Process>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_LDR, "(STUBBED) called, crr_buffer_ptr=0x{:08X}, crr_size=0x{:08X}", LOG_WARNING(Service_LDR, "(STUBBED) called, crr_buffer_ptr=0x{:08X}, crr_size=0x{:08X}",
crr_buffer_ptr, crr_size); crr_buffer_ptr, crr_size);
@ -161,7 +161,7 @@ void RO::UnloadCRR(Kernel::HLERequestContext& ctx) {
auto process = rp.PopObject<Kernel::Process>(); auto process = rp.PopObject<Kernel::Process>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_LDR, "(STUBBED) called, crr_buffer_ptr=0x{:08X}", crr_buffer_ptr); LOG_WARNING(Service_LDR, "(STUBBED) called, crr_buffer_ptr=0x{:08X}", crr_buffer_ptr);
} }
@ -251,7 +251,7 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
return; return;
} }
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
result = process->Map(cro_address, cro_buffer_ptr, cro_size, Kernel::VMAPermission::Read, true); result = process->Map(cro_address, cro_buffer_ptr, cro_size, Kernel::VMAPermission::Read, true);
if (result.IsError()) { if (result.IsError()) {
@ -330,7 +330,7 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
LOG_INFO(Service_LDR, "CRO \"{}\" loaded at 0x{:08X}, fixed_end=0x{:08X}", cro.ModuleName(), LOG_INFO(Service_LDR, "CRO \"{}\" loaded at 0x{:08X}, fixed_end=0x{:08X}", cro.ModuleName(),
cro_address, cro_address + fix_size); cro_address, cro_address + fix_size);
rb.Push(RESULT_SUCCESS, fix_size); rb.Push(ResultSuccess, fix_size);
} }
void RO::UnloadCRO(Kernel::HLERequestContext& ctx) { void RO::UnloadCRO(Kernel::HLERequestContext& ctx) {
@ -502,7 +502,7 @@ void RO::Shutdown(Kernel::HLERequestContext& ctx) {
CROHelper crs(slot->loaded_crs, *process, system); CROHelper crs(slot->loaded_crs, *process, system);
crs.Unrebase(true); crs.Unrebase(true);
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
result = process->Unmap(slot->loaded_crs, crs_buffer_ptr, crs.GetFileSize(), result = process->Unmap(slot->loaded_crs, crs_buffer_ptr, crs.GetFileSize(),
Kernel::VMAPermission::ReadWrite, true); Kernel::VMAPermission::ReadWrite, true);

View File

@ -157,7 +157,7 @@ struct MIC_U::Impl {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_TRACE(Service_MIC, "called, size=0x{:X}", size); LOG_TRACE(Service_MIC, "called, size=0x{:X}", size);
} }
@ -166,7 +166,7 @@ struct MIC_U::Impl {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
shared_memory = nullptr; shared_memory = nullptr;
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_TRACE(Service_MIC, "called"); LOG_TRACE(Service_MIC, "called");
} }
@ -230,7 +230,7 @@ struct MIC_U::Impl {
timing.ScheduleEvent(GetBufferUpdatePeriod(state.sample_rate), buffer_write_event); timing.ScheduleEvent(GetBufferUpdatePeriod(state.sample_rate), buffer_write_event);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_TRACE(Service_MIC, LOG_TRACE(Service_MIC,
"called, encoding={}, sample_rate={}, " "called, encoding={}, sample_rate={}, "
"audio_buffer_offset={}, audio_buffer_size={}, audio_buffer_loop={}", "audio_buffer_offset={}, audio_buffer_size={}, audio_buffer_loop={}",
@ -246,7 +246,7 @@ struct MIC_U::Impl {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_TRACE(Service_MIC, "sample_rate={}", sample_rate); LOG_TRACE(Service_MIC, "sample_rate={}", sample_rate);
} }
@ -254,7 +254,7 @@ struct MIC_U::Impl {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
timing.RemoveEvent(buffer_write_event); timing.RemoveEvent(buffer_write_event);
if (mic) { if (mic) {
mic->StopSampling(); mic->StopSampling();
@ -267,7 +267,7 @@ struct MIC_U::Impl {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
bool is_sampling = mic && mic->IsSampling(); bool is_sampling = mic && mic->IsSampling();
rb.Push<bool>(is_sampling); rb.Push<bool>(is_sampling);
LOG_TRACE(Service_MIC, "IsSampling: {}", is_sampling); LOG_TRACE(Service_MIC, "IsSampling: {}", is_sampling);
@ -277,7 +277,7 @@ struct MIC_U::Impl {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(buffer_full_event); rb.PushCopyObjects(buffer_full_event);
LOG_WARNING(Service_MIC, "(STUBBED) called"); LOG_WARNING(Service_MIC, "(STUBBED) called");
} }
@ -288,7 +288,7 @@ struct MIC_U::Impl {
state.gain = gain; state.gain = gain;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_TRACE(Service_MIC, "gain={}", gain); LOG_TRACE(Service_MIC, "gain={}", gain);
} }
@ -296,7 +296,7 @@ struct MIC_U::Impl {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(state.gain); rb.Push<u8>(state.gain);
LOG_TRACE(Service_MIC, "gain={}", state.gain); LOG_TRACE(Service_MIC, "gain={}", state.gain);
} }
@ -307,7 +307,7 @@ struct MIC_U::Impl {
state.power = power; state.power = power;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_TRACE(Service_MIC, "mic_power={}", power); LOG_TRACE(Service_MIC, "mic_power={}", power);
} }
@ -315,7 +315,7 @@ struct MIC_U::Impl {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u8>(state.power); rb.Push<u8>(state.power);
LOG_TRACE(Service_MIC, "called"); LOG_TRACE(Service_MIC, "called");
} }
@ -326,7 +326,7 @@ struct MIC_U::Impl {
const Kernel::MappedBuffer& buffer = rp.PopMappedBuffer(); const Kernel::MappedBuffer& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_MIC, "(STUBBED) called, size=0x{:X}, buffer=0x{:08X}", size, LOG_WARNING(Service_MIC, "(STUBBED) called, size=0x{:X}, buffer=0x{:08X}", size,
buffer.GetId()); buffer.GetId());
@ -337,7 +337,7 @@ struct MIC_U::Impl {
clamp = rp.Pop<bool>(); clamp = rp.Pop<bool>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_MIC, "(STUBBED) called, clamp={}", clamp); LOG_WARNING(Service_MIC, "(STUBBED) called, clamp={}", clamp);
} }
@ -345,7 +345,7 @@ struct MIC_U::Impl {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<bool>(clamp); rb.Push<bool>(clamp);
LOG_WARNING(Service_MIC, "(STUBBED) called"); LOG_WARNING(Service_MIC, "(STUBBED) called");
} }
@ -355,7 +355,7 @@ struct MIC_U::Impl {
allow_shell_closed = rp.Pop<bool>(); allow_shell_closed = rp.Pop<bool>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_MIC, "(STUBBED) called, allow_shell_closed={}", allow_shell_closed); LOG_WARNING(Service_MIC, "(STUBBED) called, allow_shell_closed={}", allow_shell_closed);
} }
@ -365,7 +365,7 @@ struct MIC_U::Impl {
LOG_WARNING(Service_MIC, "(STUBBED) called, version: 0x{:08X}", version); LOG_WARNING(Service_MIC, "(STUBBED) called, version: 0x{:08X}", version);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void CreateMic() { void CreateMic() {

View File

@ -17,7 +17,7 @@ void NDM_U::EnterExclusiveState(Kernel::HLERequestContext& ctx) {
rp.PopPID(); rp.PopPID();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NDM, "(STUBBED) exclusive_state=0x{:08X}", exclusive_state); LOG_WARNING(Service_NDM, "(STUBBED) exclusive_state=0x{:08X}", exclusive_state);
} }
@ -26,14 +26,14 @@ void NDM_U::LeaveExclusiveState(Kernel::HLERequestContext& ctx) {
rp.PopPID(); rp.PopPID();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NDM, "(STUBBED)"); LOG_WARNING(Service_NDM, "(STUBBED)");
} }
void NDM_U::QueryExclusiveMode(Kernel::HLERequestContext& ctx) { void NDM_U::QueryExclusiveMode(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(exclusive_state); rb.PushEnum(exclusive_state);
LOG_WARNING(Service_NDM, "(STUBBED)"); LOG_WARNING(Service_NDM, "(STUBBED)");
} }
@ -44,7 +44,7 @@ void NDM_U::LockState(Kernel::HLERequestContext& ctx) {
daemon_lock_enabled = true; daemon_lock_enabled = true;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NDM, "(STUBBED)"); LOG_WARNING(Service_NDM, "(STUBBED)");
} }
@ -54,7 +54,7 @@ void NDM_U::UnlockState(Kernel::HLERequestContext& ctx) {
daemon_lock_enabled = false; daemon_lock_enabled = false;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NDM, "(STUBBED)"); LOG_WARNING(Service_NDM, "(STUBBED)");
} }
@ -70,7 +70,7 @@ void NDM_U::SuspendDaemons(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x{:08X}", bit_mask); LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x{:08X}", bit_mask);
} }
@ -85,7 +85,7 @@ void NDM_U::ResumeDaemons(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x{:08X}", bit_mask); LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x{:08X}", bit_mask);
} }
@ -94,14 +94,14 @@ void NDM_U::SuspendScheduler(Kernel::HLERequestContext& ctx) {
bool perform_in_background = rp.Pop<bool>(); bool perform_in_background = rp.Pop<bool>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NDM, "(STUBBED) perform_in_background={}", perform_in_background); LOG_WARNING(Service_NDM, "(STUBBED) perform_in_background={}", perform_in_background);
} }
void NDM_U::ResumeScheduler(Kernel::HLERequestContext& ctx) { void NDM_U::ResumeScheduler(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NDM, "(STUBBED)"); LOG_WARNING(Service_NDM, "(STUBBED)");
} }
@ -110,7 +110,7 @@ void NDM_U::QueryStatus(Kernel::HLERequestContext& ctx) {
u8 daemon = rp.Pop<u8>(); u8 daemon = rp.Pop<u8>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(daemon_status.at(daemon)); rb.PushEnum(daemon_status.at(daemon));
LOG_WARNING(Service_NDM, "(STUBBED) daemon=0x{:02X}", daemon); LOG_WARNING(Service_NDM, "(STUBBED) daemon=0x{:02X}", daemon);
} }
@ -120,7 +120,7 @@ void NDM_U::GetDaemonDisableCount(Kernel::HLERequestContext& ctx) {
u8 daemon = rp.Pop<u8>(); u8 daemon = rp.Pop<u8>();
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); // current process disable count rb.Push<u32>(0); // current process disable count
rb.Push<u32>(0); // total disable count rb.Push<u32>(0); // total disable count
LOG_WARNING(Service_NDM, "(STUBBED) daemon=0x{:02X}", daemon); LOG_WARNING(Service_NDM, "(STUBBED) daemon=0x{:02X}", daemon);
@ -130,7 +130,7 @@ void NDM_U::GetSchedulerDisableCount(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); // current process disable count rb.Push<u32>(0); // current process disable count
rb.Push<u32>(0); // total disable count rb.Push<u32>(0); // total disable count
LOG_WARNING(Service_NDM, "(STUBBED)"); LOG_WARNING(Service_NDM, "(STUBBED)");
@ -141,14 +141,14 @@ void NDM_U::SetScanInterval(Kernel::HLERequestContext& ctx) {
scan_interval = rp.Pop<u32>(); scan_interval = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NDM, "(STUBBED) scan_interval=0x{:08X}", scan_interval); LOG_WARNING(Service_NDM, "(STUBBED) scan_interval=0x{:08X}", scan_interval);
} }
void NDM_U::GetScanInterval(Kernel::HLERequestContext& ctx) { void NDM_U::GetScanInterval(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(scan_interval); rb.Push(scan_interval);
LOG_WARNING(Service_NDM, "(STUBBED)"); LOG_WARNING(Service_NDM, "(STUBBED)");
} }
@ -158,14 +158,14 @@ void NDM_U::SetRetryInterval(Kernel::HLERequestContext& ctx) {
retry_interval = rp.Pop<u32>(); retry_interval = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NDM, "(STUBBED) retry_interval=0x{:08X}", retry_interval); LOG_WARNING(Service_NDM, "(STUBBED) retry_interval=0x{:08X}", retry_interval);
} }
void NDM_U::GetRetryInterval(Kernel::HLERequestContext& ctx) { void NDM_U::GetRetryInterval(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(retry_interval); rb.Push(retry_interval);
LOG_WARNING(Service_NDM, "(STUBBED)"); LOG_WARNING(Service_NDM, "(STUBBED)");
} }
@ -182,7 +182,7 @@ void NDM_U::OverrideDefaultDaemons(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x{:08X}", bit_mask); LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x{:08X}", bit_mask);
} }
@ -191,14 +191,14 @@ void NDM_U::ResetDefaultDaemons(Kernel::HLERequestContext& ctx) {
default_daemon_bit_mask = DaemonMask::Default; default_daemon_bit_mask = DaemonMask::Default;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NDM, "(STUBBED)"); LOG_WARNING(Service_NDM, "(STUBBED)");
} }
void NDM_U::GetDefaultDaemons(Kernel::HLERequestContext& ctx) { void NDM_U::GetDefaultDaemons(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(default_daemon_bit_mask); rb.PushEnum(default_daemon_bit_mask);
LOG_WARNING(Service_NDM, "(STUBBED)"); LOG_WARNING(Service_NDM, "(STUBBED)");
} }
@ -206,7 +206,7 @@ void NDM_U::GetDefaultDaemons(Kernel::HLERequestContext& ctx) {
void NDM_U::ClearHalfAwakeMacFilter(Kernel::HLERequestContext& ctx) { void NDM_U::ClearHalfAwakeMacFilter(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NDM, "(STUBBED)"); LOG_WARNING(Service_NDM, "(STUBBED)");
} }

View File

@ -24,7 +24,7 @@ void NEWS_S::GetTotalNotifications(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); rb.Push<u32>(0);
} }
@ -40,7 +40,7 @@ void NEWS_S::GetNewsDBHeader(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(size); rb.Push<u32>(size);
} }

View File

@ -34,7 +34,7 @@ void Module::Interface::Initialize(Kernel::HLERequestContext& ctx) {
return; return;
} }
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
switch (communication_mode) { switch (communication_mode) {
case CommunicationMode::Ntag: case CommunicationMode::Ntag:
case CommunicationMode::Amiibo: case CommunicationMode::Amiibo:
@ -68,7 +68,7 @@ void Module::Interface::Finalize(Kernel::HLERequestContext& ctx) {
return; return;
} }
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
switch (communication_mode) { switch (communication_mode) {
case CommunicationMode::Ntag: case CommunicationMode::Ntag:
case CommunicationMode::Amiibo: case CommunicationMode::Amiibo:
@ -97,7 +97,7 @@ void Module::Interface::Connect(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
if (nfc->nfc_mode == CommunicationMode::TrainTag) { if (nfc->nfc_mode == CommunicationMode::TrainTag) {
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode); LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
return; return;
} }
@ -114,7 +114,7 @@ void Module::Interface::Disconnect(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
if (nfc->nfc_mode == CommunicationMode::TrainTag) { if (nfc->nfc_mode == CommunicationMode::TrainTag) {
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode); LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
return; return;
} }
@ -129,7 +129,7 @@ void Module::Interface::StartDetection(Kernel::HLERequestContext& ctx) {
LOG_INFO(Service_NFC, "called, in_val={:04x}", in_val); LOG_INFO(Service_NFC, "called, in_val={:04x}", in_val);
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
switch (nfc->nfc_mode) { switch (nfc->nfc_mode) {
case CommunicationMode::Ntag: case CommunicationMode::Ntag:
case CommunicationMode::Amiibo: case CommunicationMode::Amiibo:
@ -150,7 +150,7 @@ void Module::Interface::StopDetection(Kernel::HLERequestContext& ctx) {
LOG_INFO(Service_NFC, "called"); LOG_INFO(Service_NFC, "called");
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
switch (nfc->nfc_mode) { switch (nfc->nfc_mode) {
case CommunicationMode::Ntag: case CommunicationMode::Ntag:
case CommunicationMode::Amiibo: case CommunicationMode::Amiibo:
@ -175,7 +175,7 @@ void Module::Interface::Mount(Kernel::HLERequestContext& ctx) {
nfc->device->RescheduleTagRemoveEvent(); nfc->device->RescheduleTagRemoveEvent();
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
switch (nfc->nfc_mode) { switch (nfc->nfc_mode) {
case CommunicationMode::Ntag: case CommunicationMode::Ntag:
result = nfc->device->Mount(); result = nfc->device->Mount();
@ -197,7 +197,7 @@ void Module::Interface::Unmount(Kernel::HLERequestContext& ctx) {
LOG_INFO(Service_NFC, "called"); LOG_INFO(Service_NFC, "called");
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
switch (nfc->nfc_mode) { switch (nfc->nfc_mode) {
case CommunicationMode::Ntag: case CommunicationMode::Ntag:
case CommunicationMode::Amiibo: case CommunicationMode::Amiibo:
@ -217,7 +217,7 @@ void Module::Interface::Flush(Kernel::HLERequestContext& ctx) {
LOG_INFO(Service_NFC, "called"); LOG_INFO(Service_NFC, "called");
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
switch (nfc->nfc_mode) { switch (nfc->nfc_mode) {
case CommunicationMode::Ntag: case CommunicationMode::Ntag:
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode); LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
@ -247,7 +247,7 @@ void Module::Interface::GetActivateEvent(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(nfc->device->GetActivateEvent()); rb.PushCopyObjects(nfc->device->GetActivateEvent());
} }
@ -264,7 +264,7 @@ void Module::Interface::GetDeactivateEvent(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(nfc->device->GetDeactivateEvent()); rb.PushCopyObjects(nfc->device->GetDeactivateEvent());
} }
@ -281,7 +281,7 @@ void Module::Interface::GetStatus(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(state); rb.PushEnum(state);
} }
@ -293,7 +293,7 @@ void Module::Interface::GetTargetConnectionStatus(Kernel::HLERequestContext& ctx
if (nfc->nfc_mode == CommunicationMode::TrainTag) { if (nfc->nfc_mode == CommunicationMode::TrainTag) {
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode); LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushEnum(CommunicationState::Idle); rb.PushEnum(CommunicationState::Idle);
return; return;
} }
@ -315,7 +315,7 @@ void Module::Interface::GetTagInfo2(Kernel::HLERequestContext& ctx) {
if (nfc->nfc_mode == CommunicationMode::TrainTag) { if (nfc->nfc_mode == CommunicationMode::TrainTag) {
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode); LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
IPC::RequestBuilder rb = rp.MakeBuilder(25, 0); IPC::RequestBuilder rb = rp.MakeBuilder(25, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<TagInfo2>({}); rb.PushRaw<TagInfo2>({});
return; return;
} }
@ -337,7 +337,7 @@ void Module::Interface::GetTagInfo(Kernel::HLERequestContext& ctx) {
if (nfc->nfc_mode == CommunicationMode::TrainTag) { if (nfc->nfc_mode == CommunicationMode::TrainTag) {
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode); LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
IPC::RequestBuilder rb = rp.MakeBuilder(12, 0); IPC::RequestBuilder rb = rp.MakeBuilder(12, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<TagInfo>({}); rb.PushRaw<TagInfo>({});
return; return;
} }
@ -353,7 +353,7 @@ void Module::Interface::GetConnectResult(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(0); rb.Push(0);
LOG_WARNING(Service_NFC, "(STUBBED) called"); LOG_WARNING(Service_NFC, "(STUBBED) called");
} }
@ -505,7 +505,7 @@ void Module::Interface::InitializeCreateInfo(Kernel::HLERequestContext& ctx) {
InitialStruct empty{}; InitialStruct empty{};
IPC::RequestBuilder rb = rp.MakeBuilder(16, 0); IPC::RequestBuilder rb = rp.MakeBuilder(16, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<InitialStruct>(empty); rb.PushRaw<InitialStruct>(empty);
} }
@ -514,7 +514,7 @@ void Module::Interface::MountRom(Kernel::HLERequestContext& ctx) {
LOG_INFO(Service_NFC, "called"); LOG_INFO(Service_NFC, "called");
Result result = RESULT_SUCCESS; Result result = ResultSuccess;
switch (nfc->nfc_mode) { switch (nfc->nfc_mode) {
case CommunicationMode::Ntag: case CommunicationMode::Ntag:
result = nfc->device->PartiallyMount(); result = nfc->device->PartiallyMount();
@ -599,7 +599,7 @@ void Module::Interface::GetEmptyRegisterInfo(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(43, 0); IPC::RequestBuilder rb = rp.MakeBuilder(43, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<RegisterInfo>({}); rb.PushRaw<RegisterInfo>({});
} }

View File

@ -181,7 +181,7 @@ Result NfcDevice::StartCommunication() {
// This is a hack. This mode needs to change when the tag reader has completed the initalization // This is a hack. This mode needs to change when the tag reader has completed the initalization
communication_state = CommunicationState::Initialized; communication_state = CommunicationState::Initialized;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::StopCommunication() { Result NfcDevice::StopCommunication() {
@ -201,7 +201,7 @@ Result NfcDevice::StopCommunication() {
device_state = DeviceState::Initialized; device_state = DeviceState::Initialized;
communication_state = CommunicationState::Idle; communication_state = CommunicationState::Idle;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::StartDetection(TagProtocol allowed_protocol) { Result NfcDevice::StartDetection(TagProtocol allowed_protocol) {
@ -227,7 +227,7 @@ Result NfcDevice::StartDetection(TagProtocol allowed_protocol) {
LoadAmiibo(amiibo_filename); LoadAmiibo(amiibo_filename);
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::StopDetection() { Result NfcDevice::StopDetection() {
@ -250,7 +250,7 @@ Result NfcDevice::StopDetection() {
// TODO: Stop console search mode here // TODO: Stop console search mode here
device_state = DeviceState::Initialized; device_state = DeviceState::Initialized;
connection_state = ConnectionState::Success; connection_state = ConnectionState::Success;
return RESULT_SUCCESS; return ResultSuccess;
} }
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state); LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
@ -282,7 +282,7 @@ Result NfcDevice::Flush() {
if (is_write_protected) { if (is_write_protected) {
LOG_ERROR(Service_NFC, "No keys available skipping write request"); LOG_ERROR(Service_NFC, "No keys available skipping write request");
return RESULT_SUCCESS; return ResultSuccess;
} }
if (!is_plain_amiibo) { if (!is_plain_amiibo) {
@ -324,7 +324,7 @@ Result NfcDevice::Flush() {
is_data_moddified = false; is_data_moddified = false;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::Mount() { Result NfcDevice::Mount() {
@ -345,7 +345,7 @@ Result NfcDevice::Mount() {
// The loaded amiibo is not encrypted // The loaded amiibo is not encrypted
if (is_plain_amiibo) { if (is_plain_amiibo) {
device_state = DeviceState::TagMounted; device_state = DeviceState::TagMounted;
return RESULT_SUCCESS; return ResultSuccess;
} }
if (!AmiiboCrypto::DecodeAmiibo(encrypted_tag.file, tag.file)) { if (!AmiiboCrypto::DecodeAmiibo(encrypted_tag.file, tag.file)) {
@ -354,7 +354,7 @@ Result NfcDevice::Mount() {
} }
device_state = DeviceState::TagMounted; device_state = DeviceState::TagMounted;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::MountAmiibo() { Result NfcDevice::MountAmiibo() {
@ -390,7 +390,7 @@ Result NfcDevice::PartiallyMount() {
// The loaded amiibo is not encrypted // The loaded amiibo is not encrypted
if (is_plain_amiibo) { if (is_plain_amiibo) {
device_state = DeviceState::TagPartiallyMounted; device_state = DeviceState::TagPartiallyMounted;
return RESULT_SUCCESS; return ResultSuccess;
} }
if (!AmiiboCrypto::DecodeAmiibo(encrypted_tag.file, tag.file)) { if (!AmiiboCrypto::DecodeAmiibo(encrypted_tag.file, tag.file)) {
@ -399,7 +399,7 @@ Result NfcDevice::PartiallyMount() {
} }
device_state = DeviceState::TagPartiallyMounted; device_state = DeviceState::TagPartiallyMounted;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::PartiallyMountAmiibo() { Result NfcDevice::PartiallyMountAmiibo() {
@ -430,7 +430,7 @@ Result NfcDevice::ResetTagScanState() {
device_state = DeviceState::TagFound; device_state = DeviceState::TagFound;
is_app_area_open = false; is_app_area_open = false;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::GetTagInfo2(TagInfo2& tag_info) const { Result NfcDevice::GetTagInfo2(TagInfo2& tag_info) const {
@ -443,7 +443,7 @@ Result NfcDevice::GetTagInfo2(TagInfo2& tag_info) const {
.extra_data2 = {}, // Used on non amiibo tags .extra_data2 = {}, // Used on non amiibo tags
}; };
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::GetTagInfo(TagInfo& tag_info) const { Result NfcDevice::GetTagInfo(TagInfo& tag_info) const {
@ -465,7 +465,7 @@ Result NfcDevice::GetTagInfo(TagInfo& tag_info) const {
.extra_data = {}, // Used on non amiibo tags .extra_data = {}, // Used on non amiibo tags
}; };
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::GetCommonInfo(CommonInfo& common_info) const { Result NfcDevice::GetCommonInfo(CommonInfo& common_info) const {
@ -494,7 +494,7 @@ Result NfcDevice::GetCommonInfo(CommonInfo& common_info) const {
.application_area_size = sizeof(ApplicationArea), .application_area_size = sizeof(ApplicationArea),
}; };
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::GetModelInfo(ModelInfo& model_info) const { Result NfcDevice::GetModelInfo(ModelInfo& model_info) const {
@ -517,7 +517,7 @@ Result NfcDevice::GetModelInfo(ModelInfo& model_info) const {
.amiibo_type = model_info_data.amiibo_type, .amiibo_type = model_info_data.amiibo_type,
}; };
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::GetRegisterInfo(RegisterInfo& register_info) const { Result NfcDevice::GetRegisterInfo(RegisterInfo& register_info) const {
@ -545,7 +545,7 @@ Result NfcDevice::GetRegisterInfo(RegisterInfo& register_info) const {
.creation_date = settings.init_date.GetWriteDate(), .creation_date = settings.init_date.GetWriteDate(),
}; };
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::GetAdminInfo(AdminInfo& admin_info) const { Result NfcDevice::GetAdminInfo(AdminInfo& admin_info) const {
@ -604,7 +604,7 @@ Result NfcDevice::GetAdminInfo(AdminInfo& admin_info) const {
.app_area_version = app_area_version, .app_area_version = app_area_version,
}; };
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::DeleteRegisterInfo() { Result NfcDevice::DeleteRegisterInfo() {
@ -689,7 +689,7 @@ Result NfcDevice::RestoreAmiibo() {
// TODO: Load amiibo from backup on system // TODO: Load amiibo from backup on system
LOG_ERROR(Service_NFC, "Not Implemented"); LOG_ERROR(Service_NFC, "Not Implemented");
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::Format() { Result NfcDevice::Format() {
@ -704,7 +704,7 @@ Result NfcDevice::Format() {
return Result2; return Result2;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::OpenApplicationArea(u32 access_id) { Result NfcDevice::OpenApplicationArea(u32 access_id) {
@ -729,7 +729,7 @@ Result NfcDevice::OpenApplicationArea(u32 access_id) {
is_app_area_open = true; is_app_area_open = true;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::GetApplicationAreaId(u32& application_area_id) const { Result NfcDevice::GetApplicationAreaId(u32& application_area_id) const {
@ -751,7 +751,7 @@ Result NfcDevice::GetApplicationAreaId(u32& application_area_id) const {
application_area_id = tag.file.application_area_id; application_area_id = tag.file.application_area_id;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::GetApplicationArea(std::vector<u8>& data) const { Result NfcDevice::GetApplicationArea(std::vector<u8>& data) const {
@ -780,7 +780,7 @@ Result NfcDevice::GetApplicationArea(std::vector<u8>& data) const {
memcpy(data.data(), tag.file.application_area.data(), data.size()); memcpy(data.data(), tag.file.application_area.data(), data.size());
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::SetApplicationArea(std::span<const u8> data) { Result NfcDevice::SetApplicationArea(std::span<const u8> data) {
@ -828,7 +828,7 @@ Result NfcDevice::SetApplicationArea(std::span<const u8> data) {
is_data_moddified = true; is_data_moddified = true;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result NfcDevice::CreateApplicationArea(u32 access_id, std::span<const u8> data) { Result NfcDevice::CreateApplicationArea(u32 access_id, std::span<const u8> data) {
@ -955,7 +955,7 @@ Result NfcDevice::ApplicationAreaExist(bool& has_application_area) {
has_application_area = tag.file.settings.settings.appdata_initialized.Value() != 0; has_application_area = tag.file.settings.settings.appdata_initialized.Value() != 0;
return RESULT_SUCCESS; return ResultSuccess;
} }
constexpr u32 NfcDevice::GetApplicationAreaSize() const { constexpr u32 NfcDevice::GetApplicationAreaSize() const {
@ -970,13 +970,13 @@ Result NfcDevice::GetCommunicationStatus(CommunicationState& status) const {
if (communication_state == CommunicationState::Idle || if (communication_state == CommunicationState::Idle ||
communication_state == CommunicationState::SearchingForAdapter) { communication_state == CommunicationState::SearchingForAdapter) {
status = communication_state; status = communication_state;
return RESULT_SUCCESS; return ResultSuccess;
} }
if (communication_state == CommunicationState::Initialized || if (communication_state == CommunicationState::Initialized ||
communication_state == CommunicationState::Active) { communication_state == CommunicationState::Active) {
status = CommunicationState::Initialized; status = CommunicationState::Initialized;
return RESULT_SUCCESS; return ResultSuccess;
} }
return ResultInvalidOperation; return ResultInvalidOperation;
@ -991,7 +991,7 @@ Result NfcDevice::CheckConnectionState() const {
return ResultWifiOff; return ResultWifiOff;
} }
return RESULT_SUCCESS; return ResultSuccess;
} }
void NfcDevice::SetAmiiboName(AmiiboSettings& settings, const AmiiboName& amiibo_name) { void NfcDevice::SetAmiiboName(AmiiboSettings& settings, const AmiiboName& amiibo_name) {

View File

@ -190,7 +190,7 @@ void NIM_U::StartNetworkUpdate(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
} }
@ -202,7 +202,7 @@ void NIM_U::GetProgress(Kernel::HLERequestContext& ctx) {
std::memset(&progress, 0, sizeof(progress)); std::memset(&progress, 0, sizeof(progress));
IPC::RequestBuilder rb = rp.MakeBuilder(13, 0); IPC::RequestBuilder rb = rp.MakeBuilder(13, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(progress); rb.PushRaw(progress);
rb.Push(0); rb.Push(0);
rb.Push(0); rb.Push(0);
@ -214,7 +214,7 @@ void NIM_U::Cancel(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
} }
@ -223,7 +223,7 @@ void NIM_U::CommitSystemTitles(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
} }
@ -232,7 +232,7 @@ void NIM_U::GetBackgroundEventForMenu(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(nim_system_update_event_for_menu); rb.PushCopyObjects(nim_system_update_event_for_menu);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -242,7 +242,7 @@ void NIM_U::GetBackgroundEventForNews(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(nim_system_update_event_for_news); rb.PushCopyObjects(nim_system_update_event_for_news);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -252,7 +252,7 @@ void NIM_U::FormatSaveData(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
} }
@ -261,7 +261,7 @@ void NIM_U::GetCustomerSupportCode(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(0); // Customer support code rb.Push(0); // Customer support code
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -271,7 +271,7 @@ void NIM_U::IsCommittableAllSystemTitles(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(false); rb.Push(false);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -284,7 +284,7 @@ void NIM_U::GetBackgroundProgress(Kernel::HLERequestContext& ctx) {
std::memset(&progress, 0, sizeof(progress)); std::memset(&progress, 0, sizeof(progress));
IPC::RequestBuilder rb = rp.MakeBuilder(13, 0); IPC::RequestBuilder rb = rp.MakeBuilder(13, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(progress); rb.PushRaw(progress);
rb.Push(0); rb.Push(0);
rb.Push(0); rb.Push(0);
@ -299,7 +299,7 @@ void NIM_U::GetSavedHash(Kernel::HLERequestContext& ctx) {
std::memset(&hash, 0, sizeof(hash)); std::memset(&hash, 0, sizeof(hash));
IPC::RequestBuilder rb = rp.MakeBuilder(10, 0); IPC::RequestBuilder rb = rp.MakeBuilder(10, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(hash); rb.PushRaw(hash);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -325,7 +325,7 @@ void NIM_U::IsRegistered(Kernel::HLERequestContext& ctx) {
const u64 title_id = rp.Pop<u64>(); const u64 title_id = rp.Pop<u64>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(false); rb.Push(false);
LOG_WARNING(Service_NIM, "(STUBBED) called title_id={:016X}", title_id); LOG_WARNING(Service_NIM, "(STUBBED) called title_id={:016X}", title_id);
@ -353,7 +353,7 @@ void NIM_U::GetTaskInfos(Kernel::HLERequestContext& ctx) {
auto& task_infos_buffer = rp.PopMappedBuffer(); auto& task_infos_buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(0); rb.Push(0);
rb.PushMappedBuffer(task_infos_buffer); rb.PushMappedBuffer(task_infos_buffer);
@ -365,7 +365,7 @@ void NIM_U::DeleteUnmanagedContexts(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
} }
@ -377,7 +377,7 @@ void NIM_U::UpdateAutoTitleDownloadTasksAsync(Kernel::HLERequestContext& ctx) {
nim_async_completion_event->Signal(); nim_async_completion_event->Signal();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(nim_async_completion_event); rb.PushCopyObjects(nim_async_completion_event);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -390,7 +390,7 @@ void NIM_U::StartPendingAutoTitleDownloadTasksAsync(Kernel::HLERequestContext& c
nim_async_completion_event->Signal(); nim_async_completion_event->Signal();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(nim_async_completion_event); rb.PushCopyObjects(nim_async_completion_event);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -400,8 +400,8 @@ void NIM_U::GetAsyncResult(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(0); rb.Push(0);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -411,7 +411,7 @@ void NIM_U::CancelAsyncCall(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
} }
@ -420,7 +420,7 @@ void NIM_U::IsPendingAutoTitleDownloadTasks(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(false); rb.Push(false);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -430,7 +430,7 @@ void NIM_U::GetNumAutoTitleDownloadTasks(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(0); rb.Push(0);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -443,7 +443,7 @@ void NIM_U::GetAutoTitleDownloadTaskInfos(Kernel::HLERequestContext& ctx) {
auto& task_infos_buffer = rp.PopMappedBuffer(); auto& task_infos_buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(0); rb.Push(0);
rb.PushMappedBuffer(task_infos_buffer); rb.PushMappedBuffer(task_infos_buffer);
@ -457,7 +457,7 @@ void NIM_U::CancelAutoTitleDownloadTask(Kernel::HLERequestContext& ctx) {
const u64 task_id = rp.Pop<u64>(); const u64 task_id = rp.Pop<u64>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NIM, "(STUBBED) called task_id={:016X}", task_id); LOG_WARNING(Service_NIM, "(STUBBED) called task_id={:016X}", task_id);
} }
@ -468,7 +468,7 @@ void NIM_U::SetAutoDbgDat(Kernel::HLERequestContext& ctx) {
auto& auto_dbg_dat_buffer = rp.PopMappedBuffer(); auto& auto_dbg_dat_buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(auto_dbg_dat_buffer); rb.PushMappedBuffer(auto_dbg_dat_buffer);
LOG_WARNING(Service_NIM, "(STUBBED) called auto_dbg_dat_buffer=0x{:08X}", LOG_WARNING(Service_NIM, "(STUBBED) called auto_dbg_dat_buffer=0x{:08X}",
@ -481,7 +481,7 @@ void NIM_U::GetAutoDbgDat(Kernel::HLERequestContext& ctx) {
auto& auto_dbg_dat_buffer = rp.PopMappedBuffer(); auto& auto_dbg_dat_buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(auto_dbg_dat_buffer); rb.PushMappedBuffer(auto_dbg_dat_buffer);
LOG_WARNING(Service_NIM, "(STUBBED) called auto_dbg_dat_buffer=0x{:08X}", LOG_WARNING(Service_NIM, "(STUBBED) called auto_dbg_dat_buffer=0x{:08X}",
@ -495,7 +495,7 @@ void NIM_U::SetDbgTasks(Kernel::HLERequestContext& ctx) {
auto& task_infos_buffer = rp.PopMappedBuffer(); auto& task_infos_buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(task_infos_buffer); rb.PushMappedBuffer(task_infos_buffer);
LOG_WARNING(Service_NIM, "(STUBBED) called max_task_infos={:08X}, task_infos_buffer=0x{:08X}", LOG_WARNING(Service_NIM, "(STUBBED) called max_task_infos={:08X}, task_infos_buffer=0x{:08X}",
@ -509,7 +509,7 @@ void NIM_U::GetDbgTasks(Kernel::HLERequestContext& ctx) {
auto& task_infos_buffer = rp.PopMappedBuffer(); auto& task_infos_buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(0); rb.Push(0);
rb.PushMappedBuffer(task_infos_buffer); rb.PushMappedBuffer(task_infos_buffer);
@ -521,7 +521,7 @@ void NIM_U::DeleteDbgData(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
} }
@ -533,7 +533,7 @@ void NIM_U::SetTslXml(Kernel::HLERequestContext& ctx) {
auto& xml_buffer = rp.PopMappedBuffer(); auto& xml_buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(xml_buffer); rb.PushMappedBuffer(xml_buffer);
LOG_WARNING(Service_NIM, "(STUBBED) called buffer_size={:08X}, xml_buffer=0x{:08X}", LOG_WARNING(Service_NIM, "(STUBBED) called buffer_size={:08X}, xml_buffer=0x{:08X}",
@ -544,7 +544,7 @@ void NIM_U::GetTslXmlSize(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u64>(0); rb.Push<u64>(0);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -557,7 +557,7 @@ void NIM_U::GetTslXml(Kernel::HLERequestContext& ctx) {
auto& xml_buffer = rp.PopMappedBuffer(); auto& xml_buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(xml_buffer); rb.PushMappedBuffer(xml_buffer);
LOG_WARNING(Service_NIM, "(STUBBED) called buffer_capacity={:08X}, xml_buffer=0x{:08X}", LOG_WARNING(Service_NIM, "(STUBBED) called buffer_capacity={:08X}, xml_buffer=0x{:08X}",
@ -568,7 +568,7 @@ void NIM_U::DeleteTslXml(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
} }
@ -580,7 +580,7 @@ void NIM_U::SetDtlXml(Kernel::HLERequestContext& ctx) {
auto& xml_buffer = rp.PopMappedBuffer(); auto& xml_buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(xml_buffer); rb.PushMappedBuffer(xml_buffer);
LOG_WARNING(Service_NIM, "(STUBBED) called buffer_size={:08X}, xml_buffer=0x{:08X}", LOG_WARNING(Service_NIM, "(STUBBED) called buffer_size={:08X}, xml_buffer=0x{:08X}",
@ -591,7 +591,7 @@ void NIM_U::GetDtlXmlSize(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u64>(0); rb.Push<u64>(0);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -604,7 +604,7 @@ void NIM_U::GetDtlXml(Kernel::HLERequestContext& ctx) {
auto& xml_buffer = rp.PopMappedBuffer(); auto& xml_buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(xml_buffer); rb.PushMappedBuffer(xml_buffer);
LOG_WARNING(Service_NIM, "(STUBBED) called buffer_capacity={:08X}, xml_buffer=0x{:08X}", LOG_WARNING(Service_NIM, "(STUBBED) called buffer_capacity={:08X}, xml_buffer=0x{:08X}",
@ -615,8 +615,8 @@ void NIM_U::UpdateAccountStatus(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(0); rb.Push(0);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -628,7 +628,7 @@ void NIM_U::StartTitleDownload(Kernel::HLERequestContext& ctx) {
const auto& download_config = rp.PopRaw<TitleDownloadConfig>(); const auto& download_config = rp.PopRaw<TitleDownloadConfig>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NIM, "(STUBBED) called title_id={:016X}", download_config.title_id); LOG_WARNING(Service_NIM, "(STUBBED) called title_id={:016X}", download_config.title_id);
} }
@ -637,7 +637,7 @@ void NIM_U::StopTitleDownload(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
} }
@ -649,7 +649,7 @@ void NIM_U::GetTitleDownloadProgress(Kernel::HLERequestContext& ctx) {
std::memset(&progress, 0, sizeof(progress)); std::memset(&progress, 0, sizeof(progress));
IPC::RequestBuilder rb = rp.MakeBuilder(9, 0); IPC::RequestBuilder rb = rp.MakeBuilder(9, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(progress); rb.PushRaw(progress);
rb.Push(0); rb.Push(0);
rb.Push(0); rb.Push(0);
@ -669,7 +669,7 @@ void NIM_U::RegisterTask(Kernel::HLERequestContext& ctx) {
const auto& developer_name = rp.PopStaticBuffer(); const auto& developer_name = rp.PopStaticBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
const auto title_name_end = std::find(title_name.begin(), title_name.end(), u'\0'); const auto title_name_end = std::find(title_name.begin(), title_name.end(), u'\0');
const auto title_name_utf8 = const auto title_name_utf8 =
@ -690,8 +690,8 @@ void NIM_U::IsSystemUpdateAvailable(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(4, 0); IPC::RequestBuilder rb = rp.MakeBuilder(4, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(0); rb.Push(0);
rb.Push(false); rb.Push(false);
@ -702,7 +702,7 @@ void NIM_U::Unknown2B(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
} }
@ -711,8 +711,8 @@ void NIM_U::UpdateTickets(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(0); rb.Push(0);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");
@ -728,7 +728,7 @@ void NIM_U::DownloadTitleSeedAsync(Kernel::HLERequestContext& ctx) {
nim_async_completion_event->Signal(); nim_async_completion_event->Signal();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(nim_async_completion_event); rb.PushCopyObjects(nim_async_completion_event);
LOG_WARNING(Service_NIM, "(STUBBED) called title_id={:016X}, country_code={:04X}", title_id, LOG_WARNING(Service_NIM, "(STUBBED) called title_id={:016X}, country_code={:04X}", title_id,
@ -742,7 +742,7 @@ void NIM_U::DownloadMissingTitleSeedsAsync(Kernel::HLERequestContext& ctx) {
nim_async_completion_event->Signal(); nim_async_completion_event->Signal();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(nim_async_completion_event); rb.PushCopyObjects(nim_async_completion_event);
LOG_WARNING(Service_NIM, "(STUBBED) called"); LOG_WARNING(Service_NIM, "(STUBBED) called");

View File

@ -576,7 +576,7 @@ void NWM_UDS::Shutdown(Kernel::HLERequestContext& ctx) {
recv_buffer_memory.reset(); recv_buffer_memory.reset();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_NWM, "called"); LOG_DEBUG(Service_NWM, "called");
} }
@ -636,7 +636,7 @@ void NWM_UDS::RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx) {
out_buffer.Write(&data_reply_header, 0, sizeof(BeaconDataReplyHeader)); out_buffer.Write(&data_reply_header, 0, sizeof(BeaconDataReplyHeader));
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(out_buffer); rb.PushMappedBuffer(out_buffer);
LOG_DEBUG(Service_NWM, LOG_DEBUG(Service_NWM,
@ -707,7 +707,7 @@ void NWM_UDS::GetConnectionStatus(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(13, 0); IPC::RequestBuilder rb = rp.MakeBuilder(13, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
{ {
std::scoped_lock lock(connection_status_mutex); std::scoped_lock lock(connection_status_mutex);
rb.PushRaw(connection_status); rb.PushRaw(connection_status);
@ -747,7 +747,7 @@ void NWM_UDS::GetNodeInformation(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(11, 0); IPC::RequestBuilder rb = rp.MakeBuilder(11, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<NodeInfo>(*itr); rb.PushRaw<NodeInfo>(*itr);
} }
LOG_DEBUG(Service_NWM, "called"); LOG_DEBUG(Service_NWM, "called");
@ -800,7 +800,7 @@ void NWM_UDS::Bind(Kernel::HLERequestContext& ctx) {
channel_data[data_channel] = {bind_node_id, data_channel, network_node_id, event}; channel_data[data_channel] = {bind_node_id, data_channel, network_node_id, event};
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(event); rb.PushCopyObjects(event);
} }
@ -829,7 +829,7 @@ void NWM_UDS::Unbind(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(bind_node_id); rb.Push(bind_node_id);
// TODO(B3N30): Find out what the other return values are // TODO(B3N30): Find out what the other return values are
rb.Push<u32>(0); rb.Push<u32>(0);
@ -901,7 +901,7 @@ Result NWM_UDS::BeginHostingNetwork(std::span<const u8> network_info_buffer,
system.CoreTiming().ScheduleEvent(msToCycles(DefaultBeaconInterval * MillisecondsPerTU), system.CoreTiming().ScheduleEvent(msToCycles(DefaultBeaconInterval * MillisecondsPerTU),
beacon_broadcast_event, 0); beacon_broadcast_event, 0);
return RESULT_SUCCESS; return ResultSuccess;
} }
void NWM_UDS::BeginHostingNetwork(Kernel::HLERequestContext& ctx) { void NWM_UDS::BeginHostingNetwork(Kernel::HLERequestContext& ctx) {
@ -965,7 +965,7 @@ void NWM_UDS::EjectClient(Kernel::HLERequestContext& ctx) {
} }
// This function always returns success if the status is valid. // This function always returns success if the status is valid.
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
using Network::WifiPacket; using Network::WifiPacket;
Network::MacAddress dest_address = Network::BroadcastMac; Network::MacAddress dest_address = Network::BroadcastMac;
@ -996,7 +996,7 @@ void NWM_UDS::UpdateNetworkAttribute(Kernel::HLERequestContext& ctx) {
rp.Skip(2, false); rp.Skip(2, false);
LOG_WARNING(Service_NWM, "stubbed"); LOG_WARNING(Service_NWM, "stubbed");
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void NWM_UDS::DestroyNetwork(Kernel::HLERequestContext& ctx) { void NWM_UDS::DestroyNetwork(Kernel::HLERequestContext& ctx) {
@ -1032,7 +1032,7 @@ void NWM_UDS::DestroyNetwork(Kernel::HLERequestContext& ctx) {
} }
channel_data.clear(); channel_data.clear();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_NWM, "called"); LOG_DEBUG(Service_NWM, "called");
} }
@ -1078,7 +1078,7 @@ void NWM_UDS::DisconnectNetwork(Kernel::HLERequestContext& ctx) {
} }
channel_data.clear(); channel_data.clear();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_NWM, "called"); LOG_DEBUG(Service_NWM, "called");
} }
@ -1157,7 +1157,7 @@ void NWM_UDS::SendTo(Kernel::HLERequestContext& ctx) {
SendPacket(packet); SendPacket(packet);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void NWM_UDS::PullPacket(Kernel::HLERequestContext& ctx) { void NWM_UDS::PullPacket(Kernel::HLERequestContext& ctx) {
@ -1195,7 +1195,7 @@ void NWM_UDS::PullPacket(Kernel::HLERequestContext& ctx) {
if (channel->second.received_packets.empty()) { if (channel->second.received_packets.empty()) {
std::vector<u8> output_buffer(buff_size); std::vector<u8> output_buffer(buff_size);
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); rb.Push<u32>(0);
rb.Push<u16>(0); rb.Push<u16>(0);
rb.PushStaticBuffer(std::move(output_buffer), 0); rb.PushStaticBuffer(std::move(output_buffer), 0);
@ -1221,7 +1221,7 @@ void NWM_UDS::PullPacket(Kernel::HLERequestContext& ctx) {
std::memcpy(output_buffer.data(), std::memcpy(output_buffer.data(),
next_packet.data() + sizeof(LLCHeader) + sizeof(SecureDataHeader), data_size); next_packet.data() + sizeof(LLCHeader) + sizeof(SecureDataHeader), data_size);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(data_size); rb.Push<u32>(data_size);
rb.Push<u16>(secure_data.src_node_id); rb.Push<u16>(secure_data.src_node_id);
rb.PushStaticBuffer(std::move(output_buffer), 0); rb.PushStaticBuffer(std::move(output_buffer), 0);
@ -1238,7 +1238,7 @@ void NWM_UDS::GetChannel(Kernel::HLERequestContext& ctx) {
u8 channel = is_connected ? network_channel : 0; u8 channel = is_connected ? network_channel : 0;
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(channel); rb.Push(channel);
LOG_DEBUG(Service_NWM, "called"); LOG_DEBUG(Service_NWM, "called");
@ -1252,7 +1252,7 @@ public:
Kernel::ThreadWakeupReason reason) { Kernel::ThreadWakeupReason reason) {
// TODO(B3N30): Add error handling for host full and timeout // TODO(B3N30): Add error handling for host full and timeout
IPC::RequestBuilder rb(ctx, command_id, 1, 0); IPC::RequestBuilder rb(ctx, command_id, 1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_DEBUG(Service_NWM, "connection sequence finished"); LOG_DEBUG(Service_NWM, "connection sequence finished");
} }
@ -1339,7 +1339,7 @@ void NWM_UDS::SetApplicationData(Kernel::HLERequestContext& ctx) {
network_info.application_data_size = static_cast<u8>(size); network_info.application_data_size = static_cast<u8>(size);
std::memcpy(network_info.application_data.data(), application_data.data(), size); std::memcpy(network_info.application_data.data(), application_data.data(), size);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void NWM_UDS::GetApplicationData(Kernel::HLERequestContext& ctx) { void NWM_UDS::GetApplicationData(Kernel::HLERequestContext& ctx) {
@ -1348,7 +1348,7 @@ void NWM_UDS::GetApplicationData(Kernel::HLERequestContext& ctx) {
u8 appdata_size = network_info.application_data_size; u8 appdata_size = network_info.application_data_size;
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
if (input_size < appdata_size) { if (input_size < appdata_size) {
rb.Push(0); rb.Push(0);
@ -1420,7 +1420,7 @@ void NWM_UDS::DecryptBeaconData(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
std::vector<u8> output_buffer(sizeof(NodeInfo) * UDSMaxNodes); std::vector<u8> output_buffer(sizeof(NodeInfo) * UDSMaxNodes);
std::memcpy(output_buffer.data(), nodes.data(), sizeof(NodeInfo) * nodes.size()); std::memcpy(output_buffer.data(), nodes.data(), sizeof(NodeInfo) * nodes.size());

View File

@ -160,7 +160,7 @@ void PLG_LDR::IsEnabled(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(plgldr_context.is_enabled); rb.Push(plgldr_context.is_enabled);
} }
@ -174,7 +174,7 @@ void PLG_LDR::SetEnabled(Kernel::HLERequestContext& ctx) {
Settings::values.plugin_loader_enabled.SetValue(enabled); Settings::values.plugin_loader_enabled.SetValue(enabled);
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push((can_change) ? RESULT_SUCCESS : Kernel::ERR_NOT_AUTHORIZED); rb.Push((can_change) ? ResultSuccess : Kernel::ResultNotAuthorized);
} }
void PLG_LDR::SetLoadSettings(Kernel::HLERequestContext& ctx) { void PLG_LDR::SetLoadSettings(Kernel::HLERequestContext& ctx) {
@ -198,7 +198,7 @@ void PLG_LDR::SetLoadSettings(Kernel::HLERequestContext& ctx) {
std::min(sizeof(PluginLoaderContext::PluginLoadParameters::config), config.GetSize())); std::min(sizeof(PluginLoaderContext::PluginLoadParameters::config), config.GetSize()));
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void PLG_LDR::DisplayErrorMessage(Kernel::HLERequestContext& ctx) { void PLG_LDR::DisplayErrorMessage(Kernel::HLERequestContext& ctx) {
@ -220,14 +220,14 @@ void PLG_LDR::DisplayErrorMessage(Kernel::HLERequestContext& ctx) {
std::string(title_data.data()), std::string(desc_data.data())); std::string(title_data.data()), std::string(desc_data.data()));
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void PLG_LDR::GetPLGLDRVersion(Kernel::HLERequestContext& ctx) { void PLG_LDR::GetPLGLDRVersion(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(plgldr_version.raw); rb.Push(plgldr_version.raw);
} }
@ -239,7 +239,7 @@ void PLG_LDR::GetArbiter(Kernel::HLERequestContext& ctx) {
// signal the plgldr service thread when a event is ready. Instead we just send // signal the plgldr service thread when a event is ready. Instead we just send
// an error and the 3GX plugin will take care of it. // an error and the 3GX plugin will take care of it.
// (We never send any events anyways) // (We never send any events anyways)
rb.Push(Kernel::ERR_NOT_IMPLEMENTED); rb.Push(Kernel::ResultNotImplemented);
} }
void PLG_LDR::GetPluginPath(Kernel::HLERequestContext& ctx) { void PLG_LDR::GetPluginPath(Kernel::HLERequestContext& ctx) {
@ -260,7 +260,7 @@ void PLG_LDR::GetPluginPath(Kernel::HLERequestContext& ctx) {
path.Write(plugin_path.c_str(), 0, std::min(path.GetSize(), plugin_path.length() + 1)); path.Write(plugin_path.c_str(), 0, std::min(path.GetSize(), plugin_path.length() + 1));
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(path); rb.PushMappedBuffer(path);
} }

View File

@ -141,7 +141,7 @@ void PS_PS::EncryptDecryptAes(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(5, 4); IPC::RequestBuilder rb = rp.MakeBuilder(5, 4);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw(new_iv); rb.PushRaw(new_iv);
rb.PushMappedBuffer(source); rb.PushMappedBuffer(source);
rb.PushMappedBuffer(destination); rb.PushMappedBuffer(destination);
@ -157,7 +157,7 @@ void PS_PS::GenerateRandomBytes(Kernel::HLERequestContext& ctx) {
buffer.Write(out_data.data(), 0, size); buffer.Write(out_data.data(), 0, size);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
} }

View File

@ -30,7 +30,7 @@ void Module::Interface::GetAdapterState(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ptm->battery_is_charging); rb.Push(ptm->battery_is_charging);
LOG_WARNING(Service_PTM, "(STUBBED) called"); LOG_WARNING(Service_PTM, "(STUBBED) called");
@ -40,7 +40,7 @@ void Module::Interface::GetShellState(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ptm->shell_open); rb.Push(ptm->shell_open);
} }
@ -48,7 +48,7 @@ void Module::Interface::GetBatteryLevel(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(ChargeLevels::CompletelyFull)); // Set to a completely full battery rb.Push(static_cast<u32>(ChargeLevels::CompletelyFull)); // Set to a completely full battery
LOG_WARNING(Service_PTM, "(STUBBED) called"); LOG_WARNING(Service_PTM, "(STUBBED) called");
@ -58,7 +58,7 @@ void Module::Interface::GetBatteryChargeState(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ptm->battery_is_charging); rb.Push(ptm->battery_is_charging);
LOG_WARNING(Service_PTM, "(STUBBED) called"); LOG_WARNING(Service_PTM, "(STUBBED) called");
@ -68,7 +68,7 @@ void Module::Interface::GetPedometerState(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ptm->pedometer_is_counting); rb.Push(ptm->pedometer_is_counting);
LOG_WARNING(Service_PTM, "(STUBBED) called"); LOG_WARNING(Service_PTM, "(STUBBED) called");
@ -90,7 +90,7 @@ void Module::Interface::GetStepHistory(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
LOG_WARNING(Service_PTM, "(STUBBED) called, from time(raw): 0x{:x}, for {} hours", start_time, LOG_WARNING(Service_PTM, "(STUBBED) called, from time(raw): 0x{:x}, for {} hours", start_time,
@ -101,7 +101,7 @@ void Module::Interface::GetTotalStepCount(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push<u32>(0); rb.Push<u32>(0);
LOG_WARNING(Service_PTM, "(STUBBED) called"); LOG_WARNING(Service_PTM, "(STUBBED) called");
@ -111,7 +111,7 @@ void Module::Interface::GetSoftwareClosedFlag(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(false); rb.Push(false);
LOG_WARNING(Service_PTM, "(STUBBED) called"); LOG_WARNING(Service_PTM, "(STUBBED) called");
@ -120,7 +120,7 @@ void Module::Interface::GetSoftwareClosedFlag(Kernel::HLERequestContext& ctx) {
void CheckNew3DS(IPC::RequestBuilder& rb) { void CheckNew3DS(IPC::RequestBuilder& rb) {
const bool is_new_3ds = Settings::values.is_new_3ds.GetValue(); const bool is_new_3ds = Settings::values.is_new_3ds.GetValue();
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(is_new_3ds); rb.Push(is_new_3ds);
LOG_DEBUG(Service_PTM, "called isNew3DS = 0x{:08x}", static_cast<u32>(is_new_3ds)); LOG_DEBUG(Service_PTM, "called isNew3DS = 0x{:08x}", static_cast<u32>(is_new_3ds));
@ -140,7 +140,7 @@ void Module::Interface::GetSystemTime(Kernel::HLERequestContext& ctx) {
const u64 console_time = share_page.GetSystemTimeSince2000(); const u64 console_time = share_page.GetSystemTimeSince2000();
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(console_time); rb.Push(console_time);
} }
@ -155,7 +155,7 @@ static void WriteGameCoinData(GameCoin gamecoin_data) {
FileSys::Path gamecoin_path("/gamecoin.dat"); FileSys::Path gamecoin_path("/gamecoin.dat");
// If the archive didn't exist, create the files inside // If the archive didn't exist, create the files inside
if (archive_result.Code() == FileSys::ERR_NOT_FORMATTED) { if (archive_result.Code() == FileSys::ResultNotFormatted) {
// Format the archive to create the directories // Format the archive to create the directories
extdata_archive_factory.Format(archive_path, FileSys::ArchiveFormatInfo(), 0); extdata_archive_factory.Format(archive_path, FileSys::ArchiveFormatInfo(), 0);
// Open it again to get a valid archive now that the folder exists // Open it again to get a valid archive now that the folder exists
@ -216,7 +216,7 @@ Module::Module() {
const FileSys::Path archive_path(ptm_shared_extdata_id); const FileSys::Path archive_path(ptm_shared_extdata_id);
const auto archive_result = extdata_archive_factory.Open(archive_path, 0); const auto archive_result = extdata_archive_factory.Open(archive_path, 0);
// If the archive didn't exist, write the default game coin file // If the archive didn't exist, write the default game coin file
if (archive_result.Code() == FileSys::ERR_NOT_FORMATTED) { if (archive_result.Code() == FileSys::ResultNotFormatted) {
WriteGameCoinData(default_game_coin); WriteGameCoinData(default_game_coin);
} }
} }

View File

@ -16,7 +16,7 @@ void QTM_S::GetHeadtrackingInfo(Kernel::HLERequestContext& ctx) {
std::array<u8, 0x40> data{}; std::array<u8, 0x40> data{};
IPC::RequestBuilder rb = rp.MakeBuilder(17, 0); IPC::RequestBuilder rb = rp.MakeBuilder(17, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushRaw<std::array<u8, 0x40>>(data); rb.PushRaw<std::array<u8, 0x40>>(data);
LOG_DEBUG(Service, "(STUBBED) called"); LOG_DEBUG(Service, "(STUBBED) called");

View File

@ -13,9 +13,9 @@
namespace Service::SM { namespace Service::SM {
static Result ValidateServiceName(const std::string& name) { static Result ValidateServiceName(const std::string& name) {
R_UNLESS(name.size() > 0 && name.size() <= 8, ERR_INVALID_NAME_SIZE); R_UNLESS(name.size() > 0 && name.size() <= 8, ResultInvalidNameSize);
R_UNLESS(name.find('\0') == std::string::npos, ERR_NAME_CONTAINS_NUL); R_UNLESS(name.find('\0') == std::string::npos, ResultNameContainsNul);
return RESULT_SUCCESS; return ResultSuccess;
} }
ServiceManager::ServiceManager(Core::System& system) : system(system) {} ServiceManager::ServiceManager(Core::System& system) : system(system) {}
@ -31,14 +31,14 @@ void ServiceManager::InstallInterfaces(Core::System& system) {
Result ServiceManager::RegisterService(std::shared_ptr<Kernel::ServerPort>& server_port, Result ServiceManager::RegisterService(std::shared_ptr<Kernel::ServerPort>& server_port,
std::string name, u32 max_sessions) { std::string name, u32 max_sessions) {
R_TRY(ValidateServiceName(name)); R_TRY(ValidateServiceName(name));
R_UNLESS(registered_services.find(name) == registered_services.end(), ERR_ALREADY_REGISTERED); R_UNLESS(registered_services.find(name) == registered_services.end(), ResultAlreadyRegistered);
std::shared_ptr<Kernel::ClientPort> client_port; std::shared_ptr<Kernel::ClientPort> client_port;
std::tie(server_port, client_port) = system.Kernel().CreatePortPair(max_sessions, name); std::tie(server_port, client_port) = system.Kernel().CreatePortPair(max_sessions, name);
registered_services_inverse.emplace(client_port->GetObjectId(), name); registered_services_inverse.emplace(client_port->GetObjectId(), name);
registered_services.emplace(std::move(name), std::move(client_port)); registered_services.emplace(std::move(name), std::move(client_port));
return RESULT_SUCCESS; return ResultSuccess;
} }
Result ServiceManager::GetServicePort(std::shared_ptr<Kernel::ClientPort>& out_port, Result ServiceManager::GetServicePort(std::shared_ptr<Kernel::ClientPort>& out_port,
@ -46,10 +46,10 @@ Result ServiceManager::GetServicePort(std::shared_ptr<Kernel::ClientPort>& out_p
R_TRY(ValidateServiceName(name)); R_TRY(ValidateServiceName(name));
auto it = registered_services.find(name); auto it = registered_services.find(name);
R_UNLESS(it != registered_services.end(), ERR_SERVICE_NOT_REGISTERED); R_UNLESS(it != registered_services.end(), ResultServiceNotRegistered);
out_port = it->second; out_port = it->second;
return RESULT_SUCCESS; return ResultSuccess;
} }
Result ServiceManager::ConnectToService(std::shared_ptr<Kernel::ClientSession>& session, Result ServiceManager::ConnectToService(std::shared_ptr<Kernel::ClientSession>& session,

View File

@ -31,19 +31,19 @@ namespace Service::SM {
class SRV; class SRV;
constexpr Result ERR_SERVICE_NOT_REGISTERED(1, ErrorModule::SRV, ErrorSummary::WouldBlock, constexpr Result ResultServiceNotRegistered(1, ErrorModule::SRV, ErrorSummary::WouldBlock,
ErrorLevel::Temporary); // 0xD0406401 ErrorLevel::Temporary); // 0xD0406401
constexpr Result ERR_MAX_CONNECTIONS_REACHED(2, ErrorModule::SRV, ErrorSummary::WouldBlock, constexpr Result ResultMaxConnectionsReached(2, ErrorModule::SRV, ErrorSummary::WouldBlock,
ErrorLevel::Temporary); // 0xD0406402 ErrorLevel::Temporary); // 0xD0406402
constexpr Result ERR_INVALID_NAME_SIZE(5, ErrorModule::SRV, ErrorSummary::WrongArgument, constexpr Result ResultInvalidNameSize(5, ErrorModule::SRV, ErrorSummary::WrongArgument,
ErrorLevel::Permanent); // 0xD9006405 ErrorLevel::Permanent); // 0xD9006405
constexpr Result ERR_ACCESS_DENIED(6, ErrorModule::SRV, ErrorSummary::InvalidArgument, constexpr Result ResultAccessDenied(6, ErrorModule::SRV, ErrorSummary::InvalidArgument,
ErrorLevel::Permanent); // 0xD8E06406 ErrorLevel::Permanent); // 0xD8E06406
constexpr Result ERR_NAME_CONTAINS_NUL(7, ErrorModule::SRV, ErrorSummary::WrongArgument, constexpr Result ResultNameContainsNul(7, ErrorModule::SRV, ErrorSummary::WrongArgument,
ErrorLevel::Permanent); // 0xD9006407 ErrorLevel::Permanent); // 0xD9006407
constexpr Result ERR_ALREADY_REGISTERED(ErrorDescription::AlreadyExists, ErrorModule::OS, constexpr Result ResultAlreadyRegistered(ErrorDescription::AlreadyExists, ErrorModule::OS,
ErrorSummary::WrongArgument, ErrorSummary::WrongArgument,
ErrorLevel::Permanent); // 0xD9001BFC ErrorLevel::Permanent); // 0xD9001BFC
class ServiceManager { class ServiceManager {
public: public:

View File

@ -53,13 +53,13 @@ void SRV::RegisterClient(Kernel::HLERequestContext& ctx) {
const auto pid_descriptor = rp.Pop<u32>(); const auto pid_descriptor = rp.Pop<u32>();
if (pid_descriptor != IPC::CallingPidDesc()) { if (pid_descriptor != IPC::CallingPidDesc()) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(IPC::ERR_INVALID_BUFFER_DESCRIPTOR); rb.Push(IPC::ResultInvalidBufferDescriptor);
return; return;
} }
const auto caller_pid = rp.Pop<u32>(); const auto caller_pid = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_SRV, "(STUBBED) called. Caller PID={}", caller_pid); LOG_WARNING(Service_SRV, "(STUBBED) called. Caller PID={}", caller_pid);
} }
@ -80,7 +80,7 @@ void SRV::EnableNotification(Kernel::HLERequestContext& ctx) {
system.Kernel().CreateSemaphore(0, MAX_PENDING_NOTIFICATIONS, "SRV:Notification").Unwrap(); system.Kernel().CreateSemaphore(0, MAX_PENDING_NOTIFICATIONS, "SRV:Notification").Unwrap();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushCopyObjects(notification_semaphore); rb.PushCopyObjects(notification_semaphore);
LOG_WARNING(Service_SRV, "(STUBBED) called"); LOG_WARNING(Service_SRV, "(STUBBED) called");
} }
@ -104,8 +104,8 @@ public:
IPC::RequestBuilder rb(ctx, 0x5, 1, 2); IPC::RequestBuilder rb(ctx, 0x5, 1, 2);
rb.Push(result); rb.Push(result);
rb.PushMoveObjects(std::move(session)); rb.PushMoveObjects(std::move(session));
} else if (result == Kernel::ERR_MAX_CONNECTIONS_REACHED) { } else if (result == Kernel::ResultMaxConnectionsReached) {
LOG_ERROR(Service_SRV, "called service={} -> ERR_MAX_CONNECTIONS_REACHED", name); LOG_ERROR(Service_SRV, "called service={} -> ResultMaxConnectionsReached", name);
UNREACHABLE(); UNREACHABLE();
} else { } else {
LOG_ERROR(Service_SRV, "called service={} -> error 0x{:08X}", name, result.raw); LOG_ERROR(Service_SRV, "called service={} -> error 0x{:08X}", name, result.raw);
@ -149,8 +149,8 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
if (name_len > Service::kMaxPortSize) { if (name_len > Service::kMaxPortSize) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ERR_INVALID_NAME_SIZE); rb.Push(ResultInvalidNameSize);
LOG_ERROR(Service_SRV, "called name_len=0x{:X} -> ERR_INVALID_NAME_SIZE", name_len); LOG_ERROR(Service_SRV, "called name_len=0x{:X} -> ResultInvalidNameSize", name_len);
return; return;
} }
std::string name(name_buf.data(), name_len); std::string name(name_buf.data(), name_len);
@ -162,7 +162,7 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
std::shared_ptr<Kernel::ClientPort> client_port; std::shared_ptr<Kernel::ClientPort> client_port;
auto result = system.ServiceManager().GetServicePort(client_port, name); auto result = system.ServiceManager().GetServicePort(client_port, name);
if (result.IsError()) { if (result.IsError()) {
if (wait_until_available && result == ERR_SERVICE_NOT_REGISTERED) { if (wait_until_available && result == ResultServiceNotRegistered) {
LOG_INFO(Service_SRV, "called service={} delayed", name); LOG_INFO(Service_SRV, "called service={} delayed", name);
std::shared_ptr<Kernel::Event> get_service_handle_event = std::shared_ptr<Kernel::Event> get_service_handle_event =
ctx.SleepClientThread("GetServiceHandle", std::chrono::nanoseconds(-1), get_handle); ctx.SleepClientThread("GetServiceHandle", std::chrono::nanoseconds(-1), get_handle);
@ -183,8 +183,8 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(result); rb.Push(result);
rb.PushMoveObjects(std::move(session)); rb.PushMoveObjects(std::move(session));
} else if (result == Kernel::ERR_MAX_CONNECTIONS_REACHED && wait_until_available) { } else if (result == Kernel::ResultMaxConnectionsReached && wait_until_available) {
LOG_WARNING(Service_SRV, "called service={} -> ERR_MAX_CONNECTIONS_REACHED", name); LOG_WARNING(Service_SRV, "called service={} -> ResultMaxConnectionsReached", name);
// TODO(Subv): Put the caller guest thread to sleep until this port becomes available again. // TODO(Subv): Put the caller guest thread to sleep until this port becomes available again.
UNIMPLEMENTED_MSG("Unimplemented wait until port {} is available.", name); UNIMPLEMENTED_MSG("Unimplemented wait until port {} is available.", name);
} else { } else {
@ -208,7 +208,7 @@ void SRV::Subscribe(Kernel::HLERequestContext& ctx) {
u32 notification_id = rp.Pop<u32>(); u32 notification_id = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_SRV, "(STUBBED) called, notification_id=0x{:X}", notification_id); LOG_WARNING(Service_SRV, "(STUBBED) called, notification_id=0x{:X}", notification_id);
} }
@ -226,7 +226,7 @@ void SRV::Unsubscribe(Kernel::HLERequestContext& ctx) {
u32 notification_id = rp.Pop<u32>(); u32 notification_id = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
LOG_WARNING(Service_SRV, "(STUBBED) called, notification_id=0x{:X}", notification_id); LOG_WARNING(Service_SRV, "(STUBBED) called, notification_id=0x{:X}", notification_id);
} }
@ -256,7 +256,7 @@ void SRV::PublishToSubscriber(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void SRV::RegisterService(Kernel::HLERequestContext& ctx) { void SRV::RegisterService(Kernel::HLERequestContext& ctx) {
@ -285,7 +285,7 @@ void SRV::RegisterService(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMoveObjects(std::move(port)); rb.PushMoveObjects(std::move(port));
} }

View File

@ -428,21 +428,21 @@ std::optional<std::reference_wrapper<SocketHolder>> SOC_U::GetSocketHolder(u32 c
if (initialized_processes.find(process_id) == initialized_processes.end()) { if (initialized_processes.find(process_id) == initialized_processes.end()) {
LOG_DEBUG(Service_SOC, "Process not initialized: pid={}", process_id); LOG_DEBUG(Service_SOC, "Process not initialized: pid={}", process_id);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ERR_NOT_INITIALIZED); rb.Push(ResultNotInitialized);
return std::nullopt; return std::nullopt;
} }
auto fd_info = created_sockets.find(ctr_socket_fd); auto fd_info = created_sockets.find(ctr_socket_fd);
if (fd_info == created_sockets.end()) { if (fd_info == created_sockets.end()) {
LOG_DEBUG(Service_SOC, "Invalid socket: pid={}, fd={}", process_id, ctr_socket_fd); LOG_DEBUG(Service_SOC, "Invalid socket: pid={}, fd={}", process_id, ctr_socket_fd);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ERR_INVALID_SOCKET_DESCRIPTOR); rb.Push(ResultInvalidSocketDescriptor);
return std::nullopt; return std::nullopt;
} }
if (fd_info->second.ownerProcess != process_id && !fd_info->second.isGlobal) { if (fd_info->second.ownerProcess != process_id && !fd_info->second.isGlobal) {
LOG_DEBUG(Service_SOC, "Invalid process owner: pid={}, fd={}, owner_pid={}", process_id, LOG_DEBUG(Service_SOC, "Invalid process owner: pid={}, fd={}, owner_pid={}", process_id,
ctr_socket_fd, fd_info->second.ownerProcess); ctr_socket_fd, fd_info->second.ownerProcess);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ERR_WRONG_PROCESS); rb.Push(ResultWrongProcess);
return std::nullopt; return std::nullopt;
} }
return std::ref(fd_info->second); return std::ref(fd_info->second);
@ -820,7 +820,7 @@ void SOC_U::Socket(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_SOC, "called, pid={}, ret={}", pid, static_cast<s32>(ret)); LOG_DEBUG(Service_SOC, "called, pid={}, ret={}", pid, static_cast<s32>(ret));
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(static_cast<s32>(ret)); rb.Push(static_cast<s32>(ret));
} }
@ -851,7 +851,7 @@ void SOC_U::Bind(Kernel::HLERequestContext& ctx) {
static_cast<s32>(ret)); static_cast<s32>(ret));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ret); rb.Push(ret);
} }
@ -874,7 +874,7 @@ void SOC_U::Fcntl(Kernel::HLERequestContext& ctx) {
static_cast<s32>(posix_ret)); static_cast<s32>(posix_ret));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(posix_ret); rb.Push(posix_ret);
}); });
@ -911,7 +911,7 @@ void SOC_U::Listen(Kernel::HLERequestContext& ctx) {
static_cast<s32>(ret)); static_cast<s32>(ret));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ret); rb.Push(ret);
} }
@ -1029,7 +1029,7 @@ void SOC_U::SockAtMark(Kernel::HLERequestContext& ctx) {
static_cast<s32>(ret)); static_cast<s32>(ret));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ret); rb.Push(ret);
} }
@ -1043,7 +1043,7 @@ void SOC_U::GetHostId(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(host_id); rb.Push(host_id);
} }
@ -1068,7 +1068,7 @@ void SOC_U::Close(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_SOC, "pid={}, fd={}, ret={}", pid, socket_handle, static_cast<s32>(ret)); LOG_DEBUG(Service_SOC, "pid={}, fd={}, ret={}", pid, socket_handle, static_cast<s32>(ret));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ret); rb.Push(ret);
} }
@ -1133,7 +1133,7 @@ void SOC_U::SendToOther(Kernel::HLERequestContext& ctx) {
LOG_SEND_RECV(Service_SOC, "called, fd={}, ret={}", socket_handle, static_cast<s32>(ret)); LOG_SEND_RECV(Service_SOC, "called, fd={}, ret={}", socket_handle, static_cast<s32>(ret));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ret); rb.Push(ret);
} }
@ -1202,7 +1202,7 @@ void SOC_U::SendToSingle(Kernel::HLERequestContext& ctx) {
LOG_SEND_RECV(Service_SOC, "called, fd={}, ret={}", socket_handle, static_cast<s32>(ret)); LOG_SEND_RECV(Service_SOC, "called, fd={}, ret={}", socket_handle, static_cast<s32>(ret));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ret); rb.Push(ret);
} }
@ -1335,7 +1335,7 @@ void SOC_U::RecvFromOther(Kernel::HLERequestContext& ctx) {
static_cast<s32>(async_data->ret)); static_cast<s32>(async_data->ret));
IPC::RequestBuilder rb(ctx, 0x07, 2, 4); IPC::RequestBuilder rb(ctx, 0x07, 2, 4);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(async_data->ret); rb.Push(async_data->ret);
rb.PushStaticBuffer(std::move(async_data->addr_buff), 0); rb.PushStaticBuffer(std::move(async_data->addr_buff), 0);
rb.PushMappedBuffer(*async_data->buffer); rb.PushMappedBuffer(*async_data->buffer);
@ -1456,7 +1456,7 @@ void SOC_U::RecvFrom(Kernel::HLERequestContext& ctx) {
static_cast<s32>(async_data->ret)); static_cast<s32>(async_data->ret));
IPC::RequestBuilder rb(ctx, 0x08, 3, 4); IPC::RequestBuilder rb(ctx, 0x08, 3, 4);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(async_data->ret); rb.Push(async_data->ret);
rb.Push(total_received); rb.Push(total_received);
rb.PushStaticBuffer(std::move(async_data->output_buff), 0); rb.PushStaticBuffer(std::move(async_data->output_buff), 0);
@ -1532,7 +1532,7 @@ void SOC_U::Poll(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb(ctx, static_cast<u16>(ctx.CommandHeader().command_id.Value()), 2, IPC::RequestBuilder rb(ctx, static_cast<u16>(ctx.CommandHeader().command_id.Value()), 2,
2); 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(async_data->ret); rb.Push(async_data->ret);
rb.PushStaticBuffer(std::move(output_fds), 0); rb.PushStaticBuffer(std::move(output_fds), 0);
@ -1574,7 +1574,7 @@ void SOC_U::GetSockName(Kernel::HLERequestContext& ctx) {
static_cast<s32>(ret)); static_cast<s32>(ret));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ret); rb.Push(ret);
rb.PushStaticBuffer(std::move(dest_addr_buff), 0); rb.PushStaticBuffer(std::move(dest_addr_buff), 0);
} }
@ -1604,7 +1604,7 @@ void SOC_U::Shutdown(Kernel::HLERequestContext& ctx) {
static_cast<s32>(ret)); static_cast<s32>(ret));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ret); rb.Push(ret);
} }
@ -1716,7 +1716,7 @@ void SOC_U::GetPeerName(Kernel::HLERequestContext& ctx) {
static_cast<s32>(result)); static_cast<s32>(result));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(result); rb.Push(result);
rb.PushStaticBuffer(std::move(dest_addr_buff), 0); rb.PushStaticBuffer(std::move(dest_addr_buff), 0);
} }
@ -1787,7 +1787,7 @@ void SOC_U::InitializeSockets(Kernel::HLERequestContext& ctx) {
if (initialized_processes.find(pid) == initialized_processes.end()) { if (initialized_processes.find(pid) == initialized_processes.end()) {
initialized_processes.insert(pid); initialized_processes.insert(pid);
} else { } else {
res = ERR_ALREADY_INITIALIZED; res = ResultAlreadyInitialized;
} }
LOG_DEBUG(Service_SOC, "called, pid={}, res={:#08X}", pid, res.raw); LOG_DEBUG(Service_SOC, "called, pid={}, res={:#08X}", pid, res.raw);
@ -1806,7 +1806,7 @@ void SOC_U::ShutdownSockets(Kernel::HLERequestContext& ctx) {
if (initialized_processes.find(pid) == initialized_processes.end()) { if (initialized_processes.find(pid) == initialized_processes.end()) {
LOG_DEBUG(Service_SOC, "Process not initialized: pid={}", pid); LOG_DEBUG(Service_SOC, "Process not initialized: pid={}", pid);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ERR_NOT_INITIALIZED); rb.Push(ResultNotInitialized);
return; return;
} }
@ -1816,7 +1816,7 @@ void SOC_U::ShutdownSockets(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_SOC, "called, pid={}", pid); LOG_DEBUG(Service_SOC, "called, pid={}", pid);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void SOC_U::GetSockOpt(Kernel::HLERequestContext& ctx) { void SOC_U::GetSockOpt(Kernel::HLERequestContext& ctx) {
@ -1863,7 +1863,7 @@ void SOC_U::GetSockOpt(Kernel::HLERequestContext& ctx) {
static_cast<s32>(err)); static_cast<s32>(err));
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(err); rb.Push(err);
rb.Push(static_cast<u32>(optval.size())); rb.Push(static_cast<u32>(optval.size()));
rb.PushStaticBuffer(std::move(optval), 0); rb.PushStaticBuffer(std::move(optval), 0);
@ -1910,7 +1910,7 @@ void SOC_U::SetSockOpt(Kernel::HLERequestContext& ctx) {
static_cast<s32>(err)); static_cast<s32>(err));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(err); rb.Push(err);
} }
@ -1963,7 +1963,7 @@ void SOC_U::GetNetworkOpt(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(err); rb.Push(err);
rb.Push(static_cast<u32>(opt_len)); rb.Push(static_cast<u32>(opt_len));
rb.PushStaticBuffer(std::move(opt_data), 0); rb.PushStaticBuffer(std::move(opt_data), 0);
@ -2026,7 +2026,7 @@ void SOC_U::GetAddrInfoImpl(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ret); rb.Push(ret);
rb.Push(count); rb.Push(count);
rb.PushStaticBuffer(std::move(out_buff), 0); rb.PushStaticBuffer(std::move(out_buff), 0);
@ -2055,7 +2055,7 @@ void SOC_U::GetNameInfoImpl(Kernel::HLERequestContext& ctx) {
} }
IPC::RequestBuilder rb = rp.MakeBuilder(2, 4); IPC::RequestBuilder rb = rp.MakeBuilder(2, 4);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.Push(ret); rb.Push(ret);
rb.PushStaticBuffer(std::move(host), 0); rb.PushStaticBuffer(std::move(host), 0);
rb.PushStaticBuffer(std::move(serv), 1); rb.PushStaticBuffer(std::move(serv), 1);
@ -2102,7 +2102,7 @@ void SOC_U::CloseSockets(Kernel::HLERequestContext& ctx) {
if (initialized_processes.find(pid) == initialized_processes.end()) { if (initialized_processes.find(pid) == initialized_processes.end()) {
LOG_DEBUG(Service_SOC, "Process not initialized: pid={}", pid); LOG_DEBUG(Service_SOC, "Process not initialized: pid={}", pid);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ERR_NOT_INITIALIZED); rb.Push(ResultNotInitialized);
return; return;
} }

View File

@ -61,13 +61,13 @@ public:
std::optional<InterfaceInfo> GetDefaultInterfaceInfo(); std::optional<InterfaceInfo> GetDefaultInterfaceInfo();
private: private:
static constexpr Result ERR_WRONG_PROCESS = static constexpr Result ResultWrongProcess =
Result(4, ErrorModule::SOC, ErrorSummary::InvalidState, ErrorLevel::Status); Result(4, ErrorModule::SOC, ErrorSummary::InvalidState, ErrorLevel::Status);
static constexpr Result ERR_NOT_INITIALIZED = static constexpr Result ResultNotInitialized =
Result(6, ErrorModule::SOC, ErrorSummary::InvalidArgument, ErrorLevel::Permanent); Result(6, ErrorModule::SOC, ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
static constexpr Result ERR_INVALID_SOCKET_DESCRIPTOR = static constexpr Result ResultInvalidSocketDescriptor =
Result(7, ErrorModule::SOC, ErrorSummary::InvalidArgument, ErrorLevel::Permanent); Result(7, ErrorModule::SOC, ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
static constexpr Result ERR_ALREADY_INITIALIZED = static constexpr Result ResultAlreadyInitialized =
Result(11, ErrorModule::SOC, ErrorSummary::InvalidState, ErrorLevel::Status); Result(11, ErrorModule::SOC, ErrorSummary::InvalidState, ErrorLevel::Status);
static constexpr u32 SOC_ERR_INAVLID_ENUM_VALUE = 0xFFFF8025; static constexpr u32 SOC_ERR_INAVLID_ENUM_VALUE = 0xFFFF8025;

View File

@ -19,7 +19,7 @@ void SSL_C::Initialize(Kernel::HLERequestContext& ctx) {
// Stub, return success // Stub, return success
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
} }
void SSL_C::GenerateRandomData(Kernel::HLERequestContext& ctx) { void SSL_C::GenerateRandomData(Kernel::HLERequestContext& ctx) {
@ -32,7 +32,7 @@ void SSL_C::GenerateRandomData(Kernel::HLERequestContext& ctx) {
buffer.Write(out_data.data(), 0, size); buffer.Write(out_data.data(), 0, size);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(ResultSuccess);
rb.PushMappedBuffer(buffer); rb.PushMappedBuffer(buffer);
} }

View File

@ -125,7 +125,7 @@ TEST_CASE("HLERequestContext::PopulateFromIncomingCommandBuffer", "[core][kernel
auto result = context.PopulateFromIncomingCommandBuffer(input, process); auto result = context.PopulateFromIncomingCommandBuffer(input, process);
REQUIRE(result == RESULT_SUCCESS); REQUIRE(result == ResultSuccess);
auto* output = context.CommandBuffer(); auto* output = context.CommandBuffer();
REQUIRE(context.GetIncomingHandle(output[2]) == nullptr); REQUIRE(context.GetIncomingHandle(output[2]) == nullptr);
} }
@ -150,7 +150,7 @@ TEST_CASE("HLERequestContext::PopulateFromIncomingCommandBuffer", "[core][kernel
VAddr target_address = 0x10000000; VAddr target_address = 0x10000000;
auto result = process->vm_manager.MapBackingMemory( auto result = process->vm_manager.MapBackingMemory(
target_address, buffer, static_cast<u32>(buffer.GetSize()), MemoryState::Private); target_address, buffer, static_cast<u32>(buffer.GetSize()), MemoryState::Private);
REQUIRE(result.Code() == RESULT_SUCCESS); REQUIRE(result.Code() == ResultSuccess);
const u32_le input[]{ const u32_le input[]{
IPC::MakeHeader(0, 0, 2), IPC::MakeHeader(0, 0, 2),
@ -163,7 +163,7 @@ TEST_CASE("HLERequestContext::PopulateFromIncomingCommandBuffer", "[core][kernel
CHECK(context.GetStaticBuffer(0) == mem->Vector()); CHECK(context.GetStaticBuffer(0) == mem->Vector());
REQUIRE(process->vm_manager.UnmapRange( REQUIRE(process->vm_manager.UnmapRange(
target_address, static_cast<u32>(buffer.GetSize())) == RESULT_SUCCESS); target_address, static_cast<u32>(buffer.GetSize())) == ResultSuccess);
} }
SECTION("translates MappedBuffer descriptors") { SECTION("translates MappedBuffer descriptors") {
@ -174,7 +174,7 @@ TEST_CASE("HLERequestContext::PopulateFromIncomingCommandBuffer", "[core][kernel
VAddr target_address = 0x10000000; VAddr target_address = 0x10000000;
auto result = process->vm_manager.MapBackingMemory( auto result = process->vm_manager.MapBackingMemory(
target_address, buffer, static_cast<u32>(buffer.GetSize()), MemoryState::Private); target_address, buffer, static_cast<u32>(buffer.GetSize()), MemoryState::Private);
REQUIRE(result.Code() == RESULT_SUCCESS); REQUIRE(result.Code() == ResultSuccess);
const u32_le input[]{ const u32_le input[]{
IPC::MakeHeader(0, 0, 2), IPC::MakeHeader(0, 0, 2),
@ -190,7 +190,7 @@ TEST_CASE("HLERequestContext::PopulateFromIncomingCommandBuffer", "[core][kernel
CHECK(other_buffer == mem->Vector()); CHECK(other_buffer == mem->Vector());
REQUIRE(process->vm_manager.UnmapRange( REQUIRE(process->vm_manager.UnmapRange(
target_address, static_cast<u32>(buffer.GetSize())) == RESULT_SUCCESS); target_address, static_cast<u32>(buffer.GetSize())) == ResultSuccess);
} }
SECTION("translates mixed params") { SECTION("translates mixed params") {
@ -206,13 +206,13 @@ TEST_CASE("HLERequestContext::PopulateFromIncomingCommandBuffer", "[core][kernel
auto result = process->vm_manager.MapBackingMemory( auto result = process->vm_manager.MapBackingMemory(
target_address_static, buffer_static, static_cast<u32>(buffer_static.GetSize()), target_address_static, buffer_static, static_cast<u32>(buffer_static.GetSize()),
MemoryState::Private); MemoryState::Private);
REQUIRE(result.Code() == RESULT_SUCCESS); REQUIRE(result.Code() == ResultSuccess);
VAddr target_address_mapped = 0x20000000; VAddr target_address_mapped = 0x20000000;
result = process->vm_manager.MapBackingMemory(target_address_mapped, buffer_mapped, result = process->vm_manager.MapBackingMemory(target_address_mapped, buffer_mapped,
static_cast<u32>(buffer_mapped.GetSize()), static_cast<u32>(buffer_mapped.GetSize()),
MemoryState::Private); MemoryState::Private);
REQUIRE(result.Code() == RESULT_SUCCESS); REQUIRE(result.Code() == ResultSuccess);
auto a = MakeObject(kernel); auto a = MakeObject(kernel);
Handle a_handle; Handle a_handle;
@ -245,10 +245,10 @@ TEST_CASE("HLERequestContext::PopulateFromIncomingCommandBuffer", "[core][kernel
REQUIRE(process->vm_manager.UnmapRange(target_address_static, REQUIRE(process->vm_manager.UnmapRange(target_address_static,
static_cast<u32>(buffer_static.GetSize())) == static_cast<u32>(buffer_static.GetSize())) ==
RESULT_SUCCESS); ResultSuccess);
REQUIRE(process->vm_manager.UnmapRange(target_address_mapped, REQUIRE(process->vm_manager.UnmapRange(target_address_mapped,
static_cast<u32>(buffer_mapped.GetSize())) == static_cast<u32>(buffer_mapped.GetSize())) ==
RESULT_SUCCESS); ResultSuccess);
} }
} }
@ -309,7 +309,7 @@ TEST_CASE("HLERequestContext::WriteToOutgoingCommandBuffer", "[core][kernel]") {
auto result = context.WriteToOutgoingCommandBuffer(output, *process); auto result = context.WriteToOutgoingCommandBuffer(output, *process);
REQUIRE(result == RESULT_SUCCESS); REQUIRE(result == ResultSuccess);
REQUIRE(output[2] == 0); REQUIRE(output[2] == 0);
} }
@ -344,7 +344,7 @@ TEST_CASE("HLERequestContext::WriteToOutgoingCommandBuffer", "[core][kernel]") {
auto result = process->vm_manager.MapBackingMemory( auto result = process->vm_manager.MapBackingMemory(
target_address, output_buffer, static_cast<u32>(output_buffer.GetSize()), target_address, output_buffer, static_cast<u32>(output_buffer.GetSize()),
MemoryState::Private); MemoryState::Private);
REQUIRE(result.Code() == RESULT_SUCCESS); REQUIRE(result.Code() == ResultSuccess);
input[0] = IPC::MakeHeader(0, 0, 2); input[0] = IPC::MakeHeader(0, 0, 2);
input[1] = IPC::StaticBufferDesc(input_buffer.size(), 0); input[1] = IPC::StaticBufferDesc(input_buffer.size(), 0);
@ -362,7 +362,7 @@ TEST_CASE("HLERequestContext::WriteToOutgoingCommandBuffer", "[core][kernel]") {
CHECK(output_mem->Vector() == input_buffer); CHECK(output_mem->Vector() == input_buffer);
REQUIRE(process->vm_manager.UnmapRange( REQUIRE(process->vm_manager.UnmapRange(
target_address, static_cast<u32>(output_buffer.GetSize())) == RESULT_SUCCESS); target_address, static_cast<u32>(output_buffer.GetSize())) == ResultSuccess);
} }
SECTION("translates StaticBuffer descriptors") { SECTION("translates StaticBuffer descriptors") {
@ -376,7 +376,7 @@ TEST_CASE("HLERequestContext::WriteToOutgoingCommandBuffer", "[core][kernel]") {
auto result = process->vm_manager.MapBackingMemory( auto result = process->vm_manager.MapBackingMemory(
target_address, output_buffer, static_cast<u32>(output_buffer.GetSize()), target_address, output_buffer, static_cast<u32>(output_buffer.GetSize()),
MemoryState::Private); MemoryState::Private);
REQUIRE(result.Code() == RESULT_SUCCESS); REQUIRE(result.Code() == ResultSuccess);
const u32_le input_cmdbuff[]{ const u32_le input_cmdbuff[]{
IPC::MakeHeader(0, 0, 2), IPC::MakeHeader(0, 0, 2),
@ -398,7 +398,7 @@ TEST_CASE("HLERequestContext::WriteToOutgoingCommandBuffer", "[core][kernel]") {
CHECK(output[2] == target_address); CHECK(output[2] == target_address);
CHECK(output_mem->Vector() == input_buffer); CHECK(output_mem->Vector() == input_buffer);
REQUIRE(process->vm_manager.UnmapRange( REQUIRE(process->vm_manager.UnmapRange(
target_address, static_cast<u32>(output_buffer.GetSize())) == RESULT_SUCCESS); target_address, static_cast<u32>(output_buffer.GetSize())) == ResultSuccess);
} }
} }

View File

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <vector>
#include <catch2/catch_test_macros.hpp> #include <catch2/catch_test_macros.hpp>
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
@ -27,7 +26,7 @@ TEST_CASE("Memory Basics", "[kernel][memory]") {
auto result = auto result =
manager->MapBackingMemory(Memory::HEAP_VADDR, block, static_cast<u32>(block.GetSize()), manager->MapBackingMemory(Memory::HEAP_VADDR, block, static_cast<u32>(block.GetSize()),
Kernel::MemoryState::Private); Kernel::MemoryState::Private);
REQUIRE(result.Code() == RESULT_SUCCESS); REQUIRE(result.Code() == ResultSuccess);
auto vma = manager->FindVMA(Memory::HEAP_VADDR); auto vma = manager->FindVMA(Memory::HEAP_VADDR);
CHECK(vma != manager->vma_map.end()); CHECK(vma != manager->vma_map.end());
@ -43,11 +42,10 @@ TEST_CASE("Memory Basics", "[kernel][memory]") {
auto result = auto result =
manager->MapBackingMemory(Memory::HEAP_VADDR, block, static_cast<u32>(block.GetSize()), manager->MapBackingMemory(Memory::HEAP_VADDR, block, static_cast<u32>(block.GetSize()),
Kernel::MemoryState::Private); Kernel::MemoryState::Private);
REQUIRE(result.Code() == RESULT_SUCCESS); REQUIRE(result.Code() == ResultSuccess);
ResultCode code = Result code = manager->UnmapRange(Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()));
manager->UnmapRange(Memory::HEAP_VADDR, static_cast<u32>(block.GetSize())); REQUIRE(code == ResultSuccess);
REQUIRE(code == RESULT_SUCCESS);
auto vma = manager->FindVMA(Memory::HEAP_VADDR); auto vma = manager->FindVMA(Memory::HEAP_VADDR);
CHECK(vma != manager->vma_map.end()); CHECK(vma != manager->vma_map.end());
@ -61,18 +59,18 @@ TEST_CASE("Memory Basics", "[kernel][memory]") {
auto result = auto result =
manager->MapBackingMemory(Memory::HEAP_VADDR, block, static_cast<u32>(block.GetSize()), manager->MapBackingMemory(Memory::HEAP_VADDR, block, static_cast<u32>(block.GetSize()),
Kernel::MemoryState::Private); Kernel::MemoryState::Private);
REQUIRE(result.Code() == RESULT_SUCCESS); REQUIRE(result.Code() == ResultSuccess);
ResultCode code = manager->ReprotectRange( Result code = manager->ReprotectRange(Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()),
Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()), Kernel::VMAPermission::Execute); Kernel::VMAPermission::Execute);
CHECK(code == RESULT_SUCCESS); CHECK(code == ResultSuccess);
auto vma = manager->FindVMA(Memory::HEAP_VADDR); auto vma = manager->FindVMA(Memory::HEAP_VADDR);
CHECK(vma != manager->vma_map.end()); CHECK(vma != manager->vma_map.end());
CHECK(vma->second.permissions == Kernel::VMAPermission::Execute); CHECK(vma->second.permissions == Kernel::VMAPermission::Execute);
code = manager->UnmapRange(Memory::HEAP_VADDR, static_cast<u32>(block.GetSize())); code = manager->UnmapRange(Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()));
REQUIRE(code == RESULT_SUCCESS); REQUIRE(code == ResultSuccess);
} }
SECTION("changing memory state") { SECTION("changing memory state") {
@ -81,29 +79,29 @@ TEST_CASE("Memory Basics", "[kernel][memory]") {
auto result = auto result =
manager->MapBackingMemory(Memory::HEAP_VADDR, block, static_cast<u32>(block.GetSize()), manager->MapBackingMemory(Memory::HEAP_VADDR, block, static_cast<u32>(block.GetSize()),
Kernel::MemoryState::Private); Kernel::MemoryState::Private);
REQUIRE(result.Code() == RESULT_SUCCESS); REQUIRE(result.Code() == ResultSuccess);
SECTION("reprotect memory range") { SECTION("reprotect memory range") {
ResultCode code = Result code =
manager->ReprotectRange(Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()), manager->ReprotectRange(Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()),
Kernel::VMAPermission::ReadWrite); Kernel::VMAPermission::ReadWrite);
REQUIRE(code == RESULT_SUCCESS); REQUIRE(code == ResultSuccess);
} }
SECTION("with invalid address") { SECTION("with invalid address") {
ResultCode code = manager->ChangeMemoryState( Result code = manager->ChangeMemoryState(
0xFFFFFFFF, static_cast<u32>(block.GetSize()), Kernel::MemoryState::Locked, 0xFFFFFFFF, static_cast<u32>(block.GetSize()), Kernel::MemoryState::Locked,
Kernel::VMAPermission::ReadWrite, Kernel::MemoryState::Aliased, Kernel::VMAPermission::ReadWrite, Kernel::MemoryState::Aliased,
Kernel::VMAPermission::Execute); Kernel::VMAPermission::Execute);
CHECK(code == Kernel::ERR_INVALID_ADDRESS); CHECK(code == Kernel::ResultInvalidAddress);
} }
SECTION("ignoring the original permissions") { SECTION("ignoring the original permissions") {
ResultCode code = manager->ChangeMemoryState( Result code = manager->ChangeMemoryState(
Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()), Kernel::MemoryState::Private, Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()), Kernel::MemoryState::Private,
Kernel::VMAPermission::None, Kernel::MemoryState::Locked, Kernel::VMAPermission::None, Kernel::MemoryState::Locked,
Kernel::VMAPermission::Write); Kernel::VMAPermission::Write);
CHECK(code == RESULT_SUCCESS); CHECK(code == ResultSuccess);
auto vma = manager->FindVMA(Memory::HEAP_VADDR); auto vma = manager->FindVMA(Memory::HEAP_VADDR);
CHECK(vma != manager->vma_map.end()); CHECK(vma != manager->vma_map.end());
@ -112,11 +110,11 @@ TEST_CASE("Memory Basics", "[kernel][memory]") {
} }
SECTION("enforcing the original permissions with correct expectations") { SECTION("enforcing the original permissions with correct expectations") {
ResultCode code = manager->ChangeMemoryState( Result code = manager->ChangeMemoryState(
Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()), Kernel::MemoryState::Private, Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()), Kernel::MemoryState::Private,
Kernel::VMAPermission::ReadWrite, Kernel::MemoryState::Aliased, Kernel::VMAPermission::ReadWrite, Kernel::MemoryState::Aliased,
Kernel::VMAPermission::Execute); Kernel::VMAPermission::Execute);
CHECK(code == RESULT_SUCCESS); CHECK(code == ResultSuccess);
auto vma = manager->FindVMA(Memory::HEAP_VADDR); auto vma = manager->FindVMA(Memory::HEAP_VADDR);
CHECK(vma != manager->vma_map.end()); CHECK(vma != manager->vma_map.end());
@ -125,11 +123,11 @@ TEST_CASE("Memory Basics", "[kernel][memory]") {
} }
SECTION("with incorrect permission expectations") { SECTION("with incorrect permission expectations") {
ResultCode code = manager->ChangeMemoryState( Result code = manager->ChangeMemoryState(
Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()), Kernel::MemoryState::Private, Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()), Kernel::MemoryState::Private,
Kernel::VMAPermission::Execute, Kernel::MemoryState::Aliased, Kernel::VMAPermission::Execute, Kernel::MemoryState::Aliased,
Kernel::VMAPermission::Execute); Kernel::VMAPermission::Execute);
CHECK(code == Kernel::ERR_INVALID_ADDRESS_STATE); CHECK(code == Kernel::ResultInvalidAddressState);
auto vma = manager->FindVMA(Memory::HEAP_VADDR); auto vma = manager->FindVMA(Memory::HEAP_VADDR);
CHECK(vma != manager->vma_map.end()); CHECK(vma != manager->vma_map.end());
@ -138,11 +136,11 @@ TEST_CASE("Memory Basics", "[kernel][memory]") {
} }
SECTION("with incorrect state expectations") { SECTION("with incorrect state expectations") {
ResultCode code = manager->ChangeMemoryState( Result code = manager->ChangeMemoryState(
Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()), Kernel::MemoryState::Locked, Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()), Kernel::MemoryState::Locked,
Kernel::VMAPermission::ReadWrite, Kernel::MemoryState::Aliased, Kernel::VMAPermission::ReadWrite, Kernel::MemoryState::Aliased,
Kernel::VMAPermission::Execute); Kernel::VMAPermission::Execute);
CHECK(code == Kernel::ERR_INVALID_ADDRESS_STATE); CHECK(code == Kernel::ResultInvalidAddressState);
auto vma = manager->FindVMA(Memory::HEAP_VADDR); auto vma = manager->FindVMA(Memory::HEAP_VADDR);
CHECK(vma != manager->vma_map.end()); CHECK(vma != manager->vma_map.end());
@ -150,8 +148,7 @@ TEST_CASE("Memory Basics", "[kernel][memory]") {
CHECK(vma->second.meminfo_state == Kernel::MemoryState::Private); CHECK(vma->second.meminfo_state == Kernel::MemoryState::Private);
} }
ResultCode code = Result code = manager->UnmapRange(Memory::HEAP_VADDR, static_cast<u32>(block.GetSize()));
manager->UnmapRange(Memory::HEAP_VADDR, static_cast<u32>(block.GetSize())); REQUIRE(code == ResultSuccess);
REQUIRE(code == RESULT_SUCCESS);
} }
} }