1
mirror of https://github.com/revanced/revanced-patcher synced 2025-09-06 16:38:50 +02:00

Compare commits

..

3 Commits

Author SHA1 Message Date
semantic-release-bot
447e1ad30e chore(release): 5.1.2 [skip ci]
## [5.1.2](https://github.com/revanced/revanced-patcher/compare/v5.1.1...v5.1.2) (2022-09-29)

### Bug Fixes

* check dependencies for resource patches ([9c07ffc](9c07ffcc7a))
* use instruction index instead of strings list index for `StringMatch` ([843e62a](843e62ad29))
2022-09-29 19:29:55 +00:00
oSumAtrIX
843e62ad29 fix: use instruction index instead of strings list index for StringMatch 2022-09-29 21:27:56 +02:00
oSumAtrIX
9c07ffcc7a fix: check dependencies for resource patches 2022-09-29 21:27:12 +02:00
4 changed files with 18 additions and 9 deletions

View File

@@ -1,3 +1,11 @@
## [5.1.2](https://github.com/revanced/revanced-patcher/compare/v5.1.1...v5.1.2) (2022-09-29)
### Bug Fixes
* check dependencies for resource patches ([9c07ffc](https://github.com/revanced/revanced-patcher/commit/9c07ffcc7af9f088426528561f4321c5cc6b5b15))
* use instruction index instead of strings list index for `StringMatch` ([843e62a](https://github.com/revanced/revanced-patcher/commit/843e62ad290ee0a707be9322ee943921da3ea420))
## [5.1.1](https://github.com/revanced/revanced-patcher/compare/v5.1.0...v5.1.1) (2022-09-26)

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 5.1.1
version = 5.1.2

View File

@@ -207,7 +207,7 @@ class Patcher(private val options: PatcherOptions) {
*/
fun Class<out Patch<Data>>.isResource() {
this.also {
if (!ResourcePatch::class.java.isAssignableFrom(it)) return
if (!ResourcePatch::class.java.isAssignableFrom(it)) return@also
// set the mode to decode all resources before running the patches
resourceDecodingMode = ResourceDecodingMode.FULL
}.dependencies?.forEach { it.java.isResource() }
@@ -249,14 +249,15 @@ class Patcher(private val options: PatcherOptions) {
}
// recursively apply all dependency patches
patch.dependencies?.forEach { dependency ->
val result = applyPatch(dependency.java, appliedPatches)
patch.dependencies?.forEach { dependencyClass ->
val dependency = dependencyClass.java
val result = applyPatch(dependency, appliedPatches)
if (result.isSuccess()) return@forEach
val error = result.error()!!
val errorMessage = error.cause ?: error.message
return PatchResultError("'$patchName' depends on '${patch.patchName}' but the following error was raised: $errorMessage")
return PatchResultError("'$patchName' depends on '${dependency.patchName}' but the following error was raised: $errorMessage")
}
patch.deprecated?.let { (reason, replacement) ->

View File

@@ -102,17 +102,17 @@ abstract class MethodFingerprint(
val stringsList = methodFingerprint.strings.toMutableList()
implementation.instructions.forEach { instruction ->
if (instruction.opcode.ordinal != Opcode.CONST_STRING.ordinal) return@forEach
implementation.instructions.forEachIndexed { instructionIndex, instruction ->
if (instruction.opcode.ordinal != Opcode.CONST_STRING.ordinal) return@forEachIndexed
val string = ((instruction as ReferenceInstruction).reference as StringReference).string
val index = stringsList.indexOfFirst { it == string }
if (index == -1) return@forEach
if (index == -1) return@forEachIndexed
add(
StringMatch(
string,
index
instructionIndex
)
)
stringsList.removeAt(index)