build(integration): update gradle and dependency

This commit is contained in:
inotia00 2023-09-05 09:42:49 +09:00
parent c00af81a9b
commit 02b54cab2c
2 changed files with 30 additions and 31 deletions

View File

@ -4,7 +4,6 @@ import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
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.annotations.DependsOn
import app.revanced.patches.music.utils.annotations.MusicCompatibility
@ -22,36 +21,37 @@ class LithoFilterPatch : BytecodePatch(
override fun execute(context: BytecodeContext) {
identifierHook("$MUSIC_ADS_PATH/LithoFilterPatch;->filter")
LithoFilterFingerprint.result?.mutableMethod?.apply {
removeInstructions(2, 4) // Remove dummy filter.
LithoFilterFingerprint.result?.let {
it.mutableMethod.apply {
removeInstructions(0, 6)
addFilter = { classDescriptor ->
addInstructions(
2,
"""
new-instance v1, $classDescriptor
invoke-direct {v1}, $classDescriptor-><init>()V
${getConstString(2, filterCount++)}
aput-object v1, v0, v2
addFilter = { classDescriptor ->
addInstructions(
0, """
new-instance v0, $classDescriptor
invoke-direct {v0}, $classDescriptor-><init>()V
const/16 v2, ${filterCount++}
aput-object v0, v1, v2
"""
)
)
}
}
} ?: throw LithoFilterFingerprint.exception
}
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 {
internal lateinit var addFilter: (String) -> Unit
private set
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"
}
}

View File

@ -5,7 +5,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
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.annotations.DependsOn
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
@ -59,15 +58,15 @@ class LithoFilterPatch : BytecodePatch(
generalHook("$ADS_PATH/LithoFilterPatch;->filters")
LithoFilterFingerprint.result?.mutableMethod?.apply {
removeInstructions(2, 4) // Remove dummy filter.
removeInstructions(0, 6)
addFilter = { classDescriptor ->
addInstructions(
2, """
new-instance v1, $classDescriptor
invoke-direct {v1}, $classDescriptor-><init>()V
${getConstString(2, filterCount++)}
aput-object v1, v0, v2
0, """
new-instance v0, $classDescriptor
invoke-direct {v0}, $classDescriptor-><init>()V
const/16 v2, ${filterCount++}
aput-object v0, v1, v2
"""
)
}
@ -76,17 +75,17 @@ class LithoFilterPatch : BytecodePatch(
}
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 {
internal lateinit var addFilter: (String) -> Unit
private set
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"
}
}