mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-27 04:31:03 +00:00
migrations
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package app.revanced.patches.instagram.feed
|
||||
|
||||
import app.revanced.patcher.classDef
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.fieldReference
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.firstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.immutableClassDef
|
||||
import app.revanced.patcher.name
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patches.instagram.misc.extension.sharedExtensionPatch
|
||||
@@ -32,10 +35,9 @@ val `Limit feed to followed profiles` by creatingBytecodePatch(
|
||||
|
||||
mainFeedHeaderMapFinderMethod.apply {
|
||||
mainFeedRequestHeaderFieldName = indexOfFirstInstructionOrThrow {
|
||||
getReference<FieldReference>().let { ref ->
|
||||
ref?.type == "Ljava/util/Map;" &&
|
||||
ref.definingClass == mainFeedRequestClassMethod.immutableClassDef.toString()
|
||||
}
|
||||
val reference = fieldReference
|
||||
reference?.type == "Ljava/util/Map;" &&
|
||||
reference.definingClass == mainFeedRequestClassMethod.classDef.type
|
||||
}.let { instructionIndex ->
|
||||
getInstruction(instructionIndex).getReference<FieldReference>()!!.name
|
||||
}
|
||||
|
||||
@@ -22,14 +22,14 @@ val `Enable developer menu` by creatingBytecodePatch(
|
||||
clearNotificationReceiverMethodMatch.let {
|
||||
val stringIndex = it.indices.first()
|
||||
|
||||
it.method.indexOfFirstInstructionReversedOrThrow(stringIndex) {
|
||||
it.immutableMethod.indexOfFirstInstructionReversedOrThrow(stringIndex) {
|
||||
val reference = methodReference
|
||||
opcode in listOf(Opcode.INVOKE_STATIC, Opcode.INVOKE_STATIC_RANGE) &&
|
||||
reference?.parameterTypes?.size == 1 &&
|
||||
reference.parameterTypes.first() == "Lcom/instagram/common/session/UserSession;" &&
|
||||
reference.returnType == "Z"
|
||||
}.let { index ->
|
||||
navigate(it.method).to(index).stop().returnEarly(true)
|
||||
navigate(it.immutableMethod).to(index).stop().returnEarly(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
package app.revanced.patches.mifitness.misc.locale
|
||||
|
||||
import app.revanced.patcher.definingClass
|
||||
import app.revanced.patcher.gettingFirstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.name
|
||||
import app.revanced.patcher.opcodes
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.*
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val BytecodePatchContext.syncBluetoothLanguageMethod by gettingFirstMutableMethodDeclaratively {
|
||||
internal val syncBluetoothLanguageMethodMatch = firstMethodComposite {
|
||||
name("syncBluetoothLanguage")
|
||||
definingClass("Lcom/xiaomi/fitness/devicesettings/DeviceSettingsSyncer")
|
||||
opcodes(Opcode.MOVE_RESULT_OBJECT)
|
||||
|
||||
@@ -15,11 +15,11 @@ val `Force English locale` by creatingBytecodePatch(
|
||||
dependsOn(`Fix login`)
|
||||
|
||||
apply {
|
||||
syncBluetoothLanguageMethod.apply {
|
||||
val resolvePhoneLocaleInstruction = syncBluetoothLanguageMethod.instructionMatches.first().index // TODO
|
||||
val registerIndexToUpdate = getInstruction<OneRegisterInstruction>(resolvePhoneLocaleInstruction).registerA
|
||||
syncBluetoothLanguageMethodMatch.let {
|
||||
val resolvePhoneLocaleInstruction = it.indices.first()
|
||||
val registerIndexToUpdate = it.method.getInstruction<OneRegisterInstruction>(resolvePhoneLocaleInstruction).registerA
|
||||
|
||||
replaceInstruction(
|
||||
it.method.replaceInstruction(
|
||||
resolvePhoneLocaleInstruction,
|
||||
"const-string v$registerIndexToUpdate, \"en_gb\"",
|
||||
)
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package app.revanced.patches.music.ad.video
|
||||
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
import app.revanced.patcher.firstMethodComposite
|
||||
import app.revanced.patcher.opcodes
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val BytecodePatchContext.showVideoAdsParentMethod by gettingFirstMethodDeclaratively {
|
||||
internal val showVideoAdsParentMethodMatch = firstMethodComposite(
|
||||
"maybeRegenerateCpnAndStatsClient called unexpectedly, but no error.",
|
||||
) {
|
||||
opcodes(
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.IGET_OBJECT,
|
||||
)
|
||||
strings("maybeRegenerateCpnAndStatsClient called unexpectedly, but no error.")
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ val `Hide music video ads` by creatingBytecodePatch(
|
||||
SwitchPreference("revanced_music_hide_video_ads"),
|
||||
)
|
||||
|
||||
navigate(showVideoAdsParentMethod.immutableMethod)
|
||||
.to(showVideoAdsParentMethod.instructionMatches.first().index + 1)
|
||||
navigate(showVideoAdsParentMethodMatch.immutableMethod)
|
||||
.to(showVideoAdsParentMethodMatch.indices.first() + 1)
|
||||
.stop()
|
||||
.addInstructions(
|
||||
0,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.music.audio.exclusiveaudio
|
||||
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
import app.revanced.patcher.gettingFirstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.opcodes
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
@@ -9,7 +9,7 @@ import app.revanced.patcher.returnType
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val BytecodePatchContext.allowExclusiveAudioPlaybackMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.allowExclusiveAudioPlaybackMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("Z")
|
||||
parameterTypes()
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package app.revanced.patches.music.interaction.permanentrepeat
|
||||
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val BytecodePatchContext.repeatTrackMethod by gettingFirstMutableMethodDeclaratively("w_st") {
|
||||
internal val repeatTrackMethodMatch = firstMethodComposite("w_st") {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes("L", "L")
|
||||
|
||||
@@ -38,10 +38,10 @@ val `Permanent repeat` by creatingBytecodePatch(
|
||||
SwitchPreference("revanced_music_play_permanent_repeat"),
|
||||
)
|
||||
|
||||
val startIndex = repeatTrackMethod.indices.last() // TODO
|
||||
val repeatIndex = startIndex + 1
|
||||
repeatTrackMethodMatch.method.apply {
|
||||
val startIndex = repeatTrackMethodMatch.indices.last()
|
||||
val repeatIndex = startIndex + 1
|
||||
|
||||
repeatTrackMethod.apply {
|
||||
// Start index is at a branch, but the same
|
||||
// register is clobbered in both branch paths.
|
||||
val freeRegister = findFreeRegister(startIndex + 1)
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
package app.revanced.patches.music.layout.buttons
|
||||
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.custom
|
||||
import app.revanced.patcher.definingClass
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.extensions.instructions
|
||||
import app.revanced.patcher.gettingFirstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.immutableClassDef
|
||||
import app.revanced.patcher.instructions
|
||||
import app.revanced.patcher.invoke
|
||||
import app.revanced.patcher.literal
|
||||
import app.revanced.patcher.matchIndexed
|
||||
import app.revanced.patcher.opcodes
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.returnType
|
||||
import app.revanced.patcher.unorderedAllOf
|
||||
import app.revanced.util.literal
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
@@ -26,12 +15,10 @@ internal val BytecodePatchContext.mediaRouteButtonMethod by gettingFirstMutableM
|
||||
internal val BytecodePatchContext.playerOverlayChipMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("L")
|
||||
custom {
|
||||
instructions { literal { playerOverlayChip() } }
|
||||
}
|
||||
instructions(playerOverlayChip())
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.historyMenuItemMethod by gettingFirstMutableMethodDeclaratively {
|
||||
internal val historyMenuItemMethodMatch = firstMethodComposite {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes("Landroid/view/Menu;")
|
||||
@@ -39,13 +26,13 @@ internal val BytecodePatchContext.historyMenuItemMethod by gettingFirstMutableMe
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.RETURN_VOID,
|
||||
)
|
||||
historyMenuItem()
|
||||
literal { historyMenuItem }
|
||||
custom {
|
||||
immutableClassDef.methods.count() == 5 // TODO CONFIRM
|
||||
immutableClassDef.methods.count() == 5
|
||||
}
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.historyMenuItemOfflineTabMethod by gettingFirstMutableMethodDeclaratively {
|
||||
internal val historyMenuItemOfflineTabMethodMatch = firstMethodComposite {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes("Landroid/view/Menu;")
|
||||
@@ -63,12 +50,12 @@ internal val BytecodePatchContext.searchActionViewMethod by gettingFirstMutableM
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("Landroid/view/View;")
|
||||
parameterTypes()
|
||||
searchButton()
|
||||
literal { searchButton }
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.topBarMenuItemImageViewMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("Landroid/view/View;")
|
||||
parameterTypes()
|
||||
topBarMenuItemImageView()
|
||||
literal { topBarMenuItemImageView }
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package app.revanced.patches.music.layout.buttons
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.firstMutableMethod
|
||||
import app.revanced.patcher.immutableClassDef
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patches.all.misc.resources.addResources
|
||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||
@@ -67,11 +69,11 @@ val `Hide buttons` by creatingBytecodePatch(
|
||||
|
||||
// Region for hide history button in the top bar.
|
||||
arrayOf(
|
||||
historyMenuItemFingerprint,
|
||||
historyMenuItemOfflineTabFingerprint,
|
||||
).forEach { fingerprint ->
|
||||
fingerprint.method.apply {
|
||||
val targetIndex = fingerprint.patternMatch.startIndex
|
||||
historyMenuItemMethodMatch,
|
||||
historyMenuItemOfflineTabMethodMatch,
|
||||
).forEach { match ->
|
||||
match.method.apply {
|
||||
val targetIndex = match.indices.first()
|
||||
val targetRegister = getInstruction<FiveRegisterInstruction>(targetIndex).registerD
|
||||
|
||||
addInstructions(
|
||||
@@ -86,11 +88,11 @@ val `Hide buttons` by creatingBytecodePatch(
|
||||
|
||||
// Region for hide cast, search and notification buttons in the top bar.
|
||||
arrayOf(
|
||||
Triple(playerOverlayChipFingerprint, playerOverlayChip, "hideCastButton"),
|
||||
Triple(searchActionViewFingerprint, searchButton, "hideSearchButton"),
|
||||
Triple(topBarMenuItemImageViewFingerprint, topBarMenuItemImageView, "hideNotificationButton"),
|
||||
).forEach { (fingerprint, resourceIdLiteral, methodName) ->
|
||||
fingerprint.method.apply {
|
||||
Triple(playerOverlayChipMethod, playerOverlayChip, "hideCastButton"),
|
||||
Triple(searchActionViewMethod, searchButton, "hideSearchButton"),
|
||||
Triple(topBarMenuItemImageViewMethod, topBarMenuItemImageView, "hideNotificationButton"),
|
||||
).forEach { (method, resourceIdLiteral, methodName) ->
|
||||
method.apply {
|
||||
val resourceIndex = indexOfFirstLiteralInstructionOrThrow(resourceIdLiteral)
|
||||
val targetIndex = indexOfFirstInstructionOrThrow(
|
||||
resourceIndex,
|
||||
@@ -107,8 +109,8 @@ val `Hide buttons` by creatingBytecodePatch(
|
||||
}
|
||||
|
||||
// Region for hide cast button in the player.
|
||||
mediaRouteButtonFingerprint.classDef.methods.single { method ->
|
||||
method.name == "setVisibility"
|
||||
mediaRouteButtonMethod.immutableClassDef.firstMutableMethod {
|
||||
name == "setVisibility"
|
||||
}.addInstructions(
|
||||
0,
|
||||
"""
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package app.revanced.patches.music.layout.compactheader
|
||||
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
import app.revanced.patcher.opcodes
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.returnType
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.util.literal
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val BytecodePatchContext.chipCloudMethod by gettingFirstMethodDeclaratively {
|
||||
internal val chipCloudMethodMatch = firstMethodComposite {
|
||||
returnType("V")
|
||||
opcodes(
|
||||
Opcode.CONST,
|
||||
|
||||
@@ -43,11 +43,11 @@ val `Hide category bar` by creatingBytecodePatch(
|
||||
|
||||
chipCloud = ResourceType.LAYOUT["chip_cloud"]
|
||||
|
||||
chipCloudMethod.apply {
|
||||
val targetIndex = chipCloudMethod.patternMatch.endIndex
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
chipCloudMethodMatch.let {
|
||||
val targetIndex = it.indices.last()
|
||||
val targetRegister = it.method.getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
it.method.addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static { v$targetRegister }, $EXTENSION_CLASS_DESCRIPTOR->hideCategoryBar(Landroid/view/View;)V",
|
||||
)
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
|
||||
package app.revanced.patches.music.layout.miniplayercolor
|
||||
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.firstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patcher.returnType
|
||||
import app.revanced.patches.all.misc.resources.addResources
|
||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||
import app.revanced.patches.music.misc.extension.sharedExtensionPatch
|
||||
@@ -45,8 +49,8 @@ val `Change miniplayer color` by creatingBytecodePatch(
|
||||
SwitchPreference("revanced_music_change_miniplayer_color"),
|
||||
)
|
||||
|
||||
switchToggleColorMethod.match(miniPlayerConstructorMethod.classDef).let {
|
||||
val relativeIndex = it.patternMatch.endIndex + 1
|
||||
switchToggleColorMethodMatch.match(miniPlayerConstructorMethodMatch.immutableClassDef).let {
|
||||
val relativeIndex = it.indices.last() + 1
|
||||
|
||||
val invokeVirtualIndex = it.method.indexOfFirstInstructionOrThrow(
|
||||
relativeIndex,
|
||||
@@ -62,20 +66,24 @@ val `Change miniplayer color` by creatingBytecodePatch(
|
||||
val colorMathPlayerIGetReference = it.method
|
||||
.getInstruction<ReferenceInstruction>(iGetIndex).reference as FieldReference
|
||||
|
||||
val colorGreyIndex = miniPlayerConstructorMethod.indexOfFirstInstructionReversedOrThrow {
|
||||
getReference<MethodReference>()?.name == "getColor"
|
||||
}
|
||||
val iPutIndex = miniPlayerConstructorMethod.indexOfFirstInstructionOrThrow(
|
||||
val colorGreyIndex =
|
||||
miniPlayerConstructorMethodMatch.immutableMethod.indexOfFirstInstructionReversedOrThrow {
|
||||
getReference<MethodReference>()?.name == "getColor"
|
||||
}
|
||||
val iPutIndex = miniPlayerConstructorMethodMatch.immutableMethod.indexOfFirstInstructionOrThrow(
|
||||
colorGreyIndex,
|
||||
Opcode.IPUT,
|
||||
)
|
||||
val colorMathPlayerIPutReference = miniPlayerConstructorMethod
|
||||
val colorMathPlayerIPutReference = miniPlayerConstructorMethodMatch.immutableMethod
|
||||
.getInstruction<ReferenceInstruction>(iPutIndex).reference
|
||||
|
||||
miniPlayerConstructorMethod.classDef.methods.single { method ->
|
||||
method.accessFlags == AccessFlags.PUBLIC.value or AccessFlags.FINAL.value &&
|
||||
method.returnType == "V" &&
|
||||
method.parameters == it.immutableMethod.parameters
|
||||
miniPlayerConstructorMethodMatch.immutableClassDef.firstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes(
|
||||
parameterTypePrefixes = it.method.parameterTypes.map { type -> type.toString() }
|
||||
.toTypedArray(),
|
||||
)
|
||||
}.apply {
|
||||
val insertIndex = indexOfFirstInstructionReversedOrThrow(Opcode.INVOKE_DIRECT)
|
||||
val freeRegister = findFreeRegister(insertIndex)
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
package app.revanced.patches.music.layout.miniplayercolor
|
||||
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
import app.revanced.patcher.instructions
|
||||
import app.revanced.patcher.opcodes
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.returnType
|
||||
import app.revanced.patches.shared.misc.mapping.ResourceType
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||
|
||||
internal val BytecodePatchContext.miniPlayerConstructorMethod by gettingFirstMethodDeclaratively {
|
||||
internal val miniPlayerConstructorMethodMatch = firstMethodComposite {
|
||||
returnType("V")
|
||||
instructions(
|
||||
ResourceType.ID("mpp_player_bottom_sheet"),
|
||||
"sharedToggleMenuItemMutations"(),
|
||||
)
|
||||
strings("sharedToggleMenuItemMutations")
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches to the class found in [miniPlayerConstructorMethod].
|
||||
* Matches to the class found in [miniPlayerConstructorMethodMatch].
|
||||
*/
|
||||
internal val BytecodePatchContext.switchToggleColorMethod by gettingFirstMethodDeclaratively {
|
||||
internal val switchToggleColorMethodMatch = firstMethodComposite {
|
||||
accessFlags(AccessFlags.PRIVATE, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes("L", "J")
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
package app.revanced.patches.music.layout.navigationbar
|
||||
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
import app.revanced.patcher.opcodes
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.returnType
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.util.containsLiteralInstruction
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstruction
|
||||
@@ -14,7 +9,7 @@ import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.Method
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
internal val BytecodePatchContext.tabLayoutTextMethod by gettingFirstMethodDeclaratively {
|
||||
internal val tabLayoutTextMethodMatch = firstMethodComposite("FEmusic_search") {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes("L")
|
||||
@@ -27,10 +22,9 @@ internal val BytecodePatchContext.tabLayoutTextMethod by gettingFirstMethodDecla
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.MOVE_RESULT,
|
||||
)
|
||||
strings("FEmusic_search")
|
||||
custom { method, _ ->
|
||||
method.containsLiteralInstruction(text1) &&
|
||||
indexOfGetVisibilityInstruction(method) >= 0
|
||||
custom {
|
||||
containsLiteralInstruction(text1) &&
|
||||
indexOfGetVisibilityInstruction(this) >= 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ val `Navigation bar` by creatingBytecodePatch(
|
||||
),
|
||||
)
|
||||
|
||||
tabLayoutTextMethod.apply {
|
||||
tabLayoutTextMethodMatch.method.apply {
|
||||
// Hide navigation labels.
|
||||
val constIndex = indexOfFirstLiteralInstructionOrThrow(text1)
|
||||
val targetIndex = indexOfFirstInstructionOrThrow(constIndex, Opcode.CHECK_CAST)
|
||||
@@ -99,7 +99,7 @@ val `Navigation bar` by creatingBytecodePatch(
|
||||
)
|
||||
|
||||
// Set navigation enum and hide navigation buttons.
|
||||
val enumIndex = tabLayoutTextMethod.patternMatch.startIndex + 3
|
||||
val enumIndex = tabLayoutTextMethodMatch.indices.first() + 3
|
||||
val enumRegister = getInstruction<OneRegisterInstruction>(enumIndex).registerA
|
||||
val insertEnumIndex = indexOfFirstInstructionOrThrow(Opcode.AND_INT_LIT8) - 2
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val BytecodePatchContext.hideGetPremiumMethod by gettingFirstMutableMethodDeclaratively(
|
||||
internal val hideGetPremiumMethodMatch = firstMethodComposite(
|
||||
"FEmusic_history",
|
||||
"FEmusic_offline"
|
||||
) {
|
||||
|
||||
@@ -39,23 +39,25 @@ val `Hide 'Get Music Premium'` by creatingBytecodePatch(
|
||||
SwitchPreference("revanced_music_hide_get_premium_label"),
|
||||
)
|
||||
|
||||
hideGetPremiumMethod.apply {
|
||||
val insertIndex = hideGetPremiumMethod.indices.last() // TODO
|
||||
hideGetPremiumMethodMatch.let {
|
||||
val insertIndex = it.indices.last()
|
||||
|
||||
val setVisibilityInstruction = getInstruction<FiveRegisterInstruction>(insertIndex)
|
||||
val getPremiumViewRegister = setVisibilityInstruction.registerC
|
||||
val visibilityRegister = setVisibilityInstruction.registerD
|
||||
it.method.apply {
|
||||
val setVisibilityInstruction = getInstruction<FiveRegisterInstruction>(insertIndex)
|
||||
val getPremiumViewRegister = setVisibilityInstruction.registerC
|
||||
val visibilityRegister = setVisibilityInstruction.registerD
|
||||
|
||||
replaceInstruction(
|
||||
insertIndex,
|
||||
"const/16 v$visibilityRegister, 0x8",
|
||||
)
|
||||
replaceInstruction(
|
||||
insertIndex,
|
||||
"const/16 v$visibilityRegister, 0x8",
|
||||
)
|
||||
|
||||
addInstruction(
|
||||
insertIndex + 1,
|
||||
"invoke-virtual {v$getPremiumViewRegister, v$visibilityRegister}, " +
|
||||
"Landroid/view/View;->setVisibility(I)V",
|
||||
)
|
||||
addInstruction(
|
||||
insertIndex + 1,
|
||||
"invoke-virtual {v$getPremiumViewRegister, v$visibilityRegister}, " +
|
||||
"Landroid/view/View;->setVisibility(I)V",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
membershipSettingsMethod.addInstructionsWithLabels(
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package app.revanced.patches.music.misc.extension.hooks
|
||||
|
||||
import app.revanced.patcher.instructions
|
||||
import app.revanced.patcher.invoke
|
||||
import app.revanced.patcher.name
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.returnType
|
||||
@@ -11,7 +13,7 @@ internal val applicationInitHook = extensionHook {
|
||||
name("onCreate")
|
||||
returnType("V")
|
||||
parameterTypes()
|
||||
strings("activity")
|
||||
instructions("activity"())
|
||||
}
|
||||
|
||||
internal val applicationInitOnCreateHook = activityOnCreateExtensionHook(YOUTUBE_MUSIC_MAIN_ACTIVITY_CLASS_TYPE)
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package app.revanced.patches.protonvpn.splittunneling
|
||||
|
||||
import app.revanced.patcher.gettingFirstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.name
|
||||
import app.revanced.patcher.opcodes
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val BytecodePatchContext.enableSplitTunnelingUiMethod by gettingFirstMutableMethodDeclaratively("currentModeAppNames") {
|
||||
internal val enableSplitTunnelingUiMethodMatch = firstMethodComposite("currentModeAppNames") {
|
||||
opcodes(
|
||||
Opcode.MOVE_OBJECT,
|
||||
Opcode.MOVE_FROM16,
|
||||
|
||||
@@ -14,11 +14,10 @@ val `Unlock split tunneling` by creatingBytecodePatch {
|
||||
compatibleWith("ch.protonvpn.android")
|
||||
|
||||
apply {
|
||||
val registerIndex = enableSplitTunnelingUiMethod.patternMatch!!.endIndex - 1 // TODO
|
||||
|
||||
enableSplitTunnelingUiMethod.apply {
|
||||
val register = getInstruction<OneRegisterInstruction>(registerIndex).registerA
|
||||
replaceInstruction(registerIndex, "const/4 v$register, 0x0")
|
||||
enableSplitTunnelingUiMethodMatch.let {
|
||||
val registerIndex = it.indices.last() - 1
|
||||
val register = it.method.getInstruction<OneRegisterInstruction>(registerIndex).registerA
|
||||
it.method.replaceInstruction(registerIndex, "const/4 v$register, 0x0")
|
||||
}
|
||||
|
||||
initializeSplitTunnelingSettingsUIMethod.apply {
|
||||
|
||||
@@ -69,11 +69,11 @@ val `Open Shorts in regular player` by creatingBytecodePatch(
|
||||
// Find the obfuscated method name for PlaybackStartDescriptor.videoId()
|
||||
val (videoIdStartMethod, videoIdIndex) = if (is_20_39_or_greater) {
|
||||
watchPanelVideoIdMethodMatch.let {
|
||||
it.method to it.indices.last()
|
||||
it.immutableMethod to it.indices.last()
|
||||
}
|
||||
} else {
|
||||
playbackStartFeatureFlagMethodMatch.let {
|
||||
it.method to it.indices.first()
|
||||
it.immutableMethod to it.indices.first()
|
||||
}
|
||||
}
|
||||
val playbackStartVideoIdMethodName = navigate(videoIdStartMethod).to(videoIdIndex).stop().name
|
||||
|
||||
Reference in New Issue
Block a user