Add support for JOGL artifact links in early HD era loaders

Signed-off-by: Graham <gpe@openrs2.org>
Graham 1 year ago
parent 7925be5301
commit 0cd8be87ca
  1. 17
      archive/src/main/kotlin/org/openrs2/archive/client/ClientImporter.kt

@ -883,7 +883,7 @@ public class ClientImporter @Inject constructor(
val hash = hashes.remove(target) ?: continue val hash = hashes.remove(target) ?: continue
if (!paths.remove(path)) { if (!paths.remove(path)) {
continue logger.warn { "Adding link for unused file $path" }
} }
links += parseLink(path, hash) links += parseLink(path, hash)
@ -911,6 +911,8 @@ public class ClientImporter @Inject constructor(
// TODO(gpe): funorb loaders // TODO(gpe): funorb loaders
"runescape", "client" -> ArtifactType.CLIENT "runescape", "client" -> ArtifactType.CLIENT
"unpackclass" -> ArtifactType.UNPACKCLASS "unpackclass" -> ArtifactType.UNPACKCLASS
"jogl", "jogltrimmed" -> ArtifactType.JOGL
"jogl_awt" -> ArtifactType.JOGL_AWT
else -> throw IllegalArgumentException() else -> throw IllegalArgumentException()
} }
@ -918,17 +920,22 @@ public class ClientImporter @Inject constructor(
"pack200" -> ArtifactFormat.PACK200 "pack200" -> ArtifactFormat.PACK200
"js5" -> ArtifactFormat.PACKCLASS "js5" -> ArtifactFormat.PACKCLASS
"jar", "pack" -> ArtifactFormat.JAR "jar", "pack" -> ArtifactFormat.JAR
"dll" -> ArtifactFormat.NATIVE
else -> throw IllegalArgumentException() else -> throw IllegalArgumentException()
} }
val os = if (format == ArtifactFormat.NATIVE) OperatingSystem.WINDOWS else OperatingSystem.INDEPENDENT
val arch = if (format == ArtifactFormat.NATIVE) Architecture.X86 else Architecture.INDEPENDENT
val jvm = if (format == ArtifactFormat.NATIVE) Jvm.SUN else Jvm.INDEPENDENT
val crc = crc1.toIntOrNull() ?: crc2.toIntOrNull() ?: throw IllegalArgumentException() val crc = crc1.toIntOrNull() ?: crc2.toIntOrNull() ?: throw IllegalArgumentException()
return ArtifactLink( return ArtifactLink(
type, type,
format, format,
OperatingSystem.INDEPENDENT, os,
Architecture.INDEPENDENT, arch,
Jvm.INDEPENDENT, jvm,
crc, crc,
sha1, sha1,
null null
@ -982,7 +989,7 @@ public class ClientImporter @Inject constructor(
private val SHA1_MATCHER = private val SHA1_MATCHER =
InsnMatcher.compile("BIPUSH NEWARRAY (DUP (ICONST | BIPUSH) (ICONST | BIPUSH | SIPUSH) IASTORE)+") InsnMatcher.compile("BIPUSH NEWARRAY (DUP (ICONST | BIPUSH) (ICONST | BIPUSH | SIPUSH) IASTORE)+")
private val FILE_NAME_REGEX = Regex("([a-z]+)(?:_(-?[0-9]+))?[.]([a-z0-9]+)(?:\\?crc=(-?[0-9]+))?") private val FILE_NAME_REGEX = Regex("([a-z_]+)(?:_(-?[0-9]+))?[.]([a-z0-9]+)(?:\\?crc=(-?[0-9]+))?")
private val SHA1_CMP_MATCHER = private val SHA1_CMP_MATCHER =
InsnMatcher.compile("((ICONST | BIPUSH)? ALOAD (ICONST | BIPUSH) BALOAD (ICONST IXOR)? (ICONST | BIPUSH)? (IF_ICMPEQ | IF_ICMPNE | IFEQ | IFNE))+") InsnMatcher.compile("((ICONST | BIPUSH)? ALOAD (ICONST | BIPUSH) BALOAD (ICONST IXOR)? (ICONST | BIPUSH)? (IF_ICMPEQ | IF_ICMPNE | IFEQ | IFNE))+")
private val PATH_CMP_MATCHER = InsnMatcher.compile("(LDC ALOAD | ALOAD LDC) (IF_ACMPEQ | IF_ACMPNE)") private val PATH_CMP_MATCHER = InsnMatcher.compile("(LDC ALOAD | ALOAD LDC) (IF_ACMPEQ | IF_ACMPNE)")

Loading…
Cancel
Save