You've already forked revanced-patcher
mirror of
https://github.com/revanced/revanced-patcher
synced 2025-09-06 16:38:50 +02:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c13361823d | ||
![]() |
8f66f9f606 |
@@ -1,3 +1,10 @@
|
||||
# [1.7.0](https://github.com/revanced/revanced-patcher/compare/v1.6.0...v1.7.0) (2022-06-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* migrate logger to `slf4j` ([8f66f9f](https://github.com/revanced/revanced-patcher/commit/8f66f9f606a785ac947b0e553822877f211d82df))
|
||||
|
||||
# [1.6.0](https://github.com/revanced/revanced-patcher/compare/v1.5.0...v1.6.0) (2022-06-22)
|
||||
|
||||
|
||||
|
@@ -25,6 +25,7 @@ dependencies {
|
||||
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||
implementation("org.smali:smali:2.5.2")
|
||||
implementation("org.apktool:apktool-lib:2.6.5-SNAPSHOT")
|
||||
implementation("org.slf4j:slf4j-api:1.7.36")
|
||||
|
||||
testImplementation(kotlin("test"))
|
||||
}
|
||||
|
@@ -1,2 +1,2 @@
|
||||
kotlin.code.style = official
|
||||
version = 1.6.0
|
||||
version = 1.7.0
|
||||
|
@@ -32,9 +32,9 @@ import org.jf.dexlib2.Opcodes
|
||||
import org.jf.dexlib2.iface.ClassDef
|
||||
import org.jf.dexlib2.iface.DexFile
|
||||
import org.jf.dexlib2.writer.io.MemoryDataStore
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
import java.util.logging.Logger
|
||||
|
||||
val NAMER = BasicDexFileNamer()
|
||||
|
||||
@@ -43,7 +43,7 @@ val NAMER = BasicDexFileNamer()
|
||||
* @param options The options for the patcher.
|
||||
*/
|
||||
class Patcher(private val options: PatcherOptions) {
|
||||
private val logger: Logger = Logger.getLogger(::Patcher.name)
|
||||
private val logger = LoggerFactory.getLogger(Patcher::class.java)
|
||||
|
||||
val data: PatcherData
|
||||
private val opcodes: Opcodes
|
||||
@@ -51,7 +51,7 @@ class Patcher(private val options: PatcherOptions) {
|
||||
init {
|
||||
val extInputFile = ExtFile(options.inputFile)
|
||||
val outDir = File(options.resourceCacheDirectory)
|
||||
if (outDir.exists()){
|
||||
if (outDir.exists()) {
|
||||
logger.info("Delete previous resource cache directory")
|
||||
|
||||
outDir.deleteRecursively()
|
||||
@@ -80,7 +80,7 @@ class Patcher(private val options: PatcherOptions) {
|
||||
}
|
||||
|
||||
} else {
|
||||
logger.warning("Resource patching is disabled. Falling back to manually decode AndroidManifest.xml")
|
||||
logger.warn("Resource patching is disabled. Falling back to manually decode AndroidManifest.xml")
|
||||
|
||||
// create decoder for the resource table
|
||||
val decoder = ResAttrDecoder()
|
||||
@@ -136,14 +136,14 @@ class Patcher(private val options: PatcherOptions) {
|
||||
}
|
||||
val (_, idx) = e
|
||||
if (allowedOverwrites.contains(type)) {
|
||||
logger.fine("Override $type")
|
||||
logger.trace("Override $type")
|
||||
data.bytecodeData.classes.internalClasses[idx] = classDef
|
||||
continue
|
||||
}
|
||||
logger.fine("Skip $type")
|
||||
logger.trace("Skip $type")
|
||||
continue
|
||||
}
|
||||
logger.finest("Add $type")
|
||||
logger.trace("Add $type")
|
||||
data.bytecodeData.classes.internalClasses.add(classDef)
|
||||
}
|
||||
}
|
||||
@@ -250,8 +250,8 @@ class Patcher(private val options: PatcherOptions) {
|
||||
val patchName = patch.patchName
|
||||
|
||||
// if the patch has already applied silently skip it
|
||||
if (appliedPatches.contains(patchName)){
|
||||
logger.fine("Skip $patchName because it already has been applied")
|
||||
if (appliedPatches.contains(patchName)) {
|
||||
logger.warn("Skip $patchName because it already has been applied")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
@@ -284,7 +284,7 @@ class Patcher(private val options: PatcherOptions) {
|
||||
data.bytecodeData
|
||||
}
|
||||
|
||||
logger.fine("Execute $patchName")
|
||||
logger.warn("Execute $patchName")
|
||||
|
||||
return try {
|
||||
patchInstance.execute(data)
|
||||
|
@@ -12,7 +12,8 @@ import org.jf.dexlib2.iface.Method
|
||||
import org.jf.dexlib2.iface.instruction.Instruction
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
|
||||
import org.jf.dexlib2.iface.reference.StringReference
|
||||
import java.util.logging.Logger
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
internal class MethodSignatureResolver(
|
||||
private val classes: List<ClassDef>,
|
||||
@@ -20,7 +21,7 @@ internal class MethodSignatureResolver(
|
||||
) {
|
||||
// These functions do not require the constructor values, so they can be static.
|
||||
companion object {
|
||||
private val LOGGER: Logger = Logger.getLogger(::MethodSignatureResolver.name)
|
||||
private val logger: Logger = LoggerFactory.getLogger(MethodSignatureResolver::class.java)
|
||||
|
||||
fun resolveFromProxy(
|
||||
classProxy: app.revanced.patcher.util.proxy.ClassProxy,
|
||||
@@ -29,7 +30,7 @@ internal class MethodSignatureResolver(
|
||||
for (method in classProxy.immutableClass.methods) {
|
||||
val result = compareSignatureToMethod(signature, method) ?: continue
|
||||
|
||||
LOGGER.fine("${signature.name} match to ${method.definingClass}->${method.name}")
|
||||
logger.trace("${signature.name} match to ${method.definingClass}->${method.name}")
|
||||
|
||||
return SignatureResolverResult(
|
||||
classProxy,
|
||||
@@ -149,12 +150,12 @@ internal class MethodSignatureResolver(
|
||||
fun resolve(patcherData: PatcherData) {
|
||||
for (signature in methodSignatures) {
|
||||
val signatureName = signature.name
|
||||
LOGGER.fine("Resolve $signatureName")
|
||||
logger.trace("Resolve $signatureName")
|
||||
for (classDef in classes) {
|
||||
for (method in classDef.methods) {
|
||||
val patternScanData = compareSignatureToMethod(signature, method) ?: continue
|
||||
|
||||
LOGGER.fine("$signatureName match to ${method.definingClass}->${method.name}")
|
||||
logger.trace("$signatureName match to ${method.definingClass}->${method.name}")
|
||||
|
||||
// create class proxy, in case a patch needs mutability
|
||||
val classProxy = patcherData.bytecodeData.proxy(classDef)
|
||||
|
Reference in New Issue
Block a user