fix: amoled patch changes other areas to black color besides the flyout panel https://github.com/inotia00/ReVanced_Extended/issues/750

This commit is contained in:
inotia00 2023-04-17 09:18:37 +09:00
parent 9e9f10377b
commit 4d58acf94a
3 changed files with 1 additions and 71 deletions

View File

@ -1,19 +0,0 @@
package app.revanced.patches.music.layout.amoled.bytecode.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 LithoThemeFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PROTECTED or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.IF_NEZ,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID
),
customFingerprint = { it.name == "onBoundsChange" }
)

View File

@ -1,42 +0,0 @@
package app.revanced.patches.music.layout.amoled.bytecode.patch
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.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.patches.music.layout.amoled.bytecode.fingerprints.LithoThemeFingerprint
import app.revanced.util.integrations.Constants.UTILS_PATH
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Name("amoled-bytecode-patch")
@YouTubeMusicCompatibility
@Version("0.0.1")
class AmoledBytecodePatch : BytecodePatch(
listOf(
LithoThemeFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
LithoThemeFingerprint.result?.let {
with (it.mutableMethod) {
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1
val register = (implementation!!.instructions[insertIndex] as Instruction35c).registerD
addInstructions(
insertIndex, """
invoke-static { v$register }, $UTILS_PATH/LithoThemePatch;->applyLithoTheme(I)I
move-result v$register
"""
)
}
} ?: return LithoThemeFingerprint.toErrorResult()
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.amoled.resource.patch
package app.revanced.patches.music.layout.amoled.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
@ -7,22 +7,13 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.layout.amoled.bytecode.patch.AmoledBytecodePatch
import app.revanced.patches.music.misc.integrations.patch.MusicIntegrationsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import org.w3c.dom.Element
@Patch
@Name("amoled")
@Description("Applies pure black theme in flyout panels.")
@DependsOn(
[
AmoledBytecodePatch::class,
MusicIntegrationsPatch::class
]
)
@YouTubeMusicCompatibility
@Version("0.0.1")
class AmoledPatch : ResourcePatch {