Compare commits

..

20 Commits

Author SHA1 Message Date
semantic-release-bot
b1b1561704 chore(release): 2.188.0-dev.28 [skip ci]
# [2.188.0-dev.28](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.27...v2.188.0-dev.28) (2023-08-26)

### Features

* **YouTube:** Add `Enable tablet layout` patch ([b9c57db](b9c57db166))
2023-08-26 15:14:25 +00:00
oSumAtrIX
b9c57db166 feat(YouTube): Add Enable tablet layout patch 2023-08-26 17:10:36 +02:00
semantic-release-bot
e614e48da2 chore(release): 2.188.0-dev.27 [skip ci]
# [2.188.0-dev.27](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.26...v2.188.0-dev.27) (2023-08-26)

### Features

* **YouTube Music - Exclusive audio playback:** Support latest version ([65420f1](65420f1833))
2023-08-26 14:24:48 +00:00
oSumAtrIX
65420f1833 feat(YouTube Music - Exclusive audio playback): Support latest version 2023-08-26 16:22:07 +02:00
semantic-release-bot
ae335104fe chore(release): 2.188.0-dev.26 [skip ci]
# [2.188.0-dev.26](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.25...v2.188.0-dev.26) (2023-08-26)

### Features

* **YouTube:** Support version `18.32.39` ([c5ef490](c5ef490eee))
2023-08-26 12:15:34 +00:00
oSumAtrIX
96a72c9323 chore(YouTube): Bump compatibility to 18.29.38 2023-08-26 14:12:43 +02:00
oSumAtrIX
c5ef490eee feat(YouTube): Support version 18.32.39 2023-08-26 14:12:43 +02:00
semantic-release-bot
69092def55 chore(release): 2.188.0-dev.25 [skip ci]
# [2.188.0-dev.25](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.24...v2.188.0-dev.25) (2023-08-26)

### Features

