You've already forked revanced-patcher
mirror of
https://github.com/revanced/revanced-patcher
synced 2025-09-13 18:30:49 +02:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c828fa2a27 | ||
![]() |
92ac5e4dc2 | ||
![]() |
070c09cf71 | ||
![]() |
b738dcd7ea | ||
![]() |
8efcf329bb | ||
![]() |
0e87ef56c4 | ||
![]() |
e3bf367ad6 |
22
CHANGELOG.md
22
CHANGELOG.md
@@ -1,3 +1,25 @@
|
||||
# [1.11.0](https://github.com/revanced/revanced-patcher/compare/v1.10.2...v1.11.0) (2022-06-24)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add replace and remove extensions ([#50](https://github.com/revanced/revanced-patcher/issues/50)) ([92ac5e4](https://github.com/revanced/revanced-patcher/commit/92ac5e4dc25f612856e2b5e528cf5fd48a5f20af))
|
||||
|
||||
## [1.10.2](https://github.com/revanced/revanced-patcher/compare/v1.10.1...v1.10.2) (2022-06-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* dexlib must be propagated ([b738dcd](https://github.com/revanced/revanced-patcher/commit/b738dcd7ea04f5fe56e66af46fb11541fe54f6af))
|
||||
|
||||
## [1.10.1](https://github.com/revanced/revanced-patcher/compare/v1.10.0...v1.10.1) (2022-06-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* callback only when inteded ([e3bf367](https://github.com/revanced/revanced-patcher/commit/e3bf367ad6615b30b06027d65f906b2588567a7f))
|
||||
* mutability of local variable `modified` ([0e87ef5](https://github.com/revanced/revanced-patcher/commit/0e87ef56c418d5c37d58abb9b27f85e25fd44f81))
|
||||
|
||||
# [1.10.0](https://github.com/revanced/revanced-patcher/compare/v1.9.0...v1.10.0) (2022-06-23)
|
||||
|
||||
|
||||
|
@@ -21,8 +21,9 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api("app.revanced:multidexlib2:2.5.2.r2")
|
||||
|
||||
implementation("xpp3:xpp3:1.1.4c")
|
||||
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||
implementation("org.smali:smali:2.5.2")
|
||||
implementation("org.apktool:apktool-lib:2.6.5-SNAPSHOT")
|
||||
|
||||
|
@@ -1,2 +1,2 @@
|
||||
kotlin.code.style = official
|
||||
version = 1.10.0
|
||||
version = 1.11.0
|
||||
|
@@ -128,8 +128,7 @@ class Patcher(private val options: PatcherOptions) {
|
||||
callback: (File) -> Unit
|
||||
) {
|
||||
for (file in files) {
|
||||
callback(file)
|
||||
|
||||
var modified = false
|
||||
for (classDef in MultiDexIO.readDexFile(true, file, NAMER, null, null).classes) {
|
||||
val type = classDef.type
|
||||
|
||||
@@ -139,7 +138,7 @@ class Patcher(private val options: PatcherOptions) {
|
||||
|
||||
logger.trace("Merging $type")
|
||||
data.bytecodeData.classes.internalClasses.add(classDef)
|
||||
|
||||
modified = true
|
||||
|
||||
continue
|
||||
}
|
||||
@@ -150,8 +149,9 @@ class Patcher(private val options: PatcherOptions) {
|
||||
|
||||
val index = existingClass.second
|
||||
data.bytecodeData.classes.internalClasses[index] = classDef
|
||||
|
||||
modified = true
|
||||
}
|
||||
if (modified) callback(file)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,4 +324,4 @@ private fun BuildOptions.setBuildOptions(options: PatcherOptions) {
|
||||
this.aaptPath = options.aaptPath
|
||||
this.useAapt2 = true
|
||||
this.frameworkFolderLocation = options.frameworkFolderLocation
|
||||
}
|
||||
}
|
||||
|
@@ -23,6 +23,18 @@ fun MutableMethodImplementation.addInstructions(index: Int, instructions: List<B
|
||||
}
|
||||
}
|
||||
|
||||
fun MutableMethodImplementation.replaceInstructions(index: Int, instructions: List<BuilderInstruction>) {
|
||||
for (i in instructions.lastIndex downTo 0) {
|
||||
this.replaceInstruction(index + i, instructions[i])
|
||||
}
|
||||
}
|
||||
|
||||
fun MutableMethodImplementation.removeInstructions(index: Int, count: Int) {
|
||||
for (i in count downTo 0) {
|
||||
this.removeInstruction(index + i)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare a method to another, considering constructors and parameters.
|
||||
* @param otherMethod The method to compare against.
|
||||
@@ -66,13 +78,28 @@ internal fun Method.clone(
|
||||
}
|
||||
|
||||
/**
|
||||
* Add smali instructions to the method.
|
||||
* @param index The index to insert the instructions at.
|
||||
* Add a smali instruction to the method.
|
||||
* @param index The index to insert the instruction at.
|
||||
* @param instruction The smali instruction to add.
|
||||
*/
|
||||
fun MutableMethod.addInstruction(index: Int, instruction: String) =
|
||||
this.implementation!!.addInstruction(index, instruction.toInstruction(this))
|
||||
|
||||
/**
|
||||
* Replace a smali instruction within the method.
|
||||
* @param index The index to replace the instruction at.
|
||||
* @param instruction The smali instruction to place.
|
||||
*/
|
||||
fun MutableMethod.replaceInstruction(index: Int, instruction: String) =
|
||||
this.implementation!!.replaceInstruction(index, instruction.toInstruction(this))
|
||||
|
||||
/**
|
||||
* Remove a smali instruction within the method.
|
||||
* @param index The index to delete the instruction at.
|
||||
*/
|
||||
fun MutableMethod.removeInstruction(index: Int) =
|
||||
this.implementation!!.removeInstruction(index)
|
||||
|
||||
/**
|
||||
* Add smali instructions to the method.
|
||||
* @param index The index to insert the instructions at.
|
||||
@@ -81,6 +108,22 @@ fun MutableMethod.addInstruction(index: Int, instruction: String) =
|
||||
fun MutableMethod.addInstructions(index: Int, instructions: String) =
|
||||
this.implementation!!.addInstructions(index, instructions.toInstructions(this))
|
||||
|
||||
/**
|
||||
* Replace smali instructions within the method.
|
||||
* @param index The index to replace the instructions at.
|
||||
* @param instructions The smali instructions to place.
|
||||
*/
|
||||
fun MutableMethod.replaceInstructions(index: Int, instructions: String) =
|
||||
this.implementation!!.replaceInstructions(index, instructions.toInstructions(this))
|
||||
|
||||
/**
|
||||
* Remove smali instructions from the method.
|
||||
* @param index The index to remove the instructions at.
|
||||
* @param count The amount of instructions to remove.
|
||||
*/
|
||||
fun MutableMethod.removeInstructions(index: Int, count: Int) =
|
||||
this.implementation!!.removeInstructions(index, count)
|
||||
|
||||
/**
|
||||
* Clones the method.
|
||||
* @param registerCount This parameter allows you to change the register count of the method.
|
||||
@@ -108,4 +151,4 @@ internal fun parametersEqual(
|
||||
internal val nullOutputStream: OutputStream =
|
||||
object : OutputStream() {
|
||||
override fun write(b: Int) {}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user