Add scrambledLibraries set to the deobfuscator profile

This allows us to improve the code used for detecting the client library
in the static member scrambling code.

Signed-off-by: Graham <gpe@openrs2.dev>
bzip2
Graham 4 years ago
parent 9db64efb7b
commit fa2f9cd33d
  1. 1
      deob/src/main/java/dev/openrs2/deob/Profile.kt
  2. 4
      deob/src/main/java/dev/openrs2/deob/remap/StaticFieldUnscrambler.kt
  3. 4
      deob/src/main/java/dev/openrs2/deob/remap/StaticMethodUnscrambler.kt
  4. 2
      deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt
  5. 2
      share/deob/profile.yaml

@ -8,5 +8,6 @@ class Profile(
val excludedMethods: GlobMemberFilter,
val excludedFields: GlobMemberFilter,
val entryPoints: GlobMemberFilter,
val scrambledLibraries: Set<String>,
val maxObfuscatedNameLen: Int
)

@ -16,6 +16,7 @@ import org.objectweb.asm.tree.MethodNode
class StaticFieldUnscrambler(
private val classPath: ClassPath,
private val excludedFields: MemberFilter,
private val scrambledLibraries: Set<String>,
private val nameMap: NameMap,
private val inheritedFieldSets: DisjointSet<MemberRef>,
staticClassNameGenerator: NameGenerator
@ -26,8 +27,7 @@ class StaticFieldUnscrambler(
val fields = mutableMapOf<DisjointSet.Partition<MemberRef>, StaticField>()
for (library in classPath.libraries) {
if ("client" !in library) {
// TODO(gpe): improve detection of the client library
if (library.name !in scrambledLibraries) {
continue
}

@ -10,6 +10,7 @@ import org.objectweb.asm.Opcodes
class StaticMethodUnscrambler(
private val classPath: ClassPath,
private val excludedMethods: MemberFilter,
private val scrambledLibraries: Set<String>,
private val nameMap: NameMap,
private val inheritedMethodSets: DisjointSet<MemberRef>,
staticClassNameGenerator: NameGenerator
@ -20,8 +21,7 @@ class StaticMethodUnscrambler(
val owners = mutableMapOf<DisjointSet.Partition<MemberRef>, String>()
for (library in classPath.libraries) {
if ("client" !in library) {
// TODO(gpe): improve detection of the client library
if (library.name !in scrambledLibraries) {
continue
}

@ -88,6 +88,7 @@ class TypedRemapper private constructor(
val staticFields = StaticFieldUnscrambler(
classPath,
profile.excludedFields,
profile.scrambledLibraries,
nameMap,
inheritedFieldSets,
staticClassNameGenerator
@ -95,6 +96,7 @@ class TypedRemapper private constructor(
val staticMethods = StaticMethodUnscrambler(
classPath,
profile.excludedMethods,
profile.scrambledLibraries,
nameMap,
inheritedMethodSets,
staticClassNameGenerator

@ -31,4 +31,6 @@ entry_points:
- "com/sun/opengl/impl/x11/DRIHack.end *"
- "loader.<init> *"
- "unpackclass.<init> *"
scrambled_libraries:
- client
max_obfuscated_name_len: 2

Loading…
Cancel
Save