mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-04 00:24:34 +02:00
build(integration): update gradle and dependency
This commit is contained in:
parent
c00af81a9b
commit
02b54cab2c
@ -4,7 +4,6 @@ import app.revanced.extensions.exception
|
|||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
|
||||||
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.patches.music.utils.annotations.MusicCompatibility
|
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||||
@ -22,36 +21,37 @@ class LithoFilterPatch : BytecodePatch(
|
|||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
identifierHook("$MUSIC_ADS_PATH/LithoFilterPatch;->filter")
|
identifierHook("$MUSIC_ADS_PATH/LithoFilterPatch;->filter")
|
||||||
|
|
||||||
LithoFilterFingerprint.result?.mutableMethod?.apply {
|
LithoFilterFingerprint.result?.let {
|
||||||
removeInstructions(2, 4) // Remove dummy filter.
|
it.mutableMethod.apply {
|
||||||
|
removeInstructions(0, 6)
|
||||||
|
|
||||||
addFilter = { classDescriptor ->
|
addFilter = { classDescriptor ->
|
||||||
addInstructions(
|
addInstructions(
|
||||||
2,
|
0, """
|
||||||
"""
|
new-instance v0, $classDescriptor
|
||||||
new-instance v1, $classDescriptor
|
invoke-direct {v0}, $classDescriptor-><init>()V
|
||||||
invoke-direct {v1}, $classDescriptor-><init>()V
|
const/16 v2, ${filterCount++}
|
||||||
${getConstString(2, filterCount++)}
|
aput-object v0, v1, v2
|
||||||
aput-object v1, v0, v2
|
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} ?: throw LithoFilterFingerprint.exception
|
} ?: throw LithoFilterFingerprint.exception
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun close() = LithoFilterFingerprint.result!!
|
override fun close() = LithoFilterFingerprint.result!!
|
||||||
.mutableMethod.replaceInstruction(0, getConstString(0, filterCount))
|
.mutableMethod.addInstructions(
|
||||||
|
0, """
|
||||||
|
const/16 v1, $filterCount
|
||||||
|
new-array v1, v1, [Lapp/revanced/music/patches/ads/Filter;
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
internal lateinit var addFilter: (String) -> Unit
|
internal lateinit var addFilter: (String) -> Unit
|
||||||
private set
|
private set
|
||||||
|
|
||||||
private var filterCount = 0
|
private var filterCount = 0
|
||||||
|
|
||||||
private fun getConstString(
|
|
||||||
register: Int,
|
|
||||||
count: Int
|
|
||||||
): String = if (count >= 8) "const/16 v$register, $count" else "const/4 v$register, $count"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ 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.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
|
||||||
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.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
@ -59,15 +58,15 @@ class LithoFilterPatch : BytecodePatch(
|
|||||||
generalHook("$ADS_PATH/LithoFilterPatch;->filters")
|
generalHook("$ADS_PATH/LithoFilterPatch;->filters")
|
||||||
|
|
||||||
LithoFilterFingerprint.result?.mutableMethod?.apply {
|
LithoFilterFingerprint.result?.mutableMethod?.apply {
|
||||||
removeInstructions(2, 4) // Remove dummy filter.
|
removeInstructions(0, 6)
|
||||||
|
|
||||||
addFilter = { classDescriptor ->
|
addFilter = { classDescriptor ->
|
||||||
addInstructions(
|
addInstructions(
|
||||||
2, """
|
0, """
|
||||||
new-instance v1, $classDescriptor
|
new-instance v0, $classDescriptor
|
||||||
invoke-direct {v1}, $classDescriptor-><init>()V
|
invoke-direct {v0}, $classDescriptor-><init>()V
|
||||||
${getConstString(2, filterCount++)}
|
const/16 v2, ${filterCount++}
|
||||||
aput-object v1, v0, v2
|
aput-object v0, v1, v2
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -76,17 +75,17 @@ class LithoFilterPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun close() = LithoFilterFingerprint.result!!
|
override fun close() = LithoFilterFingerprint.result!!
|
||||||
.mutableMethod.replaceInstruction(0, getConstString(0, filterCount))
|
.mutableMethod.addInstructions(
|
||||||
|
0, """
|
||||||
|
const/16 v1, $filterCount
|
||||||
|
new-array v1, v1, [Lapp/revanced/integrations/patches/ads/Filter;
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
internal lateinit var addFilter: (String) -> Unit
|
internal lateinit var addFilter: (String) -> Unit
|
||||||
private set
|
private set
|
||||||
|
|
||||||
private var filterCount = 0
|
private var filterCount = 0
|
||||||
|
|
||||||
private fun getConstString(
|
|
||||||
register: Int,
|
|
||||||
count: Int
|
|
||||||
): String = if (count >= 8) "const/16 v$register, $count" else "const/4 v$register, $count"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user