chore: Lint code

This commit is contained in:
inotia00 2025-03-30 19:13:14 +09:00
parent f249e88ce8
commit 28ff781786
55 changed files with 336 additions and 152 deletions

View File

@ -240,7 +240,11 @@ class StreamingDataRequest private constructor(
}
handleConnectionError(str("revanced_spoof_streaming_data_failed_forbidden"), null, true)
handleConnectionError(str("revanced_spoof_streaming_data_failed_forbidden_suggestion"), null, true)
handleConnectionError(
str("revanced_spoof_streaming_data_failed_forbidden_suggestion"),
null,
true
)
return null
}
}

View File

@ -37,7 +37,6 @@ import app.revanced.extension.youtube.sponsorblock.ui.SponsorBlockViewController
/**
* Not thread safe. All fields/methods must be accessed from the main thread.
*
*/
public class SponsorBlockUtils {
private static final int LOCKED_COLOR = Color.parseColor("#FFC83D");

View File

@ -1,7 +1,36 @@
package app.revanced.extension.youtube.sponsorblock.objects;
import static app.revanced.extension.shared.utils.StringRef.sf;
import static app.revanced.extension.youtube.settings.Settings.*;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_FILLER;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_FILLER_COLOR;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_FILLER_OPACITY;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_HIGHLIGHT;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_HIGHLIGHT_COLOR;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_HIGHLIGHT_OPACITY;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_INTERACTION;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_INTERACTION_COLOR;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_INTERACTION_OPACITY;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_INTRO;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_INTRO_COLOR;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_INTRO_OPACITY;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_MUSIC_OFFTOPIC;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_MUSIC_OFFTOPIC_COLOR;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_MUSIC_OFFTOPIC_OPACITY;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_OUTRO;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_OUTRO_COLOR;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_OUTRO_OPACITY;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_PREVIEW;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_PREVIEW_COLOR;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_PREVIEW_OPACITY;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_SELF_PROMO;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_SELF_PROMO_COLOR;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_SELF_PROMO_OPACITY;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_SPONSOR;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_SPONSOR_COLOR;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_SPONSOR_OPACITY;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_UNSUBMITTED;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_UNSUBMITTED_COLOR;
import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_UNSUBMITTED_OPACITY;
import android.graphics.Color;
import android.graphics.Paint;
@ -56,7 +85,6 @@ public enum SegmentCategory {
SB_CATEGORY_MUSIC_OFFTOPIC, SB_CATEGORY_MUSIC_OFFTOPIC_COLOR, SB_CATEGORY_MUSIC_OFFTOPIC_OPACITY),
UNSUBMITTED("unsubmitted", StringRef.empty, sf("revanced_sb_skip_button_unsubmitted"), sf("revanced_sb_skipped_unsubmitted"),
SB_CATEGORY_UNSUBMITTED, SB_CATEGORY_UNSUBMITTED_COLOR, SB_CATEGORY_UNSUBMITTED_OPACITY);
;
private static final StringRef skipSponsorTextCompact = sf("revanced_sb_skip_button_compact");
private static final StringRef skipSponsorTextCompactHighlight = sf("revanced_sb_skip_button_compact_highlight");

View File

@ -145,8 +145,10 @@ class SwipeControlsOverlayLayout(
addView(feedbackTextView)
// get icons scaled, assuming square icons
val iconHeight = round(feedbackTextView.lineHeight * .8).toInt()
autoBrightnessIcon = getDrawable("revanced_ic_sc_brightness_auto", iconHeight, iconHeight)
manualBrightnessIcon = getDrawable("revanced_ic_sc_brightness_manual", iconHeight, iconHeight)
autoBrightnessIcon =
getDrawable("revanced_ic_sc_brightness_auto", iconHeight, iconHeight)
manualBrightnessIcon =
getDrawable("revanced_ic_sc_brightness_manual", iconHeight, iconHeight)
mutedVolumeIcon = getDrawable("revanced_ic_sc_volume_mute", iconHeight, iconHeight)
normalVolumeIcon = getDrawable("revanced_ic_sc_volume_normal", iconHeight, iconHeight)
}
@ -186,11 +188,18 @@ class SwipeControlsOverlayLayout(
/**
* Displays the progress bar with the appropriate value, icon, and type (brightness or volume).
*/
private fun showFeedbackView(value: String, progress: Int, max: Int, icon: Drawable, isBrightness: Boolean) {
private fun showFeedbackView(
value: String,
progress: Int,
max: Int,
icon: Drawable,
isBrightness: Boolean
) {
feedbackHideHandler.removeCallbacks(feedbackHideCallback)
feedbackHideHandler.postDelayed(feedbackHideCallback, config.overlayShowTimeoutMillis)
val viewToShow = if (config.isCircularProgressBar) circularProgressView else horizontalProgressView
val viewToShow =
if (config.isCircularProgressBar) circularProgressView else horizontalProgressView
viewToShow.apply {
setProgress(progress, max, value, isBrightness)
this.icon = icon
@ -241,7 +250,13 @@ class SwipeControlsOverlayLayout(
brightnessValue < 75 -> highBrightnessIcon
else -> fullBrightnessIcon
}
showFeedbackView("$brightnessValue%", brightnessValue, 100, icon, isBrightness = true)
showFeedbackView(
"$brightnessValue%",
brightnessValue,
100,
icon,
isBrightness = true
)
} else {
showFeedbackView("${round(brightness).toInt()}%", manualBrightnessIcon)
}
@ -274,7 +289,12 @@ abstract class AbstractProgressView(
) : View(context, attrs, defStyleAttr) {
// Combined paint creation function for both fill and stroke styles
private fun createPaint(color: Int, style: Paint.Style = Paint.Style.FILL, strokeCap: Paint.Cap = Paint.Cap.BUTT, strokeWidth: Float = 0f) = Paint(Paint.ANTI_ALIAS_FLAG).apply {
private fun createPaint(
color: Int,
style: Paint.Style = Paint.Style.FILL,
strokeCap: Paint.Cap = Paint.Cap.BUTT,
strokeWidth: Float = 0f
) = Paint(Paint.ANTI_ALIAS_FLAG).apply {
this.style = style
this.color = color
this.strokeCap = strokeCap
@ -283,7 +303,12 @@ abstract class AbstractProgressView(
// Initialize paints
val backgroundPaint = createPaint(overlayBackgroundOpacity, style = Paint.Style.FILL)
val progressPaint = createPaint(overlayProgressColor, style = Paint.Style.STROKE, strokeCap = Paint.Cap.ROUND, strokeWidth = 20f)
val progressPaint = createPaint(
overlayProgressColor,
style = Paint.Style.STROKE,
strokeCap = Paint.Cap.ROUND,
strokeWidth = 20f
)
val fillBackgroundPaint = createPaint(overlayFillBackgroundPaint, style = Paint.Style.FILL)
val textPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
color = overlayTextColor
@ -352,7 +377,12 @@ class CircularProgressView(
rectF.set(20f, 20f, size - 20f, size - 20f)
canvas.drawOval(rectF, fillBackgroundPaint) // Draw the outer ring.
canvas.drawCircle(width / 2f, height / 2f, size / 3, backgroundPaint) // Draw the inner circle.
canvas.drawCircle(
width / 2f,
height / 2f,
size / 3,
backgroundPaint
) // Draw the inner circle.
// Select the paint for drawing based on whether it's brightness or volume.
val sweepAngle = (progress.toFloat() / maxProgress) * 360
@ -428,7 +458,15 @@ class HorizontalProgressView(
if (!overlayShowOverlayMinimalStyle) {
canvas.drawRoundRect(0f, 0f, width, height, cornerRadius, cornerRadius, backgroundPaint)
} else {
canvas.drawRoundRect(minimalStartX, 0f, minimalStartX + minimalElementWidth, height, cornerRadius, cornerRadius, backgroundPaint)
canvas.drawRoundRect(
minimalStartX,
0f,
minimalStartX + minimalElementWidth,
height,
cornerRadius,
cornerRadius,
backgroundPaint
)
}
if (!overlayShowOverlayMinimalStyle) {
@ -466,7 +504,12 @@ class HorizontalProgressView(
padding + minimalStartX
}
val iconY = height / 2 - iconSize / 2
it.setBounds(iconX.toInt(), iconY.toInt(), (iconX + iconSize).toInt(), (iconY + iconSize).toInt())
it.setBounds(
iconX.toInt(),
iconY.toInt(),
(iconX + iconSize).toInt(),
(iconY + iconSize).toInt()
)
it.draw(canvas)
}

View File

@ -152,7 +152,10 @@ private enum class MethodCall(
RegisterNetworkCallback1(
"Landroid/net/ConnectivityManager;",
"registerNetworkCallback",
arrayOf("Landroid/net/NetworkRequest;", "Landroid/net/ConnectivityManager\$NetworkCallback;"),
arrayOf(
"Landroid/net/NetworkRequest;",
"Landroid/net/ConnectivityManager\$NetworkCallback;"
),
"V",
),
RegisterNetworkCallback2(
@ -174,13 +177,20 @@ private enum class MethodCall(
RequestNetwork1(
"Landroid/net/ConnectivityManager;",
"requestNetwork",
arrayOf("Landroid/net/NetworkRequest;", "Landroid/net/ConnectivityManager\$NetworkCallback;"),
arrayOf(
"Landroid/net/NetworkRequest;",
"Landroid/net/ConnectivityManager\$NetworkCallback;"
),
"V",
),
RequestNetwork2(
"Landroid/net/ConnectivityManager;",
"requestNetwork",
arrayOf("Landroid/net/NetworkRequest;", "Landroid/net/ConnectivityManager\$NetworkCallback;", "I"),
arrayOf(
"Landroid/net/NetworkRequest;",
"Landroid/net/ConnectivityManager\$NetworkCallback;",
"I"
),
"V",
),
RequestNetwork3(

View File

@ -19,7 +19,8 @@ val edgeToEdgeDisplayPatch = resourcePatch(
// Instead, it checks compileSdkVersion and prints a warning.
try {
val manifestElement = document.getNode("manifest") as Element
val compileSdkVersion = Integer.parseInt(manifestElement.getAttribute("android:compileSdkVersion"))
val compileSdkVersion =
Integer.parseInt(manifestElement.getAttribute("android:compileSdkVersion"))
if (compileSdkVersion < 35) {
printWarn("This app may not be forcing edge to edge display (compileSdkVersion: $compileSdkVersion)")
}

View File

@ -117,7 +117,8 @@ val accountComponentsPatch = bytecodePatch(
.forEach { index ->
val insertIndex = index - 1
if (!hook && getInstruction(insertIndex).opcode == Opcode.IF_NEZ) {
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
val insertRegister =
getInstruction<OneRegisterInstruction>(insertIndex).registerA
addInstructions(
insertIndex, """

View File

@ -115,7 +115,8 @@ val adsPatch = bytecodePatch(
.methodOrThrow(getPremiumDialogParentFingerprint)
.apply {
val setContentViewIndex = indexOfSetContentViewInstruction(this)
val dialogInstruction = getInstruction<FiveRegisterInstruction>(setContentViewIndex)
val dialogInstruction =
getInstruction<FiveRegisterInstruction>(setContentViewIndex)
val dialogRegister = dialogInstruction.registerC
val viewRegister = dialogInstruction.registerD

View File

@ -206,7 +206,8 @@ val changeHeaderPatch = resourcePatch(
printWarn(warnings)
}
val isLegacyLogoExists = get("res").resolve("drawable-xxhdpi").resolve("ytm_logo.png").exists()
val isLegacyLogoExists =
get("res").resolve("drawable-xxhdpi").resolve("ytm_logo.png").exists()
if (is_7_27_or_greater && isLegacyLogoExists) {
document("res/layout/signin_fragment.xml").use { document ->
document.doRecursively node@{ node ->

View File

@ -1,13 +1,13 @@
package app.revanced.patches.music.misc.watchhistory
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.shared.trackingurlhook.hookWatchHistory
import app.revanced.patches.shared.trackingurlhook.trackingUrlHookPatch
import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.music.utils.patch.PatchList.WATCH_HISTORY
import app.revanced.patches.music.utils.settings.CategoryType
import app.revanced.patches.music.utils.settings.addPreferenceWithIntent
import app.revanced.patches.music.utils.settings.settingsPatch
import app.revanced.patches.shared.trackingurlhook.hookWatchHistory
import app.revanced.patches.shared.trackingurlhook.trackingUrlHookPatch
@Suppress("unused")
val watchHistoryPatch = bytecodePatch(

View File

@ -124,14 +124,17 @@ val navigationBarComponentsPatch = bytecodePatch(
opcode == Opcode.IGET_OBJECT &&
getReference<FieldReference>()?.type == "Ljava/lang/String;"
}
val browseIdReference = getInstruction<ReferenceInstruction>(browseIdIndex).reference as FieldReference
val browseIdReference =
getInstruction<ReferenceInstruction>(browseIdIndex).reference as FieldReference
val fieldName = browseIdReference.name
val componentIndex = indexOfFirstInstructionOrThrow(stringIndex) {
opcode == Opcode.IGET_OBJECT &&
getReference<FieldReference>()?.toString() == browseIdReference.toString()
}
val browseIdRegister = getInstruction<TwoRegisterInstruction>(componentIndex).registerA
val componentRegister = getInstruction<TwoRegisterInstruction>(componentIndex).registerB
val browseIdRegister =
getInstruction<TwoRegisterInstruction>(componentIndex).registerA
val componentRegister =
getInstruction<TwoRegisterInstruction>(componentIndex).registerB
val enumIndex = it.patternMatch!!.startIndex + 3
val enumRegister = getInstruction<OneRegisterInstruction>(enumIndex).registerA

View File

@ -747,7 +747,8 @@ val playerComponentsPatch = bytecodePatch(
getInstruction<FiveRegisterInstruction>(bottomSheetBehaviorIndex).registerD
val getFieldIndex = bottomSheetBehaviorIndex - 2
val getFieldReference = getInstruction<ReferenceInstruction>(getFieldIndex).reference
val getFieldReference =
getInstruction<ReferenceInstruction>(getFieldIndex).reference
val getFieldInstruction = getInstruction<TwoRegisterInstruction>(getFieldIndex)
addInstructionsWithLabels(

View File

@ -22,7 +22,6 @@ import app.revanced.patches.music.utils.settings.ResourceUtils.updatePatchStatus
import app.revanced.patches.music.utils.settings.addPreferenceWithIntent
import app.revanced.patches.music.utils.settings.addSwitchPreference
import app.revanced.patches.music.utils.settings.settingsPatch
import app.revanced.patches.shared.spoof.blockrequest.blockRequestPatch
import app.revanced.patches.shared.createPlayerRequestBodyWithModelFingerprint
import app.revanced.patches.shared.customspeed.customPlaybackSpeedPatch
import app.revanced.patches.shared.extension.Constants.PATCHES_PATH
@ -31,6 +30,7 @@ import app.revanced.patches.shared.indexOfBrandInstruction
import app.revanced.patches.shared.indexOfManufacturerInstruction
import app.revanced.patches.shared.indexOfModelInstruction
import app.revanced.patches.shared.indexOfReleaseInstruction
import app.revanced.patches.shared.spoof.blockrequest.blockRequestPatch
import app.revanced.util.findMethodOrThrow
import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall
import app.revanced.util.fingerprint.matchOrThrow

View File

@ -142,7 +142,8 @@ internal val sharedResourceIdPatch = resourcePatch(
endButtonsContainer = getResourceId(ID, "end_buttons_container")
floatingLayout = getResourceId(ID, "floating_layout")
historyMenuItem = getResourceId(ID, "history_menu_item")
inlineTimeBarAdBreakMarkerColor = getResourceId(COLOR, "inline_time_bar_ad_break_marker_color")
inlineTimeBarAdBreakMarkerColor =
getResourceId(COLOR, "inline_time_bar_ad_break_marker_color")
inlineTimeBarProgressColor = getResourceId(COLOR, "inline_time_bar_progress_color")
interstitialsContainer = getResourceId(ID, "interstitials_container")
isTablet = getResourceId(BOOL, "is_tablet")
@ -156,7 +157,8 @@ internal val sharedResourceIdPatch = resourcePatch(
modernDialogBackground = getResourceId(DRAWABLE, "modern_dialog_background")
musicNotifierShelf = getResourceId(LAYOUT, "music_notifier_shelf")
musicTasteBuilderShelf = getResourceId(LAYOUT, "music_tastebuilder_shelf")
namesInactiveAccountThumbnailSize = getResourceId(DIMEN, "names_inactive_account_thumbnail_size")
namesInactiveAccountThumbnailSize =
getResourceId(DIMEN, "names_inactive_account_thumbnail_size")
offlineSettingsMenuItem = getResourceId(ID, "offline_settings_menu_item")
playerOverlayChip = getResourceId(ID, "player_overlay_chip")
playerViewPager = getResourceId(ID, "player_view_pager")

View File

@ -25,7 +25,8 @@ val videoTypeHookPatch = bytecodePatch(
videoTypeFingerprint.methodOrThrow(videoTypeParentFingerprint).apply {
val getEnumIndex = indexOfGetEnumInstruction(this)
val enumClass = (getInstruction<ReferenceInstruction>(getEnumIndex).reference as MethodReference).definingClass
val enumClass =
(getInstruction<ReferenceInstruction>(getEnumIndex).reference as MethodReference).definingClass
val referenceIndex = indexOfFirstInstructionOrThrow(getEnumIndex) {
opcode == Opcode.SGET_OBJECT &&
getReference<FieldReference>()?.type == enumClass

View File

@ -71,7 +71,8 @@ val playerResponseMethodHookPatch = bytecodePatch(
val beforeVideoIdHooks =
hooks.filterIsInstance<Hook.PlayerParameterBeforeVideoId>().asReversed()
val videoIdHooks = hooks.filterIsInstance<Hook.VideoId>().asReversed()
val videoIdAndPlaylistIdHooks = hooks.filterIsInstance<Hook.VideoIdAndPlaylistId>().asReversed()
val videoIdAndPlaylistIdHooks =
hooks.filterIsInstance<Hook.VideoIdAndPlaylistId>().asReversed()
val afterVideoIdHooks = hooks.filterIsInstance<Hook.PlayerParameter>().asReversed()
// Add the hooks in this specific order as they insert instructions at the beginning of the method.

View File

@ -56,7 +56,8 @@ val navigationButtonsPatch = bytecodePatch(
if (bottomNavScreenFingerprint.resolvable()) {
val bottomNavScreenMutableClass = with(bottomNavScreenFingerprint.methodOrThrow()) {
val startIndex = indexOfGetDimensionPixelSizeInstruction(this)
val targetIndex = indexOfFirstInstructionOrThrow(startIndex, Opcode.NEW_INSTANCE)
val targetIndex =
indexOfFirstInstructionOrThrow(startIndex, Opcode.NEW_INSTANCE)
val targetReference =
getInstruction<ReferenceInstruction>(targetIndex).reference.toString()
@ -65,7 +66,9 @@ val navigationButtonsPatch = bytecodePatch(
?: throw ClassNotFoundException("Failed to find class $targetReference")
}
bottomNavScreenOnGlobalLayoutFingerprint.second.matchOrNull(bottomNavScreenMutableClass)
bottomNavScreenOnGlobalLayoutFingerprint.second.matchOrNull(
bottomNavScreenMutableClass
)
?.let {
it.method.apply {
val startIndex = it.patternMatch!!.startIndex
@ -82,7 +85,8 @@ val navigationButtonsPatch = bytecodePatch(
// Legacy method.
bottomNavScreenHandlerFingerprint.methodOrThrow().apply {
val targetIndex = indexOfGetItemsInstruction(this) + 1
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
val targetRegister =
getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstructions(
targetIndex + 1, """

View File

@ -42,7 +42,8 @@ val subRedditDialogPatch = bytecodePatch(
.apply {
listOfIsLoggedInInstruction(this)
.forEach { index ->
val register = getInstruction<OneRegisterInstruction>(index + 1).registerA
val register =
getInstruction<OneRegisterInstruction>(index + 1).registerA
addInstructions(
index + 2, """

View File

@ -6,8 +6,6 @@ import app.revanced.util.indexOfFirstInstruction
import app.revanced.util.or
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.Method
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
import com.android.tools.smali.dexlib2.iface.reference.StringReference
import com.android.tools.smali.dexlib2.util.MethodUtil

View File

@ -1,6 +1,5 @@
package app.revanced.patches.shared.mapping
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.resourcePatch
import org.w3c.dom.Element

View File

@ -147,7 +147,8 @@ fun ResourcePatchContext.baseTranslationsPatch(
val length = text.length
if (!text.endsWith("DEFAULT") &&
length >= 2 &&
text.subSequence(length - 2, length) !in filteredAppLanguages) {
text.subSequence(length - 2, length) !in filteredAppLanguages
) {
nodesToRemove.add(item)
}
}

View File

@ -262,8 +262,10 @@ val feedComponentsPatch = bytecodePatch(
val insertIndex = indexOfBufferParserInstruction(this)
if (is_19_46_or_greater) {
val objectIndex = indexOfFirstInstructionReversedOrThrow(insertIndex, Opcode.IGET_OBJECT)
val objectRegister = getInstruction<TwoRegisterInstruction>(objectIndex).registerA
val objectIndex =
indexOfFirstInstructionReversedOrThrow(insertIndex, Opcode.IGET_OBJECT)
val objectRegister =
getInstruction<TwoRegisterInstruction>(objectIndex).registerA
addInstructionsWithLabels(
insertIndex, """
@ -275,7 +277,8 @@ val feedComponentsPatch = bytecodePatch(
)
} else {
val objectIndex = indexOfFirstInstructionOrThrow(Opcode.MOVE_OBJECT)
val objectRegister = getInstruction<TwoRegisterInstruction>(objectIndex).registerA
val objectRegister =
getInstruction<TwoRegisterInstruction>(objectIndex).registerA
val jumpIndex = it.patternMatch!!.startIndex
addInstructionsWithLabels(

View File

@ -90,7 +90,8 @@ val openChannelOfLiveAvatarPatch = bytecodePatch(
)
val playbackStartIndex = indexOfPlaybackStartDescriptorInstruction(this) + 1
val playbackStartRegister = getInstruction<OneRegisterInstruction>(playbackStartIndex).registerA
val playbackStartRegister =
getInstruction<OneRegisterInstruction>(playbackStartIndex).registerA
val mapIndex = indexOfFirstInstructionOrThrow(playbackStartIndex) {
val reference = getReference<MethodReference>()
@ -169,15 +170,24 @@ val openChannelOfLiveAvatarPatch = bytecodePatch(
val playbackStartIndex = indexOfFirstInstructionOrThrow {
getReference<MethodReference>()?.returnType == PLAYBACK_START_DESCRIPTOR_CLASS_DESCRIPTOR
}
val mapIndex = indexOfFirstInstructionReversedOrThrow(playbackStartIndex, Opcode.IPUT)
val mapIndex =
indexOfFirstInstructionReversedOrThrow(playbackStartIndex, Opcode.IPUT)
val mapRegister = getInstruction<TwoRegisterInstruction>(mapIndex).registerA
val playbackStartRegister = getInstruction<OneRegisterInstruction>(playbackStartIndex + 1).registerA
val videoIdRegister = getInstruction<FiveRegisterInstruction>(playbackStartIndex).registerC
val playbackStartRegister =
getInstruction<OneRegisterInstruction>(playbackStartIndex + 1).registerA
val videoIdRegister =
getInstruction<FiveRegisterInstruction>(playbackStartIndex).registerC
addInstructionsWithLabels(
playbackStartIndex + 2, """
move-object/from16 v$mapRegister, p2
${fetchChannelIdInstructions(playbackStartRegister, mapRegister, videoIdRegister)}
${
fetchChannelIdInstructions(
playbackStartRegister,
mapRegister,
videoIdRegister
)
}
"""
)
}

View File

@ -80,7 +80,8 @@ private val snackBarComponentsBytecodePatch = bytecodePatch(
bottomUiContainerThemeFingerprint.matchOrThrow().let {
it.method.apply {
val darkThemeIndex = it.patternMatch!!.startIndex + 2
val darkThemeReference = getInstruction<ReferenceInstruction>(darkThemeIndex).reference.toString()
val darkThemeReference =
getInstruction<ReferenceInstruction>(darkThemeIndex).reference.toString()
implementation!!.instructions
.withIndex()
@ -91,7 +92,8 @@ private val snackBarComponentsBytecodePatch = bytecodePatch(
.map { (index, _) -> index }
.reversed()
.forEach { index ->
val appThemeIndex = indexOfFirstInstructionReversedOrThrow(index, Opcode.MOVE_RESULT_OBJECT)
val appThemeIndex =
indexOfFirstInstructionReversedOrThrow(index, Opcode.MOVE_RESULT_OBJECT)
val appThemeRegister =
getInstruction<OneRegisterInstruction>(appThemeIndex).registerA
val darkThemeRegister =

View File

@ -86,7 +86,11 @@ val shortsActionButtonsPatch = resourcePatch(
// Some directory is missing in the bundles.
if (inputStreamForLegacy != null && fromFileResolved.exists()) {
Files.copy(inputStreamForLegacy, fromFileResolved.toPath(), StandardCopyOption.REPLACE_EXISTING)
Files.copy(
inputStreamForLegacy,
fromFileResolved.toPath(),
StandardCopyOption.REPLACE_EXISTING
)
}
if (is_19_36_or_greater) {
@ -95,7 +99,11 @@ val shortsActionButtonsPatch = resourcePatch(
// Some directory is missing in the bundles.
if (inputStreamForNew != null && toFileResolved.exists()) {
Files.copy(inputStreamForNew, toFileResolved.toPath(), StandardCopyOption.REPLACE_EXISTING)
Files.copy(
inputStreamForNew,
toFileResolved.toPath(),
StandardCopyOption.REPLACE_EXISTING
)
}
}
}

View File

@ -249,7 +249,10 @@ val customBrandingIconPatch = resourcePatch(
style.setAttribute("parent", nodeAttributeParent)
val splashScreenAnimatedIcon = document.createElement("item")
splashScreenAnimatedIcon.setAttribute("name", "android:windowSplashScreenAnimatedIcon")
splashScreenAnimatedIcon.setAttribute(
"name",
"android:windowSplashScreenAnimatedIcon"
)
splashScreenAnimatedIcon.textContent = "@drawable/avd_anim"
// Deprecated in Android 13+
@ -258,7 +261,8 @@ val customBrandingIconPatch = resourcePatch(
"name",
"android:windowSplashScreenAnimationDuration"
)
splashScreenAnimationDuration.textContent = if (appIcon.startsWith("revancify"))
splashScreenAnimationDuration.textContent =
if (appIcon.startsWith("revancify"))
"1500"
else
"1000"

View File

@ -61,8 +61,10 @@ val sharedThemePatch = resourcePatch(
0 -> when (nodeAttributeName) {
"Base.Theme.YouTube.Launcher.Dark",
"Base.Theme.YouTube.Launcher.Cairo.Dark" -> "@color/yt_black1"
"Base.Theme.YouTube.Launcher.Light",
"Base.Theme.YouTube.Launcher.Cairo.Light" -> "@color/yt_white1"
else -> "null"
}

View File

@ -32,8 +32,10 @@ val accessibilityPatch = bytecodePatch(
.methods
.first { method -> method.name == "<init>" }
.apply {
val lifecycleObserverIndex = indexOfFirstInstructionReversedOrThrow(Opcode.NEW_INSTANCE)
val lifecycleObserverClass = getInstruction<ReferenceInstruction>(lifecycleObserverIndex).reference.toString()
val lifecycleObserverIndex =
indexOfFirstInstructionReversedOrThrow(Opcode.NEW_INSTANCE)
val lifecycleObserverClass =
getInstruction<ReferenceInstruction>(lifecycleObserverIndex).reference.toString()
findMethodOrThrow(lifecycleObserverClass) {
accessFlags == AccessFlags.PUBLIC or AccessFlags.FINAL &&

View File

@ -85,10 +85,12 @@ val backgroundPlaybackPatch = bytecodePatch(
backgroundPlaybackManagerCairoFragmentPrimaryFingerprint,
backgroundPlaybackManagerCairoFragmentSecondaryFingerprint
).forEach { fingerprint ->
fingerprint.matchOrThrow(backgroundPlaybackManagerCairoFragmentParentFingerprint).let {
fingerprint.matchOrThrow(backgroundPlaybackManagerCairoFragmentParentFingerprint)
.let {
it.method.apply {
val insertIndex = it.patternMatch!!.startIndex + 4
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
val insertRegister =
getInstruction<OneRegisterInstruction>(insertIndex).registerA
addInstruction(
insertIndex,

View File

@ -62,11 +62,17 @@ val actionButtonsPatch = bytecodePatch(
indexOfFirstStringInstructionOrThrow(", identifierProperty=")
val identifierStringAppendIndex =
indexOfFirstInstructionOrThrow(identifierStringIndex, Opcode.INVOKE_VIRTUAL)
val identifierStringAppendIndexRegister = getInstruction<FiveRegisterInstruction>(identifierStringAppendIndex).registerD
val identifierStringAppendIndexRegister =
getInstruction<FiveRegisterInstruction>(identifierStringAppendIndex).registerD
val identifierAppendIndex =
indexOfFirstInstructionOrThrow(identifierStringAppendIndex + 1, Opcode.INVOKE_VIRTUAL)
val identifierRegister = getInstruction<FiveRegisterInstruction>(identifierAppendIndex).registerD
val identifierIndex = indexOfFirstInstructionReversedOrThrow(identifierAppendIndex) {
indexOfFirstInstructionOrThrow(
identifierStringAppendIndex + 1,
Opcode.INVOKE_VIRTUAL
)
val identifierRegister =
getInstruction<FiveRegisterInstruction>(identifierAppendIndex).registerD
val identifierIndex =
indexOfFirstInstructionReversedOrThrow(identifierAppendIndex) {
opcode == Opcode.IGET_OBJECT &&
getReference<FieldReference>()?.type == "Ljava/lang/String;" &&
(this as? TwoRegisterInstruction)?.registerA == identifierRegister

View File

@ -10,11 +10,11 @@ import app.revanced.patches.youtube.utils.resourceid.endScreenElementLayoutCircl
import app.revanced.patches.youtube.utils.resourceid.endScreenElementLayoutIcon
import app.revanced.patches.youtube.utils.resourceid.endScreenElementLayoutVideo
import app.revanced.patches.youtube.utils.resourceid.offlineActionsVideoDeletedUndoSnackbarText
import app.revanced.patches.youtube.utils.resourceid.verticalTouchOffsetToEnterFineScrubbing
import app.revanced.patches.youtube.utils.resourceid.seekEasyHorizontalTouchOffsetToStartScrubbing
import app.revanced.patches.youtube.utils.resourceid.suggestedAction
import app.revanced.patches.youtube.utils.resourceid.tapBloomView
import app.revanced.patches.youtube.utils.resourceid.touchArea
import app.revanced.patches.youtube.utils.resourceid.verticalTouchOffsetToEnterFineScrubbing
import app.revanced.patches.youtube.utils.resourceid.verticalTouchOffsetToStartFineScrubbing
import app.revanced.patches.youtube.utils.resourceid.videoZoomSnapIndicator
import app.revanced.util.fingerprint.legacyFingerprint

View File

@ -130,8 +130,10 @@ private val speedOverlayPatch = bytecodePatch(
// region patch for Custom speed overlay float value
val speedFieldReference = with(speedOverlayFloatValueFingerprint.methodOrThrow()) {
val literalIndex = indexOfFirstLiteralInstructionOrThrow(SPEED_OVERLAY_LEGACY_FEATURE_FLAG)
val floatIndex = indexOfFirstInstructionOrThrow(literalIndex, Opcode.DOUBLE_TO_FLOAT)
val literalIndex =
indexOfFirstLiteralInstructionOrThrow(SPEED_OVERLAY_LEGACY_FEATURE_FLAG)
val floatIndex =
indexOfFirstInstructionOrThrow(literalIndex, Opcode.DOUBLE_TO_FLOAT)
val floatRegister = getInstruction<TwoRegisterInstruction>(floatIndex).registerA
addInstructions(
@ -604,7 +606,9 @@ val playerComponentsPatch = bytecodePatch(
)
if (is_20_12_or_greater) {
filmStripOverlayMotionEventPrimaryFingerprint.matchOrThrow(filmStripOverlayStartParentFingerprint).let {
filmStripOverlayMotionEventPrimaryFingerprint.matchOrThrow(
filmStripOverlayStartParentFingerprint
).let {
it.method.apply {
val index = it.patternMatch!!.startIndex
val register = getInstruction<TwoRegisterInstruction>(index).registerA
@ -613,7 +617,9 @@ val playerComponentsPatch = bytecodePatch(
}
}
filmStripOverlayMotionEventSecondaryFingerprint.matchOrThrow(filmStripOverlayStartParentFingerprint).let {
filmStripOverlayMotionEventSecondaryFingerprint.matchOrThrow(
filmStripOverlayStartParentFingerprint
).let {
it.method.apply {
val index = it.patternMatch!!.startIndex + 2
val register = getInstruction<OneRegisterInstruction>(index).registerA

View File

@ -7,7 +7,6 @@ import app.revanced.patches.youtube.utils.resourceid.quickActionsElementContaine
import app.revanced.util.fingerprint.legacyFingerprint
import app.revanced.util.or
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.util.MethodUtil
internal val broadcastReceiverFingerprint = legacyFingerprint(
name = "broadcastReceiverFingerprint",

View File

@ -63,6 +63,7 @@ internal val miniplayerResponseModelSizeCheckFingerprint = legacyFingerprint(
// region modern miniplayer
internal const val MINIPLAYER_MODERN_FEATURE_KEY = 45622882L
// In later targets this feature flag does nothing and is dead code.
internal const val MINIPLAYER_MODERN_FEATURE_LEGACY_KEY = 45630429L
internal const val MINIPLAYER_DOUBLE_TAP_FEATURE_KEY = 45628823L

View File

@ -239,7 +239,8 @@ val miniplayerPatch = bytecodePatch(
val register = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstructions(
targetIndex + 1, """
targetIndex + 1,
"""
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getMiniplayerDefaultSize(I)I
move-result v$register
""",

View File

@ -256,7 +256,8 @@ val overlayButtonsPatch = resourcePatch(
width != "0.0dip",
)
val isButton = id.endsWith("_button") && id != "@id/multiview_button" || id == "@id/youtube_controls_fullscreen_button_stub"
val isButton =
id.endsWith("_button") && id != "@id/multiview_button" || id == "@id/youtube_controls_fullscreen_button_stub"
// Adjust TimeBar and Chapter bottom padding
val timBarItem = mutableMapOf(
@ -286,7 +287,10 @@ val overlayButtonsPatch = resourcePatch(
if (id.equals("@+id/bottom_margin")) {
node.setAttribute("android:layout_height", marginBottom)
} else if (id.equals("@id/time_bar_reference_view")) {
node.setAttribute("yt:layout_constraintBottom_toTopOf", "@id/quick_actions_container")
node.setAttribute(
"yt:layout_constraintBottom_toTopOf",
"@id/quick_actions_container"
)
}
}
}

View File

@ -14,7 +14,6 @@ import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.Method
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
import kotlin.collections.listOf
internal val shortsSeekbarColorFingerprint = legacyFingerprint(
name = "shortsSeekbarColorFingerprint",

View File

@ -139,7 +139,8 @@ val seekbarComponentsPatch = bytecodePatch(
reference?.returnType == "V" &&
reference.parameterTypes.isEmpty()
}
val thisInstanceRegister = getInstruction<FiveRegisterInstruction>(tapSeekIndex).registerC
val thisInstanceRegister =
getInstruction<FiveRegisterInstruction>(tapSeekIndex).registerC
val tapSeekClass = getInstruction(tapSeekIndex)
.getReference<MethodReference>()!!
@ -274,7 +275,10 @@ val seekbarComponentsPatch = bytecodePatch(
playerSeekbarHandleColorPrimaryFingerprint,
playerSeekbarHandleColorSecondaryFingerprint
).forEach {
it.methodOrThrow().addColorChangeInstructions(ytStaticBrandRed, "getVideoPlayerSeekbarColorAccent")
it.methodOrThrow().addColorChangeInstructions(
ytStaticBrandRed,
"getVideoPlayerSeekbarColorAccent"
)
}
// If hiding feed seekbar thumbnails, then turn off the cairo gradient
// of the watch history menu items as they use the same gradient as the

View File

@ -22,7 +22,6 @@ import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.Method
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
import kotlin.collections.listOf
internal val bottomSheetMenuDismissFingerprint = legacyFingerprint(
name = "bottomSheetMenuDismissFingerprint",

View File

@ -344,7 +344,11 @@ private val shortsCustomActionsPatch = bytecodePatch(
recyclerViewTreeObserverHook("$EXTENSION_CUSTOM_ACTIONS_CLASS_DESCRIPTOR->onFlyoutMenuCreate(Landroid/support/v7/widget/RecyclerView;)V")
} else {
// The type of the Shorts flyout menu is ListView.
val dismissReference = with (bottomSheetMenuDismissFingerprint.methodOrThrow(bottomSheetMenuListBuilderFingerprint)) {
val dismissReference = with(
bottomSheetMenuDismissFingerprint.methodOrThrow(
bottomSheetMenuListBuilderFingerprint
)
) {
val dismissIndex = indexOfDismissInstruction(this)
getInstruction<ReferenceInstruction>(dismissIndex).reference
}
@ -352,7 +356,8 @@ private val shortsCustomActionsPatch = bytecodePatch(
bottomSheetMenuItemClickFingerprint
.methodOrThrow(bottomSheetMenuListBuilderFingerprint)
.addInstructionsWithLabels(
0, """
0,
"""
invoke-static/range {p2 .. p2}, $EXTENSION_CUSTOM_ACTIONS_CLASS_DESCRIPTOR->onBottomSheetMenuItemClick(Landroid/view/View;)Z
move-result v0
if-eqz v0, :ignore
@ -510,7 +515,11 @@ private val shortsRepeatPatch = bytecodePatch(
// Manually add the 'Autoplay' code that Google removed.
// Tested on YouTube 20.10.
if (is_20_09_or_greater) {
val (directReference, virtualReference) = with (reelPlaybackFingerprint.methodOrThrow(videoIdFingerprintShorts)) {
val (directReference, virtualReference) = with(
reelPlaybackFingerprint.methodOrThrow(
videoIdFingerprintShorts
)
) {
val directIndex = indexOfInitializationInstruction(this)
val virtualIndex = indexOfFirstInstructionOrThrow(directIndex) {
opcode == Opcode.INVOKE_VIRTUAL &&
@ -528,7 +537,8 @@ private val shortsRepeatPatch = bytecodePatch(
opcode == Opcode.INVOKE_STATIC &&
getReference<MethodReference>()?.definingClass == EXTENSION_REPEAT_STATE_CLASS_DESCRIPTOR
}
val enumRegister = getInstruction<OneRegisterInstruction>(extensionIndex + 1).registerA
val enumRegister =
getInstruction<OneRegisterInstruction>(extensionIndex + 1).registerA
val freeIndex = indexOfFirstInstructionOrThrow(extensionIndex) {
opcode == Opcode.SGET_OBJECT &&
getReference<FieldReference>()?.name != "a"
@ -1014,7 +1024,8 @@ val shortsComponentPatch = bytecodePatch(
getReference<MethodReference>()?.returnType == PLAYBACK_START_DESCRIPTOR_CLASS_DESCRIPTOR
}
val freeRegister = getInstruction<FiveRegisterInstruction>(index).registerC
val playbackStartRegister = getInstruction<OneRegisterInstruction>(index + 1).registerA
val playbackStartRegister =
getInstruction<OneRegisterInstruction>(index + 1).registerA
addInstructionsWithLabels(
index + 2,

View File

@ -1,10 +1,10 @@
package app.revanced.patches.youtube.utils.fix.cairo
import app.revanced.patches.youtube.utils.resourceid.settingsFragment
import app.revanced.patches.youtube.utils.resourceid.settingsFragmentCairo
import app.revanced.util.fingerprint.legacyFingerprint
import app.revanced.util.or
import com.android.tools.smali.dexlib2.AccessFlags
import app.revanced.patches.youtube.utils.resourceid.settingsFragment
import app.revanced.patches.youtube.utils.resourceid.settingsFragmentCairo
import com.android.tools.smali.dexlib2.Opcode
/**

View File

@ -22,7 +22,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
import com.android.tools.smali.dexlib2.iface.reference.TypeReference
import kotlin.collections.mutableListOf
private const val EXTENSION_VIDEO_UTILS_CLASS_DESCRIPTOR =
"$EXTENSION_PATH/utils/VideoUtils;"
@ -59,7 +58,10 @@ val fullscreenButtonHookPatch = bytecodePatch(
getReference<MethodReference>()?.name == "addListener"
}
val animatorListenerAdapterClass = getInstruction<ReferenceInstruction>(
indexOfFirstInstructionReversedOrThrow(addListenerIndex, Opcode.NEW_INSTANCE)
indexOfFirstInstructionReversedOrThrow(
addListenerIndex,
Opcode.NEW_INSTANCE
)
).reference.toString()
return Pair(
findMethodOrThrow(animatorListenerAdapterClass) { parameters.isEmpty() },

View File

@ -67,14 +67,16 @@ val playlistPatch = bytecodePatch(
.let {
it.method.apply {
val castIndex = it.patternMatch!!.startIndex
val castClass = getInstruction<ReferenceInstruction>(castIndex).reference.toString()
val castClass =
getInstruction<ReferenceInstruction>(castIndex).reference.toString()
if (castClass != setVideoIdReference.definingClass) {
throw PatchException("Method signature parameter did not match: $castClass")
}
val castRegister = getInstruction<OneRegisterInstruction>(castIndex).registerA
val insertIndex = castIndex + 1
val insertRegister = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
val insertRegister =
getInstruction<TwoRegisterInstruction>(insertIndex).registerA
addInstructions(
insertIndex, """

View File

@ -316,9 +316,11 @@ internal val sharedResourceIdPatch = resourcePatch(
fullScreenEngagementPanel = getResourceId(ID, "fullscreen_engagement_panel_holder")
horizontalCardList = getResourceId(LAYOUT, "horizontal_card_list")
imageOnlyTab = getResourceId(LAYOUT, "image_only_tab")
inlineTimeBarColorizedBarPlayedColorDark = getResourceId(COLOR, "inline_time_bar_colorized_bar_played_color_dark")
inlineTimeBarColorizedBarPlayedColorDark =
getResourceId(COLOR, "inline_time_bar_colorized_bar_played_color_dark")
inlineTimeBarLiveSeekAbleRange = getResourceId(COLOR, "inline_time_bar_live_seekable_range")
inlineTimeBarPlayedNotHighlightedColor = getResourceId(COLOR, "inline_time_bar_played_not_highlighted_color")
inlineTimeBarPlayedNotHighlightedColor =
getResourceId(COLOR, "inline_time_bar_played_not_highlighted_color")
insetOverlayViewLayout = getResourceId(ID, "inset_overlay_view_layout")
interstitialsContainer = getResourceId(ID, "interstitials_container")
insetElementsWrapper = getResourceId(LAYOUT, "inset_elements_wrapper")
@ -328,14 +330,19 @@ internal val sharedResourceIdPatch = resourcePatch(
modernMiniPlayerClose = getResourceId(ID, "modern_miniplayer_close")
modernMiniPlayerExpand = getResourceId(ID, "modern_miniplayer_expand")
modernMiniPlayerForwardButton = getResourceId(ID, "modern_miniplayer_forward_button")
modernMiniPlayerOverlayActionButton = getResourceId(ID, "modern_miniplayer_overlay_action_button")
modernMiniPlayerOverlayActionButton =
getResourceId(ID, "modern_miniplayer_overlay_action_button")
modernMiniPlayerRewindButton = getResourceId(ID, "modern_miniplayer_rewind_button")
musicAppDeeplinkButtonView = getResourceId(ID, "music_app_deeplink_button_view")
notificationBigPictureIconWidth = getResourceId(DIMEN, "notification_big_picture_icon_width")
offlineActionsVideoDeletedUndoSnackbarText = getResourceId(STRING, "offline_actions_video_deleted_undo_snackbar_text")
notificationBigPictureIconWidth =
getResourceId(DIMEN, "notification_big_picture_icon_width")
offlineActionsVideoDeletedUndoSnackbarText =
getResourceId(STRING, "offline_actions_video_deleted_undo_snackbar_text")
playerCollapseButton = getResourceId(ID, "player_collapse_button")
playerControlPreviousButtonTouchArea = getResourceId(ID, "player_control_previous_button_touch_area")
playerControlNextButtonTouchArea = getResourceId(ID, "player_control_next_button_touch_area")
playerControlPreviousButtonTouchArea =
getResourceId(ID, "player_control_previous_button_touch_area")
playerControlNextButtonTouchArea =
getResourceId(ID, "player_control_next_button_touch_area")
playerVideoTitleView = getResourceId(ID, "player_video_title_view")
posterArtWidthDefault = getResourceId(DIMEN, "poster_art_width_default")
qualityAuto = getResourceId(STRING, "quality_auto")
@ -356,7 +363,8 @@ internal val sharedResourceIdPatch = resourcePatch(
relatedChipCloudMargin = getResourceId(LAYOUT, "related_chip_cloud_reduced_margins")
rightComment = getResourceId(DRAWABLE, "ic_right_comment_32c")
scrimOverlay = getResourceId(ID, "scrim_overlay")
seekEasyHorizontalTouchOffsetToStartScrubbing = getResourceId(DIMEN, "seek_easy_horizontal_touch_offset_to_start_scrubbing")
seekEasyHorizontalTouchOffsetToStartScrubbing =
getResourceId(DIMEN, "seek_easy_horizontal_touch_offset_to_start_scrubbing")
seekUndoEduOverlayStub = getResourceId(ID, "seek_undo_edu_overlay_stub")
settingsFragment = getResourceId(XML, "settings_fragment")
settingsFragmentCairo = getResourceId(XML, "settings_fragment_cairo")
@ -369,20 +377,26 @@ internal val sharedResourceIdPatch = resourcePatch(
toolTipContentView = getResourceId(LAYOUT, "tooltip_content_view")
totalTime = getResourceId(STRING, "total_time")
touchArea = getResourceId(ID, "touch_area")
videoQualityBottomSheet = getResourceId(LAYOUT, "video_quality_bottom_sheet_list_fragment_title")
videoQualityBottomSheet =
getResourceId(LAYOUT, "video_quality_bottom_sheet_list_fragment_title")
varispeedUnavailableTitle = getResourceId(STRING, "varispeed_unavailable_title")
verticalTouchOffsetToEnterFineScrubbing = getResourceId(DIMEN, "vertical_touch_offset_to_enter_fine_scrubbing")
verticalTouchOffsetToStartFineScrubbing = getResourceId(DIMEN, "vertical_touch_offset_to_start_fine_scrubbing")
videoQualityUnavailableAnnouncement = getResourceId(STRING, "video_quality_unavailable_announcement")
verticalTouchOffsetToEnterFineScrubbing =
getResourceId(DIMEN, "vertical_touch_offset_to_enter_fine_scrubbing")
verticalTouchOffsetToStartFineScrubbing =
getResourceId(DIMEN, "vertical_touch_offset_to_start_fine_scrubbing")
videoQualityUnavailableAnnouncement =
getResourceId(STRING, "video_quality_unavailable_announcement")
videoZoomSnapIndicator = getResourceId(ID, "video_zoom_snap_indicator")
voiceSearch = getResourceId(ID, "voice_search")
youTubeControlsOverlaySubtitleButton = getResourceId(LAYOUT, "youtube_controls_overlay_subtitle_button")
youTubeControlsOverlaySubtitleButton =
getResourceId(LAYOUT, "youtube_controls_overlay_subtitle_button")
youTubeLogo = getResourceId(ID, "youtube_logo")
ytCallToAction = getResourceId(ATTR, "ytCallToAction")
ytFillBell = getResourceId(DRAWABLE, "yt_fill_bell_black_24")
ytOutlineLibrary = getResourceId(DRAWABLE, "yt_outline_library_black_24")
ytOutlineMoonZ = getResourceId(DRAWABLE, "yt_outline_moon_z_vd_theme_24")
ytOutlinePictureInPictureWhite = getResourceId(DRAWABLE, "yt_outline_picture_in_picture_white_24")
ytOutlinePictureInPictureWhite =
getResourceId(DRAWABLE, "yt_outline_picture_in_picture_white_24")
ytOutlineVideoCamera = getResourceId(DRAWABLE, "yt_outline_video_camera_black_24")
ytOutlineXWhite = getResourceId(DRAWABLE, "yt_outline_x_white_24")
ytPremiumWordMarkHeader = getResourceId(ATTR, "ytPremiumWordmarkHeader")

View File

@ -162,13 +162,15 @@ val videoPlaybackPatch = bytecodePatch(
loadVideoParamsFingerprint.matchOrThrow(loadVideoParamsParentFingerprint).let {
it.method.apply {
val targetIndex = it.patternMatch!!.endIndex
val targetReference = getInstruction<ReferenceInstruction>(targetIndex).reference as MethodReference
val targetReference =
getInstruction<ReferenceInstruction>(targetIndex).reference as MethodReference
findMethodOrThrow(definingClass) {
name == targetReference.name
}.apply {
val insertIndex = implementation!!.instructions.lastIndex
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
val insertRegister =
getInstruction<OneRegisterInstruction>(insertIndex).registerA
addInstructions(
insertIndex, """

View File

@ -26,7 +26,8 @@ val playbackStartDescriptorPatch = bytecodePatch(
&& reference.returnType == "Ljava/lang/String;"
}
playbackStartVideoIdReference = getInstruction<ReferenceInstruction>(stringMethodIndex).reference
playbackStartVideoIdReference =
getInstruction<ReferenceInstruction>(stringMethodIndex).reference
}
}
}

View File

@ -39,7 +39,8 @@ val playerResponseMethodHookPatch = bytecodePatch(
playerResponseMethod.apply {
val setIndex = parameterTypes.indexOfFirst { it == "Ljava/util/Set;" }
val parameterSize = parameterTypes.size
val relativeIndex = parameterTypes.subList(setIndex, parameterSize - 1).indexOfFirst { it == "Z" }
val relativeIndex =
parameterTypes.subList(setIndex, parameterSize - 1).indexOfFirst { it == "Z" }
// YouTube 18.29 ~ 19.22 : p11
// YouTube 19.23 ~ 20.09 : p12