mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
feat(music/amoled): patch now applies the amoled theme to the comment input box as well
This commit is contained in:
@ -3,7 +3,7 @@ package app.revanced.patches.youtube.layout.theme.patch
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.youtube.utils.litho.patch.LithoThemePatch
|
||||
import app.revanced.patches.shared.patch.litho.LithoThemePatch
|
||||
import app.revanced.util.integrations.Constants.UTILS_PATH
|
||||
import org.w3c.dom.Element
|
||||
|
||||
|
@ -11,11 +11,11 @@ import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.shared.patch.litho.LithoThemePatch
|
||||
import app.revanced.patches.youtube.seekbar.seekbarcolor.fingerprints.ControlsOverlayStyleFingerprint
|
||||
import app.revanced.patches.youtube.seekbar.seekbarcolor.fingerprints.PlayerSeekbarColorFingerprint
|
||||
import app.revanced.patches.youtube.seekbar.seekbarcolor.fingerprints.ShortsSeekbarColorFingerprint
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.litho.patch.LithoThemePatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.InlineTimeBarColorizedBarPlayedColorDark
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.InlineTimeBarPlayedNotHighlightedColor
|
||||
|
@ -1,19 +0,0 @@
|
||||
package app.revanced.patches.youtube.utils.litho.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object LithoThemeFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL, // Paint.setColor: inject point
|
||||
Opcode.RETURN_VOID
|
||||
),
|
||||
customFingerprint = { methodDef, _ -> methodDef.name == "onBoundsChange" }
|
||||
)
|
@ -1,56 +0,0 @@
|
||||
package app.revanced.patches.youtube.utils.litho.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.youtube.utils.litho.fingerprints.LithoThemeFingerprint
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
class LithoThemePatch : BytecodePatch(
|
||||
listOf(
|
||||
LithoThemeFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
LithoThemeFingerprint.result?.mutableMethod?.let {
|
||||
with(it.implementation!!.instructions) {
|
||||
for (index in size - 1 downTo 0) {
|
||||
val invokeInstruction = this[index] as? ReferenceInstruction ?: continue
|
||||
if ((invokeInstruction.reference as MethodReference).name != "setColor") continue
|
||||
insertIndex = index
|
||||
insertRegister = (this[index] as Instruction35c).registerD
|
||||
insertMethod = it
|
||||
break
|
||||
}
|
||||
}
|
||||
} ?: throw LithoThemeFingerprint.exception
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
private var offset = 0
|
||||
|
||||
private var insertIndex: Int = 0
|
||||
private var insertRegister: Int = 0
|
||||
private lateinit var insertMethod: MutableMethod
|
||||
|
||||
|
||||
fun injectCall(
|
||||
methodDescriptor: String
|
||||
) {
|
||||
insertMethod.addInstructions(
|
||||
insertIndex + offset, """
|
||||
invoke-static {v$insertRegister}, $methodDescriptor
|
||||
move-result v$insertRegister
|
||||
"""
|
||||
)
|
||||
offset += 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user