feat(YouTube/Old speed layout): support version 18.46.43

This commit is contained in:
inotia00 2023-12-02 14:46:54 +09:00
parent 70f8435789
commit d131bb6da6
2 changed files with 13 additions and 30 deletions

View File

@ -7,10 +7,10 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable 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.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.oldspeedlayout.fingerprints.PlaybackRateBottomSheetClassFingerprint
import app.revanced.patches.youtube.flyoutpanel.recyclerview.BottomSheetRecyclerViewPatch import app.revanced.patches.youtube.flyoutpanel.recyclerview.BottomSheetRecyclerViewPatch
import app.revanced.patches.youtube.utils.fingerprints.RecyclerViewTreeObserverFingerprint import app.revanced.patches.youtube.utils.fingerprints.RecyclerViewTreeObserverFingerprint
@ -31,21 +31,28 @@ object OldSpeedLayoutPatch : BytecodePatch(
setOf( setOf(
CustomPlaybackSpeedIntegrationsFingerprint, CustomPlaybackSpeedIntegrationsFingerprint,
PlaybackRateBottomSheetClassFingerprint, PlaybackRateBottomSheetClassFingerprint,
PlaybackRateBottomSheetBuilderFingerprint,
RecyclerViewTreeObserverFingerprint RecyclerViewTreeObserverFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
/** /**
* Find the values we need * Input 'playbackRateBottomSheetClass' in FlyoutPanelPatch.
*/ */
PlaybackRateBottomSheetBuilderFingerprint.result?.let { PlaybackRateBottomSheetClassFingerprint.result?.let {
it.mutableMethod.apply { it.mutableMethod.apply {
PLAYBACK_RATE_BOTTOM_SHEET_CLASS = definingClass 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 * Create a static field in the patch
@ -81,18 +88,6 @@ object OldSpeedLayoutPatch : BytecodePatch(
} }
} ?: throw CustomPlaybackSpeedIntegrationsFingerprint.exception } ?: 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 * New method
*/ */

View File

@ -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")
)