Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ A cache library written in Kotlin.
# Implementation
Just use cache if you do not require any of the revision specific loaders.
```
cache = { module = "com.runetopic.cache:cache", version.ref "1.4.18-SNAPSHOT" }
cache = { module = "com.runetopic.cache:cache", version.ref "1.4.19-SNAPSHOT" }
loader = { module = "com.runetopic.cache:loader", version.ref "647.6.4-SNAPSHOT" }
```

Expand Down
2 changes: 1 addition & 1 deletion cache/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
signing
}

version = "1.4.18-SNAPSHOT"
version = "1.4.19-SNAPSHOT"

java {
withJavadocJar()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,23 @@ internal fun decode(

val groups = hashMapOf<Int, Group>()
(0 until count).forEach {
val groupReferenceTableData = datFile.readReferenceTable(idxFile.id(), idxFile.loadReferenceTable(it))
val groupId = groupIds[it]

val groupReferenceTableData = datFile.readReferenceTable(idxFile.id(), idxFile.loadReferenceTable(groupId))
val data = if (groupReferenceTableData.isEmpty()) byteArrayOf() else try {
groupReferenceTableData.decompress()
} catch (exception: ZipException) {
groupReferenceTableData
}

val groupId = groupIds[it]
groups[it] = (Group(
groups[groupId] = (Group(
groupId,
groupNameHashes[groupId],
groupCrcs[groupId],
groupWhirlpools[groupId],
groupRevisions[groupId],
intArrayOf(),//TODO
decodeFiles(fileIds, fileNameHashes, data, groupFileIds[it], it),
decodeFiles(fileIds, fileNameHashes, data, groupFileIds[groupId], groupId),
data
))
}
Expand Down Expand Up @@ -206,7 +207,7 @@ internal fun decodeFiles(
groupId: Int
): Map<Int, File> {
if (data.isEmpty()) return hashMapOf(Pair(0, File.DEFAULT))
if (count == 1) return hashMapOf(Pair(0, File(fileIds[groupId][0], fileNameHashes[groupId][0], data)))
if (count <= 1) return hashMapOf(Pair(0, File(fileIds[groupId][0], fileNameHashes[groupId][0], data)))

var position = data.size
val chunks = data[--position].toInt() and 0xFF
Expand Down