mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-29 22:24:31 +02:00
build: bump patcher to 11.0.1
This commit is contained in:
parent
af84ca9a4c
commit
9aae2f0032
2
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
2
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
@ -1,6 +1,6 @@
|
||||
name: 🐞 Bug report
|
||||
description: Report a very clearly broken issue.
|
||||
title: 'bug: <title>'
|
||||
title: 'bug: '
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: markdown
|
||||
|
6
.github/ISSUE_TEMPLATE/patch-request.yml
vendored
6
.github/ISSUE_TEMPLATE/patch-request.yml
vendored
@ -1,6 +1,6 @@
|
||||
name: ⭐ Patch Request
|
||||
description: Create a detailed patch request.
|
||||
title: 'feat(patch): '
|
||||
title: 'feat: '
|
||||
labels: [patch-request]
|
||||
body:
|
||||
- type: textarea
|
||||
@ -24,7 +24,7 @@ body:
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Motivation
|
||||
description: Why should your patch request should be considered? What makes it valuable to the community?
|
||||
description: Why should your patch request be considered? What makes it valuable to the community?
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
@ -38,4 +38,4 @@ body:
|
||||
- label: I have written a short but informative title.
|
||||
required: true
|
||||
- label: I filled out all of the requested information in this issue properly.
|
||||
required: true
|
||||
required: true
|
||||
|
2
.github/config.yml
vendored
Normal file
2
.github/config.yml
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
firstPRMergeComment: >
|
||||
Thank you for contributing to ReVanced. Join us on [Discord](https://revanced.app/discord) if you want to receive a contributor role.
|
7
.github/workflows/pull_request.yml
vendored
7
.github/workflows/pull_request.yml
vendored
@ -21,5 +21,10 @@ jobs:
|
||||
with:
|
||||
destination_branch: 'main'
|
||||
pr_title: 'chore: ${{ env.MESSAGE }}'
|
||||
pr_body: 'This pull request will ${{ env.MESSAGE }}.'
|
||||
pr_body: |
|
||||
This pull request will ${{ env.MESSAGE }}.
|
||||
|
||||
## Dependencies before merge
|
||||
|
||||
- [ ] https://github.com/revanced/revanced-integrations
|
||||
pr_draft: true
|
||||
|
25
.github/workflows/release.yml
vendored
25
.github/workflows/release.yml
vendored
@ -23,23 +23,16 @@ jobs:
|
||||
# https://github.com/cycjimmy/semantic-release-action#private-packages
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
- name: Setup JDK
|
||||
uses: actions/setup-java@v3
|
||||
- name: Cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'zulu'
|
||||
cache: gradle
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
- name: Setup Android SDK
|
||||
uses: amyu/setup-android@v2
|
||||
with:
|
||||
cache-disabled: false
|
||||
sdk-version: '33'
|
||||
build-tools-version: '33.0.2'
|
||||
path: |
|
||||
${{ runner.home }}/.gradle/caches
|
||||
${{ runner.home }}/.gradle/wrapper
|
||||
.gradle
|
||||
build
|
||||
node_modules
|
||||
key: ${{ runner.os }}-gradle-npm-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'package-lock.json') }}
|
||||
- name: Build with Gradle
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "1.8.20"
|
||||
kotlin("jvm") version "1.8.22"
|
||||
}
|
||||
|
||||
group = "app.revanced"
|
||||
@ -20,7 +20,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("app.revanced:revanced-patcher:7.1.1")
|
||||
implementation("app.revanced:revanced-patcher:11.0.1")
|
||||
implementation("app.revanced:multidexlib2:2.5.3-a3836654")
|
||||
// Required for meta
|
||||
implementation("com.google.code.gson:gson:2.10.1")
|
||||
@ -33,7 +33,7 @@ tasks {
|
||||
|
||||
doLast {
|
||||
val androidHome = System.getenv("ANDROID_HOME") ?: throw GradleException("ANDROID_HOME not found")
|
||||
val d8 = "${androidHome}/build-tools/33.0.2/d8"
|
||||
val d8 = "${androidHome}/build-tools/34.0.0/d8"
|
||||
val input = configurations.archives.get().allArtifacts.files.files.first().absolutePath
|
||||
val work = File("${buildDir}/libs")
|
||||
|
||||
|
@ -2,9 +2,7 @@ package app.revanced.extensions
|
||||
|
||||
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
@ -80,10 +78,4 @@ internal fun String.startsWithAny(vararg prefixes: String): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
internal fun toResult(errorIndex: Int): PatchResult {
|
||||
return if (errorIndex == -1)
|
||||
PatchResultSuccess()
|
||||
else
|
||||
PatchResultError("Instruction not found: $errorIndex")
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.util.patch.PatchBundle
|
||||
import java.io.File
|
||||
|
||||
typealias PatchBundlePatches = List<Class<out Patch<Context>>>
|
||||
internal typealias PatchBundlePatches = List<Class<out Patch<Context>>>
|
||||
|
||||
internal interface PatchesFileGenerator {
|
||||
fun generate(bundle: PatchBundlePatches)
|
||||
|
@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import com.unascribed.flexver.FlexVerComparator
|
||||
import java.io.File
|
||||
|
||||
internal class ReadmeGenerator : PatchesFileGenerator {
|
||||
@ -37,9 +38,8 @@ internal class ReadmeGenerator : PatchesFileGenerator {
|
||||
}
|
||||
}.let { commonMap ->
|
||||
commonMap.maxByOrNull { it.value }?.value?.let {
|
||||
// This is not foolproof, because for example v1.0.0-dev.0 will be returned instead of v1.0.0-release.
|
||||
// Unfortunately this can not be solved easily because versioning can be complex.
|
||||
commonMap.entries.filter { mostCommon -> mostCommon.value == it }.maxBy { it.key }.key
|
||||
commonMap.entries.filter { mostCommon -> mostCommon.value == it }
|
||||
.maxOfWith(FlexVerComparator::compare, Map.Entry<String, Int>::key)
|
||||
} ?: "all"
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,8 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.*
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -29,15 +30,18 @@ class DisableAutoCaptionsPatch : BytecodePatch(
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
SubtitleTrackFingerprint.result?.mutableMethod?.let {
|
||||
val index = it.implementation!!.instructions.size - 1
|
||||
val register = it.instruction<OneRegisterInstruction>(index).registerA
|
||||
it.addInstructions(
|
||||
index, """
|
||||
invoke-static {v$register}, $MUSIC_LAYOUT->disableAutoCaptions(Z)Z
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
SubtitleTrackFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val index = implementation!!.instructions.size - 1
|
||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
|
||||
addInstructions(
|
||||
index, """
|
||||
invoke-static {v$register}, $MUSIC_LAYOUT->disableAutoCaptions(Z)Z
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return SubtitleTrackFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_disable_auto_captions", "false")
|
||||
|
@ -9,13 +9,13 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object TabLayoutFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
opcodes = listOf(
|
||||
Opcode.CONST,
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT
|
||||
),
|
||||
customFingerprint = { it.isWideLiteralExists(colorGreyId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(colorGreyId) }
|
||||
)
|
||||
|
||||
|
@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -39,7 +39,7 @@ class BlackNavbarPatch : BytecodePatch(
|
||||
TabLayoutFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
|
@ -6,6 +6,6 @@ import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object HideCastButtonFingerprint : MethodFingerprint (
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("I")
|
||||
)
|
@ -6,6 +6,6 @@ import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object HideCastButtonParentFingerprint : MethodFingerprint (
|
||||
returnType = "Z",
|
||||
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||
strings = listOf("MediaRouteButton")
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
|
@ -13,6 +13,6 @@ object ChipCloudFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { it.isWideLiteralExists(chipCloudId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(chipCloudId) }
|
||||
)
|
||||
|
||||
|
@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -38,7 +38,7 @@ class CategoryBarPatch : BytecodePatch(
|
||||
ChipCloudFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object ColorMatchPlayerFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L", "J"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_DIRECT,
|
||||
|
@ -5,9 +5,9 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.removeInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
@ -42,11 +42,11 @@ class ColorMatchPlayerPatch : BytecodePatch(
|
||||
targetMethod = parentResult.mutableMethod
|
||||
|
||||
val insertIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
||||
val jumpInstruction = instruction<Instruction>(insertIndex)
|
||||
val jumpInstruction = getInstruction<Instruction>(insertIndex)
|
||||
|
||||
val type = it.classDef.type
|
||||
|
||||
addInstructions(
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $MUSIC_LAYOUT->enableColorMatchPlayer()Z
|
||||
move-result v2
|
||||
@ -65,7 +65,7 @@ class ColorMatchPlayerPatch : BytecodePatch(
|
||||
goto :exit
|
||||
:off
|
||||
invoke-direct {p0}, ${type}->${parentResult.mutableMethod.name}()V
|
||||
""", listOf(ExternalLabel("exit", jumpInstruction))
|
||||
""", ExternalLabel("exit", jumpInstruction)
|
||||
)
|
||||
removeInstruction(insertIndex - 1)
|
||||
}
|
||||
@ -79,8 +79,8 @@ class ColorMatchPlayerPatch : BytecodePatch(
|
||||
private companion object {
|
||||
private lateinit var targetMethod: MutableMethod
|
||||
|
||||
fun descriptor(index: Int):String {
|
||||
return (targetMethod.instruction(index) as ReferenceInstruction).reference.toString()
|
||||
fun descriptor(index: Int): String {
|
||||
return targetMethod.getInstruction<ReferenceInstruction>(index).reference.toString()
|
||||
}
|
||||
}
|
||||
}
|
@ -9,13 +9,13 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object DialogSolidFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_STATIC
|
||||
),
|
||||
customFingerprint = { it.isWideLiteralExists(dialogSolidId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(dialogSolidId) }
|
||||
)
|
||||
|
||||
|
@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object FloatingButtonFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(Opcode.AND_INT_LIT16)
|
||||
)
|
||||
|
@ -8,9 +8,9 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object FloatingButtonParentFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(Opcode.INVOKE_DIRECT),
|
||||
customFingerprint = { it.isNarrowLiteralExists(259982244) }
|
||||
customFingerprint = { it, _ -> it.isNarrowLiteralExists(259982244) }
|
||||
)
|
||||
|
||||
|
@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
@ -38,15 +38,17 @@ class NewPlaylistButtonPatch : BytecodePatch(
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
FloatingButtonParentFingerprint.result?.let { parentResult ->
|
||||
FloatingButtonFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.mutableMethod?.let {
|
||||
it.addInstructions(
|
||||
1, """
|
||||
invoke-static {}, $MUSIC_LAYOUT->hideNewPlaylistButton()Z
|
||||
move-result v0
|
||||
if-eqz v0, :show
|
||||
return-void
|
||||
""", listOf(ExternalLabel("show", it.instruction(1)))
|
||||
)
|
||||
FloatingButtonFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
1, """
|
||||
invoke-static {}, $MUSIC_LAYOUT->hideNewPlaylistButton()Z
|
||||
move-result v0
|
||||
if-eqz v0, :show
|
||||
return-void
|
||||
""", ExternalLabel("show", getInstruction(1))
|
||||
)
|
||||
}
|
||||
} ?: return FloatingButtonFingerprint.toErrorResult()
|
||||
} ?: return FloatingButtonParentFingerprint.toErrorResult()
|
||||
|
||||
|
@ -9,13 +9,13 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object TabletIdentifierFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.CONST,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT
|
||||
),
|
||||
customFingerprint = { it.isWideLiteralExists(isTabletId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(isTabletId) }
|
||||
)
|
||||
|
||||
|
@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object MinimizedPlayerFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L", "L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
|
@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object ZenModeFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L", "J"),
|
||||
opcodes = listOf(
|
||||
Opcode.MOVE_RESULT,
|
||||
|
@ -5,9 +5,9 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.removeInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
@ -39,16 +39,16 @@ class ZenModePatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
|
||||
val firstRegister = instruction<OneRegisterInstruction>(startIndex).registerA
|
||||
val secondRegister = instruction<OneRegisterInstruction>(startIndex + 2).registerA
|
||||
val firstRegister = getInstruction<OneRegisterInstruction>(startIndex).registerA
|
||||
val secondRegister = getInstruction<OneRegisterInstruction>(startIndex + 2).registerA
|
||||
val dummyRegister = secondRegister + 1
|
||||
|
||||
val referenceIndex = it.scanResult.patternScanResult!!.endIndex + 1
|
||||
val targetReference = (instruction(referenceIndex) as ReferenceInstruction).reference.toString()
|
||||
val targetReference = getInstruction<ReferenceInstruction>(referenceIndex).reference.toString()
|
||||
|
||||
val insertIndex = referenceIndex + 1
|
||||
|
||||
addInstructions(
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $MUSIC_LAYOUT->enableZenMode()Z
|
||||
move-result v$dummyRegister
|
||||
|
@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object BackgroundPlaybackParentFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_STATIC,
|
||||
@ -17,5 +17,5 @@ object BackgroundPlaybackParentFingerprint : MethodFingerprint(
|
||||
Opcode.GOTO,
|
||||
Opcode.NOP
|
||||
),
|
||||
customFingerprint = { it.definingClass.endsWith("/WatchFragment;") }
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("/WatchFragment;") }
|
||||
)
|
@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -27,7 +27,7 @@ class ClientSpoofMusicPatch : BytecodePatch(
|
||||
UserAgentHeaderBuilderFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
||||
val packageNameRegister = instruction<FiveRegisterInstruction>(insertIndex).registerD
|
||||
val packageNameRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
|
||||
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object AllCodecsFingerprint : MethodFingerprint(
|
||||
returnType = "J",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
opcodes = listOf(
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.GOTO,
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object AllCodecsParentFingerprint : MethodFingerprint(
|
||||
returnType = "J",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_SUPER
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object CodecsLockFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
opcodes = listOf(
|
||||
Opcode.NEW_INSTANCE,
|
||||
Opcode.NEW_INSTANCE,
|
||||
|
@ -6,8 +6,8 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
@ -15,7 +15,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.misc.codecs.fingerprints.*
|
||||
import app.revanced.patches.music.misc.codecs.fingerprints.AllCodecsFingerprint
|
||||
import app.revanced.patches.music.misc.codecs.fingerprints.AllCodecsParentFingerprint
|
||||
import app.revanced.patches.music.misc.codecs.fingerprints.CodecsLockFingerprint
|
||||
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
@ -49,15 +51,15 @@ class CodecsUnlockPatch : BytecodePatch(
|
||||
CodecsLockFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
addInstructions(
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
addInstructionsWithLabels(
|
||||
targetIndex + 1, """
|
||||
invoke-static {}, $MUSIC_MISC_PATH/OpusCodecPatch;->enableOpusCodec()Z
|
||||
move-result v7
|
||||
if-eqz v7, :mp4a
|
||||
invoke-static {}, ${allCodecsMethod.definingClass}->${allCodecsMethod.name}()Ljava/util/Set;
|
||||
move-result-object v$targetRegister
|
||||
""", listOf(ExternalLabel("mp4a", instruction(targetIndex + 1)))
|
||||
""", ExternalLabel("mp4a", getInstruction(targetIndex + 1))
|
||||
)
|
||||
}
|
||||
} ?: return CodecsLockFingerprint.toErrorResult()
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object AudioOnlyEnablerFingerprint: MethodFingerprint(
|
||||
returnType = "Z",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
opcodes = listOf(
|
||||
Opcode.IGET_OBJECT,
|
||||
|
@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
@ -3,8 +3,8 @@ package app.revanced.patches.music.misc.litho.patch
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -33,24 +33,24 @@ class MusicLithoFilterPatch : BytecodePatch(
|
||||
|
||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val bufferIndex = getNarrowLiteralIndex(168777401)
|
||||
val bufferRegister = instruction<OneRegisterInstruction>(bufferIndex).registerA
|
||||
val bufferRegister = getInstruction<OneRegisterInstruction>(bufferIndex).registerA
|
||||
val targetIndex = targetInstruction.indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.CONST_STRING &&
|
||||
(instruction as BuilderInstruction21c).reference.toString() == "Element missing type extension"
|
||||
} + 2
|
||||
|
||||
val builderMethodDescriptor = (instruction(targetIndex) as ReferenceInstruction).reference as MethodReference
|
||||
val emptyComponentFieldDescriptor = (instruction(targetIndex + 2) as ReferenceInstruction).reference as FieldReference
|
||||
val identifierRegister = instruction<OneRegisterInstruction>(endIndex).registerA
|
||||
val builderMethodDescriptor = (getInstruction(targetIndex) as ReferenceInstruction).reference as MethodReference
|
||||
val emptyComponentFieldDescriptor = (getInstruction(targetIndex + 2) as ReferenceInstruction).reference as FieldReference
|
||||
val identifierRegister = getInstruction<OneRegisterInstruction>(endIndex).registerA
|
||||
|
||||
targetInstruction.filter { instruction ->
|
||||
val fieldReference = (instruction as? ReferenceInstruction)?.reference as? FieldReference
|
||||
fieldReference?.let { reference -> reference.type == "Ljava/lang/StringBuilder;" } == true
|
||||
}.forEach { instruction ->
|
||||
val insertIndex = targetInstruction.indexOf(instruction)
|
||||
val stringBuilderRegister = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||
val stringBuilderRegister = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {v$stringBuilderRegister, v$identifierRegister}, $MUSIC_ADS_PATH/MusicLithoFilterPatch;->filter(Ljava/lang/StringBuilder;Ljava/lang/String;)Z
|
||||
move-result v$bufferRegister
|
||||
@ -60,7 +60,7 @@ class MusicLithoFilterPatch : BytecodePatch(
|
||||
move-result-object v0
|
||||
iget-object v0, v0, $emptyComponentFieldDescriptor
|
||||
return-object v0
|
||||
""", listOf(ExternalLabel("not_an_ad", instruction(insertIndex)))
|
||||
""", ExternalLabel("not_an_ad", getInstruction(insertIndex))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object MinimizedPlaybackManagerFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("I", "L", "Z"),
|
||||
opcodes = listOf(
|
||||
Opcode.IGET,
|
||||
|
@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
@ -9,7 +9,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object AccountMenuFooterFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
opcodes = listOf(
|
||||
Opcode.CONST,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
@ -18,5 +18,5 @@ object AccountMenuFooterFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.IGET_OBJECT
|
||||
),
|
||||
customFingerprint = { it.isWideLiteralExists(privacyTosFooterId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(privacyTosFooterId) }
|
||||
)
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object HideGetPremiumFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
opcodes = listOf(
|
||||
Opcode.IGET_BOOLEAN,
|
||||
|
@ -6,8 +6,8 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -43,7 +43,7 @@ class HideGetPremiumPatch : BytecodePatch(
|
||||
HideGetPremiumFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val register = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||
val register = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
insertIndex + 1,
|
||||
@ -56,7 +56,7 @@ class HideGetPremiumPatch : BytecodePatch(
|
||||
AccountMenuFooterFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralIndex(privacyTosFooterId) + 4
|
||||
targetReference = instruction<ReferenceInstruction>(targetIndex + 1).reference
|
||||
targetReference = getInstruction<ReferenceInstruction>(targetIndex + 1).reference
|
||||
|
||||
with (context
|
||||
.toMethodWalker(this)
|
||||
@ -67,8 +67,8 @@ class HideGetPremiumPatch : BytecodePatch(
|
||||
for ((index, instruction) in withIndex()) {
|
||||
if (instruction.opcode != Opcode.IGET_OBJECT) continue
|
||||
|
||||
if (instruction<ReferenceInstruction>(index).reference == targetReference) {
|
||||
val targetRegister = instruction<OneRegisterInstruction>(index + 2).registerA
|
||||
if (getInstruction<ReferenceInstruction>(index).reference == targetReference) {
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(index + 2).registerA
|
||||
|
||||
addInstruction(
|
||||
index,
|
||||
|
@ -9,5 +9,5 @@ object MusicVideoQualitySetterFingerprint : MethodFingerprint(
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.IPUT_OBJECT
|
||||
),
|
||||
customFingerprint = { it.name == "<init>" }
|
||||
customFingerprint = { it, _ -> it.name == "<init>" }
|
||||
)
|
@ -7,5 +7,5 @@ import app.revanced.util.bytecode.isWideLiteralExists
|
||||
object MusicVideoQualitySetterParentFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("L"),
|
||||
customFingerprint = { it.isWideLiteralExists(qualityAutoId)}
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(qualityAutoId)}
|
||||
)
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object MusicVideoQualitySettingsFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("[L", "I", "Z"),
|
||||
opcodes = listOf(
|
||||
Opcode.IPUT_OBJECT,
|
||||
|
@ -7,5 +7,5 @@ import app.revanced.util.bytecode.isWideLiteralExists
|
||||
object MusicVideoQualitySettingsParentFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
parameters = listOf(),
|
||||
customFingerprint = { it.isWideLiteralExists(qualityTitleId)}
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(qualityTitleId)}
|
||||
)
|
@ -6,9 +6,9 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
@ -53,7 +53,7 @@ class VideoQualityPatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
|
||||
qualityReference = instruction<ReferenceInstruction>(endIndex).reference
|
||||
qualityReference = getInstruction<ReferenceInstruction>(endIndex).reference
|
||||
qualityFieldReference = qualityReference as FieldReference
|
||||
|
||||
qIndexMethodName = context
|
||||
@ -79,7 +79,7 @@ class VideoQualityPatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val qualityChangedClass =
|
||||
context.findClass((instruction<BuilderInstruction21c>(endIndex))
|
||||
context.findClass((getInstruction<BuilderInstruction21c>(endIndex))
|
||||
.reference.toString())!!
|
||||
.mutableClass
|
||||
|
||||
|
@ -19,5 +19,5 @@ object PreferenceFingerprint : MethodFingerprint(
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_INTERFACE
|
||||
),
|
||||
customFingerprint = { it.definingClass == "Landroidx/preference/Preference;" }
|
||||
customFingerprint = { it, _ -> it.definingClass == "Landroidx/preference/Preference;" }
|
||||
)
|
@ -12,5 +12,5 @@ object SettingsHeadersFragmentFingerprint : MethodFingerprint(
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
|
||||
),
|
||||
customFingerprint = { it.definingClass.endsWith("/SettingsHeadersFragment;") && it.name == "onCreate" }
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("/SettingsHeadersFragment;") && it.name == "onCreate" }
|
||||
)
|
@ -4,8 +4,8 @@ import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -32,7 +32,7 @@ class MusicSettingsBytecodePatch : BytecodePatch(
|
||||
SettingsHeadersFragmentFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
@ -44,8 +44,8 @@ class MusicSettingsBytecodePatch : BytecodePatch(
|
||||
PreferenceFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val keyRegister = instruction<FiveRegisterInstruction>(targetIndex).registerD
|
||||
val valueRegister = instruction<FiveRegisterInstruction>(targetIndex).registerE
|
||||
val keyRegister = getInstruction<FiveRegisterInstruction>(targetIndex).registerD
|
||||
val valueRegister = getInstruction<FiveRegisterInstruction>(targetIndex).registerE
|
||||
|
||||
addInstruction(
|
||||
targetIndex,
|
||||
|
@ -3,7 +3,7 @@ package app.revanced.patches.music.misc.sharebuttonhook.fingerprints
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object FullStackTraceActivityFingerprint : MethodFingerprint(
|
||||
customFingerprint = {
|
||||
customFingerprint = { it, _ ->
|
||||
it.definingClass.endsWith("FullStackTraceActivity;") && it.name == "onCreate"
|
||||
}
|
||||
)
|
||||
|
@ -5,9 +5,10 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -48,13 +49,13 @@ class ShareButtonHookPatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
|
||||
addInstructions(
|
||||
addInstructionsWithLabels(
|
||||
targetIndex,"""
|
||||
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->overrideSharePanel()Z
|
||||
move-result p1
|
||||
if-eqz p1, :default
|
||||
return-void
|
||||
""", listOf(ExternalLabel("default", instruction(targetIndex)))
|
||||
""", ExternalLabel("default", getInstruction(targetIndex))
|
||||
)
|
||||
}
|
||||
} ?: return SharePanelFingerprint.toErrorResult()
|
||||
@ -75,7 +76,7 @@ class ShareButtonHookPatch : BytecodePatch(
|
||||
1,"""
|
||||
invoke-static {p0}, $MUSIC_INTEGRATIONS_PATH/settingsmenu/SharedPreferenceChangeListener;->initializeSettings(Landroid/app/Activity;)V
|
||||
return-void
|
||||
"""
|
||||
"""
|
||||
) ?: return FullStackTraceActivityFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.MISC, "revanced_hook_share_button", "false")
|
||||
|
@ -7,12 +7,12 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object MusicPlaybackControlsFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("Z"),
|
||||
opcodes = listOf(
|
||||
Opcode.IPUT_BOOLEAN,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.RETURN_VOID
|
||||
),
|
||||
customFingerprint = { it.definingClass.endsWith("MusicPlaybackControls;") }
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("MusicPlaybackControls;") }
|
||||
)
|
||||
|
@ -9,7 +9,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object ShuffleClassFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
@ -18,6 +18,6 @@ object ShuffleClassFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.RETURN_VOID
|
||||
),
|
||||
customFingerprint = { it.name == "<init>" && it.isWideLiteralExists(disabledIconId) }
|
||||
customFingerprint = { it, _ -> it.name == "<init>" && it.isWideLiteralExists(disabledIconId) }
|
||||
)
|
||||
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object ShuffleClassReferenceFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
opcodes = listOf(
|
||||
Opcode.IGET_OBJECT,
|
||||
|
@ -6,9 +6,9 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
@ -65,10 +65,10 @@ class EnforceShufflePatch : BytecodePatch(
|
||||
|
||||
SHUFFLE_CLASS = it.classDef.type
|
||||
|
||||
shuffleReference1 = instruction(startIndex).descriptor
|
||||
shuffleReference2 = instruction(startIndex + 1).descriptor
|
||||
shuffleReference3 = instruction(endIndex).descriptor
|
||||
shuffleReference4 = instruction(imageViewIndex).descriptor
|
||||
shuffleReference1 = getInstruction(startIndex).descriptor
|
||||
shuffleReference2 = getInstruction(startIndex + 1).descriptor
|
||||
shuffleReference3 = getInstruction(endIndex).descriptor
|
||||
shuffleReference4 = getInstruction(imageViewIndex).descriptor
|
||||
}
|
||||
} ?: return ShuffleClassReferenceFingerprint.toErrorResult()
|
||||
|
||||
@ -99,8 +99,8 @@ class EnforceShufflePatch : BytecodePatch(
|
||||
|
||||
MusicPlaybackControlsFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
shuffleReference5 = instruction(0).descriptor
|
||||
shuffleReference6 = instruction(1).descriptor
|
||||
shuffleReference5 = getInstruction(0).descriptor
|
||||
shuffleReference6 = getInstruction(1).descriptor
|
||||
|
||||
addInstructions(
|
||||
0, """
|
||||
|
@ -9,5 +9,5 @@ object MusicPlaybackControlsClickFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.RETURN_VOID
|
||||
),
|
||||
customFingerprint = { it.definingClass.endsWith("/MusicPlaybackControls;") && it.name == "onClick" }
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("/MusicPlaybackControls;") && it.name == "onClick" }
|
||||
)
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object MusicPlaybackControlsTimeFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL or AccessFlags.SYNTHETIC,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL or AccessFlags.SYNTHETIC,
|
||||
parameters = listOf("J","J","J","J"),
|
||||
opcodes = listOf(Opcode.RETURN_VOID),
|
||||
)
|
@ -4,7 +4,7 @@ import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
|
@ -9,7 +9,7 @@ import org.jf.dexlib2.Opcode
|
||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
||||
object TasteBuilderConstructorFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
parameters = listOf("L", "L", "L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_DIRECT,
|
||||
|
@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -27,7 +27,7 @@ class RemoveTasteBuilderPatch : BytecodePatch(
|
||||
TasteBuilderConstructorFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 8
|
||||
val register = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||
val register = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
|
@ -9,13 +9,13 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object NotifierShelfFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
opcodes = listOf(
|
||||
Opcode.CONST,
|
||||
Opcode.CONST_4,
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { it.isWideLiteralExists(notifierShelfId)}
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(notifierShelfId)}
|
||||
)
|
||||
|
||||
|
@ -8,10 +8,10 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object PivotBarConstructorFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
opcodes = listOf(
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.RETURN_VOID
|
||||
),
|
||||
customFingerprint = { it.name == "<init>" && it.isNarrowLiteralExists(117501096) }
|
||||
customFingerprint = { it, _ -> it.name == "<init>" && it.isNarrowLiteralExists(117501096) }
|
||||
)
|
@ -5,10 +5,10 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
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.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -16,7 +16,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.misc.integrations.patch.MusicIntegrationsPatch
|
||||
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.misc.upgradebutton.fingerprints.*
|
||||
import app.revanced.patches.music.misc.upgradebutton.fingerprints.NotifierShelfFingerprint
|
||||
import app.revanced.patches.music.misc.upgradebutton.fingerprints.PivotBarConstructorFingerprint
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -44,16 +45,16 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
|
||||
PivotBarConstructorFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val targetRegisterA = instruction<TwoRegisterInstruction>(targetIndex).registerA
|
||||
val targetRegisterB = instruction<TwoRegisterInstruction>(targetIndex).registerB
|
||||
val targetRegisterA = getInstruction<TwoRegisterInstruction>(targetIndex).registerA
|
||||
val targetRegisterB = getInstruction<TwoRegisterInstruction>(targetIndex).registerB
|
||||
|
||||
val replaceReference = instruction<ReferenceInstruction>(targetIndex).reference.toString()
|
||||
val replaceReference = getInstruction<ReferenceInstruction>(targetIndex).reference.toString()
|
||||
|
||||
replaceInstruction(
|
||||
targetIndex,
|
||||
"invoke-interface {v$targetRegisterA}, Ljava/util/List;->size()I"
|
||||
)
|
||||
addInstructions(
|
||||
addInstructionsWithLabels(
|
||||
targetIndex + 1,"""
|
||||
move-result v1
|
||||
const/4 v2, 0x3
|
||||
@ -69,7 +70,7 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
|
||||
NotifierShelfFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$targetRegister}, $INTEGRATIONS_PATH/adremover/AdRemoverAPI;->HideViewWithLayout1dp(Landroid/view/View;)V"
|
||||
|
@ -12,5 +12,5 @@ object MusicVideoIdFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { it.definingClass.endsWith("SubtitlesOverlayPresenter;") && it.name == "handleVideoStageEvent" }
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("SubtitlesOverlayPresenter;") && it.name == "handleVideoStageEvent" }
|
||||
)
|
||||
|
@ -5,7 +5,8 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.*
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -28,7 +29,7 @@ class MusicVideoIdPatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
insertMethod = this
|
||||
videoIdRegister = instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
videoIdRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
}
|
||||
offset++ // offset so setVideoId is called before any injected call
|
||||
} ?: return MusicVideoIdFingerprint.toErrorResult()
|
||||
@ -54,7 +55,7 @@ class MusicVideoIdPatch : BytecodePatch(
|
||||
fun injectCall(
|
||||
methodDescriptor: String
|
||||
) {
|
||||
insertMethod.addInstructions(
|
||||
insertMethod.addInstruction(
|
||||
insertIndex + offset, // move-result-object offset
|
||||
"invoke-static {v$videoIdRegister}, $methodDescriptor"
|
||||
)
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object ClientInfoFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
opcodes = listOf(Opcode.OR_INT_LIT16)
|
||||
)
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object ColorMatchPlayerParentFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||
opcodes = listOf(
|
||||
Opcode.IGET,
|
||||
Opcode.IGET,
|
||||
|
@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object LayoutConstructorFingerprint : MethodFingerprint(
|
||||
strings = listOf("1.0x"),
|
||||
customFingerprint = { it.definingClass.endsWith("YouTubeControlsOverlay;") }
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("YouTubeControlsOverlay;") }
|
||||
)
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object LayoutSwitchFingerprint : MethodFingerprint(
|
||||
returnType = "I",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
|
@ -8,7 +8,7 @@ import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||
|
||||
object LegacyVideoAdsFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
opcodes = listOf(
|
||||
Opcode.CONST_WIDE_16,
|
||||
@ -20,7 +20,7 @@ object LegacyVideoAdsFingerprint : MethodFingerprint(
|
||||
Opcode.IPUT_WIDE,
|
||||
Opcode.CONST_4,
|
||||
),
|
||||
customFingerprint = { methodDef ->
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.implementation!!.instructions.any {
|
||||
((it as? NarrowLiteralInstruction)?.narrowLiteral == 4)
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object LithoBufferFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
opcodes = listOf(
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object LithoFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.IF_EQZ
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object LithoObjectFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
opcodes = listOf(
|
||||
Opcode.CONST_STRING,
|
||||
Opcode.INVOKE_VIRTUAL
|
||||
|
@ -9,10 +9,10 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object PivotBarCreateButtonViewFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
opcodes = listOf(
|
||||
Opcode.MOVE_OBJECT,
|
||||
Opcode.INVOKE_DIRECT_RANGE, // unique instruction anchor
|
||||
),
|
||||
customFingerprint = { it.isWideLiteralExists(imageOnlyTabId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(imageOnlyTabId) }
|
||||
)
|
@ -7,8 +7,8 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object SubtitleButtonControllerFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("Lcom/google/android/libraries/youtube/player/subtitles/model/SubtitleTrack;"),
|
||||
opcodes = listOf(
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IF_NEZ,
|
||||
@ -19,5 +19,6 @@ object SubtitleButtonControllerFingerprint : MethodFingerprint(
|
||||
Opcode.CONST,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.IGET_OBJECT
|
||||
)
|
||||
),
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("SubtitleButtonController;") }
|
||||
)
|
@ -6,6 +6,6 @@ import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object SubtitleTrackFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
strings = listOf("DISABLE_CAPTIONS_OPTION")
|
||||
)
|
@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object TotalTimeFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
customFingerprint = { it.isWideLiteralExists(totalTimeId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(totalTimeId) }
|
||||
)
|
@ -4,13 +4,14 @@ import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint.RegisterResolver
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.ClassDef
|
||||
import org.jf.dexlib2.iface.Method
|
||||
|
||||
@Description("Applies mandatory patches to implement the ReVanced integrations into the application.")
|
||||
@ -26,11 +27,21 @@ abstract class AbstractIntegrationsPatch(
|
||||
* @see MethodFingerprint
|
||||
*/
|
||||
abstract class IntegrationsFingerprint(
|
||||
returnType: String? = null,
|
||||
accessFlags: Int? = null,
|
||||
parameters: Iterable<String>? = null,
|
||||
opcodes: Iterable<Opcode?>? = null,
|
||||
strings: Iterable<String>? = null,
|
||||
customFingerprint: ((methodDef: Method) -> Boolean)? = null,
|
||||
customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null,
|
||||
private val contextRegisterResolver: (Method) -> Int = object : RegisterResolver {}
|
||||
) : MethodFingerprint(strings = strings, customFingerprint = customFingerprint) {
|
||||
|
||||
) : MethodFingerprint(
|
||||
returnType,
|
||||
accessFlags,
|
||||
parameters,
|
||||
opcodes,
|
||||
strings,
|
||||
customFingerprint
|
||||
) {
|
||||
fun invoke(integrationsDescriptor: String): PatchResult {
|
||||
result?.mutableMethod?.let { method ->
|
||||
val contextRegister = contextRegisterResolver(method)
|
||||
@ -41,6 +52,7 @@ abstract class AbstractIntegrationsPatch(
|
||||
"$integrationsDescriptor->context:Landroid/content/Context;"
|
||||
)
|
||||
} ?: return toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
|
@ -5,8 +5,9 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -55,13 +56,13 @@ class GeneralVideoAdsPatch : BytecodePatch(
|
||||
fun injectMainstreamAds(
|
||||
descriptor: String
|
||||
) {
|
||||
mainstreamVideoAdsMethod.addInstructions(
|
||||
mainstreamVideoAdsMethod.addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $descriptor
|
||||
move-result v0
|
||||
if-nez v0, :show_video_ads
|
||||
return-void
|
||||
""", listOf(ExternalLabel("show_video_ads", mainstreamVideoAdsMethod.instruction(0)))
|
||||
""", ExternalLabel("show_video_ads", mainstreamVideoAdsMethod.getInstruction(0))
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -5,5 +5,5 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object OnBackPressedFingerprint : MethodFingerprint(
|
||||
opcodes = listOf(Opcode.RETURN_VOID),
|
||||
customFingerprint = { it.definingClass.endsWith("WatchWhileActivity;") && it.name == "onBackPressed" }
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("WatchWhileActivity;") && it.name == "onBackPressed" }
|
||||
)
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object ScrollPositionFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.IF_NEZ,
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object ScrollTopFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
opcodes = listOf(
|
||||
Opcode.CHECK_CAST,
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object ScrollTopParentFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
opcodes = listOf(
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
@ -20,6 +20,6 @@ object ScrollTopParentFingerprint : MethodFingerprint(
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.RETURN_VOID
|
||||
),
|
||||
customFingerprint = { it.name == "<init>"}
|
||||
customFingerprint = { it, _ -> it.name == "<init>"}
|
||||
)
|
||||
|
||||
|
@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
|
@ -5,7 +5,7 @@ import app.revanced.extensions.injectHideCall
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -33,10 +33,10 @@ class GeneralAdsBytecodePatch : BytecodePatch() {
|
||||
.findMutableMethodOf(method)
|
||||
.apply {
|
||||
val insertIndex = method.getWideLiteralIndex(adAttributionId) + 1
|
||||
if (instruction(insertIndex).opcode != org.jf.dexlib2.Opcode.INVOKE_VIRTUAL)
|
||||
if (getInstruction(insertIndex).opcode != org.jf.dexlib2.Opcode.INVOKE_VIRTUAL)
|
||||
return@forEach
|
||||
|
||||
val viewRegister = instruction<Instruction35c>(insertIndex).registerC
|
||||
val viewRegister = getInstruction<Instruction35c>(insertIndex).registerC
|
||||
|
||||
this.implementation!!.injectHideCall(insertIndex, viewRegister, "ads/AdsFilter", "hideAdAttributionView")
|
||||
}
|
||||
|
@ -1,14 +1,19 @@
|
||||
package app.revanced.patches.youtube.ads.getpremium.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object CompactYpcOfferModuleViewFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||
parameters = listOf("I", "I"),
|
||||
opcodes = listOf(
|
||||
Opcode.ADD_INT_2ADDR,
|
||||
Opcode.ADD_INT_2ADDR,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.RETURN_VOID
|
||||
),
|
||||
customFingerprint = { it.definingClass.endsWith("CompactYpcOfferModuleView;") && it.name == "onMeasure" }
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("CompactYpcOfferModuleView;") && it.name == "onMeasure" }
|
||||
)
|
@ -4,8 +4,8 @@ import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -24,19 +24,19 @@ class HideGetPremiumPatch : BytecodePatch(
|
||||
CompactYpcOfferModuleViewFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val measuredWidthRegister = instruction<TwoRegisterInstruction>(startIndex).registerA
|
||||
val measuredHeightInstruction = instruction<TwoRegisterInstruction>(startIndex + 1)
|
||||
val measuredWidthRegister = getInstruction<TwoRegisterInstruction>(startIndex).registerA
|
||||
val measuredHeightInstruction = getInstruction<TwoRegisterInstruction>(startIndex + 1)
|
||||
val measuredHeightRegister = measuredHeightInstruction.registerA
|
||||
val tempRegister = measuredHeightInstruction.registerB
|
||||
|
||||
addInstructions(
|
||||
addInstructionsWithLabels(
|
||||
startIndex + 2, """
|
||||
invoke-static {}, $PATCHES_PATH/ads/AdsFilter;->hideGetPremium()Z
|
||||
move-result v$tempRegister
|
||||
if-eqz v$tempRegister, :show
|
||||
const/4 v$measuredWidthRegister, 0x0
|
||||
const/4 v$measuredHeightRegister, 0x0
|
||||
""", listOf(ExternalLabel("show", instruction(startIndex + 2)))
|
||||
""", ExternalLabel("show", getInstruction(startIndex + 2))
|
||||
)
|
||||
}
|
||||
} ?: return CompactYpcOfferModuleViewFingerprint.toErrorResult()
|
||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object SwipeRefreshLayoutFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
opcodes = listOf(
|
||||
Opcode.RETURN,
|
||||
@ -15,5 +15,5 @@ object SwipeRefreshLayoutFingerprint : MethodFingerprint(
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.RETURN
|
||||
),
|
||||
customFingerprint = { it.definingClass.endsWith("SwipeRefreshLayout;") }
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("SwipeRefreshLayout;") }
|
||||
)
|
||||
|
@ -4,8 +4,8 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -26,7 +26,7 @@ class SwipeRefreshPatch : BytecodePatch(
|
||||
SwipeRefreshLayoutFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val register = instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
val register = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
|
@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object AutoNavInformerFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
customFingerprint = { it.definingClass.endsWith("WillAutonavInformer;") }
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("WillAutonavInformer;") }
|
||||
)
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object RepeatListenerFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL_RANGE,
|
||||
Opcode.IGET_OBJECT,
|
||||
|
@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object VideoEndFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
customFingerprint = { it.implementation!!.instructions.count() == 3 && it.annotations.isEmpty()}
|
||||
customFingerprint = { it, _ -> it.implementation!!.instructions.count() == 3 && it.annotations.isEmpty()}
|
||||
)
|
@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object VideoEndParentFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
strings = listOf(
|
||||
"play() called when the player wasn't loaded.",
|
||||
"play() blocked because Background Playability failed"
|
||||
|
@ -4,7 +4,10 @@ import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.*
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
@ -34,13 +37,13 @@ class AutoRepeatPatch : BytecodePatch(
|
||||
VideoEndFingerprint.also {
|
||||
it.resolve(context, classDef)
|
||||
}.result?.mutableMethod?.let {
|
||||
it.addInstructions(
|
||||
it.addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $VIDEO_PATH/VideoInformation;->shouldAutoRepeat()Z
|
||||
move-result v0
|
||||
if-eqz v0, :notrepeat
|
||||
return-void
|
||||
""", listOf(ExternalLabel("notrepeat", it.instruction(0)))
|
||||
""", ExternalLabel("notrepeat", it.getInstruction(0))
|
||||
)
|
||||
} ?: return VideoEndFingerprint.toErrorResult()
|
||||
} ?: return VideoEndParentFingerprint.toErrorResult()
|
||||
@ -50,20 +53,20 @@ class AutoRepeatPatch : BytecodePatch(
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex - 1
|
||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
|
||||
val registerC = instruction<BuilderInstruction35c>(targetIndex).registerC
|
||||
val registerD = instruction<BuilderInstruction35c>(targetIndex).registerD
|
||||
val registerC = getInstruction<BuilderInstruction35c>(targetIndex).registerC
|
||||
val registerD = getInstruction<BuilderInstruction35c>(targetIndex).registerD
|
||||
|
||||
val dummyRegister = (instruction(endIndex) as Instruction31i).registerA
|
||||
val dummyRegister = (getInstruction(endIndex) as Instruction31i).registerA
|
||||
|
||||
val targetReference = instruction<ReferenceInstruction>(targetIndex).reference
|
||||
val targetReference = getInstruction<ReferenceInstruction>(targetIndex).reference
|
||||
|
||||
addInstructions(
|
||||
addInstructionsWithLabels(
|
||||
targetIndex + 1, """
|
||||
invoke-static {}, $UTILS_PATH/EnableAutoRepeatPatch;->shouldAutoRepeat()Z
|
||||
move-result v$dummyRegister
|
||||
if-nez v$dummyRegister, :bypass
|
||||
invoke-virtual {v$registerC, v$registerD}, $targetReference
|
||||
""", listOf(ExternalLabel("bypass", instruction(targetIndex + 1)))
|
||||
""", ExternalLabel("bypass", getInstruction(targetIndex + 1))
|
||||
)
|
||||
removeInstruction(targetIndex)
|
||||
}
|
||||
@ -71,13 +74,13 @@ class AutoRepeatPatch : BytecodePatch(
|
||||
|
||||
AutoNavInformerFingerprint.result?.mutableMethod?.let {
|
||||
val index = it.implementation!!.instructions.size - 1 - 1
|
||||
val register = it.instruction<OneRegisterInstruction>(index).registerA
|
||||
val register = it.getInstruction<OneRegisterInstruction>(index).registerA
|
||||
|
||||
it.addInstructions(
|
||||
index + 1, """
|
||||
invoke-static {v$register}, $UTILS_PATH/EnableAutoRepeatPatch;->enableAutoRepeat(Z)Z
|
||||
move-result v0
|
||||
"""
|
||||
"""
|
||||
)
|
||||
} ?: return AutoNavInformerFingerprint.toErrorResult()
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user