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