mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-09 19:09:22 +01:00
feat(youtube): support version 18.16.37
This commit is contained in:
parent
795f7d37e6
commit
8beb5ea860
@ -7,5 +7,17 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object MiniPlayerOverrideFingerprint : MethodFingerprint(
|
||||
"Z", AccessFlags.STATIC or AccessFlags.PUBLIC,
|
||||
opcodes = listOf(Opcode.RETURN), // anchor to insert the instruction
|
||||
listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.CONST_4,
|
||||
Opcode.IF_EQ,
|
||||
Opcode.CONST_4,
|
||||
Opcode.IF_EQ,
|
||||
Opcode.CONST_4, // override this value
|
||||
Opcode.RETURN,
|
||||
Opcode.CONST_4, // override this value
|
||||
Opcode.RETURN
|
||||
),
|
||||
)
|
@ -1,13 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
|
||||
object MiniPlayerOverrideParentFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
parameters = listOf("L"),
|
||||
strings = listOf("PLAYBACK_RATE_MENU_BOTTOM_SHEET_FRAGMENT")
|
||||
strings = listOf("Possible Context wrapper loop - chain of wrappers larger than 10000")
|
||||
)
|
@ -10,6 +10,7 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -20,6 +21,7 @@ import app.revanced.patches.youtube.layout.tabletminiplayer.annotations.TabletMi
|
||||
import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.*
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@ -68,10 +70,28 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
MiniPlayerOverrideParentFingerprint.result?.let {
|
||||
if (!MiniPlayerOverrideFingerprint.resolve(context, it.classDef))
|
||||
throw MiniPlayerOverrideFingerprint.toErrorResult()
|
||||
|
||||
MiniPlayerOverrideFingerprint.addProxyCall()
|
||||
} ?: return MiniPlayerOverrideParentFingerprint.toErrorResult()
|
||||
|
||||
/*
|
||||
* Override every return instruction with the proxy call.
|
||||
*/
|
||||
MiniPlayerOverrideFingerprint.result!!.mutableMethod.apply {
|
||||
implementation!!.let { implementation ->
|
||||
val returnIndices = implementation.instructions
|
||||
.withIndex()
|
||||
.filter { (_, instruction) -> instruction.opcode == Opcode.RETURN }
|
||||
.map { (index, _) -> index }
|
||||
|
||||
if (returnIndices.isEmpty()) throw PatchResultError("No return instructions found.")
|
||||
|
||||
// This method clobbers register p0 to return the value, calculate to override.
|
||||
val returnedRegister = implementation.registerCount - parameters.size
|
||||
|
||||
// Hook the returned register on every return instruction.
|
||||
returnIndices.forEach { index -> insertOverride(index, returnedRegister) }
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Size check return value override.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user