mirror of
https://github.com/PabloMK7/citra
synced 2024-11-15 05:08:23 +00:00
Artic Base: Fix issue when 0 bytes are read from file (#199)
This commit is contained in:
parent
959a66d839
commit
518f7234f7
2 changed files with 10 additions and 8 deletions
|
@ -405,11 +405,12 @@ ResultVal<std::size_t> ArticFileBackend::Read(u64 offset, std::size_t length, u8
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
auto read_buff = resp->GetResponseBuffer(0);
|
auto read_buff = resp->GetResponseBuffer(0);
|
||||||
if (!read_buff.has_value())
|
size_t actually_read = 0;
|
||||||
return Result(-1);
|
if (read_buff.has_value()) {
|
||||||
size_t actually_read = read_buff->second;
|
actually_read = read_buff->second;
|
||||||
|
memcpy(buffer + read_amount, read_buff->first, actually_read);
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(buffer + read_amount, read_buff->first, actually_read);
|
|
||||||
read_amount += actually_read;
|
read_amount += actually_read;
|
||||||
if (actually_read != to_read)
|
if (actually_read != to_read)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -200,11 +200,12 @@ ResultVal<size_t> ArticCache::ReadFromArtic(s32 file_handle, u8* buffer, size_t
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
auto read_buff = resp->GetResponseBuffer(0);
|
auto read_buff = resp->GetResponseBuffer(0);
|
||||||
if (!read_buff.has_value())
|
size_t actually_read = 0;
|
||||||
return Result(-1);
|
if (read_buff.has_value()) {
|
||||||
size_t actually_read = read_buff->second;
|
actually_read = read_buff->second;
|
||||||
|
memcpy(buffer + read_amount, read_buff->first, actually_read);
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(buffer + read_amount, read_buff->first, actually_read);
|
|
||||||
read_amount += actually_read;
|
read_amount += actually_read;
|
||||||
if (actually_read != to_read)
|
if (actually_read != to_read)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue