Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
chore: apply breaking changes from patcher
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Apr 9, 2022
1 parent 1b6757f commit b1372c0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/kotlin/app/revanced/cli/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit b1372c0

Please sign in to comment.