mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-29 05:10:20 +02:00
fix(music/hide-upgrade-button): not compatible with latest version
This commit is contained in:
parent
b1adb5f584
commit
4eec203126
@ -1,21 +0,0 @@
|
|||||||
package app.revanced.patches.music.misc.upgradebutton.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import app.revanced.util.bytecode.isNarrowLiteralExists
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
|
|
||||||
object PivotBarConstructorFingerprint : MethodFingerprint(
|
|
||||||
returnType = "V",
|
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
|
||||||
opcodes = listOf(
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.RETURN_VOID
|
|
||||||
),
|
|
||||||
customFingerprint = { methodDef, _ ->
|
|
||||||
methodDef.name == "<init>" && methodDef.isNarrowLiteralExists(
|
|
||||||
117501096
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.music.misc.upgradebutton.fingerprints
|
package app.revanced.patches.music.navigation.upgrade.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.music.misc.upgradebutton.patch
|
package app.revanced.patches.music.navigation.upgrade.patch
|
||||||
|
|
||||||
import app.revanced.extensions.exception
|
import app.revanced.extensions.exception
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
@ -7,18 +7,20 @@ import app.revanced.patcher.data.BytecodeContext
|
|||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.music.misc.upgradebutton.fingerprints.NotifierShelfFingerprint
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.music.misc.upgradebutton.fingerprints.PivotBarConstructorFingerprint
|
import app.revanced.patches.music.navigation.upgrade.fingerprints.NotifierShelfFingerprint
|
||||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||||
|
import app.revanced.patches.music.utils.fingerprints.TabLayoutTextFingerprint
|
||||||
import app.revanced.patches.music.utils.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.music.utils.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||||
|
import app.revanced.util.integrations.Constants.MUSIC_NAVIGATION
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
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.instruction.formats.Instruction35c
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("Hide upgrade button")
|
@Name("Hide upgrade button")
|
||||||
@ -32,36 +34,36 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
|||||||
@MusicCompatibility
|
@MusicCompatibility
|
||||||
class UpgradeButtonPatch : BytecodePatch(
|
class UpgradeButtonPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
PivotBarConstructorFingerprint,
|
NotifierShelfFingerprint,
|
||||||
NotifierShelfFingerprint
|
TabLayoutTextFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
PivotBarConstructorFingerprint.result?.let {
|
TabLayoutTextFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex
|
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 3
|
||||||
val targetRegisterA = getInstruction<TwoRegisterInstruction>(targetIndex).registerA
|
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
val targetRegisterB = getInstruction<TwoRegisterInstruction>(targetIndex).registerB
|
|
||||||
|
|
||||||
val replaceReference =
|
val insertIndex = implementation!!.instructions.indexOfFirst { instruction ->
|
||||||
getInstruction<ReferenceInstruction>(targetIndex).reference.toString()
|
instruction.opcode == Opcode.AND_INT_LIT8
|
||||||
|
} - 2
|
||||||
|
|
||||||
replaceInstruction(
|
for ((index, instruction) in implementation!!.instructions.withIndex()) {
|
||||||
targetIndex,
|
if (instruction.opcode != Opcode.INVOKE_INTERFACE) continue
|
||||||
"invoke-interface {v$targetRegisterA}, Ljava/util/List;->size()I"
|
|
||||||
)
|
if ((getInstruction<Instruction35c>(index).reference as MethodReference).name != "hasNext") continue
|
||||||
addInstructionsWithLabels(
|
|
||||||
targetIndex + 1, """
|
addInstructionsWithLabels(
|
||||||
move-result v1
|
insertIndex, """
|
||||||
const/4 v2, 0x3
|
invoke-static {v$targetRegister}, $MUSIC_NAVIGATION->hideUpgradeButton(Ljava/lang/Enum;)Z
|
||||||
if-le v1, v2, :dismiss
|
move-result v$targetRegister
|
||||||
invoke-interface {v$targetRegisterA, v2}, Ljava/util/List;->remove(I)Ljava/lang/Object;
|
if-nez v$targetRegister, :hide
|
||||||
:dismiss
|
""", ExternalLabel("hide", getInstruction(index))
|
||||||
iput-object v$targetRegisterA, v$targetRegisterB, $replaceReference
|
)
|
||||||
"""
|
break
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
} ?: throw PivotBarConstructorFingerprint.exception
|
} ?: throw TabLayoutTextFingerprint.exception
|
||||||
|
|
||||||
NotifierShelfFingerprint.result?.let {
|
NotifierShelfFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
Loading…
x
Reference in New Issue
Block a user