mirror of
https://github.com/ReVanced/revanced-patcher.git
synced 2024-11-10 09:08:04 +01:00
fix: Patcher not writing resolved methods
This commit is contained in:
parent
6767c8fbc1
commit
d15240d033
2 changed files with 11 additions and 3 deletions
|
@ -39,10 +39,13 @@ class Patcher(
|
||||||
val newDexFile = object : DexFile {
|
val newDexFile = object : DexFile {
|
||||||
override fun getClasses(): Set<ClassDef> {
|
override fun getClasses(): Set<ClassDef> {
|
||||||
// this is a slow workaround for now
|
// this is a slow workaround for now
|
||||||
|
cache.methodMap.values.forEach {
|
||||||
|
if (!it.definingClassProxy.proxyUsed) return@forEach
|
||||||
|
cache.classes.replace(it.definingClassProxy.originalIndex, it.definingClassProxy.mutatedClass)
|
||||||
|
}
|
||||||
cache.classProxy
|
cache.classProxy
|
||||||
.filter { it.proxyUsed }.forEach { proxy ->
|
.filter { it.proxyUsed }.forEach { proxy ->
|
||||||
cache.classes.remove(cache.classes.elementAt(proxy.originalIndex))
|
cache.classes.replace(proxy.originalIndex, proxy.mutatedClass)
|
||||||
cache.classes.add(proxy.mutatedClass)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cache.classes
|
return cache.classes
|
||||||
|
@ -87,3 +90,8 @@ class Patcher(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun MutableSet<ClassDef>.replace(originalIndex: Int, mutatedClass: ClassDef) {
|
||||||
|
this.remove(this.elementAt(originalIndex))
|
||||||
|
this.add(mutatedClass)
|
||||||
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.jf.dexlib2.iface.ClassDef
|
||||||
|
|
||||||
class Cache(
|
class Cache(
|
||||||
internal val classes: MutableSet<ClassDef>,
|
internal val classes: MutableSet<ClassDef>,
|
||||||
val resolvedMethods: MethodMap
|
val methodMap: MethodMap
|
||||||
) {
|
) {
|
||||||
// TODO: currently we create ClassProxies at multiple places, which is why we could have merge conflicts
|
// TODO: currently we create ClassProxies at multiple places, which is why we could have merge conflicts
|
||||||
// this can be solved by creating a dedicated method for creating class proxies,
|
// this can be solved by creating a dedicated method for creating class proxies,
|
||||||
|
|
Loading…
Reference in a new issue