fix(sponsorblock): skip button in wrong location when fullscreen and comments visible

This commit is contained in:
inotia00 2023-05-03 23:39:46 +09:00
parent ca02b06a21
commit 373c1d7b7e

View File

@ -25,7 +25,7 @@ class SponsorBlockSecondaryBytecodePatch : BytecodePatch() {
// list of resource names to get the id of // list of resource names to get the id of
private val resourceIds = arrayOf( private val resourceIds = arrayOf(
"string" to "total_time", "string" to "total_time",
"layout" to "player_overlays" "id" to "inset_overlay_view_layout"
).map { (type, name) -> ).map { (type, name) ->
ResourceMappingPatch ResourceMappingPatch
.resourceMappings .resourceMappings
@ -58,15 +58,16 @@ class SponsorBlockSecondaryBytecodePatch : BytecodePatch() {
} }
resourceIds[1] -> { // player overlay resourceIds[1] -> { // player overlay
val insertIndex = index + 4 val insertIndex = index + 3
val invokeInstruction = instructions.elementAt(insertIndex) val invokeInstruction = instructions.elementAt(insertIndex)
if (invokeInstruction.opcode != Opcode.CHECK_CAST) return@forEachIndexed if (invokeInstruction.opcode != Opcode.CHECK_CAST) return@forEachIndexed
val targetRegister = (invokeInstruction as OneRegisterInstruction).registerA
val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method) val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method)
mutableMethod.addInstruction( mutableMethod.addInstruction(
insertIndex, insertIndex + 1,
"invoke-static {p0}, Lapp/revanced/integrations/sponsorblock/ui/SponsorBlockViewController;->initialize(Ljava/lang/Object;)V" "invoke-static {v$targetRegister}, Lapp/revanced/integrations/sponsorblock/ui/SponsorBlockViewController;->initialize(Landroid/view/ViewGroup;)V"
) )
patchSuccessArray[1] = true patchSuccessArray[1] = true