* **YouTube:** Add `Custom player overlay opacity` patch ([#2721](https://github.com/ReVanced/revanced-patches/issues/2721)) ([004aae8](004aae8258))
2023-08-26 00:15:24 +00:00
johnconner122
004aae8258 feat(YouTube): Add Custom player overlay opacity patch (#2721)
This gets rid of the `Hide player overlay` patch.

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-08-26 02:12:30 +02:00
semantic-release-bot
c378869941 chore(release): 2.188.0-dev.24 [skip ci]
# [2.188.0-dev.24](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.23...v2.188.0-dev.24) (2023-08-25)

### Features

* Exclude `Custom branding` patch by default ([52e7086](52e70866d9))
2023-08-25 15:57:17 +00:00
oSumAtrIX
52e70866d9 feat: Exclude Custom branding patch by default
Due to design complexity of the patch the default branding included with the patch is mistaken as the branding soley meant for YouTube and not understood merely as the default branding.
2023-08-25 17:54:10 +02:00
semantic-release-bot
c7e1dd7563 chore(release): 2.188.0-dev.23 [skip ci]
# [2.188.0-dev.23](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.22...v2.188.0-dev.23) (2023-08-25)

### Features

* **Strava:** Add `Subscription features` patch ([#2872](https://github.com/ReVanced/revanced-patches/issues/2872)) ([3d4ef97](3d4ef97c1e))
2023-08-25 01:19:27 +00:00
xehpuk
3d4ef97c1e feat(Strava): Add Subscription features patch (#2872)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-08-25 03:16:12 +02:00
semantic-release-bot
040f612818 chore(release): 2.188.0-dev.22 [skip ci]
# [2.188.0-dev.22](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.21...v2.188.0-dev.22) (2023-08-24)

### Features

* Publicize resource utility functions ([520eb07](520eb07277))
* Use an extension property to create new exception when failing to resolve a fingerprint ([a471605](a471605db7))
2023-08-24 22:08:30 +00:00
oSumAtrIX
520eb07277 feat: Publicize resource utility functions
This commit adds the functions to the public API
2023-08-25 00:05:32 +02:00
oSumAtrIX
a471605db7 feat: Use an extension property to create new exception when failing to resolve a fingerprint
This commit adds the extension property to the public API
2023-08-25 00:05:30 +02:00
semantic-release-bot
31b5d506a5 chore(release): 2.188.0-dev.21 [skip ci]
# [2.188.0-dev.21](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.20...v2.188.0-dev.21) (2023-08-24)

### Features

* **Duolingo:** Add `Unlock Duolingo Super` patch ([#2862](https://github.com/ReVanced/revanced-patches/issues/2862)) ([1168c0c](1168c0cdf4))
2023-08-24 20:24:14 +00:00
Karol
1168c0cdf4 feat(Duolingo): Add Unlock Duolingo Super patch (#2862) 2023-08-24 22:21:33 +02:00
semantic-release-bot
eeab2fa705 chore(release): 2.188.0-dev.20 [skip ci]
# [2.188.0-dev.20](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.19...v2.188.0-dev.20) (2023-08-24)

### Bug Fixes

* **Enable android debugging:** Update patch description ([#2869](https://github.com/ReVanced/revanced-patches/issues/2869)) ([c10de2d](c10de2da22))
2023-08-24 16:18:34 +00:00
LisoUseInAIKyrios
c10de2da22 fix(Enable android debugging): Update patch description (#2869)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-08-24 20:15:48 +04:00
175 changed files with 829 additions and 553 deletions

View File

@@ -1,3 +1,67 @@
# [2.188.0-dev.28](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.27...v2.188.0-dev.28) (2023-08-26)
### Features
* **YouTube:** Add `Enable tablet layout` patch ([3ac68b3](https://github.com/ReVanced/revanced-patches/commit/3ac68b3c6ef0d568780855003217fc3e904d789b))
# [2.188.0-dev.27](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.26...v2.188.0-dev.27) (2023-08-26)
### Features
* **YouTube Music - Exclusive audio playback:** Support latest version ([bfa379a](https://github.com/ReVanced/revanced-patches/commit/bfa379a398bce8d635043eb2d4f81c4ed7440101))
# [2.188.0-dev.26](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.25...v2.188.0-dev.26) (2023-08-26)
### Features
* **YouTube:** Support version `18.32.39` ([7b503e2](https://github.com/ReVanced/revanced-patches/commit/7b503e2336dd4d330b651bf7c168d95a38e8c777))
# [2.188.0-dev.25](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.24...v2.188.0-dev.25) (2023-08-26)
### Features
* **YouTube:** Add `Custom player overlay opacity` patch ([#2721](https://github.com/ReVanced/revanced-patches/issues/2721)) ([2622b00](https://github.com/ReVanced/revanced-patches/commit/2622b008ab78b15aa3c28a13b38e63041f29c9ea))
# [2.188.0-dev.24](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.23...v2.188.0-dev.24) (2023-08-25)
### Features
* Exclude `Custom branding` patch by default ([d6de957](https://github.com/ReVanced/revanced-patches/commit/d6de957f4efce11d9a709d4c8f500b039166fc2f))
# [2.188.0-dev.23](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.22...v2.188.0-dev.23) (2023-08-25)
### Features
* **Strava:** Add `Subscription features` patch ([#2872](https://github.com/ReVanced/revanced-patches/issues/2872)) ([387eb29](https://github.com/ReVanced/revanced-patches/commit/387eb29e7ed45169c89a03513af64104d0082f28))
# [2.188.0-dev.22](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.21...v2.188.0-dev.22) (2023-08-24)
### Features
* Publicize resource utility functions ([20aff26](https://github.com/ReVanced/revanced-patches/commit/20aff26784296517257ea19d66ffd3bdfe6b06fa))
* Use an extension property to create new exception when failing to resolve a fingerprint ([47eac14](https://github.com/ReVanced/revanced-patches/commit/47eac14f039dc466c1957470d82255bfa2c06ff0))
# [2.188.0-dev.21](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.20...v2.188.0-dev.21) (2023-08-24)
### Features
* **Duolingo:** Add `Unlock Duolingo Super` patch ([#2862](https://github.com/ReVanced/revanced-patches/issues/2862)) ([61a7533](https://github.com/ReVanced/revanced-patches/commit/61a7533136f38d7a308e31c9f250baad00515d6a))
# [2.188.0-dev.20](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.19...v2.188.0-dev.20) (2023-08-24)
### Bug Fixes
* **Enable android debugging:** Update patch description ([#2869](https://github.com/ReVanced/revanced-patches/issues/2869)) ([d9f0d08](https://github.com/ReVanced/revanced-patches/commit/d9f0d08498662e7aa18edb5201a5d60f3738e4e4))
# [2.188.0-dev.19](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.18...v2.188.0-dev.19) (2023-08-24) # [2.188.0-dev.19](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.18...v2.188.0-dev.19) (2023-08-24)

View File

@@ -1,4 +1,4 @@
org.gradle.parallel = true org.gradle.parallel = true
org.gradle.caching = true org.gradle.caching = true
kotlin.code.style = official kotlin.code.style = official
version = 2.188.0-dev.19 version = 2.188.0-dev.28

File diff suppressed because one or more lines are too long

View File

@@ -15,11 +15,12 @@ import com.android.tools.smali.dexlib2.util.MethodUtil
import org.w3c.dom.Node import org.w3c.dom.Node
/** /**
* Return [PatchException] from a [MethodFingerprint]. * The [PatchException] of failing to resolve a [MethodFingerprint].
* *
* @return The [PatchException] for the [MethodFingerprint]. * @return The [PatchException].
*/ */
internal fun MethodFingerprint.toErrorResult() = PatchException("Failed to resolve $name") val MethodFingerprint.exception
get() = PatchException("Failed to resolve $name")
/** /**
* Find the [MutableMethod] from a given [Method] in a [MutableClass]. * Find the [MutableMethod] from a given [Method] in a [MutableClass].
@@ -27,27 +28,27 @@ internal fun MethodFingerprint.toErrorResult() = PatchException("Failed to resol
* @param method The [Method] to find. * @param method The [Method] to find.
* @return The [MutableMethod]. * @return The [MutableMethod].
*/ */
internal fun MutableClass.findMutableMethodOf(method: Method) = this.methods.first { fun MutableClass.findMutableMethodOf(method: Method) = this.methods.first {
MethodUtil.methodSignaturesMatch(it, method) MethodUtil.methodSignaturesMatch(it, method)
} }
/** /**
* apply a transform to all methods of the class * apply a transform to all methods of the class.
* *
* @param transform the transformation function. original method goes in, transformed method goes out * @param transform the transformation function. original method goes in, transformed method goes out.
*/ */
internal fun MutableClass.transformMethods(transform: MutableMethod.() -> MutableMethod) { fun MutableClass.transformMethods(transform: MutableMethod.() -> MutableMethod) {
val transformedMethods = methods.map { it.transform() } val transformedMethods = methods.map { it.transform() }
methods.clear() methods.clear()
methods.addAll(transformedMethods) methods.addAll(transformedMethods)
} }
internal fun Node.doRecursively(action: (Node) -> Unit) { fun Node.doRecursively(action: (Node) -> Unit) {
action(this) action(this)
for (i in 0 until this.childNodes.length) this.childNodes.item(i).doRecursively(action) for (i in 0 until this.childNodes.length) this.childNodes.item(i).doRecursively(action)
} }
internal fun MutableMethod.injectHideViewCall( fun MutableMethod.injectHideViewCall(
insertIndex: Int, insertIndex: Int,
viewRegister: Int, viewRegister: Int,
classDescriptor: String, classDescriptor: String,
@@ -57,7 +58,13 @@ internal fun MutableMethod.injectHideViewCall(
"invoke-static { v$viewRegister }, $classDescriptor->$targetMethod(Landroid/view/View;)V" "invoke-static { v$viewRegister }, $classDescriptor->$targetMethod(Landroid/view/View;)V"
) )
internal fun Method.findIndexForIdResource(resourceName: String): Int { /**
* Find the index of the first constant instruction with the id of the given resource name.
*
* @param resourceName the name of the resource to find the id for.
* @return the index of the first constant instruction with the id of the given resource name, or -1 if not found.
*/
fun Method.findIndexForIdResource(resourceName: String): Int {
fun getIdResourceId(resourceName: String) = ResourceMappingPatch.resourceMappings.single { fun getIdResourceId(resourceName: String) = ResourceMappingPatch.resourceMappings.single {
it.type == "id" && it.name == resourceName it.type == "id" && it.name == resourceName
}.id }.id
@@ -66,6 +73,8 @@ internal fun Method.findIndexForIdResource(resourceName: String): Int {
} }
/** /**
* Find the index of the first constant instruction with the given value.
*
* @return the first constant instruction with the value, or -1 if not found. * @return the first constant instruction with the value, or -1 if not found.
*/ */
fun Method.indexOfFirstConstantInstructionValue(constantValue: Long): Int { fun Method.indexOfFirstConstantInstructionValue(constantValue: Long): Int {
@@ -77,6 +86,8 @@ fun Method.indexOfFirstConstantInstructionValue(constantValue: Long): Int {
} }
/** /**
* Check if the method contains a constant with the given value.
*
* @return if the method contains a constant with the given value. * @return if the method contains a constant with the given value.
*/ */
fun Method.containsConstantInstructionValue(constantValue: Long): Boolean { fun Method.containsConstantInstructionValue(constantValue: Long): Boolean {
@@ -84,10 +95,10 @@ fun Method.containsConstantInstructionValue(constantValue: Long): Boolean {
} }
/** /**
* traverse the class hierarchy starting from the given root class * Traverse the class hierarchy starting from the given root class.
* *
* @param targetClass the class to start traversing the class hierarchy from * @param targetClass the class to start traversing the class hierarchy from.
* @param callback function that is called for every class in the hierarchy * @param callback function that is called for every class in the hierarchy.
*/ */
fun BytecodeContext.traverseClassHierarchy(targetClass: MutableClass, callback: MutableClass.() -> Unit) { fun BytecodeContext.traverseClassHierarchy(targetClass: MutableClass, callback: MutableClass.() -> Unit) {
callback(targetClass) callback(targetClass)

View File

@@ -15,7 +15,7 @@ import java.util.*
@Name("Spoof wifi connection") @Name("Spoof wifi connection")
@Description("Spoofs an existing Wi-Fi connection.") @Description("Spoofs an existing Wi-Fi connection.")
@RequiresIntegrations @RequiresIntegrations
internal class SpoofWifiPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() { class SpoofWifiPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() {
private companion object { private companion object {
const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX = "Lapp/revanced/all/connectivity/wifi/spoof/SpoofWifiPatch" const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX = "Lapp/revanced/all/connectivity/wifi/spoof/SpoofWifiPatch"

View File

@@ -9,7 +9,7 @@ import org.w3c.dom.Element
@Patch(false) @Patch(false)
@Name("Enable android debugging") @Name("Enable android debugging")
@Description("Enables Android debugging capabilities.") @Description("Enables Android debugging capabilities. This can slow down the app.")
class EnableAndroidDebuggingPatch : ResourcePatch { class EnableAndroidDebuggingPatch : ResourcePatch {
override fun execute(context: ResourceContext) { override fun execute(context: ResourceContext) {
context.xmlEditor["AndroidManifest.xml"].use { dom -> context.xmlEditor["AndroidManifest.xml"].use { dom ->

View File

@@ -7,7 +7,10 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotations.RequiresIntegrations import app.revanced.patcher.patch.annotations.RequiresIntegrations
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.all.screencapture.removerestriction.resource.patch.RemoveCaptureRestrictionResourcePatch import app.revanced.patches.all.screencapture.removerestriction.resource.patch.RemoveCaptureRestrictionResourcePatch
import app.revanced.util.patch.* import app.revanced.util.patch.AbstractTransformInstructionsPatch
import app.revanced.util.patch.IMethodCall
import app.revanced.util.patch.Instruction35cInfo
import app.revanced.util.patch.filterMapInstruction35c
import com.android.tools.smali.dexlib2.iface.ClassDef import com.android.tools.smali.dexlib2.iface.ClassDef
import com.android.tools.smali.dexlib2.iface.Method import com.android.tools.smali.dexlib2.iface.Method
import com.android.tools.smali.dexlib2.iface.instruction.Instruction import com.android.tools.smali.dexlib2.iface.instruction.Instruction
@@ -17,7 +20,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.Instruction
@Description("Removes the restriction of capturing audio from apps that normally wouldn't allow it.") @Description("Removes the restriction of capturing audio from apps that normally wouldn't allow it.")
@DependsOn([RemoveCaptureRestrictionResourcePatch::class]) @DependsOn([RemoveCaptureRestrictionResourcePatch::class])
@RequiresIntegrations @RequiresIntegrations
internal class RemoveCaptureRestrictionPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() { class RemoveCaptureRestrictionPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() {
// Information about method calls we want to replace // Information about method calls we want to replace
enum class MethodCall( enum class MethodCall(
override val definedClassName: String, override val definedClassName: String,

View File

@@ -5,17 +5,19 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotations.RequiresIntegrations import app.revanced.patcher.patch.annotations.RequiresIntegrations
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.util.patch.* import app.revanced.util.patch.AbstractTransformInstructionsPatch
import app.revanced.util.patch.IMethodCall
import app.revanced.util.patch.Instruction35cInfo
import app.revanced.util.patch.filterMapInstruction35c
import com.android.tools.smali.dexlib2.iface.ClassDef import com.android.tools.smali.dexlib2.iface.ClassDef
import com.android.tools.smali.dexlib2.iface.Method import com.android.tools.smali.dexlib2.iface.Method
import com.android.tools.smali.dexlib2.iface.instruction.Instruction import com.android.tools.smali.dexlib2.iface.instruction.Instruction
import java.util.*
@Patch(false) @Patch(false)
@Name("Remove screenshot restriction") @Name("Remove screenshot restriction")
@Description("Removes the restriction of taking screenshots in apps that normally wouldn't allow it.") @Description("Removes the restriction of taking screenshots in apps that normally wouldn't allow it.")
@RequiresIntegrations @RequiresIntegrations
internal class RemoveScreenshotRestrictionPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() { class RemoveScreenshotRestrictionPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() {
private companion object { private companion object {
const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX = const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX =

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.backdrops.misc.pro.patch package app.revanced.patches.backdrops.misc.pro.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -33,6 +33,6 @@ class ProUnlockPatch : BytecodePatch(
) )
} }
} ?: throw ProUnlockFingerprint.toErrorResult() } ?: throw ProUnlockFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.candylinkvpn.patch package app.revanced.patches.candylinkvpn.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -24,6 +24,6 @@ class UnlockProPatch : BytecodePatch(
const/4 v0, 0x1 const/4 v0, 0x1
return v0 return v0
""" """
) ?: throw IsPremiumPurchasedFingerprint.toErrorResult() ) ?: throw IsPremiumPurchasedFingerprint.exception
} }
} }

View File

@@ -0,0 +1,14 @@
package app.revanced.patches.duolingo.unlocksuper.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
object IsUserSuperMethodFingerprint : MethodFingerprint(
returnType = "Ljava/lang/Object",
parameters = listOf("Ljava/lang/Object"),
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
strings = listOf("user"),
opcodes = listOf(Opcode.IGET_BOOLEAN),
)

View File

@@ -1,18 +1,20 @@
package app.revanced.patches.youtube.misc.links.open.fingerprints package app.revanced.patches.duolingo.unlocksuper.fingerprints
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
object InitializeCustomTabSupportFingerprint : MethodFingerprint( object UserSerializationMethodFingerprint : MethodFingerprint(
returnType = "V", returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
opcodes = listOf( strings = listOf(
Opcode.CHECK_CAST, "betaStatus",
Opcode.NEW_INSTANCE, "coachOutfit",
Opcode.INVOKE_DIRECT, "globalAmbassadorStatus",
Opcode.CONST_STRING ),
opcodes = listOf(
Opcode.MOVE_FROM16,
Opcode.IPUT_BOOLEAN,
), ),
strings = listOf("android.support.customtabs.action.CustomTabsService")
) )

View File

@@ -0,0 +1,64 @@
package app.revanced.patches.duolingo.unlocksuper.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Package
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.duolingo.unlocksuper.fingerprints.IsUserSuperMethodFingerprint
import app.revanced.patches.duolingo.unlocksuper.fingerprints.UserSerializationMethodFingerprint
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22c
import com.android.tools.smali.dexlib2.iface.reference.Reference
@Patch
@Name("Unlock Duolingo Super")
@Description("Unlocks Duolingo Super features.")
@Compatibility([Package("com.duolingo")])
class UnlockDuolingoSuperPatch : BytecodePatch(
listOf(UserSerializationMethodFingerprint, IsUserSuperMethodFingerprint)
) {
/* First find the reference to the isUserSuper field, then patch the instruction that assigns it to false.
* This strategy is used because the method that sets the isUserSuper field is difficult to fingerprint reliably.
*/
override fun execute(context: BytecodeContext) {
// Find the reference to the isUserSuper field.
val isUserSuperReference = IsUserSuperMethodFingerprint
.result
?.mutableMethod
?.getInstructions()
?.filterIsInstance<BuilderInstruction22c>()
?.firstOrNull { it.opcode == Opcode.IGET_BOOLEAN }
?.reference
?: throw IsUserSuperMethodFingerprint.exception
// Patch the instruction that assigns isUserSuper to true.
UserSerializationMethodFingerprint
.result
?.mutableMethod
?.apply {
replaceInstructions(
indexOfReference(isUserSuperReference) - 1,
"const/4 v2, 0x1"
)
}
?: throw UserSerializationMethodFingerprint.exception
}
private companion object {
private fun MutableMethod.indexOfReference(reference: Reference) = getInstructions()
.filterIsInstance<BuilderInstruction22c>()
.filter { it.opcode == Opcode.IPUT_BOOLEAN }.indexOfFirst { it.reference == reference }.let {
if (it == -1) throw PatchException("Could not find index of instruction with supplied reference.")
else it
}
}
}

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.finanzonline.detection.bootloader.patch package app.revanced.patches.finanzonline.detection.bootloader.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -27,7 +27,7 @@ class BootloaderDetectionPatch : BytecodePatch(
const/4 v0, 0x1 const/4 v0, 0x1
return v0 return v0
""" """
) ?: throw fingerprint.toErrorResult() ) ?: throw fingerprint.exception
} }
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.finanzonline.detection.root.patch package app.revanced.patches.finanzonline.detection.root.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -24,6 +24,6 @@ class RootDetectionPatch : BytecodePatch(
sget-object v0, Ljava/lang/Boolean;->FALSE:Ljava/lang/Boolean; sget-object v0, Ljava/lang/Boolean;->FALSE:Ljava/lang/Boolean;
return-object v0 return-object v0
""" """
) ?: throw RootDetectionFingerprint.toErrorResult() ) ?: throw RootDetectionFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.googlerecorder.restrictions.patch package app.revanced.patches.googlerecorder.restrictions.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
@@ -34,6 +34,6 @@ class RemoveDeviceRestrictions : BytecodePatch(
// Override "isPixelDevice()" to return true. // Override "isPixelDevice()" to return true.
addInstruction(featureStringIndex, "const/4 v$featureAvailableRegister, 0x1") addInstruction(featureStringIndex, "const/4 v$featureAvailableRegister, 0x1")
} }
} ?: throw OnApplicationCreateFingerprint.toErrorResult() } ?: throw OnApplicationCreateFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.inshorts.ad.patch package app.revanced.patches.inshorts.ad.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
@@ -27,6 +27,6 @@ class HideAdsPatch : BytecodePatch(
""" """
) )
} }
} ?: throw InshortsAdsFingerprint.toErrorResult() } ?: throw InshortsAdsFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.instagram.patches.ads.timeline.patch package app.revanced.patches.instagram.patches.ads.timeline.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.* import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
@@ -33,16 +33,16 @@ class HideTimelineAdsPatch : BytecodePatch(
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
// region Resolve required methods to check for ads. // region Resolve required methods to check for ads.
ShowAdFingerprint.result ?: throw ShowAdFingerprint.toErrorResult() ShowAdFingerprint.result ?: throw ShowAdFingerprint.exception
PaidPartnershipAdFingerprint.result ?: throw PaidPartnershipAdFingerprint.toErrorResult() PaidPartnershipAdFingerprint.result ?: throw PaidPartnershipAdFingerprint.exception
MediaFingerprint.result?.let { MediaFingerprint.result?.let {
GenericMediaAdFingerprint.resolve(context, it.classDef) GenericMediaAdFingerprint.resolve(context, it.classDef)
ShoppingAdFingerprint.resolve(context, it.classDef) ShoppingAdFingerprint.resolve(context, it.classDef)
return@let return@let
} ?: throw MediaFingerprint.toErrorResult() } ?: throw MediaFingerprint.exception
// endregion // endregion

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.lightroom.misc.login.patch package app.revanced.patches.lightroom.misc.login.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
@@ -18,6 +18,6 @@ class DisableMandatoryLoginPatch : BytecodePatch(listOf(IsLoggedInFingerprint))
val index = implementation!!.instructions.lastIndex - 1 val index = implementation!!.instructions.lastIndex - 1
// Set isLoggedIn = true. // Set isLoggedIn = true.
replaceInstruction(index, "const/4 v0, 0x1") replaceInstruction(index, "const/4 v0, 0x1")
} ?: throw IsLoggedInFingerprint.toErrorResult() } ?: throw IsLoggedInFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.lightroom.misc.premium.patch package app.revanced.patches.lightroom.misc.premium.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -18,6 +18,6 @@ class UnlockPremiumPatch : BytecodePatch(listOf(HasPurchasedFingerprint)) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
// Set hasPremium = true. // Set hasPremium = true.
HasPurchasedFingerprint.result?.mutableMethod?.replaceInstruction(2, "const/4 v2, 0x1") HasPurchasedFingerprint.result?.mutableMethod?.replaceInstruction(2, "const/4 v2, 0x1")
?: throw HasPurchasedFingerprint.toErrorResult() ?: throw HasPurchasedFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.memegenerator.detection.license.patch package app.revanced.patches.memegenerator.detection.license.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
@@ -20,6 +20,6 @@ class LicenseValidationPatch : BytecodePatch(
return p0 return p0
""" """
) )
} ?: throw LicenseValidationFingerprint.toErrorResult() } ?: throw LicenseValidationFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.memegenerator.detection.signature.patch package app.revanced.patches.memegenerator.detection.signature.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
@@ -20,6 +20,6 @@ class SignatureVerificationPatch : BytecodePatch(
return p0 return p0
""" """
) )
} ?: throw VerifySignatureFingerprint.toErrorResult() } ?: throw VerifySignatureFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.memegenerator.misc.pro.patch package app.revanced.patches.memegenerator.misc.pro.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -34,6 +34,6 @@ class UnlockProVersionPatch : BytecodePatch(
return-object p0 return-object p0
""" """
) )
} ?: throw IsFreeVersionFingerprint.toErrorResult() } ?: throw IsFreeVersionFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.messenger.ads.inbox.patch package app.revanced.patches.messenger.ads.inbox.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.* import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
@@ -18,7 +18,7 @@ class HideInboxAdsPatch : BytecodePatch(
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
LoadInboxAdsFingerprint.result?.mutableMethod?.apply { LoadInboxAdsFingerprint.result?.mutableMethod?.apply {
this.replaceInstruction(0, "return-void") this.replaceInstruction(0, "return-void")
} ?: throw LoadInboxAdsFingerprint.toErrorResult() } ?: throw LoadInboxAdsFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.messenger.inputfield.patch package app.revanced.patches.messenger.inputfield.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.* import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@@ -27,6 +27,6 @@ class DisableSwitchingEmojiToStickerInMessageInputField : BytecodePatch(listOf(S
"const-string v$targetRegister, \"expression\"" "const-string v$targetRegister, \"expression\""
) )
} }
} ?: throw SwitchMessangeInputEmojiButtonFingerprint.toErrorResult() } ?: throw SwitchMessangeInputEmojiButtonFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.messenger.inputfield.patch package app.revanced.patches.messenger.inputfield.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
@@ -18,6 +18,6 @@ import app.revanced.patches.messenger.inputfield.fingerprints.SendTypingIndicato
class DisableTypingIndicator : BytecodePatch(listOf(SendTypingIndicatorFingerprint)) { class DisableTypingIndicator : BytecodePatch(listOf(SendTypingIndicatorFingerprint)) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
SendTypingIndicatorFingerprint.result?.mutableMethod?.replaceInstruction(0, "return-void") SendTypingIndicatorFingerprint.result?.mutableMethod?.replaceInstruction(0, "return-void")
?: throw SendTypingIndicatorFingerprint.toErrorResult() ?: throw SendTypingIndicatorFingerprint.exception
} }
} }

View File

@@ -5,14 +5,11 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
object AudioOnlyEnablerFingerprint: MethodFingerprint( object AllowExclusiveAudioPlaybackFingerprint: MethodFingerprint(
"Z", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf( "Z",
Opcode.IGET_OBJECT, AccessFlags.PUBLIC or AccessFlags.FINAL,
Opcode.INVOKE_INTERFACE, listOf(),
Opcode.MOVE_RESULT_OBJECT, listOf(
Opcode.IGET_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST, Opcode.CHECK_CAST,

View File

@@ -1,25 +1,31 @@
package app.revanced.patches.music.audio.exclusiveaudio.patch package app.revanced.patches.music.audio.exclusiveaudio.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.annotations.MusicCompatibility import app.revanced.patches.music.annotations.MusicCompatibility
import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AllowExclusiveAudioPlaybackFingerprint
@Patch @Patch
@Name("Exclusive audio playback") @Name("Exclusive audio playback")
@Description("Enables the option to play music without video.") @Description("Enables the option to play audio without video.")
@MusicCompatibility @MusicCompatibility
class ExclusiveAudioPatch : BytecodePatch( class ExclusiveAudioPatch : BytecodePatch(
listOf(AudioOnlyEnablerFingerprint) listOf(AllowExclusiveAudioPlaybackFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
val method = AudioOnlyEnablerFingerprint.result!!.mutableMethod AllowExclusiveAudioPlaybackFingerprint.result?.mutableMethod?.apply {
method.replaceInstruction(method.implementation!!.instructions.count() - 1, "const/4 v0, 0x1") addInstructions(
method.addInstruction("return v0") 0,
"""
const/4 v0, 0x1
return v0
"""
)
} ?: throw AllowExclusiveAudioPlaybackFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.music.interaction.permanentrepeat.patch package app.revanced.patches.music.interaction.permanentrepeat.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -31,6 +31,6 @@ class PermanentRepeatPatch : BytecodePatch(
ExternalLabel("repeat", getInstruction(repeatIndex)) ExternalLabel("repeat", getInstruction(repeatIndex))
) )
} }
} ?: throw RepeatTrackFingerprint.toErrorResult() } ?: throw RepeatTrackFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.music.interaction.permanentshuffle.patch package app.revanced.patches.music.interaction.permanentshuffle.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -20,6 +20,6 @@ class PermanentShuffleTogglePatch : BytecodePatch(
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
DisableShuffleFingerprint.result?.mutableMethod?.addInstruction(0, "return-void") DisableShuffleFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
?: throw DisableShuffleFingerprint.toErrorResult() ?: throw DisableShuffleFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.music.misc.androidauto.patch package app.revanced.patches.music.misc.androidauto.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -25,6 +25,6 @@ class BypassCertificateChecksPatch : BytecodePatch(
return v0 return v0
""" """
) )
} ?: throw CheckCertificateFingerprint.toErrorResult() } ?: throw CheckCertificateFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.nfctoolsse.misc.pro.patch package app.revanced.patches.nfctoolsse.misc.pro.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -29,7 +29,7 @@ class UnlockProPatch : BytecodePatch(
return v0 return v0
""" """
) )
} ?: throw IsLicenseRegisteredFingerprint.toErrorResult() } ?: throw IsLicenseRegisteredFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.photomath.detection.signature.patch package app.revanced.patches.photomath.detection.signature.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@@ -21,7 +21,7 @@ class SignatureDetectionPatch : BytecodePatch(
val checkRegister = (signatureCheckInstruction as OneRegisterInstruction).registerA val checkRegister = (signatureCheckInstruction as OneRegisterInstruction).registerA
mutableMethod.replaceInstruction(signatureCheckInstruction.location.index, "const/4 v$checkRegister, 0x1") mutableMethod.replaceInstruction(signatureCheckInstruction.location.index, "const/4 v$checkRegister, 0x1")
} ?: throw CheckSignatureFingerprint.toErrorResult() } ?: throw CheckSignatureFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.photomath.misc.unlockplus.patch package app.revanced.patches.photomath.misc.unlockplus.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -31,7 +31,7 @@ class UnlockPlusPatch : BytecodePatch(
return v0 return v0
""" """
) )
} ?: throw IsPlusUnlockedFingerprint.toErrorResult() } ?: throw IsPlusUnlockedFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.pixiv.ads.patch package app.revanced.patches.pixiv.ads.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.* import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
@@ -23,6 +23,6 @@ class HideAdsPatch : BytecodePatch(listOf(IsNotPremiumFingerprint)) {
const/4 v0, 0x0 const/4 v0, 0x0
return v0 return v0
""" """
) ?: throw IsNotPremiumFingerprint.toErrorResult() ) ?: throw IsNotPremiumFingerprint.exception
} }
} }

View File

@@ -1,7 +1,7 @@
package app.revanced.patches.reddit.customclients package app.revanced.patches.reddit.customclients
import android.os.Environment import android.os.Environment
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
@@ -47,7 +47,7 @@ abstract class AbstractSpoofClientPatch(
fun List<MethodFingerprint>?.executePatch( fun List<MethodFingerprint>?.executePatch(
patch: List<MethodFingerprintResult>.(BytecodeContext) -> Unit patch: List<MethodFingerprintResult>.(BytecodeContext) -> Unit
) = this?.map { it.result ?: throw it.toErrorResult() }?.patch(context) ) = this?.map { it.result ?: throw it.exception }?.patch(context)
clientIdFingerprints.executePatch { patchClientId(context) } clientIdFingerprints.executePatch { patchClientId(context) }
userAgentFingerprints.executePatch { patchUserAgent(context) } userAgentFingerprints.executePatch { patchUserAgent(context) }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.reddit.customclients.joeyforreddit.ads.patch package app.revanced.patches.reddit.customclients.joeyforreddit.ads.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@@ -24,6 +24,6 @@ class DisableAdsPatch : BytecodePatch(listOf(IsAdFreeUserFingerprint)) {
const/4 v0, 0x1 const/4 v0, 0x1
return v0 return v0
""" """
) ?: throw IsAdFreeUserFingerprint.toErrorResult() ) ?: throw IsAdFreeUserFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.patch package app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
@@ -13,6 +13,6 @@ class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerpr
""" """
return-void return-void
""" """
) ?: throw PiracyDetectionFingerprint.toErrorResult() ) ?: throw PiracyDetectionFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.reddit.customclients.syncforreddit.ads.patch package app.revanced.patches.reddit.customclients.syncforreddit.ads.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.* import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
@@ -24,7 +24,7 @@ class DisableAdsPatch : BytecodePatch(listOf(IsAdsEnabledFingerprint)) {
return v0 return v0
""" """
) )
} ?: throw IsAdsEnabledFingerprint.toErrorResult() } ?: throw IsAdsEnabledFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.reddit.customclients.syncforreddit.api.patch package app.revanced.patches.reddit.customclients.syncforreddit.api.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@@ -48,7 +48,7 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
return-object v0 return-object v0
""" """
) )
} ?: throw GetBearerTokenFingerprint.toErrorResult() } ?: throw GetBearerTokenFingerprint.exception
}.let { }.let {
val occurrenceIndex = it.scanResult.stringsScanResult!!.matches.first().index val occurrenceIndex = it.scanResult.stringsScanResult!!.matches.first().index

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.reddit.layout.disablescreenshotpopup.patch package app.revanced.patches.reddit.layout.disablescreenshotpopup.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -19,6 +19,6 @@ class DisableScreenshotPopupPatch : BytecodePatch(
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
DisableScreenshotPopupFingerprint.result?.mutableMethod?.addInstruction(0, "return-void") DisableScreenshotPopupFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
?: throw DisableScreenshotPopupFingerprint.toErrorResult() ?: throw DisableScreenshotPopupFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.reddit.misc.tracking.url.patch package app.revanced.patches.reddit.misc.tracking.url.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -22,7 +22,7 @@ class SanitizeUrlQueryPatch : BytecodePatch(
ShareLinkFormatterFingerprint.result?.mutableMethod?.addInstructions( ShareLinkFormatterFingerprint.result?.mutableMethod?.addInstructions(
0, 0,
"return-object p0" "return-object p0"
) ?: throw ShareLinkFormatterFingerprint.toErrorResult() ) ?: throw ShareLinkFormatterFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.shared.misc.fix.verticalscroll.patch package app.revanced.patches.shared.misc.fix.verticalscroll.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
@@ -27,6 +27,6 @@ class VerticalScrollPatch : BytecodePatch(
"const/4 v$moveResultRegister, 0x0" "const/4 v$moveResultRegister, 0x0"
) )
} }
} ?: throw CanScrollVerticallyFingerprint.toErrorResult() } ?: throw CanScrollVerticallyFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.solidexplorer2.functionality.filesize.patch package app.revanced.patches.solidexplorer2.functionality.filesize.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
@@ -23,5 +23,5 @@ class RemoveFileSizeLimitPatch : BytecodePatch(listOf(OnReadyFingerprint)) {
val cmpResultRegister = result.mutableMethod.getInstruction<ThreeRegisterInstruction>(cmpIndex).registerA val cmpResultRegister = result.mutableMethod.getInstruction<ThreeRegisterInstruction>(cmpIndex).registerA
result.mutableMethod.replaceInstruction(cmpIndex, "const/4 v${cmpResultRegister}, 0x0") result.mutableMethod.replaceInstruction(cmpIndex, "const/4 v${cmpResultRegister}, 0x0")
} ?: throw OnReadyFingerprint.toErrorResult() } ?: throw OnReadyFingerprint.exception
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.songpal.badge.patch package app.revanced.patches.songpal.badge.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -50,7 +50,7 @@ class BadgeTabPatch : BytecodePatch(
""" """
) )
} ?: throw CreateTabsFingerprint.toErrorResult() } ?: throw CreateTabsFingerprint.exception
} }
companion object { companion object {

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.songpal.badge.patch package app.revanced.patches.songpal.badge.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -20,6 +20,6 @@ class RemoveNotificationBadgePatch : BytecodePatch(
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
ShowNotificationFingerprint.result?.mutableMethod?.apply { ShowNotificationFingerprint.result?.mutableMethod?.apply {
addInstructions(0, "return-void") addInstructions(0, "return-void")
} ?: throw ShowNotificationFingerprint.toErrorResult() } ?: throw ShowNotificationFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.spotify.lite.ondemand.patch package app.revanced.patches.spotify.lite.ondemand.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -24,6 +24,6 @@ class OnDemandPatch : BytecodePatch(
val insertIndex = scanResult.patternScanResult!!.endIndex - 1 val insertIndex = scanResult.patternScanResult!!.endIndex - 1
// Spoof a premium account // Spoof a premium account
mutableMethod.addInstruction(insertIndex, "const/4 v0, 0x2") mutableMethod.addInstruction(insertIndex, "const/4 v0, 0x2")
} ?: throw OnDemandFingerprint.toErrorResult() } ?: throw OnDemandFingerprint.exception
} }
} }

