mirror of
https://github.com/revanced/revanced-patches
synced 2025-01-05 04:15:49 +01:00
fix: constrain old-quality-layout
to older version
This commit is contained in:
parent
d1c7edfc87
commit
add7232619
@ -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)
|
||||
|
@ -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
|
||||
"""
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user