Move Js5Archive and Js5ConfigGroup to cache-550

Signed-off-by: Graham <gpe@openrs2.org>
bzip2
Graham 4 years ago
parent 849b083400
commit 2c43930db2
  1. 2
      archive/build.gradle.kts
  2. 2
      cache-550/src/main/kotlin/org/openrs2/cache/Js5Archive.kt
  3. 0
      cache-550/src/main/kotlin/org/openrs2/cache/Js5ConfigGroup.kt
  4. 6
      cache/src/main/kotlin/org/openrs2/cache/Cache.kt
  5. 2
      cache/src/main/kotlin/org/openrs2/cache/CacheArchive.kt
  6. 4
      cache/src/main/kotlin/org/openrs2/cache/Js5MasterIndex.kt
  7. 5
      cache/src/main/kotlin/org/openrs2/cache/Store.kt
  8. 2
      game/build.gradle.kts

@ -12,7 +12,7 @@ dependencies {
api(libs.clikt)
implementation(projects.buffer)
implementation(projects.cache)
implementation(projects.cache550)
implementation(projects.cli)
implementation(projects.db)
implementation(projects.http)

@ -30,5 +30,5 @@ public object Js5Archive {
public const val MATERIALS: Int = 26
public const val CONFIG_PARTICLE: Int = 27
public const val DEFAULTS: Int = 28
public const val ARCHIVESET: Int = 255
public const val ARCHIVESET: Int = Store.ARCHIVESET
}

@ -23,8 +23,8 @@ public class Cache private constructor(
private val unpackedCache = UnpackedCache(unpackedCacheSize)
private fun init() {
for (archive in store.list(Js5Archive.ARCHIVESET)) {
val index = store.read(Js5Archive.ARCHIVESET, archive).use { compressed ->
for (archive in store.list(Store.ARCHIVESET)) {
val index = store.read(Store.ARCHIVESET, archive).use { compressed ->
Js5Compression.uncompress(compressed).use { buf ->
Js5Index.read(buf)
}
@ -178,7 +178,7 @@ public class Cache private constructor(
unpackedCache.remove(archive)
store.remove(archive)
store.remove(Js5Archive.ARCHIVESET, archive)
store.remove(Store.ARCHIVESET, archive)
}
public fun remove(archive: Int, group: Int) {

@ -26,7 +26,7 @@ public class CacheArchive internal constructor(
}
override fun writePackedIndex(buf: ByteBuf) {
store.write(Js5Archive.ARCHIVESET, archive, buf)
store.write(Store.ARCHIVESET, archive, buf)
}
override fun removePacked(group: Int) {

@ -121,9 +121,9 @@ public data class Js5MasterIndex(
val masterIndex = Js5MasterIndex(MasterIndexFormat.ORIGINAL)
var nextArchive = 0
for (archive in store.list(Js5Archive.ARCHIVESET)) {
for (archive in store.list(Store.ARCHIVESET)) {
val entry = try {
store.read(Js5Archive.ARCHIVESET, archive).use { buf ->
store.read(Store.ARCHIVESET, archive).use { buf ->
val checksum = buf.crc32()
val digest = buf.whirlpool()

@ -122,6 +122,11 @@ public interface Store : Flushable, Closeable {
*/
public const val MAX_GROUP_SIZE: Int = (1 shl 24) - 1
/**
* The ID of the ARCHIVESET archive.
*/
public const val ARCHIVESET: Int = 255
/**
* Opens a [Store], automatically detecting the type based on the
* presence or absence of the `main_file_cache.dat2` file.

@ -12,7 +12,7 @@ dependencies {
api(libs.clikt)
implementation(projects.buffer)
implementation(projects.cache)
implementation(projects.cache550)
implementation(projects.conf)
implementation(projects.inject)
implementation(projects.net)

Loading…
Cancel
Save