mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-12 01:27:52 +01:00
refactor: simplify casting instructions
This commit is contained in:
parent
1abc929583
commit
aada4d9e9b
@ -1,15 +1,14 @@
|
|||||||
package app.revanced.patches.backdrops.misc.pro.patch
|
package app.revanced.patches.backdrops.misc.pro.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
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.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.instruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
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
|
||||||
@ -25,17 +24,20 @@ class ProUnlockPatch : BytecodePatch(
|
|||||||
listOf(ProUnlockFingerprint)
|
listOf(ProUnlockFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val result = ProUnlockFingerprint.result ?: return PatchResultError("${ProUnlockFingerprint.name} not found")
|
ProUnlockFingerprint.result?.let { result ->
|
||||||
|
val registerIndex = result.scanResult.patternScanResult!!.endIndex - 1
|
||||||
|
|
||||||
val moveRegisterInstruction = result.mutableMethod.instruction(result.scanResult.patternScanResult!!.endIndex - 1)
|
result.mutableMethod.apply {
|
||||||
val register = (moveRegisterInstruction as OneRegisterInstruction).registerA
|
val register = instruction<OneRegisterInstruction>(registerIndex).registerA
|
||||||
|
addInstructions(
|
||||||
result.mutableMethod.addInstructions(
|
|
||||||
result.scanResult.patternScanResult!!.endIndex,
|
result.scanResult.patternScanResult!!.endIndex,
|
||||||
"""
|
"""
|
||||||
const/4 v$register, 0x1
|
const/4 v$register, 0x1
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
} ?: return ProUnlockFingerprint.toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,8 @@ class HideTimelineAdsPatch : BytecodePatch(
|
|||||||
val scanStart = scanResult.patternScanResult!!.startIndex
|
val scanStart = scanResult.patternScanResult!!.startIndex
|
||||||
val jumpIndex = scanStart - 1
|
val jumpIndex = scanStart - 1
|
||||||
|
|
||||||
val mediaInstanceRegister = (mutableMethod.instruction(scanStart) as FiveRegisterInstruction).registerC
|
val mediaInstanceRegister = mutableMethod.instruction<FiveRegisterInstruction>(scanStart).registerC
|
||||||
val freeRegister = (mutableMethod.instruction(jumpIndex) as OneRegisterInstruction).registerA
|
val freeRegister = mutableMethod.instruction<OneRegisterInstruction>(jumpIndex).registerA
|
||||||
|
|
||||||
val returnFalseLabel = "an_ad"
|
val returnFalseLabel = "an_ad"
|
||||||
|
|
||||||
|
@ -30,7 +30,8 @@ class ClientSpoofPatch : BytecodePatch(
|
|||||||
UserAgentHeaderBuilderFingerprint.result?.let { result ->
|
UserAgentHeaderBuilderFingerprint.result?.let { result ->
|
||||||
val insertIndex = result.scanResult.patternScanResult!!.endIndex
|
val insertIndex = result.scanResult.patternScanResult!!.endIndex
|
||||||
result.mutableMethod.apply {
|
result.mutableMethod.apply {
|
||||||
val packageNameRegister = (instruction(insertIndex) as FiveRegisterInstruction).registerD
|
val packageNameRegister = instruction<FiveRegisterInstruction>(insertIndex).registerD
|
||||||
|
|
||||||
addInstruction(insertIndex, "const-string v$packageNameRegister, \"$ORIGINAL_PACKAGE_NAME\"")
|
addInstruction(insertIndex, "const-string v$packageNameRegister, \"$ORIGINAL_PACKAGE_NAME\"")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,19 +20,17 @@ class VerticalScrollPatch : BytecodePatch(
|
|||||||
listOf(CanScrollVerticallyFingerprint)
|
listOf(CanScrollVerticallyFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val result = CanScrollVerticallyFingerprint.result ?: return CanScrollVerticallyFingerprint.toErrorResult()
|
CanScrollVerticallyFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
val moveResultRegister = instruction<OneRegisterInstruction>(insertIndex - 1).registerA
|
||||||
|
|
||||||
with(result) {
|
addInstruction(
|
||||||
val method = mutableMethod
|
insertIndex,
|
||||||
|
|
||||||
val moveResultIndex = scanResult.patternScanResult!!.endIndex
|
|
||||||
val moveResultRegister = (method.instruction(moveResultIndex) as OneRegisterInstruction).registerA
|
|
||||||
|
|
||||||
method.addInstruction(
|
|
||||||
moveResultIndex + 1,
|
|
||||||
"const/4 v$moveResultRegister, 0x0"
|
"const/4 v$moveResultRegister, 0x0"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
} ?: return CanScrollVerticallyFingerprint.toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,8 @@ class DisableCaptureRestrictionBytecodePatch : BytecodePatch(
|
|||||||
// Store register of the integer parameter for setAllowedCapturePolicy
|
// Store register of the integer parameter for setAllowedCapturePolicy
|
||||||
invokeParamRegister = (instruction as FiveRegisterInstruction).registerD
|
invokeParamRegister = (instruction as FiveRegisterInstruction).registerD
|
||||||
invokePosition = index
|
invokePosition = index
|
||||||
|
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if(invokePosition == null || invokeParamRegister == null)
|
if(invokePosition == null || invokeParamRegister == null)
|
||||||
|
@ -25,7 +25,6 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||||
import org.jf.dexlib2.iface.reference.StringReference
|
import org.jf.dexlib2.iface.reference.StringReference
|
||||||
import org.jf.dexlib2.iface.reference.TypeReference
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([IntegrationsPatch::class])
|
@DependsOn([IntegrationsPatch::class])
|
||||||
@ -96,7 +95,7 @@ class SettingsPatch : BytecodePatch(
|
|||||||
private fun patchOptionNameAndOnClickEvent(index: Int, context: BytecodeContext) {
|
private fun patchOptionNameAndOnClickEvent(index: Int, context: BytecodeContext) {
|
||||||
with(SettingsOnViewCreatedFingerprint.result!!.mutableMethod) {
|
with(SettingsOnViewCreatedFingerprint.result!!.mutableMethod) {
|
||||||
// Patch option name
|
// Patch option name
|
||||||
val overrideRegister = (instruction(index - 4) as OneRegisterInstruction).registerA
|
val overrideRegister = instruction<OneRegisterInstruction>(index - 4).registerA
|
||||||
replaceInstruction(
|
replaceInstruction(
|
||||||
index - 4,
|
index - 4,
|
||||||
"""
|
"""
|
||||||
@ -105,9 +104,8 @@ class SettingsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Patch option OnClick Event
|
// Patch option OnClick Event
|
||||||
with(((instruction(index) as ReferenceInstruction).reference as TypeReference).type) {
|
val type = instruction<ReferenceInstruction>(index).reference.toString()
|
||||||
context.findClass(this)!!.mutableClass.methods.first { it.name == "onClick" }
|
context.findClass(type)!!.mutableClass.methods.first { type == "onClick" }.addInstructions(
|
||||||
.addInstructions(
|
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
invoke-static {}, Lapp/revanced/tiktok/settingsmenu/SettingsMenu;->startSettingsActivity()V
|
invoke-static {}, Lapp/revanced/tiktok/settingsmenu/SettingsMenu;->startSettingsActivity()V
|
||||||
@ -116,5 +114,4 @@ class SettingsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
@ -97,7 +97,7 @@ class SpoofSimPatch : BytecodePatch() {
|
|||||||
|
|
||||||
// Patch Android API and return fake sim information
|
// Patch Android API and return fake sim information
|
||||||
private fun MutableMethod.replaceReference(index: Int, replacement: String) {
|
private fun MutableMethod.replaceReference(index: Int, replacement: String) {
|
||||||
val resultReg = (instruction(index + 1) as OneRegisterInstruction).registerA
|
val resultReg = instruction<OneRegisterInstruction>(index + 1).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
index + 2,
|
index + 2,
|
||||||
|
@ -4,8 +4,12 @@ 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.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.*
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.patch.*
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
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
|
||||||
@ -13,7 +17,9 @@ import app.revanced.patches.shared.settings.preference.impl.ArrayResource
|
|||||||
import app.revanced.patches.shared.settings.preference.impl.ListPreference
|
import app.revanced.patches.shared.settings.preference.impl.ListPreference
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
import app.revanced.patches.twitch.chat.antidelete.annotations.ShowDeletedMessagesCompatibility
|
import app.revanced.patches.twitch.chat.antidelete.annotations.ShowDeletedMessagesCompatibility
|
||||||
import app.revanced.patches.twitch.chat.antidelete.fingerprints.*
|
import app.revanced.patches.twitch.chat.antidelete.fingerprints.ChatUtilCreateDeletedSpanFingerprint
|
||||||
|
import app.revanced.patches.twitch.chat.antidelete.fingerprints.DeletedMessageClickableSpanCtorFingerprint
|
||||||
|
import app.revanced.patches.twitch.chat.antidelete.fingerprints.SetHasModAccessFingerprint
|
||||||
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
|
||||||
|
@ -4,7 +4,9 @@ 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.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.*
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
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.PatchResult
|
||||||
@ -19,7 +21,10 @@ import app.revanced.patches.shared.settings.util.AbstractPreferenceScreen
|
|||||||
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.twitch.misc.settings.annotations.SettingsCompatibility
|
import app.revanced.patches.twitch.misc.settings.annotations.SettingsCompatibility
|
||||||
import app.revanced.patches.twitch.misc.settings.components.CustomPreferenceCategory
|
import app.revanced.patches.twitch.misc.settings.components.CustomPreferenceCategory
|
||||||
import app.revanced.patches.twitch.misc.settings.fingerprints.*
|
import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsOnClickFingerprint
|
||||||
|
import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsUpdatedFingerprint
|
||||||
|
import app.revanced.patches.twitch.misc.settings.fingerprints.SettingsActivityOnCreateFingerprint
|
||||||
|
import app.revanced.patches.twitch.misc.settings.fingerprints.SettingsMenuItemEnumFingerprint
|
||||||
import app.revanced.patches.twitch.misc.settings.resource.patch.SettingsResourcePatch
|
import app.revanced.patches.twitch.misc.settings.resource.patch.SettingsResourcePatch
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.immutable.ImmutableField
|
import org.jf.dexlib2.immutable.ImmutableField
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package app.revanced.patches.youtube.ad.general.bytecode.patch
|
package app.revanced.patches.youtube.ad.general.bytecode.patch
|
||||||
|
|
||||||
import app.revanced.extensions.findMutableMethodOf
|
import app.revanced.extensions.findMutableMethodOf
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
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.annotation.Version
|
||||||
@ -9,16 +10,15 @@ import app.revanced.patcher.extensions.addInstruction
|
|||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.instruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
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
|
||||||
|
import app.revanced.patches.shared.misc.fix.verticalscroll.patch.VerticalScrollPatch
|
||||||
import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility
|
import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility
|
||||||
import app.revanced.patches.youtube.ad.general.bytecode.fingerprints.ReelConstructorFingerprint
|
import app.revanced.patches.youtube.ad.general.bytecode.fingerprints.ReelConstructorFingerprint
|
||||||
import app.revanced.patches.youtube.ad.general.resource.patch.GeneralAdsResourcePatch
|
import app.revanced.patches.youtube.ad.general.resource.patch.GeneralAdsResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.fix.backtoexitgesture.patch.FixBackToExitGesturePatch
|
import app.revanced.patches.youtube.misc.fix.backtoexitgesture.patch.FixBackToExitGesturePatch
|
||||||
import app.revanced.patches.shared.misc.fix.verticalscroll.patch.VerticalScrollPatch
|
|
||||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||||
@ -71,20 +71,16 @@ class GeneralAdsPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
with(
|
ReelConstructorFingerprint.result?.let {
|
||||||
ReelConstructorFingerprint.result
|
|
||||||
?: return PatchResultError("Could not resolve fingerprint")
|
|
||||||
) {
|
|
||||||
// iput-object v$viewRegister, ...
|
// iput-object v$viewRegister, ...
|
||||||
val insertIndex = this.scanResult.patternScanResult!!.startIndex + 2
|
val insertIndex = it.scanResult.patternScanResult!!.startIndex + 2
|
||||||
|
|
||||||
with(this.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val viewRegister = (instruction(insertIndex) as TwoRegisterInstruction).registerA
|
val viewRegister = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
injectHideCall(insertIndex, viewRegister, "hideReelView")
|
injectHideCall(insertIndex, viewRegister, "hideReelView")
|
||||||
}
|
}
|
||||||
|
} ?: return ReelConstructorFingerprint.toErrorResult()
|
||||||
}
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class HideAutoplayButtonPatch : BytecodePatch(
|
|||||||
val jumpInstruction = layoutGenMethodInstructions[insertIndex + branchIndex] as Instruction
|
val jumpInstruction = layoutGenMethodInstructions[insertIndex + branchIndex] as Instruction
|
||||||
|
|
||||||
// can be clobbered because this register is overwritten after the injected code
|
// can be clobbered because this register is overwritten after the injected code
|
||||||
val clobberRegister = (instruction(insertIndex) as OneRegisterInstruction).registerA
|
val clobberRegister = instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
|
@ -149,7 +149,7 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
|
|||||||
}!!.index
|
}!!.index
|
||||||
|
|
||||||
val conditionalCheckIndex = stringIndex - 1
|
val conditionalCheckIndex = stringIndex - 1
|
||||||
val conditionRegister = (instruction(conditionalCheckIndex) as OneRegisterInstruction).registerA
|
val conditionRegister = instruction<OneRegisterInstruction>(conditionalCheckIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
conditionalCheckIndex,
|
conditionalCheckIndex,
|
||||||
|
@ -20,7 +20,7 @@ internal object InjectionUtils {
|
|||||||
|
|
||||||
// Register to pass to the hook
|
// Register to pass to the hook
|
||||||
val registerIndex = insertIndex - 1 // MOVE_RESULT_OBJECT is always the previous instruction
|
val registerIndex = insertIndex - 1 // MOVE_RESULT_OBJECT is always the previous instruction
|
||||||
val register = (injectTarget.instruction(registerIndex) as OneRegisterInstruction).registerA
|
val register = injectTarget.instruction<OneRegisterInstruction>(registerIndex).registerA
|
||||||
|
|
||||||
injectTarget.addInstruction(
|
injectTarget.addInstruction(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
|
@ -55,7 +55,7 @@ class HidePlayerButtonsPatch : BytecodePatch(
|
|||||||
|
|
||||||
PlayerControlsVisibilityModelFingerprint.result?.apply {
|
PlayerControlsVisibilityModelFingerprint.result?.apply {
|
||||||
val callIndex = scanResult.patternScanResult!!.endIndex
|
val callIndex = scanResult.patternScanResult!!.endIndex
|
||||||
val callInstruction = mutableMethod.instruction(callIndex) as Instruction3rc
|
val callInstruction = mutableMethod.instruction<Instruction3rc>(callIndex)
|
||||||
|
|
||||||
// overriding this parameter register hides the previous and next buttons
|
// overriding this parameter register hides the previous and next buttons
|
||||||
val hasNextParameterRegister = callInstruction.startRegister + ParameterOffsets.HAS_NEXT
|
val hasNextParameterRegister = callInstruction.startRegister + ParameterOffsets.HAS_NEXT
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.albumcards.bytecode.patch
|
package app.revanced.patches.youtube.layout.hide.albumcards.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.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.annotation.Version
|
||||||
@ -29,16 +30,22 @@ class AlbumCardsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val albumCardsResult = AlbumCardsFingerprint.result!!
|
AlbumCardsFingerprint.result?.let {
|
||||||
val albumCardsMethod = albumCardsResult.mutableMethod
|
it.mutableMethod.apply {
|
||||||
|
val checkCastAnchorIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
val insertIndex = checkCastAnchorIndex + 1
|
||||||
|
|
||||||
val checkCastAnchorIndex = albumCardsResult.scanResult.patternScanResult!!.endIndex
|
val albumCardViewRegister = instruction<OneRegisterInstruction>(checkCastAnchorIndex).registerA
|
||||||
|
|
||||||
albumCardsMethod.addInstruction(
|
addInstruction(
|
||||||
checkCastAnchorIndex + 1, """
|
insertIndex,
|
||||||
invoke-static {v${(albumCardsMethod.instruction(checkCastAnchorIndex) as OneRegisterInstruction).registerA}}, Lapp/revanced/integrations/patches/HideAlbumCardsPatch;->hideAlbumCards(Landroid/view/View;)V
|
"invoke-static {v$albumCardViewRegister}, " +
|
||||||
"""
|
"Lapp/revanced/integrations/patches/HideAlbumCardsPatch;" +
|
||||||
|
"->" +
|
||||||
|
"hideAlbumCards(Landroid/view/View;)V"
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
} ?: return AlbumCardsFingerprint.toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.breakingnews.bytecode.patch
|
package app.revanced.patches.youtube.layout.hide.breakingnews.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.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.annotation.Version
|
||||||
@ -24,22 +25,29 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
@BreakingNewsCompatibility
|
@BreakingNewsCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class BreakingNewsPatch : BytecodePatch(
|
class BreakingNewsPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(BreakingNewsFingerprint)
|
||||||
BreakingNewsFingerprint,
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val breakingNewsResult = BreakingNewsFingerprint.result!!
|
BreakingNewsFingerprint.result?.let {
|
||||||
val breakingNewsMethod = breakingNewsResult.mutableMethod
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
||||||
|
val moveResultIndex = insertIndex - 1
|
||||||
|
|
||||||
val moveResultObjectIndex =
|
it.mutableMethod.apply {
|
||||||
breakingNewsResult.scanResult.patternScanResult!!.endIndex - 2
|
val breakingNewsViewRegister = instruction<OneRegisterInstruction>(moveResultIndex).registerA
|
||||||
|
|
||||||
breakingNewsMethod.addInstruction(
|
addInstruction(
|
||||||
moveResultObjectIndex + 1, """
|
insertIndex,
|
||||||
invoke-static {v${(breakingNewsMethod.instruction(moveResultObjectIndex) as OneRegisterInstruction).registerA}}, Lapp/revanced/integrations/patches/HideBreakingNewsPatch;->hideBreakingNews(Landroid/view/View;)V
|
"""
|
||||||
|
invoke-static {v$breakingNewsViewRegister},
|
||||||
|
Lapp/revanced/integrations/patches/HideBreakingNewsPatch;
|
||||||
|
->
|
||||||
|
hideBreakingNews(Landroid/view/View;)V
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
} ?: return BreakingNewsFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.comments.bytecode.patch
|
package app.revanced.patches.youtube.layout.hide.comments.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
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.annotation.Version
|
||||||
@ -32,9 +33,6 @@ class CommentsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val shortsCommentsButtonResult = ShortsCommentsButtonFingerprint.result!!
|
|
||||||
val shortsCommentsButtonMethod = shortsCommentsButtonResult.mutableMethod
|
|
||||||
|
|
||||||
val checkCastAnchorFingerprint = object : MethodFingerprint(
|
val checkCastAnchorFingerprint = object : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.CONST,
|
Opcode.CONST,
|
||||||
@ -47,15 +45,24 @@ class CommentsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
val checkCastAnchorIndex = checkCastAnchorFingerprint.also {
|
ShortsCommentsButtonFingerprint.result?.let {
|
||||||
it.resolve(context, shortsCommentsButtonMethod, shortsCommentsButtonResult.classDef)
|
it.mutableMethod.apply {
|
||||||
|
val checkCastAnchorIndex = checkCastAnchorFingerprint.also { result ->
|
||||||
|
if (!result.resolve(context, this, it.classDef))
|
||||||
|
throw checkCastAnchorFingerprint.toErrorResult()
|
||||||
}.result!!.scanResult.patternScanResult!!.endIndex
|
}.result!!.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
shortsCommentsButtonMethod.addInstructions(
|
val shortsCommentsButtonRegister = instruction<OneRegisterInstruction>(checkCastAnchorIndex).registerA
|
||||||
checkCastAnchorIndex + 1, """
|
val insertIndex = checkCastAnchorIndex + 1
|
||||||
invoke-static {v${(shortsCommentsButtonMethod.instruction(checkCastAnchorIndex) as OneRegisterInstruction).registerA}}, Lapp/revanced/integrations/patches/HideShortsCommentsButtonPatch;->hideShortsCommentsButton(Landroid/view/View;)V
|
|
||||||
|
addInstructions(
|
||||||
|
insertIndex,
|
||||||
|
"""
|
||||||
|
invoke-static {v$shortsCommentsButtonRegister, Lapp/revanced/integrations/patches/HideShortsCommentsButtonPatch;->hideShortsCommentsButton(Landroid/view/View;)V
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
} ?: return ShortsCommentsButtonFingerprint.toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class CrowdfundingBoxPatch : BytecodePatch(
|
|||||||
CrowdfundingBoxFingerprint.result?.let {
|
CrowdfundingBoxFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val objectRegister = (instruction(insertIndex) as TwoRegisterInstruction).registerA
|
val objectRegister = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstruction(insertIndex, "invoke-static {v$objectRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR")
|
addInstruction(insertIndex, "invoke-static {v$objectRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR")
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.endscreencards.bytecode.patch
|
package app.revanced.patches.youtube.layout.hide.endscreencards.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.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.annotation.Version
|
||||||
@ -35,19 +36,23 @@ class HideEndscreenCardsPatch : BytecodePatch(
|
|||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
fun MethodFingerprint.injectHideCall() {
|
fun MethodFingerprint.injectHideCall() {
|
||||||
val layoutResult = result!!
|
val layoutResult = result ?: throw toErrorResult()
|
||||||
val layoutMethod = layoutResult.mutableMethod
|
layoutResult.mutableMethod.apply {
|
||||||
|
val insertIndex = layoutResult.scanResult.patternScanResult!!.endIndex + 1
|
||||||
|
val viewRegister = instruction<Instruction21c>(insertIndex - 1).registerA
|
||||||
|
|
||||||
val checkCastIndex = layoutResult.scanResult.patternScanResult!!.endIndex
|
addInstruction(
|
||||||
val viewRegister = (layoutMethod.instruction(checkCastIndex) as Instruction21c).registerA
|
insertIndex,
|
||||||
|
|
||||||
layoutMethod.addInstruction(
|
|
||||||
checkCastIndex + 1,
|
|
||||||
"invoke-static { v$viewRegister }, Lapp/revanced/integrations/patches/HideEndscreenCardsPatch;->hideEndscreen(Landroid/view/View;)V"
|
"invoke-static { v$viewRegister }, Lapp/revanced/integrations/patches/HideEndscreenCardsPatch;->hideEndscreen(Landroid/view/View;)V"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
listOf(LayoutCircleFingerprint, LayoutIconFingerprint, LayoutVideoFingerprint).forEach(MethodFingerprint::injectHideCall)
|
listOf(
|
||||||
|
LayoutCircleFingerprint,
|
||||||
|
LayoutIconFingerprint,
|
||||||
|
LayoutVideoFingerprint
|
||||||
|
).forEach(MethodFingerprint::injectHideCall)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ class HideFloatingMicrophoneButtonPatch : BytecodePatch(
|
|||||||
ShowFloatingMicrophoneButtonFingerprint.result?.let { result ->
|
ShowFloatingMicrophoneButtonFingerprint.result?.let { result ->
|
||||||
with(result.mutableMethod) {
|
with(result.mutableMethod) {
|
||||||
val insertIndex = result.scanResult.patternScanResult!!.startIndex + 1
|
val insertIndex = result.scanResult.patternScanResult!!.startIndex + 1
|
||||||
val showButtonRegister = (instruction(insertIndex - 1) as TwoRegisterInstruction).registerA
|
val showButtonRegister = instruction<TwoRegisterInstruction>(insertIndex - 1).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
|
@ -45,8 +45,9 @@ class HideGetPremiumPatch : BytecodePatch(
|
|||||||
GetPremiumViewFingerprint.result?.let {
|
GetPremiumViewFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
val measuredWidthRegister = (instruction(startIndex) as TwoRegisterInstruction).registerA
|
val measuredWidthRegister = instruction<TwoRegisterInstruction>(startIndex).registerA
|
||||||
val measuredHeightInstruction = instruction(startIndex + 1) as TwoRegisterInstruction
|
val measuredHeightInstruction = instruction<TwoRegisterInstruction>(startIndex + 1)
|
||||||
|
|
||||||
val measuredHeightRegister = measuredHeightInstruction.registerA
|
val measuredHeightRegister = measuredHeightInstruction.registerA
|
||||||
val tempRegister = measuredHeightInstruction.registerB
|
val tempRegister = measuredHeightInstruction.registerB
|
||||||
|
|
||||||
|
@ -20,7 +20,8 @@ import app.revanced.patches.youtube.layout.hide.infocards.fingerprints.Infocards
|
|||||||
import app.revanced.patches.youtube.layout.hide.infocards.resource.patch.HideInfocardsResourcePatch
|
import app.revanced.patches.youtube.layout.hide.infocards.resource.patch.HideInfocardsResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([IntegrationsPatch::class, HideInfocardsResourcePatch::class])
|
@DependsOn([IntegrationsPatch::class, HideInfocardsResourcePatch::class])
|
||||||
@ -35,18 +36,17 @@ class HideInfoCardsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
with(InfocardsIncognitoFingerprint.also {
|
InfocardsIncognitoFingerprint.also {
|
||||||
it.resolve(context, InfocardsIncognitoParentFingerprint.result!!.classDef)
|
it.resolve(context, InfocardsIncognitoParentFingerprint.result!!.classDef)
|
||||||
}.result!!.mutableMethod) {
|
}.result!!.mutableMethod.apply {
|
||||||
val invokeInstructionIndex = implementation!!.instructions.indexOfFirst {
|
val invokeInstructionIndex = implementation!!.instructions.indexOfFirst {
|
||||||
it.opcode.ordinal == Opcode.INVOKE_VIRTUAL.ordinal &&
|
it.opcode.ordinal == Opcode.INVOKE_VIRTUAL.ordinal &&
|
||||||
((it as? BuilderInstruction35c)?.reference.toString() ==
|
((it as ReferenceInstruction).reference.toString() == "Landroid/view/View;->setVisibility(I)V")
|
||||||
"Landroid/view/View;->setVisibility(I)V")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
invokeInstructionIndex,
|
invokeInstructionIndex,
|
||||||
"invoke-static {v${(instruction(invokeInstructionIndex) as? BuilderInstruction35c)?.registerC}}," +
|
"invoke-static {v${instruction<FiveRegisterInstruction>(invokeInstructionIndex).registerC}}," +
|
||||||
" Lapp/revanced/integrations/patches/HideInfoCardsPatch;->hideInfoCardsIncognito(Landroid/view/View;)V"
|
" Lapp/revanced/integrations/patches/HideInfoCardsPatch;->hideInfoCardsIncognito(Landroid/view/View;)V"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.personalinformation.bytecode.patch
|
package app.revanced.patches.youtube.layout.hide.personalinformation.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
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.annotation.Version
|
||||||
@ -29,23 +30,22 @@ class HideEmailAddressPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val accountSwitcherAccessibilityLabelResult = AccountSwitcherAccessibilityLabelFingerprint.result!!
|
AccountSwitcherAccessibilityLabelFingerprint.result?.let {
|
||||||
val accountSwitcherAccessibilityLabelMethod = accountSwitcherAccessibilityLabelResult.mutableMethod
|
it.mutableMethod.apply {
|
||||||
|
val setVisibilityConstIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
val setVisibilityConstIndex =
|
val setVisibilityConstRegister =
|
||||||
accountSwitcherAccessibilityLabelResult.scanResult.patternScanResult!!.endIndex
|
instruction<OneRegisterInstruction>(setVisibilityConstIndex - 2).registerA
|
||||||
|
|
||||||
val setVisibilityConstRegister = (
|
addInstructions(
|
||||||
accountSwitcherAccessibilityLabelMethod.instruction
|
setVisibilityConstIndex,
|
||||||
(setVisibilityConstIndex - 2) as OneRegisterInstruction
|
"""
|
||||||
).registerA
|
|
||||||
|
|
||||||
accountSwitcherAccessibilityLabelMethod.addInstructions(
|
|
||||||
setVisibilityConstIndex, """
|
|
||||||
invoke-static {v$setVisibilityConstRegister}, Lapp/revanced/integrations/patches/HideEmailAddressPatch;->hideEmailAddress(I)I
|
invoke-static {v$setVisibilityConstRegister}, Lapp/revanced/integrations/patches/HideEmailAddressPatch;->hideEmailAddress(I)I
|
||||||
move-result v$setVisibilityConstRegister
|
move-result v$setVisibilityConstRegister
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
} ?: return AccountSwitcherAccessibilityLabelFingerprint.toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
@ -102,18 +102,21 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
|||||||
val atomicReferenceStartIndex = TextComponentAtomicReferenceFingerprint.result!!
|
val atomicReferenceStartIndex = TextComponentAtomicReferenceFingerprint.result!!
|
||||||
.scanResult.patternScanResult!!.startIndex
|
.scanResult.patternScanResult!!.startIndex
|
||||||
|
|
||||||
|
val insertIndex = atomicReferenceStartIndex + 8
|
||||||
|
|
||||||
textComponentContextFingerprintResult.mutableMethod.apply {
|
textComponentContextFingerprintResult.mutableMethod.apply {
|
||||||
// Get the conversion context obfuscated field name, and the registers for the AtomicReference and CharSequence
|
// Get the conversion context obfuscated field name, and the registers for the AtomicReference and CharSequence
|
||||||
val conversionContextFieldReference =
|
val conversionContextFieldReference =
|
||||||
(instruction(conversionContextIndex) as ReferenceInstruction).reference
|
instruction<ReferenceInstruction>(conversionContextIndex).reference
|
||||||
|
|
||||||
// any free register
|
// any free register
|
||||||
val contextRegister =
|
val contextRegister =
|
||||||
(instruction(atomicReferenceStartIndex) as TwoRegisterInstruction).registerB
|
instruction<TwoRegisterInstruction>(atomicReferenceStartIndex).registerB
|
||||||
val atomicReferenceRegister =
|
|
||||||
(instruction(atomicReferenceStartIndex + 5) as FiveRegisterInstruction).registerC
|
|
||||||
|
|
||||||
val insertIndex = atomicReferenceStartIndex + 8
|
val atomicReferenceRegister =
|
||||||
val moveCharSequenceInstruction = instruction(insertIndex) as TwoRegisterInstruction
|
instruction<FiveRegisterInstruction>(atomicReferenceStartIndex + 5).registerC
|
||||||
|
|
||||||
|
val moveCharSequenceInstruction = instruction<TwoRegisterInstruction>(insertIndex)
|
||||||
val charSequenceRegister = moveCharSequenceInstruction.registerB
|
val charSequenceRegister = moveCharSequenceInstruction.registerB
|
||||||
|
|
||||||
// Insert as first instructions at the control flow label.
|
// Insert as first instructions at the control flow label.
|
||||||
@ -145,8 +148,8 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
|||||||
return PatchResultError("Method signature did not match: $this $parameterTypes")
|
return PatchResultError("Method signature did not match: $this $parameterTypes")
|
||||||
|
|
||||||
val insertIndex = implementation!!.instructions.size - 1
|
val insertIndex = implementation!!.instructions.size - 1
|
||||||
val spannedParameterRegister = (instruction(insertIndex) as OneRegisterInstruction).registerA
|
val spannedParameterRegister = instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
val parameter = (instruction(insertIndex - 2) as BuilderInstruction35c).reference
|
val parameter = instruction<BuilderInstruction35c>(insertIndex - 2).reference
|
||||||
|
|
||||||
if (!parameter.toString().endsWith("Landroid/text/Spanned;"))
|
if (!parameter.toString().endsWith("Landroid/text/Spanned;"))
|
||||||
return PatchResultError("Method signature parameter did not match: $parameter")
|
return PatchResultError("Method signature parameter did not match: $parameter")
|
||||||
@ -171,9 +174,12 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
|||||||
DislikesOldLayoutTextViewFingerprint.result?.let {
|
DislikesOldLayoutTextViewFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
val resourceIdentifierRegister = (instruction(startIndex) as OneRegisterInstruction).registerA
|
|
||||||
val textViewRegister = (instruction(startIndex + 4) as OneRegisterInstruction).registerA
|
val resourceIdentifierRegister = instruction<OneRegisterInstruction>(startIndex).registerA
|
||||||
addInstruction(startIndex + 4,
|
val textViewRegister = instruction<OneRegisterInstruction>(startIndex + 4).registerA
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
startIndex + 4,
|
||||||
"invoke-static {v$resourceIdentifierRegister, v$textViewRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->setOldUILayoutDislikes(ILandroid/widget/TextView;)V"
|
"invoke-static {v$resourceIdentifierRegister, v$textViewRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->setOldUILayoutDislikes(ILandroid/widget/TextView;)V"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class ThemeBytecodePatch : BytecodePatch(
|
|||||||
val putColorValueIndex = it.method.indexOfInstructionWithSeekbarId!! + 3
|
val putColorValueIndex = it.method.indexOfInstructionWithSeekbarId!! + 3
|
||||||
|
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val overrideRegister = (instruction(putColorValueIndex) as TwoRegisterInstruction).registerA
|
val overrideRegister = instruction<TwoRegisterInstruction>(putColorValueIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
putColorValueIndex,
|
putColorValueIndex,
|
||||||
@ -57,7 +57,7 @@ class ThemeBytecodePatch : BytecodePatch(
|
|||||||
.getMethod() as MutableMethod
|
.getMethod() as MutableMethod
|
||||||
|
|
||||||
method.apply {
|
method.apply {
|
||||||
val colorRegister = (method.instruction(0) as TwoRegisterInstruction).registerA
|
val colorRegister = method.instruction<TwoRegisterInstruction>(0).registerA
|
||||||
addInstructions(
|
addInstructions(
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
|
@ -93,7 +93,7 @@ class VideoInformationPatch : BytecodePatch(
|
|||||||
|
|
||||||
with(videoLengthMethodResult.mutableMethod) {
|
with(videoLengthMethodResult.mutableMethod) {
|
||||||
val videoLengthRegisterIndex = videoLengthMethodResult.scanResult.patternScanResult!!.endIndex - 2
|
val videoLengthRegisterIndex = videoLengthMethodResult.scanResult.patternScanResult!!.endIndex - 2
|
||||||
val videoLengthRegister = (instruction(videoLengthRegisterIndex) as OneRegisterInstruction).registerA
|
val videoLengthRegister = instruction<OneRegisterInstruction>(videoLengthRegisterIndex).registerA
|
||||||
val dummyRegisterForLong = videoLengthRegister + 1 // required for long values since they are wide
|
val dummyRegisterForLong = videoLengthRegister + 1 // required for long values since they are wide
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
@ -140,7 +140,7 @@ class VideoInformationPatch : BytecodePatch(
|
|||||||
speedSelectionInsertMethod = mutableMethod
|
speedSelectionInsertMethod = mutableMethod
|
||||||
speedSelectionInsertIndex = scanResult.patternScanResult!!.startIndex - 3
|
speedSelectionInsertIndex = scanResult.patternScanResult!!.startIndex - 3
|
||||||
speedSelectionValueRegister =
|
speedSelectionValueRegister =
|
||||||
(mutableMethod.instruction(speedSelectionInsertIndex) as FiveRegisterInstruction).registerD
|
mutableMethod.instruction<FiveRegisterInstruction>(speedSelectionInsertIndex).registerD
|
||||||
|
|
||||||
val speedSelectionMethodInstructions = mutableMethod.implementation!!.instructions
|
val speedSelectionMethodInstructions = mutableMethod.implementation!!.instructions
|
||||||
setPlaybackSpeedContainerClassFieldReference =
|
setPlaybackSpeedContainerClassFieldReference =
|
||||||
|
@ -7,7 +7,9 @@ import app.revanced.patcher.annotation.Version
|
|||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.instruction
|
||||||
import app.revanced.patcher.patch.*
|
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,7 +33,7 @@ class VideoIdPatch : BytecodePatch(
|
|||||||
result.mutableMethod.also {
|
result.mutableMethod.also {
|
||||||
insertMethod = it
|
insertMethod = it
|
||||||
}.apply {
|
}.apply {
|
||||||
videoIdRegister = (instruction(videoIdRegisterInstructionIndex) as OneRegisterInstruction).registerA
|
videoIdRegister = instruction<OneRegisterInstruction>(videoIdRegisterInstructionIndex).registerA
|
||||||
insertIndex = videoIdRegisterInstructionIndex + 1
|
insertIndex = videoIdRegisterInstructionIndex + 1
|
||||||
}
|
}
|
||||||
} ?: return VideoIdFingerprint.toErrorResult()
|
} ?: return VideoIdFingerprint.toErrorResult()
|
||||||
@ -44,7 +44,7 @@ class VideoIdPatch : BytecodePatch(
|
|||||||
result.mutableMethod.also {
|
result.mutableMethod.also {
|
||||||
backgroundPlaybackMethod = it
|
backgroundPlaybackMethod = it
|
||||||
}.apply {
|
}.apply {
|
||||||
backgroundPlaybackVideoIdRegister = (instruction(endIndex + 1) as OneRegisterInstruction).registerA
|
backgroundPlaybackVideoIdRegister = instruction<OneRegisterInstruction>(endIndex + 1).registerA
|
||||||
backgroundPlaybackInsertIndex = endIndex + 2
|
backgroundPlaybackInsertIndex = endIndex + 2
|
||||||
}
|
}
|
||||||
} ?: return VideoIdFingerprintBackgroundPlay.toErrorResult()
|
} ?: return VideoIdFingerprintBackgroundPlay.toErrorResult()
|
||||||
|
@ -12,9 +12,9 @@ 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
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.misc.zoomhaptics.annotations.ZoomHapticsCompatibility
|
import app.revanced.patches.youtube.misc.zoomhaptics.annotations.ZoomHapticsCompatibility
|
||||||
import app.revanced.patches.youtube.misc.zoomhaptics.fingerprints.ZoomHapticsFingerprint
|
import app.revanced.patches.youtube.misc.zoomhaptics.fingerprints.ZoomHapticsFingerprint
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class HideAdsPatch : BytecodePatch(
|
|||||||
ContainsAdFingerprint.result?.let { result ->
|
ContainsAdFingerprint.result?.let { result ->
|
||||||
result.mutableMethod.apply {
|
result.mutableMethod.apply {
|
||||||
val insertIndex = result.scanResult.patternScanResult!!.endIndex + 1
|
val insertIndex = result.scanResult.patternScanResult!!.endIndex + 1
|
||||||
val adsListRegister = (instruction(insertIndex - 2) as Instruction21c).registerA
|
val adsListRegister = instruction<Instruction21c>(insertIndex - 2).registerA
|
||||||
|
|
||||||
listOf(
|
listOf(
|
||||||
"_buttoned_layout",
|
"_buttoned_layout",
|
||||||
|
Loading…
Reference in New Issue
Block a user