View File

@@ -0,0 +1,11 @@
package app.revanced.patches.strava.subscription.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode
object GetSubscribedFingerprint : MethodFingerprint(
opcodes = listOf(Opcode.IGET_BOOLEAN),
customFingerprint = { methodDef, classDef ->
classDef.type.endsWith("SubscriptionDetailResponse;") && methodDef.name == "getSubscribed"
}
)

View File

@@ -0,0 +1,23 @@
package app.revanced.patches.strava.subscription.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Package
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.strava.subscription.fingerprints.GetSubscribedFingerprint
@Patch
@Name("Unlock subscription features")
@Description("Unlocks \"Matched Runs\" and \"Segment Efforts\".")
@Compatibility([Package("com.strava", ["320.12"])])
class UnlockSubscriptionPatch : BytecodePatch(listOf(GetSubscribedFingerprint)) {
override fun execute(context: BytecodeContext) = GetSubscribedFingerprint.result?.let { result ->
val isSubscribedIndex = result.scanResult.patternScanResult!!.startIndex
result.mutableMethod.replaceInstruction(isSubscribedIndex, "const/4 v0, 0x1")
} ?: throw GetSubscribedFingerprint.exception
}

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.tiktok.interaction.seekbar.patch package app.revanced.patches.tiktok.interaction.seekbar.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -40,7 +40,7 @@ class ShowSeekbarPatch : BytecodePatch(
const/16 v$typeRegister, 0x64 const/16 v$typeRegister, 0x64
""" """
) )
} ?: throw SetSeekBarShowTypeFingerprint.toErrorResult() } ?: throw SetSeekBarShowTypeFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.tiktok.misc.settings.patch package app.revanced.patches.tiktok.misc.settings.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -34,9 +34,9 @@ class SettingsPatch : BytecodePatch(
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
// Find the class name of classes which construct a settings entry // Find the class name of classes which construct a settings entry
val settingsButtonClass = SettingsEntryFingerprint.result?.classDef?.type?.toClassName() val settingsButtonClass = SettingsEntryFingerprint.result?.classDef?.type?.toClassName()
?: throw SettingsEntryFingerprint.toErrorResult() ?: throw SettingsEntryFingerprint.exception
val settingsButtonInfoClass = SettingsEntryInfoFingerprint.result?.classDef?.type?.toClassName() val settingsButtonInfoClass = SettingsEntryInfoFingerprint.result?.classDef?.type?.toClassName()
?: throw SettingsEntryInfoFingerprint.toErrorResult() ?: throw SettingsEntryInfoFingerprint.exception
// Create a settings entry for 'revanced settings' and add it to settings fragment // Create a settings entry for 'revanced settings' and add it to settings fragment
AddSettingsEntryFingerprint.result?.apply { AddSettingsEntryFingerprint.result?.apply {
@@ -64,7 +64,7 @@ class SettingsPatch : BytecodePatch(
""" """
) )
} }
} ?: throw AddSettingsEntryFingerprint.toErrorResult() } ?: throw AddSettingsEntryFingerprint.exception
// Initialize the settings menu once the replaced setting entry is clicked. // Initialize the settings menu once the replaced setting entry is clicked.
AdPersonalizationActivityOnCreateFingerprint.result?.mutableMethod?.apply { AdPersonalizationActivityOnCreateFingerprint.result?.mutableMethod?.apply {
@@ -85,7 +85,7 @@ class SettingsPatch : BytecodePatch(
""", """,
ExternalLabel("notrevanced", getInstruction(initializeSettingsIndex)) ExternalLabel("notrevanced", getInstruction(initializeSettingsIndex))
) )
} ?: throw AdPersonalizationActivityOnCreateFingerprint.toErrorResult() } ?: throw AdPersonalizationActivityOnCreateFingerprint.exception
} }
private fun String.toClassName(): String { private fun String.toClassName(): String {

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.trakt.patch package app.revanced.patches.trakt.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -25,13 +25,13 @@ class UnlockProPatch : BytecodePatch(
arrayOf(IsVIPFingerprint, IsVIPEPFingerprint).onEach { fingerprint -> arrayOf(IsVIPFingerprint, IsVIPEPFingerprint).onEach { fingerprint ->
// Resolve both fingerprints on the same class. // Resolve both fingerprints on the same class.
if (!fingerprint.resolve(context, remoteUserClass)) if (!fingerprint.resolve(context, remoteUserClass))
throw fingerprint.toErrorResult() throw fingerprint.exception
}.forEach { fingerprint -> }.forEach { fingerprint ->
// Return true for both VIP check methods. // Return true for both VIP check methods.
fingerprint.result?.mutableMethod?.addInstructions(0, RETURN_TRUE_INSTRUCTIONS) fingerprint.result?.mutableMethod?.addInstructions(0, RETURN_TRUE_INSTRUCTIONS)
?: throw fingerprint.toErrorResult() ?: throw fingerprint.exception
} }
} ?: throw RemoteUserFingerprint.toErrorResult() } ?: throw RemoteUserFingerprint.exception
} }
private companion object { private companion object {

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.twelvewidgets.unlock.patch package app.revanced.patches.twelvewidgets.unlock.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.* import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
@@ -32,7 +32,7 @@ class UnlockPaidWidgetsPatch : BytecodePatch(
ScreentimeSmallWidgetUnlockFingerprint, ScreentimeSmallWidgetUnlockFingerprint,
WeatherWidgetUnlockFingerprint WeatherWidgetUnlockFingerprint
).map { fingerprint -> ).map { fingerprint ->
fingerprint.result?.mutableMethod ?: throw fingerprint.toErrorResult() fingerprint.result?.mutableMethod ?: throw fingerprint.exception
}.forEach { method -> }.forEach { method ->
method.apply { method.apply {
removeInstructions(4, 3) removeInstructions(4, 3)

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.twitch.ad.video.patch package app.revanced.patches.twitch.ad.video.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -95,7 +95,7 @@ class VideoAdsPatch : AbstractAdPatch(
""", """,
ExternalLabel(skipLabelName, mutableMethod.getInstruction(0)) ExternalLabel(skipLabelName, mutableMethod.getInstruction(0))
) )
} ?: throw CheckAdEligibilityLambdaFingerprint.toErrorResult() } ?: throw CheckAdEligibilityLambdaFingerprint.exception
GetReadyToShowAdFingerprint.result?.apply { GetReadyToShowAdFingerprint.result?.apply {
val adFormatDeclined = "Ltv/twitch/android/shared/display/ads/theatre/StreamDisplayAdsPresenter\$Action\$AdFormatDeclined;" val adFormatDeclined = "Ltv/twitch/android/shared/display/ads/theatre/StreamDisplayAdsPresenter\$Action\$AdFormatDeclined;"
@@ -110,7 +110,7 @@ class VideoAdsPatch : AbstractAdPatch(
""", """,
ExternalLabel(skipLabelName, mutableMethod.getInstruction(0)) ExternalLabel(skipLabelName, mutableMethod.getInstruction(0))
) )
} ?: throw GetReadyToShowAdFingerprint.toErrorResult() } ?: throw GetReadyToShowAdFingerprint.exception
// Spoof showAds JSON field // Spoof showAds JSON field
ContentConfigShowAdsFingerprint.result?.apply { ContentConfigShowAdsFingerprint.result?.apply {
@@ -121,7 +121,7 @@ class VideoAdsPatch : AbstractAdPatch(
return v0 return v0
""" """
) )
} ?: throw ContentConfigShowAdsFingerprint.toErrorResult() } ?: throw ContentConfigShowAdsFingerprint.exception
SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences( SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences(
SwitchPreference( SwitchPreference(

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.twitch.chat.antidelete.patch package app.revanced.patches.twitch.chat.antidelete.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -51,11 +51,11 @@ class ShowDeletedMessagesPatch : BytecodePatch(
""", """,
ExternalLabel("no_spoiler", getInstruction(implementation!!.instructions.lastIndex)) ExternalLabel("no_spoiler", getInstruction(implementation!!.instructions.lastIndex))
) )
} ?: throw DeletedMessageClickableSpanCtorFingerprint.toErrorResult() } ?: throw DeletedMessageClickableSpanCtorFingerprint.exception
// Spoiler mode: Disable setHasModAccess setter // Spoiler mode: Disable setHasModAccess setter
SetHasModAccessFingerprint.result?.mutableMethod?.addInstruction(0, "return-void") SetHasModAccessFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
?: throw SetHasModAccessFingerprint.toErrorResult() ?: throw SetHasModAccessFingerprint.exception
// Cross-out mode: Reformat span of deleted message // Cross-out mode: Reformat span of deleted message
ChatUtilCreateDeletedSpanFingerprint.result?.mutableMethod?.apply { ChatUtilCreateDeletedSpanFingerprint.result?.mutableMethod?.apply {
@@ -69,7 +69,7 @@ class ShowDeletedMessagesPatch : BytecodePatch(
""", """,
ExternalLabel("no_reformat", getInstruction(0)) ExternalLabel("no_reformat", getInstruction(0))
) )
} ?: throw ChatUtilCreateDeletedSpanFingerprint.toErrorResult() } ?: throw ChatUtilCreateDeletedSpanFingerprint.exception
SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences( SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences(
ListPreference( ListPreference(

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.twitch.chat.autoclaim.patch package app.revanced.patches.twitch.chat.autoclaim.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -60,6 +60,6 @@ class AutoClaimChannelPointPatch : BytecodePatch(
""", """,
ExternalLabel("auto_claim", getInstruction(lastIndex)) ExternalLabel("auto_claim", getInstruction(lastIndex))
) )
} ?: throw CommunityPointsButtonViewDelegateFingerprint.toErrorResult() } ?: throw CommunityPointsButtonViewDelegateFingerprint.exception
} }
} }

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.twitch.debug.patch package app.revanced.patches.twitch.debug.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -44,7 +44,7 @@ class DebugModePatch : BytecodePatch(
return v0 return v0
""" """
) )
} ?: throw it.toErrorResult() } ?: throw it.exception
} }
SettingsPatch.PreferenceScreen.MISC.OTHER.addPreferences( SettingsPatch.PreferenceScreen.MISC.OTHER.addPreferences(

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.twitch.misc.settings.bytecode.patch package app.revanced.patches.twitch.misc.settings.bytecode.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -55,7 +55,7 @@ class SettingsPatch : BytecodePatch(
""", """,
ExternalLabel("no_rv_settings_init", mutableMethod.getInstruction(insertIndex)) ExternalLabel("no_rv_settings_init", mutableMethod.getInstruction(insertIndex))
) )
} ?: throw SettingsActivityOnCreateFingerprint.toErrorResult() } ?: throw SettingsActivityOnCreateFingerprint.exception
// Create new menu item for settings menu // Create new menu item for settings menu
SettingsMenuItemEnumFingerprint.result?.apply { SettingsMenuItemEnumFingerprint.result?.apply {
@@ -65,7 +65,7 @@ class SettingsPatch : BytecodePatch(
REVANCED_SETTINGS_MENU_ITEM_TITLE_RES, REVANCED_SETTINGS_MENU_ITEM_TITLE_RES,
REVANCED_SETTINGS_MENU_ITEM_ICON_RES REVANCED_SETTINGS_MENU_ITEM_ICON_RES
) )
} ?: throw SettingsMenuItemEnumFingerprint.toErrorResult() } ?: throw SettingsMenuItemEnumFingerprint.exception
// Intercept settings menu creation and add new menu item // Intercept settings menu creation and add new menu item
MenuGroupsUpdatedFingerprint.result?.apply { MenuGroupsUpdatedFingerprint.result?.apply {
@@ -77,7 +77,7 @@ class SettingsPatch : BytecodePatch(
move-result-object p1 move-result-object p1
""" """
) )
} ?: throw MenuGroupsUpdatedFingerprint.toErrorResult() } ?: throw MenuGroupsUpdatedFingerprint.exception
// Intercept onclick events for the settings menu // Intercept onclick events for the settings menu
MenuGroupsOnClickFingerprint.result?.apply { MenuGroupsOnClickFingerprint.result?.apply {
@@ -94,7 +94,7 @@ class SettingsPatch : BytecodePatch(
""", """,
ExternalLabel("no_rv_settings_onclick", mutableMethod.getInstruction(insertIndex)) ExternalLabel("no_rv_settings_onclick", mutableMethod.getInstruction(insertIndex))
) )
} ?: throw MenuGroupsOnClickFingerprint.toErrorResult() } ?: throw MenuGroupsOnClickFingerprint.exception
addString("revanced_settings", "ReVanced Settings", false) addString("revanced_settings", "ReVanced Settings", false)
addString("revanced_reboot_message", "Twitch needs to restart to apply your changes. Restart now?", false) addString("revanced_reboot_message", "Twitch needs to restart to apply your changes. Restart now?", false)

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.vsco.misc.pro.patch package app.revanced.patches.vsco.misc.pro.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.* import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
@@ -25,6 +25,6 @@ class UnlockProPatch : BytecodePatch(
const p1, 0x1 const p1, 0x1
""" """
) )
} ?: throw RevCatSubscriptionFingerprint.toErrorResult() } ?: throw RevCatSubscriptionFingerprint.exception
} }
} }

