summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKevin Hartman <kevin@hart.mn>2015-02-18 07:48:30 +0100
committerKevin Hartman <kevin@hart.mn>2015-02-21 06:47:58 +0100
commita6fdb8f2176e2701c505758237ee96029e97f405 (patch)
tree2ed18a38e36ac4b4aa396ea95b15e15b801057ea /src
parentMerge pull request #587 from archshift/assert (diff)
downloadyuzu-a6fdb8f2176e2701c505758237ee96029e97f405.tar
yuzu-a6fdb8f2176e2701c505758237ee96029e97f405.tar.gz
yuzu-a6fdb8f2176e2701c505758237ee96029e97f405.tar.bz2
yuzu-a6fdb8f2176e2701c505758237ee96029e97f405.tar.lz
yuzu-a6fdb8f2176e2701c505758237ee96029e97f405.tar.xz
yuzu-a6fdb8f2176e2701c505758237ee96029e97f405.tar.zst
yuzu-a6fdb8f2176e2701c505758237ee96029e97f405.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/cfg/cfg.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
index 1a2104b48..71986f7d2 100644
--- a/src/core/hle/service/cfg/cfg.cpp
+++ b/src/core/hle/service/cfg/cfg.cpp
@@ -43,13 +43,18 @@ ResultCode GetConfigInfoBlock(u32 block_id, u32 size, u32 flag, u8* output) {
SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
auto itr = std::find_if(std::begin(config->block_entries), std::end(config->block_entries),
- [&](const SaveConfigBlockEntry& entry) {
- return entry.block_id == block_id && entry.size == size && (entry.flags & flag);
- });
+ [&](const SaveConfigBlockEntry& entry) {
+ return entry.block_id == block_id && (entry.flags & flag);
+ });
if (itr == std::end(config->block_entries)) {
- LOG_ERROR(Service_CFG, "Config block %u with size %u and flags %u not found", block_id, size, flag);
- return ResultCode(-1); // TODO(Subv): Find the correct error code
+ LOG_ERROR(Service_CFG, "Config block %u with flags %u was not found", block_id, flag);
+ return ResultCode(ErrorDescription::NotFound, ErrorModule::Config, ErrorSummary::WrongArgument, ErrorLevel::Permanent);
+ }
+
+ if (itr->size != size) {
+ LOG_ERROR(Service_CFG, "Invalid size %u for config block %u with flags %u", size, block_id, flag);
+ return ResultCode(ErrorDescription::InvalidSize, ErrorModule::Config, ErrorSummary::WrongArgument, ErrorLevel::Permanent);
}
// The data is located in the block header itself if the size is less than 4 bytes