mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-03 16:14:28 +02:00
fix(youtube/enable-old-quality-layout): not working in new player flyout panel
This commit is contained in:
parent
25e460f6d6
commit
f3aa092371
@ -0,0 +1,14 @@
|
|||||||
|
package app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.BottomSheetMargins
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object NewQualityLayoutBuilderFingerprint : MethodFingerprint(
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("L"),
|
||||||
|
returnType = "Landroid/widget/LinearLayout;",
|
||||||
|
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(BottomSheetMargins) }
|
||||||
|
)
|
@ -1,11 +1,16 @@
|
|||||||
package app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints
|
package app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints
|
||||||
|
|
||||||
|
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.utils.resourceid.patch.SharedResourceIdPatch.Companion.VideoQualityBottomSheet
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.VideoQualityBottomSheet
|
||||||
import app.revanced.util.bytecode.isWideLiteralExists
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object QualityMenuViewInflateFingerprint : MethodFingerprint(
|
object QualityMenuViewInflateFingerprint : MethodFingerprint(
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("L", "L", "L"),
|
||||||
|
returnType = "L",
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.INVOKE_SUPER,
|
Opcode.INVOKE_SUPER,
|
||||||
Opcode.CONST,
|
Opcode.CONST,
|
||||||
|
@ -12,9 +12,11 @@ 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.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints.NewQualityLayoutBuilderFingerprint
|
||||||
import app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
|
import app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
|
||||||
import app.revanced.patches.youtube.utils.alertdialog.patch.NewLayoutAlertDialogPatch
|
import app.revanced.patches.youtube.utils.alertdialog.patch.NewLayoutAlertDialogPatch
|
||||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
|
import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch
|
||||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
||||||
@ -27,6 +29,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
NewLayoutAlertDialogPatch::class,
|
NewLayoutAlertDialogPatch::class,
|
||||||
|
LithoFilterPatch::class,
|
||||||
SettingsPatch::class,
|
SettingsPatch::class,
|
||||||
SharedResourceIdPatch::class
|
SharedResourceIdPatch::class
|
||||||
]
|
]
|
||||||
@ -34,22 +37,43 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class OldQualityLayoutPatch : BytecodePatch(
|
class OldQualityLayoutPatch : BytecodePatch(
|
||||||
listOf(QualityMenuViewInflateFingerprint)
|
listOf(
|
||||||
|
NewQualityLayoutBuilderFingerprint,
|
||||||
|
QualityMenuViewInflateFingerprint
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For old player flyout panels
|
||||||
|
*/
|
||||||
QualityMenuViewInflateFingerprint.result?.let {
|
QualityMenuViewInflateFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val register = getInstruction<OneRegisterInstruction>(endIndex).registerA
|
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
endIndex + 1,
|
insertIndex + 1,
|
||||||
"invoke-static { v$register }, $FLYOUT_PANEL->enableOldQualityMenu(Landroid/widget/ListView;)V"
|
"invoke-static { v$insertRegister }, $FLYOUT_PANEL->enableOldQualityMenu(Landroid/widget/ListView;)V"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: return QualityMenuViewInflateFingerprint.toErrorResult()
|
} ?: return QualityMenuViewInflateFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For new player flyout panels
|
||||||
|
*/
|
||||||
|
NewQualityLayoutBuilderFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val insertIndex = implementation!!.instructions.size - 1
|
||||||
|
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
insertIndex,
|
||||||
|
"invoke-static { v$insertRegister }, $FLYOUT_PANEL->enableOldQualityMenu(Landroid/widget/LinearLayout;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: return NewQualityLayoutBuilderFingerprint.toErrorResult()
|
||||||
|
|
||||||
context.updatePatchStatus("OldQualityLayout")
|
context.updatePatchStatus("OldQualityLayout")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,6 +36,7 @@ class SharedResourceIdPatch : ResourcePatch {
|
|||||||
var BackgroundCategory: Long = -1
|
var BackgroundCategory: Long = -1
|
||||||
var BarContainerHeight: Long = -1
|
var BarContainerHeight: Long = -1
|
||||||
var BottomPanelOverlayText: Long = -1
|
var BottomPanelOverlayText: Long = -1
|
||||||
|
var BottomSheetMargins: Long = -1
|
||||||
var BottomSheetRecyclerView: Long = -1
|
var BottomSheetRecyclerView: Long = -1
|
||||||
var BottomUiContainerStub: Long = -1
|
var BottomUiContainerStub: Long = -1
|
||||||
var ChannelListSubMenu: Long = -1
|
var ChannelListSubMenu: Long = -1
|
||||||
@ -105,6 +106,7 @@ class SharedResourceIdPatch : ResourcePatch {
|
|||||||
BackgroundCategory = find(STRING, "pref_background_and_offline_category")
|
BackgroundCategory = find(STRING, "pref_background_and_offline_category")
|
||||||
BarContainerHeight = find(DIMEN, "bar_container_height")
|
BarContainerHeight = find(DIMEN, "bar_container_height")
|
||||||
BottomPanelOverlayText = find(ID, "bottom_panel_overlay_text")
|
BottomPanelOverlayText = find(ID, "bottom_panel_overlay_text")
|
||||||
|
BottomSheetMargins = find(DIMEN, "bottom_sheet_margins")
|
||||||
BottomSheetRecyclerView = find(LAYOUT, "bottom_sheet_recycler_view")
|
BottomSheetRecyclerView = find(LAYOUT, "bottom_sheet_recycler_view")
|
||||||
BottomUiContainerStub = find(ID, "bottom_ui_container_stub")
|
BottomUiContainerStub = find(ID, "bottom_ui_container_stub")
|
||||||
ChannelListSubMenu = find(LAYOUT, "channel_list_sub_menu")
|
ChannelListSubMenu = find(LAYOUT, "channel_list_sub_menu")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user