mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-28 04:40:19 +02:00
fix(youtube/sponsorblock): patch fails when hide-seekbar
patch is excluded
This commit is contained in:
parent
ded6ba383a
commit
4179e8dadc
@ -89,7 +89,8 @@ class PlayerControlsPatch : BytecodePatch(
|
||||
context,
|
||||
classDef
|
||||
)
|
||||
}.result?.mutableMethod ?: return PlayerControlsVisibilityFingerprint.toErrorResult()
|
||||
}.result?.mutableMethod
|
||||
?: return PlayerControlsVisibilityFingerprint.toErrorResult()
|
||||
} ?: return YouTubeControlsOverlayFingerprint.toErrorResult()
|
||||
|
||||
controlsLayoutInflateResult =
|
||||
@ -102,7 +103,8 @@ class PlayerControlsPatch : BytecodePatch(
|
||||
|
||||
FullscreenEngagementSpeedEduVisibleParentFingerprint.result?.let { parentResult ->
|
||||
parentResult.mutableMethod.apply {
|
||||
fullscreenEngagementViewVisibleReference = findReference(", isFullscreenEngagementViewVisible=")
|
||||
fullscreenEngagementViewVisibleReference =
|
||||
findReference(", isFullscreenEngagementViewVisible=")
|
||||
speedEDUVisibleReference = findReference(", isSpeedmasterEDUVisible=")
|
||||
}
|
||||
|
||||
@ -112,7 +114,8 @@ class PlayerControlsPatch : BytecodePatch(
|
||||
context,
|
||||
parentResult.classDef
|
||||
)
|
||||
}.result?.mutableMethod?: return FullscreenEngagementSpeedEduVisibleFingerprint.toErrorResult()
|
||||
}.result?.mutableMethod
|
||||
?: return FullscreenEngagementSpeedEduVisibleFingerprint.toErrorResult()
|
||||
} ?: return FullscreenEngagementSpeedEduVisibleParentFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
@ -145,7 +148,7 @@ class PlayerControlsPatch : BytecodePatch(
|
||||
index,
|
||||
"invoke-static {v$register}, $descriptor->changeVisibilityNegatedImmediate(Z)V"
|
||||
)
|
||||
break;
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -175,15 +178,27 @@ class PlayerControlsPatch : BytecodePatch(
|
||||
}
|
||||
|
||||
fun injectVisibility(descriptor: String) {
|
||||
playerControlsVisibilityMutableMethod.injectVisibilityCall(descriptor, "changeVisibility")
|
||||
playerControlsVisibilityMutableMethod.injectVisibilityCall(
|
||||
descriptor,
|
||||
"changeVisibility"
|
||||
)
|
||||
seekEDUVisibleMutableMethod.injectVisibilityCall(
|
||||
descriptor,
|
||||
"changeVisibilityNegatedImmediate"
|
||||
)
|
||||
userScrubbingMutableMethod.injectVisibilityCall(descriptor, "changeVisibilityNegatedImmediate")
|
||||
userScrubbingMutableMethod.injectVisibilityCall(
|
||||
descriptor,
|
||||
"changeVisibilityNegatedImmediate"
|
||||
)
|
||||
|
||||
injectFullscreenEngagementSpeedEduViewVisibilityCall(fullscreenEngagementViewVisibleReference, descriptor)
|
||||
injectFullscreenEngagementSpeedEduViewVisibilityCall(speedEDUVisibleReference, descriptor)
|
||||
injectFullscreenEngagementSpeedEduViewVisibilityCall(
|
||||
fullscreenEngagementViewVisibleReference,
|
||||
descriptor
|
||||
)
|
||||
injectFullscreenEngagementSpeedEduViewVisibilityCall(
|
||||
speedEDUVisibleReference,
|
||||
descriptor
|
||||
)
|
||||
}
|
||||
|
||||
fun initializeSB(descriptor: String) {
|
||||
|
@ -8,6 +8,8 @@ object PlayerControllerFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
parameters = listOf("Ljava/lang/Object;"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.definingClass == "Lapp/revanced/integrations/sponsorblock/SegmentPlaybackController;"
|
||||
&& methodDef.name == "setSponsorBarRect" }
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass == "Lapp/revanced/integrations/sponsorblock/SegmentPlaybackController;"
|
||||
&& methodDef.name == "setSponsorBarRect"
|
||||
}
|
||||
)
|
||||
|
@ -56,6 +56,7 @@ import org.jf.dexlib2.iface.reference.MethodReference
|
||||
class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
listOf(
|
||||
PlayerControllerFingerprint,
|
||||
SeekbarFingerprint,
|
||||
TotalTimeFingerprint,
|
||||
YouTubeControlsOverlayFingerprint
|
||||
)
|
||||
@ -80,10 +81,16 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
/**
|
||||
* Seekbar drawing
|
||||
*/
|
||||
insertMethod = SeekbarFingerprint.result!!.let {
|
||||
SeekbarOnDrawFingerprint.apply { resolve(context, it.mutableClass) }
|
||||
}.result?.mutableMethod ?: return SeekbarFingerprint.toErrorResult()
|
||||
insertInstructions = insertMethod.implementation!!.instructions
|
||||
SeekbarFingerprint.result?.mutableClass?.let { mutableClass ->
|
||||
insertMethod = SeekbarOnDrawFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
mutableClass
|
||||
)
|
||||
}.result?.mutableMethod
|
||||
?: return SeekbarOnDrawFingerprint.toErrorResult()
|
||||
insertInstructions = insertMethod.implementation!!.instructions
|
||||
} ?: return SeekbarFingerprint.toErrorResult()
|
||||
|
||||
|
||||
/**
|
||||
@ -115,6 +122,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw segment
|
||||
*/
|
||||
@ -138,6 +146,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Voting & Shield button
|
||||
*/
|
||||
@ -146,6 +155,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
PlayerControlsPatch.injectVisibility("$INTEGRATIONS_BUTTON_CLASS_DESCRIPTOR/ui/$it;")
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Append the new time to the player layout
|
||||
*/
|
||||
@ -163,6 +173,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
}
|
||||
} ?: return TotalTimeFingerprint.toErrorResult()
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the SponsorBlock view
|
||||
*/
|
||||
@ -178,34 +189,42 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
}
|
||||
} ?: return YouTubeControlsOverlayFingerprint.toErrorResult()
|
||||
|
||||
|
||||
/**
|
||||
* Replace strings
|
||||
*/
|
||||
RectangleFieldInvalidatorFingerprint.resolve(
|
||||
context,
|
||||
SeekbarOnDrawFingerprint.result!!.classDef
|
||||
)
|
||||
val rectangleFieldInvalidatorInstructions =
|
||||
RectangleFieldInvalidatorFingerprint.result!!.method.implementation!!.instructions
|
||||
val rectangleFieldName =
|
||||
((rectangleFieldInvalidatorInstructions.elementAt(rectangleFieldInvalidatorInstructions.count() - 3) as ReferenceInstruction).reference as FieldReference).name
|
||||
SeekbarFingerprint.result?.mutableClass?.let { mutableClass ->
|
||||
RectangleFieldInvalidatorFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
mutableClass
|
||||
)
|
||||
}.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val rectangleReference =
|
||||
getInstruction<ReferenceInstruction>(implementation!!.instructions.count() - 3).reference
|
||||
val rectangleFieldName = (rectangleReference as FieldReference).name
|
||||
|
||||
PlayerControllerFingerprint.result?.let { result ->
|
||||
result.mutableMethod.apply {
|
||||
for ((index, instruction) in implementation!!.instructions.withIndex()) {
|
||||
if (instruction.opcode != Opcode.CONST_STRING) continue
|
||||
|
||||
PlayerControllerFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
for ((index, instruction) in implementation!!.instructions.withIndex()) {
|
||||
if (instruction.opcode != Opcode.CONST_STRING) continue
|
||||
val register =
|
||||
getInstruction<OneRegisterInstruction>(index).registerA
|
||||
|
||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
|
||||
replaceInstruction(
|
||||
index,
|
||||
"const-string v$register, \"$rectangleFieldName\""
|
||||
)
|
||||
break
|
||||
replaceInstruction(
|
||||
index,
|
||||
"const-string v$register, \"$rectangleFieldName\""
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
} ?: return PlayerControllerFingerprint.toErrorResult()
|
||||
}
|
||||
}
|
||||
} ?: return PlayerControllerFingerprint.toErrorResult()
|
||||
} ?: return RectangleFieldInvalidatorFingerprint.toErrorResult()
|
||||
} ?: return SeekbarFingerprint.toErrorResult()
|
||||
|
||||
|
||||
/**
|
||||
* Inject VideoIdPatch
|
||||
|
Loading…
x
Reference in New Issue
Block a user