mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-24 02:29:20 +01:00
Add rle record support
This commit is contained in:
parent
d8284dfacc
commit
1c62bc06cf
@ -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 New Issue
Block a user