mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-29 22:24:31 +02:00
feat(YouTube/Old speed layout): support version 18.46.43
This commit is contained in:
parent
70f8435789
commit
d131bb6da6
@ -7,10 +7,10 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||
import app.revanced.patches.youtube.flyoutpanel.oldspeedlayout.fingerprints.CustomPlaybackSpeedIntegrationsFingerprint
|
||||
import app.revanced.patches.youtube.flyoutpanel.oldspeedlayout.fingerprints.PlaybackRateBottomSheetBuilderFingerprint
|
||||
import app.revanced.patches.youtube.flyoutpanel.oldspeedlayout.fingerprints.PlaybackRateBottomSheetClassFingerprint
|
||||
import app.revanced.patches.youtube.flyoutpanel.recyclerview.BottomSheetRecyclerViewPatch
|
||||
import app.revanced.patches.youtube.utils.fingerprints.RecyclerViewTreeObserverFingerprint
|
||||
@ -31,21 +31,28 @@ object OldSpeedLayoutPatch : BytecodePatch(
|
||||
setOf(
|
||||
CustomPlaybackSpeedIntegrationsFingerprint,
|
||||
PlaybackRateBottomSheetClassFingerprint,
|
||||
PlaybackRateBottomSheetBuilderFingerprint,
|
||||
RecyclerViewTreeObserverFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
/**
|
||||
* Find the values we need
|
||||
* Input 'playbackRateBottomSheetClass' in FlyoutPanelPatch.
|
||||
*/
|
||||
PlaybackRateBottomSheetBuilderFingerprint.result?.let {
|
||||
PlaybackRateBottomSheetClassFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
PLAYBACK_RATE_BOTTOM_SHEET_CLASS = definingClass
|
||||
PLAYBACK_RATE_BOTTOM_SHEET_BUILDER_METHOD = name
|
||||
PLAYBACK_RATE_BOTTOM_SHEET_BUILDER_METHOD =
|
||||
it.mutableClass.methods.find { method -> method.parameters.isEmpty() && method.returnType == "V" }
|
||||
?.name
|
||||
?: throw PatchException("Could not find PlaybackRateBottomSheetBuilderMethod")
|
||||
|
||||
addInstruction(
|
||||
0,
|
||||
"sput-object p0, $INTEGRATIONS_CLASS_DESCRIPTOR->playbackRateBottomSheetClass:$PLAYBACK_RATE_BOTTOM_SHEET_CLASS"
|
||||
)
|
||||
}
|
||||
} ?: throw PlaybackRateBottomSheetBuilderFingerprint.exception
|
||||
} ?: throw PlaybackRateBottomSheetClassFingerprint.exception
|
||||
|
||||
/**
|
||||
* Create a static field in the patch
|
||||
@ -81,18 +88,6 @@ object OldSpeedLayoutPatch : BytecodePatch(
|
||||
}
|
||||
} ?: throw CustomPlaybackSpeedIntegrationsFingerprint.exception
|
||||
|
||||
/**
|
||||
* Input 'playbackRateBottomSheetClass' in FlyoutPanelPatch.
|
||||
*/
|
||||
PlaybackRateBottomSheetClassFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstruction(
|
||||
0,
|
||||
"sput-object p0, $INTEGRATIONS_CLASS_DESCRIPTOR->playbackRateBottomSheetClass:$PLAYBACK_RATE_BOTTOM_SHEET_CLASS"
|
||||
)
|
||||
}
|
||||
} ?: throw PlaybackRateBottomSheetClassFingerprint.exception
|
||||
|
||||
/**
|
||||
* New method
|
||||
*/
|
||||
|
@ -1,12 +0,0 @@
|
||||
package app.revanced.patches.youtube.flyoutpanel.oldspeedlayout.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object PlaybackRateBottomSheetBuilderFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = emptyList(),
|
||||
strings = listOf("PLAYBACK_RATE_MENU_BOTTOM_SHEET_FRAGMENT")
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user