mirror of
https://github.com/revanced/revanced-cli.git
synced 2024-12-11 20:57:49 +01:00
chore: apply breaking changes from patcher
This commit is contained in:
parent
1b6757ff40
commit
b1372c0e9f
@ -3,27 +3,30 @@ package app.revanced.cli
|
|||||||
import app.revanced.cli.utils.SignatureParser
|
import app.revanced.cli.utils.SignatureParser
|
||||||
import app.revanced.patcher.Patcher
|
import app.revanced.patcher.Patcher
|
||||||
import app.revanced.patches.Index.patches
|
import app.revanced.patches.Index.patches
|
||||||
|
import org.jf.dexlib2.writer.io.MemoryDataStore
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.nio.file.Files
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val patcher = Patcher(
|
val patcher = Patcher(
|
||||||
File(args[0]), // in.apk
|
File(args[0]), // in.apk
|
||||||
File(args[1]), // out path
|
|
||||||
SignatureParser.parse(args[2]).toTypedArray() // signatures.json
|
SignatureParser.parse(args[2]).toTypedArray() // signatures.json
|
||||||
)
|
)
|
||||||
|
|
||||||
// add integrations dex container
|
// add integrations dex container
|
||||||
patcher.addFiles(File(args[3]))
|
patcher.addFiles(File(args[3]))
|
||||||
|
|
||||||
// load all patches
|
|
||||||
for (patch in patches) {
|
for (patch in patches) {
|
||||||
patcher.addPatches(patch())
|
patcher.addPatches(patch())
|
||||||
}
|
}
|
||||||
|
|
||||||
patcher.applyPatches().forEach{ (name, result) ->
|
patcher.applyPatches().forEach { (name, result) ->
|
||||||
println("$name: $result")
|
println("$name: $result")
|
||||||
}
|
}
|
||||||
|
|
||||||
// save patched apk
|
// 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)
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user