View File

@@ -3,7 +3,7 @@ package app.revanced.patches.youtube.ad.general.annotation
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class HideAdsCompatibility internal annotation class HideAdsCompatibility

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.ad.getpremium.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class HideGetPremiumCompatibility internal annotation class HideGetPremiumCompatibility

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.ad.getpremium.bytecode.patch package app.revanced.patches.youtube.ad.getpremium.bytecode.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
@@ -62,7 +62,7 @@ class HideGetPremiumPatch : BytecodePatch(listOf(GetPremiumViewFingerprint)) {
""" """
) )
} }
} ?: throw GetPremiumViewFingerprint.toErrorResult() } ?: throw GetPremiumViewFingerprint.exception
} }
private companion object { private companion object {

View File

@@ -3,7 +3,7 @@ package app.revanced.patches.youtube.ad.video.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class VideoAdsCompatibility internal annotation class VideoAdsCompatibility

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.interaction.copyvideourl.annotation
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class CopyVideoUrlCompatibility internal annotation class CopyVideoUrlCompatibility

View File

@@ -3,7 +3,7 @@ package app.revanced.patches.youtube.interaction.downloads.annotation
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class ExternalDownloadsCompatibility internal annotation class ExternalDownloadsCompatibility

View File

@@ -3,7 +3,7 @@ package app.revanced.patches.youtube.interaction.seekbar.annotation
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class SeekbarTappingCompatibility internal annotation class SeekbarTappingCompatibility

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.interaction.seekbar.patch package app.revanced.patches.youtube.interaction.seekbar.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -43,7 +43,7 @@ class EnableSeekbarTappingPatch : BytecodePatch(
} }
} }
seekbarTappingMethods ?: throw OnTouchEventHandlerFingerprint.toErrorResult() seekbarTappingMethods ?: throw OnTouchEventHandlerFingerprint.exception
SeekbarTappingFingerprint.result?.let { SeekbarTappingFingerprint.result?.let {
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1 val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1
@@ -72,6 +72,6 @@ class EnableSeekbarTappingPatch : BytecodePatch(
ExternalLabel("disabled", getInstruction(insertIndex)) ExternalLabel("disabled", getInstruction(insertIndex))
) )
} }
} ?: throw SeekbarTappingFingerprint.toErrorResult() } ?: throw SeekbarTappingFingerprint.exception
} }
} }

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.interaction.swipecontrols.annotation
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class SwipeControlsCompatibility internal annotation class SwipeControlsCompatibility

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.autocaptions.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class AutoCaptionsCompatibility internal annotation class AutoCaptionsCompatibility

