download comment images w/o watermark
This commit is contained in:
parent
e4cfa15efc
commit
6c2b836aa8
2 changed files with 40 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ import app.revanced.util.returnEarly
|
|||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/tiktok/download/DownloadsPatch;"
|
||||
|
|
@ -61,6 +62,39 @@ val downloadsPatch = bytecodePatch(
|
|||
)
|
||||
}
|
||||
|
||||
commentImageWatermarkFingerprint.method.apply {
|
||||
val drawBitmapIndex = findInstructionIndicesReversedOrThrow {
|
||||
opcode.name == "invoke-virtual" &&
|
||||
this is ReferenceInstruction &&
|
||||
reference.toString().contains("->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V")
|
||||
}.first()
|
||||
|
||||
val drawInstr = getInstruction<FiveRegisterInstruction>(drawBitmapIndex)
|
||||
val canvasReg = drawInstr.registerC
|
||||
val bitmapReg = drawInstr.registerD
|
||||
val xReg = drawInstr.registerE
|
||||
val yReg = drawInstr.registerF
|
||||
val paintReg = drawInstr.registerG
|
||||
|
||||
removeInstructions(drawBitmapIndex, 1)
|
||||
|
||||
addInstructionsWithLabels(
|
||||
drawBitmapIndex,
|
||||
"""
|
||||
invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->shouldRemoveWatermark()Z
|
||||
move-result v$xReg
|
||||
|
||||
if-nez v$xReg, :skip_watermark
|
||||
|
||||
const/4 v$xReg, 0x0
|
||||
invoke-virtual {v$canvasReg, v$bitmapReg, v$xReg, v$yReg, v$paintReg}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V
|
||||
|
||||
:skip_watermark
|
||||
nop
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
downloadUriFingerprint.method.apply {
|
||||
findInstructionIndicesReversedOrThrow {
|
||||
getReference<FieldReference>().let {
|
||||
|
|
|
|||
|
|
@ -54,3 +54,9 @@ internal val awemeGetVideoFingerprint = fingerprint {
|
|||
method.parameterTypes.isEmpty()
|
||||
}
|
||||
}
|
||||
|
||||
internal val commentImageWatermarkFingerprint = fingerprint {
|
||||
strings("[tiktok_logo]", "image/jpeg", "is_pending")
|
||||
parameters("Landroid/graphics/Bitmap;")
|
||||
returns("V")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue