fix: constrain old-quality-layout to older version

This commit is contained in:
oSumAtrIX 2022-07-13 13:36:09 +02:00
parent d1c7edfc87
commit add7232619
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 13 additions and 5 deletions

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35")
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35")
)]
)
@Target(AnnotationTarget.CLASS)

View File

@ -37,15 +37,23 @@ class OldQualityLayoutPatch : BytecodePatch(
val implementation = result.mutableMethod.implementation!!
// use this register because it is free
val containerRegister = 5
// if useOldStyleQualitySettings == true, jump over all instructions
val jmpInstruction = BuilderInstruction21t(
Opcode.IF_NEZ, 0, implementation.instructions[result.patternScanResult!!.endIndex].location.labels.first()
implementation.addInstruction(
4, BuilderInstruction21t(
Opcode.IF_NEZ,
containerRegister,
implementation.instructions[result.patternScanResult!!.endIndex].location.labels.first()
)
)
implementation.addInstruction(5, jmpInstruction)
// insert the new condition
result.mutableMethod.addInstructions(
0, """
invoke-static { }, Lapp/revanced/integrations/patches/OldStyleQualityPatch;->useOldStyleQualitySettings()Z
move-result v0
move-result v$containerRegister
"""
)