From 373c1d7b7e88ce96c5d0ae8021969b0ae08bef36 Mon Sep 17 00:00:00 2001 From: inotia00 Date: Wed, 3 May 2023 23:39:46 +0900 Subject: [PATCH] fix(sponsorblock): skip button in wrong location when fullscreen and comments visible --- .../bytecode/patch/SponsorBlockSecondaryBytecodePatch.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockSecondaryBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockSecondaryBytecodePatch.kt index 895150b82..b119fc558 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockSecondaryBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockSecondaryBytecodePatch.kt @@ -25,7 +25,7 @@ class SponsorBlockSecondaryBytecodePatch : BytecodePatch() { // list of resource names to get the id of private val resourceIds = arrayOf( "string" to "total_time", - "layout" to "player_overlays" + "id" to "inset_overlay_view_layout" ).map { (type, name) -> ResourceMappingPatch .resourceMappings @@ -58,15 +58,16 @@ class SponsorBlockSecondaryBytecodePatch : BytecodePatch() { } resourceIds[1] -> { // player overlay - val insertIndex = index + 4 + val insertIndex = index + 3 val invokeInstruction = instructions.elementAt(insertIndex) if (invokeInstruction.opcode != Opcode.CHECK_CAST) return@forEachIndexed + val targetRegister = (invokeInstruction as OneRegisterInstruction).registerA val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method) mutableMethod.addInstruction( - insertIndex, - "invoke-static {p0}, Lapp/revanced/integrations/sponsorblock/ui/SponsorBlockViewController;->initialize(Ljava/lang/Object;)V" + insertIndex + 1, + "invoke-static {v$targetRegister}, Lapp/revanced/integrations/sponsorblock/ui/SponsorBlockViewController;->initialize(Landroid/view/ViewGroup;)V" ) patchSuccessArray[1] = true