View File

@@ -3,7 +3,9 @@ package app.revanced.patches.youtube.layout.branding.icon.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.* import app.revanced.patcher.patch.OptionsContainer
import app.revanced.patcher.patch.PatchOption
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils
@@ -11,7 +13,7 @@ import app.revanced.util.resources.ResourceUtils.copyResources
import java.io.File import java.io.File
import java.nio.file.Files import java.nio.file.Files
@Patch @Patch(false)
@Name("Custom branding") @Name("Custom branding")
@Description("Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).") @Description("Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).")
@CustomBrandingCompatibility @CustomBrandingCompatibility

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.action.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class HideButtonsCompatibility internal annotation class HideButtonsCompatibility

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.autoplay.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class AutoplayButtonCompatibility internal annotation class AutoplayButtonCompatibility

View File

@@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.buttons.autoplay.patch package app.revanced.patches.youtube.layout.buttons.autoplay.patch
import app.revanced.extensions.findIndexForIdResource import app.revanced.extensions.findIndexForIdResource
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -68,6 +68,6 @@ class HideAutoplayButtonPatch : BytecodePatch(
""", """,
ExternalLabel("hidden", jumpInstruction) ExternalLabel("hidden", jumpInstruction)
) )
} ?: throw LayoutConstructorFingerprint.toErrorResult() } ?: throw LayoutConstructorFingerprint.exception
} }
} }

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.captions.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class HideCaptionsButtonCompatibility internal annotation class HideCaptionsButtonCompatibility

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.navigation.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class NavigationButtonsCompatibility internal annotation class NavigationButtonsCompatibility

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.buttons.navigation.patch package app.revanced.patches.youtube.layout.buttons.navigation.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -101,7 +101,7 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
initializeButtonsResult.mutableClass initializeButtonsResult.mutableClass
) )
) )
throw it.toErrorResult() throw it.exception
} }
.map { it.result!!.scanResult.patternScanResult!! } .map { it.result!!.scanResult.patternScanResult!! }
@@ -150,7 +150,7 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
""" """
) )
} }
} ?: throw AddCreateButtonViewFingerprint.toErrorResult() } ?: throw AddCreateButtonViewFingerprint.exception
/* /*
* Resolve fingerprints * Resolve fingerprints
@@ -158,7 +158,7 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
InitializeButtonsFingerprint.result!!.let { InitializeButtonsFingerprint.result!!.let {
if (!PivotBarCreateButtonViewFingerprint.resolve(context, it.mutableMethod, it.mutableClass)) if (!PivotBarCreateButtonViewFingerprint.resolve(context, it.mutableMethod, it.mutableClass))
throw PivotBarCreateButtonViewFingerprint.toErrorResult() throw PivotBarCreateButtonViewFingerprint.exception
} }
PivotBarCreateButtonViewFingerprint.result!!.apply { PivotBarCreateButtonViewFingerprint.result!!.apply {

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.buttons.navigation.patch package app.revanced.patches.youtube.layout.buttons.navigation.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
@@ -28,8 +28,8 @@ class ResolvePivotBarFingerprintsPatch : BytecodePatch(
context, context,
it.classDef it.classDef
) )
) throw InitializeButtonsFingerprint.toErrorResult() ) throw InitializeButtonsFingerprint.exception
} ?: throw PivotBarConstructorFingerprint.toErrorResult() } ?: throw PivotBarConstructorFingerprint.exception
} }
internal companion object { internal companion object {

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.player.hide.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class HidePlayerButtonsCompatibility internal annotation class HidePlayerButtonsCompatibility

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.buttons.player.hide.patch package app.revanced.patches.youtube.layout.buttons.player.hide.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -67,6 +67,6 @@ class HidePlayerButtonsPatch : BytecodePatch(
move-result v$hasPreviousParameterRegister move-result v$hasPreviousParameterRegister
""" """
) )
} ?: throw PlayerControlsVisibilityModelFingerprint.toErrorResult() } ?: throw PlayerControlsVisibilityModelFingerprint.exception
} }
} }

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.albumcards.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class AlbumCardsCompatibility internal annotation class AlbumCardsCompatibility

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.hide.albumcards.bytecode.patch package app.revanced.patches.youtube.layout.hide.albumcards.bytecode.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -41,6 +41,6 @@ class AlbumCardsPatch : BytecodePatch(
"hideAlbumCard(Landroid/view/View;)V" "hideAlbumCard(Landroid/view/View;)V"
) )
} }
} ?: throw AlbumCardsFingerprint.toErrorResult() } ?: throw AlbumCardsFingerprint.exception
} }
} }

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.breakingnews.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class BreakingNewsCompatibility internal annotation class BreakingNewsCompatibility

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.hide.breakingnews.bytecode.patch package app.revanced.patches.youtube.layout.hide.breakingnews.bytecode.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -42,7 +42,7 @@ class BreakingNewsPatch : BytecodePatch(
) )
} }
} ?: throw BreakingNewsFingerprint.toErrorResult() } ?: throw BreakingNewsFingerprint.exception
} }
} }

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.comments.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class HideCommentsCompatibility internal annotation class HideCommentsCompatibility

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.crowdfundingbox.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class CrowdfundingBoxCompatibility internal annotation class CrowdfundingBoxCompatibility

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.hide.crowdfundingbox.bytecode.patch package app.revanced.patches.youtube.layout.hide.crowdfundingbox.bytecode.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -33,7 +33,7 @@ class CrowdfundingBoxPatch : BytecodePatch(
addInstruction(insertIndex, "invoke-static {v$objectRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR") addInstruction(insertIndex, "invoke-static {v$objectRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR")
} }
} ?: throw CrowdfundingBoxFingerprint.toErrorResult() } ?: throw CrowdfundingBoxFingerprint.exception
} }
private companion object { private companion object {

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.endscreencards.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class HideEndscreenCardsCompatibility internal annotation class HideEndscreenCardsCompatibility

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.hide.endscreencards.bytecode.patch package app.revanced.patches.youtube.layout.hide.endscreencards.bytecode.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -32,7 +32,7 @@ class HideEndscreenCardsPatch : BytecodePatch(
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
fun MethodFingerprint.injectHideCall() { fun MethodFingerprint.injectHideCall() {
val layoutResult = result ?: throw toErrorResult() val layoutResult = result ?: throw exception
layoutResult.mutableMethod.apply { layoutResult.mutableMethod.apply {
val insertIndex = layoutResult.scanResult.patternScanResult!!.endIndex + 1 val insertIndex = layoutResult.scanResult.patternScanResult!!.endIndex + 1
val viewRegister = getInstruction<Instruction21c>(insertIndex - 1).registerA val viewRegister = getInstruction<Instruction21c>(insertIndex - 1).registerA

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.filterbar.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class HideFilterBar internal annotation class HideFilterBar

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.hide.filterbar.patch package app.revanced.patches.youtube.layout.hide.filterbar.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -76,6 +76,6 @@ class HideFilterBarPatch : BytecodePatch(
addInstructions(insertIndex, instructions(register)) addInstructions(insertIndex, instructions(register))
} }
} ?: throw toErrorResult() } ?: throw exception
} }
} }

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.floatingmicrophone.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class HideFloatingMicrophoneButtonCompatibility internal annotation class HideFloatingMicrophoneButtonCompatibility

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.hide.floatingmicrophone.patch package app.revanced.patches.youtube.layout.hide.floatingmicrophone.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -35,7 +35,7 @@ class HideFloatingMicrophoneButtonPatch : BytecodePatch(
""" """
) )
} }
} ?: throw ShowFloatingMicrophoneButtonFingerprint.toErrorResult() } ?: throw ShowFloatingMicrophoneButtonFingerprint.exception
} }
private companion object { private companion object {

View File

@@ -3,7 +3,7 @@ package app.revanced.patches.youtube.layout.hide.general.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class HideLayoutComponentsCompatibility internal annotation class HideLayoutComponentsCompatibility

View File

@@ -1,9 +0,0 @@
package app.revanced.patches.youtube.layout.hide.general.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode
object ConvertElementToFlatBufferFingerprint : MethodFingerprint(
strings = listOf("Failed to convert Element to Flatbuffers: %s"),
opcodes = listOf(Opcode.IGET_OBJECT) // Patched at this opcodes index
)

View File

@@ -0,0 +1,10 @@
package app.revanced.patches.youtube.layout.hide.general.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode
object ParseElementFromBufferFingerprint : MethodFingerprint(
parameters = listOf("L","L","[B", "L","L"),
opcodes = listOf(Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT),
strings = listOf("Failed to parse Element")
)

View File

@@ -1,12 +1,12 @@
package app.revanced.patches.youtube.layout.hide.general.patch package app.revanced.patches.youtube.layout.hide.general.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
@@ -15,10 +15,12 @@ import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.shared.settings.preference.impl.TextPreference import app.revanced.patches.shared.settings.preference.impl.TextPreference
import app.revanced.patches.youtube.layout.hide.general.annotations.HideLayoutComponentsCompatibility import app.revanced.patches.youtube.layout.hide.general.annotations.HideLayoutComponentsCompatibility
import app.revanced.patches.youtube.layout.hide.general.fingerprints.ConvertElementToFlatBufferFingerprint import app.revanced.patches.youtube.layout.hide.general.fingerprints.ParseElementFromBufferFingerprint
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch.PreferenceScreen import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch.PreferenceScreen
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
@Patch @Patch
@Name("Hide layout components") @Name("Hide layout components")
@@ -26,7 +28,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch.P
@DependsOn([LithoFilterPatch::class, SettingsPatch::class]) @DependsOn([LithoFilterPatch::class, SettingsPatch::class])
@HideLayoutComponentsCompatibility @HideLayoutComponentsCompatibility
class HideLayoutComponentsPatch : BytecodePatch( class HideLayoutComponentsPatch : BytecodePatch(
listOf(ConvertElementToFlatBufferFingerprint) listOf(ParseElementFromBufferFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
PreferenceScreen.LAYOUT.addPreferences( PreferenceScreen.LAYOUT.addPreferences(
@@ -249,30 +251,26 @@ class HideLayoutComponentsPatch : BytecodePatch(
// region Mix playlists // region Mix playlists
ConvertElementToFlatBufferFingerprint.result?.let { ParseElementFromBufferFingerprint.result?.let { result ->
val returnEmptyComponentIndex = it.scanResult.stringsScanResult!!.matches.first().index + 2 val returnEmptyComponentInstruction = result.mutableMethod.getInstructions()
.last { it.opcode == Opcode.INVOKE_STATIC }
it.mutableMethod.apply { result.mutableMethod.apply {
// The last virtual register (not parameter). Used to store the byte array val consumeByteBufferIndex = result.scanResult.patternScanResult!!.startIndex
// that may contain information about a mix playlist. val byteBufferRegister = getInstruction<FiveRegisterInstruction>(consumeByteBufferIndex).registerD
val freeRegister = (implementation!!.registerCount - 1) - parameterTypes.size - 1
// Check if the byte array contains anything about a mix playlist.
addInstructionsWithLabels( addInstructionsWithLabels(
it.scanResult.patternScanResult!!.startIndex, result.scanResult.patternScanResult!!.startIndex,
""" """
invoke-static {v$freeRegister}, $FILTER_CLASS_DESCRIPTOR->filterMixPlaylists([B)Z invoke-static {v$byteBufferRegister}, $FILTER_CLASS_DESCRIPTOR->filterMixPlaylists([B)Z
move-result v$freeRegister move-result v0 # Conveniently same register happens to be free.
if-nez v$freeRegister, :return_empty_component if-nez v0, :return_empty_component
""", """,
ExternalLabel("return_empty_component", getInstruction(returnEmptyComponentIndex)) ExternalLabel("return_empty_component", returnEmptyComponentInstruction)
) )
// Move the byte array to a free register.
addInstruction(0, "move-object/from16 v$freeRegister, p3")
} }
} ?: throw ConvertElementToFlatBufferFingerprint.toErrorResult() } ?: throw ParseElementFromBufferFingerprint.exception
// endregion // endregion
} }

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.infocards.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class HideInfocardsCompatibility internal annotation class HideInfocardsCompatibility

View File

@@ -3,7 +3,7 @@ package app.revanced.patches.youtube.layout.hide.loadmorebutton.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class HideLoadMoreButtonCompatibility internal annotation class HideLoadMoreButtonCompatibility

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.hide.loadmorebutton.bytecode.patch package app.revanced.patches.youtube.layout.hide.loadmorebutton.bytecode.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@@ -33,7 +33,7 @@ class HideLoadMoreButtonPatch : BytecodePatch(listOf(HideLoadMoreButtonFingerpri
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideLoadMoreButton(Landroid/view/View;)V" "$INTEGRATIONS_CLASS_DESCRIPTOR->hideLoadMoreButton(Landroid/view/View;)V"
) )
} }
} ?: throw HideLoadMoreButtonFingerprint.toErrorResult() } ?: throw HideLoadMoreButtonFingerprint.exception
} }
private companion object { private companion object {

View File

@@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.hide.personalinformation.annotations
import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38"))]) @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
internal annotation class HideEmailAddressCompatibility internal annotation class HideEmailAddressCompatibility

Some files were not shown because too many files have changed in this diff Show More