diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/result.h | 17 | ||||
| -rw-r--r-- | src/core/hle/service/cfg/cfg.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/service/ptm/ptm.cpp | 2 |
3 files changed, 18 insertions, 6 deletions
diff --git a/src/core/hle/result.h b/src/core/hle/result.h index db548bd76..c44668732 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h | |||
| @@ -13,9 +13,14 @@ | |||
| 13 | 13 | ||
| 14 | // All the constants in this file come from http://3dbrew.org/wiki/Error_codes | 14 | // All the constants in this file come from http://3dbrew.org/wiki/Error_codes |
| 15 | 15 | ||
| 16 | /// Detailed description of the error. This listing is likely incomplete. | 16 | /** |
| 17 | * Detailed description of the error. Code 0 always means success. Codes 1000 and above are | ||
| 18 | * considered "well-known" and have common values between all modules. The meaning of other codes | ||
| 19 | * vary by module. | ||
| 20 | */ | ||
| 17 | enum class ErrorDescription : u32 { | 21 | enum class ErrorDescription : u32 { |
| 18 | Success = 0, | 22 | Success = 0, |
| 23 | |||
| 19 | SessionClosedByRemote = 26, | 24 | SessionClosedByRemote = 26, |
| 20 | WrongPermission = 46, | 25 | WrongPermission = 46, |
| 21 | OS_InvalidBufferDescriptor = 48, | 26 | OS_InvalidBufferDescriptor = 48, |
| @@ -45,6 +50,8 @@ enum class ErrorDescription : u32 { | |||
| 45 | FS_UnsupportedOpenFlags = 760, | 50 | FS_UnsupportedOpenFlags = 760, |
| 46 | FS_IncorrectExeFSReadSize = 761, | 51 | FS_IncorrectExeFSReadSize = 761, |
| 47 | FS_UnexpectedFileOrDirectory = 770, | 52 | FS_UnexpectedFileOrDirectory = 770, |
| 53 | |||
| 54 | // Codes 1000 and above are considered "well-known" and have common values between all modules. | ||
| 48 | InvalidSection = 1000, | 55 | InvalidSection = 1000, |
| 49 | TooLarge = 1001, | 56 | TooLarge = 1001, |
| 50 | NotAuthorized = 1002, | 57 | NotAuthorized = 1002, |
| @@ -218,7 +225,7 @@ enum class ErrorLevel : u32 { | |||
| 218 | union ResultCode { | 225 | union ResultCode { |
| 219 | u32 raw; | 226 | u32 raw; |
| 220 | 227 | ||
| 221 | BitField<0, 10, ErrorDescription> description; | 228 | BitField<0, 10, u32> description; |
| 222 | BitField<10, 8, ErrorModule> module; | 229 | BitField<10, 8, ErrorModule> module; |
| 223 | 230 | ||
| 224 | BitField<21, 6, ErrorSummary> summary; | 231 | BitField<21, 6, ErrorSummary> summary; |
| @@ -230,7 +237,11 @@ union ResultCode { | |||
| 230 | 237 | ||
| 231 | constexpr explicit ResultCode(u32 raw) : raw(raw) {} | 238 | constexpr explicit ResultCode(u32 raw) : raw(raw) {} |
| 232 | 239 | ||
| 233 | constexpr ResultCode(ErrorDescription description_, ErrorModule module_, ErrorSummary summary_, | 240 | constexpr ResultCode(ErrorDescription description, ErrorModule module, ErrorSummary summary, |
| 241 | ErrorLevel level) | ||
| 242 | : ResultCode(static_cast<u32>(description), module, summary, level) {} | ||
| 243 | |||
| 244 | constexpr ResultCode(u32 description_, ErrorModule module_, ErrorSummary summary_, | ||
| 234 | ErrorLevel level_) | 245 | ErrorLevel level_) |
| 235 | : raw(description.FormatValue(description_) | module.FormatValue(module_) | | 246 | : raw(description.FormatValue(description_) | module.FormatValue(module_) | |
| 236 | summary.FormatValue(summary_) | level.FormatValue(level_)) {} | 247 | summary.FormatValue(summary_) | level.FormatValue(level_)) {} |
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index 8c8c1ec77..14185ae20 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp | |||
| @@ -411,7 +411,8 @@ ResultCode UpdateConfigNANDSavegame() { | |||
| 411 | ResultCode FormatConfig() { | 411 | ResultCode FormatConfig() { |
| 412 | ResultCode res = DeleteConfigNANDSaveFile(); | 412 | ResultCode res = DeleteConfigNANDSaveFile(); |
| 413 | // The delete command fails if the file doesn't exist, so we have to check that too | 413 | // The delete command fails if the file doesn't exist, so we have to check that too |
| 414 | if (!res.IsSuccess() && res.description != ErrorDescription::FS_FileNotFound) { | 414 | if (!res.IsSuccess() && |
| 415 | res.description != static_cast<u32>(ErrorDescription::FS_FileNotFound)) { | ||
| 415 | return res; | 416 | return res; |
| 416 | } | 417 | } |
| 417 | // Delete the old data | 418 | // Delete the old data |
| @@ -534,7 +535,7 @@ ResultCode LoadConfigNANDSaveFile() { | |||
| 534 | Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SystemSaveData, archive_path); | 535 | Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SystemSaveData, archive_path); |
| 535 | 536 | ||
| 536 | // If the archive didn't exist, create the files inside | 537 | // If the archive didn't exist, create the files inside |
| 537 | if (archive_result.Code().description == ErrorDescription::FS_NotFormatted) { | 538 | if (archive_result.Code().description == static_cast<u32>(ErrorDescription::FS_NotFormatted)) { |
| 538 | // Format the archive to create the directories | 539 | // Format the archive to create the directories |
| 539 | Service::FS::FormatArchive(Service::FS::ArchiveIdCode::SystemSaveData, | 540 | Service::FS::FormatArchive(Service::FS::ArchiveIdCode::SystemSaveData, |
| 540 | FileSys::ArchiveFormatInfo(), archive_path); | 541 | FileSys::ArchiveFormatInfo(), archive_path); |
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp index 319e8c946..b6d6d105a 100644 --- a/src/core/hle/service/ptm/ptm.cpp +++ b/src/core/hle/service/ptm/ptm.cpp | |||
| @@ -134,7 +134,7 @@ void Init() { | |||
| 134 | auto archive_result = | 134 | auto archive_result = |
| 135 | Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path); | 135 | Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path); |
| 136 | // If the archive didn't exist, create the files inside | 136 | // If the archive didn't exist, create the files inside |
| 137 | if (archive_result.Code().description == ErrorDescription::FS_NotFormatted) { | 137 | if (archive_result.Code().description == static_cast<u32>(ErrorDescription::FS_NotFormatted)) { |
| 138 | // Format the archive to create the directories | 138 | // Format the archive to create the directories |
| 139 | Service::FS::FormatArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, | 139 | Service::FS::FormatArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, |
| 140 | FileSys::ArchiveFormatInfo(), archive_path); | 140 | FileSys::ArchiveFormatInfo(), archive_path); |