some more fixes

This commit is contained in:
oSumAtrIX 2026-01-23 17:54:14 +01:00
parent ef3272bf90
commit 63a73d0eab
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
20 changed files with 108 additions and 144 deletions

View file

@ -1,24 +1,24 @@
package app.revanced.patches.facebook.ads.story
import app.revanced.patcher.fingerprint
import app.revanced.patcher.*
import app.revanced.patcher.patch.BytecodePatchContext
import com.android.tools.smali.dexlib2.iface.value.StringEncodedValue
internal val adsInsertionFingerprint = fieldFingerprint(
fieldValue = "AdBucketDataSourceUtil\$attemptAdsInsertion\$1",
internal val BytecodePatchContext.adsInsertionMethod by runMethod(
fieldValue = $$"AdBucketDataSourceUtil$attemptAdsInsertion$1",
)
internal val fetchMoreAdsFingerprint = fieldFingerprint(
fieldValue = "AdBucketDataSourceUtil\$attemptFetchMoreAds\$1",
internal val BytecodePatchContext.fetchMoreAdsMethod by runMethod(
fieldValue = $$"AdBucketDataSourceUtil$attemptFetchMoreAds$1",
)
internal fun fieldFingerprint(fieldValue: String) = fingerprint {
returns("V")
parameters()
custom { method, classDef ->
method.name == "run" &&
classDef.fields.any any@{ field ->
if (field.name != "__redex_internal_original_name") return@any false
(field.initialValue as? StringEncodedValue)?.value == fieldValue
}
internal fun runMethod(fieldValue: String) = gettingFirstMutableMethodDeclaratively {
name("run")
returnType("V")
parameterTypes()
custom {
immutableClassDef.anyField {
name == "__redex_internal_original_name" && (initialValue as? StringEncodedValue)?.value == fieldValue
}
}
}

View file

@ -1,7 +1,8 @@
package app.revanced.patches.facebook.ads.story
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly
import com.android.tools.smali.dexlib2.mutable.MutableMethod
@Suppress("unused")
val hideStoryAdsPatch = bytecodePatch(
@ -11,11 +12,6 @@ val hideStoryAdsPatch = bytecodePatch(
compatibleWith("com.facebook.katana")
apply {
setOf(
fetchMoreAdsFingerprint,
adsInsertionFingerprint,
).forEach { fingerprint ->
fingerprint.method.replaceInstruction(0, "return-void")
}
setOf(fetchMoreAdsMethod, adsInsertionMethod).forEach(MutableMethod::returnEarly)
}
}

View file

@ -14,16 +14,14 @@ val removeDeviceIntegrityChecksPatch = bytecodePatch(
apply {
isDeviceRootedMethod.returnEarly(false)
isDeviceBootloaderOpenMethod.apply {
addInstructions(
0,
"""
const/4 v0, 0x0
invoke-static { v0 }, Lkotlin/coroutines/jvm/internal/Boxing;->boxBoolean(Z)Ljava/lang/Boolean;
move-result-object v0
return-object v0
"""
)
}
isDeviceBootloaderOpenMethod.addInstructions(
0,
"""
const/4 v0, 0x0
invoke-static { v0 }, Lkotlin/coroutines/jvm/internal/Boxing;->boxBoolean(Z)Ljava/lang/Boolean;
move-result-object v0
return-object v0
""",
)
}
}

View file

@ -1,7 +1,7 @@
package app.revanced.patches.inshorts.ad
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly
@Suppress("unused")
val hideAdsPatch = bytecodePatch(
@ -10,11 +10,6 @@ val hideAdsPatch = bytecodePatch(
compatibleWith("com.nis.app")
apply {
inshortsAdsMethod.addInstruction(
0,
"""
return-void
""",
)
inshortsAdsMethod.returnEarly()
}
}

View file

@ -17,7 +17,7 @@ internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/instagr
val limitFeedToFollowedProfiles = bytecodePatch(
name = "Limit feed to followed profiles",
description = "Filters the home feed to display only content from profiles you follow.",
use = false
use = false,
) {
compatibleWith("com.instagram.android")
@ -31,12 +31,11 @@ val limitFeedToFollowedProfiles = bytecodePatch(
*/
val mainFeedRequestHeaderFieldName: String
with(mainFeedHeaderMapFinderMethod) {
mainFeedHeaderMapFinderMethod.apply {
mainFeedRequestHeaderFieldName = indexOfFirstInstructionOrThrow {
getReference<FieldReference>().let { ref ->
ref?.type == "Ljava/util/Map;" &&
ref.definingClass == mainFeedRequestClassMethod.classDef.toString()
ref.definingClass == mainFeedRequestClassMethod.classDef.toString()
}
}.let { instructionIndex ->
getInstruction(instructionIndex).getReference<FieldReference>()!!.name
@ -46,7 +45,7 @@ val limitFeedToFollowedProfiles = bytecodePatch(
val initMainFeedRequestFingerprint = fingerprint {
custom { method, classDef ->
method.name == "<init>" &&
classDef == mainFeedRequestClassMethod.classDef
classDef == mainFeedRequestClassMethod.classDef
}
}
initMainFeedRequestFingerprint.method.apply {
@ -65,7 +64,7 @@ val limitFeedToFollowedProfiles = bytecodePatch(
"""
invoke-static { v$paramHeaderRegister }, $EXTENSION_CLASS_DESCRIPTOR->setFollowingHeader(Ljava/util/Map;)Ljava/util/Map;
move-result-object v$paramHeaderRegister
"""
""",
)
}
}

View file

@ -1,19 +1,13 @@
package app.revanced.patches.memegenerator.detection.license
import app.revanced.patcher.extensions.replaceInstructions
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly
val licenseValidationPatch = bytecodePatch(
description = "Disables Firebase license validation.",
) {
apply {
licenseValidationMethod.replaceInstructions(
0,
"""
const/4 p0, 0x1
return p0
""",
)
licenseValidationMethod.returnEarly(true)
}
}

View file

@ -23,7 +23,7 @@ internal val BytecodePatchContext.backgroundPlaybackDisableMethod by gettingFirs
}
internal val BytecodePatchContext.kidsBackgroundPlaybackPolicyControllerMethod by gettingFirstMutableMethodDeclaratively {
accessFlags(AccessFlags.PUBLIC, AccessFlags.STATIC)
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returnType("V")
parameterTypes("I", "L", "Z")
opcodes(
@ -40,4 +40,4 @@ internal val BytecodePatchContext.kidsBackgroundPlaybackPolicyControllerMethod b
Opcode.IF_NE,
Opcode.IPUT_BOOLEAN,
)
}
}

View file

@ -1,15 +1,15 @@
package app.revanced.patches.serviceportalbund.detection.root
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.creatingBytecodePatch
import app.revanced.util.returnEarly
@Suppress("unused", "ObjectPropertyName")
val `Remove root detection` by creatingBytecodePatch(
description = "Removes the check for root permissions and unlocked bootloader."
description = "Removes the check for root permissions and unlocked bootloader.",
) {
compatibleWith("at.gv.bka.serviceportal")
apply {
rootDetectionMethod.addInstruction(0, "return-void")
rootDetectionMethod.returnEarly()
}
}

View file

@ -26,7 +26,7 @@ internal fun sanitizeSharingLinksPatch(
block: BytecodePatchBuilder.() -> Unit = {},
executeBlock: BytecodePatchContext.() -> Unit = {},
preferenceScreen: BasePreferenceScreen.Screen,
replaceMusicLinksWithYouTube: Boolean = false
replaceMusicLinksWithYouTube: Boolean = false,
) = bytecodePatch(
name = "Sanitize sharing links",
description = "Removes the tracking query parameters from shared links.",
@ -50,12 +50,12 @@ internal fun sanitizeSharingLinksPatch(
tag = "app.revanced.extension.shared.settings.preference.NoTitlePreferenceCategory",
preferences = setOf(
sanitizePreference,
SwitchPreference("revanced_replace_music_with_youtube")
)
SwitchPreference("revanced_replace_music_with_youtube"),
),
)
} else {
sanitizePreference
}
},
)
fun MatchBuilder.hookUrlString(matchIndex: Int) {
@ -67,7 +67,7 @@ internal fun sanitizeSharingLinksPatch(
"""
invoke-static { v$urlRegister }, $EXTENSION_CLASS_DESCRIPTOR->sanitize(Ljava/lang/String;)Ljava/lang/String;
move-result-object v$urlRegister
"""
""",
)
}
@ -80,7 +80,7 @@ internal fun sanitizeSharingLinksPatch(
"""
invoke-static { v$urlRegister }, $EXTENSION_CLASS_DESCRIPTOR->sanitize(Ljava/lang/String;)Ljava/lang/String;
move-result-object v$urlRegister
"""
""",
)
}
@ -93,4 +93,4 @@ internal fun sanitizeSharingLinksPatch(
// Native system share sheet.
youTubeSystemShareSheetMethodMatch.hookIntentPutExtra(3)
}
}
}

View file

@ -5,14 +5,14 @@ import app.revanced.patcher.patch.BytecodePatchContext
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.interceptFingerprint by gettingFirstMutableMethodDeclaratively("SC-Mob-UserPlan", "Configuration") {
internal val interceptMethodMatch = firstMethodComposite("SC-Mob-UserPlan", "Configuration") {
accessFlags(AccessFlags.PUBLIC)
returnType("L")
parameterTypes("L")
opcodes(
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT
Opcode.MOVE_RESULT_OBJECT,
)
}

View file

@ -50,8 +50,8 @@ val hideAdsPatch = bytecodePatch(
// Prevent verification of an HTTP header containing the user's current plan, which would contradict the previous patch.
val conditionIndex = interceptFingerprint.instructionMatches.last().index + 1 // TODO
interceptFingerprint.addInstruction(
val conditionIndex = interceptMethodMatch.indices.last() + 1 // TODO
interceptMethodMatch.method.addInstruction(
conditionIndex,
"return-object p1",
)

View file

@ -1,10 +1,10 @@
package app.revanced.patches.tiktok.interaction.cleardisplay
import app.revanced.patcher.extensions.ExternalLabel
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.getInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.extensions.ExternalLabel
import app.revanced.patches.tiktok.shared.onRenderFirstFrameFingerprint
import app.revanced.util.indexOfFirstInstructionOrThrow
import com.android.tools.smali.dexlib2.Opcode
@ -21,13 +21,13 @@ val rememberClearDisplayPatch = bytecodePatch(
)
apply {
onClearDisplayEventMethod.let {
onClearDisplayEventMethod.apply {
// region Hook the "Clear display" configuration save event to remember the state of clear display.
val isEnabledIndex = it.indexOfFirstInstructionOrThrow(Opcode.IGET_BOOLEAN) + 1
val isEnabledRegister = it.getInstruction<TwoRegisterInstruction>(isEnabledIndex - 1).registerA
val isEnabledIndex = indexOfFirstInstructionOrThrow(Opcode.IGET_BOOLEAN) + 1
val isEnabledRegister = getInstruction<TwoRegisterInstruction>(isEnabledIndex - 1).registerA
it.addInstructions(
addInstructions(
isEnabledIndex,
"invoke-static { v$isEnabledRegister }, " +
"Lapp/revanced/extension/tiktok/cleardisplay/RememberClearDisplayPatch;->rememberClearDisplayState(Z)V",
@ -37,7 +37,7 @@ val rememberClearDisplayPatch = bytecodePatch(
// region Override the "Clear display" configuration load event to load the state of clear display.
val clearDisplayEventClass = it.parameters[0].type
val clearDisplayEventClass = parameters[0].type
onRenderFirstFrameFingerprint.method.addInstructionsWithLabels(
0,
"""

View file

@ -24,48 +24,46 @@ val playbackSpeedPatch = bytecodePatch(
)
apply {
setSpeedMethod.let { onVideoSwiped ->
getSpeedMethod.apply {
val injectIndex =
indexOfFirstInstructionOrThrow { getReference<MethodReference>()?.returnType == "F" } + 2
val register = getInstruction<Instruction11x>(injectIndex - 1).registerA
getSpeedMethod.apply {
val injectIndex =
indexOfFirstInstructionOrThrow { getReference<MethodReference>()?.returnType == "F" } + 2
val register = getInstruction<Instruction11x>(injectIndex - 1).registerA
addInstruction(
injectIndex,
"invoke-static { v$register }," +
" Lapp/revanced/extension/tiktok/speed/PlaybackSpeedPatch;->rememberPlaybackSpeed(F)V",
)
}
// By default, the playback speed will reset to 1.0 at the start of each video.
// Instead, override it with the desired playback speed.
onRenderFirstFrameFingerprint.method.addInstructions(
0,
"""
# Video playback location (e.g. home page, following page or search result page) retrieved using getEnterFrom method.
const/4 v0, 0x1
invoke-virtual { p0, v0 }, ${getEnterFromFingerprint.originalMethod}
move-result-object v0
# Model of current video retrieved using getCurrentAweme method.
invoke-virtual { p0 }, Lcom/ss/android/ugc/aweme/feed/panel/BaseListFragmentPanel;->getCurrentAweme()Lcom/ss/android/ugc/aweme/feed/model/Aweme;
move-result-object v1
# Desired playback speed retrieved using getPlaybackSpeed method.
invoke-static { }, Lapp/revanced/extension/tiktok/speed/PlaybackSpeedPatch;->getPlaybackSpeed()F
move-result v2
invoke-static { v0, v1, v2 }, ${onVideoSwiped.originalMethod} // TODO
""",
)
// Force enable the playback speed option for all videos.
onVideoSwiped.classDef.methods.find { method -> method.returnType == "Z" }?.addInstructions(
0,
"""
const/4 v0, 0x1
return v0
""",
addInstruction(
injectIndex,
"invoke-static { v$register }," +
" Lapp/revanced/extension/tiktok/speed/PlaybackSpeedPatch;->rememberPlaybackSpeed(F)V",
)
}
// By default, the playback speed will reset to 1.0 at the start of each video.
// Instead, override it with the desired playback speed.
onRenderFirstFrameFingerprint.method.addInstructions(
0,
"""
# Video playback location (e.g. home page, following page or search result page) retrieved using getEnterFrom method.
const/4 v0, 0x1
invoke-virtual { p0, v0 }, ${getEnterFromFingerprint.originalMethod}
move-result-object v0
# Model of current video retrieved using getCurrentAweme method.
invoke-virtual { p0 }, Lcom/ss/android/ugc/aweme/feed/panel/BaseListFragmentPanel;->getCurrentAweme()Lcom/ss/android/ugc/aweme/feed/model/Aweme;
move-result-object v1
# Desired playback speed retrieved using getPlaybackSpeed method.
invoke-static { }, Lapp/revanced/extension/tiktok/speed/PlaybackSpeedPatch;->getPlaybackSpeed()F
move-result v2
invoke-static { v0, v1, v2 }, $setSpeedMethod
""",
)
// Force enable the playback speed option for all videos.
setSpeedMethod.classDef.methods.find { method -> method.returnType == "Z" }?.addInstructions(
0,
"""
const/4 v0, 0x1
return v0
""",
)
}
}

View file

@ -1,7 +1,8 @@
package app.revanced.patches.tiktok.misc.login.fixgoogle
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly
import com.android.tools.smali.dexlib2.mutable.MutableMethod
@Suppress("unused")
val fixGoogleLoginPatch = bytecodePatch(
@ -14,17 +15,6 @@ val fixGoogleLoginPatch = bytecodePatch(
)
apply {
listOf(
googleOneTapAuthAvailableMethod,
googleAuthAvailableMethod,
).forEach { method ->
method.addInstructions(
0,
"""
const/4 v0, 0x0
return v0
""",
)
}
listOf(googleOneTapAuthAvailableMethod, googleAuthAvailableMethod).forEach(MutableMethod::returnEarly)
}
}

View file

@ -29,8 +29,8 @@ val `Sanitize sharing links` by creatingBytecodePatch(
apply {
urlShorteningMethod.apply {
val invokeIndex = indexOfFirstInstructionOrThrow {
val ref = getReference<MethodReference>()
ref?.name == "LIZ" && ref.definingClass.startsWith("LX/")
val reference = getReference<MethodReference>()
reference?.name == "LIZ" && reference.definingClass.startsWith("LX/")
}
val moveResultIndex = indexOfFirstInstructionOrThrow(invokeIndex, Opcode.MOVE_RESULT_OBJECT)
@ -74,7 +74,7 @@ val `Sanitize sharing links` by creatingBytecodePatch(
:skip_sanitization
nop
"""
""",
)
}
}

View file

@ -7,5 +7,5 @@ import app.revanced.patcher.patch.BytecodePatchContext
internal val BytecodePatchContext.createsUsherClientMethod by gettingFirstMutableMethodDeclaratively {
name("buildOkHttpClient")
definingClass("Ltv/twitch/android/network/OkHttpClientFactory;"::endsWith)
definingClass("Ltv/twitch/android/network/OkHttpClientFactory;")
}

View file

@ -5,7 +5,7 @@ import app.revanced.patcher.patch.BytecodePatchContext
import com.android.tools.smali.dexlib2.AccessFlags
internal val BytecodePatchContext.menuGroupsOnClickMethod by gettingFirstMutableMethodDeclaratively {
name(String::contains("render")) // TODO
name("render"::contains)
definingClass("/SettingsMenuViewDelegate;"::endsWith)
accessFlags(AccessFlags.PRIVATE, AccessFlags.STATIC, AccessFlags.FINAL)
returnType("V")

View file

@ -1,7 +1,7 @@
package app.revanced.patches.twitter.layout.viewcount
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly
@Suppress("unused")
val hideViewCountPatch = bytecodePatch(
@ -12,12 +12,6 @@ val hideViewCountPatch = bytecodePatch(
compatibleWith("com.twitter.android")
apply {
viewCountsEnabledMethod.addInstructions(
0,
"""
const/4 v0, 0x0
return v0
""",
)
viewCountsEnabledMethod.returnEarly()
}
}

View file

@ -9,8 +9,8 @@ val firebaseGetCertPatch = bytecodePatch(
compatibleWith("de.dwd.warnapp")
apply {
listOf(getRegistrationCertMethod, getMessagingCertMethod).forEach { match ->
match.returnEarly("0799DDF0414D3B3475E88743C91C0676793ED450")
listOf(getRegistrationCertMethod, getMessagingCertMethod).forEach { method ->
method.returnEarly("0799DDF0414D3B3475E88743C91C0676793ED450")
}
}
}

View file

@ -11,7 +11,7 @@ internal val hideAdsPatch = bytecodePatch(
compatibleWith("at.willhaben")
apply {
adResolverMethod.returnEarly(null) // TODO
adResolverMethod.returnEarly() // TODO
whAdViewInjectorMethod.returnEarly()
}
}