mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-09 19:14:37 +02:00
add support YouTube v18.16.37
This commit is contained in:
parent
3ab4a9ff63
commit
42a5364050
@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
|
|||||||
"18.12.35",
|
"18.12.35",
|
||||||
"18.13.38",
|
"18.13.38",
|
||||||
"18.14.41",
|
"18.14.41",
|
||||||
"18.15.40"
|
"18.15.40",
|
||||||
|
"18.16.37"
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
|
@ -10,6 +10,10 @@ import org.jf.dexlib2.Opcode
|
|||||||
object PivotBarCreateButtonViewFingerprint : MethodFingerprint(
|
object PivotBarCreateButtonViewFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.MOVE_OBJECT,
|
||||||
|
Opcode.INVOKE_DIRECT_RANGE, // unique instruction anchor
|
||||||
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { methodDef ->
|
||||||
methodDef.implementation?.instructions?.any {
|
methodDef.implementation?.instructions?.any {
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
||||||
|
@ -13,7 +13,7 @@ object MiniPlayerDimensionsCalculatorFingerprint : MethodFingerprint(
|
|||||||
customFingerprint = { methodDef ->
|
customFingerprint = { methodDef ->
|
||||||
methodDef.implementation?.instructions?.any {
|
methodDef.implementation?.instructions?.any {
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.floatyBarQueueLabelId
|
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.floatyBarTopMarginLabelId
|
||||||
} == true
|
} == true
|
||||||
}
|
}
|
||||||
)
|
)
|
@ -1,25 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.layout.navigation.createbutton.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object PivotBarFingerprint : MethodFingerprint(
|
|
||||||
returnType = "L",
|
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
|
||||||
opcodes = listOf(
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.RETURN_OBJECT
|
|
||||||
),
|
|
||||||
customFingerprint = { methodDef ->
|
|
||||||
methodDef.definingClass == "Lcom/google/android/apps/youtube/app/ui/pivotbar/PivotBar;" &&
|
|
||||||
methodDef.implementation?.instructions?.any {
|
|
||||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.imageWithTextTabId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
|
@ -12,14 +12,12 @@ 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.fingerprints.PivotBarCreateButtonViewFingerprint
|
import app.revanced.patches.shared.fingerprints.PivotBarCreateButtonViewFingerprint
|
||||||
import app.revanced.patches.youtube.layout.navigation.createbutton.fingerprints.PivotBarFingerprint
|
|
||||||
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.integrations.Constants.NAVIGATION
|
import app.revanced.util.integrations.Constants.NAVIGATION
|
||||||
import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
|
import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
|
||||||
import app.revanced.util.pivotbar.InjectionUtils.injectHook
|
import app.revanced.util.pivotbar.InjectionUtils.injectHook
|
||||||
import org.jf.dexlib2.dexbacked.reference.DexBackedMethodReference
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("hide-create-button")
|
@Name("hide-create-button")
|
||||||
@ -34,39 +32,23 @@ import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
|||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class CreateButtonRemoverPatch : BytecodePatch(
|
class CreateButtonRemoverPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
PivotBarCreateButtonViewFingerprint,
|
PivotBarCreateButtonViewFingerprint
|
||||||
PivotBarFingerprint
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
/*
|
|
||||||
* Resolve fingerprints
|
|
||||||
*/
|
|
||||||
|
|
||||||
PivotBarFingerprint.result?.let {
|
|
||||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
|
||||||
val pivotBarInstructions = it.mutableMethod.implementation!!.instructions
|
|
||||||
createRef = (pivotBarInstructions.elementAt(startIndex) as ReferenceInstruction).reference as DexBackedMethodReference
|
|
||||||
} ?: return PivotBarFingerprint.toErrorResult()
|
|
||||||
|
|
||||||
PivotBarCreateButtonViewFingerprint.result?.let { result ->
|
PivotBarCreateButtonViewFingerprint.result?.let { result ->
|
||||||
with (result.mutableMethod){
|
with (result.mutableMethod) {
|
||||||
val createButtonInstructions = implementation!!.instructions
|
val insertIndex = implementation!!.instructions.let {
|
||||||
createButtonInstructions.filter { instruction ->
|
val scanStart = result.scanResult.patternScanResult!!.endIndex
|
||||||
val fieldReference = (instruction as? ReferenceInstruction)?.reference as? DexBackedMethodReference
|
|
||||||
fieldReference?.let { it.definingClass == createRef.definingClass && it.name == createRef.name } == true
|
scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction ->
|
||||||
}.forEach { instruction ->
|
instruction.opcode == Opcode.INVOKE_STATIC
|
||||||
if (foundIndex == 0) {
|
|
||||||
foundIndex++
|
|
||||||
return@forEach
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
injectHook(hook, insertIndex)
|
||||||
* Inject hooks
|
}
|
||||||
*/
|
} ?: return PivotBarCreateButtonViewFingerprint.toErrorResult()
|
||||||
|
|
||||||
injectHook(hook, createButtonInstructions.indexOf(instruction) + 2)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add settings
|
* Add settings
|
||||||
@ -82,19 +64,11 @@ class CreateButtonRemoverPatch : BytecodePatch(
|
|||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
return PivotBarCreateButtonViewFingerprint.toErrorResult()
|
|
||||||
}
|
|
||||||
} ?: return PivotBarCreateButtonViewFingerprint.toErrorResult()
|
|
||||||
}
|
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
const val hook =
|
const val hook =
|
||||||
"invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, $NAVIGATION" +
|
"invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, $NAVIGATION" +
|
||||||
"->" +
|
"->" +
|
||||||
"hideCreateButton(Landroid/view/View;)V"
|
"hideCreateButton(Landroid/view/View;)V"
|
||||||
|
|
||||||
lateinit var createRef: DexBackedMethodReference
|
|
||||||
|
|
||||||
var foundIndex: Int = 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,6 @@ object PivotBarChangedFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_STATIC,
|
Opcode.INVOKE_STATIC,
|
||||||
Opcode.MOVE_RESULT
|
Opcode.MOVE_RESULT
|
||||||
),
|
),
|
||||||
customFingerprint = { it.definingClass == "Lcom/google/android/apps/youtube/app/ui/pivotbar/PivotBar;"
|
customFingerprint = { it.definingClass.endsWith("PivotBar;")
|
||||||
&& it.name == "onConfigurationChanged" }
|
&& it.name == "onConfigurationChanged" }
|
||||||
)
|
)
|
@ -11,5 +11,5 @@ object PivotBarStyleFingerprint : MethodFingerprint(
|
|||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
Opcode.XOR_INT_2ADDR
|
Opcode.XOR_INT_2ADDR
|
||||||
),
|
),
|
||||||
customFingerprint = { it.definingClass == "Lcom/google/android/apps/youtube/app/ui/pivotbar/PivotBar;" }
|
customFingerprint = { it.definingClass.endsWith("PivotBar;") }
|
||||||
)
|
)
|
@ -31,9 +31,8 @@ class SharedResourceIdPatch : ResourcePatch {
|
|||||||
var donationCompanionResourceId: Long = -1
|
var donationCompanionResourceId: Long = -1
|
||||||
var fabLabelId: Long = -1
|
var fabLabelId: Long = -1
|
||||||
var filterBarHeightLabelId: Long = -1
|
var filterBarHeightLabelId: Long = -1
|
||||||
var floatyBarQueueLabelId: Long = -1
|
var floatyBarTopMarginLabelId: Long = -1
|
||||||
var imageOnlyTabId: Long = -1
|
var imageOnlyTabId: Long = -1
|
||||||
var imageWithTextTabId: Long = -1
|
|
||||||
var layoutCircle: Long = -1
|
var layoutCircle: Long = -1
|
||||||
var layoutIcon: Long = -1
|
var layoutIcon: Long = -1
|
||||||
var layoutVideo: Long = -1
|
var layoutVideo: Long = -1
|
||||||
@ -72,9 +71,8 @@ class SharedResourceIdPatch : ResourcePatch {
|
|||||||
donationCompanionResourceId = find(LAYOUT, "donation_companion")
|
donationCompanionResourceId = find(LAYOUT, "donation_companion")
|
||||||
fabLabelId = find(ID, "fab")
|
fabLabelId = find(ID, "fab")
|
||||||
filterBarHeightLabelId = find(DIMEN, "filter_bar_height")
|
filterBarHeightLabelId = find(DIMEN, "filter_bar_height")
|
||||||
floatyBarQueueLabelId = find(STRING, "floaty_bar_queue_status")
|
floatyBarTopMarginLabelId = find(DIMEN, "floaty_bar_button_top_margin")
|
||||||
imageOnlyTabId = find(LAYOUT, "image_only_tab")
|
imageOnlyTabId = find(LAYOUT, "image_only_tab")
|
||||||
imageWithTextTabId = find(LAYOUT, "image_with_text_tab")
|
|
||||||
layoutCircle = find(LAYOUT, "endscreen_element_layout_circle")
|
layoutCircle = find(LAYOUT, "endscreen_element_layout_circle")
|
||||||
layoutIcon = find(LAYOUT, "endscreen_element_layout_icon")
|
layoutIcon = find(LAYOUT, "endscreen_element_layout_icon")
|
||||||
layoutVideo = find(LAYOUT, "endscreen_element_layout_video")
|
layoutVideo = find(LAYOUT, "endscreen_element_layout_video")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user