mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-17 06:47:15 +02:00
add support YouTube v18.19.36, v18.20.39, v18.21.35, v18.22.37
This commit is contained in:
parent
aceaf2dade
commit
8f11b4e327
@ -6,12 +6,10 @@ import app.revanced.patcher.annotation.Package
|
|||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.youtube", arrayOf(
|
"com.google.android.youtube", arrayOf(
|
||||||
"18.12.35",
|
"18.19.36",
|
||||||
"18.13.38",
|
"18.20.39",
|
||||||
"18.14.41",
|
"18.21.35",
|
||||||
"18.15.40",
|
"18.22.37"
|
||||||
"18.16.39",
|
|
||||||
"18.17.43"
|
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.layoutswitch.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object ClientFormFactorWalkerFingerprint : MethodFingerprint(
|
||||||
|
returnType = "L",
|
||||||
|
parameters = listOf(),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.RETURN_OBJECT
|
||||||
|
)
|
||||||
|
)
|
@ -5,6 +5,7 @@ import app.revanced.patcher.annotation.Description
|
|||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
@ -14,12 +15,16 @@ import app.revanced.patcher.patch.PatchResult
|
|||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.shared.fingerprints.LayoutSwitchFingerprint
|
import app.revanced.patches.shared.fingerprints.LayoutSwitchFingerprint
|
||||||
import app.revanced.patches.youtube.misc.layoutswitch.fingerprints.*
|
import app.revanced.patches.youtube.misc.layoutswitch.fingerprints.ClientFormFactorFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.layoutswitch.fingerprints.ClientFormFactorParentFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.layoutswitch.fingerprints.ClientFormFactorWalkerFingerprint
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.integrations.Constants.MISC_PATH
|
import app.revanced.util.integrations.Constants.MISC_PATH
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("layout-switch")
|
@Name("layout-switch")
|
||||||
@ -35,19 +40,36 @@ class LayoutSwitchPatch : BytecodePatch(
|
|||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
ClientFormFactorParentFingerprint.result?.let { parentResult ->
|
fun MutableMethod.injectTabletLayout(jumpIndex: Int) {
|
||||||
ClientFormFactorFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
|
||||||
it.mutableMethod.apply {
|
|
||||||
val jumpIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
|
||||||
addInstructionsWithLabels(
|
addInstructionsWithLabels(
|
||||||
1, """
|
0, """
|
||||||
invoke-static {}, $MISC_PATH/LayoutOverridePatch;->enableTabletLayout()Z
|
invoke-static {}, $MISC_PATH/LayoutOverridePatch;->enableTabletLayout()Z
|
||||||
move-result v2
|
move-result v0
|
||||||
if-nez v2, :tablet_layout
|
if-nez v0, :tablet_layout
|
||||||
""", ExternalLabel("tablet_layout", getInstruction(jumpIndex))
|
""", ExternalLabel("tablet_layout", getInstruction(jumpIndex))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: return ClientFormFactorFingerprint.toErrorResult()
|
|
||||||
|
ClientFormFactorParentFingerprint.result?.classDef?.let { classDef ->
|
||||||
|
try {
|
||||||
|
ClientFormFactorFingerprint.also { it.resolve(context, classDef) }.result!!.apply {
|
||||||
|
mutableMethod.injectTabletLayout(scanResult.patternScanResult!!.startIndex + 1)
|
||||||
|
}
|
||||||
|
} catch (_: Exception) {
|
||||||
|
ClientFormFactorWalkerFingerprint.also { it.resolve(context, classDef) }.result?.let {
|
||||||
|
(context
|
||||||
|
.toMethodWalker(it.method)
|
||||||
|
.nextMethod(it.scanResult.patternScanResult!!.startIndex, true)
|
||||||
|
.getMethod() as MutableMethod).apply {
|
||||||
|
|
||||||
|
val jumpIndex = implementation!!.instructions.indexOfFirst { instruction ->
|
||||||
|
instruction.opcode == Opcode.RETURN_OBJECT
|
||||||
|
} - 1
|
||||||
|
|
||||||
|
injectTabletLayout(jumpIndex)
|
||||||
|
}
|
||||||
|
} ?: return ClientFormFactorWalkerFingerprint.toErrorResult()
|
||||||
|
}
|
||||||
} ?: return ClientFormFactorParentFingerprint.toErrorResult()
|
} ?: return ClientFormFactorParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
LayoutSwitchFingerprint.result?.mutableMethod?.addInstructions(
|
LayoutSwitchFingerprint.result?.mutableMethod?.addInstructions(
|
||||||
@ -57,7 +79,7 @@ class LayoutSwitchPatch : BytecodePatch(
|
|||||||
"""
|
"""
|
||||||
) ?: return LayoutSwitchFingerprint.toErrorResult()
|
) ?: return LayoutSwitchFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*(
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
SettingsPatch.addPreference(
|
SettingsPatch.addPreference(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user