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