Fix version trailers in RuneLiteStore

Signed-off-by: Graham <gpe@openrs2.org>
master
Graham 3 years ago
parent 52ca09e4d0
commit 078b1f6197
  1. 19
      cache/src/main/kotlin/org/openrs2/cache/RuneLiteStore.kt

@ -100,7 +100,24 @@ public class RuneLiteStore @Inject constructor(
"contents" -> { "contents" -> {
Unpooled.wrappedBuffer(Base64.getDecoder().decode(value)).use { buf -> Unpooled.wrappedBuffer(Base64.getDecoder().decode(value)).use { buf ->
output.write(archive, group!!.id, buf) // Some groups have version trailers and some don't. Fix that up here.
if (group!!.checksum != buf.crc32()) {
if (group!!.version != VersionTrailer.strip(buf)) {
throw StoreCorruptException("Group version does not match contents")
}
if (group!!.checksum != buf.crc32()) {
throw StoreCorruptException("Group CRC does not match contents")
}
}
alloc.buffer(2, 2).use { versionBuf ->
versionBuf.writeShort(group!!.version)
Unpooled.wrappedBuffer(buf.retain(), versionBuf.retain()).use { combinedBuf ->
output.write(archive, group!!.id, combinedBuf)
}
}
} }
} }

Loading…
Cancel
Save