mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-16 22:37:17 +02:00
refactor: simplify casting instructions
This commit is contained in:
parent
0f5350e691
commit
2b70050200
@ -9,7 +9,5 @@ object ClientInfoFingerprint : MethodFingerprint(
|
|||||||
returnType = "L",
|
returnType = "L",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
opcodes = listOf(
|
opcodes = listOf(Opcode.OR_INT_LIT16)
|
||||||
Opcode.OR_INT_LIT16
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
@ -4,11 +4,6 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object OnBackPressedFingerprint : MethodFingerprint(
|
object OnBackPressedFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(Opcode.RETURN_VOID),
|
||||||
Opcode.RETURN_VOID
|
customFingerprint = { it.definingClass.endsWith("WatchWhileActivity;") && it.name == "onBackPressed" }
|
||||||
),
|
|
||||||
customFingerprint = { methodDef ->
|
|
||||||
methodDef.definingClass.endsWith("WatchWhileActivity;")
|
|
||||||
&& methodDef.name == "onBackPressed"
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
@ -30,25 +30,25 @@ class DoubleBackToClosePatch : BytecodePatch(
|
|||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
/*
|
/**
|
||||||
Hook onBackPressed method inside WatchWhileActivity
|
* Hook onBackPressed method inside WatchWhileActivity
|
||||||
*/
|
*/
|
||||||
OnBackPressedFingerprint.result?.let {
|
OnBackPressedFingerprint.result?.let {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
it.mutableMethod.apply {
|
||||||
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
with(it.mutableMethod) {
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
"invoke-static {p0}, $INTEGRATIONS_CLASS_DESCRIPTOR" +
|
"invoke-static {p0}, $INTEGRATIONS_CLASS_DESCRIPTOR" +
|
||||||
"->" +
|
"->" +
|
||||||
"closeActivityOnBackPressed(Landroid/app/Activity;)V"
|
"closeActivityOnBackPressed(Landroid/app/Activity;)V"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: return OnBackPressedFingerprint.toErrorResult()
|
} ?: return OnBackPressedFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
Inject the methods which start of ScrollView
|
* Inject the methods which start of ScrollView
|
||||||
*/
|
*/
|
||||||
ScrollPositionFingerprint.result?.let {
|
ScrollPositionFingerprint.result?.let {
|
||||||
val insertMethod = context.toMethodWalker(it.method)
|
val insertMethod = context.toMethodWalker(it.method)
|
||||||
@ -57,19 +57,18 @@ class DoubleBackToClosePatch : BytecodePatch(
|
|||||||
|
|
||||||
val insertIndex = insertMethod.implementation!!.instructions.size - 1 - 1
|
val insertIndex = insertMethod.implementation!!.instructions.size - 1 - 1
|
||||||
|
|
||||||
injectScrollView(insertMethod, insertIndex, "onStartScrollView")
|
insertMethod.injectScrollView(insertIndex, "onStartScrollView")
|
||||||
} ?: return ScrollPositionFingerprint.toErrorResult()
|
} ?: return ScrollPositionFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**Inject the methods which stop of ScrollView
|
||||||
Inject the methods which stop of ScrollView
|
|
||||||
*/
|
*/
|
||||||
ScrollTopParentFingerprint.result?.let { parentResult ->
|
ScrollTopParentFingerprint.result?.let { parentResult ->
|
||||||
ScrollTopFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
ScrollTopFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||||
val insertMethod = it.mutableMethod
|
val insertMethod = it.mutableMethod
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
injectScrollView(insertMethod, insertIndex, "onStopScrollView")
|
insertMethod.injectScrollView(insertIndex, "onStopScrollView")
|
||||||
} ?: return ScrollTopFingerprint.toErrorResult()
|
} ?: return ScrollTopFingerprint.toErrorResult()
|
||||||
} ?: return ScrollTopParentFingerprint.toErrorResult()
|
} ?: return ScrollTopParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
@ -80,12 +79,11 @@ class DoubleBackToClosePatch : BytecodePatch(
|
|||||||
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
"$UTILS_PATH/DoubleBackToClosePatch;"
|
"$UTILS_PATH/DoubleBackToClosePatch;"
|
||||||
|
|
||||||
fun injectScrollView(
|
fun MutableMethod.injectScrollView(
|
||||||
method: MutableMethod,
|
|
||||||
index: Int,
|
index: Int,
|
||||||
descriptor: String
|
descriptor: String
|
||||||
) {
|
) {
|
||||||
method.addInstruction(
|
addInstruction(
|
||||||
index,
|
index,
|
||||||
"invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->$descriptor()V"
|
"invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->$descriptor()V"
|
||||||
)
|
)
|
||||||
|
@ -5,48 +5,44 @@ import app.revanced.extensions.injectHideCall
|
|||||||
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.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.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||||
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.adAttributionId
|
||||||
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||||
|
|
||||||
@Name("hide-general-ads-bytecode-patch")
|
@Name("hide-general-ads-bytecode-patch")
|
||||||
@DependsOn([SharedResourceIdPatch::class])
|
@DependsOn([SharedResourceIdPatch::class])
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
|
@Suppress("LABEL_NAME_CLASH")
|
||||||
class GeneralAdsBytecodePatch : BytecodePatch() {
|
class GeneralAdsBytecodePatch : BytecodePatch() {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
context.classes.forEach { classDef ->
|
context.classes.forEach { classDef ->
|
||||||
classDef.methods.forEach { method ->
|
classDef.methods.forEach { method ->
|
||||||
with(method.implementation) {
|
if (!method.isWideLiteralExists(adAttributionId))
|
||||||
this?.instructions?.forEachIndexed { index, instruction ->
|
return@forEach
|
||||||
if (instruction.opcode != org.jf.dexlib2.Opcode.CONST)
|
|
||||||
return@forEachIndexed
|
|
||||||
// Instruction to store the id adAttribution into a register
|
|
||||||
if ((instruction as Instruction31i).wideLiteral != SharedResourceIdPatch.adAttributionLabelId)
|
|
||||||
return@forEachIndexed
|
|
||||||
|
|
||||||
val insertIndex = index + 1
|
context.proxy(classDef)
|
||||||
|
.mutableClass
|
||||||
|
.findMutableMethodOf(method)
|
||||||
|
.apply {
|
||||||
|
val insertIndex = method.getWideLiteralIndex(adAttributionId) + 1
|
||||||
|
if (instruction(insertIndex).opcode != org.jf.dexlib2.Opcode.INVOKE_VIRTUAL)
|
||||||
|
return@forEach
|
||||||
|
|
||||||
// Call to get the view with the id adAttribution
|
val viewRegister = instruction<Instruction35c>(insertIndex).registerC
|
||||||
with(instructions.elementAt(insertIndex)) {
|
|
||||||
if (opcode != org.jf.dexlib2.Opcode.INVOKE_VIRTUAL)
|
|
||||||
return@forEachIndexed
|
|
||||||
|
|
||||||
// Hide the view
|
this.implementation!!.injectHideCall(insertIndex, viewRegister, "ads/GeneralAdsPatch", "hideAdAttributionView")
|
||||||
val viewRegister = (this as Instruction35c).registerC
|
|
||||||
context.proxy(classDef)
|
|
||||||
.mutableClass
|
|
||||||
.findMutableMethodOf(method)
|
|
||||||
.implementation!!.injectHideCall(insertIndex, viewRegister, "ads/GeneralAdsPatch", "hideAdAttributionView")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context.updatePatchStatus("GeneralAds")
|
context.updatePatchStatus("GeneralAds")
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
@ -14,6 +14,7 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch
|
import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch
|
||||||
import app.revanced.patches.youtube.ads.getpremium.patch.HideGetPremiumPatch
|
import app.revanced.patches.youtube.ads.getpremium.patch.HideGetPremiumPatch
|
||||||
|
import app.revanced.patches.youtube.misc.litho.patch.ByteBufferFilterPatch
|
||||||
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
|
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
@ -23,9 +24,9 @@ import org.w3c.dom.Element
|
|||||||
@Description("Removes general ads.")
|
@Description("Removes general ads.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
HideGetPremiumPatch::class,
|
ByteBufferFilterPatch::class,
|
||||||
GeneralAdsBytecodePatch::class,
|
GeneralAdsBytecodePatch::class,
|
||||||
LithoFilterPatch::class,
|
HideGetPremiumPatch::class,
|
||||||
SettingsPatch::class
|
SettingsPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -17,17 +17,15 @@ import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
|||||||
@Name("hide-get-premium")
|
@Name("hide-get-premium")
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class HideGetPremiumPatch : BytecodePatch(
|
class HideGetPremiumPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(CompactYpcOfferModuleViewFingerprint)
|
||||||
CompactYpcOfferModuleViewFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
CompactYpcOfferModuleViewFingerprint.result?.let {
|
CompactYpcOfferModuleViewFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
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
|
||||||
|
|
||||||
|
@ -15,5 +15,5 @@ object SwipeRefreshLayoutFingerprint : MethodFingerprint(
|
|||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
Opcode.RETURN
|
Opcode.RETURN
|
||||||
),
|
),
|
||||||
customFingerprint = { it.definingClass == "Landroidx/swiperefreshlayout/widget/SwipeRefreshLayout;" }
|
customFingerprint = { it.definingClass.endsWith("SwipeRefreshLayout;") }
|
||||||
)
|
)
|
||||||
|
@ -19,16 +19,14 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class SwipeRefreshPatch : BytecodePatch(
|
class SwipeRefreshPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(SwipeRefreshLayoutFingerprint)
|
||||||
SwipeRefreshLayoutFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
SwipeRefreshLayoutFingerprint.result?.let {
|
SwipeRefreshLayoutFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val register = (instruction(insertIndex) as OneRegisterInstruction).registerA
|
val register = instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
|
@ -12,7 +12,6 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.shared.patch.videoads.GeneralVideoAdsPatch
|
import app.revanced.patches.shared.patch.videoads.GeneralVideoAdsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
|
||||||
import app.revanced.util.integrations.Constants.ADS_PATH
|
import app.revanced.util.integrations.Constants.ADS_PATH
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@ -32,8 +31,6 @@ class VideoAdsPatch : BytecodePatch() {
|
|||||||
GeneralVideoAdsPatch.injectLegacyAds(INTEGRATIONS_CLASS_DESCRIPTOR)
|
GeneralVideoAdsPatch.injectLegacyAds(INTEGRATIONS_CLASS_DESCRIPTOR)
|
||||||
GeneralVideoAdsPatch.injectMainstreamAds(INTEGRATIONS_CLASS_DESCRIPTOR)
|
GeneralVideoAdsPatch.injectMainstreamAds(INTEGRATIONS_CLASS_DESCRIPTOR)
|
||||||
|
|
||||||
context.updatePatchStatus("VideoAds")
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +15,5 @@ object RepeatListenerFingerprint : MethodFingerprint(
|
|||||||
Opcode.CHECK_CAST,
|
Opcode.CHECK_CAST,
|
||||||
Opcode.CONST_WIDE_32
|
Opcode.CONST_WIDE_32
|
||||||
),
|
),
|
||||||
strings = listOf(
|
strings = listOf("ppoobsa")
|
||||||
"ppoobsa"
|
|
||||||
)
|
|
||||||
)
|
)
|
@ -8,5 +8,5 @@ object VideoEndFingerprint : MethodFingerprint(
|
|||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
customFingerprint = { methodDef -> methodDef.implementation!!.instructions.count() == 3 && methodDef.annotations.isEmpty()}
|
customFingerprint = { it.implementation!!.instructions.count() == 3 && it.annotations.isEmpty()}
|
||||||
)
|
)
|
@ -16,6 +16,7 @@ import app.revanced.util.integrations.Constants.UTILS_PATH
|
|||||||
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
||||||
|
|
||||||
@Name("always-autorepeat")
|
@Name("always-autorepeat")
|
||||||
@ -45,40 +46,39 @@ class AutoRepeatPatch : BytecodePatch(
|
|||||||
} ?: return VideoEndParentFingerprint.toErrorResult()
|
} ?: return VideoEndParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
RepeatListenerFingerprint.result?.let {
|
RepeatListenerFingerprint.result?.let {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex - 1
|
it.mutableMethod.apply {
|
||||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
val targetIndex = it.scanResult.patternScanResult!!.startIndex - 1
|
||||||
with (it.mutableMethod) {
|
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val targetReference = (instruction(targetIndex) as BuilderInstruction35c).reference.toString()
|
|
||||||
|
|
||||||
val firstRegister = (instruction(targetIndex) as BuilderInstruction35c).registerC
|
val registerC = instruction<BuilderInstruction35c>(targetIndex).registerC
|
||||||
val secondRegister = (instruction(targetIndex) as BuilderInstruction35c).registerD
|
val registerD = instruction<BuilderInstruction35c>(targetIndex).registerD
|
||||||
|
|
||||||
val dummyRegister = (instruction(endIndex) as Instruction31i).registerA
|
val dummyRegister = (instruction(endIndex) as Instruction31i).registerA
|
||||||
|
|
||||||
addInstructions(
|
val targetReference = instruction<ReferenceInstruction>(targetIndex).reference
|
||||||
targetIndex + 1, """
|
|
||||||
|
addInstructions(
|
||||||
|
targetIndex + 1, """
|
||||||
invoke-static {}, $UTILS_PATH/EnableAutoRepeatPatch;->shouldAutoRepeat()Z
|
invoke-static {}, $UTILS_PATH/EnableAutoRepeatPatch;->shouldAutoRepeat()Z
|
||||||
move-result v$dummyRegister
|
move-result v$dummyRegister
|
||||||
if-nez v$dummyRegister, :bypass
|
if-nez v$dummyRegister, :bypass
|
||||||
invoke-virtual {v$firstRegister, v$secondRegister}, $targetReference
|
invoke-virtual {v$registerC, v$registerD}, $targetReference
|
||||||
""", listOf(ExternalLabel("bypass", instruction(targetIndex + 1)))
|
""", listOf(ExternalLabel("bypass", instruction(targetIndex + 1)))
|
||||||
)
|
)
|
||||||
removeInstruction(targetIndex)
|
removeInstruction(targetIndex)
|
||||||
}
|
}
|
||||||
} ?: return RepeatListenerFingerprint.toErrorResult()
|
} ?: return RepeatListenerFingerprint.toErrorResult()
|
||||||
|
|
||||||
AutoNavInformerFingerprint.result?.mutableMethod?.let {
|
AutoNavInformerFingerprint.result?.mutableMethod?.let {
|
||||||
with (it.implementation!!.instructions) {
|
val index = it.implementation!!.instructions.size - 1 - 1
|
||||||
val index = this.size - 1 - 1
|
val register = it.instruction<OneRegisterInstruction>(index).registerA
|
||||||
val register = (this[index] as OneRegisterInstruction).registerA
|
|
||||||
it.addInstructions(
|
it.addInstructions(
|
||||||
index + 1, """
|
index + 1, """
|
||||||
invoke-static {v$register}, $UTILS_PATH/EnableAutoRepeatPatch;->enableAutoRepeat(Z)Z
|
invoke-static {v$register}, $UTILS_PATH/EnableAutoRepeatPatch;->enableAutoRepeat(Z)Z
|
||||||
move-result v0
|
move-result v0
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
|
||||||
} ?: return AutoNavInformerFingerprint.toErrorResult()
|
} ?: return AutoNavInformerFingerprint.toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
@ -25,14 +25,14 @@ class OverlayButtonsBytecodePatch : BytecodePatch() {
|
|||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
arrayOf(
|
arrayOf(
|
||||||
"$BUTTON_PATH/Download;",
|
"Download",
|
||||||
"$BUTTON_PATH/AutoRepeat;",
|
"AutoRepeat",
|
||||||
"$BUTTON_PATH/CopyWithTimeStamp;",
|
"CopyWithTimeStamp",
|
||||||
"$BUTTON_PATH/Copy;",
|
"Copy",
|
||||||
"$BUTTON_PATH/Speed;"
|
"Speed"
|
||||||
).forEach { descriptor ->
|
).forEach {
|
||||||
PlayerControlsPatch.initializeControl(descriptor)
|
PlayerControlsPatch.initializeControl("$BUTTON_PATH/$it;")
|
||||||
PlayerControlsPatch.injectVisibility(descriptor)
|
PlayerControlsPatch.injectVisibility("$BUTTON_PATH/$it;")
|
||||||
}
|
}
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
@ -4,17 +4,13 @@ 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.ResourceContext
|
import app.revanced.patcher.data.ResourceContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.instruction
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
|
import app.revanced.patches.youtube.misc.litho.patch.ByteBufferFilterPatch
|
||||||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.integrations.Constants.BOTTOM_PLAYER
|
import app.revanced.util.integrations.Constants.BOTTOM_PLAYER
|
||||||
|
|
||||||
@ -23,8 +19,7 @@ import app.revanced.util.integrations.Constants.BOTTOM_PLAYER
|
|||||||
@Description("Adds the options to hide action buttons under a video.")
|
@Description("Adds the options to hide action buttons under a video.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
LithoFilterPatch::class,
|
ByteBufferFilterPatch::class,
|
||||||
PlayerTypeHookPatch::class,
|
|
||||||
SettingsPatch::class
|
SettingsPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -33,32 +28,9 @@ import app.revanced.util.integrations.Constants.BOTTOM_PLAYER
|
|||||||
class ButtonContainerPatch : ResourcePatch {
|
class ButtonContainerPatch : ResourcePatch {
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
|
||||||
val instructionList =
|
ByteBufferFilterPatch.inject("$BOTTOM_PLAYER->hideActionButtons")
|
||||||
"""
|
|
||||||
move-object/from16 v3, p2
|
|
||||||
invoke-static {v3, v10}, $BOTTOM_PLAYER->hideActionButtons(Ljava/lang/Object;Ljava/nio/ByteBuffer;)Z
|
|
||||||
move-result v10
|
|
||||||
if-eqz v10, :do_not_block
|
|
||||||
move-object/from16 v15, p1
|
|
||||||
invoke-static {v15}, ${LithoFilterPatch.builderMethodDescriptor}
|
|
||||||
move-result-object v0
|
|
||||||
iget-object v0, v0, ${LithoFilterPatch.emptyComponentFieldDescriptor}
|
|
||||||
return-object v0
|
|
||||||
"""
|
|
||||||
|
|
||||||
with(LithoFilterPatch.lithoMethod) {
|
/**
|
||||||
addInstructions(
|
|
||||||
0, """
|
|
||||||
move-object/from16 v10, p3
|
|
||||||
iget-object v10, v10, ${LithoFilterPatch.objectReference.definingClass}->${LithoFilterPatch.objectReference.name}:${LithoFilterPatch.objectReference.type}
|
|
||||||
if-eqz v10, :do_not_block
|
|
||||||
check-cast v10, ${LithoFilterPatch.bufferReference}
|
|
||||||
iget-object v10, v10, ${LithoFilterPatch.bufferReference}->b:Ljava/nio/ByteBuffer;
|
|
||||||
""" + instructionList,listOf(ExternalLabel("do_not_block", LithoFilterPatch.lithoMethod.instruction(0)))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -27,7 +27,7 @@ import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
|||||||
class CommentComponentPatch : ResourcePatch {
|
class CommentComponentPatch : ResourcePatch {
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -21,18 +21,11 @@ import org.w3c.dom.Element
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class PlayerButtonBackgroundPatch : ResourcePatch {
|
class PlayerButtonBackgroundPatch : ResourcePatch {
|
||||||
private companion object {
|
|
||||||
const val RESOURCE_FILE_PATH = "res/drawable/player_button_circle_background.xml"
|
|
||||||
|
|
||||||
val replacements = arrayOf(
|
|
||||||
"color"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
context.xmlEditor[RESOURCE_FILE_PATH].use { editor ->
|
context.xmlEditor["res/drawable/player_button_circle_background.xml"].use { editor ->
|
||||||
editor.file.doRecursively { node ->
|
editor.file.doRecursively { node ->
|
||||||
replacements.forEach replacement@{ replacement ->
|
arrayOf("color").forEach replacement@{ replacement ->
|
||||||
if (node !is Element) return@replacement
|
if (node !is Element) return@replacement
|
||||||
|
|
||||||
node.getAttributeNode("android:$replacement")?.let { attribute ->
|
node.getAttributeNode("android:$replacement")?.let { attribute ->
|
||||||
|
@ -14,9 +14,9 @@ import app.revanced.patches.youtube.layout.etc.theme.patch.GeneralThemePatch
|
|||||||
import app.revanced.patches.youtube.layout.etc.theme.patch.GeneralThemePatch.Companion.isMonetPatchIncluded
|
import app.revanced.patches.youtube.layout.etc.theme.patch.GeneralThemePatch.Companion.isMonetPatchIncluded
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.resources.ResourceHelper.updatePatchStatusTheme
|
import app.revanced.util.resources.ResourceHelper.updatePatchStatusTheme
|
||||||
|
import app.revanced.util.resources.ResourceUtils
|
||||||
|
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||||
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||||
import java.nio.file.Files
|
|
||||||
import java.nio.file.StandardCopyOption
|
|
||||||
|
|
||||||
@Patch(false)
|
@Patch(false)
|
||||||
@Name("materialyou")
|
@Name("materialyou")
|
||||||
@ -32,35 +32,28 @@ import java.nio.file.StandardCopyOption
|
|||||||
class MaterialYouPatch : ResourcePatch {
|
class MaterialYouPatch : ResourcePatch {
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
|
||||||
val drawables1 = "drawable-night-v31" to arrayOf(
|
arrayOf(
|
||||||
"new_content_dot_background.xml"
|
ResourceUtils.ResourceGroup(
|
||||||
)
|
"drawable-night-v31",
|
||||||
|
"new_content_dot_background.xml"
|
||||||
val drawables2 = "drawable-v31" to arrayOf(
|
),
|
||||||
"new_content_count_background.xml",
|
ResourceUtils.ResourceGroup(
|
||||||
"new_content_dot_background.xml"
|
"drawable-v31",
|
||||||
)
|
"new_content_count_background.xml",
|
||||||
|
"new_content_dot_background.xml"
|
||||||
val layout1 = "layout-v31" to arrayOf(
|
),
|
||||||
"new_content_count.xml"
|
ResourceUtils.ResourceGroup(
|
||||||
)
|
"layout-v31",
|
||||||
|
"new_content_count.xml"
|
||||||
arrayOf(drawables1, drawables2, layout1).forEach { (path, resourceNames) ->
|
)
|
||||||
Files.createDirectory(context["res"].resolve(path).toPath())
|
).forEach {
|
||||||
resourceNames.forEach { name ->
|
context["res/${it.resourceDirectoryName}"].mkdirs()
|
||||||
val monetPath = "$path/$name"
|
context.copyResources("youtube/materialyou", it)
|
||||||
|
|
||||||
Files.copy(
|
|
||||||
this.javaClass.classLoader.getResourceAsStream("youtube/materialyou/$monetPath")!!,
|
|
||||||
context["res"].resolve(monetPath).toPath(),
|
|
||||||
StandardCopyOption.REPLACE_EXISTING
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
context.copyXmlNode("youtube/materialyou/host", "values-v31/colors.xml", "resources")
|
context.copyXmlNode("youtube/materialyou/host", "values-v31/colors.xml", "resources")
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
context.updatePatchStatusTheme("materialyou")
|
context.updatePatchStatusTheme("materialyou")
|
||||||
|
@ -29,7 +29,7 @@ class RedundantResourcePatch : ResourcePatch {
|
|||||||
WHITELIST_XHDPI,
|
WHITELIST_XHDPI,
|
||||||
WHITELIST_XXXHDPI
|
WHITELIST_XXXHDPI
|
||||||
).forEach { (path, array) ->
|
).forEach { (path, array) ->
|
||||||
val tmpDirectory = path + "-v21"
|
val tmpDirectory = "$path-v21"
|
||||||
Files.createDirectory(context["res"].resolve(tmpDirectory).toPath())
|
Files.createDirectory(context["res"].resolve(tmpDirectory).toPath())
|
||||||
|
|
||||||
(WHITELIST_GENERAL + array).forEach { name ->
|
(WHITELIST_GENERAL + array).forEach { name ->
|
||||||
|
@ -2,19 +2,13 @@ package app.revanced.patches.youtube.layout.etc.tooltip.fingerprints
|
|||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.toolTipId
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object TooltipContentViewFingerprint : MethodFingerprint(
|
object TooltipContentViewFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(toolTipId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.tooltipLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
@ -39,7 +39,7 @@ class TooltipContentViewPatch : BytecodePatch(
|
|||||||
"return-void"
|
"return-void"
|
||||||
) ?: return TooltipContentViewFingerprint.toErrorResult()
|
) ?: return TooltipContentViewFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.updatePatchStatus("hide-tooltip-content")
|
SettingsPatch.updatePatchStatus("hide-tooltip-content")
|
||||||
|
@ -10,7 +10,7 @@ import app.revanced.patcher.patch.ResourcePatch
|
|||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
|
import app.revanced.patches.youtube.ads.general.resource.patch.GeneralAdsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@ -18,7 +18,7 @@ import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
|||||||
@Description("Adds options to hide player settings flyout panel.")
|
@Description("Adds options to hide player settings flyout panel.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
LithoFilterPatch::class,
|
GeneralAdsPatch::class,
|
||||||
SettingsPatch::class
|
SettingsPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -27,7 +27,7 @@ import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
|||||||
class FlyoutPanelPatch : ResourcePatch {
|
class FlyoutPanelPatch : ResourcePatch {
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.fingerprints
|
package app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.videoQualityFragmentId
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object QualityMenuViewInflateFingerprint : MethodFingerprint(
|
object QualityMenuViewInflateFingerprint : MethodFingerprint(
|
||||||
@ -22,10 +22,5 @@ object QualityMenuViewInflateFingerprint : MethodFingerprint(
|
|||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.CHECK_CAST
|
Opcode.CHECK_CAST
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(videoQualityFragmentId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.videoQualityFragmentLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -38,9 +38,10 @@ class OldQualityLayoutPatch : BytecodePatch(
|
|||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
QualityMenuViewInflateFingerprint.result?.let {
|
QualityMenuViewInflateFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val register = (instruction(endIndex) as OneRegisterInstruction).registerA
|
val register = instruction<OneRegisterInstruction>(endIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
endIndex + 1,
|
endIndex + 1,
|
||||||
"invoke-static { v$register }, $FLYOUT_PANEL->enableOldQualityMenu(Landroid/widget/ListView;)V"
|
"invoke-static { v$register }, $FLYOUT_PANEL->enableOldQualityMenu(Landroid/widget/ListView;)V"
|
||||||
@ -48,7 +49,7 @@ class OldQualityLayoutPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return QualityMenuViewInflateFingerprint.toErrorResult()
|
} ?: return QualityMenuViewInflateFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -6,6 +6,7 @@ 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.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
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.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
@ -14,15 +15,15 @@ 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.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
|
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
|
||||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||||
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.autoNavPreviewId
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.bytecode.getStringIndex
|
||||||
|
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||||
import app.revanced.util.integrations.Constants.FULLSCREEN
|
import app.revanced.util.integrations.Constants.FULLSCREEN
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
|
|
||||||
import org.jf.dexlib2.iface.instruction.Instruction
|
import org.jf.dexlib2.iface.instruction.Instruction
|
||||||
|
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.WideLiteralInstruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
|
|
||||||
import org.jf.dexlib2.iface.reference.FieldReference
|
import org.jf.dexlib2.iface.reference.FieldReference
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@ -30,53 +31,38 @@ import org.jf.dexlib2.iface.reference.FieldReference
|
|||||||
@Description("Hides the autoplay preview container in the fullscreen.")
|
@Description("Hides the autoplay preview container in the fullscreen.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
ResourceMappingPatch::class,
|
SettingsPatch::class,
|
||||||
SettingsPatch::class
|
SharedResourceIdPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class HideAutoplayPreviewPatch : BytecodePatch(
|
class HideAutoplayPreviewPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(LayoutConstructorFingerprint)
|
||||||
LayoutConstructorFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
// resolve the offsets such as ...
|
LayoutConstructorFingerprint.result?.mutableMethod?.let {
|
||||||
val autoNavPreviewStubId = ResourceMappingPatch.resourceMappings.single {
|
val insertInstruction = it.implementation!!.instructions
|
||||||
it.type == "id" && it.name == "autonav_preview_stub"
|
|
||||||
}.id
|
|
||||||
|
|
||||||
LayoutConstructorFingerprint.result?.mutableMethod?.let { method ->
|
val dummyRegister = it.instruction<OneRegisterInstruction>(it.getStringIndex("1.0x")).registerA
|
||||||
with (method.implementation!!.instructions) {
|
val insertIndex = it.getWideLiteralIndex(autoNavPreviewId)
|
||||||
val registerIndex = indexOfFirst {
|
|
||||||
it.opcode == Opcode.CONST_STRING &&
|
|
||||||
(it as BuilderInstruction21c).reference.toString() == "1.0x"
|
|
||||||
}
|
|
||||||
val dummyRegister = (this[registerIndex] as Instruction21c).registerA
|
|
||||||
|
|
||||||
// where to insert the branch instructions and ...
|
val branchIndex = insertInstruction.subList(insertIndex + 1, insertInstruction.size - 1).indexOfFirst { instruction ->
|
||||||
val insertIndex = this.indexOfFirst {
|
((instruction as? ReferenceInstruction)?.reference as? FieldReference)?.type == "Lcom/google/android/apps/youtube/app/player/autonav/AutonavToggleController;"
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == autoNavPreviewStubId
|
} + 1
|
||||||
}
|
|
||||||
|
|
||||||
val branchIndex = this.subList(insertIndex + 1, this.size - 1).indexOfFirst {
|
val jumpInstruction = it.instruction<Instruction>(insertIndex + branchIndex)
|
||||||
((it as? ReferenceInstruction)?.reference as? FieldReference)?.type == "Lcom/google/android/apps/youtube/app/player/autonav/AutonavToggleController;"
|
|
||||||
} + 1
|
|
||||||
|
|
||||||
val jumpInstruction = this[insertIndex + branchIndex] as Instruction
|
it.addInstructions(
|
||||||
|
insertIndex, """
|
||||||
method.addInstructions(
|
invoke-static {}, $FULLSCREEN->hideAutoPlayPreview()Z
|
||||||
insertIndex, """
|
move-result v$dummyRegister
|
||||||
invoke-static {}, $FULLSCREEN->hideAutoPlayPreview()Z
|
if-nez v$dummyRegister, :hidden
|
||||||
move-result v$dummyRegister
|
|
||||||
if-nez v$dummyRegister, :hidden
|
|
||||||
""", listOf(ExternalLabel("hidden", jumpInstruction))
|
""", listOf(ExternalLabel("hidden", jumpInstruction))
|
||||||
)
|
)
|
||||||
}
|
|
||||||
} ?: return LayoutConstructorFingerprint.toErrorResult()
|
} ?: return LayoutConstructorFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.accessibilityVideoTimeId
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object ScrubbingLabelAlternativeFingerprint : MethodFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.IF_NEZ,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.IPUT_BOOLEAN,
|
||||||
|
Opcode.RETURN_VOID
|
||||||
|
),
|
||||||
|
customFingerprint = { it.isWideLiteralExists(accessibilityVideoTimeId) }
|
||||||
|
)
|
@ -1,16 +1,14 @@
|
|||||||
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.fingerprints
|
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.scrubbingId
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object ScrubbingLabelFingerprint : MethodFingerprint(
|
object ScrubbingLabelFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(Opcode.IPUT_BOOLEAN),
|
opcodes = listOf(
|
||||||
customFingerprint = { methodDef ->
|
Opcode.IPUT_BOOLEAN,
|
||||||
methodDef.implementation?.instructions?.any {
|
Opcode.CONST_WIDE_32
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
),
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.scrubbingLabelId
|
customFingerprint = { it.isWideLiteralExists(scrubbingId) }
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -6,73 +6,80 @@ 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.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
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.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.fingerprints.ScrubbingLabelAlternativeFingerprint
|
||||||
import app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.fingerprints.ScrubbingLabelFingerprint
|
import app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.fingerprints.ScrubbingLabelFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.integrations.Constants.FULLSCREEN
|
import app.revanced.util.integrations.Constants.FULLSCREEN
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.reference.FieldReference
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("hide-filmstrip-overlay")
|
@Name("hide-filmstrip-overlay")
|
||||||
@Description("Hide flimstrip overlay on swipe controls.")
|
@Description("Hide flimstrip overlay on swipe controls.")
|
||||||
@DependsOn([SettingsPatch::class])
|
@DependsOn(
|
||||||
|
[
|
||||||
|
SettingsPatch::class,
|
||||||
|
SharedResourceIdPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class HideFilmstripOverlayPatch : BytecodePatch(
|
class HideFilmstripOverlayPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
ScrubbingLabelFingerprint
|
ScrubbingLabelFingerprint,
|
||||||
|
ScrubbingLabelAlternativeFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
ScrubbingLabelFingerprint.result?.mutableMethod?.let {
|
|
||||||
with (it.implementation!!.instructions) {
|
|
||||||
for ((index, instruction) in this.withIndex()) {
|
|
||||||
if (instruction.opcode != Opcode.IPUT_BOOLEAN) continue
|
|
||||||
val primaryRegister = (instruction as TwoRegisterInstruction).registerA
|
|
||||||
val secondaryRegister = (instruction as TwoRegisterInstruction).registerB
|
|
||||||
val dummyRegister = primaryRegister + 2
|
|
||||||
val fieldReference = (instruction as ReferenceInstruction).reference as FieldReference
|
|
||||||
|
|
||||||
it.addInstructions(
|
val result = try {
|
||||||
index + 1, """
|
ScrubbingLabelFingerprint.result!!
|
||||||
invoke-static {}, $FULLSCREEN->hideFilmstripOverlay()Z
|
} catch (_: Exception) {
|
||||||
move-result v$dummyRegister
|
ScrubbingLabelAlternativeFingerprint.result
|
||||||
if-eqz v$dummyRegister, :show
|
?: return ScrubbingLabelAlternativeFingerprint.toErrorResult()
|
||||||
const/4 v$primaryRegister, 0x0
|
}
|
||||||
:show
|
|
||||||
iput-boolean v$primaryRegister, v$secondaryRegister, ${fieldReference.definingClass}->${fieldReference.name}:${fieldReference.type}
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
it.removeInstruction(index)
|
result.mutableMethod.hook(result.scanResult.patternScanResult!!.endIndex - 1)
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
arrayOf(
|
arrayOf(
|
||||||
"PREFERENCE: FULLSCREEN_SETTINGS",
|
"PREFERENCE: FULLSCREEN_SETTINGS",
|
||||||
"SETTINGS: HIDE_FILMSTRIP_OVERLAY"
|
"SETTINGS: HIDE_FILMSTRIP_OVERLAY"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
SettingsPatch.updatePatchStatus("hide-filmstrip-overlay")
|
SettingsPatch.updatePatchStatus("hide-filmstrip-overlay")
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
}
|
private companion object {
|
||||||
} ?: return ScrubbingLabelFingerprint.toErrorResult()
|
fun MutableMethod.hook(index: Int) {
|
||||||
|
val targetInstruction = instruction<TwoRegisterInstruction>(index)
|
||||||
|
val fieldReference = instruction<ReferenceInstruction>(index).reference
|
||||||
|
replaceInstruction(
|
||||||
|
index,
|
||||||
|
"invoke-static {v${targetInstruction.registerA}}, $FULLSCREEN->hideFilmstripOverlay(Z)Z"
|
||||||
|
)
|
||||||
|
|
||||||
return PatchResultError("Could not find the method to hook.")
|
addInstructions(
|
||||||
|
index + 1, """
|
||||||
|
move-result v${targetInstruction.registerA}
|
||||||
|
iput-boolean v${targetInstruction.registerA}, v${targetInstruction.registerB}, $fieldReference
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,11 @@ import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
|
|||||||
import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint
|
import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint
|
||||||
import app.revanced.patches.youtube.layout.fullscreen.quickactions.patch.QuickActionsPatch
|
import app.revanced.patches.youtube.layout.fullscreen.quickactions.patch.QuickActionsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.bytecode.getStringIndex
|
||||||
import app.revanced.util.integrations.Constants.FULLSCREEN
|
import app.revanced.util.integrations.Constants.FULLSCREEN
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
|
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@ -45,9 +45,9 @@ class HideFullscreenPanelsPatch : BytecodePatch(
|
|||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
FullscreenViewAdderFingerprint.result?.let {
|
FullscreenViewAdderFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val register = (implementation!!.instructions[endIndex] as Instruction35c).registerD
|
val register = instruction<Instruction35c>(endIndex).registerD
|
||||||
|
|
||||||
for (i in 1..3) removeInstruction(endIndex - i)
|
for (i in 1..3) removeInstruction(endIndex - i)
|
||||||
|
|
||||||
@ -60,30 +60,26 @@ class HideFullscreenPanelsPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return FullscreenViewAdderFingerprint.toErrorResult()
|
} ?: return FullscreenViewAdderFingerprint.toErrorResult()
|
||||||
|
|
||||||
LayoutConstructorFingerprint.result?.mutableMethod?.let { method ->
|
LayoutConstructorFingerprint.result?.mutableMethod?.let {
|
||||||
val instructions = method.implementation!!.instructions
|
val instructions = it.implementation!!.instructions
|
||||||
val registerIndex = instructions.indexOfFirst {
|
val dummyRegister = it.instruction<OneRegisterInstruction>(it.getStringIndex("1.0x")).registerA
|
||||||
it.opcode == Opcode.CONST_STRING &&
|
|
||||||
(it as BuilderInstruction21c).reference.toString() == "1.0x"
|
|
||||||
}
|
|
||||||
val dummyRegister = (instructions[registerIndex] as Instruction21c).registerA
|
|
||||||
|
|
||||||
val invokeIndex = method.implementation!!.instructions.indexOfFirst {
|
val invokeIndex = instructions.indexOfFirst { instruction ->
|
||||||
it.opcode.ordinal == Opcode.INVOKE_VIRTUAL.ordinal &&
|
instruction.opcode == Opcode.INVOKE_VIRTUAL &&
|
||||||
((it as? BuilderInstruction35c)?.reference.toString() ==
|
((instruction as ReferenceInstruction).reference.toString() ==
|
||||||
"Landroid/widget/FrameLayout;->addView(Landroid/view/View;)V")
|
"Landroid/widget/FrameLayout;->addView(Landroid/view/View;)V")
|
||||||
}
|
}
|
||||||
|
|
||||||
method.addInstructions(
|
it.addInstructions(
|
||||||
invokeIndex, """
|
invokeIndex, """
|
||||||
invoke-static {}, $FULLSCREEN->showFullscreenTitle()Z
|
invoke-static {}, $FULLSCREEN->showFullscreenTitle()Z
|
||||||
move-result v$dummyRegister
|
move-result v$dummyRegister
|
||||||
if-eqz v$dummyRegister, :hidden
|
if-eqz v$dummyRegister, :hidden
|
||||||
""", listOf(ExternalLabel("hidden", method.instruction(invokeIndex + 1)))
|
""", listOf(ExternalLabel("hidden", it.instruction(invokeIndex + 1)))
|
||||||
)
|
)
|
||||||
} ?: return LayoutConstructorFingerprint.toErrorResult()
|
} ?: return LayoutConstructorFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -51,7 +51,7 @@ class HapticFeedBackPatch : BytecodePatch(
|
|||||||
} ?: return fingerprint.toErrorResult()
|
} ?: return fingerprint.toErrorResult()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
@ -68,34 +68,34 @@ class HapticFeedBackPatch : BytecodePatch(
|
|||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
fun MethodFingerprintResult.disableHaptics(targetMethodName: String) {
|
fun MethodFingerprintResult.disableHaptics(targetMethodName: String) {
|
||||||
val startIndex = scanResult.patternScanResult!!.startIndex
|
mutableMethod.apply {
|
||||||
val endIndex = scanResult.patternScanResult!!.endIndex
|
val startIndex = scanResult.patternScanResult!!.startIndex
|
||||||
val insertIndex = endIndex + 4
|
val endIndex = scanResult.patternScanResult!!.endIndex
|
||||||
val targetRegister = (method.implementation!!.instructions.elementAt(insertIndex) as OneRegisterInstruction).registerA
|
val insertIndex = endIndex + 4
|
||||||
val dummyRegister = targetRegister + 1
|
val targetRegister = instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
val dummyRegister = targetRegister + 1
|
||||||
|
|
||||||
with (mutableMethod) {
|
|
||||||
removeInstruction(insertIndex)
|
removeInstruction(insertIndex)
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex, """
|
insertIndex, """
|
||||||
invoke-static {}, $FULLSCREEN->$targetMethodName()Z
|
invoke-static {}, $FULLSCREEN->$targetMethodName()Z
|
||||||
move-result v$dummyRegister
|
move-result v$dummyRegister
|
||||||
if-eqz v$dummyRegister, :vibrate
|
if-eqz v$dummyRegister, :vibrate
|
||||||
const-wide/16 v$targetRegister, 0x0
|
const-wide/16 v$targetRegister, 0x0
|
||||||
goto :exit
|
goto :exit
|
||||||
:vibrate
|
:vibrate
|
||||||
const-wide/16 v$targetRegister, 0x19
|
const-wide/16 v$targetRegister, 0x19
|
||||||
""", listOf(ExternalLabel("exit", mutableMethod.instruction(insertIndex)))
|
""", listOf(ExternalLabel("exit", instruction(insertIndex)))
|
||||||
)
|
)
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
startIndex, """
|
startIndex, """
|
||||||
invoke-static {}, $FULLSCREEN->$targetMethodName()Z
|
invoke-static {}, $FULLSCREEN->$targetMethodName()Z
|
||||||
move-result v$dummyRegister
|
move-result v$dummyRegister
|
||||||
if-eqz v$dummyRegister, :vibrate
|
if-eqz v$dummyRegister, :vibrate
|
||||||
return-void
|
return-void
|
||||||
""", listOf(ExternalLabel("vibrate", mutableMethod.instruction(startIndex)))
|
""", listOf(ExternalLabel("vibrate", instruction(startIndex)))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ class HapticFeedBackPatch : BytecodePatch(
|
|||||||
move-result v0
|
move-result v0
|
||||||
if-eqz v0, :vibrate
|
if-eqz v0, :vibrate
|
||||||
return-void
|
return-void
|
||||||
""", listOf(ExternalLabel("vibrate", mutableMethod.instruction(0)))
|
""", listOf(ExternalLabel("vibrate", mutableMethod.instruction(0)))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,21 +27,19 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class LandScapeModePatch : BytecodePatch(
|
class LandScapeModePatch : BytecodePatch(
|
||||||
listOf(
|
listOf(OrientationParentFingerprint)
|
||||||
OrientationParentFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
OrientationParentFingerprint.result?.classDef?.let { classDef ->
|
OrientationParentFingerprint.result?.classDef?.let { classDef ->
|
||||||
arrayOf(
|
arrayOf(
|
||||||
OrientationPrimaryFingerprint,
|
OrientationPrimaryFingerprint,
|
||||||
OrientationSecondaryFingerprint
|
OrientationSecondaryFingerprint
|
||||||
).forEach { fingerprint ->
|
).forEach {
|
||||||
fingerprint.also { it.resolve(context, classDef) }.result?.injectOverride() ?: return fingerprint.toErrorResult()
|
it.also { it.resolve(context, classDef) }.result?.injectOverride() ?: return it.toErrorResult()
|
||||||
}
|
}
|
||||||
} ?: return OrientationParentFingerprint.toErrorResult()
|
} ?: return OrientationParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
@ -61,15 +59,15 @@ class LandScapeModePatch : BytecodePatch(
|
|||||||
"$FULLSCREEN->disableLandScapeMode(Z)Z"
|
"$FULLSCREEN->disableLandScapeMode(Z)Z"
|
||||||
|
|
||||||
fun MethodFingerprintResult.injectOverride() {
|
fun MethodFingerprintResult.injectOverride() {
|
||||||
with (mutableMethod) {
|
mutableMethod.apply {
|
||||||
val index = scanResult.patternScanResult!!.endIndex
|
val index = scanResult.patternScanResult!!.endIndex
|
||||||
val register = (instruction(index) as OneRegisterInstruction).registerA
|
val register = instruction<OneRegisterInstruction>(index).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
index +1, """
|
index +1, """
|
||||||
invoke-static {v$register}, $INTEGRATIONS_CLASS_DESCRIPTOR
|
invoke-static {v$register}, $INTEGRATIONS_CLASS_DESCRIPTOR
|
||||||
move-result v$register
|
move-result v$register
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,27 +4,21 @@ 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.ResourceContext
|
import app.revanced.patcher.data.ResourceContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.instruction
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
|
import app.revanced.patches.youtube.ads.general.resource.patch.GeneralAdsPatch
|
||||||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.integrations.Constants.FULLSCREEN
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("hide-quick-actions")
|
@Name("hide-quick-actions")
|
||||||
@Description("Adds the options to hide quick actions components in the fullscreen.")
|
@Description("Adds the options to hide quick actions components in the fullscreen.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
LithoFilterPatch::class,
|
GeneralAdsPatch::class,
|
||||||
PlayerTypeHookPatch::class,
|
|
||||||
SettingsPatch::class
|
SettingsPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -33,32 +27,7 @@ import app.revanced.util.integrations.Constants.FULLSCREEN
|
|||||||
class QuickActionsPatch : ResourcePatch {
|
class QuickActionsPatch : ResourcePatch {
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
|
||||||
val instructionList =
|
/**
|
||||||
"""
|
|
||||||
move-object/from16 v3, p2
|
|
||||||
invoke-static {v3, v10}, $FULLSCREEN->hideQuickActionButtons(Ljava/lang/Object;Ljava/nio/ByteBuffer;)Z
|
|
||||||
move-result v10
|
|
||||||
if-eqz v10, :do_not_block
|
|
||||||
move-object/from16 v15, p1
|
|
||||||
invoke-static {v15}, ${LithoFilterPatch.builderMethodDescriptor}
|
|
||||||
move-result-object v0
|
|
||||||
iget-object v0, v0, ${LithoFilterPatch.emptyComponentFieldDescriptor}
|
|
||||||
return-object v0
|
|
||||||
"""
|
|
||||||
|
|
||||||
with(LithoFilterPatch.lithoMethod) {
|
|
||||||
addInstructions(
|
|
||||||
0, """
|
|
||||||
move-object/from16 v10, p3
|
|
||||||
iget-object v10, v10, ${LithoFilterPatch.objectReference.definingClass}->${LithoFilterPatch.objectReference.name}:${LithoFilterPatch.objectReference.type}
|
|
||||||
if-eqz v10, :do_not_block
|
|
||||||
check-cast v10, ${LithoFilterPatch.bufferReference}
|
|
||||||
iget-object v10, v10, ${LithoFilterPatch.bufferReference}->b:Ljava/nio/ByteBuffer;
|
|
||||||
""" + instructionList,listOf(ExternalLabel("do_not_block", LithoFilterPatch.lithoMethod.instruction(0)))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -1,16 +1,10 @@
|
|||||||
package app.revanced.patches.youtube.layout.fullscreen.seekmessage.fingerprints
|
package app.revanced.patches.youtube.layout.fullscreen.seekmessage.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.easySeekEduContainerId
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object SeekEduContainerFingerprint : MethodFingerprint(
|
object SeekEduContainerFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(easySeekEduContainerId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.easySeekEduContainerId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -30,9 +30,7 @@ import app.revanced.util.integrations.Constants.FULLSCREEN
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class SeekMessagePatch : BytecodePatch(
|
class SeekMessagePatch : BytecodePatch(
|
||||||
listOf(
|
listOf(SeekEduContainerFingerprint)
|
||||||
SeekEduContainerFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.general.accountmenu.fingerprints
|
package app.revanced.patches.youtube.layout.general.accountmenu.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.compactLinkId
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object AccountMenuParentFingerprint : MethodFingerprint(
|
object AccountMenuParentFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
@ -12,10 +12,5 @@ object AccountMenuParentFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT_OBJECT
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(compactLinkId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.compactLinkLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -33,17 +33,15 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class AccountMenuPatch : BytecodePatch(
|
class AccountMenuPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(AccountMenuParentFingerprint)
|
||||||
AccountMenuParentFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
AccountMenuParentFingerprint.result?.let { parentResult ->
|
AccountMenuParentFingerprint.result?.let { parentResult ->
|
||||||
AccountMenuFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
AccountMenuFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
||||||
val register = (instruction(targetIndex) as OneRegisterInstruction).registerA
|
val register = instruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
targetIndex + 1,
|
targetIndex + 1,
|
||||||
@ -52,9 +50,9 @@ class AccountMenuPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return AccountMenuFingerprint.toErrorResult()
|
} ?: return AccountMenuFingerprint.toErrorResult()
|
||||||
|
|
||||||
with (parentResult.mutableMethod) {
|
parentResult.mutableMethod.apply {
|
||||||
val endIndex = parentResult.scanResult.patternScanResult!!.endIndex
|
val endIndex = parentResult.scanResult.patternScanResult!!.endIndex
|
||||||
val register = (instruction(endIndex) as OneRegisterInstruction).registerA
|
val register = instruction<OneRegisterInstruction>(endIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
endIndex + 1,
|
endIndex + 1,
|
||||||
@ -63,7 +61,7 @@ class AccountMenuPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return AccountMenuParentFingerprint.toErrorResult()
|
} ?: return AccountMenuParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -49,9 +49,9 @@ class AutoCaptionsPatch : BytecodePatch(
|
|||||||
addInstructions(
|
addInstructions(
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
const/4 v0, ${status.value}
|
const/4 v0, ${status.value}
|
||||||
sput-boolean v0, $GENERAL->captionsButtonStatus:Z
|
sput-boolean v0, $GENERAL->captionsButtonStatus:Z
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,11 +66,11 @@ class AutoCaptionsPatch : BytecodePatch(
|
|||||||
if-nez v0, :auto_captions_shown
|
if-nez v0, :auto_captions_shown
|
||||||
const/4 v0, 0x1
|
const/4 v0, 0x1
|
||||||
return v0
|
return v0
|
||||||
""", listOf(ExternalLabel("auto_captions_shown", it.instruction(0)))
|
""", listOf(ExternalLabel("auto_captions_shown", it.instruction(0)))
|
||||||
)
|
)
|
||||||
} ?: return SubtitleTrackFingerprint.toErrorResult()
|
} ?: return SubtitleTrackFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -25,9 +25,7 @@ import app.revanced.util.integrations.Constants.GENERAL
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class PlayerPopupPanelsPatch : BytecodePatch(
|
class PlayerPopupPanelsPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(EngagementPanelControllerFingerprint)
|
||||||
EngagementPanelControllerFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
@ -44,7 +42,7 @@ class PlayerPopupPanelsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
} ?: return EngagementPanelControllerFingerprint.toErrorResult()
|
} ?: return EngagementPanelControllerFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.general.breakingnews.fingerprints
|
package app.revanced.patches.youtube.layout.general.breakingnews.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.horizontalCardListId
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object BreakingNewsFingerprint : MethodFingerprint(
|
object BreakingNewsFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
@ -12,10 +12,5 @@ object BreakingNewsFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT_OBJECT
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(horizontalCardListId) }
|
||||||
methodDef.implementation?.instructions?.any { instruction ->
|
|
||||||
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.horizontalCardListId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -39,7 +39,7 @@ class BreakingNewsPatch : BytecodePatch(
|
|||||||
BreakingNewsFingerprint.result?.let {
|
BreakingNewsFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val targetRegister = (instruction(targetIndex) as OneRegisterInstruction).registerA
|
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
addInstruction(
|
addInstruction(
|
||||||
targetIndex + 1,
|
targetIndex + 1,
|
||||||
"invoke-static {v$targetRegister}, $GENERAL->hideBreakingNewsShelf(Landroid/view/View;)V"
|
"invoke-static {v$targetRegister}, $GENERAL->hideBreakingNewsShelf(Landroid/view/View;)V"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.general.categorybar.fingerprints
|
package app.revanced.patches.youtube.layout.general.categorybar.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.filterBarHeightId
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object FilterBarHeightFingerprint : MethodFingerprint(
|
object FilterBarHeightFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
@ -12,10 +12,5 @@ object FilterBarHeightFingerprint : MethodFingerprint(
|
|||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
Opcode.IPUT
|
Opcode.IPUT
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(filterBarHeightId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.filterBarHeightLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.general.categorybar.fingerprints
|
package app.revanced.patches.youtube.layout.general.categorybar.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.relatedChipCloudMarginId
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object RelatedChipCloudFingerprint : MethodFingerprint(
|
object RelatedChipCloudFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
@ -11,10 +11,5 @@ object RelatedChipCloudFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT_OBJECT
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(relatedChipCloudMarginId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.relatedChipCloudMarginLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.general.categorybar.fingerprints
|
package app.revanced.patches.youtube.layout.general.categorybar.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.barContainerHeightId
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object SearchResultsChipBarFingerprint : MethodFingerprint(
|
object SearchResultsChipBarFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
@ -13,10 +13,5 @@ object SearchResultsChipBarFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT_OBJECT
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(barContainerHeightId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.barContainerHeightLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -48,9 +48,9 @@ class CategoryBarPatch : BytecodePatch(
|
|||||||
* Home feed and subscriptions feed
|
* Home feed and subscriptions feed
|
||||||
*/
|
*/
|
||||||
FilterBarHeightFingerprint.result?.let {
|
FilterBarHeightFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val register = (instruction(insertIndex) as TwoRegisterInstruction).registerA
|
val register = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex, """
|
insertIndex, """
|
||||||
@ -65,9 +65,9 @@ class CategoryBarPatch : BytecodePatch(
|
|||||||
* Category Bar in related video
|
* Category Bar in related video
|
||||||
*/
|
*/
|
||||||
RelatedChipCloudFingerprint.result?.let {
|
RelatedChipCloudFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val register = (instruction(insertIndex) as OneRegisterInstruction).registerA
|
val register = instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
insertIndex + 1,
|
insertIndex + 1,
|
||||||
@ -80,9 +80,9 @@ class CategoryBarPatch : BytecodePatch(
|
|||||||
* Category Bar in search results
|
* Category Bar in search results
|
||||||
*/
|
*/
|
||||||
SearchResultsChipBarFingerprint.result?.let {
|
SearchResultsChipBarFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex - 2
|
val targetIndex = it.scanResult.patternScanResult!!.endIndex - 2
|
||||||
val register = (instruction(targetIndex) as OneRegisterInstruction).registerA
|
val register = instruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
targetIndex + 1, """
|
targetIndex + 1, """
|
||||||
@ -93,7 +93,7 @@ class CategoryBarPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return SearchResultsChipBarFingerprint.toErrorResult()
|
} ?: return SearchResultsChipBarFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.general.channellistsubmenu.fingerprints
|
package app.revanced.patches.youtube.layout.general.channellistsubmenu.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.channelListSubMenuId
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object ChannelListSubMenuFingerprint : MethodFingerprint(
|
object ChannelListSubMenuFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
@ -12,10 +12,5 @@ object ChannelListSubMenuFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT_OBJECT
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(channelListSubMenuId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.channelListSubMenuLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -31,16 +31,14 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ChannelListSubMenuPatch : BytecodePatch(
|
class ChannelListSubMenuPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(ChannelListSubMenuFingerprint)
|
||||||
ChannelListSubMenuFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
ChannelListSubMenuFingerprint.result?.let {
|
ChannelListSubMenuFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val register = (instruction(endIndex) as OneRegisterInstruction).registerA
|
val register = instruction<OneRegisterInstruction>(endIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
endIndex + 1,
|
endIndex + 1,
|
||||||
@ -49,7 +47,7 @@ class ChannelListSubMenuPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return ChannelListSubMenuFingerprint.toErrorResult()
|
} ?: return ChannelListSubMenuFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.general.crowdfundingbox.fingerprints
|
package app.revanced.patches.youtube.layout.general.crowdfundingbox.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.donationCompanionResourceId
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object CrowdfundingBoxFingerprint : MethodFingerprint(
|
object CrowdfundingBoxFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
@ -11,10 +11,5 @@ object CrowdfundingBoxFingerprint : MethodFingerprint(
|
|||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.IPUT_OBJECT
|
Opcode.IPUT_OBJECT
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(donationCompanionResourceId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.donationCompanionResourceId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -31,16 +31,14 @@ import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class CrowdfundingBoxPatch : BytecodePatch(
|
class CrowdfundingBoxPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(CrowdfundingBoxFingerprint)
|
||||||
CrowdfundingBoxFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
CrowdfundingBoxFingerprint.result?.let {
|
CrowdfundingBoxFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val register = (instruction(insertIndex) as TwoRegisterInstruction).registerA
|
val register = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
@ -49,7 +47,7 @@ class CrowdfundingBoxPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return CrowdfundingBoxFingerprint.toErrorResult()
|
} ?: return CrowdfundingBoxFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.general.floatingmicrophone.fingerprints
|
package app.revanced.patches.youtube.layout.general.floatingmicrophone.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.fabId
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object FloatingMicrophoneFingerprint : MethodFingerprint(
|
object FloatingMicrophoneFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
@ -11,10 +11,5 @@ object FloatingMicrophoneFingerprint : MethodFingerprint(
|
|||||||
Opcode.IF_EQZ,
|
Opcode.IF_EQZ,
|
||||||
Opcode.RETURN_VOID
|
Opcode.RETURN_VOID
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(fabId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.fabLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -31,16 +31,14 @@ import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class FloatingMicrophonePatch : BytecodePatch(
|
class FloatingMicrophonePatch : BytecodePatch(
|
||||||
listOf(
|
listOf(FloatingMicrophoneFingerprint)
|
||||||
FloatingMicrophoneFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
FloatingMicrophoneFingerprint.result?.let {
|
FloatingMicrophoneFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.startIndex
|
val insertIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
val register = (instruction(insertIndex) as TwoRegisterInstruction).registerA
|
val register = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex + 1, """
|
insertIndex + 1, """
|
||||||
|
@ -76,7 +76,7 @@ class HeaderSwitchPatch : BytecodePatch() {
|
|||||||
val errorIndex: Int = patchSuccessArray.indexOf(false)
|
val errorIndex: Int = patchSuccessArray.indexOf(false)
|
||||||
|
|
||||||
if (errorIndex == -1) {
|
if (errorIndex == -1) {
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.general.loadmorebutton.fingerprints
|
package app.revanced.patches.youtube.layout.general.loadmorebutton.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.expandButtonId
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object LoadMoreButtonFingerprint : MethodFingerprint(
|
object LoadMoreButtonFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
@ -12,10 +12,5 @@ object LoadMoreButtonFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_STATIC,
|
Opcode.INVOKE_STATIC,
|
||||||
Opcode.MOVE_RESULT_OBJECT
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(expandButtonId) }
|
||||||
methodDef.implementation?.instructions?.any { instruction ->
|
|
||||||
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.expandButtonId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -31,15 +31,13 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class LoadMoreButtonPatch : BytecodePatch(
|
class LoadMoreButtonPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(LoadMoreButtonFingerprint,)
|
||||||
LoadMoreButtonFingerprint,
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
LoadMoreButtonFingerprint.result?.let {
|
LoadMoreButtonFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val targetRegister = (instruction(targetIndex) as OneRegisterInstruction).registerA
|
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
addInstruction(
|
addInstruction(
|
||||||
targetIndex + 1,
|
targetIndex + 1,
|
||||||
"invoke-static {v$targetRegister}, $GENERAL->hideLoadMoreButton(Landroid/view/View;)V"
|
"invoke-static {v$targetRegister}, $GENERAL->hideLoadMoreButton(Landroid/view/View;)V"
|
||||||
|
@ -10,7 +10,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
|||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
|
import app.revanced.patches.youtube.misc.litho.patch.ByteBufferFilterPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@ -18,7 +18,7 @@ import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
|||||||
@Description("Removes mix playlists from home feed and video player.")
|
@Description("Removes mix playlists from home feed and video player.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
LithoFilterPatch::class,
|
ByteBufferFilterPatch::class,
|
||||||
SettingsPatch::class
|
SettingsPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -27,7 +27,7 @@ import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
|||||||
class MixPlaylistsPatch : BytecodePatch() {
|
class MixPlaylistsPatch : BytecodePatch() {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.general.personalinformation.fingerprints
|
package app.revanced.patches.youtube.layout.general.personalinformation.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.accountSwitcherAccessibilityId
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object AccountSwitcherAccessibilityLabelFingerprint : MethodFingerprint(
|
object AccountSwitcherAccessibilityLabelFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
@ -15,10 +15,5 @@ object AccountSwitcherAccessibilityLabelFingerprint : MethodFingerprint(
|
|||||||
Opcode.APUT_OBJECT,
|
Opcode.APUT_OBJECT,
|
||||||
Opcode.CONST
|
Opcode.CONST
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(accountSwitcherAccessibilityId) }
|
||||||
methodDef.implementation?.instructions?.any { it ->
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.accountSwitcherAccessibilityLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -25,16 +25,14 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class HideEmailAddressPatch : BytecodePatch(
|
class HideEmailAddressPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(AccountSwitcherAccessibilityLabelFingerprint)
|
||||||
AccountSwitcherAccessibilityLabelFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
AccountSwitcherAccessibilityLabelFingerprint.result?.let {
|
AccountSwitcherAccessibilityLabelFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val register = (instruction(insertIndex - 2) as OneRegisterInstruction).registerA
|
val register = instruction<OneRegisterInstruction>(insertIndex - 2).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex, """
|
insertIndex, """
|
||||||
@ -45,7 +43,7 @@ class HideEmailAddressPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return AccountSwitcherAccessibilityLabelFingerprint.toErrorResult()
|
} ?: return AccountSwitcherAccessibilityLabelFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.general.searchterms.fingerprints
|
package app.revanced.patches.youtube.layout.general.searchterms.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.searchSuggestionEntryId
|
||||||
import org.jf.dexlib2.Opcode
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object SearchSuggestionEntryFingerprint : MethodFingerprint(
|
object SearchSuggestionEntryFingerprint : MethodFingerprint(
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(searchSuggestionEntryId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.searchSuggestionEntryLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -16,10 +16,11 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.layout.general.searchterms.fingerprints.*
|
import app.revanced.patches.youtube.layout.general.searchterms.fingerprints.*
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||||
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.searchSuggestionEntryId
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||||
import app.revanced.util.integrations.Constants.GENERAL
|
import app.revanced.util.integrations.Constants.GENERAL
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("hide-search-terms")
|
@Name("hide-search-terms")
|
||||||
@ -42,9 +43,9 @@ class SearchTermsPatch : BytecodePatch(
|
|||||||
|
|
||||||
SearchEndpointParentFingerprint.result?.let { parentResult ->
|
SearchEndpointParentFingerprint.result?.let { parentResult ->
|
||||||
SearchEndpointFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
SearchEndpointFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
||||||
val targetRegister = (instruction(targetIndex) as OneRegisterInstruction).registerA
|
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
targetIndex + 1,
|
targetIndex + 1,
|
||||||
@ -54,27 +55,22 @@ class SearchTermsPatch : BytecodePatch(
|
|||||||
} ?: return SearchEndpointFingerprint.toErrorResult()
|
} ?: return SearchEndpointFingerprint.toErrorResult()
|
||||||
} ?: return SearchEndpointParentFingerprint.toErrorResult()
|
} ?: return SearchEndpointParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
SearchSuggestionEntryFingerprint.result?.mutableMethod?.let { method ->
|
SearchSuggestionEntryFingerprint.result?.mutableMethod?.let {
|
||||||
with (method.implementation!!.instructions) {
|
val targetIndex = it.getWideLiteralIndex(searchSuggestionEntryId) + 2
|
||||||
val targetIndex = this.indexOfFirst {
|
val targetRegister = it.instruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.searchSuggestionEntryLabelId
|
|
||||||
} + 2
|
|
||||||
|
|
||||||
val targetRegister = (elementAt(targetIndex) as OneRegisterInstruction).registerA
|
it.addInstruction(
|
||||||
|
targetIndex + 4,
|
||||||
|
"invoke-static {v$targetRegister}, $GENERAL->hideSearchTerms(Landroid/view/View;)V"
|
||||||
|
)
|
||||||
|
|
||||||
method.addInstruction(
|
it.addInstruction(
|
||||||
targetIndex + 4,
|
targetIndex + 2,
|
||||||
"invoke-static {v$targetRegister}, $GENERAL->hideSearchTerms(Landroid/view/View;)V"
|
"invoke-static {v$targetRegister}, $GENERAL->hideSearchTerms(Landroid/view/View;)V"
|
||||||
)
|
)
|
||||||
|
|
||||||
method.addInstruction(
|
|
||||||
targetIndex + 2,
|
|
||||||
"invoke-static {v$targetRegister}, $GENERAL->hideSearchTerms(Landroid/view/View;)V"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: return SearchSuggestionEntryFingerprint.toErrorResult()
|
} ?: return SearchSuggestionEntryFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -25,9 +25,7 @@ import app.revanced.util.integrations.Constants.GENERAL
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class HideSnackBarPatch : BytecodePatch(
|
class HideSnackBarPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(HideSnackBarFingerprint)
|
||||||
HideSnackBarFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
@ -42,7 +40,7 @@ class HideSnackBarPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
} ?: return HideSnackBarFingerprint.toErrorResult()
|
} ?: return HideSnackBarFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -2,18 +2,12 @@ package app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprint
|
|||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.floatyBarTopMarginId
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object MiniPlayerDimensionsCalculatorFingerprint : MethodFingerprint(
|
object MiniPlayerDimensionsCalculatorFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(floatyBarTopMarginId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.floatyBarTopMarginLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -7,6 +7,7 @@ import app.revanced.patcher.annotation.Version
|
|||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.data.toMethodWalker
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
@ -19,9 +20,9 @@ import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
|||||||
import app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints.*
|
import app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints.*
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.bytecode.getStringIndex
|
||||||
import app.revanced.util.integrations.Constants.GENERAL
|
import app.revanced.util.integrations.Constants.GENERAL
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
|
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@ -52,21 +53,17 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
|||||||
} ?: return MiniPlayerDimensionsCalculatorFingerprint.toErrorResult()
|
} ?: return MiniPlayerDimensionsCalculatorFingerprint.toErrorResult()
|
||||||
|
|
||||||
MiniPlayerOverrideFingerprint.result?.let {
|
MiniPlayerOverrideFingerprint.result?.let {
|
||||||
val targetIndex = it.mutableMethod.implementation!!.instructions.indexOfFirst { instruction ->
|
it.mutableMethod.apply {
|
||||||
instruction.opcode == Opcode.CONST_STRING &&
|
(context.toMethodWalker(this)
|
||||||
(instruction as BuilderInstruction21c).reference.toString() == "appName"
|
.nextMethod(getStringIndex("appName") + 2, true)
|
||||||
} + 2
|
|
||||||
(context.toMethodWalker(it.method)
|
|
||||||
.nextMethod(targetIndex, true)
|
|
||||||
.getMethod() as MutableMethod)
|
.getMethod() as MutableMethod)
|
||||||
.instructionProxyCall()
|
.instructionProxyCall()
|
||||||
|
}
|
||||||
} ?: return MiniPlayerOverrideFingerprint.toErrorResult()
|
} ?: return MiniPlayerOverrideFingerprint.toErrorResult()
|
||||||
|
|
||||||
MiniPlayerResponseModelSizeCheckFingerprint.result?.let {
|
MiniPlayerResponseModelSizeCheckFingerprint.result?.addProxyCall() ?: return MiniPlayerResponseModelSizeCheckFingerprint.toErrorResult()
|
||||||
val (_, _, _) = it.addProxyCall()
|
|
||||||
} ?: return MiniPlayerResponseModelSizeCheckFingerprint.toErrorResult()
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
@ -104,7 +101,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
|||||||
val insertInstructions = this.implementation!!.instructions
|
val insertInstructions = this.implementation!!.instructions
|
||||||
for ((index, instruction) in insertInstructions.withIndex()) {
|
for ((index, instruction) in insertInstructions.withIndex()) {
|
||||||
if (instruction.opcode != Opcode.RETURN) continue
|
if (instruction.opcode != Opcode.RETURN) continue
|
||||||
val parameterRegister = (instruction as OneRegisterInstruction).registerA
|
val parameterRegister = this.instruction<OneRegisterInstruction>(index).registerA
|
||||||
this.insertOverride(index, parameterRegister)
|
this.insertOverride(index, parameterRegister)
|
||||||
this.insertOverride(insertInstructions.size - 1, parameterRegister)
|
this.insertOverride(insertInstructions.size - 1, parameterRegister)
|
||||||
break
|
break
|
||||||
@ -114,8 +111,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
|||||||
fun MethodFingerprintResult.unwrap(): Triple<MutableMethod, Int, Int> {
|
fun MethodFingerprintResult.unwrap(): Triple<MutableMethod, Int, Int> {
|
||||||
val scanIndex = this.scanResult.patternScanResult!!.endIndex
|
val scanIndex = this.scanResult.patternScanResult!!.endIndex
|
||||||
val method = this.mutableMethod
|
val method = this.mutableMethod
|
||||||
val instructions = method.implementation!!.instructions
|
val parameterRegister = method.instruction<OneRegisterInstruction>(scanIndex).registerA
|
||||||
val parameterRegister = (instructions[scanIndex] as OneRegisterInstruction).registerA
|
|
||||||
|
|
||||||
return Triple(method, scanIndex, parameterRegister)
|
return Triple(method, scanIndex, parameterRegister)
|
||||||
}
|
}
|
||||||
|
@ -54,12 +54,12 @@ class WideSearchbarPatch : BytecodePatch(
|
|||||||
.nextMethod(index, true)
|
.nextMethod(index, true)
|
||||||
.getMethod() as MutableMethod
|
.getMethod() as MutableMethod
|
||||||
|
|
||||||
injectSearchBarHook(targetMethod)
|
targetMethod.injectSearchBarHook()
|
||||||
} ?: return fingerprint.toErrorResult()
|
} ?: return fingerprint.toErrorResult()
|
||||||
} ?: return parentFingerprint.toErrorResult()
|
} ?: return parentFingerprint.toErrorResult()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
@ -74,13 +74,12 @@ class WideSearchbarPatch : BytecodePatch(
|
|||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun injectSearchBarHook(method: MutableMethod) {
|
private fun MutableMethod.injectSearchBarHook() {
|
||||||
val index = method.implementation!!.instructions.size - 1
|
addInstructions(
|
||||||
method.addInstructions(
|
implementation!!.instructions.size - 1, """
|
||||||
index, """
|
invoke-static {}, $GENERAL->enableWideSearchbar()Z
|
||||||
invoke-static {}, $GENERAL->enableWideSearchbar()Z
|
move-result p0
|
||||||
move-result p0
|
"""
|
||||||
"""
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,9 @@ class ChangeHomePagePatch : BytecodePatch(
|
|||||||
} ?: return LauncherActivityFingerprint.toErrorResult()
|
} ?: return LauncherActivityFingerprint.toErrorResult()
|
||||||
|
|
||||||
IntentExceptionFingerprint.result?.let {
|
IntentExceptionFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val index = it.scanResult.patternScanResult!!.endIndex + 1
|
val index = it.scanResult.patternScanResult!!.endIndex + 1
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
index, """
|
index, """
|
||||||
invoke-static {}, $NAVIGATION->changeHomePage()Z
|
invoke-static {}, $NAVIGATION->changeHomePage()Z
|
||||||
@ -56,7 +57,7 @@ class ChangeHomePagePatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return IntentExceptionFingerprint.toErrorResult()
|
} ?: return IntentExceptionFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -26,19 +26,17 @@ import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class NavigationLabelPatch : BytecodePatch(
|
class NavigationLabelPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(PivotBarSetTextFingerprint)
|
||||||
PivotBarSetTextFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
PivotBarSetTextFingerprint.result?.let {
|
PivotBarSetTextFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex - 2
|
val targetIndex = it.scanResult.patternScanResult!!.endIndex - 2
|
||||||
val targetReference = (instruction(targetIndex) as ReferenceInstruction).reference.toString()
|
val targetReference = instruction<ReferenceInstruction>(targetIndex).reference.toString()
|
||||||
if (targetReference != "Landroid/widget/TextView;")
|
if (targetReference != "Landroid/widget/TextView;")
|
||||||
return PivotBarSetTextFingerprint.toErrorResult()
|
return PivotBarSetTextFingerprint.toErrorResult()
|
||||||
val targetRegister = (instruction(targetIndex) as OneRegisterInstruction).registerA
|
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
addInstruction(
|
addInstruction(
|
||||||
targetIndex + 1,
|
targetIndex + 1,
|
||||||
"invoke-static {v$targetRegister}, $NAVIGATION->hideNavigationLabel(Landroid/widget/TextView;)V"
|
"invoke-static {v$targetRegister}, $NAVIGATION->hideNavigationLabel(Landroid/widget/TextView;)V"
|
||||||
|
@ -92,13 +92,13 @@ class NavigationButtonsPatch : BytecodePatch(
|
|||||||
|
|
||||||
} ?: return PivotBarCreateButtonViewFingerprint.toErrorResult()
|
} ?: return PivotBarCreateButtonViewFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Switch create button with notifications button
|
* Switch create button with notifications button
|
||||||
*/
|
*/
|
||||||
AutoMotiveFingerprint.result?.let {
|
AutoMotiveFingerprint.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val register = (instruction(insertIndex) as OneRegisterInstruction).registerA
|
val register = instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex, """
|
insertIndex, """
|
||||||
|
@ -44,10 +44,9 @@ class ShortsNavBarPatch : BytecodePatch(
|
|||||||
|
|
||||||
PivotBarCreateButtonViewFingerprint.result?.let { parentResult ->
|
PivotBarCreateButtonViewFingerprint.result?.let { parentResult ->
|
||||||
SetPivotBarFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
SetPivotBarFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
val instructions = implementation!!.instructions
|
val register = instruction<OneRegisterInstruction>(startIndex).registerA
|
||||||
val register = (instructions[startIndex] as OneRegisterInstruction).registerA
|
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
startIndex + 1,
|
startIndex + 1,
|
||||||
@ -58,11 +57,11 @@ class ShortsNavBarPatch : BytecodePatch(
|
|||||||
} ?: return PivotBarCreateButtonViewFingerprint.toErrorResult()
|
} ?: return PivotBarCreateButtonViewFingerprint.toErrorResult()
|
||||||
|
|
||||||
ReelWatchBundleFingerprint.result?.let {
|
ReelWatchBundleFingerprint.result?.let {
|
||||||
with (context
|
(context
|
||||||
.toMethodWalker(it.method)
|
.toMethodWalker(it.method)
|
||||||
.nextMethod(it.scanResult.patternScanResult!!.endIndex, true)
|
.nextMethod(it.scanResult.patternScanResult!!.endIndex, true)
|
||||||
.getMethod() as MutableMethod
|
.getMethod() as MutableMethod
|
||||||
) {
|
).apply {
|
||||||
addInstruction(
|
addInstruction(
|
||||||
0,
|
0,
|
||||||
"invoke-static {}, $NAVIGATION->hideShortsPlayerNavBar()V"
|
"invoke-static {}, $NAVIGATION->hideShortsPlayerNavBar()V"
|
||||||
@ -88,7 +87,7 @@ class ShortsNavBarPatch : BytecodePatch(
|
|||||||
}.forEach { instruction ->
|
}.forEach { instruction ->
|
||||||
val insertIndex = indexOf(instruction) + 4
|
val insertIndex = indexOf(instruction) + 4
|
||||||
val targetRegister =
|
val targetRegister =
|
||||||
(navigationEndpointMethod.instruction(insertIndex) as OneRegisterInstruction).registerA
|
navigationEndpointMethod.instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
navigationEndpointMethod.addInstructions(
|
navigationEndpointMethod.addInstructions(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
@ -102,7 +101,7 @@ class ShortsNavBarPatch : BytecodePatch(
|
|||||||
|
|
||||||
} ?: return NavigationEndpointFingerprint.toErrorResult()
|
} ?: return NavigationEndpointFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -9,6 +9,5 @@ object PivotBarChangedFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_STATIC,
|
Opcode.INVOKE_STATIC,
|
||||||
Opcode.MOVE_RESULT
|
Opcode.MOVE_RESULT
|
||||||
),
|
),
|
||||||
customFingerprint = { it.definingClass.endsWith("PivotBar;")
|
customFingerprint = { it.definingClass.endsWith("PivotBar;") && it.name == "onConfigurationChanged" }
|
||||||
&& it.name == "onConfigurationChanged" }
|
|
||||||
)
|
)
|
@ -40,7 +40,7 @@ class TabletNavigationBarPatch : BytecodePatch(
|
|||||||
it.result?.insertHook() ?: return it.toErrorResult()
|
it.result?.insertHook() ?: return it.toErrorResult()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
@ -57,7 +57,7 @@ class TabletNavigationBarPatch : BytecodePatch(
|
|||||||
companion object {
|
companion object {
|
||||||
private fun MethodFingerprintResult.insertHook() {
|
private fun MethodFingerprintResult.insertHook() {
|
||||||
val targetIndex = this.scanResult.patternScanResult!!.startIndex + 1
|
val targetIndex = this.scanResult.patternScanResult!!.startIndex + 1
|
||||||
val register = (mutableMethod.instruction(targetIndex) as OneRegisterInstruction).registerA
|
val register = mutableMethod.instruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
|
|
||||||
mutableMethod.addInstructions(
|
mutableMethod.addInstructions(
|
||||||
targetIndex + 1, """
|
targetIndex + 1, """
|
||||||
|
@ -6,6 +6,7 @@ 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.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
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.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
@ -14,15 +15,15 @@ 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.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
|
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
|
||||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||||
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.autoNavPreviewId
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.bytecode.getStringIndex
|
||||||
|
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||||
import app.revanced.util.integrations.Constants.PLAYER
|
import app.revanced.util.integrations.Constants.PLAYER
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
|
|
||||||
import org.jf.dexlib2.iface.instruction.Instruction
|
import org.jf.dexlib2.iface.instruction.Instruction
|
||||||
|
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.WideLiteralInstruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
|
|
||||||
import org.jf.dexlib2.iface.reference.MethodReference
|
import org.jf.dexlib2.iface.reference.MethodReference
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@ -30,53 +31,39 @@ import org.jf.dexlib2.iface.reference.MethodReference
|
|||||||
@Description("Hides the autoplay button in the video player.")
|
@Description("Hides the autoplay button in the video player.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
ResourceMappingPatch::class,
|
SettingsPatch::class,
|
||||||
SettingsPatch::class
|
SharedResourceIdPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class HideAutoplayButtonPatch : BytecodePatch(
|
class HideAutoplayButtonPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(LayoutConstructorFingerprint)
|
||||||
LayoutConstructorFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
// resolve the offsets such as ...
|
|
||||||
val autoNavToggleId = ResourceMappingPatch.resourceMappings.single {
|
|
||||||
it.type == "id" && it.name == "autonav_toggle"
|
|
||||||
}.id
|
|
||||||
|
|
||||||
LayoutConstructorFingerprint.result?.mutableMethod?.let { method ->
|
LayoutConstructorFingerprint.result?.mutableMethod?.let {
|
||||||
with (method.implementation!!.instructions) {
|
val insertInstruction = it.implementation!!.instructions
|
||||||
val registerIndex = indexOfFirst {
|
|
||||||
it.opcode == Opcode.CONST_STRING &&
|
|
||||||
(it as BuilderInstruction21c).reference.toString() == "1.0x"
|
|
||||||
}
|
|
||||||
val dummyRegister = (this[registerIndex] as Instruction21c).registerA
|
|
||||||
|
|
||||||
// where to insert the branch instructions and ...
|
val dummyRegister = it.instruction<OneRegisterInstruction>(it.getStringIndex("1.0x")).registerA
|
||||||
val insertIndex = this.indexOfFirst {
|
val insertIndex = it.getWideLiteralIndex(autoNavPreviewId)
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == autoNavToggleId
|
|
||||||
}
|
|
||||||
// where to branch away
|
|
||||||
val branchIndex = this.subList(insertIndex + 1, this.size - 1).indexOfFirst {
|
|
||||||
((it as? ReferenceInstruction)?.reference as? MethodReference)?.name == "addOnLayoutChangeListener"
|
|
||||||
} + 2
|
|
||||||
|
|
||||||
val jumpInstruction = this[insertIndex + branchIndex] as Instruction
|
val branchIndex = insertInstruction.subList(insertIndex + 1, insertInstruction.size - 1).indexOfFirst { instruction ->
|
||||||
|
((instruction as? ReferenceInstruction)?.reference as? MethodReference)?.name == "addOnLayoutChangeListener"
|
||||||
|
} + 2
|
||||||
|
|
||||||
method.addInstructions(
|
val jumpInstruction = it.instruction<Instruction>(insertIndex + branchIndex)
|
||||||
insertIndex, """
|
|
||||||
invoke-static {}, $PLAYER->hideAutoPlayButton()Z
|
it.addInstructions(
|
||||||
move-result v$dummyRegister
|
insertIndex, """
|
||||||
if-nez v$dummyRegister, :hidden
|
invoke-static {}, $PLAYER->hideAutoPlayButton()Z
|
||||||
|
move-result v$dummyRegister
|
||||||
|
if-nez v$dummyRegister, :hidden
|
||||||
""", listOf(ExternalLabel("hidden", jumpInstruction))
|
""", listOf(ExternalLabel("hidden", jumpInstruction))
|
||||||
)
|
)
|
||||||
}
|
|
||||||
} ?: return LayoutConstructorFingerprint.toErrorResult()
|
} ?: return LayoutConstructorFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -24,14 +24,12 @@ import org.jf.dexlib2.Opcode
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class HideCaptionsButtonBytecodePatch : BytecodePatch(
|
class HideCaptionsButtonBytecodePatch : BytecodePatch(
|
||||||
listOf(
|
listOf(SubtitleButtonControllerFingerprint)
|
||||||
SubtitleButtonControllerFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
SubtitleButtonControllerFingerprint.result?.mutableMethod?.let {
|
SubtitleButtonControllerFingerprint.result?.mutableMethod?.let {
|
||||||
with (it.implementation!!.instructions) {
|
it.implementation!!.instructions.apply {
|
||||||
for ((index, instruction) in this.withIndex()) {
|
for ((index, instruction) in this.withIndex()) {
|
||||||
if (instruction.opcode != Opcode.IGET_BOOLEAN) continue
|
if (instruction.opcode != Opcode.IGET_BOOLEAN) continue
|
||||||
|
|
||||||
@ -45,7 +43,7 @@ class HideCaptionsButtonBytecodePatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return SubtitleButtonControllerFingerprint.toErrorResult()
|
} ?: return SubtitleButtonControllerFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -38,7 +38,7 @@ class HideCastButtonPatch : BytecodePatch() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -27,7 +27,7 @@ import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
|||||||
class HideCollapseButtonPatch : ResourcePatch {
|
class HideCollapseButtonPatch : ResourcePatch {
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patches.youtube.layout.player.endscreencards.fingerprints
|
package app.revanced.patches.youtube.layout.player.endscreencards.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.layoutCircleId
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object LayoutCircleFingerprint : MethodFingerprint(
|
object LayoutCircleFingerprint : MethodFingerprint(
|
||||||
@ -13,10 +13,5 @@ object LayoutCircleFingerprint : MethodFingerprint(
|
|||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.CHECK_CAST,
|
Opcode.CHECK_CAST,
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(layoutCircleId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.layoutCircle
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patches.youtube.layout.player.endscreencards.fingerprints
|
package app.revanced.patches.youtube.layout.player.endscreencards.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.layoutIconId
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object LayoutIconFingerprint : MethodFingerprint(
|
object LayoutIconFingerprint : MethodFingerprint(
|
||||||
@ -13,10 +13,5 @@ object LayoutIconFingerprint : MethodFingerprint(
|
|||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.CHECK_CAST,
|
Opcode.CHECK_CAST,
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(layoutIconId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.layoutIcon
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patches.youtube.layout.player.endscreencards.fingerprints
|
package app.revanced.patches.youtube.layout.player.endscreencards.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.layoutVideoId
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object LayoutVideoFingerprint : MethodFingerprint(
|
object LayoutVideoFingerprint : MethodFingerprint(
|
||||||
@ -13,10 +13,5 @@ object LayoutVideoFingerprint : MethodFingerprint(
|
|||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.CHECK_CAST,
|
Opcode.CHECK_CAST,
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(layoutVideoId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.layoutVideo
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -17,7 +17,7 @@ import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
|||||||
import app.revanced.patches.youtube.layout.player.endscreencards.fingerprints.*
|
import app.revanced.patches.youtube.layout.player.endscreencards.fingerprints.*
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("hide-endscreen-cards")
|
@Name("hide-endscreen-cards")
|
||||||
@ -41,8 +41,8 @@ class HideEndscreenCardsPatch : BytecodePatch(
|
|||||||
|
|
||||||
fun MethodFingerprintResult.injectHideCalls() {
|
fun MethodFingerprintResult.injectHideCalls() {
|
||||||
val index = this.scanResult.patternScanResult!!.endIndex
|
val index = this.scanResult.patternScanResult!!.endIndex
|
||||||
with (this.mutableMethod) {
|
this.mutableMethod.apply {
|
||||||
val register = (this.instruction(index) as Instruction21c).registerA
|
val register = this.instruction<OneRegisterInstruction>(index).registerA
|
||||||
this.implementation!!.injectHideCall(index + 1, register, "layout/PlayerPatch", "hideEndscreen")
|
this.implementation!!.injectHideCall(index + 1, register, "layout/PlayerPatch", "hideEndscreen")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ class HideEndscreenCardsPatch : BytecodePatch(
|
|||||||
it.result?.injectHideCalls() ?: return it.toErrorResult()
|
it.result?.injectHideCalls() ?: return it.toErrorResult()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -40,7 +40,7 @@ class HideInfocardsPatch : BytecodePatch(
|
|||||||
) ?: return InfocardsIncognitoFingerprint.toErrorResult()
|
) ?: return InfocardsIncognitoFingerprint.toErrorResult()
|
||||||
} ?: return InfocardsIncognitoParentFingerprint.toErrorResult()
|
} ?: return InfocardsIncognitoParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -27,7 +27,7 @@ import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
|||||||
class HideLiveChatButtonPatch : ResourcePatch {
|
class HideLiveChatButtonPatch : ResourcePatch {
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -30,7 +30,7 @@ class HideMusicButtonPatch : BytecodePatch(
|
|||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
MusicAppDeeplinkButtonFingerprint.result?.mutableMethod?.let {
|
MusicAppDeeplinkButtonFingerprint.result?.mutableMethod?.let {
|
||||||
with (it.implementation!!.instructions) {
|
it.implementation!!.instructions.apply {
|
||||||
val jumpInstruction = this[size - 1] as Instruction
|
val jumpInstruction = this[size - 1] as Instruction
|
||||||
it.addInstructions(
|
it.addInstructions(
|
||||||
0, """
|
0, """
|
||||||
@ -42,7 +42,7 @@ class HideMusicButtonPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return MusicAppDeeplinkButtonFingerprint.toErrorResult()
|
} ?: return MusicAppDeeplinkButtonFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -15,6 +15,7 @@ import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
|||||||
import app.revanced.patches.youtube.layout.player.playerbuttonbg.fingerprints.HidePlayerButtonFingerprint
|
import app.revanced.patches.youtube.layout.player.playerbuttonbg.fingerprints.HidePlayerButtonFingerprint
|
||||||
import app.revanced.patches.youtube.misc.playerbutton.patch.PlayerButtonPatch
|
import app.revanced.patches.youtube.misc.playerbutton.patch.PlayerButtonPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("hide-player-button-background")
|
@Name("hide-player-button-background")
|
||||||
@ -28,18 +29,16 @@ import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class HidePlayerButtonBackgroundPatch : BytecodePatch(
|
class HidePlayerButtonBackgroundPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(HidePlayerButtonFingerprint)
|
||||||
HidePlayerButtonFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
HidePlayerButtonFingerprint.result?.mutableMethod?.addInstruction(
|
HidePlayerButtonFingerprint.result?.mutableMethod?.addInstruction(
|
||||||
0,
|
0,
|
||||||
"invoke-static { p0 }, Lapp/revanced/integrations/utils/ResourceHelper;->hidePlayerButtonBackground(Landroid/view/View;)V"
|
"invoke-static { p0 }, $INTEGRATIONS_PATH/utils/ResourceHelper;->hidePlayerButtonBackground(Landroid/view/View;)V"
|
||||||
) ?: return HidePlayerButtonFingerprint.toErrorResult()
|
) ?: return HidePlayerButtonFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -38,7 +38,7 @@ class HidePreviousNextButtonPatch : BytecodePatch(
|
|||||||
) ?: return SupportsNextPreviousFingerprint.toErrorResult()
|
) ?: return SupportsNextPreviousFingerprint.toErrorResult()
|
||||||
} ?: return ControlsOverlayStyleFingerprint.toErrorResult()
|
} ?: return ControlsOverlayStyleFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -14,7 +14,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
|||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
||||||
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
|
import app.revanced.patches.youtube.misc.litho.patch.ByteBufferFilterPatch
|
||||||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
||||||
@ -27,7 +27,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
|||||||
@Description("Hide the suggested actions bar inside the player.")
|
@Description("Hide the suggested actions bar inside the player.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
LithoFilterPatch::class,
|
ByteBufferFilterPatch::class,
|
||||||
PlayerTypeHookPatch::class,
|
PlayerTypeHookPatch::class,
|
||||||
ResourceMappingPatch::class,
|
ResourceMappingPatch::class,
|
||||||
SettingsPatch::class
|
SettingsPatch::class
|
||||||
|
@ -28,30 +28,28 @@ import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class HideChannelWatermarkBytecodePatch : BytecodePatch(
|
class HideChannelWatermarkBytecodePatch : BytecodePatch(
|
||||||
listOf(
|
listOf(HideWatermarkParentFingerprint)
|
||||||
HideWatermarkParentFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
HideWatermarkParentFingerprint.result?.let { parentResult ->
|
HideWatermarkParentFingerprint.result?.let { parentResult ->
|
||||||
HideWatermarkFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
HideWatermarkFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
it.mutableMethod.apply {
|
||||||
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
val register = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
with (it.mutableMethod) {
|
|
||||||
val register = (instruction(insertIndex) as TwoRegisterInstruction).registerA
|
|
||||||
removeInstruction(insertIndex)
|
removeInstruction(insertIndex)
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex, """
|
insertIndex, """
|
||||||
invoke-static {}, $PLAYER->hideChannelWatermark()Z
|
invoke-static {}, $PLAYER->hideChannelWatermark()Z
|
||||||
move-result v$register
|
move-result v$register
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: return HideWatermarkFingerprint.toErrorResult()
|
} ?: return HideWatermarkFingerprint.toErrorResult()
|
||||||
} ?: return HideWatermarkParentFingerprint.toErrorResult()
|
} ?: return HideWatermarkParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -42,7 +42,7 @@ class HideSeekbarPatch : BytecodePatch() {
|
|||||||
""", listOf(ExternalLabel("show_seekbar", insertMethod.instruction(0)))
|
""", listOf(ExternalLabel("show_seekbar", insertMethod.instruction(0)))
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.seekbar.seekbarcolor.bytecode.fingerprints
|
package app.revanced.patches.youtube.layout.seekbar.seekbarcolor.bytecode.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.inlineTimeBarColorizedBarPlayedColorDarkId
|
||||||
import org.jf.dexlib2.Opcode
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object SeekbarColorFingerprint : MethodFingerprint(
|
object SeekbarColorFingerprint : MethodFingerprint(
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(inlineTimeBarColorizedBarPlayedColorDarkId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.inlineTimeBarColorizedBarPlayedColorDarkId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -18,10 +18,12 @@ import app.revanced.patches.shared.fingerprints.ControlsOverlayStyleFingerprint
|
|||||||
import app.revanced.patches.youtube.layout.seekbar.seekbarcolor.bytecode.fingerprints.*
|
import app.revanced.patches.youtube.layout.seekbar.seekbarcolor.bytecode.fingerprints.*
|
||||||
import app.revanced.patches.youtube.misc.litho.patch.LithoThemePatch
|
import app.revanced.patches.youtube.misc.litho.patch.LithoThemePatch
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||||
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.inlineTimeBarColorizedBarPlayedColorDarkId
|
||||||
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.inlineTimeBarPlayedNotHighlightedColorId
|
||||||
|
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||||
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
||||||
import app.revanced.util.integrations.Constants.SEEKBAR
|
import app.revanced.util.integrations.Constants.SEEKBAR
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
@Name("custom-seekbar-color-bytecode-patch")
|
@Name("custom-seekbar-color-bytecode-patch")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
@ -40,20 +42,9 @@ class SeekbarColorBytecodePatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
SeekbarColorFingerprint.result?.mutableMethod?.let { method ->
|
SeekbarColorFingerprint.result?.mutableMethod?.let {
|
||||||
with (method.implementation!!.instructions) {
|
it.hook(it.getWideLiteralIndex(inlineTimeBarColorizedBarPlayedColorDarkId) + 2)
|
||||||
val insertIndex = arrayOf(
|
it.hook(it.getWideLiteralIndex(inlineTimeBarPlayedNotHighlightedColorId) + 2)
|
||||||
SharedResourceIdPatch.inlineTimeBarColorizedBarPlayedColorDarkId,
|
|
||||||
SharedResourceIdPatch.inlineTimeBarPlayedNotHighlightedColorId
|
|
||||||
).map { id ->
|
|
||||||
this.indexOfFirst {
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == id
|
|
||||||
} + 2
|
|
||||||
}
|
|
||||||
|
|
||||||
method.hook(insertIndex[0])
|
|
||||||
method.hook(insertIndex[1])
|
|
||||||
}
|
|
||||||
} ?: return SeekbarColorFingerprint.toErrorResult()
|
} ?: return SeekbarColorFingerprint.toErrorResult()
|
||||||
|
|
||||||
ControlsOverlayStyleFingerprint.result?.let { parentResult ->
|
ControlsOverlayStyleFingerprint.result?.let { parentResult ->
|
||||||
@ -86,7 +77,7 @@ class SeekbarColorBytecodePatch : BytecodePatch(
|
|||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
fun MutableMethod.hook(insertIndex: Int) {
|
fun MutableMethod.hook(insertIndex: Int) {
|
||||||
val insertRegister = (instruction(insertIndex) as OneRegisterInstruction).registerA
|
val insertRegister = instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex + 1, """
|
insertIndex + 1, """
|
||||||
|
@ -2,9 +2,9 @@ package app.revanced.patches.youtube.layout.seekbar.seekbartapping.fingerprints
|
|||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.util.bytecode.isNarrowLiteralExists
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
|
||||||
|
|
||||||
object SeekbarTappingFingerprint : MethodFingerprint(
|
object SeekbarTappingFingerprint : MethodFingerprint(
|
||||||
returnType = "Z",
|
returnType = "Z",
|
||||||
@ -17,10 +17,5 @@ object SeekbarTappingFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.RETURN
|
Opcode.RETURN
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.name == "onTouchEvent" && it.isNarrowLiteralExists(2147483647) }
|
||||||
methodDef.name == "onTouchEvent"
|
|
||||||
&& methodDef.implementation!!.instructions.any {
|
|
||||||
((it as? NarrowLiteralInstruction)?.narrowLiteral == 2147483647)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -2,18 +2,12 @@ package app.revanced.patches.youtube.layout.seekbar.seekbartapping.fingerprints
|
|||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.accessibilityProgressTimeId
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object SeekbarTappingParentFingerprint : MethodFingerprint(
|
object SeekbarTappingParentFingerprint : MethodFingerprint(
|
||||||
returnType = "L",
|
returnType = "L",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(accessibilityProgressTimeId)}
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.accessibilityProgressTimeLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -68,9 +68,8 @@ class SeekbarTappingPatch : BytecodePatch(
|
|||||||
SeekbarTappingFingerprint.result?.let {
|
SeekbarTappingFingerprint.result?.let {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
with (it.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val instructions = implementation!!.instructions
|
val register = instruction<Instruction35c>(insertIndex - 1).registerC
|
||||||
val register = (instructions[insertIndex - 1] as Instruction35c).registerC
|
|
||||||
|
|
||||||
val pMethod = tapSeekMethods["P"]!!
|
val pMethod = tapSeekMethods["P"]!!
|
||||||
val oMethod = tapSeekMethods["O"]!!
|
val oMethod = tapSeekMethods["O"]!!
|
||||||
@ -87,7 +86,7 @@ class SeekbarTappingPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return SeekbarTappingFingerprint.toErrorResult()
|
} ?: return SeekbarTappingFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -25,9 +25,7 @@ import app.revanced.util.integrations.Constants.SEEKBAR
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class HideTimeStampPatch : BytecodePatch(
|
class HideTimeStampPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(TimeCounterFingerprint)
|
||||||
TimeCounterFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
@ -42,7 +40,7 @@ class HideTimeStampPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
} ?: return TimeCounterFingerprint.toErrorResult()
|
} ?: return TimeCounterFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints
|
package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.rightCommentId
|
||||||
import org.jf.dexlib2.Opcode
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object ShortsCommentFingerprint : MethodFingerprint(
|
object ShortsCommentFingerprint : MethodFingerprint(
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(rightCommentId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.rightCommentLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -1,16 +1,10 @@
|
|||||||
package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints
|
package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.reelPlayerInfoPanelId
|
||||||
import org.jf.dexlib2.Opcode
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object ShortsInfoPanelFingerprint : MethodFingerprint(
|
object ShortsInfoPanelFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(reelPlayerInfoPanelId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.reelPlayerInfoPanelLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -1,15 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints
|
package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.reelPlayerBadgeId
|
||||||
import org.jf.dexlib2.Opcode
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object ShortsPaidContentFingerprint : MethodFingerprint(
|
object ShortsPaidContentFingerprint : MethodFingerprint(
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(reelPlayerBadgeId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.reelPlayerBadgeLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -1,15 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints
|
package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.reelRemixId
|
||||||
import org.jf.dexlib2.Opcode
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object ShortsRemixFingerprint : MethodFingerprint(
|
object ShortsRemixFingerprint : MethodFingerprint(
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(reelRemixId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.reelRemixLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -1,15 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints
|
package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.reelPlayerPausedId
|
||||||
import org.jf.dexlib2.Opcode
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object ShortsSubscriptionsFingerprint : MethodFingerprint(
|
object ShortsSubscriptionsFingerprint : MethodFingerprint(
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(reelPlayerPausedId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.reelPlayerPausedLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -1,15 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints
|
package app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.reelPlayerFooterId
|
||||||
import org.jf.dexlib2.Opcode
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object ShortsSubscriptionsTabletParentFingerprint : MethodFingerprint(
|
object ShortsSubscriptionsTabletParentFingerprint : MethodFingerprint(
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { it.isWideLiteralExists(reelPlayerFooterId) }
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.reelPlayerFooterLabelId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
)
|
@ -5,38 +5,32 @@ 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.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
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.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsCommentFingerprint
|
import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsCommentFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.rightCommentId
|
||||||
|
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||||
import app.revanced.util.integrations.Constants.SHORTS
|
import app.revanced.util.integrations.Constants.SHORTS
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
@Name("hide-shorts-comment")
|
@Name("hide-shorts-comment")
|
||||||
@DependsOn([SharedResourceIdPatch::class])
|
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ShortsCommentButtonPatch : BytecodePatch(
|
class ShortsCommentButtonPatch : BytecodePatch(
|
||||||
listOf(ShortsCommentFingerprint)
|
listOf(ShortsCommentFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
ShortsCommentFingerprint.result?.mutableMethod?.let { method ->
|
ShortsCommentFingerprint.result?.mutableMethod?.let {
|
||||||
with (method.implementation!!.instructions) {
|
val insertIndex = it.getWideLiteralIndex(rightCommentId) + 3
|
||||||
val insertIndex = this.indexOfFirst {
|
val insertRegister = it.instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.rightCommentLabelId
|
|
||||||
} + 3
|
|
||||||
|
|
||||||
val insertRegister = (elementAt(insertIndex) as OneRegisterInstruction).registerA
|
it.addInstruction(
|
||||||
|
insertIndex + 1,
|
||||||
method.addInstruction(
|
"invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerCommentsButton(Landroid/view/View;)V"
|
||||||
insertIndex + 1,
|
)
|
||||||
"invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerCommentsButton(Landroid/view/View;)V"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: return ShortsCommentFingerprint.toErrorResult()
|
} ?: return ShortsCommentFingerprint.toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
@ -11,8 +11,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
|||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
||||||
import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch
|
import app.revanced.patches.youtube.ads.general.resource.patch.GeneralAdsPatch
|
||||||
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
|
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
||||||
@ -22,8 +21,7 @@ import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
|||||||
@Description("Hides other Shorts components.")
|
@Description("Hides other Shorts components.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
GeneralAdsBytecodePatch::class,
|
GeneralAdsPatch::class,
|
||||||
LithoFilterPatch::class,
|
|
||||||
ResourceMappingPatch::class,
|
ResourceMappingPatch::class,
|
||||||
SettingsPatch::class,
|
SettingsPatch::class,
|
||||||
SharedResourceIdPatch::class,
|
SharedResourceIdPatch::class,
|
||||||
@ -41,7 +39,7 @@ class ShortsComponentPatch : BytecodePatch() {
|
|||||||
|
|
||||||
context.updatePatchStatus("ShortsComponent")
|
context.updatePatchStatus("ShortsComponent")
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
@ -5,40 +5,34 @@ 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.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
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.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsInfoPanelFingerprint
|
import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsInfoPanelFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.reelPlayerInfoPanelId
|
||||||
|
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||||
import app.revanced.util.integrations.Constants.SHORTS
|
import app.revanced.util.integrations.Constants.SHORTS
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
@Name("hide-shorts-info-panel")
|
@Name("hide-shorts-info-panel")
|
||||||
@DependsOn([SharedResourceIdPatch::class])
|
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ShortsInfoPanelPatch : BytecodePatch(
|
class ShortsInfoPanelPatch : BytecodePatch(
|
||||||
listOf(ShortsInfoPanelFingerprint)
|
listOf(ShortsInfoPanelFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
ShortsInfoPanelFingerprint.result?.mutableMethod?.let { method ->
|
ShortsInfoPanelFingerprint.result?.mutableMethod?.let {
|
||||||
with (method.implementation!!.instructions) {
|
val insertIndex = it.getWideLiteralIndex(reelPlayerInfoPanelId) + 3
|
||||||
val insertIndex = this.indexOfFirst {
|
val insertRegister = it.instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.reelPlayerInfoPanelLabelId
|
|
||||||
} + 3
|
|
||||||
|
|
||||||
val insertRegister = (elementAt(insertIndex) as OneRegisterInstruction).registerA
|
it.addInstructions(
|
||||||
|
insertIndex + 1, """
|
||||||
method.addInstructions(
|
invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerInfoPanel(Landroid/view/ViewGroup;)Landroid/view/ViewGroup;
|
||||||
insertIndex + 1, """
|
move-result-object v$insertRegister
|
||||||
invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerInfoPanel(Landroid/view/ViewGroup;)Landroid/view/ViewGroup;
|
|
||||||
move-result-object v$insertRegister
|
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
|
||||||
} ?: return ShortsInfoPanelFingerprint.toErrorResult()
|
} ?: return ShortsInfoPanelFingerprint.toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
@ -9,40 +9,32 @@ 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.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsPaidContentFingerprint
|
import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsPaidContentFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.reelPlayerBadge2Id
|
||||||
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.reelPlayerBadgeId
|
||||||
|
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||||
import app.revanced.util.integrations.Constants.SHORTS
|
import app.revanced.util.integrations.Constants.SHORTS
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
@Name("hide-shorts-paid-content")
|
@Name("hide-shorts-paid-content")
|
||||||
@DependsOn([SharedResourceIdPatch::class])
|
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ShortsPaidContentBannerPatch : BytecodePatch(
|
class ShortsPaidContentBannerPatch : BytecodePatch(
|
||||||
listOf(ShortsPaidContentFingerprint)
|
listOf(ShortsPaidContentFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
ShortsPaidContentFingerprint.result?.mutableMethod?.let { method ->
|
ShortsPaidContentFingerprint.result?.mutableMethod?.let {
|
||||||
with (method.implementation!!.instructions) {
|
val primaryIndex = it.getWideLiteralIndex(reelPlayerBadgeId) + 3
|
||||||
val primaryIndex = this.indexOfFirst {
|
val secondaryIndex = it.getWideLiteralIndex(reelPlayerBadge2Id) + 3
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.reelPlayerBadgeLabelId
|
|
||||||
} + 3
|
|
||||||
|
|
||||||
val secondaryIndex = this.indexOfFirst {
|
if (primaryIndex > secondaryIndex) {
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.reelPlayerBadge2LabelId
|
it.insertHook(primaryIndex)
|
||||||
} + 3
|
it.insertHook(secondaryIndex)
|
||||||
|
} else {
|
||||||
if (primaryIndex > secondaryIndex) {
|
it.insertHook(secondaryIndex)
|
||||||
method.insertHook(primaryIndex)
|
it.insertHook(primaryIndex)
|
||||||
method.insertHook(secondaryIndex)
|
|
||||||
} else {
|
|
||||||
method.insertHook(secondaryIndex)
|
|
||||||
method.insertHook(primaryIndex)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} ?: return ShortsPaidContentFingerprint.toErrorResult()
|
} ?: return ShortsPaidContentFingerprint.toErrorResult()
|
||||||
|
|
||||||
@ -50,12 +42,13 @@ class ShortsPaidContentBannerPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
private companion object {
|
private companion object {
|
||||||
fun MutableMethod.insertHook(insertIndex: Int) {
|
fun MutableMethod.insertHook(insertIndex: Int) {
|
||||||
val insertRegister = (instruction(insertIndex) as OneRegisterInstruction).registerA
|
val insertRegister = instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex + 1, """
|
insertIndex + 1, """
|
||||||
invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerPaidContent(Landroid/view/ViewStub;)Landroid/view/ViewStub;
|
invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerPaidContent(Landroid/view/ViewStub;)Landroid/view/ViewStub;
|
||||||
move-result-object v$insertRegister
|
move-result-object v$insertRegister
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,38 +5,32 @@ 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.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
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.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsRemixFingerprint
|
import app.revanced.patches.youtube.layout.shorts.shortscomponent.fingerprints.ShortsRemixFingerprint
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.reelRemixId
|
||||||
|
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||||
import app.revanced.util.integrations.Constants.SHORTS
|
import app.revanced.util.integrations.Constants.SHORTS
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
@Name("hide-shorts-remix")
|
@Name("hide-shorts-remix")
|
||||||
@DependsOn([SharedResourceIdPatch::class])
|
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ShortsRemixButtonPatch : BytecodePatch(
|
class ShortsRemixButtonPatch : BytecodePatch(
|
||||||
listOf(ShortsRemixFingerprint)
|
listOf(ShortsRemixFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
ShortsRemixFingerprint.result?.mutableMethod?.let { method ->
|
ShortsRemixFingerprint.result?.mutableMethod?.let {
|
||||||
with (method.implementation!!.instructions) {
|
val insertIndex = it.getWideLiteralIndex(reelRemixId) - 2
|
||||||
val insertIndex = this.indexOfFirst {
|
val insertRegister = it.instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.reelRemixLabelId
|
|
||||||
} - 2
|
|
||||||
|
|
||||||
val insertRegister = (elementAt(insertIndex) as OneRegisterInstruction).registerA
|
it.addInstruction(
|
||||||
|
insertIndex,
|
||||||
method.addInstruction(
|
"invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerRemixButton(Landroid/view/View;)V"
|
||||||
insertIndex,
|
)
|
||||||
"invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerRemixButton(Landroid/view/View;)V"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: return ShortsRemixFingerprint.toErrorResult()
|
} ?: return ShortsRemixFingerprint.toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user