From 066a9f8c52ae4b369c9b87445a95337a6d9445ad Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Tue, 19 Dec 2023 17:50:50 +0900 Subject: [PATCH] fix: error toast is shown when not connected to the network or playing a device file --- .../music/video/videoid/VideoIdPatch.kt | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) 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(