mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-28 18:12:44 -06:00
Add rle record support
This commit is contained in:
parent
d8284dfacc
commit
1c62bc06cf
1 changed files with 12 additions and 0 deletions
|
@ -553,6 +553,18 @@ void NCCHContainer::ApplyIPS(std::vector<u8>& ips, std::vector<u8>& buffer) {
|
||||||
u32 offset = ips[cursor] << 16 | ips[cursor + 1] << 8 | ips[cursor + 2];
|
u32 offset = ips[cursor] << 16 | ips[cursor + 1] << 8 | ips[cursor + 2];
|
||||||
std::size_t length = ips[cursor + 3] << 8 | ips[cursor + 4];
|
std::size_t length = ips[cursor + 3] << 8 | ips[cursor + 4];
|
||||||
|
|
||||||
|
// check for an rle record
|
||||||
|
if (length == 0) {
|
||||||
|
length = ips[cursor + 5] << 8 | ips[cursor + 6];
|
||||||
|
|
||||||
|
for (u32 i = 0; i < length; ++i)
|
||||||
|
buffer[offset + i] = ips[cursor + 7];
|
||||||
|
|
||||||
|
cursor += 8;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
std::memcpy(&buffer[offset], &ips[cursor + 5], length);
|
std::memcpy(&buffer[offset], &ips[cursor + 5], length);
|
||||||
cursor += length + 5;
|
cursor += length + 5;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue