feat(YouTube - Playback Speed): Use modern custom speed dialog (#5069)

Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com>
This commit is contained in:
MarcaD 2025-06-01 12:12:56 +03:00 committed by GitHub
parent 5bf5a2d2db
commit a320e35c32
17 changed files with 697 additions and 209 deletions

View file

@ -10,6 +10,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.misc.mapping.get
@ -31,6 +32,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.ThreeRegisterInstructio
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.WideLiteralInstruction
import com.android.tools.smali.dexlib2.iface.reference.Reference
import com.android.tools.smali.dexlib2.immutable.ImmutableField
import com.android.tools.smali.dexlib2.util.MethodUtil
import java.util.EnumSet
@ -962,6 +964,43 @@ private fun MutableMethod.overrideReturnValue(value: String, returnLate: Boolean
}
}
internal fun BytecodePatchContext.addStaticFieldToExtension(
className: String,
methodName: String,
fieldName: String,
objectClass: String,
smaliInstructions: String
) {
val classDef = classes.find { classDef -> classDef.type == className }
?: throw PatchException("No matching methods found in: $className")
val mutableClass = proxy(classDef).mutableClass
val objectCall = "$mutableClass->$fieldName:$objectClass"
mutableClass.apply {
methods.first { method -> method.name == methodName }.apply {
staticFields.add(
ImmutableField(
definingClass,
fieldName,
objectClass,
AccessFlags.PUBLIC.value or AccessFlags.STATIC.value,
null,
annotations,
null
).toMutable()
)
addInstructionsWithLabels(
0,
"""
sget-object v0, $objectCall
""" + smaliInstructions
)
}
}
}
/**
* Set the custom condition for this fingerprint to check for a literal value.
*