diff --git a/src/main/kotlin/app/revanced/patches/music/video/videoid/VideoIdPatch.kt b/src/main/kotlin/app/revanced/patches/music/video/videoid/VideoIdPatch.kt index 4c801d1e8..fc1e377b0 100644 --- a/src/main/kotlin/app/revanced/patches/music/video/videoid/VideoIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/video/videoid/VideoIdPatch.kt @@ -2,11 +2,9 @@ package app.revanced.patches.music.video.videoid import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction -import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod -import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.music.video.videoid.fingerprints.PlayerResponseModelStoryboardRendererFingerprint import app.revanced.patches.music.video.videoid.fingerprints.VideoIdParentFingerprint import app.revanced.util.exception @@ -15,14 +13,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.reference.FieldReference import com.android.tools.smali.dexlib2.iface.reference.MethodReference -import java.io.Closeable object VideoIdPatch : BytecodePatch( setOf( PlayerResponseModelStoryboardRendererFingerprint, VideoIdParentFingerprint ) -), Closeable { +) { private var videoIdRegister = 0 private var videoIdInsertIndex = 0 private lateinit var videoIdMethod: MutableMethod @@ -64,22 +61,6 @@ object VideoIdPatch : BytecodePatch( } ?: throw PlayerResponseModelStoryboardRendererFingerprint.exception } - override fun close() { - backgroundPlaybackMethod.apply { - val insertIndex = implementation!!.instructions.indexOfLast { instruction -> - instruction.opcode == Opcode.IGET_OBJECT - } + 1 - - if (insertIndex != backgroundPlaybackInsertIndex) { - addInstructionsWithLabels( - insertIndex, """ - if-eqz v$backgroundPlaybackVideoIdRegister, :ignore - """, ExternalLabel("ignore", getInstruction(backgroundPlaybackInsertIndex)) - ) - } - } - } - fun hookVideoId( methodDescriptor: String ) = videoIdMethod.addInstruction(