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

Compare commits

..

8 Commits

Author SHA1 Message Date
semantic-release-bot
5024204046 chore: Release v20.0.2-dev.1 [skip ci]
## [20.0.2-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1...v20.0.2-dev.1) (2024-10-15)

### Bug Fixes

* Make it work on Android 12 and lower by using existing APIs ([#312](https://github.com/ReVanced/revanced-patcher/issues/312)) ([a44802e](a44802ef4e))
2024-10-15 11:41:01 +00:00
LisoUseInAIKyrios
a44802ef4e fix: Make it work on Android 12 and lower by using existing APIs (#312)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2024-10-15 13:39:33 +02:00
semantic-release-bot
4c1c34ad01 chore: Release v20.0.1 [skip ci]
## [20.0.1](https://github.com/ReVanced/revanced-patcher/compare/v20.0.0...v20.0.1) (2024-10-13)

### Bug Fixes

* Check for class type exactly instead of with contains ([#310](https://github.com/ReVanced/revanced-patcher/issues/310)) ([69f2f20](69f2f20fd9))
* Make it work on Android by not using APIs from JVM unavailable to Android. ([2be6e97](2be6e97817))
* Use non-nullable type for options ([ea6fc70](ea6fc70caa))

### Performance Improvements

* Free memory earlier and remove negligible lookup maps ([d53aacd](d53aacdad4))
2024-10-13 01:54:23 +00:00
oSumAtrIX
b2aecb726d chore: Merge branch dev to main (#304) 2024-10-13 03:52:31 +02:00
semantic-release-bot
851f9c7885 chore: Release v20.0.1-dev.5 [skip ci]
## [20.0.1-dev.5](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1-dev.4...v20.0.1-dev.5) (2024-10-11)

### Bug Fixes

* Use non-nullable type for options ([ea6fc70](ea6fc70caa))
2024-10-11 03:30:03 +00:00
oSumAtrIX
ea6fc70caa fix: Use non-nullable type for options 2024-10-11 05:28:15 +02:00
semantic-release-bot
a2875d1d64 chore: Release v20.0.1-dev.4 [skip ci]
## [20.0.1-dev.4](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1-dev.3...v20.0.1-dev.4) (2024-10-07)

### Bug Fixes

* Make it work on Android by not using APIs from JVM unavailable to Android. ([2be6e97](2be6e97817))
2024-10-07 16:27:20 +00:00
oSumAtrIX
2be6e97817 fix: Make it work on Android by not using APIs from JVM unavailable to Android. 2024-10-07 18:25:43 +02:00
5 changed files with 59 additions and 16 deletions

View File

@@ -1,3 +1,38 @@
## [20.0.2-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1...v20.0.2-dev.1) (2024-10-15)
### Bug Fixes
* Make it work on Android 12 and lower by using existing APIs ([#312](https://github.com/ReVanced/revanced-patcher/issues/312)) ([a44802e](https://github.com/ReVanced/revanced-patcher/commit/a44802ef4ebf59ae47213854ba761c81dadc51f3))
## [20.0.1](https://github.com/ReVanced/revanced-patcher/compare/v20.0.0...v20.0.1) (2024-10-13)
### Bug Fixes
* Check for class type exactly instead of with contains ([#310](https://github.com/ReVanced/revanced-patcher/issues/310)) ([69f2f20](https://github.com/ReVanced/revanced-patcher/commit/69f2f20fd99162f91cd9c531dfe47d00d3152ead))
* Make it work on Android by not using APIs from JVM unavailable to Android. ([2be6e97](https://github.com/ReVanced/revanced-patcher/commit/2be6e97817437f40e17893dfff3bea2cd4c3ff9e))
* Use non-nullable type for options ([ea6fc70](https://github.com/ReVanced/revanced-patcher/commit/ea6fc70caab055251ad4d0d3f1b5cf53865abb85))
### Performance Improvements
* Free memory earlier and remove negligible lookup maps ([d53aacd](https://github.com/ReVanced/revanced-patcher/commit/d53aacdad4ed3750ddae526fb307577ea36e6171))
## [20.0.1-dev.5](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1-dev.4...v20.0.1-dev.5) (2024-10-11)
### Bug Fixes
* Use non-nullable type for options ([ea6fc70](https://github.com/ReVanced/revanced-patcher/commit/ea6fc70caab055251ad4d0d3f1b5cf53865abb85))
## [20.0.1-dev.4](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1-dev.3...v20.0.1-dev.4) (2024-10-07)
### Bug Fixes
* Make it work on Android by not using APIs from JVM unavailable to Android. ([2be6e97](https://github.com/ReVanced/revanced-patcher/commit/2be6e97817437f40e17893dfff3bea2cd4c3ff9e))
## [20.0.1-dev.3](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1-dev.2...v20.0.1-dev.3) (2024-10-03) ## [20.0.1-dev.3](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1-dev.2...v20.0.1-dev.3) (2024-10-03)

View File

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

View File

@@ -62,17 +62,16 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
* Merge the extensions for this set of patches. * Merge the extensions for this set of patches.
*/ */
internal fun Set<Patch<*>>.mergeExtensions() { internal fun Set<Patch<*>>.mergeExtensions() {
// Lookup map for fast checking if a class exists by its type. // Lookup map to check if a class exists by its type quickly.
val classesByType = mutableMapOf<String, ClassDef>().apply { val classesByType = mutableMapOf<String, ClassDef>().apply {
classes.forEach { classDef -> put(classDef.type, classDef) } classes.forEach { classDef -> put(classDef.type, classDef) }
} }
forEachRecursively { patch -> forEachRecursively { patch ->
if (patch is BytecodePatch && patch.extension != null) { if (patch !is BytecodePatch) return@forEachRecursively
val extension = patch.extension.readAllBytes() patch.extension?.use { extensionStream ->
RawDexIO.readRawDexFile(extensionStream, 0, null).classes.forEach { classDef ->
RawDexIO.readRawDexFile(extension, 0, null).classes.forEach { classDef ->
val existingClass = classesByType[classDef.type] ?: run { val existingClass = classesByType[classDef.type] ?: run {
logger.fine("Adding class \"$classDef\"") logger.fine("Adding class \"$classDef\"")

View File

@@ -231,7 +231,7 @@ fun intOption(
title: String? = null, title: String? = null,
description: String? = null, description: String? = null,
required: Boolean = false, required: Boolean = false,
validator: Option<Int?>.(Int?) -> Boolean = { true }, validator: Option<Int>.(Int?) -> Boolean = { true },
) = option( ) = option(
key, key,
default, default,
@@ -264,7 +264,7 @@ fun PatchBuilder<*>.intOption(
title: String? = null, title: String? = null,
description: String? = null, description: String? = null,
required: Boolean = false, required: Boolean = false,
validator: Option<Int?>.(Int?) -> Boolean = { true }, validator: Option<Int>.(Int?) -> Boolean = { true },
) = option( ) = option(
key, key,
default, default,
@@ -297,7 +297,7 @@ fun booleanOption(
title: String? = null, title: String? = null,
description: String? = null, description: String? = null,
required: Boolean = false, required: Boolean = false,
validator: Option<Boolean?>.(Boolean?) -> Boolean = { true }, validator: Option<Boolean>.(Boolean?) -> Boolean = { true },
) = option( ) = option(
key, key,
default, default,
@@ -330,7 +330,7 @@ fun PatchBuilder<*>.booleanOption(
title: String? = null, title: String? = null,
description: String? = null, description: String? = null,
required: Boolean = false, required: Boolean = false,
validator: Option<Boolean?>.(Boolean?) -> Boolean = { true }, validator: Option<Boolean>.(Boolean?) -> Boolean = { true },
) = option( ) = option(
key, key,
default, default,
@@ -363,7 +363,7 @@ fun floatOption(
title: String? = null, title: String? = null,
description: String? = null, description: String? = null,
required: Boolean = false, required: Boolean = false,
validator: Option<Float?>.(Float?) -> Boolean = { true }, validator: Option<Float>.(Float?) -> Boolean = { true },
) = option( ) = option(
key, key,
default, default,
@@ -396,7 +396,7 @@ fun PatchBuilder<*>.floatOption(
title: String? = null, title: String? = null,
description: String? = null, description: String? = null,
required: Boolean = false, required: Boolean = false,
validator: Option<Float?>.(Float?) -> Boolean = { true }, validator: Option<Float>.(Float?) -> Boolean = { true },
) = option( ) = option(
key, key,
default, default,
@@ -429,7 +429,7 @@ fun longOption(
title: String? = null, title: String? = null,
description: String? = null, description: String? = null,
required: Boolean = false, required: Boolean = false,
validator: Option<Long?>.(Long?) -> Boolean = { true }, validator: Option<Long>.(Long?) -> Boolean = { true },
) = option( ) = option(
key, key,
default, default,
@@ -462,7 +462,7 @@ fun PatchBuilder<*>.longOption(
title: String? = null, title: String? = null,
description: String? = null, description: String? = null,
required: Boolean = false, required: Boolean = false,
validator: Option<Long?>.(Long?) -> Boolean = { true }, validator: Option<Long>.(Long?) -> Boolean = { true },
) = option( ) = option(
key, key,
default, default,

View File

@@ -10,6 +10,9 @@ import lanchon.multidexlib2.BasicDexFileNamer
import lanchon.multidexlib2.MultiDexIO import lanchon.multidexlib2.MultiDexIO
import java.io.File import java.io.File
import java.io.InputStream import java.io.InputStream
import java.lang.reflect.Member
import java.lang.reflect.Method
import java.lang.reflect.Modifier
import java.net.URLClassLoader import java.net.URLClassLoader
import java.util.jar.JarFile import java.util.jar.JarFile
import kotlin.reflect.KProperty import kotlin.reflect.KProperty
@@ -636,7 +639,7 @@ sealed class PatchLoader private constructor(
*/ */
private val Class<*>.patchFields private val Class<*>.patchFields
get() = fields.filter { field -> get() = fields.filter { field ->
field.type.isPatch && field.canAccess(null) field.type.isPatch && field.canAccess()
}.map { field -> }.map { field ->
field.get(null) as Patch<*> field.get(null) as Patch<*>
} }
@@ -646,7 +649,7 @@ sealed class PatchLoader private constructor(
*/ */
private val Class<*>.patchMethods private val Class<*>.patchMethods
get() = methods.filter { method -> get() = methods.filter { method ->
method.returnType.isPatch && method.parameterCount == 0 && method.canAccess(null) method.returnType.isPatch && method.parameterCount == 0 && method.canAccess()
}.map { method -> }.map { method ->
method.invoke(null) as Patch<*> method.invoke(null) as Patch<*>
} }
@@ -670,6 +673,12 @@ sealed class PatchLoader private constructor(
it.name != null it.name != null
}.toSet() }.toSet()
} }
private fun Member.canAccess(): Boolean {
if (this is Method && parameterCount != 0) return false
return Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)
}
} }
} }