build(Needs bump): Bump dependencies

This commit is contained in:
oSumAtrIX 2023-08-19 01:50:29 +02:00
parent c0a13bbb78
commit dba0d0c1ae
214 changed files with 473 additions and 1271 deletions

View File

@ -25,7 +25,7 @@ repositories {
} }
dependencies { dependencies {
implementation("app.revanced:revanced-patcher:13.0.0") implementation("app.revanced:revanced-patcher:14.0.0")
implementation("com.android.tools.smali:smali:3.0.3") implementation("com.android.tools.smali:smali:3.0.3")
// Required because build fails without it. // Required because build fails without it.
// TODO: Find a way to remove this dependency. // TODO: Find a way to remove this dependency.

View File

@ -1,9 +1,10 @@
package app.revanced.extensions package app.revanced.extensions
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
@ -13,13 +14,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.WideLiteralInstruction
import com.android.tools.smali.dexlib2.util.MethodUtil import com.android.tools.smali.dexlib2.util.MethodUtil
import org.w3c.dom.Node import org.w3c.dom.Node
// TODO: populate this to all patches
/** /**
* Convert a [MethodFingerprint] to a [PatchResultError]. * Return [PatchException] from a [MethodFingerprint].
* *
* @return A [PatchResultError] for the [MethodFingerprint]. * @return The [PatchException] for the [MethodFingerprint].
*/ */
internal fun MethodFingerprint.toErrorResult() = PatchResultError("Failed to resolve $name") internal fun MethodFingerprint.toErrorResult() = 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].
@ -82,3 +82,16 @@ fun Method.indexOfFirstConstantInstructionValue(constantValue: Long): Int {
fun Method.containsConstantInstructionValue(constantValue: Long): Boolean { fun Method.containsConstantInstructionValue(constantValue: Long): Boolean {
return indexOfFirstConstantInstructionValue(constantValue) >= 0 return indexOfFirstConstantInstructionValue(constantValue) >= 0
} }
/**
* traverse the class hierarchy starting from the given root class
*
* @param targetClass the class to start traversing the class hierarchy from
* @param callback function that is called for every class in the hierarchy
*/
fun BytecodeContext.traverseClassHierarchy(targetClass: MutableClass, callback: MutableClass.() -> Unit) {
callback(targetClass)
this.findClass(targetClass.superclass ?: return)?.mutableClass?.let {
traverseClassHierarchy(it, callback)
}
}

View File

@ -6,7 +6,6 @@ import app.revanced.patcher.extensions.PatchExtensions.description
import app.revanced.patcher.extensions.PatchExtensions.include import app.revanced.patcher.extensions.PatchExtensions.include
import app.revanced.patcher.extensions.PatchExtensions.options import app.revanced.patcher.extensions.PatchExtensions.options
import app.revanced.patcher.extensions.PatchExtensions.patchName import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.extensions.PatchExtensions.version
import app.revanced.patcher.patch.PatchOption import app.revanced.patcher.patch.PatchOption
import com.google.gson.GsonBuilder import com.google.gson.GsonBuilder
import java.io.File import java.io.File
@ -17,7 +16,6 @@ internal class JsonGenerator : PatchesFileGenerator {
JsonPatch( JsonPatch(
it.patchName, it.patchName,
it.description ?: "This patch has no description.", it.description ?: "This patch has no description.",
it.version ?: "0.0.0",
!it.include, !it.include,
it.options?.map { option -> it.options?.map { option ->
JsonPatch.Option( JsonPatch.Option(
@ -48,7 +46,6 @@ internal class JsonGenerator : PatchesFileGenerator {
private class JsonPatch( private class JsonPatch(
val name: String, val name: String,
val description: String, val description: String,
val version: String,
val excluded: Boolean, val excluded: Boolean,
val options: Array<Option>, val options: Array<Option>,
val dependencies: Array<String>, val dependencies: Array<String>,

View File

@ -1,25 +1,22 @@
package app.revanced.meta package app.revanced.meta
import app.revanced.patcher.data.Context import app.revanced.patcher.PatchBundleLoader
import app.revanced.patcher.patch.Patch import app.revanced.patcher.patch.PatchClass
import app.revanced.patcher.util.patch.PatchBundle
import java.io.File import java.io.File
internal typealias PatchBundlePatches = List<Class<out Patch<Context>>> internal typealias PatchBundlePatches = List<PatchClass>
internal interface PatchesFileGenerator { internal interface PatchesFileGenerator {
fun generate(bundle: PatchBundlePatches) fun generate(bundle: PatchBundlePatches)
private companion object { private companion object {
@JvmStatic @JvmStatic
fun main(args: Array<String>) = PatchBundle.Jar( fun main(args: Array<String>) = PatchBundleLoader.Jar(
File("build/libs/").listFiles()!!.first { File("build/libs/").listFiles { it -> it.name.endsWith(".jar") }!!.first()
it.name.startsWith("revanced-patches-") && it.name.endsWith(".jar") ).also { loader ->
}.absolutePath if (loader.isEmpty()) throw IllegalStateException("No patches found")
).loadPatches().also {
if (it.isEmpty()) throw IllegalStateException("No patches found")
}.let { bundle -> }.let { bundle ->
arrayOf(JsonGenerator()).forEach { it.generate(bundle) } arrayOf(JsonGenerator()).forEach { generator -> generator.generate(bundle) }
} }
} }
} }

View File

@ -1,10 +1,8 @@
package app.revanced.patches.all.activity.exportAll.patch package app.revanced.patches.all.activity.exportall.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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
@ -12,7 +10,7 @@ import app.revanced.patcher.patch.annotations.Patch
@Name("Export all activities") @Name("Export all activities")
@Description("Makes all app activities exportable.") @Description("Makes all app activities exportable.")
class ExportAllActivitiesPatch : ResourcePatch { class ExportAllActivitiesPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext) {
context.xmlEditor["AndroidManifest.xml"].use { editor -> context.xmlEditor["AndroidManifest.xml"].use { editor ->
val document = editor.file val document = editor.file
val activities = document.getElementsByTagName("activity") val activities = document.getElementsByTagName("activity")
@ -33,8 +31,6 @@ class ExportAllActivitiesPatch : ResourcePatch {
} }
} }
} }
return PatchResultSuccess()
} }
private companion object { private companion object {

View File

@ -3,8 +3,6 @@ package app.revanced.patches.all.interaction.gestures.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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
@ -12,7 +10,7 @@ import app.revanced.patcher.patch.annotations.Patch
@Name("Predictive back gesture") @Name("Predictive back gesture")
@Description("Enables the predictive back gesture introduced on Android 13.") @Description("Enables the predictive back gesture introduced on Android 13.")
class PredictiveBackGesturePatch : ResourcePatch { class PredictiveBackGesturePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext) {
context.xmlEditor["AndroidManifest.xml"].use { editor -> context.xmlEditor["AndroidManifest.xml"].use { editor ->
val document = editor.file val document = editor.file
@ -25,8 +23,6 @@ class PredictiveBackGesturePatch : ResourcePatch {
} }
} }
return PatchResultSuccess()
} }
private companion object { private companion object {

View File

@ -11,7 +11,7 @@ import org.w3c.dom.Element
@Name("Enable android debugging") @Name("Enable android debugging")
@Description("Enables Android debugging capabilities.") @Description("Enables Android debugging capabilities.")
class EnableAndroidDebuggingPatch : ResourcePatch { class EnableAndroidDebuggingPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext) {
context.xmlEditor["AndroidManifest.xml"].use { dom -> context.xmlEditor["AndroidManifest.xml"].use { dom ->
val applicationNode = dom val applicationNode = dom
.file .file
@ -21,8 +21,6 @@ class EnableAndroidDebuggingPatch : ResourcePatch {
// set application as debuggable // set application as debuggable
applicationNode.setAttribute("android:debuggable", "true") applicationNode.setAttribute("android:debuggable", "true")
} }
return PatchResultSuccess()
} }
} }

View File

@ -2,9 +2,8 @@ package app.revanced.patches.all.misc.network.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.annotation.Version
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.* import app.revanced.patcher.patch.ResourcePatch
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
import app.revanced.patches.all.misc.debugging.patch.EnableAndroidDebuggingPatch import app.revanced.patches.all.misc.debugging.patch.EnableAndroidDebuggingPatch
@ -16,8 +15,7 @@ import java.io.File
@Description("Overrides certificate pinning, allowing to inspect traffic via a proxy.") @Description("Overrides certificate pinning, allowing to inspect traffic via a proxy.")
@DependsOn([EnableAndroidDebuggingPatch::class]) @DependsOn([EnableAndroidDebuggingPatch::class])
class OverrideCertificatePinningPatch : ResourcePatch { class OverrideCertificatePinningPatch : ResourcePatch {
override fun execute(context: ResourceContext) {
override fun execute(context: ResourceContext): PatchResult {
val resXmlDirectory = context["res/xml"] val resXmlDirectory = context["res/xml"]
// Add android:networkSecurityConfig="@xml/network_security_config" and the "networkSecurityConfig" attribute if it does not exist. // Add android:networkSecurityConfig="@xml/network_security_config" and the "networkSecurityConfig" attribute if it does not exist.
@ -73,7 +71,5 @@ class OverrideCertificatePinningPatch : ResourcePatch {
} }
} }
return PatchResultSuccess()
} }
} }

View File

@ -11,20 +11,18 @@ import org.w3c.dom.Element
@Name("Change package name") @Name("Change package name")
@Description("Changes the package name. Appends \".revanced\" to the package name by default.") @Description("Changes the package name. Appends \".revanced\" to the package name by default.")
class ChangePackageNamePatch : ResourcePatch { class ChangePackageNamePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext) {
val packageNameToUse = packageName ?: getDefaultPackageName(context) val packageNameToUse = packageName ?: getDefaultPackageName(context)
val packageNameRegex = Regex("^[a-z]\\w*(\\.[a-z]\\w*)+\$") val packageNameRegex = Regex("^[a-z]\\w*(\\.[a-z]\\w*)+\$")
if (!packageNameToUse.matches(packageNameRegex)) if (!packageNameToUse.matches(packageNameRegex))
return PatchResultError("Invalid package name") throw PatchException("Invalid package name")
val originalPackageName = getOriginalPackageName(context) val originalPackageName = getOriginalPackageName(context)
context["AndroidManifest.xml"].apply { context["AndroidManifest.xml"].apply {
readText().replace(originalPackageName, packageNameToUse).let(::writeText) readText().replace(originalPackageName, packageNameToUse).let(::writeText)
} }
return PatchResultSuccess()
} }
private fun getDefaultPackageName(context: ResourceContext): String { private fun getDefaultPackageName(context: ResourceContext): String {

View File

@ -2,14 +2,12 @@ package app.revanced.patches.all.screencapture.removerestriction.resource.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import org.w3c.dom.Element import org.w3c.dom.Element
@Description("Sets allowAudioPlaybackCapture in manifest to true.") @Description("Sets allowAudioPlaybackCapture in manifest to true.")
internal class RemoveCaptureRestrictionResourcePatch : ResourcePatch { internal class RemoveCaptureRestrictionResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext) {
// create an xml editor instance // create an xml editor instance
context.xmlEditor["AndroidManifest.xml"].use { dom -> context.xmlEditor["AndroidManifest.xml"].use { dom ->
// get the application node // get the application node
@ -21,7 +19,5 @@ internal class RemoveCaptureRestrictionResourcePatch : ResourcePatch {
// set allowAudioPlaybackCapture attribute to true // set allowAudioPlaybackCapture attribute to true
applicationNode.setAttribute("android:allowAudioPlaybackCapture", "true") applicationNode.setAttribute("android:allowAudioPlaybackCapture", "true")
} }
return PatchResultSuccess()
} }
} }

View File

@ -7,8 +7,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.backdrops.misc.pro.annotations.ProUnlockCompatibility import app.revanced.patches.backdrops.misc.pro.annotations.ProUnlockCompatibility
import app.revanced.patches.backdrops.misc.pro.fingerprints.ProUnlockFingerprint import app.revanced.patches.backdrops.misc.pro.fingerprints.ProUnlockFingerprint
@ -21,7 +19,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
class ProUnlockPatch : BytecodePatch( class ProUnlockPatch : BytecodePatch(
listOf(ProUnlockFingerprint) listOf(ProUnlockFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
ProUnlockFingerprint.result?.let { result -> ProUnlockFingerprint.result?.let { result ->
val registerIndex = result.scanResult.patternScanResult!!.endIndex - 1 val registerIndex = result.scanResult.patternScanResult!!.endIndex - 1
@ -35,8 +33,6 @@ class ProUnlockPatch : BytecodePatch(
) )
} }
} ?: return ProUnlockFingerprint.toErrorResult() } ?: throw ProUnlockFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.candylinkvpn.annotations.UnlockProCompatibility import app.revanced.patches.candylinkvpn.annotations.UnlockProCompatibility
import app.revanced.patches.candylinkvpn.fingerprints.IsPremiumPurchasedFingerprint import app.revanced.patches.candylinkvpn.fingerprints.IsPremiumPurchasedFingerprint
@ -19,15 +17,13 @@ import app.revanced.patches.candylinkvpn.fingerprints.IsPremiumPurchasedFingerpr
class UnlockProPatch : BytecodePatch( class UnlockProPatch : BytecodePatch(
listOf(IsPremiumPurchasedFingerprint) listOf(IsPremiumPurchasedFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
IsPremiumPurchasedFingerprint.result?.mutableMethod?.addInstructions( IsPremiumPurchasedFingerprint.result?.mutableMethod?.addInstructions(
0, 0,
""" """
const/4 v0, 0x1 const/4 v0, 0x1
return v0 return v0
""" """
) ?: return IsPremiumPurchasedFingerprint.toErrorResult() ) ?: throw IsPremiumPurchasedFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.finanzonline.detection.bootloader.fingerprints.BootStateFingerprint import app.revanced.patches.finanzonline.detection.bootloader.fingerprints.BootStateFingerprint
import app.revanced.patches.finanzonline.detection.bootloader.fingerprints.CreateKeyFingerprint import app.revanced.patches.finanzonline.detection.bootloader.fingerprints.CreateKeyFingerprint
@ -21,7 +19,7 @@ import app.revanced.patches.finanzonline.detection.shared.annotations.DetectionC
class BootloaderDetectionPatch : BytecodePatch( class BootloaderDetectionPatch : BytecodePatch(
listOf(CreateKeyFingerprint, BootStateFingerprint) listOf(CreateKeyFingerprint, BootStateFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
arrayOf(CreateKeyFingerprint, BootStateFingerprint).forEach { fingerprint -> arrayOf(CreateKeyFingerprint, BootStateFingerprint).forEach { fingerprint ->
fingerprint.result?.mutableMethod?.addInstructions( fingerprint.result?.mutableMethod?.addInstructions(
0, 0,
@ -29,9 +27,7 @@ class BootloaderDetectionPatch : BytecodePatch(
const/4 v0, 0x1 const/4 v0, 0x1
return v0 return v0
""" """
) ?: return fingerprint.toErrorResult() ) ?: throw fingerprint.toErrorResult()
} }
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.finanzonline.detection.root.fingerprints.RootDetectionFingerprint import app.revanced.patches.finanzonline.detection.root.fingerprints.RootDetectionFingerprint
import app.revanced.patches.finanzonline.detection.shared.annotations.DetectionCompatibility import app.revanced.patches.finanzonline.detection.shared.annotations.DetectionCompatibility
@ -19,15 +17,13 @@ import app.revanced.patches.finanzonline.detection.shared.annotations.DetectionC
class RootDetectionPatch : BytecodePatch( class RootDetectionPatch : BytecodePatch(
listOf(RootDetectionFingerprint) listOf(RootDetectionFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
RootDetectionFingerprint.result?.mutableMethod?.addInstructions( RootDetectionFingerprint.result?.mutableMethod?.addInstructions(
0, 0,
""" """
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
""" """
) ?: return RootDetectionFingerprint.toErrorResult() ) ?: throw RootDetectionFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -10,8 +10,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.googlerecorder.restrictions.fingerprints.OnApplicationCreateFingerprint import app.revanced.patches.googlerecorder.restrictions.fingerprints.OnApplicationCreateFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@ -23,7 +21,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
class RemoveDeviceRestrictions : BytecodePatch( class RemoveDeviceRestrictions : BytecodePatch(
listOf(OnApplicationCreateFingerprint) listOf(OnApplicationCreateFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
OnApplicationCreateFingerprint.result?.let { OnApplicationCreateFingerprint.result?.let {
val featureStringIndex = it.scanResult.stringsScanResult!!.matches.first().index val featureStringIndex = it.scanResult.stringsScanResult!!.matches.first().index
@ -36,8 +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")
} }
} ?: return OnApplicationCreateFingerprint.toErrorResult() } ?: throw OnApplicationCreateFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.hexeditor.ad.annotations.HexEditorAdsCompatibility import app.revanced.patches.hexeditor.ad.annotations.HexEditorAdsCompatibility
import app.revanced.patches.hexeditor.ad.fingerprints.PrimaryAdsFingerprint import app.revanced.patches.hexeditor.ad.fingerprints.PrimaryAdsFingerprint
@ -20,7 +18,7 @@ class HexEditorAdsPatch : BytecodePatch(
PrimaryAdsFingerprint PrimaryAdsFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val method = PrimaryAdsFingerprint.result!!.mutableMethod val method = PrimaryAdsFingerprint.result!!.mutableMethod
method.replaceInstructions( method.replaceInstructions(
@ -30,7 +28,5 @@ class HexEditorAdsPatch : BytecodePatch(
return v0 return v0
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.iconpackstudio.misc.pro.annotations.UnlockProCompatibility import app.revanced.patches.iconpackstudio.misc.pro.annotations.UnlockProCompatibility
import app.revanced.patches.iconpackstudio.misc.pro.fingerprints.CheckProFingerprint import app.revanced.patches.iconpackstudio.misc.pro.fingerprints.CheckProFingerprint
@ -20,7 +18,7 @@ class UnlockProPatch : BytecodePatch(
CheckProFingerprint CheckProFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val method = CheckProFingerprint.result!!.mutableMethod val method = CheckProFingerprint.result!!.mutableMethod
method.addInstructions( method.addInstructions(
0, 0,
@ -29,7 +27,5 @@ class UnlockProPatch : BytecodePatch(
return v0 return v0
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ 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.addInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.idaustria.detection.root.fingerprints.RootDetectionFingerprint import app.revanced.patches.idaustria.detection.root.fingerprints.RootDetectionFingerprint
import app.revanced.patches.idaustria.detection.shared.annotations.DetectionCompatibility import app.revanced.patches.idaustria.detection.shared.annotations.DetectionCompatibility
@ -18,8 +16,6 @@ import app.revanced.patches.idaustria.detection.shared.annotations.DetectionComp
class RootDetectionPatch : BytecodePatch( class RootDetectionPatch : BytecodePatch(
listOf(RootDetectionFingerprint) listOf(RootDetectionFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) =
RootDetectionFingerprint.result!!.mutableMethod.addInstruction(0, "return-void") RootDetectionFingerprint.result!!.mutableMethod.addInstruction(0, "return-void")
return PatchResultSuccess()
}
} }

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.idaustria.detection.shared.annotations.DetectionCompatibility import app.revanced.patches.idaustria.detection.shared.annotations.DetectionCompatibility
import app.revanced.patches.idaustria.detection.signature.fingerprints.SpoofSignatureFingerprint import app.revanced.patches.idaustria.detection.signature.fingerprints.SpoofSignatureFingerprint
@ -32,7 +30,7 @@ class SpoofSignaturePatch : BytecodePatch(
"bf42c121d620ddfb7914f7a95c713d9e1c1b7bdb4a03d618e40cf7e9e235c0b5687e03b7ab3,publicExponent=10001}" "bf42c121d620ddfb7914f7a95c713d9e1c1b7bdb4a03d618e40cf7e9e235c0b5687e03b7ab3,publicExponent=10001}"
} }
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
SpoofSignatureFingerprint.result!!.mutableMethod.addInstructions( SpoofSignatureFingerprint.result!!.mutableMethod.addInstructions(
0, 0,
""" """
@ -40,6 +38,5 @@ class SpoofSignaturePatch : BytecodePatch(
return-object v0 return-object v0
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.inshorts.ad.annotations.HideAdsCompatibility import app.revanced.patches.inshorts.ad.annotations.HideAdsCompatibility
import app.revanced.patches.inshorts.ad.fingerprints.InshortsAdsFingerprint import app.revanced.patches.inshorts.ad.fingerprints.InshortsAdsFingerprint
@ -19,7 +17,7 @@ import app.revanced.patches.inshorts.ad.fingerprints.InshortsAdsFingerprint
class HideAdsPatch : BytecodePatch( class HideAdsPatch : BytecodePatch(
listOf(InshortsAdsFingerprint) listOf(InshortsAdsFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
InshortsAdsFingerprint.result?.let { result -> InshortsAdsFingerprint.result?.let { result ->
result.apply { result.apply {
mutableMethod.addInstruction( mutableMethod.addInstruction(
@ -29,8 +27,6 @@ class HideAdsPatch : BytecodePatch(
""" """
) )
} }
} ?: return InshortsAdsFingerprint.toErrorResult() } ?: throw InshortsAdsFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -8,8 +8,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.MediaFingerprint import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.MediaFingerprint
@ -32,19 +30,19 @@ class HideTimelineAdsPatch : BytecodePatch(
PaidPartnershipAdFingerprint // Unlike the other ads this one is resolved from all classes. PaidPartnershipAdFingerprint // Unlike the other ads this one is resolved from all classes.
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
// region Resolve required methods to check for ads. // region Resolve required methods to check for ads.
ShowAdFingerprint.result ?: return ShowAdFingerprint.toErrorResult() ShowAdFingerprint.result ?: throw ShowAdFingerprint.toErrorResult()
PaidPartnershipAdFingerprint.result ?: return PaidPartnershipAdFingerprint.toErrorResult() PaidPartnershipAdFingerprint.result ?: throw PaidPartnershipAdFingerprint.toErrorResult()
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
} ?: return MediaFingerprint.toErrorResult() } ?: throw MediaFingerprint.toErrorResult()
// endregion // endregion
@ -99,7 +97,5 @@ class HideTimelineAdsPatch : BytecodePatch(
// endregion // endregion
} }
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ 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.addInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.irplus.ad.annotations.IrplusAdsCompatibility import app.revanced.patches.irplus.ad.annotations.IrplusAdsCompatibility
import app.revanced.patches.irplus.ad.fingerprints.IrplusAdsFingerprint import app.revanced.patches.irplus.ad.fingerprints.IrplusAdsFingerprint
@ -19,13 +17,11 @@ import app.revanced.patches.irplus.ad.fingerprints.IrplusAdsFingerprint
class IrplusAdsPatch : BytecodePatch( class IrplusAdsPatch : BytecodePatch(
listOf(IrplusAdsFingerprint) listOf(IrplusAdsFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val method = IrplusAdsFingerprint.result!!.mutableMethod val method = IrplusAdsFingerprint.result!!.mutableMethod
// By overwriting the second parameter of the method, // By overwriting the second parameter of the method,
// the view which holds the advertisement is removed. // the view which holds the advertisement is removed.
method.addInstruction(0, "const/4 p2, 0x0") method.addInstruction(0, "const/4 p2, 0x0")
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ 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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.lightroom.misc.login.annotations.DisableMandatoryLoginCompatibility import app.revanced.patches.lightroom.misc.login.annotations.DisableMandatoryLoginCompatibility
import app.revanced.patches.lightroom.misc.login.fingerprint.IsLoggedInFingerprint import app.revanced.patches.lightroom.misc.login.fingerprint.IsLoggedInFingerprint
@ -15,13 +13,11 @@ import app.revanced.patches.lightroom.misc.login.fingerprint.IsLoggedInFingerpri
@Name("Disable mandatory login") @Name("Disable mandatory login")
@DisableMandatoryLoginCompatibility @DisableMandatoryLoginCompatibility
class DisableMandatoryLoginPatch : BytecodePatch(listOf(IsLoggedInFingerprint)) { class DisableMandatoryLoginPatch : BytecodePatch(listOf(IsLoggedInFingerprint)) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
IsLoggedInFingerprint.result?.mutableMethod?.apply { IsLoggedInFingerprint.result?.mutableMethod?.apply {
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.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ 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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.lightroom.misc.premium.annotations.UnlockPremiumCompatibility import app.revanced.patches.lightroom.misc.premium.annotations.UnlockPremiumCompatibility
import app.revanced.patches.lightroom.misc.premium.fingerprint.HasPurchasedFingerprint import app.revanced.patches.lightroom.misc.premium.fingerprint.HasPurchasedFingerprint
@ -17,11 +15,9 @@ import app.revanced.patches.lightroom.misc.premium.fingerprint.HasPurchasedFinge
@Description("Unlocks premium features.") @Description("Unlocks premium features.")
@UnlockPremiumCompatibility @UnlockPremiumCompatibility
class UnlockPremiumPatch : BytecodePatch(listOf(HasPurchasedFingerprint)) { class UnlockPremiumPatch : BytecodePatch(listOf(HasPurchasedFingerprint)) {
override fun execute(context: BytecodeContext): PatchResult { 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.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -5,15 +5,13 @@ 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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.memegenerator.detection.license.fingerprint.LicenseValidationFingerprint import app.revanced.patches.memegenerator.detection.license.fingerprint.LicenseValidationFingerprint
@Description("Disables Firebase license validation.") @Description("Disables Firebase license validation.")
class LicenseValidationPatch : BytecodePatch( class LicenseValidationPatch : BytecodePatch(
listOf(LicenseValidationFingerprint) listOf(LicenseValidationFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
LicenseValidationFingerprint.result?.apply { LicenseValidationFingerprint.result?.apply {
mutableMethod.replaceInstructions( mutableMethod.replaceInstructions(
0, 0,
@ -23,7 +21,5 @@ class LicenseValidationPatch : BytecodePatch(
""" """
) )
} ?: throw LicenseValidationFingerprint.toErrorResult() } ?: throw LicenseValidationFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -5,15 +5,13 @@ 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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.memegenerator.detection.signature.fingerprint.VerifySignatureFingerprint import app.revanced.patches.memegenerator.detection.signature.fingerprint.VerifySignatureFingerprint
@Description("Disables detection of incorrect signature.") @Description("Disables detection of incorrect signature.")
class SignatureVerificationPatch : BytecodePatch( class SignatureVerificationPatch : BytecodePatch(
listOf(VerifySignatureFingerprint) listOf(VerifySignatureFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
VerifySignatureFingerprint.result?.apply { VerifySignatureFingerprint.result?.apply {
mutableMethod.replaceInstructions( mutableMethod.replaceInstructions(
0, 0,
@ -23,7 +21,5 @@ class SignatureVerificationPatch : BytecodePatch(
""" """
) )
} ?: throw VerifySignatureFingerprint.toErrorResult() } ?: throw VerifySignatureFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patches.memegenerator.detection.license.patch.LicenseValidationPatch import app.revanced.patches.memegenerator.detection.license.patch.LicenseValidationPatch
@ -28,7 +26,7 @@ class UnlockProVersionPatch : BytecodePatch(
IsFreeVersionFingerprint IsFreeVersionFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
IsFreeVersionFingerprint.result?.apply { IsFreeVersionFingerprint.result?.apply {
mutableMethod.replaceInstructions(0, mutableMethod.replaceInstructions(0,
""" """
@ -37,7 +35,5 @@ class UnlockProVersionPatch : BytecodePatch(
""" """
) )
} ?: throw IsFreeVersionFingerprint.toErrorResult() } ?: throw IsFreeVersionFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ 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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.messenger.ads.inbox.fingerprints.LoadInboxAdsFingerprint import app.revanced.patches.messenger.ads.inbox.fingerprints.LoadInboxAdsFingerprint
@ -17,12 +15,10 @@ import app.revanced.patches.messenger.ads.inbox.fingerprints.LoadInboxAdsFingerp
class HideInboxAdsPatch : BytecodePatch( class HideInboxAdsPatch : BytecodePatch(
listOf(LoadInboxAdsFingerprint) listOf(LoadInboxAdsFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
LoadInboxAdsFingerprint.result?.mutableMethod?.apply { LoadInboxAdsFingerprint.result?.mutableMethod?.apply {
this.replaceInstruction(0, "return-void") this.replaceInstruction(0, "return-void")
} ?: return LoadInboxAdsFingerprint.toErrorResult() } ?: throw LoadInboxAdsFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.messenger.inputfield.fingerprints.SwitchMessangeInputEmojiButtonFingerprint import app.revanced.patches.messenger.inputfield.fingerprints.SwitchMessangeInputEmojiButtonFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@ -17,7 +15,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Description("Disables switching from emoji to sticker search mode in message input field") @Description("Disables switching from emoji to sticker search mode in message input field")
@Compatibility([Package("com.facebook.orca")]) @Compatibility([Package("com.facebook.orca")])
class DisableSwitchingEmojiToStickerInMessageInputField : BytecodePatch(listOf(SwitchMessangeInputEmojiButtonFingerprint)) { class DisableSwitchingEmojiToStickerInMessageInputField : BytecodePatch(listOf(SwitchMessangeInputEmojiButtonFingerprint)) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
SwitchMessangeInputEmojiButtonFingerprint.result?.let { SwitchMessangeInputEmojiButtonFingerprint.result?.let {
val setStringIndex = it.scanResult.patternScanResult!!.startIndex + 2 val setStringIndex = it.scanResult.patternScanResult!!.startIndex + 2
@ -30,7 +28,5 @@ class DisableSwitchingEmojiToStickerInMessageInputField : BytecodePatch(listOf(S
) )
} }
} ?: throw SwitchMessangeInputEmojiButtonFingerprint.toErrorResult() } ?: throw SwitchMessangeInputEmojiButtonFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -8,8 +8,6 @@ import app.revanced.patcher.annotation.Package
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.messenger.inputfield.fingerprints.SendTypingIndicatorFingerprint import app.revanced.patches.messenger.inputfield.fingerprints.SendTypingIndicatorFingerprint
@ -18,10 +16,8 @@ import app.revanced.patches.messenger.inputfield.fingerprints.SendTypingIndicato
@Description("Disables the indicator while typing a message") @Description("Disables the indicator while typing a message")
@Compatibility([Package("com.facebook.orca")]) @Compatibility([Package("com.facebook.orca")])
class DisableTypingIndicator : BytecodePatch(listOf(SendTypingIndicatorFingerprint)) { class DisableTypingIndicator : BytecodePatch(listOf(SendTypingIndicatorFingerprint)) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
SendTypingIndicatorFingerprint.result?.mutableMethod?.replaceInstruction(0, "return-void") SendTypingIndicatorFingerprint.result?.mutableMethod?.replaceInstruction(0, "return-void")
?: throw SendTypingIndicatorFingerprint.toErrorResult() ?: throw SendTypingIndicatorFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.moneymanager.annotations.UnlockProCompatibility import app.revanced.patches.moneymanager.annotations.UnlockProCompatibility
import app.revanced.patches.moneymanager.fingerprints.UnlockProFingerprint import app.revanced.patches.moneymanager.fingerprints.UnlockProFingerprint
@ -18,7 +16,7 @@ import app.revanced.patches.moneymanager.fingerprints.UnlockProFingerprint
class UnlockProPatch : BytecodePatch( class UnlockProPatch : BytecodePatch(
listOf(UnlockProFingerprint) listOf(UnlockProFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
UnlockProFingerprint.result!!.mutableMethod.addInstructions( UnlockProFingerprint.result!!.mutableMethod.addInstructions(
0, 0,
""" """
@ -26,6 +24,5 @@ class UnlockProPatch : BytecodePatch(
return v0 return v0
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsConstructorFingerprint import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsConstructorFingerprint
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsFingerprint import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsFingerprint
@ -20,7 +18,7 @@ import app.revanced.patches.music.annotations.MusicCompatibility
class MusicVideoAdsPatch : BytecodePatch( class MusicVideoAdsPatch : BytecodePatch(
listOf(ShowMusicVideoAdsConstructorFingerprint) listOf(ShowMusicVideoAdsConstructorFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
ShowMusicVideoAdsFingerprint.resolve(context, ShowMusicVideoAdsConstructorFingerprint.result!!.classDef) ShowMusicVideoAdsFingerprint.resolve(context, ShowMusicVideoAdsConstructorFingerprint.result!!.classDef)
val result = ShowMusicVideoAdsFingerprint.result!! val result = ShowMusicVideoAdsFingerprint.result!!
@ -31,7 +29,5 @@ class MusicVideoAdsPatch : BytecodePatch(
const/4 p1, 0x0 const/4 p1, 0x0
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -3,10 +3,7 @@ package app.revanced.patches.music.audio.codecs.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.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.toInstruction import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patches.music.annotations.MusicCompatibility import app.revanced.patches.music.annotations.MusicCompatibility
@ -23,7 +20,7 @@ class CodecsUnlockPatch : BytecodePatch(
CodecsLockFingerprint, AllCodecsReferenceFingerprint CodecsLockFingerprint, AllCodecsReferenceFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val codecsLockResult = CodecsLockFingerprint.result!! val codecsLockResult = CodecsLockFingerprint.result!!
val implementation = codecsLockResult.mutableMethod.implementation!! val implementation = codecsLockResult.mutableMethod.implementation!!
@ -48,7 +45,5 @@ class CodecsUnlockPatch : BytecodePatch(
instructionIndex, instructionIndex,
"invoke-static {}, ${allCodecsMethod.definingClass}->${allCodecsMethod.name}()Ljava/util/Set;".toInstruction() "invoke-static {}, ${allCodecsMethod.definingClass}->${allCodecsMethod.name}()Ljava/util/Set;".toInstruction()
) )
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.AudioOnlyEnablerFingerprint
@ -19,11 +17,9 @@ import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AudioOnlyEna
class ExclusiveAudioPatch : BytecodePatch( class ExclusiveAudioPatch : BytecodePatch(
listOf(AudioOnlyEnablerFingerprint) listOf(AudioOnlyEnablerFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val method = AudioOnlyEnablerFingerprint.result!!.mutableMethod val method = AudioOnlyEnablerFingerprint.result!!.mutableMethod
method.replaceInstruction(method.implementation!!.instructions.count() - 1, "const/4 v0, 0x1") method.replaceInstruction(method.implementation!!.instructions.count() - 1, "const/4 v0, 0x1")
method.addInstruction("return v0") method.addInstruction("return v0")
return PatchResultSuccess()
} }
} }

View File

@ -7,8 +7,6 @@ import app.revanced.patcher.data.BytecodeContext
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.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.music.annotations.MusicCompatibility import app.revanced.patches.music.annotations.MusicCompatibility
@ -21,7 +19,7 @@ import app.revanced.patches.music.interaction.permanentrepeat.fingerprints.Repea
class PermanentRepeatPatch : BytecodePatch( class PermanentRepeatPatch : BytecodePatch(
listOf(RepeatTrackFingerprint) listOf(RepeatTrackFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
RepeatTrackFingerprint.result?.let { RepeatTrackFingerprint.result?.let {
val startIndex = it.scanResult.patternScanResult!!.endIndex val startIndex = it.scanResult.patternScanResult!!.endIndex
val repeatIndex = startIndex + 3 val repeatIndex = startIndex + 3
@ -33,8 +31,6 @@ class PermanentRepeatPatch : BytecodePatch(
ExternalLabel("repeat", getInstruction(repeatIndex)) ExternalLabel("repeat", getInstruction(repeatIndex))
) )
} }
} ?: return RepeatTrackFingerprint.toErrorResult() } ?: throw RepeatTrackFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ 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.addInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.interaction.permanentshuffle.fingerprints.DisableShuffleFingerprint import app.revanced.patches.music.interaction.permanentshuffle.fingerprints.DisableShuffleFingerprint
@ -20,10 +18,8 @@ import app.revanced.patches.music.interaction.permanentshuffle.fingerprints.Disa
class PermanentShuffleTogglePatch : BytecodePatch( class PermanentShuffleTogglePatch : BytecodePatch(
listOf(DisableShuffleFingerprint) listOf(DisableShuffleFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
DisableShuffleFingerprint.result?.mutableMethod?.addInstruction(0, "return-void") DisableShuffleFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
?: return DisableShuffleFingerprint.toErrorResult() ?: throw DisableShuffleFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.layout.compactheader.fingerprints.CompactHeaderConstructorFingerprint import app.revanced.patches.music.layout.compactheader.fingerprints.CompactHeaderConstructorFingerprint
@ -19,7 +17,7 @@ import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction11x
class CompactHeaderPatch : BytecodePatch( class CompactHeaderPatch : BytecodePatch(
listOf(CompactHeaderConstructorFingerprint) listOf(CompactHeaderConstructorFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val result = CompactHeaderConstructorFingerprint.result!! val result = CompactHeaderConstructorFingerprint.result!!
val method = result.mutableMethod val method = result.mutableMethod
@ -31,7 +29,5 @@ class CompactHeaderPatch : BytecodePatch(
invoke-virtual {v${register}, v2}, Landroid/view/View;->setVisibility(I)V invoke-virtual {v${register}, v2}, Landroid/view/View;->setVisibility(I)V
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ 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.addInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.layout.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint import app.revanced.patches.music.layout.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint
@ -18,14 +16,12 @@ import app.revanced.patches.music.layout.minimizedplayback.fingerprints.Minimize
class MinimizedPlaybackPatch : BytecodePatch( class MinimizedPlaybackPatch : BytecodePatch(
listOf(MinimizedPlaybackManagerFingerprint) listOf(MinimizedPlaybackManagerFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
MinimizedPlaybackManagerFingerprint.result!!.mutableMethod.addInstruction( MinimizedPlaybackManagerFingerprint.result!!.mutableMethod.addInstruction(
0, 0,
""" """
return-void return-void
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -7,8 +7,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.layout.premium.fingerprints.HideGetPremiumFingerprint import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumFingerprint
@ -21,7 +19,7 @@ import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumPare
class HideGetPremiumPatch : BytecodePatch( class HideGetPremiumPatch : BytecodePatch(
listOf(HideGetPremiumParentFingerprint) listOf(HideGetPremiumParentFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val parentResult = HideGetPremiumParentFingerprint.result!! val parentResult = HideGetPremiumParentFingerprint.result!!
HideGetPremiumFingerprint.resolve(context, parentResult.classDef) HideGetPremiumFingerprint.resolve(context, parentResult.classDef)
@ -43,7 +41,5 @@ class HideGetPremiumPatch : BytecodePatch(
const/16 v0, 0x8 const/16 v0, 0x8
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.toInstructions import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.music.annotations.MusicCompatibility import app.revanced.patches.music.annotations.MusicCompatibility
@ -24,7 +22,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
class RemoveUpgradeButtonPatch : BytecodePatch( class RemoveUpgradeButtonPatch : BytecodePatch(
listOf(PivotBarConstructorFingerprint) listOf(PivotBarConstructorFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val result = PivotBarConstructorFingerprint.result!! val result = PivotBarConstructorFingerprint.result!!
val implementation = result.mutableMethod.implementation!! val implementation = result.mutableMethod.implementation!!
@ -69,6 +67,5 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
implementation.addInstructions( implementation.addInstructions(
endIndex, instructionList endIndex, instructionList
) )
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.misc.androidauto.fingerprints.CheckCertificateFingerprint import app.revanced.patches.music.misc.androidauto.fingerprints.CheckCertificateFingerprint
@ -19,7 +17,7 @@ import app.revanced.patches.music.misc.androidauto.fingerprints.CheckCertificate
class BypassCertificateChecksPatch : BytecodePatch( class BypassCertificateChecksPatch : BytecodePatch(
listOf(CheckCertificateFingerprint) listOf(CheckCertificateFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
CheckCertificateFingerprint.result?.apply { CheckCertificateFingerprint.result?.apply {
mutableMethod.addInstructions( mutableMethod.addInstructions(
0, """ 0, """
@ -27,8 +25,6 @@ class BypassCertificateChecksPatch : BytecodePatch(
return v0 return v0
""" """
) )
} ?: return CheckCertificateFingerprint.toErrorResult() } ?: throw CheckCertificateFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -4,7 +4,6 @@ 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.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patches.music.annotations.MusicCompatibility import app.revanced.patches.music.annotations.MusicCompatibility
@ -37,27 +36,25 @@ class MicroGBytecodePatch : BytecodePatch(
// - "com.google.android.gms.phenotype.PACKAGE_NAME", // - "com.google.android.gms.phenotype.PACKAGE_NAME",
// - "com.google.android.gms.phenotype.UPDATE", // - "com.google.android.gms.phenotype.UPDATE",
// - "com.google.android.gms.phenotype", // - "com.google.android.gms.phenotype",
override fun execute(context: BytecodeContext) = override fun execute(context: BytecodeContext) = MicroGBytecodeHelper.patchBytecode(
// apply common microG patch context,
MicroGBytecodeHelper.patchBytecode( arrayOf(
context, MicroGBytecodeHelper.packageNameTransform(
arrayOf( Constants.PACKAGE_NAME,
MicroGBytecodeHelper.packageNameTransform( Constants.REVANCED_PACKAGE_NAME
Constants.PACKAGE_NAME,
Constants.REVANCED_PACKAGE_NAME
)
),
MicroGBytecodeHelper.PrimeMethodTransformationData(
PrimeFingerprint,
MUSIC_PACKAGE_NAME,
REVANCED_MUSIC_PACKAGE_NAME
),
listOf(
ServiceCheckFingerprint,
GooglePlayUtilityFingerprint,
CastDynamiteModuleFingerprint,
CastDynamiteModuleV2Fingerprint,
CastContextFetchFingerprint
) )
).let { PatchResultSuccess() } ),
MicroGBytecodeHelper.PrimeMethodTransformationData(
PrimeFingerprint,
MUSIC_PACKAGE_NAME,
REVANCED_MUSIC_PACKAGE_NAME
),
listOf(
ServiceCheckFingerprint,
GooglePlayUtilityFingerprint,
CastDynamiteModuleFingerprint,
CastDynamiteModuleV2Fingerprint,
CastContextFetchFingerprint
)
)
} }

View File

@ -2,8 +2,6 @@ package app.revanced.patches.music.misc.microg.patch.resource
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_APP_NAME import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_APP_NAME
@ -15,7 +13,7 @@ import app.revanced.util.microg.MicroGResourceHelper
@Description("Resource patch to allow YouTube Music ReVanced to run without root and under a different package name.") @Description("Resource patch to allow YouTube Music ReVanced to run without root and under a different package name.")
class MicroGResourcePatch : ResourcePatch { class MicroGResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext) {
// update manifest // update manifest
MicroGResourceHelper.patchManifest( MicroGResourceHelper.patchManifest(
context, context,
@ -30,6 +28,5 @@ class MicroGResourcePatch : ResourcePatch {
SPOOFED_PACKAGE_NAME, SPOOFED_PACKAGE_NAME,
SPOOFED_PACKAGE_SIGNATURE SPOOFED_PACKAGE_SIGNATURE
) )
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.premium.backgroundplay.fingerprints.BackgroundPlaybackDisableFingerprint import app.revanced.patches.music.premium.backgroundplay.fingerprints.BackgroundPlaybackDisableFingerprint
@ -18,7 +16,7 @@ import app.revanced.patches.music.premium.backgroundplay.fingerprints.Background
class BackgroundPlayPatch : BytecodePatch( class BackgroundPlayPatch : BytecodePatch(
listOf(BackgroundPlaybackDisableFingerprint) listOf(BackgroundPlaybackDisableFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
BackgroundPlaybackDisableFingerprint.result!!.mutableMethod.addInstructions( BackgroundPlaybackDisableFingerprint.result!!.mutableMethod.addInstructions(
0, 0,
""" """
@ -26,7 +24,5 @@ class BackgroundPlayPatch : BytecodePatch(
return v0 return v0
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.myexpenses.misc.pro.annotations.UnlockProCompatibility import app.revanced.patches.myexpenses.misc.pro.annotations.UnlockProCompatibility
import app.revanced.patches.myexpenses.misc.pro.fingerprints.IsEnabledFingerprint import app.revanced.patches.myexpenses.misc.pro.fingerprints.IsEnabledFingerprint
@ -20,7 +18,7 @@ class UnlockProPatch : BytecodePatch(
IsEnabledFingerprint IsEnabledFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val method = IsEnabledFingerprint.result!!.mutableMethod val method = IsEnabledFingerprint.result!!.mutableMethod
method.addInstructions( method.addInstructions(
0, 0,
@ -29,7 +27,5 @@ class UnlockProPatch : BytecodePatch(
return v0 return v0
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -3,8 +3,6 @@ package app.revanced.patches.netguard.broadcasts.removerestriction.resource.patc
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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.netguard.broadcasts.removerestriction.resource.annotations.RemoveBroadcastsRestrictionCompatibility import app.revanced.patches.netguard.broadcasts.removerestriction.resource.annotations.RemoveBroadcastsRestrictionCompatibility
@ -15,7 +13,7 @@ import org.w3c.dom.Element
@Description("Enables starting/stopping NetGuard via broadcasts.") @Description("Enables starting/stopping NetGuard via broadcasts.")
@RemoveBroadcastsRestrictionCompatibility @RemoveBroadcastsRestrictionCompatibility
class RemoveBroadcastsRestrictionPatch : ResourcePatch { class RemoveBroadcastsRestrictionPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext) {
context.xmlEditor["AndroidManifest.xml"].use { dom -> context.xmlEditor["AndroidManifest.xml"].use { dom ->
val applicationNode = dom val applicationNode = dom
.file .file
@ -32,7 +30,5 @@ class RemoveBroadcastsRestrictionPatch : ResourcePatch {
} }
} }
} }
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.nfctoolsse.misc.pro.annotations.UnlockProCompatibility import app.revanced.patches.nfctoolsse.misc.pro.annotations.UnlockProCompatibility
import app.revanced.patches.nfctoolsse.misc.pro.fingerprints.IsLicenseRegisteredFingerprint import app.revanced.patches.nfctoolsse.misc.pro.fingerprints.IsLicenseRegisteredFingerprint
@ -22,7 +20,7 @@ class UnlockProPatch : BytecodePatch(
IsLicenseRegisteredFingerprint IsLicenseRegisteredFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
IsLicenseRegisteredFingerprint.result?.mutableMethod?.apply { IsLicenseRegisteredFingerprint.result?.mutableMethod?.apply {
addInstructions( addInstructions(
0, 0,
@ -31,9 +29,7 @@ class UnlockProPatch : BytecodePatch(
return v0 return v0
""" """
) )
} ?: return IsLicenseRegisteredFingerprint.toErrorResult() } ?: throw IsLicenseRegisteredFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.nyx.misc.pro.annotations.UnlockProCompatibility import app.revanced.patches.nyx.misc.pro.annotations.UnlockProCompatibility
import app.revanced.patches.nyx.misc.pro.fingerprints.CheckProFingerprint import app.revanced.patches.nyx.misc.pro.fingerprints.CheckProFingerprint
@ -20,7 +18,7 @@ class UnlockProPatch : BytecodePatch(
CheckProFingerprint CheckProFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val method = CheckProFingerprint.result!!.mutableMethod val method = CheckProFingerprint.result!!.mutableMethod
method.addInstructions( method.addInstructions(
0, 0,
@ -29,7 +27,5 @@ class UnlockProPatch : BytecodePatch(
return v0 return v0
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.photomath.detection.signature.fingerprints.CheckSignatureFingerprint import app.revanced.patches.photomath.detection.signature.fingerprints.CheckSignatureFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@ -17,15 +15,13 @@ class SignatureDetectionPatch : BytecodePatch(
CheckSignatureFingerprint CheckSignatureFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
CheckSignatureFingerprint.result?.apply { CheckSignatureFingerprint.result?.apply {
val signatureCheckInstruction = mutableMethod.getInstruction(scanResult.patternScanResult!!.endIndex) val signatureCheckInstruction = mutableMethod.getInstruction(scanResult.patternScanResult!!.endIndex)
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.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patches.photomath.detection.signature.patch.SignatureDetectionPatch import app.revanced.patches.photomath.detection.signature.patch.SignatureDetectionPatch
@ -24,7 +22,7 @@ class UnlockPlusPatch : BytecodePatch(
IsPlusUnlockedFingerprint IsPlusUnlockedFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
IsPlusUnlockedFingerprint.result?.mutableMethod?.apply { IsPlusUnlockedFingerprint.result?.mutableMethod?.apply {
addInstructions( addInstructions(
0, 0,
@ -33,9 +31,7 @@ class UnlockPlusPatch : BytecodePatch(
return v0 return v0
""" """
) )
} ?: return IsPlusUnlockedFingerprint.toErrorResult() } ?: throw IsPlusUnlockedFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ 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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.pixiv.ads.fingerprints.IsNotPremiumFingerprint import app.revanced.patches.pixiv.ads.fingerprints.IsNotPremiumFingerprint
@ -15,7 +13,7 @@ import app.revanced.patches.pixiv.ads.fingerprints.IsNotPremiumFingerprint
@Description("Hides ads.") @Description("Hides ads.")
@Compatibility([Package("jp.pxv.android")]) @Compatibility([Package("jp.pxv.android")])
class HideAdsPatch : BytecodePatch(listOf(IsNotPremiumFingerprint)) { class HideAdsPatch : BytecodePatch(listOf(IsNotPremiumFingerprint)) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
// Always return false in the "isNotPremium" method which normally returns !this.accountManager.isPremium. // Always return false in the "isNotPremium" method which normally returns !this.accountManager.isPremium.
// However, this is not the method that controls the user's premium status. // However, this is not the method that controls the user's premium status.
// Instead, this method is used to determine whether ads should be shown. // Instead, this method is used to determine whether ads should be shown.
@ -25,8 +23,6 @@ class HideAdsPatch : BytecodePatch(listOf(IsNotPremiumFingerprint)) {
const/4 v0, 0x0 const/4 v0, 0x0
return v0 return v0
""" """
) ?: return IsNotPremiumFingerprint.toErrorResult() ) ?: throw IsNotPremiumFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -3,14 +3,12 @@ package app.revanced.patches.reddit.ad.banner.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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
@Name("Hide subreddit banner") @Name("Hide subreddit banner")
@Description("Hides banner ads from comments on subreddits.") @Description("Hides banner ads from comments on subreddits.")
class HideBannerPatch : ResourcePatch { class HideBannerPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext) {
context.xmlEditor[RESOURCE_FILE_PATH].use { context.xmlEditor[RESOURCE_FILE_PATH].use {
it.file.getElementsByTagName("merge").item(0).childNodes.apply { it.file.getElementsByTagName("merge").item(0).childNodes.apply {
val attributes = arrayOf("height", "width") val attributes = arrayOf("height", "width")
@ -30,8 +28,6 @@ class HideBannerPatch : ResourcePatch {
} }
} }
} }
return PatchResultSuccess()
} }
private companion object { private companion object {

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.reddit.ad.comments.fingerprints.HideCommentAdsFingerprint import app.revanced.patches.reddit.ad.comments.fingerprints.HideCommentAdsFingerprint
@Name("Hide comment ads") @Name("Hide comment ads")
@ -14,7 +12,7 @@ import app.revanced.patches.reddit.ad.comments.fingerprints.HideCommentAdsFinger
class HideCommentAdsPatch : BytecodePatch( class HideCommentAdsPatch : BytecodePatch(
listOf(HideCommentAdsFingerprint) listOf(HideCommentAdsFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val method = HideCommentAdsFingerprint.result!!.mutableMethod val method = HideCommentAdsFingerprint.result!!.mutableMethod
// Returns a blank object instead of the comment ad. // Returns a blank object instead of the comment ad.
method.addInstructions( method.addInstructions(
@ -25,6 +23,5 @@ class HideCommentAdsPatch : BytecodePatch(
return-object v0 return-object v0
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patcher.patch.annotations.RequiresIntegrations import app.revanced.patcher.patch.annotations.RequiresIntegrations
@ -31,7 +29,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
class HideAdsPatch : BytecodePatch( class HideAdsPatch : BytecodePatch(
listOf(AdPostFingerprint, NewAdPostFingerprint) listOf(AdPostFingerprint, NewAdPostFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
// region Filter promoted ads (does not work in popular or latest feed) // region Filter promoted ads (does not work in popular or latest feed)
AdPostFingerprint.result?.mutableMethod?.apply { AdPostFingerprint.result?.mutableMethod?.apply {
@ -78,8 +76,6 @@ class HideAdsPatch : BytecodePatch(
} }
// endregion // endregion
return PatchResultSuccess()
} }
private companion object { private companion object {

View File

@ -5,7 +5,10 @@ import app.revanced.extensions.toErrorResult
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
import app.revanced.patcher.patch.* import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.OptionsContainer
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.PatchOption
import java.io.File import java.io.File
abstract class AbstractSpoofClientPatch( abstract class AbstractSpoofClientPatch(
@ -17,13 +20,13 @@ abstract class AbstractSpoofClientPatch(
addAll(clientIdFingerprints) addAll(clientIdFingerprints)
userAgentFingerprints?.let(::addAll) userAgentFingerprints?.let(::addAll)
}) { }) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
if (options.clientId == null) { if (options.clientId == null) {
// Ensure device runs Android. // Ensure device runs Android.
try { try {
Class.forName("android.os.Environment") Class.forName("android.os.Environment")
} catch (e: ClassNotFoundException) { } catch (e: ClassNotFoundException) {
return PatchResultError("No client ID provided") throw PatchException("No client ID provided")
} }
File(Environment.getExternalStorageDirectory(), "reddit_client_id_revanced.txt").also { File(Environment.getExternalStorageDirectory(), "reddit_client_id_revanced.txt").also {
@ -38,22 +41,16 @@ abstract class AbstractSpoofClientPatch(
The application type has to be "Installed app" and the redirect URI has to be set to "$redirectUri". The application type has to be "Installed app" and the redirect URI has to be set to "$redirectUri".
""".trimIndent() """.trimIndent()
return PatchResultError(error) throw PatchException(error)
}.let { options.clientId = it.readText().trim() } }.let { options.clientId = it.readText().trim() }
} }
fun List<MethodFingerprint>?.executePatch( fun List<MethodFingerprint>?.executePatch(
patch: List<MethodFingerprintResult>.(BytecodeContext) -> PatchResult patch: List<MethodFingerprintResult>.(BytecodeContext) -> Unit
) { ) = this?.map { it.result ?: throw it.toErrorResult() }?.patch(context)
when (val result = this?.map { it.result ?: throw it.toErrorResult() }?.patch(context)) {
is PatchResultError -> throw result
}
}
clientIdFingerprints.executePatch { patchClientId(context) } clientIdFingerprints.executePatch { patchClientId(context) }
userAgentFingerprints.executePatch { patchUserAgent(context) } userAgentFingerprints.executePatch { patchUserAgent(context) }
return PatchResultSuccess()
} }
/** /**
@ -62,7 +59,7 @@ abstract class AbstractSpoofClientPatch(
* @param context The current [BytecodeContext]. * @param context The current [BytecodeContext].
* *
*/ */
abstract fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext): PatchResult abstract fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext)
/** /**
* Patch the user agent. The fingerprints are guaranteed to be in the same order as in [userAgentFingerprints]. * Patch the user agent. The fingerprints are guaranteed to be in the same order as in [userAgentFingerprints].
@ -70,8 +67,7 @@ abstract class AbstractSpoofClientPatch(
* @param context The current [BytecodeContext]. * @param context The current [BytecodeContext].
*/ */
// Not every client needs to patch the user agent. // Not every client needs to patch the user agent.
open fun List<MethodFingerprintResult>.patchUserAgent(context: BytecodeContext): PatchResult = open fun List<MethodFingerprintResult>.patchUserAgent(context: BytecodeContext) {}
PatchResultSuccess()
companion object Options { companion object Options {
open class SpoofClientOptionsContainer : OptionsContainer() { open class SpoofClientOptionsContainer : OptionsContainer() {

View File

@ -7,8 +7,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
import app.revanced.patches.reddit.customclients.baconreader.api.fingerprints.GetAuthorizationUrlFingerprint import app.revanced.patches.reddit.customclients.baconreader.api.fingerprints.GetAuthorizationUrlFingerprint
@ -30,7 +28,7 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
"http://baconreader.com/auth", Options, listOf(GetAuthorizationUrlFingerprint, RequestTokenFingerprint) "http://baconreader.com/auth", Options, listOf(GetAuthorizationUrlFingerprint, RequestTokenFingerprint)
) { ) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext): PatchResult { override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
fun MethodFingerprintResult.patch(replacementString: String) { fun MethodFingerprintResult.patch(replacementString: String) {
val clientIdIndex = scanResult.stringsScanResult!!.matches.first().index val clientIdIndex = scanResult.stringsScanResult!!.matches.first().index
@ -48,8 +46,6 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
// Patch client id for access token request. // Patch client id for access token request.
last().patch(clientId!!) last().patch(clientId!!)
return PatchResultSuccess()
} }
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer() companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Package
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
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint
@ -20,7 +18,7 @@ import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints
class SpoofClientPatch : AbstractSpoofClientPatch( class SpoofClientPatch : AbstractSpoofClientPatch(
"http://rubenmayayo.com", Options, listOf(GetClientIdFingerprint) "http://rubenmayayo.com", Options, listOf(GetClientIdFingerprint)
) { ) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext): PatchResult { override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
first().mutableMethod.addInstructions( first().mutableMethod.addInstructions(
0, 0,
""" """
@ -28,8 +26,6 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
return-object v0 return-object v0
""" """
) )
return PatchResultSuccess()
} }
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer() companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()

View File

@ -7,8 +7,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
import app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints.GetHttpBasicAuthHeaderFingerprint import app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints.GetHttpBasicAuthHeaderFingerprint
@ -25,7 +23,7 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
Options, Options,
listOf(GetHttpBasicAuthHeaderFingerprint, LoginActivityOnCreateFingerprint) listOf(GetHttpBasicAuthHeaderFingerprint, LoginActivityOnCreateFingerprint)
) { ) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext): PatchResult { override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
forEach { forEach {
val clientIdIndex = it.scanResult.stringsScanResult!!.matches.first().index val clientIdIndex = it.scanResult.stringsScanResult!!.matches.first().index
it.mutableMethod.apply { it.mutableMethod.apply {
@ -37,8 +35,6 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
) )
} }
} }
return PatchResultSuccess()
} }
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer() companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()

View File

@ -7,8 +7,6 @@ import app.revanced.patcher.annotation.Package
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patches.reddit.customclients.joeyforreddit.ads.fingerprints.IsAdFreeUserFingerprint import app.revanced.patches.reddit.customclients.joeyforreddit.ads.fingerprints.IsAdFreeUserFingerprint
@ -19,15 +17,13 @@ import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.
@DependsOn([DisablePiracyDetectionPatch::class]) @DependsOn([DisablePiracyDetectionPatch::class])
@Compatibility([Package("o.o.joey")]) @Compatibility([Package("o.o.joey")])
class DisableAdsPatch : BytecodePatch(listOf(IsAdFreeUserFingerprint)) { class DisableAdsPatch : BytecodePatch(listOf(IsAdFreeUserFingerprint)) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
IsAdFreeUserFingerprint.result?.mutableMethod?.addInstructions( IsAdFreeUserFingerprint.result?.mutableMethod?.addInstructions(
0, 0,
""" """
const/4 v0, 0x1 const/4 v0, 0x1
return v0 return v0
""" """
) ?: return IsAdFreeUserFingerprint.toErrorResult() ) ?: throw IsAdFreeUserFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Package
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
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
@ -31,7 +29,7 @@ import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.
class SpoofClientPatch : AbstractSpoofClientPatch( class SpoofClientPatch : AbstractSpoofClientPatch(
"https://127.0.0.1:65023/authorize_callback", Options, listOf(GetClientIdFingerprint) "https://127.0.0.1:65023/authorize_callback", Options, listOf(GetClientIdFingerprint)
) { ) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext): PatchResult { override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
first().mutableMethod.addInstructions( first().mutableMethod.addInstructions(
0, 0,
""" """
@ -39,8 +37,6 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
return-object v0 return-object v0
""" """
) )
return PatchResultSuccess()
} }
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer() companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()

View File

@ -4,19 +4,15 @@ import app.revanced.extensions.toErrorResult
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
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint
class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerprint)) { class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerprint)) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
PiracyDetectionFingerprint.result?.mutableMethod?.addInstruction( PiracyDetectionFingerprint.result?.mutableMethod?.addInstruction(
0, 0,
""" """
return-void return-void
""" """
) ?: return PiracyDetectionFingerprint.toErrorResult() ) ?: throw PiracyDetectionFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -9,8 +9,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult.MethodFingerprintScanResult.StringsScanResult.StringMatch import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult.MethodFingerprintScanResult.StringsScanResult.StringMatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.BasicAuthorizationFingerprint import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.BasicAuthorizationFingerprint
@ -29,7 +27,7 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
listOf(BuildAuthorizationStringFingerprint, BasicAuthorizationFingerprint), listOf(BuildAuthorizationStringFingerprint, BasicAuthorizationFingerprint),
listOf(GetUserAgentFingerprint) listOf(GetUserAgentFingerprint)
) { ) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext): PatchResult { override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
/** /**
* Replaces a one register instruction with a const-string instruction * Replaces a one register instruction with a const-string instruction
* at the index returned by [getReplacementIndex]. * at the index returned by [getReplacementIndex].
@ -53,11 +51,9 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
// Path basic authorization. // Path basic authorization.
last().replaceWith("$clientId:") { last().index + 7 } last().replaceWith("$clientId:") { last().index + 7 }
return PatchResultSuccess()
} }
override fun List<MethodFingerprintResult>.patchUserAgent(context: BytecodeContext): PatchResult { override fun List<MethodFingerprintResult>.patchUserAgent(context: BytecodeContext) {
// Use a random user agent. // Use a random user agent.
val randomName = (0..100000).random() val randomName = (0..100000).random()
val userAgent = "android:app.revanced.$randomName:v1.0.0 (by /u/revanced)" val userAgent = "android:app.revanced.$randomName:v1.0.0 (by /u/revanced)"
@ -69,8 +65,6 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
return-object v0 return-object v0
""" """
) )
return PatchResultSuccess()
} }
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer() companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()

View File

@ -7,8 +7,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.GetLoggedInBearerTokenFingerprint import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.GetLoggedInBearerTokenFingerprint
@ -32,7 +30,7 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
GetRefreshTokenFingerprint GetRefreshTokenFingerprint
) )
) { ) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext): PatchResult { override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
forEach { forEach {
val clientIdIndex = it.scanResult.stringsScanResult!!.matches.first().index val clientIdIndex = it.scanResult.stringsScanResult!!.matches.first().index
it.mutableMethod.apply { it.mutableMethod.apply {
@ -44,8 +42,6 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
) )
} }
} }
return PatchResultSuccess()
} }
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer() companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Package
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
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint
@ -20,7 +18,7 @@ import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints
class SpoofClientPatch : AbstractSpoofClientPatch( class SpoofClientPatch : AbstractSpoofClientPatch(
"http://www.ccrama.me", Options, listOf(GetClientIdFingerprint) "http://www.ccrama.me", Options, listOf(GetClientIdFingerprint)
) { ) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext): PatchResult { override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
first().mutableMethod.addInstructions( first().mutableMethod.addInstructions(
0, 0,
""" """
@ -28,8 +26,6 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
return-object v0 return-object v0
""" """
) )
return PatchResultSuccess()
} }
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer() companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()

View File

@ -5,8 +5,6 @@ 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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patches.reddit.customclients.syncforreddit.ads.fingerprints.IsAdsEnabledFingerprint import app.revanced.patches.reddit.customclients.syncforreddit.ads.fingerprints.IsAdsEnabledFingerprint
@ -17,7 +15,7 @@ import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.
@DependsOn([DisablePiracyDetectionPatch::class]) @DependsOn([DisablePiracyDetectionPatch::class])
@Compatibility([Package("com.laurencedawson.reddit_sync")]) @Compatibility([Package("com.laurencedawson.reddit_sync")])
class DisableAdsPatch : BytecodePatch(listOf(IsAdsEnabledFingerprint)) { class DisableAdsPatch : BytecodePatch(listOf(IsAdsEnabledFingerprint)) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
IsAdsEnabledFingerprint.result?.mutableMethod?.apply { IsAdsEnabledFingerprint.result?.mutableMethod?.apply {
addInstructions( addInstructions(
0, 0,
@ -26,9 +24,7 @@ class DisableAdsPatch : BytecodePatch(listOf(IsAdsEnabledFingerprint)) {
return v0 return v0
""" """
) )
} ?: return IsAdsEnabledFingerprint.toErrorResult() } ?: throw IsAdsEnabledFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -7,8 +7,6 @@ import app.revanced.patcher.annotation.Package
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startup.fingerprints.MainActivityOnCreate import app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startup.fingerprints.MainActivityOnCreate
@ -23,13 +21,11 @@ import app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startu
] ]
) )
class DisableSyncForLemmyBottomSheetPatch : BytecodePatch(listOf(MainActivityOnCreate)) { class DisableSyncForLemmyBottomSheetPatch : BytecodePatch(listOf(MainActivityOnCreate)) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
MainActivityOnCreate.result?.mutableMethod?.apply { MainActivityOnCreate.result?.mutableMethod?.apply {
val showBottomSheetIndex = implementation!!.instructions.lastIndex - 1 val showBottomSheetIndex = implementation!!.instructions.lastIndex - 1
removeInstruction(showBottomSheetIndex) removeInstruction(showBottomSheetIndex)
} }
return PatchResultSuccess()
} }
} }

View File

@ -10,8 +10,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
@ -38,7 +36,7 @@ import java.util.*
class SpoofClientPatch : AbstractSpoofClientPatch( class SpoofClientPatch : AbstractSpoofClientPatch(
"http://redditsync/auth", Options, listOf(GetAuthorizationStringFingerprint) "http://redditsync/auth", Options, listOf(GetAuthorizationStringFingerprint)
) { ) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext): PatchResult { override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
forEach { fingerprintResult -> forEach { fingerprintResult ->
fingerprintResult.also { result -> fingerprintResult.also { result ->
GetBearerTokenFingerprint.also { it.resolve(context, result.classDef) }.result?.mutableMethod?.apply { GetBearerTokenFingerprint.also { it.resolve(context, result.classDef) }.result?.mutableMethod?.apply {
@ -50,7 +48,7 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
return-object v0 return-object v0
""" """
) )
} ?: return GetBearerTokenFingerprint.toErrorResult() } ?: throw GetBearerTokenFingerprint.toErrorResult()
}.let { }.let {
val occurrenceIndex = it.scanResult.stringsScanResult!!.matches.first().index val occurrenceIndex = it.scanResult.stringsScanResult!!.matches.first().index
@ -71,8 +69,6 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
} }
} }
} }
return PatchResultSuccess()
} }
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer() companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()

View File

@ -4,13 +4,11 @@ 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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint
@Description("Disables detection of modified versions.") @Description("Disables detection of modified versions.")
class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerprint)) { class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerprint)) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
// Do not return an error if the fingerprint is not resolved. // Do not return an error if the fingerprint is not resolved.
// This is fine because new versions of the target app do not need this patch. // This is fine because new versions of the target app do not need this patch.
PiracyDetectionFingerprint.result?.mutableMethod?.apply { PiracyDetectionFingerprint.result?.mutableMethod?.apply {
@ -21,7 +19,5 @@ class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerpr
""" """
) )
} }
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ 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.addInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.reddit.layout.disablescreenshotpopup.annotations.DisableScreenshotPopupCompatibility import app.revanced.patches.reddit.layout.disablescreenshotpopup.annotations.DisableScreenshotPopupCompatibility
import app.revanced.patches.reddit.layout.disablescreenshotpopup.fingerprints.DisableScreenshotPopupFingerprint import app.revanced.patches.reddit.layout.disablescreenshotpopup.fingerprints.DisableScreenshotPopupFingerprint
@ -19,10 +17,8 @@ import app.revanced.patches.reddit.layout.disablescreenshotpopup.fingerprints.Di
class DisableScreenshotPopupPatch : BytecodePatch( class DisableScreenshotPopupPatch : BytecodePatch(
listOf(DisableScreenshotPopupFingerprint) listOf(DisableScreenshotPopupFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
DisableScreenshotPopupFingerprint.result?.mutableMethod?.addInstruction(0, "return-void") DisableScreenshotPopupFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
?: return DisableScreenshotPopupFingerprint.toErrorResult() ?: throw DisableScreenshotPopupFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.reddit.layout.premiumicon.annotations.PremiumIconCompatibility import app.revanced.patches.reddit.layout.premiumicon.annotations.PremiumIconCompatibility
import app.revanced.patches.reddit.layout.premiumicon.fingerprints.PremiumIconFingerprint import app.revanced.patches.reddit.layout.premiumicon.fingerprints.PremiumIconFingerprint
@ -20,7 +18,7 @@ class PremiumIconPatch : BytecodePatch(
PremiumIconFingerprint PremiumIconFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val method = PremiumIconFingerprint.result!!.mutableMethod val method = PremiumIconFingerprint.result!!.mutableMethod
method.addInstructions( method.addInstructions(
0, 0,
@ -29,6 +27,5 @@ class PremiumIconPatch : BytecodePatch(
return v0 return v0
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.reddit.misc.tracking.url.annotations.SanitizeUrlQueryCompatibility import app.revanced.patches.reddit.misc.tracking.url.annotations.SanitizeUrlQueryCompatibility
import app.revanced.patches.reddit.misc.tracking.url.fingerprints.ShareLinkFormatterFingerprint import app.revanced.patches.reddit.misc.tracking.url.fingerprints.ShareLinkFormatterFingerprint
@ -19,14 +17,12 @@ import app.revanced.patches.reddit.misc.tracking.url.fingerprints.ShareLinkForma
class SanitizeUrlQueryPatch : BytecodePatch( class SanitizeUrlQueryPatch : BytecodePatch(
listOf(ShareLinkFormatterFingerprint) listOf(ShareLinkFormatterFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
ShareLinkFormatterFingerprint.result?.mutableMethod?.addInstructions( ShareLinkFormatterFingerprint.result?.mutableMethod?.addInstructions(
0, 0,
"return-object p0" "return-object p0"
) ?: return ShareLinkFormatterFingerprint.toErrorResult() ) ?: throw ShareLinkFormatterFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.scbeasy.detection.debugging.annotations.RemoveDebuggingDetectionCompatibility import app.revanced.patches.scbeasy.detection.debugging.annotations.RemoveDebuggingDetectionCompatibility
import app.revanced.patches.scbeasy.detection.debugging.fingerprints.DebuggingDetectionFingerprint import app.revanced.patches.scbeasy.detection.debugging.fingerprints.DebuggingDetectionFingerprint
@ -18,7 +16,7 @@ import app.revanced.patches.scbeasy.detection.debugging.fingerprints.DebuggingDe
class RemoveDebuggingDetectionPatch : BytecodePatch( class RemoveDebuggingDetectionPatch : BytecodePatch(
listOf(DebuggingDetectionFingerprint) listOf(DebuggingDetectionFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
DebuggingDetectionFingerprint.result!!.mutableMethod.addInstructions( DebuggingDetectionFingerprint.result!!.mutableMethod.addInstructions(
0, 0,
""" """
@ -26,6 +24,5 @@ class RemoveDebuggingDetectionPatch : BytecodePatch(
return v0 return v0
""" """
) )
return PatchResultSuccess()
} }
} }

View File

@ -5,9 +5,7 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint.RegisterResolver import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint.RegisterResolver
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.ClassDef import com.android.tools.smali.dexlib2.iface.ClassDef
@ -40,7 +38,7 @@ abstract class AbstractIntegrationsPatch(
strings, strings,
customFingerprint customFingerprint
) { ) {
fun invoke(integrationsDescriptor: String): PatchResult { fun invoke(integrationsDescriptor: String) {
result?.mutableMethod?.let { method -> result?.mutableMethod?.let { method ->
val contextRegister = contextRegisterResolver(method) val contextRegister = contextRegisterResolver(method)
@ -49,9 +47,7 @@ abstract class AbstractIntegrationsPatch(
"sput-object v$contextRegister, " + "sput-object v$contextRegister, " +
"$integrationsDescriptor->context:Landroid/content/Context;" "$integrationsDescriptor->context:Landroid/content/Context;"
) )
} ?: return PatchResultError("Could not find hook target fingerprint.") } ?: throw PatchException("Could not find hook target fingerprint.")
return PatchResultSuccess()
} }
interface RegisterResolver : (Method) -> Int { interface RegisterResolver : (Method) -> Int {
@ -59,20 +55,11 @@ abstract class AbstractIntegrationsPatch(
} }
} }
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
if (context.findClass(integrationsDescriptor) == null) return MISSING_INTEGRATIONS if (context.findClass(integrationsDescriptor) == null) throw PatchException(
"Integrations have not been merged yet. This patch can not succeed without merging the integrations."
for (hook in hooks) hook.invoke(integrationsDescriptor).let {
if (it is PatchResultError) return it
}
return PatchResultSuccess()
}
private companion object {
val MISSING_INTEGRATIONS = PatchResultError(
"Integrations have not been merged yet. " +
"This patch can not succeed without merging the integrations."
) )
for (hook in hooks) hook.invoke(integrationsDescriptor)
} }
} }

View File

@ -1,8 +1,6 @@
package app.revanced.patches.shared.mapping.misc.patch package app.revanced.patches.shared.mapping.misc.patch
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import org.w3c.dom.Element import org.w3c.dom.Element
import java.util.* import java.util.*
@ -19,7 +17,7 @@ class ResourceMappingPatch : ResourcePatch {
private val threadPoolExecutor = Executors.newFixedThreadPool(THREAD_COUNT) private val threadPoolExecutor = Executors.newFixedThreadPool(THREAD_COUNT)
} }
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext) {
// save the file in memory to concurrently read from // save the file in memory to concurrently read from
val resourceXmlFile = context["res/values/public.xml"].readBytes() val resourceXmlFile = context["res/values/public.xml"].readBytes()
@ -59,8 +57,6 @@ class ResourceMappingPatch : ResourcePatch {
.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS) .awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS)
resourceMappings = mappings resourceMappings = mappings
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.shared.misc.fix.verticalscroll.annotations.VerticalScrollCompatibility import app.revanced.patches.shared.misc.fix.verticalscroll.annotations.VerticalScrollCompatibility
import app.revanced.patches.shared.misc.fix.verticalscroll.fingerprints.CanScrollVerticallyFingerprint import app.revanced.patches.shared.misc.fix.verticalscroll.fingerprints.CanScrollVerticallyFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@ -17,7 +15,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
class VerticalScrollPatch : BytecodePatch( class VerticalScrollPatch : BytecodePatch(
listOf(CanScrollVerticallyFingerprint) listOf(CanScrollVerticallyFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
CanScrollVerticallyFingerprint.result?.let { CanScrollVerticallyFingerprint.result?.let {
it.mutableMethod.apply { it.mutableMethod.apply {
val moveResultIndex = it.scanResult.patternScanResult!!.endIndex val moveResultIndex = it.scanResult.patternScanResult!!.endIndex
@ -29,8 +27,6 @@ class VerticalScrollPatch : BytecodePatch(
"const/4 v$moveResultRegister, 0x0" "const/4 v$moveResultRegister, 0x0"
) )
} }
} ?: return CanScrollVerticallyFingerprint.toErrorResult() } ?: throw CanScrollVerticallyFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -1,10 +1,8 @@
package app.revanced.patches.shared.settings.resource.patch package app.revanced.patches.shared.settings.resource.patch
import app.revanced.patcher.data.DomFileEditor
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.util.DomFileEditor
import app.revanced.patches.shared.settings.preference.BasePreference import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.BaseResource import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.addPreference import app.revanced.patches.shared.settings.preference.addPreference
@ -26,7 +24,7 @@ abstract class AbstractSettingsResourcePatch(
private val preferenceFileName: String, private val preferenceFileName: String,
private val sourceDirectory: String, private val sourceDirectory: String,
) : ResourcePatch, Closeable { ) : ResourcePatch, Closeable {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext) {
/* /*
* used for self-restart * used for self-restart
* TODO: do this only, when necessary * TODO: do this only, when necessary
@ -51,8 +49,6 @@ abstract class AbstractSettingsResourcePatch(
stringsEditor = context.xmlEditor["res/values/strings.xml"] stringsEditor = context.xmlEditor["res/values/strings.xml"]
arraysEditor = context.xmlEditor["res/values/arrays.xml"] arraysEditor = context.xmlEditor["res/values/arrays.xml"]
revancedPreferencesEditor = context.xmlEditor["res/xml/$preferenceFileName.xml"] revancedPreferencesEditor = context.xmlEditor["res/xml/$preferenceFileName.xml"]
return PatchResultSuccess()
} }
internal companion object { internal companion object {

View File

@ -7,8 +7,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.songpal.badge.annotations.BadgeCompatibility import app.revanced.patches.songpal.badge.annotations.BadgeCompatibility
import app.revanced.patches.songpal.badge.fingerprints.CreateTabsFingerprint import app.revanced.patches.songpal.badge.fingerprints.CreateTabsFingerprint
@ -20,7 +18,7 @@ import app.revanced.patches.songpal.badge.fingerprints.CreateTabsFingerprint
class BadgeTabPatch : BytecodePatch( class BadgeTabPatch : BytecodePatch(
listOf(CreateTabsFingerprint) listOf(CreateTabsFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
CreateTabsFingerprint.result?.mutableMethod?.apply { CreateTabsFingerprint.result?.mutableMethod?.apply {
removeInstructions(0, 2) removeInstructions(0, 2)
@ -52,9 +50,7 @@ class BadgeTabPatch : BytecodePatch(
""" """
) )
} ?: return CreateTabsFingerprint.toErrorResult() } ?: throw CreateTabsFingerprint.toErrorResult()
return PatchResultSuccess()
} }
companion object { companion object {

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.songpal.badge.annotations.BadgeCompatibility import app.revanced.patches.songpal.badge.annotations.BadgeCompatibility
import app.revanced.patches.songpal.badge.fingerprints.ShowNotificationFingerprint import app.revanced.patches.songpal.badge.fingerprints.ShowNotificationFingerprint
@ -19,11 +17,9 @@ import app.revanced.patches.songpal.badge.fingerprints.ShowNotificationFingerpri
class RemoveNotificationBadgePatch : BytecodePatch( class RemoveNotificationBadgePatch : BytecodePatch(
listOf(ShowNotificationFingerprint) listOf(ShowNotificationFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
ShowNotificationFingerprint.result?.mutableMethod?.apply { ShowNotificationFingerprint.result?.mutableMethod?.apply {
addInstructions(0, "return-void") addInstructions(0, "return-void")
} ?: return ShowNotificationFingerprint.toErrorResult() } ?: throw ShowNotificationFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -3,7 +3,9 @@ package app.revanced.patches.spotify.layout.theme.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.spotify.layout.theme.annotations.ThemeCompatibility import app.revanced.patches.spotify.layout.theme.annotations.ThemeCompatibility
import org.w3c.dom.Element import org.w3c.dom.Element
@ -13,7 +15,7 @@ import org.w3c.dom.Element
@Description("Applies a custom theme.") @Description("Applies a custom theme.")
@ThemeCompatibility @ThemeCompatibility
class ThemePatch : ResourcePatch { class ThemePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext) {
context.xmlEditor["res/values/colors.xml"].use { editor -> context.xmlEditor["res/values/colors.xml"].use { editor ->
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
@ -28,8 +30,6 @@ class ThemePatch : ResourcePatch {
} }
} }
} }
return PatchResultSuccess()
} }
companion object : OptionsContainer() { companion object : OptionsContainer() {

View File

@ -6,8 +6,6 @@ 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.addInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.spotify.lite.ondemand.annotations.OnDemandCompatibility import app.revanced.patches.spotify.lite.ondemand.annotations.OnDemandCompatibility
import app.revanced.patches.spotify.lite.ondemand.fingerprints.OnDemandFingerprint import app.revanced.patches.spotify.lite.ondemand.fingerprints.OnDemandFingerprint
@ -21,12 +19,11 @@ class OnDemandPatch : BytecodePatch(
OnDemandFingerprint OnDemandFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
OnDemandFingerprint.result?.apply { OnDemandFingerprint.result?.apply {
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")
} ?: return OnDemandFingerprint.toErrorResult() } ?: throw OnDemandFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patches.spotify.premium_navbar_tab.annotations.PremiumNavbarTabCompatibility import app.revanced.patches.spotify.premium_navbar_tab.annotations.PremiumNavbarTabCompatibility
@ -27,7 +25,7 @@ class PremiumNavbarTabPatch : BytecodePatch(
AddPremiumNavbarTabParentFingerprint AddPremiumNavbarTabParentFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val parentResult = AddPremiumNavbarTabParentFingerprint.result!! val parentResult = AddPremiumNavbarTabParentFingerprint.result!!
AddPremiumNavbarTabFingerprint.resolve(context, parentResult.classDef) AddPremiumNavbarTabFingerprint.resolve(context, parentResult.classDef)
@ -55,7 +53,5 @@ class PremiumNavbarTabPatch : BytecodePatch(
if (--removeAmount == 0) break if (--removeAmount == 0) break
} }
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.ticktick.misc.themeunlock.annotations.UnlockThemesCompatibility import app.revanced.patches.ticktick.misc.themeunlock.annotations.UnlockThemesCompatibility
import app.revanced.patches.ticktick.misc.themeunlock.fingerprints.CheckLockedThemesFingerprint import app.revanced.patches.ticktick.misc.themeunlock.fingerprints.CheckLockedThemesFingerprint
@ -23,7 +21,7 @@ class UnlockProPatch : BytecodePatch(
SetThemeFingerprint SetThemeFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val lockedThemesMethod = CheckLockedThemesFingerprint.result!!.mutableMethod val lockedThemesMethod = CheckLockedThemesFingerprint.result!!.mutableMethod
lockedThemesMethod.addInstructions( lockedThemesMethod.addInstructions(
0, 0,
@ -35,7 +33,5 @@ class UnlockProPatch : BytecodePatch(
val setThemeMethod = SetThemeFingerprint.result!!.mutableMethod val setThemeMethod = SetThemeFingerprint.result!!.mutableMethod
setThemeMethod.removeInstructions(0, 10) setThemeMethod.removeInstructions(0, 10)
return PatchResultSuccess()
} }
} }

View File

@ -5,9 +5,7 @@ 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.addInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.tiktok.ad.annotations.HideAdsCompatibility import app.revanced.patches.tiktok.ad.annotations.HideAdsCompatibility
import app.revanced.patches.tiktok.ad.fingerprints.ConvertHelpFeedItemListFingerprint import app.revanced.patches.tiktok.ad.fingerprints.ConvertHelpFeedItemListFingerprint
@ -27,7 +25,7 @@ class HideAdsPatch : BytecodePatch(
ConvertHelpFeedItemListFingerprint ConvertHelpFeedItemListFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
listOf( listOf(
FeedItemListCloneFingerprint, FeedItemListCloneFingerprint,
ConvertHelpFeedItemListFingerprint ConvertHelpFeedItemListFingerprint
@ -48,8 +46,7 @@ class HideAdsPatch : BytecodePatch(
) )
return@forEach return@forEach
} }
return PatchResultError("Can not find required instruction.") throw PatchException("Can not find required instruction.")
} }
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ 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.addInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patches.tiktok.feedfilter.annotations.FeedFilterCompatibility import app.revanced.patches.tiktok.feedfilter.annotations.FeedFilterCompatibility
@ -28,7 +26,7 @@ class FeedFilterPatch : BytecodePatch(
SettingsStatusLoadFingerprint SettingsStatusLoadFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val method = FeedApiServiceLIZFingerprint.result!!.mutableMethod val method = FeedApiServiceLIZFingerprint.result!!.mutableMethod
for ((index, instruction) in method.implementation!!.instructions.withIndex()) { for ((index, instruction) in method.implementation!!.instructions.withIndex()) {
if (instruction.opcode != Opcode.RETURN_OBJECT) continue if (instruction.opcode != Opcode.RETURN_OBJECT) continue
@ -44,6 +42,5 @@ class FeedFilterPatch : BytecodePatch(
0, 0,
"invoke-static {}, Lapp/revanced/tiktok/settingsmenu/SettingsStatus;->enableFeedFilter()V" "invoke-static {}, Lapp/revanced/tiktok/settingsmenu/SettingsStatus;->enableFeedFilter()V"
) )
return PatchResultSuccess()
} }
} }

View File

@ -3,16 +3,13 @@ package app.revanced.patches.tiktok.interaction.downloads.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.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
@ -43,7 +40,7 @@ class DownloadsPatch : BytecodePatch(
SettingsStatusLoadFingerprint SettingsStatusLoadFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val method1 = ACLCommonShareFingerprint.result!!.mutableMethod val method1 = ACLCommonShareFingerprint.result!!.mutableMethod
method1.replaceInstructions( method1.replaceInstructions(
0, 0,
@ -89,7 +86,7 @@ class DownloadsPatch : BytecodePatch(
targetOffset = index + 1 targetOffset = index + 1
break break
} }
if (targetOffset == -1) return PatchResultError("Can not find download path uri method.") if (targetOffset == -1) throw PatchException("Can not find download path uri method.")
//Change videos' download path. //Change videos' download path.
val downloadUriMethod = context val downloadUriMethod = context
.toMethodWalker(DownloadPathParentFingerprint.result!!.method) .toMethodWalker(DownloadPathParentFingerprint.result!!.method)
@ -125,6 +122,5 @@ class DownloadsPatch : BytecodePatch(
0, 0,
"invoke-static {}, Lapp/revanced/tiktok/settingsmenu/SettingsStatus;->enableDownload()V" "invoke-static {}, Lapp/revanced/tiktok/settingsmenu/SettingsStatus;->enableDownload()V"
) )
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.tiktok.interaction.seekbar.annotations.ShowSeekbarCompatibility import app.revanced.patches.tiktok.interaction.seekbar.annotations.ShowSeekbarCompatibility
import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.SetSeekBarShowTypeFingerprint import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.SetSeekBarShowTypeFingerprint
@ -23,7 +21,7 @@ class ShowSeekbarPatch : BytecodePatch(
ShouldShowSeekBarFingerprint, ShouldShowSeekBarFingerprint,
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
ShouldShowSeekBarFingerprint.result?.mutableMethod?.apply { ShouldShowSeekBarFingerprint.result?.mutableMethod?.apply {
addInstructions( addInstructions(
0, 0,
@ -42,8 +40,7 @@ class ShowSeekbarPatch : BytecodePatch(
const/16 v$typeRegister, 0x64 const/16 v$typeRegister, 0x64
""" """
) )
} ?: return SetSeekBarShowTypeFingerprint.toErrorResult() } ?: throw SetSeekBarShowTypeFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -3,11 +3,8 @@ package app.revanced.patches.tiktok.interaction.speed.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.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.tiktok.interaction.speed.annotations.PlaybackSpeedCompatibility import app.revanced.patches.tiktok.interaction.speed.annotations.PlaybackSpeedCompatibility
@ -23,7 +20,7 @@ class PlaybackSpeedPatch : BytecodePatch(
SpeedControlParentFingerprint SpeedControlParentFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val parentMethod = SpeedControlParentFingerprint.result!!.mutableMethod val parentMethod = SpeedControlParentFingerprint.result!!.mutableMethod
val parentMethodInstructions = parentMethod.implementation!!.instructions val parentMethodInstructions = parentMethod.implementation!!.instructions
for ((index, instruction) in parentMethodInstructions.withIndex()) { for ((index, instruction) in parentMethodInstructions.withIndex()) {
@ -41,6 +38,5 @@ class PlaybackSpeedPatch : BytecodePatch(
) )
break break
} }
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.tiktok.misc.login.disablerequirement.annotations.DisableLoginRequirementCompatibility import app.revanced.patches.tiktok.misc.login.disablerequirement.annotations.DisableLoginRequirementCompatibility
import app.revanced.patches.tiktok.misc.login.disablerequirement.fingerprints.MandatoryLoginServiceFingerprint import app.revanced.patches.tiktok.misc.login.disablerequirement.fingerprints.MandatoryLoginServiceFingerprint
@ -22,7 +20,7 @@ class DisableLoginRequirementPatch : BytecodePatch(
MandatoryLoginServiceFingerprint2 MandatoryLoginServiceFingerprint2
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
listOf( listOf(
MandatoryLoginServiceFingerprint, MandatoryLoginServiceFingerprint,
MandatoryLoginServiceFingerprint2 MandatoryLoginServiceFingerprint2
@ -36,6 +34,5 @@ class DisableLoginRequirementPatch : BytecodePatch(
""" """
) )
} }
return PatchResultSuccess()
} }
} }

View File

@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.tiktok.misc.login.fixgoogle.annotations.FixGoogleLoginCompatibility import app.revanced.patches.tiktok.misc.login.fixgoogle.annotations.FixGoogleLoginCompatibility
import app.revanced.patches.tiktok.misc.login.fixgoogle.fingerprints.GoogleAuthAvailableFingerprint import app.revanced.patches.tiktok.misc.login.fixgoogle.fingerprints.GoogleAuthAvailableFingerprint
@ -22,7 +20,7 @@ class FixGoogleLoginPatch : BytecodePatch(
GoogleAuthAvailableFingerprint GoogleAuthAvailableFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
listOf( listOf(
GoogleOneTapAuthAvailableFingerprint, GoogleOneTapAuthAvailableFingerprint,
GoogleAuthAvailableFingerprint GoogleAuthAvailableFingerprint
@ -37,6 +35,5 @@ class FixGoogleLoginPatch : BytecodePatch(
) )
} }
} }
return PatchResultSuccess()
} }
} }

View File

@ -8,8 +8,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
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.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
@ -33,12 +31,12 @@ class SettingsPatch : BytecodePatch(
SettingsEntryInfoFingerprint, SettingsEntryInfoFingerprint,
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { 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()
?: return SettingsEntryFingerprint.toErrorResult() ?: throw SettingsEntryFingerprint.toErrorResult()
val settingsButtonInfoClass = SettingsEntryInfoFingerprint.result?.classDef?.type?.toClassName() val settingsButtonInfoClass = SettingsEntryInfoFingerprint.result?.classDef?.type?.toClassName()
?: return SettingsEntryInfoFingerprint.toErrorResult() ?: throw SettingsEntryInfoFingerprint.toErrorResult()
// 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 {
@ -66,7 +64,7 @@ class SettingsPatch : BytecodePatch(
""" """
) )
} }
} ?: return AddSettingsEntryFingerprint.toErrorResult() } ?: throw AddSettingsEntryFingerprint.toErrorResult()
// 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 {
@ -87,9 +85,7 @@ class SettingsPatch : BytecodePatch(
""", """,
ExternalLabel("notrevanced", getInstruction(initializeSettingsIndex)) ExternalLabel("notrevanced", getInstruction(initializeSettingsIndex))
) )
} ?: return AdPersonalizationActivityOnCreateFingerprint.toErrorResult() } ?: throw AdPersonalizationActivityOnCreateFingerprint.toErrorResult()
return PatchResultSuccess()
} }
private fun String.toClassName(): String { private fun String.toClassName(): String {

View File

@ -8,8 +8,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
@ -39,7 +37,7 @@ class SpoofSimPatch : BytecodePatch() {
) )
} }
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
// Find all api call to check sim information // Find all api call to check sim information
buildMap { buildMap {
context.classes.forEach { classDef -> context.classes.forEach { classDef ->
@ -89,8 +87,6 @@ class SpoofSimPatch : BytecodePatch() {
"invoke-static {}, Lapp/revanced/tiktok/settingsmenu/SettingsStatus;->enableSimSpoof()V" "invoke-static {}, Lapp/revanced/tiktok/settingsmenu/SettingsStatus;->enableSimSpoof()V"
) )
} }
return PatchResultSuccess()
} }
// Patch Android API and return fake sim information // Patch Android API and return fake sim information

View File

@ -7,8 +7,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.trakt.annotations.UnlockProCompatibility import app.revanced.patches.trakt.annotations.UnlockProCompatibility
import app.revanced.patches.trakt.fingerprints.IsVIPEPFingerprint import app.revanced.patches.trakt.fingerprints.IsVIPEPFingerprint
@ -22,7 +20,7 @@ import app.revanced.patches.trakt.fingerprints.RemoteUserFingerprint
class UnlockProPatch : BytecodePatch( class UnlockProPatch : BytecodePatch(
listOf(RemoteUserFingerprint) listOf(RemoteUserFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
RemoteUserFingerprint.result?.classDef?.let { remoteUserClass -> RemoteUserFingerprint.result?.classDef?.let { remoteUserClass ->
arrayOf(IsVIPFingerprint, IsVIPEPFingerprint).onEach { fingerprint -> arrayOf(IsVIPFingerprint, IsVIPEPFingerprint).onEach { fingerprint ->
// Resolve both fingerprints on the same class. // Resolve both fingerprints on the same class.
@ -31,11 +29,9 @@ class UnlockProPatch : BytecodePatch(
}.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)
?: return fingerprint.toErrorResult() ?: throw fingerprint.toErrorResult()
} }
} ?: return RemoteUserFingerprint.toErrorResult() } ?: throw RemoteUserFingerprint.toErrorResult()
return PatchResultSuccess()
} }
private companion object { private companion object {

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.twelvewidgets.unlock.fingerprints.* import app.revanced.patches.twelvewidgets.unlock.fingerprints.*
@ -25,7 +23,7 @@ class UnlockPaidWidgetsPatch : BytecodePatch(
WeatherWidgetUnlockFingerprint WeatherWidgetUnlockFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
listOf( listOf(
AgendaDaysWidgetUnlockFingerprint, AgendaDaysWidgetUnlockFingerprint,
CalendarBigWidgetUnlockFingerprint, CalendarBigWidgetUnlockFingerprint,
@ -34,7 +32,7 @@ class UnlockPaidWidgetsPatch : BytecodePatch(
ScreentimeSmallWidgetUnlockFingerprint, ScreentimeSmallWidgetUnlockFingerprint,
WeatherWidgetUnlockFingerprint WeatherWidgetUnlockFingerprint
).map { fingerprint -> ).map { fingerprint ->
fingerprint.result?.mutableMethod ?: return fingerprint.toErrorResult() fingerprint.result?.mutableMethod ?: throw fingerprint.toErrorResult()
}.forEach { method -> }.forEach { method ->
method.apply { method.apply {
removeInstructions(4, 3) removeInstructions(4, 3)
@ -48,7 +46,5 @@ class UnlockPaidWidgetsPatch : BytecodePatch(
) )
} }
} }
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.data.BytecodeContext
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.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
@ -26,7 +24,7 @@ import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
class AudioAdsPatch : BytecodePatch( class AudioAdsPatch : BytecodePatch(
listOf(AudioAdsPresenterPlayFingerprint) listOf(AudioAdsPresenterPlayFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
// Block playAds call // Block playAds call
with(AudioAdsPresenterPlayFingerprint.result!!) { with(AudioAdsPresenterPlayFingerprint.result!!) {
mutableMethod.addInstructionsWithLabels( mutableMethod.addInstructionsWithLabels(
@ -59,7 +57,5 @@ class AudioAdsPatch : BytecodePatch(
default = true, default = true,
) )
) )
return PatchResultSuccess()
} }
} }

View File

@ -6,9 +6,7 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patches.shared.settings.preference.impl.ArrayResource import app.revanced.patches.shared.settings.preference.impl.ArrayResource
@ -28,8 +26,8 @@ import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
class EmbeddedAdsPatch : BytecodePatch( class EmbeddedAdsPatch : BytecodePatch(
listOf(CreateUsherClientFingerprint) listOf(CreateUsherClientFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
val result = CreateUsherClientFingerprint.result ?: return PatchResultError("${CreateUsherClientFingerprint.name} not found") val result = CreateUsherClientFingerprint.result ?: throw PatchException("${CreateUsherClientFingerprint.name} not found")
// Inject OkHttp3 application interceptor // Inject OkHttp3 application interceptor
result.mutableMethod.addInstructions( result.mutableMethod.addInstructions(
@ -70,7 +68,5 @@ class EmbeddedAdsPatch : BytecodePatch(
SettingsPatch.addString("revanced_embedded_ads_service_unavailable", "%s is unavailable. Ads may show. Try switching to another ad block service in settings.") SettingsPatch.addString("revanced_embedded_ads_service_unavailable", "%s is unavailable. Ads may show. Try switching to another ad block service in settings.")
SettingsPatch.addString("revanced_embedded_ads_service_failed", "%s server returned an error. Ads may show. Try switching to another ad block service in settings.") SettingsPatch.addString("revanced_embedded_ads_service_failed", "%s server returned an error. Ads may show. Try switching to another ad block service in settings.")
return PatchResultSuccess()
} }
} }

View File

@ -7,8 +7,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
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.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
@ -36,7 +34,7 @@ class VideoAdsPatch : AbstractAdPatch(
GetReadyToShowAdFingerprint GetReadyToShowAdFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
/* Amazon ads SDK */ /* Amazon ads SDK */
context.blockMethods( context.blockMethods(
"Lcom/amazon/ads/video/player/AdsManagerImpl;", "Lcom/amazon/ads/video/player/AdsManagerImpl;",
@ -97,7 +95,7 @@ class VideoAdsPatch : AbstractAdPatch(
""", """,
ExternalLabel(skipLabelName, mutableMethod.getInstruction(0)) ExternalLabel(skipLabelName, mutableMethod.getInstruction(0))
) )
} ?: return CheckAdEligibilityLambdaFingerprint.toErrorResult() } ?: throw CheckAdEligibilityLambdaFingerprint.toErrorResult()
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;"
@ -112,7 +110,7 @@ class VideoAdsPatch : AbstractAdPatch(
""", """,
ExternalLabel(skipLabelName, mutableMethod.getInstruction(0)) ExternalLabel(skipLabelName, mutableMethod.getInstruction(0))
) )
} ?: return GetReadyToShowAdFingerprint.toErrorResult() } ?: throw GetReadyToShowAdFingerprint.toErrorResult()
// Spoof showAds JSON field // Spoof showAds JSON field
ContentConfigShowAdsFingerprint.result?.apply { ContentConfigShowAdsFingerprint.result?.apply {
@ -123,7 +121,7 @@ class VideoAdsPatch : AbstractAdPatch(
return v0 return v0
""" """
) )
} ?: return ContentConfigShowAdsFingerprint.toErrorResult() } ?: throw ContentConfigShowAdsFingerprint.toErrorResult()
SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences( SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences(
SwitchPreference( SwitchPreference(
@ -143,7 +141,5 @@ class VideoAdsPatch : AbstractAdPatch(
default = true default = true
) )
) )
return PatchResultSuccess()
} }
} }

View File

@ -8,8 +8,6 @@ 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.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
@ -41,7 +39,7 @@ class ShowDeletedMessagesPatch : BytecodePatch(
if-eqz $register, :no_spoiler if-eqz $register, :no_spoiler
""" """
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
// Spoiler mode: Force set hasModAccess member to true in constructor // Spoiler mode: Force set hasModAccess member to true in constructor
DeletedMessageClickableSpanCtorFingerprint.result?.mutableMethod?.apply { DeletedMessageClickableSpanCtorFingerprint.result?.mutableMethod?.apply {
addInstructionsWithLabels( addInstructionsWithLabels(
@ -53,11 +51,11 @@ class ShowDeletedMessagesPatch : BytecodePatch(
""", """,
ExternalLabel("no_spoiler", getInstruction(implementation!!.instructions.lastIndex)) ExternalLabel("no_spoiler", getInstruction(implementation!!.instructions.lastIndex))
) )
} ?: return DeletedMessageClickableSpanCtorFingerprint.toErrorResult() } ?: throw DeletedMessageClickableSpanCtorFingerprint.toErrorResult()
// Spoiler mode: Disable setHasModAccess setter // Spoiler mode: Disable setHasModAccess setter
SetHasModAccessFingerprint.result?.mutableMethod?.addInstruction(0, "return-void") SetHasModAccessFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
?: return SetHasModAccessFingerprint.toErrorResult() ?: throw SetHasModAccessFingerprint.toErrorResult()
// Cross-out mode: Reformat span of deleted message // Cross-out mode: Reformat span of deleted message
ChatUtilCreateDeletedSpanFingerprint.result?.mutableMethod?.apply { ChatUtilCreateDeletedSpanFingerprint.result?.mutableMethod?.apply {
@ -71,7 +69,7 @@ class ShowDeletedMessagesPatch : BytecodePatch(
""", """,
ExternalLabel("no_reformat", getInstruction(0)) ExternalLabel("no_reformat", getInstruction(0))
) )
} ?: return ChatUtilCreateDeletedSpanFingerprint.toErrorResult() } ?: throw ChatUtilCreateDeletedSpanFingerprint.toErrorResult()
SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences( SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences(
ListPreference( ListPreference(
@ -101,7 +99,5 @@ class ShowDeletedMessagesPatch : BytecodePatch(
) )
SettingsPatch.addString("revanced_deleted_msg", "message deleted") SettingsPatch.addString("revanced_deleted_msg", "message deleted")
return PatchResultSuccess()
} }
} }

View File

@ -7,8 +7,6 @@ import app.revanced.patcher.data.BytecodeContext
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.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
@ -26,7 +24,7 @@ import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
class AutoClaimChannelPointPatch : BytecodePatch( class AutoClaimChannelPointPatch : BytecodePatch(
listOf(CommunityPointsButtonViewDelegateFingerprint) listOf(CommunityPointsButtonViewDelegateFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences( SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences(
SwitchPreference( SwitchPreference(
"revanced_auto_claim_channel_points", "revanced_auto_claim_channel_points",
@ -62,8 +60,6 @@ class AutoClaimChannelPointPatch : BytecodePatch(
""", """,
ExternalLabel("auto_claim", getInstruction(lastIndex)) ExternalLabel("auto_claim", getInstruction(lastIndex))
) )
} ?: return CommunityPointsButtonViewDelegateFingerprint.toErrorResult() } ?: throw CommunityPointsButtonViewDelegateFingerprint.toErrorResult()
return PatchResultSuccess()
} }
} }

View File

@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
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
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patches.shared.settings.preference.impl.StringResource import app.revanced.patches.shared.settings.preference.impl.StringResource
@ -31,7 +29,7 @@ class DebugModePatch : BytecodePatch(
ShouldShowDebugOptionsFingerprint ShouldShowDebugOptionsFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
listOf( listOf(
IsDebugConfigEnabledFingerprint, IsDebugConfigEnabledFingerprint,
IsOmVerificationEnabledFingerprint, IsOmVerificationEnabledFingerprint,
@ -46,7 +44,7 @@ class DebugModePatch : BytecodePatch(
return v0 return v0
""" """
) )
} ?: return it.toErrorResult() } ?: throw it.toErrorResult()
} }
SettingsPatch.PreferenceScreen.MISC.OTHER.addPreferences( SettingsPatch.PreferenceScreen.MISC.OTHER.addPreferences(
@ -67,7 +65,5 @@ class DebugModePatch : BytecodePatch(
default = false, default = false,
) )
) )
return PatchResultSuccess()
} }
} }

View File

@ -10,8 +10,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
@ -43,7 +41,7 @@ class SettingsPatch : BytecodePatch(
MenuGroupsOnClickFingerprint MenuGroupsOnClickFingerprint
) )
), Closeable { ), Closeable {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext) {
// Hook onCreate to handle fragment creation // Hook onCreate to handle fragment creation
SettingsActivityOnCreateFingerprint.result?.apply { SettingsActivityOnCreateFingerprint.result?.apply {
val insertIndex = mutableMethod.implementation!!.instructions.size - 2 val insertIndex = mutableMethod.implementation!!.instructions.size - 2
@ -57,7 +55,7 @@ class SettingsPatch : BytecodePatch(
""", """,
ExternalLabel("no_rv_settings_init", mutableMethod.getInstruction(insertIndex)) ExternalLabel("no_rv_settings_init", mutableMethod.getInstruction(insertIndex))
) )
} ?: return SettingsActivityOnCreateFingerprint.toErrorResult() } ?: throw SettingsActivityOnCreateFingerprint.toErrorResult()
// Create new menu item for settings menu // Create new menu item for settings menu
SettingsMenuItemEnumFingerprint.result?.apply { SettingsMenuItemEnumFingerprint.result?.apply {
@ -67,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
) )
} ?: return SettingsMenuItemEnumFingerprint.toErrorResult() } ?: throw SettingsMenuItemEnumFingerprint.toErrorResult()
// Intercept settings menu creation and add new menu item // Intercept settings menu creation and add new menu item
MenuGroupsUpdatedFingerprint.result?.apply { MenuGroupsUpdatedFingerprint.result?.apply {
@ -79,7 +77,7 @@ class SettingsPatch : BytecodePatch(
move-result-object p1 move-result-object p1
""" """
) )
} ?: return MenuGroupsUpdatedFingerprint.toErrorResult() } ?: throw MenuGroupsUpdatedFingerprint.toErrorResult()
// Intercept onclick events for the settings menu // Intercept onclick events for the settings menu
MenuGroupsOnClickFingerprint.result?.apply { MenuGroupsOnClickFingerprint.result?.apply {
@ -96,14 +94,12 @@ class SettingsPatch : BytecodePatch(
""", """,
ExternalLabel("no_rv_settings_onclick", mutableMethod.getInstruction(insertIndex)) ExternalLabel("no_rv_settings_onclick", mutableMethod.getInstruction(insertIndex))
) )
} ?: return MenuGroupsOnClickFingerprint.toErrorResult() } ?: throw MenuGroupsOnClickFingerprint.toErrorResult()
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)
addString("revanced_reboot", "Restart", false) addString("revanced_reboot", "Restart", false)
addString("revanced_cancel", "Cancel", false) addString("revanced_cancel", "Cancel", false)
return PatchResultSuccess()
} }
internal companion object { internal companion object {

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