some fixes

This commit is contained in:
oSumAtrIX 2026-01-23 17:15:54 +01:00
parent 69aa683901
commit 4950ac412f
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
30 changed files with 107 additions and 152 deletions

View file

@ -1,7 +1,7 @@
package app.revanced.patches.amazon package app.revanced.patches.amazon
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly
@Suppress("unused") @Suppress("unused")
val deepLinkingPatch = bytecodePatch( val deepLinkingPatch = bytecodePatch(
@ -11,12 +11,6 @@ val deepLinkingPatch = bytecodePatch(
compatibleWith("com.amazon.mShop.android.shopping") compatibleWith("com.amazon.mShop.android.shopping")
apply { apply {
deepLinkingMethod.addInstructions( deepLinkingMethod.returnEarly(true)
0,
"""
const/4 v0, 0x1
return v0
""",
)
} }
} }

View file

@ -1,7 +1,7 @@
package app.revanced.patches.cieid.restrictions.root package app.revanced.patches.cieid.restrictions.root
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly
@Suppress("unused") @Suppress("unused")
val bypassRootChecksPatch = bytecodePatch( val bypassRootChecksPatch = bytecodePatch(
@ -11,6 +11,6 @@ val bypassRootChecksPatch = bytecodePatch(
compatibleWith("it.ipzs.cieid") compatibleWith("it.ipzs.cieid")
apply { apply {
checkRootMethod.addInstruction(1, "return-void") checkRootMethod.returnEarly()
} }
} }

View file

@ -21,10 +21,10 @@ val disableAdsPatch = bytecodePatch(
// SharedPreferences has a debug boolean value with key "disable_ads", which maps to "DebugCategory.DISABLE_ADS". // SharedPreferences has a debug boolean value with key "disable_ads", which maps to "DebugCategory.DISABLE_ADS".
// //
// MonetizationDebugSettings seems to be the most general setting to work fine. // MonetizationDebugSettings seems to be the most general setting to work fine.
initializeMonetizationDebugSettingsMethod.match( // TODO initializeMonetizationDebugSettingsMethodMatch.match(
monetizationDebugSettingsToStringMethod.classDef monetizationDebugSettingsToStringMethod.classDef,
).method.apply { ).method.apply {
val insertIndex = initializeMonetizationDebugSettingsMethod.instructionMatches.first().index val insertIndex = initializeMonetizationDebugSettingsMethodMatch.indices.first()
val register = getInstruction<TwoRegisterInstruction>(insertIndex).registerA val register = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
addInstructions( addInstructions(

View file

@ -5,15 +5,14 @@ import app.revanced.patcher.patch.BytecodePatchContext
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.initializeMonetizationDebugSettingsMethod by gettingFirstMutableMethodDeclaratively { internal val initializeMonetizationDebugSettingsMethodMatch = firstMethodComposite {
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR) accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
returnType("V") returnType("V")
// Parameters have not been reliable for fingerprinting between versions. // Parameters have not been reliable for fingerprinting between versions.
opcodes(Opcode.IPUT_BOOLEAN) opcodes(Opcode.IPUT_BOOLEAN)
} }
internal val BytecodePatchContext.monetizationDebugSettingsToStringMethod by gettingFirstMutableMethodDeclaratively( internal val BytecodePatchContext.monetizationDebugSettingsToStringMethod by gettingFirstMutableMethodDeclaratively {
"MonetizationDebugSettings(" // Partial string match.
) {
name("toString") name("toString")
instructions(string("MonetizationDebugSettings(", String::contains))
} }

View file

@ -10,7 +10,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Suppress("unused") @Suppress("unused")
val enableDebugMenuPatch = bytecodePatch( val enableDebugMenuPatch = bytecodePatch(
name = "Enable debug menu", name = "Enable debug menu",
use = false use = false,
) { ) {
compatibleWith("com.duolingo") compatibleWith("com.duolingo")
@ -19,18 +19,13 @@ val enableDebugMenuPatch = bytecodePatch(
debugCategoryAllowOnReleaseBuildsMethod.returnEarly(true) debugCategoryAllowOnReleaseBuildsMethod.returnEarly(true)
// Change build config debug build flag. // Change build config debug build flag.
buildConfigProviderConstructorMethod.match( // TODO buildConfigProviderConstructorMethodMatch.match(
buildConfigProviderToStringMethod.classDef buildConfigProviderToStringMethod.classDef,
).let { ).let {
val index = it.patternMatch.startIndex // TODO val index = it.indices.first()
it.apply { val register = it.method.getInstruction<OneRegisterInstruction>(index).registerA
val register = getInstruction<OneRegisterInstruction>(index).registerA // TODO it.method.addInstruction(index + 1, "const/4 v$register, 0x1")
addInstruction(
index + 1,
"const/4 v$register, 0x1"
)
}
} }
} }
} }

View file

@ -12,17 +12,16 @@ internal val BytecodePatchContext.debugCategoryAllowOnReleaseBuildsMethod by get
parameterTypes() parameterTypes()
} }
internal val BytecodePatchContext.buildConfigProviderConstructorMethod by gettingFirstMutableMethodDeclaratively { internal val buildConfigProviderConstructorMethodMatch = firstMethodComposite {
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR) accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
parameterTypes() parameterTypes()
opcodes(Opcode.CONST_4) opcodes(Opcode.CONST_4)
} }
internal val BytecodePatchContext.buildConfigProviderToStringMethod by gettingFirstMutableMethodDeclaratively( internal val BytecodePatchContext.buildConfigProviderToStringMethod by gettingFirstMutableMethodDeclaratively {
"BuildConfigProvider(" // Partial string match.
) {
name("toString") name("toString")
parameterTypes() parameterTypes()
returnType("Ljava/lang/String;") returnType("Ljava/lang/String;")
instructions(string("BuildConfigProvider(", String::contains))
} }

