From 5e770a0f2c4a64d809cdbc85ceecf4e8622659ad Mon Sep 17 00:00:00 2001 From: Stedoss <29103029+Stedoss@users.noreply.github.com> Date: Sun, 23 Feb 2025 20:40:36 +0000 Subject: [PATCH] Add boolean to optionally decompress with version header Mostly will be used for testing --- .../src/main/kotlin/com/nisemoe/nise/replays/Wtc.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nise-backend/src/main/kotlin/com/nisemoe/nise/replays/Wtc.kt b/nise-backend/src/main/kotlin/com/nisemoe/nise/replays/Wtc.kt index fde0f29..5247d60 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/nise/replays/Wtc.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/nise/replays/Wtc.kt @@ -44,7 +44,7 @@ fun wtcCompress(stream: String): ByteArray { return byteStream.toByteArray() } -fun wtcDecompress(data: ByteArray): String { +fun wtcDecompress(data: ByteArray, hasVersionHeader: Boolean = true): String { val buffer = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN) fun unpackBytes(): ByteArray { @@ -56,7 +56,10 @@ fun wtcDecompress(data: ByteArray): String { return bytes } - buffer.getShort() // Version - may be used in the future + if (hasVersionHeader) { + buffer.getShort() // Version - may be used in the future + } + val xs = unpackBytes() val ys = unpackBytes() val zs = unpackBytes()