From b3fead748c5837672db56d95227e2dd08ccb9123 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 24 Feb 2026 00:00:12 +0100 Subject: [PATCH] fix hook --- .../revanced/patches/spotify/misc/extension/Hooks.kt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/extension/Hooks.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/extension/Hooks.kt index 2fdd95ecdd..fa50e800e5 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/extension/Hooks.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/extension/Hooks.kt @@ -3,6 +3,7 @@ package app.revanced.patches.spotify.misc.extension import app.revanced.patcher.definingClass import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.extensions.instructions +import app.revanced.patcher.extensions.string import app.revanced.patcher.instructions import app.revanced.patcher.invoke import app.revanced.patcher.name @@ -24,16 +25,9 @@ private var contextReferenceIndex = -1 internal val loadOrbitLibraryHook = extensionHook( getInsertIndex = { - // Find the last orbit_library_load string usage - var lastIndex = -1 - instructions.forEachIndexed { index, instruction -> - instruction.toString().let { - if (it.contains("orbit_library_load") || it.contains("orbit-jni-spotify")) { - lastIndex = index - } - } + indexOfFirstInstruction { + "orbit-jni-spotify" in (string ?: return@indexOfFirstInstruction false) } - lastIndex }, getContextRegister = { contextReferenceIndex = indexOfFirstInstruction {