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
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e94a706949 | ||
![]() |
89bb43066b | ||
![]() |
68174bbd6b | ||
![]() |
d05c9416d6 | ||
![]() |
5a2f02b97d | ||
![]() |
a3005fa08e | ||
![]() |
6628b7870f | ||
![]() |
a6411245aa | ||
![]() |
365e1d7a45 | ||
![]() |
4507cd2353 | ||
![]() |
1f75777cf9 | ||
![]() |
28d5468b07 | ||
![]() |
746496125d | ||
![]() |
835a421cc0 |
40
CHANGELOG.md
40
CHANGELOG.md
@@ -1,3 +1,43 @@
|
|||||||
|
# [1.4.0](https://github.com/revanced/revanced-patcher/compare/v1.3.4...v1.4.0) (2022-06-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* return a `File` instance instead of `ExtFile` ([68174bb](https://github.com/revanced/revanced-patcher/commit/68174bbd6b4df47a91b610c2b97dbae55b594163))
|
||||||
|
|
||||||
|
## [1.3.4](https://github.com/revanced/revanced-patcher/compare/v1.3.3...v1.3.4) (2022-06-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* `String.toInstructions` defaulting `forStaticMethod` to `false` ([5a2f02b](https://github.com/revanced/revanced-patcher/commit/5a2f02b97dcde95dbe901fa68cca6c6c0219cb82)), closes [revanced/revanced-patches#46](https://github.com/revanced/revanced-patches/issues/46)
|
||||||
|
|
||||||
|
## [1.3.3](https://github.com/revanced/revanced-patcher/compare/v1.3.2...v1.3.3) (2022-06-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add docs (trigger release) ([6628b78](https://github.com/revanced/revanced-patcher/commit/6628b7870fc052da40be0d50a7e2b0b6c57743cc))
|
||||||
|
|
||||||
|
|
||||||
|
### Reverts
|
||||||
|
|
||||||
|
* propagate dependencies ([365e1d7](https://github.com/revanced/revanced-patcher/commit/365e1d7a4507b918a4c8170ce2c88f6c8ff1d474))
|
||||||
|
|
||||||
|
## [1.3.2](https://github.com/revanced/revanced-patcher/compare/v1.3.1...v1.3.2) (2022-06-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* return resourceFile to caller ([1f75777](https://github.com/revanced/revanced-patcher/commit/1f75777cf985bf08483033ec541937d3e733347b))
|
||||||
|
|
||||||
|
## [1.3.1](https://github.com/revanced/revanced-patcher/compare/v1.3.0...v1.3.1) (2022-06-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* `InlineSmaliCompiler.compile` using 0 registers instead of 1 by default ([835a421](https://github.com/revanced/revanced-patcher/commit/835a421cc0588b92c2995e9d74727069d14b1750))
|
||||||
|
|
||||||
# [1.3.0](https://github.com/revanced/revanced-patcher/compare/v1.2.9...v1.3.0) (2022-06-20)
|
# [1.3.0](https://github.com/revanced/revanced-patcher/compare/v1.2.9...v1.3.0) (2022-06-20)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -21,13 +21,10 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib"))
|
implementation("xpp3:xpp3:1.1.4c")
|
||||||
implementation(kotlin("reflect"))
|
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||||
|
implementation("org.smali:smali:2.5.2")
|
||||||
api("xpp3:xpp3:1.1.4c")
|
implementation("org.apktool:apktool-lib:2.6.5-SNAPSHOT")
|
||||||
api("org.apktool:apktool-lib:2.6.5-SNAPSHOT")
|
|
||||||
api("app.revanced:multidexlib2:2.5.2.r2")
|
|
||||||
api("org.smali:smali:2.5.2")
|
|
||||||
|
|
||||||
testImplementation(kotlin("test"))
|
testImplementation(kotlin("test"))
|
||||||
}
|
}
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 1.3.0
|
version = 1.4.0
|
||||||
|
@@ -137,6 +137,7 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
fun save(): PatcherResult {
|
fun save(): PatcherResult {
|
||||||
val packageMetadata = data.packageMetadata
|
val packageMetadata = data.packageMetadata
|
||||||
val metaInfo = packageMetadata.metaInfo
|
val metaInfo = packageMetadata.metaInfo
|
||||||
|
var resourceFile: File? = null
|
||||||
|
|
||||||
if (options.patchResources) {
|
if (options.patchResources) {
|
||||||
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
|
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
|
||||||
@@ -177,9 +178,7 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
null, includedFiles
|
null, includedFiles
|
||||||
)
|
)
|
||||||
|
|
||||||
// write packaged resources to cache directory
|
resourceFile = aaptFile
|
||||||
ExtFile(aaptFile).directory.copyToDir(cacheDirectory.resolve("build/"))
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val newDexFile = object : DexFile {
|
val newDexFile = object : DexFile {
|
||||||
@@ -204,7 +203,8 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
dexFiles.map {
|
dexFiles.map {
|
||||||
app.revanced.patcher.util.dex.DexFile(it.key, it.value)
|
app.revanced.patcher.util.dex.DexFile(it.key, it.value)
|
||||||
},
|
},
|
||||||
metaInfo.doNotCompress.toList()
|
metaInfo.doNotCompress.toList(),
|
||||||
|
resourceFile
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,13 +1,17 @@
|
|||||||
package app.revanced.patcher
|
package app.revanced.patcher
|
||||||
|
|
||||||
import app.revanced.patcher.util.dex.DexFile
|
import app.revanced.patcher.util.dex.DexFile
|
||||||
|
import brut.directory.ExtFile
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The result of a patcher.
|
* The result of a patcher.
|
||||||
* @param dexFiles The patched dex files.
|
* @param dexFiles The patched dex files.
|
||||||
* @param doNotCompress List of relative paths to files to exclude from compressing.
|
* @param doNotCompress List of relative paths to files to exclude from compressing.
|
||||||
|
* @param resourceFile File containing resources that need to be extracted into the APK.
|
||||||
*/
|
*/
|
||||||
data class PatcherResult(
|
data class PatcherResult(
|
||||||
val dexFiles: List<DexFile>,
|
val dexFiles: List<DexFile>,
|
||||||
val doNotCompress: List<String>? = null
|
val doNotCompress: List<String>? = null,
|
||||||
|
val resourceFile: File?
|
||||||
)
|
)
|
@@ -14,8 +14,6 @@ import org.jf.smali.smaliParser
|
|||||||
import org.jf.smali.smaliTreeWalker
|
import org.jf.smali.smaliTreeWalker
|
||||||
import java.io.InputStreamReader
|
import java.io.InputStreamReader
|
||||||
|
|
||||||
class InlineSmaliCompiler {
|
|
||||||
companion object {
|
|
||||||
private const val METHOD_TEMPLATE = """
|
private const val METHOD_TEMPLATE = """
|
||||||
.class LInlineCompiler;
|
.class LInlineCompiler;
|
||||||
.super Ljava/lang/Object;
|
.super Ljava/lang/Object;
|
||||||
@@ -25,6 +23,8 @@ class InlineSmaliCompiler {
|
|||||||
.end method
|
.end method
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
class InlineSmaliCompiler {
|
||||||
|
companion object {
|
||||||
/**
|
/**
|
||||||
* Compiles a string of Smali code to a list of instructions.
|
* Compiles a string of Smali code to a list of instructions.
|
||||||
* p0, p1 etc. will only work correctly if the parameters and registers are passed.
|
* p0, p1 etc. will only work correctly if the parameters and registers are passed.
|
||||||
@@ -34,7 +34,7 @@ class InlineSmaliCompiler {
|
|||||||
* be messed up and results in broken Dalvik bytecode.
|
* be messed up and results in broken Dalvik bytecode.
|
||||||
* FIXME: Fix the above issue. When this is fixed, add the proper conversions in [InstructionConverter].
|
* FIXME: Fix the above issue. When this is fixed, add the proper conversions in [InstructionConverter].
|
||||||
*/
|
*/
|
||||||
fun compileMethodInstructions(
|
fun compile(
|
||||||
instructions: String, parameters: String, registers: Int, forStaticMethod: Boolean
|
instructions: String, parameters: String, registers: Int, forStaticMethod: Boolean
|
||||||
): List<BuilderInstruction> {
|
): List<BuilderInstruction> {
|
||||||
val input =
|
val input =
|
||||||
@@ -64,10 +64,11 @@ class InlineSmaliCompiler {
|
|||||||
* @param templateMethod The method to compile the instructions against.
|
* @param templateMethod The method to compile the instructions against.
|
||||||
* @returns A list of instructions.
|
* @returns A list of instructions.
|
||||||
*/
|
*/
|
||||||
fun String.toInstructions(templateMethod: Method? = null) = InlineSmaliCompiler.compileMethodInstructions(this,
|
fun String.toInstructions(templateMethod: Method? = null) = InlineSmaliCompiler.compile(this,
|
||||||
templateMethod?.parameters?.joinToString("") { it } ?: "",
|
templateMethod?.parameters?.joinToString("") { it } ?: "",
|
||||||
templateMethod?.implementation?.registerCount ?: 0,
|
templateMethod?.implementation?.registerCount ?: 1,
|
||||||
(templateMethod?.accessFlags ?: 0) and AccessFlags.STATIC.value != 0)
|
templateMethod?.let { AccessFlags.STATIC.isSet(it.accessFlags) } ?: true
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compile a line of Smali code to an instruction.
|
* Compile a line of Smali code to an instruction.
|
||||||
|
Reference in New Issue
Block a user