fix: replaceWith not replacing classes with used class proxies

Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
oSumAtrIX 2022-04-14 11:00:25 +02:00
parent 338bd9f739
commit 4178a1eedc
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4

View file

@ -70,12 +70,13 @@ class Patcher(
fun save(): Map<String, MemoryDataStore> { fun save(): Map<String, MemoryDataStore> {
val newDexFile = object : DexFile { val newDexFile = object : DexFile {
private fun MutableList<ClassDef>.replaceWith(proxy: ClassProxy) { private fun MutableList<ClassDef>.replaceWith(proxy: ClassProxy) {
if (proxy.proxyUsed) return
this[proxy.originalIndex] = proxy.mutatedClass this[proxy.originalIndex] = proxy.mutatedClass
} }
override fun getClasses(): Set<ClassDef> { override fun getClasses(): Set<ClassDef> {
for (proxy in patcherData.classProxies) { for (proxy in patcherData.classProxies) {
if (!proxy.proxyUsed) continue
patcherData.classes.replaceWith(proxy) patcherData.classes.replaceWith(proxy)
} }
for (patch in patcherData.patches) { for (patch in patcherData.patches) {