mirror of
https://github.com/revanced/revanced-patches
synced 2024-09-01 20:15:45 +02:00
fix: attempt on all patches
This commit is contained in:
parent
e088c67108
commit
3395d69747
@ -24,7 +24,7 @@ repositories {
|
||||
dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.10")
|
||||
|
||||
implementation("app.revanced:revanced-patcher:1.+") // use latest version.
|
||||
implementation(files("P:\\Andere Dateien\\STUFF\\Coding\\Java\\revanced\\revanced-patcher\\build\\libs\\revanced-patcher-1.0.0-dev.8.jar")) // use latest version.
|
||||
implementation("org.smali:dexlib2:2.5.2")
|
||||
}
|
||||
|
||||
|
@ -18,17 +18,17 @@ class VideoAds : Patch("VideoAds") {
|
||||
"show-video-ads-method",
|
||||
"V",
|
||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
setOf("Z"),
|
||||
arrayOf("Z"),
|
||||
null
|
||||
)
|
||||
) ?: return PatchResultError("Could not find required method to patch")
|
||||
|
||||
// Override the parameter by calling shouldShowAds and setting the parameter to the result
|
||||
map.resolveAndGetMethod().implementation!!.addInstructions(
|
||||
map.method.implementation!!.addInstructions(
|
||||
0,
|
||||
"""
|
||||
invoke-static { }, Lfi/vanced/libraries/youtube/whitelisting/Whitelist;->shouldShowAds()Z
|
||||
move-result v0
|
||||
move-result v1
|
||||
""".trimIndent().asInstructions()
|
||||
)
|
||||
|
||||
|
@ -7,10 +7,10 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.smali.asInstructions
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction11n
|
||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
||||
import org.jf.dexlib2.iface.Method
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction11n
|
||||
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference
|
||||
|
||||
class EnableSeekbarTapping : Patch("enable-seekbar-tapping") {
|
||||
@ -20,23 +20,26 @@ class EnableSeekbarTapping : Patch("enable-seekbar-tapping") {
|
||||
val tapSeekMethods = mutableMapOf<String, Method>()
|
||||
|
||||
// find the methods which tap the seekbar
|
||||
map.definingClassProxy.immutableClass.methods.forEach {
|
||||
for (it in map.definingClassProxy.immutableClass.methods) {
|
||||
if (it.implementation == null) continue
|
||||
|
||||
val instructions = it.implementation!!.instructions
|
||||
// here we make sure we actually find the method because it has more then 7 instructions
|
||||
if (instructions.count() < 7) return@forEach
|
||||
if (instructions.count() < 7) continue
|
||||
|
||||
// we know that the 7th instruction has the opcode CONST_4
|
||||
val instruction = instructions.elementAt(6)
|
||||
if (instruction.opcode != Opcode.CONST_4) return@forEach
|
||||
if (instruction.opcode != Opcode.CONST_4) continue
|
||||
|
||||
// the literal for this instruction has to be either 1 or 2
|
||||
val literal = (instruction as BuilderInstruction11n).narrowLiteral
|
||||
val literal = (instruction as Instruction11n).narrowLiteral
|
||||
|
||||
// method founds
|
||||
if (literal == 1) tapSeekMethods["P"] = it
|
||||
if (literal == 2) tapSeekMethods["O"] = it
|
||||
}
|
||||
val implementation = cache.methodMap["enable-seekbar-tapping"].resolveAndGetMethod().implementation!!
|
||||
|
||||
val implementation = cache.methodMap["enable-seekbar-tapping"].method.implementation!!
|
||||
|
||||
// if tap-seeking is enabled, do not invoke the two methods below
|
||||
val pMethod = tapSeekMethods["P"]!!
|
||||
@ -78,7 +81,7 @@ class EnableSeekbarTapping : Patch("enable-seekbar-tapping") {
|
||||
)
|
||||
|
||||
// if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label
|
||||
val elseLabel = implementation.instructions[7].location.labels.first()
|
||||
val elseLabel = implementation.newLabelForIndex(map.scanData.endIndex)
|
||||
implementation.addInstruction(
|
||||
map.scanData.endIndex,
|
||||
BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel)
|
||||
|
@ -11,7 +11,7 @@ class CreateButtonRemover : Patch("create-button-remover") {
|
||||
val map = cache.methodMap["create-button-patch"]
|
||||
|
||||
// Hide the button view via proxy by passing it to the hideCreateButton method
|
||||
map.resolveAndGetMethod().implementation!!.addInstruction(
|
||||
map.method.implementation!!.addInstruction(
|
||||
map.scanData.endIndex,
|
||||
"invoke-static { v6 }, Lfi/razerman/youtube/XAdRemover;->hideCreateButton(Landroid/view/View;)V".asInstruction()
|
||||
)
|
||||
|
@ -8,7 +8,7 @@ import app.revanced.patcher.smali.asInstruction
|
||||
|
||||
class HideReels : Patch("hide-reels") {
|
||||
override fun execute(cache: Cache): PatchResult {
|
||||
val implementation = cache.methodMap["hide-reel-patch"].resolveAndGetMethod().implementation!!
|
||||
val implementation = cache.methodMap["hide-reel-patch"].method.implementation!!
|
||||
|
||||
// HideReel will hide the reel view before it is being used,
|
||||
// so we pass the view to the HideReel method
|
||||
|
@ -18,12 +18,12 @@ class HideSuggestions : Patch("hide-suggestions") {
|
||||
MethodSignature(
|
||||
"hide-suggestions-method",
|
||||
"V",
|
||||
AccessFlags.PUBLIC or AccessFlags.PUBLIC,
|
||||
setOf("Z"),
|
||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
arrayOf("Z"),
|
||||
arrayOf(
|
||||
Opcode.IPUT_BOOLEAN,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IPUT_BOOLEAN,
|
||||
Opcode.IGET_BOOLEAN,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.RETURN_VOID
|
||||
)
|
||||
@ -31,7 +31,7 @@ class HideSuggestions : Patch("hide-suggestions") {
|
||||
) ?: return PatchResultError("Parent method hide-suggestions-method has not been found")
|
||||
|
||||
// Proxy the first parameter by passing it to the RemoveSuggestions method
|
||||
map.resolveAndGetMethod().implementation!!.addInstructions(
|
||||
map.method.implementation!!.addInstructions(
|
||||
0,
|
||||
"""
|
||||
invoke-static { p1 }, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
|
||||
|
@ -12,7 +12,7 @@ class MinimizedPlayback : Patch("minimized-playback") {
|
||||
// Instead of removing all instructions like Vanced,
|
||||
// we return the method at the beginning instead
|
||||
cache.methodMap["minimized-playback-manager"]
|
||||
.resolveAndGetMethod()
|
||||
.method
|
||||
.implementation!!
|
||||
.addInstruction(
|
||||
0,
|
||||
|
@ -19,18 +19,20 @@ class OldQualityLayout : Patch("old-quality-restore") {
|
||||
"old-quality-patch-method",
|
||||
"L",
|
||||
AccessFlags.FINAL or AccessFlags.PUBLIC,
|
||||
emptySet(),
|
||||
emptyArray(),
|
||||
arrayOf(
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.IGET,
|
||||
Opcode.CONST_4,
|
||||
Opcode.IF_NE
|
||||
Opcode.IF_NE,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.GOTO,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.RETURN_OBJECT
|
||||
)
|
||||
)
|
||||
) ?: return PatchResultError("Parent method old-quality-patch-method has not been found")
|
||||
|
||||
|
||||
val implementation = map.resolveAndGetMethod().implementation!!
|
||||
val implementation = map.method.implementation!!
|
||||
|
||||
// if useOldStyleQualitySettings == true, jump over all instructions and return the field at the end
|
||||
val jmpInstruction =
|
||||
|
Loading…
Reference in New Issue
Block a user