chore: apply breaking changes from patcher

This commit is contained in:
oSumAtrIX 2022-04-10 01:34:50 +02:00
parent 1b6757ff40
commit b1372c0e9f
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
1 changed files with 7 additions and 4 deletions

View File

@ -3,27 +3,30 @@ package app.revanced.cli
import app.revanced.cli.utils.SignatureParser
import app.revanced.patcher.Patcher
import app.revanced.patches.Index.patches
import org.jf.dexlib2.writer.io.MemoryDataStore
import java.io.File
import java.nio.file.Files
fun main(args: Array<String>) {
val patcher = Patcher(
File(args[0]), // in.apk
File(args[1]), // out path
SignatureParser.parse(args[2]).toTypedArray() // signatures.json
)
// add integrations dex container
patcher.addFiles(File(args[3]))
// load all patches
for (patch in patches) {
patcher.addPatches(patch())
}
patcher.applyPatches().forEach{ (name, result) ->
patcher.applyPatches().forEach { (name, result) ->
println("$name: $result")
}
// save patched apk
patcher.save()
val dexFiles: Map<String, MemoryDataStore> = patcher.save()
dexFiles.forEach { (t, p) ->
Files.write(File(args[1], t).toPath(), p.buffer)
}
}