1
mirror of https://github.com/revanced/revanced-patcher synced 2025-10-29 18:30:51 +01:00

Compare commits

..

9 Commits

Author SHA1 Message Date
oSumAtrIX
c2e0f57579 Update 4_apis.md 2024-10-27 05:32:10 +01:00
oSumAtrIX
242e244b18 Update 4_apis.md 2024-10-27 05:31:11 +01:00
oSumAtrIX
f338ebff6c add missing syntax highlighting 2024-10-27 05:30:16 +01:00
oSumAtrIX
00e5950cf2 feat: Improve some APIs
Some APIs have been slightly changed and docs have been added.

BREAKING CHANGE: Various APIs have been changed.
2024-10-27 05:28:25 +01:00
oSumAtrIX
5a0e3841ff more nesting fixes 2024-10-27 04:40:06 +01:00
oSumAtrIX
cfb459b832 fix nesting 2024-10-27 04:37:40 +01:00
oSumAtrIX
2096306107 fix nesting 2024-10-27 04:37:20 +01:00
oSumAtrIX
92eaba8081 feat: Improve Fingerprint API
Fingerprints can now be matched easily without having to add them to a patch first.

BREAKING CHANGE: Many APIs have been changed.
2024-10-27 04:31:43 +01:00
oSumAtrIX
7be0cd8548 fix: Merge extension only when patch executes 2024-10-26 23:23:36 +02:00
6 changed files with 11 additions and 44 deletions

View File

@@ -1,22 +1,3 @@
# [21.0.0-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v20.0.2...v21.0.0-dev.1) (2024-10-27)
### Bug Fixes
* Merge extension only when patch executes ([#315](https://github.com/ReVanced/revanced-patcher/issues/315)) ([aa472eb](https://github.com/ReVanced/revanced-patcher/commit/aa472eb9857145b53b49f843406a9764fbb7e5ce))
### Features
* Improve Fingerprint API ([#316](https://github.com/ReVanced/revanced-patcher/issues/316)) ([0abf1c6](https://github.com/ReVanced/revanced-patcher/commit/0abf1c6c0279708fdef5cb66b141d07d17682693))
* Improve various APIs ([#317](https://github.com/ReVanced/revanced-patcher/issues/317)) ([b824978](https://github.com/ReVanced/revanced-patcher/commit/b8249789df8b90129f7b7ad0e523a8d0ceaab848))
### BREAKING CHANGES
* Various APIs have been changed.
* Many APIs have been changed.
## [20.0.2](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1...v20.0.2) (2024-10-17)

View File

@@ -89,9 +89,9 @@ val patcherResult = Patcher(PatcherConfig(apkFile = File("some.apk"))).use { pat
runBlocking {
patcher().collect { patchResult ->
if (patchResult.exception != null)
logger.info { "\"${patchResult.patch}\" failed:\n${patchResult.exception}" }
logger.info("\"${patchResult.patch}\" failed:\n${patchResult.exception}")
else
logger.info { "\"${patchResult.patch}\" succeeded" }
logger.info("\"${patchResult.patch}\" succeeded")
}
}

View File

@@ -233,11 +233,6 @@ The `classDef` and `method` properties can be used to make changes to the class
They are lazy properties, so they are only computed
and will effectively replace the original method or class definition when accessed.
> [!TIP]
> If only read-only access to the class or method is needed,
> the `originalClassDef` and `originalMethod` properties can be used,
> to avoid making a mutable copy of the class or method.
## 🏹 Manually matching fingerprints
By default, a fingerprint is matched automatically against all classes when the `match` property is accessed.
@@ -266,15 +261,6 @@ you can match the fingerprint on the list of classes:
val match = showAdsFingerprint.match(context, adsLoaderClass) ?: throw PatchException("No match found")
}
```
Another common usecase is to use a fingerprint to reduce the search space of a method to a single class.
```kt
execute {
// Match showAdsFingerprint in the class of the ads loader found by adsLoaderClassFingerprint.
val match by showAdsFingerprint.match(adsLoaderClassFingerprint.match!!.classDef)
}
```
- Match a **single method**, to extract certain information about it

View File

@@ -1,3 +1,3 @@
org.gradle.parallel = true
org.gradle.caching = true
version = 21.0.0-dev.1
version = 20.0.2

View File

@@ -98,7 +98,7 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
bytecodePatch.extensionInputStream?.get()?.use { extensionStream ->
RawDexIO.readRawDexFile(extensionStream, 0, null).classes.forEach { classDef ->
val existingClass = lookupMaps.classesByType[classDef.type] ?: run {
logger.fine { "Adding class \"$classDef\"" }
logger.fine("Adding class \"$classDef\"")
classes += classDef
lookupMaps.classesByType[classDef.type] = classDef
@@ -106,7 +106,7 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
return@forEach
}
logger.fine { "Class \"$classDef\" exists already. Adding missing methods and fields." }
logger.fine("Class \"$classDef\" exists already. Adding missing methods and fields.")
existingClass.merge(classDef, this@BytecodePatchContext).let { mergedClass ->
// If the class was merged, replace the original class with the merged class.
@@ -179,7 +179,7 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
override fun getOpcodes() = this@BytecodePatchContext.opcodes
},
DexIO.DEFAULT_MAX_DEX_POOL_SIZE,
) { _, entryName, _ -> logger.info { "Compiled $entryName" } }
) { _, entryName, _ -> logger.info("Compiled $entryName") }
}.listFiles(FileFilter { it.isFile })!!.map {
PatcherResult.PatchedDexFile(it.name, it.inputStream())
}.toSet()

View File

@@ -60,7 +60,7 @@ internal object ClassMerger {
if (missingMethods.isEmpty()) return this
logger.fine { "Found ${missingMethods.size} missing methods" }
logger.fine("Found ${missingMethods.size} missing methods")
return asMutableClass().apply {
methods.addAll(missingMethods.map { it.toMutable() })
@@ -80,7 +80,7 @@ internal object ClassMerger {
if (missingFields.isEmpty()) return this
logger.fine { "Found ${missingFields.size} missing fields" }
logger.fine("Found ${missingFields.size} missing fields")
return asMutableClass().apply {
fields.addAll(missingFields.map { it.toMutable() })
@@ -100,7 +100,7 @@ internal object ClassMerger {
context.traverseClassHierarchy(this) {
if (accessFlags.isPublic()) return@traverseClassHierarchy
logger.fine { "Publicizing ${this.type}" }
logger.fine("Publicizing ${this.type}")
accessFlags = accessFlags.toPublic()
}
@@ -124,7 +124,7 @@ internal object ClassMerger {
if (brokenFields.isEmpty()) return this
logger.fine { "Found ${brokenFields.size} broken fields" }
logger.fine("Found ${brokenFields.size} broken fields")
/**
* Make a field public.
@@ -153,7 +153,7 @@ internal object ClassMerger {
if (brokenMethods.isEmpty()) return this
logger.fine { "Found ${brokenMethods.size} methods" }
logger.fine("Found ${brokenMethods.size} methods")
/**
* Make a method public.