diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt index b0021b966..2128722e7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt @@ -3,6 +3,7 @@ package app.revanced.patches.music.layout.compactheader import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.bytecodePatch +import app.revanced.util.findFreeRegister import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Suppress("unused") @@ -17,13 +18,14 @@ val hideCategoryBar = bytecodePatch( constructCategoryBarFingerprint.method.apply { val insertIndex = constructCategoryBarFingerprint.patternMatch!!.startIndex val register = getInstruction(insertIndex - 1).registerA + val freeRegister = findFreeRegister(insertIndex, register) addInstructions( insertIndex, """ - const/16 v2, 0x8 - invoke-virtual {v$register, v2}, Landroid/view/View;->setVisibility(I)V - """, + const/16 v$freeRegister, 0x8 + invoke-virtual { v$register, v$freeRegister }, Landroid/view/View;->setVisibility(I)V + """ ) } }