View file

@ -14,10 +14,12 @@ internal val BytecodePatchContext.initializeEnergyConfigMethod by gettingFirstMu
} }
// Class name currently is not obfuscated, but it may be in the future. // Class name currently is not obfuscated, but it may be in the future.
internal val BytecodePatchContext.energyConfigToStringMethod by gettingFirstMutableMethodDeclaratively( internal val BytecodePatchContext.energyConfigToStringMethod by gettingFirstMutableMethodDeclaratively {
"EnergyConfig(", "maxEnergy=" // Partial string matches.
) {
name("toString") name("toString")
parameterTypes() parameterTypes()
returnType("Ljava/lang/String;") returnType("Ljava/lang/String;")
instructions(
string("EnergyConfig(", String::contains),
string("maxEnergy=", String::contains),
)
} }

View file

@ -1,7 +1,7 @@
package app.revanced.patches.finanzonline.detection.bootloader package app.revanced.patches.finanzonline.detection.bootloader
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly
@Suppress("unused") @Suppress("unused")
val bootloaderDetectionPatch = bytecodePatch( val bootloaderDetectionPatch = bytecodePatch(
@ -11,14 +11,8 @@ val bootloaderDetectionPatch = bytecodePatch(
compatibleWith("at.gv.bmf.bmf2go") compatibleWith("at.gv.bmf.bmf2go")
apply { apply {
setOf(createKeyMethod, bootStateMethod).forEach { fingerprint -> setOf(createKeyMethod, bootStateMethod).forEach { method ->
fingerprint.addInstructions( method.returnEarly(true)
0,
"""
const/4 v0, 0x1
return v0
""",
)
} }
} }
} }

View file

@ -29,18 +29,17 @@ internal val BytecodePatchContext.bootStateMethod by gettingFirstMutableMethodDe
Opcode.IF_NE, Opcode.IF_NE,
Opcode.GOTO, Opcode.GOTO,
Opcode.MOVE, Opcode.MOVE,
Opcode.RETURN Opcode.RETURN,
) )
} }
// Located @ at.gv.bmf.bmf2go.taxequalization.tools.utils.AttestationHelper#createKey (3.0.1) // Located @ at.gv.bmf.bmf2go.taxequalization.tools.utils.AttestationHelper#createKey (3.0.1)
internal val BytecodePatchContext.createKeyMethod by gettingFirstMutableMethodDeclaratively( internal val BytecodePatchContext.createKeyMethod by gettingFirstMutableMethodDeclaratively(
"attestation", "attestation",
"SHA-256", "SHA-256",
"random", "random",
"EC", "EC",
"AndroidKeyStore" "AndroidKeyStore",
) { ) {
accessFlags(AccessFlags.PUBLIC) accessFlags(AccessFlags.PUBLIC)
returnType("Z") returnType("Z")

View file

@ -13,8 +13,8 @@ val enableCustomTabsPatch = bytecodePatch(
compatibleWith("com.google.android.apps.magazines") compatibleWith("com.google.android.apps.magazines")
apply { apply {
launchCustomTabMethod.apply { launchCustomTabMethodMatch.method.apply {
val checkIndex = launchCustomTabMethod.instructionMatches.last().index + 1 // TODO val checkIndex = launchCustomTabMethodMatch.indices.last() + 1
val register = getInstruction<OneRegisterInstruction>(checkIndex).registerA val register = getInstruction<OneRegisterInstruction>(checkIndex).registerA
replaceInstruction(checkIndex, "const/4 v$register, 0x1") replaceInstruction(checkIndex, "const/4 v$register, 0x1")

View file

@ -2,13 +2,12 @@ package app.revanced.patches.googlenews.customtabs
import app.revanced.patcher.accessFlags import app.revanced.patcher.accessFlags
import app.revanced.patcher.definingClass import app.revanced.patcher.definingClass
import app.revanced.patcher.gettingFirstMutableMethodDeclaratively import app.revanced.patcher.firstMethodComposite
import app.revanced.patcher.opcodes import app.revanced.patcher.opcodes
import app.revanced.patcher.patch.BytecodePatchContext
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.launchCustomTabMethod by gettingFirstMutableMethodDeclaratively { internal val launchCustomTabMethodMatch = firstMethodComposite {
definingClass("CustomTabsArticleLauncher;"::endsWith) definingClass("CustomTabsArticleLauncher;"::endsWith)
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR) accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
opcodes( opcodes(

View file

@ -1,7 +1,7 @@
package app.revanced.patches.hexeditor.ad package app.revanced.patches.hexeditor.ad
import app.revanced.patcher.extensions.replaceInstructions
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly
@Suppress("unused") @Suppress("unused")
val disableAdsPatch = bytecodePatch( val disableAdsPatch = bytecodePatch(
@ -10,12 +10,6 @@ val disableAdsPatch = bytecodePatch(
compatibleWith("com.myprog.hexedit") compatibleWith("com.myprog.hexedit")
apply { apply {
primaryAdsMethod.replaceInstructions( primaryAdsMethod.returnEarly(true)
0,
"""
const/4 v0, 0x1
return v0
""",
)
} }
} }

View file

@ -1,22 +0,0 @@
package app.revanced.patches.lightroom.misc.version
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.lightroom.misc.bypassVersionCheck.refreshRemoteConfigurationMethod
@Suppress("unused")
val disableVersionCheckPatch = bytecodePatch(
name = "Disable version check",
description = "Disables the server-side version check that prevents the app from starting.",
) {
compatibleWith("com.adobe.lrmobile"("9.3.0"))
apply {
refreshRemoteConfigurationMethod.apply {
val igetIndex = refreshRemoteConfigurationMethod.patternMatch!!.endIndex // TODO
// This value represents the server command to clear all version restrictions.
val statusForceReset = "-0x2";
replaceInstruction(igetIndex, "const/4 v1, $statusForceReset")
}
}
}

View file

@ -1,5 +1,6 @@
package app.revanced.patches.lightroom.misc.login package app.revanced.patches.lightroom.misc.login
import app.revanced.patcher.extensions.instructions
import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
@ -10,10 +11,8 @@ val disableMandatoryLoginPatch = bytecodePatch(
compatibleWith("com.adobe.lrmobile"("9.3.0")) compatibleWith("com.adobe.lrmobile"("9.3.0"))
apply { apply {
isLoggedInMethod.apply { val index = isLoggedInMethod.instructions.lastIndex - 1
val index = implementation!!.instructions.lastIndex - 1 // Set isLoggedIn = true.
// Set isLoggedIn = true. isLoggedInMethod.replaceInstruction(index, "const/4 v0, 0x1")
replaceInstruction(index, "const/4 v0, 0x1")
}
} }
} }

View file

@ -0,0 +1,20 @@
package app.revanced.patches.lightroom.misc.version
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch
@Suppress("unused")
val disableVersionCheckPatch = bytecodePatch(
name = "Disable version check",
description = "Disables the server-side version check that prevents the app from starting.",
) {
compatibleWith("com.adobe.lrmobile"("9.3.0"))
apply {
val igetIndex = refreshRemoteConfigurationMethodMatch.indices.last()
// This value represents the server command to clear all version restrictions.
val statusForceReset = "-0x2"
refreshRemoteConfigurationMethodMatch.method.replaceInstruction(igetIndex, "const/4 v1, $statusForceReset")
}
}

View file

@ -1,15 +1,14 @@
package app.revanced.patches.lightroom.misc.bypassVersionCheck package app.revanced.patches.lightroom.misc.version
import app.revanced.patcher.accessFlags import app.revanced.patcher.accessFlags
import app.revanced.patcher.gettingFirstMutableMethodDeclaratively import app.revanced.patcher.firstMethodComposite
import app.revanced.patcher.opcodes import app.revanced.patcher.opcodes
import app.revanced.patcher.patch.BytecodePatchContext
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.refreshRemoteConfigurationMethod by gettingFirstMutableMethodDeclaratively( internal val refreshRemoteConfigurationMethodMatch = firstMethodComposite(
"com.adobe.lrmobile.denylisted_version_set_key", "com.adobe.lrmobile.denylisted_version_set_key",
"com.adobe.lrmobile.app_min_version_key" "com.adobe.lrmobile.app_min_version_key",
) { ) {
accessFlags(AccessFlags.PUBLIC, AccessFlags.STATIC) accessFlags(AccessFlags.PUBLIC, AccessFlags.STATIC)
opcodes( opcodes(

View file

@ -7,12 +7,11 @@ import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.getMobileConfigBoolMethod by gettingFirstMutableMethodDeclaratively { internal val BytecodePatchContext.getMobileConfigBoolMethod by gettingFirstMutableMethodDeclaratively {
returnType("Z") returnType("Z")
opcodes(Opcode.RETURN) opcodes(Opcode.RETURN)
custom { immutableClassDef.interfaces.contains("Lcom/facebook/mobileconfig/factory/MobileConfigUnsafeContext;") } custom { "Lcom/facebook/mobileconfig/factory/MobileConfigUnsafeContext;" in immutableClassDef.interfaces }
} }
internal val BytecodePatchContext.metaAIKillSwitchCheckMethod by gettingFirstMutableMethodDeclaratively("SearchAiagentImplementationsKillSwitch") { internal val BytecodePatchContext.metaAIKillSwitchCheckMethod by gettingFirstMutableMethodDeclaratively("SearchAiagentImplementationsKillSwitch") {
opcodes(Opcode.CONST_WIDE) opcodes(Opcode.CONST_WIDE)
} }
internal val BytecodePatchContext.extensionMethodMethod by gettingFirstMutableMethodDeclaratively("REPLACED_BY_PATCH") { internal val BytecodePatchContext.extensionMethodMethod by gettingFirstMutableMethodDeclaratively("REPLACED_BY_PATCH") {
name(EXTENSION_METHOD_NAME) name(EXTENSION_METHOD_NAME)

View file

@ -4,14 +4,11 @@ import app.revanced.patcher.*
import app.revanced.patcher.patch.BytecodePatchContext import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patches.music.shared.YOUTUBE_MUSIC_MAIN_ACTIVITY_CLASS_TYPE import app.revanced.patches.music.shared.YOUTUBE_MUSIC_MAIN_ACTIVITY_CLASS_TYPE
import app.revanced.patches.shared.misc.mapping.ResourceType import app.revanced.patches.shared.misc.mapping.ResourceType
import app.revanced.patches.shared.misc.mapping.resourceLiteral
internal val BytecodePatchContext.cairoSplashAnimationConfigMethod by gettingFirstMutableMethodDeclaratively { internal val BytecodePatchContext.cairoSplashAnimationConfigMethod by gettingFirstMutableMethodDeclaratively {
name("onCreate") name("onCreate")
returnType("V") returnType("V")
definingClass(YOUTUBE_MUSIC_MAIN_ACTIVITY_CLASS_TYPE) definingClass(YOUTUBE_MUSIC_MAIN_ACTIVITY_CLASS_TYPE)
parameterTypes("Landroid/os/Bundle;") parameterTypes("Landroid/os/Bundle;")
instructions( instructions(ResourceType.LAYOUT("main_activity_launch_animation"))
resourceLiteral(ResourceType.LAYOUT, "main_activity_launch_animation")
)
} }

View file

@ -1,6 +1,5 @@
package app.revanced.patches.music.misc.backgroundplayback package app.revanced.patches.music.misc.backgroundplayback
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.music.misc.extension.sharedExtensionPatch import app.revanced.patches.music.misc.extension.sharedExtensionPatch
import app.revanced.patches.music.misc.settings.settingsPatch import app.revanced.patches.music.misc.settings.settingsPatch
@ -12,22 +11,18 @@ val backgroundPlaybackPatch = bytecodePatch(
) { ) {
dependsOn( dependsOn(
sharedExtensionPatch, sharedExtensionPatch,
settingsPatch settingsPatch,
) )
compatibleWith( compatibleWith(
"com.google.android.apps.youtube.music"( "com.google.android.apps.youtube.music"(
"7.29.52", "7.29.52",
"8.10.52" "8.10.52",
) ),
) )
apply { apply {
kidsBackgroundPlaybackPolicyControllerMethod.addInstruction( kidsBackgroundPlaybackPolicyControllerMethod.returnEarly()
0,
"return-void",
)
backgroundPlaybackDisableMethod.returnEarly(true) backgroundPlaybackDisableMethod.returnEarly(true)
} }
} }

View file

@ -1,8 +1,8 @@
package app.revanced.patches.protonvpn.splittunneling package app.revanced.patches.protonvpn.splittunneling
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.getReference import app.revanced.util.getReference
import app.revanced.util.indexOfFirstInstructionOrThrow import app.revanced.util.indexOfFirstInstructionOrThrow

View file

@ -1,7 +1,6 @@
package app.revanced.patches.shared.misc.mapping package app.revanced.patches.shared.misc.mapping
import app.revanced.patcher.InstructionLocation import app.revanced.patcher.Predicate
import app.revanced.patcher.LiteralFilter
import app.revanced.patcher.extensions.wideLiteral import app.revanced.patcher.extensions.wideLiteral
import app.revanced.patcher.literal import app.revanced.patcher.literal
import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.PatchException
@ -35,10 +34,12 @@ enum class ResourceType(val value: String) {
STYLEABLE("styleable"), STYLEABLE("styleable"),
TRANSITION("transition"), TRANSITION("transition"),
VALUES("values"), VALUES("values"),
XML("xml"); XML("xml"),
;
operator fun invoke(name: String): Instruction.() -> Boolean = val id = getResourceId(this, name)
getResourceId(this, name).let { { wideLiteral(it) } }
operator fun invoke(name: String): Predicate<Instruction> = { wideLiteral == id }
companion object { companion object {
private val VALUE_MAP: Map<String, ResourceType> = entries.associateBy { it.value } private val VALUE_MAP: Map<String, ResourceType> = entries.associateBy { it.value }
@ -82,7 +83,7 @@ fun hasResourceId(type: ResourceType, name: String) = resourceMappings[type.valu
fun resourceLiteral( fun resourceLiteral(
type: ResourceType, type: ResourceType,
name: String, name: String,
location: InstructionLocation = InstructionLocation.MatchAfterAnywhere() location: InstructionLocation = InstructionLocation.MatchAfterAnywhere(),
) = literal({ getResourceId(type, name) }, null, location) ) = literal({ getResourceId(type, name) }, null, location)
val resourceMappingPatch = resourcePatch { val resourceMappingPatch = resourcePatch {

View file

@ -37,7 +37,7 @@ val enableOfflineSync = bytecodePatch(
// Patch the URL builder to use the HTTPS_STREAM endpoint // Patch the URL builder to use the HTTPS_STREAM endpoint
// instead of the offline sync endpoint to downloading the track. // instead of the offline sync endpoint to downloading the track.
downloadOperationsURLBuilderFingerprint.apply { downloadOperationsURLBuilderMethod.apply {
val getEndpointsEnumFieldIndex = 1 val getEndpointsEnumFieldIndex = 1
val getEndpointsEnumFieldInstruction = getInstruction<OneRegisterInstruction>(getEndpointsEnumFieldIndex) val getEndpointsEnumFieldInstruction = getInstruction<OneRegisterInstruction>(getEndpointsEnumFieldIndex)
@ -53,7 +53,7 @@ val enableOfflineSync = bytecodePatch(
// The HTTPS_STREAM endpoint does not return the necessary headers for offline sync. // The HTTPS_STREAM endpoint does not return the necessary headers for offline sync.
// Mock the headers to prevent the app from crashing by setting them to empty strings. // Mock the headers to prevent the app from crashing by setting them to empty strings.
// The headers are all cosmetic and do not affect the functionality of the app. // The headers are all cosmetic and do not affect the functionality of the app.
downloadOperationsHeaderVerificationFingerprint.apply { downloadOperationsHeaderVerificationMethod.apply {
// The first three null checks need to be patched. // The first three null checks need to be patched.
instructions.asSequence().filter { instructions.asSequence().filter {
it.opcode == Opcode.IF_EQZ it.opcode == Opcode.IF_EQZ

View file

@ -5,7 +5,7 @@ import app.revanced.patcher.patch.BytecodePatchContext
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.downloadOperationsURLBuilderFingerprint by gettingFirstMutableMethodDeclaratively { internal val BytecodePatchContext.downloadOperationsURLBuilderMethod by gettingFirstMutableMethodDeclaratively {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returnType("Ljava/lang/String") returnType("Ljava/lang/String")
parameterTypes("L", "L") parameterTypes("L", "L")
@ -16,10 +16,10 @@ internal val BytecodePatchContext.downloadOperationsURLBuilderFingerprint by get
) )
} }
internal val BytecodePatchContext.downloadOperationsHeaderVerificationFingerprint by gettingFirstMutableMethodDeclaratively( internal val BytecodePatchContext.downloadOperationsHeaderVerificationMethod by gettingFirstMutableMethodDeclaratively(
"X-SC-Mime-Type", "X-SC-Mime-Type",
"X-SC-Preset", "X-SC-Preset",
"X-SC-Quality" "X-SC-Quality",
) { ) {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returnType("V") returnType("V")

View file

@ -1,13 +1,12 @@
package app.revanced.patches.strava.upselling package app.revanced.patches.strava.upselling
import app.revanced.patcher.classDef
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.removeInstruction import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable
@Suppress("unused") @Suppress("unused")
val disableSubscriptionSuggestionsPatch = bytecodePatch( val disableSubscriptionSuggestionsPatch = bytecodePatch(
@ -20,11 +19,11 @@ val disableSubscriptionSuggestionsPatch = bytecodePatch(
val pageSuffix = "_upsell" val pageSuffix = "_upsell"
val label = "original" val label = "original"
val className = getModulesMethod.classDef.type val className = getModulesMethodMatch.classDef.type
val originalMethod = getModulesMethod val originalMethod = getModulesMethodMatch.method
val returnType = originalMethod.returnType val returnType = originalMethod.returnType
getModulesMethod.classDef.methods.add( getModulesMethodMatch.classDef.methods.add(
ImmutableMethod( ImmutableMethod(
className, className,
helperMethodName, helperMethodName,
@ -53,16 +52,14 @@ val disableSubscriptionSuggestionsPatch = bytecodePatch(
}, },
) )
val getModulesIndex = getModulesMethod.instructionMatches.first().index // TODO val getModulesIndex = getModulesMethodMatch.indices.first()
with(originalMethod) { originalMethod.removeInstruction(getModulesIndex)
removeInstruction(getModulesIndex) originalMethod.addInstructions(
addInstructions( getModulesIndex,
getModulesIndex, """
""" invoke-direct {p0}, $className->$helperMethodName()$returnType
invoke-direct {p0}, $className->$helperMethodName()$returnType move-result-object v0
move-result-object v0 """,
""", )
)
}
} }
} }

View file

@ -1,13 +1,12 @@
package app.revanced.patches.strava.upselling package app.revanced.patches.strava.upselling
import app.revanced.patcher.definingClass import app.revanced.patcher.definingClass
import app.revanced.patcher.gettingFirstMutableMethodDeclaratively import app.revanced.patcher.firstMethodComposite
import app.revanced.patcher.name import app.revanced.patcher.name
import app.revanced.patcher.opcodes import app.revanced.patcher.opcodes
import app.revanced.patcher.patch.BytecodePatchContext
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.getModulesMethod by gettingFirstMutableMethodDeclaratively { internal val getModulesMethodMatch = firstMethodComposite {
name("getModules") name("getModules")
definingClass("/GenericLayoutEntry;"::endsWith) definingClass("/GenericLayoutEntry;"::endsWith)
opcodes(Opcode.IGET_OBJECT) opcodes(Opcode.IGET_OBJECT)

View file

@ -1,10 +1,6 @@
package app.revanced.patches.tiktok.interaction.downloads package app.revanced.patches.tiktok.interaction.downloads
import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.*
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.getInstruction
import app.revanced.patcher.extensions.removeInstructions
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.tiktok.misc.extension.sharedExtensionPatch import app.revanced.patches.tiktok.misc.extension.sharedExtensionPatch
import app.revanced.patches.tiktok.misc.settings.settingsPatch import app.revanced.patches.tiktok.misc.settings.settingsPatch
@ -75,7 +71,7 @@ val downloadsPatch = bytecodePatch(
} }
} }
settingsStatusLoadFingerprint.method.addInstruction( // TODO settingsStatusLoadFingerprint.method.addInstruction(
0, 0,
"invoke-static {}, Lapp/revanced/extension/tiktok/settings/SettingsStatus;->enableDownload()V", "invoke-static {}, Lapp/revanced/extension/tiktok/settings/SettingsStatus;->enableDownload()V",
) )

View file

@ -1,7 +1,7 @@
package app.revanced.patches.tumblr.annoyances.popups package app.revanced.patches.tumblr.annoyances.popups
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly
@Suppress("unused") @Suppress("unused")
val disableGiftMessagePopupPatch = bytecodePatch( val disableGiftMessagePopupPatch = bytecodePatch(
@ -11,6 +11,6 @@ val disableGiftMessagePopupPatch = bytecodePatch(
compatibleWith("com.tumblr") compatibleWith("com.tumblr")
apply { apply {
showGiftMessagePopupMethod.addInstructions(0, "return-void") showGiftMessagePopupMethod.returnEarly()
} }
} }

View file

@ -28,7 +28,7 @@ val embeddedAdsPatch = bytecodePatch(
ListPreference("revanced_block_embedded_ads"), ListPreference("revanced_block_embedded_ads"),
) )
// Inject OkHttp3 application interceptor // Inject OkHttp3 application interceptor.
createsUsherClientMethod.addInstructions( createsUsherClientMethod.addInstructions(
3, 3,
""" """

View file

@ -1,10 +1,10 @@
package app.revanced.patches.twitch.chat.autoclaim package app.revanced.patches.twitch.chat.autoclaim
import app.revanced.patcher.extensions.ExternalLabel
import app.revanced.patcher.extensions.addInstructionsWithLabels import app.revanced.patcher.extensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.extensions.getInstruction
import app.revanced.patcher.extensions.instructions import app.revanced.patcher.extensions.instructions
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.extensions.ExternalLabel
import app.revanced.patches.all.misc.resources.addResources import app.revanced.patches.all.misc.resources.addResources
import app.revanced.patches.all.misc.resources.addResourcesPatch import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference import app.revanced.patches.shared.misc.settings.preference.SwitchPreference

View file

@ -33,8 +33,8 @@ val debugModePatch = bytecodePatch(
isDebugConfigEnabledMethod, isDebugConfigEnabledMethod,
isOmVerificationEnabledMethod, isOmVerificationEnabledMethod,
shouldShowDebugOptionsMethod, shouldShowDebugOptionsMethod,
).forEach { fingerprint -> ).forEach { method ->
fingerprint.addInstructions( method.addInstructions(
0, 0,
""" """
invoke-static {}, Lapp/revanced/extension/twitch/patches/DebugModePatch;->isDebugModeEnabled()Z invoke-static {}, Lapp/revanced/extension/twitch/patches/DebugModePatch;->isDebugModeEnabled()Z