mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
Fix error message for bad config block request.
This commit is contained in:
parent
c7d1480ece
commit
a6fdb8f217
|
@ -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());
|
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),
|
auto itr = std::find_if(std::begin(config->block_entries), std::end(config->block_entries),
|
||||||
[&](const SaveConfigBlockEntry& entry) {
|
[&](const SaveConfigBlockEntry& entry) {
|
||||||
return entry.block_id == block_id && entry.size == size && (entry.flags & flag);
|
return entry.block_id == block_id && (entry.flags & flag);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (itr == std::end(config->block_entries)) {
|
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);
|
LOG_ERROR(Service_CFG, "Config block %u with flags %u was not found", block_id, flag);
|
||||||
return ResultCode(-1); // TODO(Subv): Find the correct error code
|
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
|
// The data is located in the block header itself if the size is less than 4 bytes
|
||||||
|
|
Loading…
Reference in a new issue