generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: OldQualityLayout, HideSuggestions, HideReels, EnableSeekbarTapping
- Loading branch information
Showing
8 changed files
with
193 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tlin/app/revanced/patches/ads/VideoAds.kt → ...otlin/app/revanced/patches/ad/VideoAds.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/kotlin/app/revanced/patches/interaction/EnableSeekbarTapping.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package app.revanced.patches.interaction | ||
|
||
import app.revanced.patcher.cache.Cache | ||
import app.revanced.patcher.patch.Patch | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.writer.ASMWriter.insertAt | ||
import org.objectweb.asm.Opcodes | ||
import org.objectweb.asm.tree.* | ||
|
||
class EnableSeekbarTapping : Patch("enable-seekbar-tapping") { | ||
override fun execute(cache: Cache): PatchResult { | ||
val patchData = cache.methods["enable-seekbar-tapping"] | ||
val methodOPatchData = cache.methods["enable-seekbar-tapping-method-o"] | ||
val methodPPatchData = cache.methods["enable-seekbar-tapping-method-p"] | ||
|
||
val elseLabel = LabelNode() | ||
patchData.method.instructions.insertAt( | ||
patchData.scanData.endIndex, | ||
InsnNode(Opcodes.ACONST_NULL), | ||
MethodInsnNode( | ||
Opcodes.INVOKESTATIC, | ||
"fi/razerman/youtube/preferences/BooleanPreferences", | ||
"isTapSeekingEnabled", | ||
"()Z" | ||
), | ||
JumpInsnNode(Opcodes.IFEQ, elseLabel), | ||
VarInsnNode(Opcodes.ALOAD, 0), | ||
VarInsnNode(Opcodes.ILOAD, 6), | ||
MethodInsnNode( | ||
Opcodes.INVOKEVIRTUAL, | ||
methodOPatchData.declaringClass.name, | ||
methodOPatchData.method.name, | ||
"(I)V" | ||
), | ||
VarInsnNode(Opcodes.ALOAD, 0), | ||
VarInsnNode(Opcodes.ILOAD, 6), | ||
MethodInsnNode( | ||
Opcodes.INVOKEVIRTUAL, | ||
methodPPatchData.declaringClass.name, | ||
methodPPatchData.method.name, | ||
"(I)V" | ||
), | ||
elseLabel | ||
) | ||
|
||
return PatchResultSuccess() | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ed/patches/layouts/CreateButtonRemover.kt → ...ced/patches/layout/CreateButtonRemover.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package app.revanced.patches.layout | ||
|
||
import app.revanced.patcher.cache.Cache | ||
import app.revanced.patcher.patch.Patch | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.writer.ASMWriter.insertAt | ||
import org.objectweb.asm.Opcodes | ||
import org.objectweb.asm.tree.MethodInsnNode | ||
import org.objectweb.asm.tree.VarInsnNode | ||
|
||
class HideReels : Patch("hide-reels") { | ||
override fun execute(cache: Cache): PatchResult { | ||
val patchData = cache.methods["hide-reel-patch"] | ||
|
||
patchData.method.instructions.insertAt( | ||
patchData.scanData.endIndex + 1, | ||
VarInsnNode(Opcodes.ALOAD, 18), | ||
MethodInsnNode( | ||
Opcodes.INVOKESTATIC, | ||
"fi/razerman/youtube/XAdRemover", | ||
"HideReels", | ||
"(Landroid/view/View;)V" | ||
) | ||
) | ||
|
||
return PatchResultSuccess() | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/main/kotlin/app/revanced/patches/layout/HideSuggestions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package app.revanced.patches.layout | ||
|
||
import app.revanced.patcher.cache.Cache | ||
import app.revanced.patcher.patch.Patch | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultError | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.signature.Signature | ||
import app.revanced.patcher.writer.ASMWriter.insertAt | ||
import org.objectweb.asm.Opcodes | ||
import org.objectweb.asm.Type | ||
import org.objectweb.asm.tree.MethodInsnNode | ||
import org.objectweb.asm.tree.VarInsnNode | ||
|
||
class HideSuggestions : Patch("hide-suggestions") { | ||
override fun execute(cache: Cache): PatchResult { | ||
val method = cache.methods["hide-suggestions-patch"].findParentMethod( | ||
Signature( | ||
"hide-suggestions-method", | ||
Type.VOID_TYPE, | ||
Opcodes.ACC_PUBLIC or Opcodes.ACC_FINAL, | ||
arrayOf(Type.BOOLEAN_TYPE), | ||
arrayOf( | ||
Opcodes.ALOAD, | ||
Opcodes.ILOAD, | ||
Opcodes.PUTFIELD, | ||
Opcodes.ALOAD, | ||
Opcodes.GETFIELD | ||
) | ||
) | ||
) ?: return PatchResultError("Parent method hide-suggestions-method has not been found") | ||
|
||
method.method.instructions.insertAt( | ||
0, | ||
VarInsnNode(Opcodes.ILOAD, 1), | ||
MethodInsnNode( | ||
Opcodes.INVOKESTATIC, | ||
"java/lang/Boolean", | ||
"valueOf", | ||
"(Z)Ljava/lang/Boolean" | ||
), | ||
MethodInsnNode( | ||
Opcodes.INVOKESTATIC, | ||
"fi/razerman/youtube/XAdRemover", | ||
"HideReels", | ||
"(Landroid/view/View;)V" | ||
) | ||
) | ||
|
||
return PatchResultSuccess() | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...nced/patches/layouts/MinimizedPlayback.kt → ...anced/patches/layout/MinimizedPlayback.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/main/kotlin/app/revanced/patches/layout/OldQualityLayout.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package app.revanced.patches.layout | ||
|
||
import app.revanced.patcher.cache.Cache | ||
import app.revanced.patcher.patch.Patch | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultError | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.signature.Signature | ||
import app.revanced.patcher.util.ExtraTypes | ||
import app.revanced.patcher.writer.ASMWriter.insertAt | ||
import org.objectweb.asm.Opcodes | ||
import org.objectweb.asm.tree.JumpInsnNode | ||
import org.objectweb.asm.tree.MethodInsnNode | ||
import org.objectweb.asm.tree.VarInsnNode | ||
|
||
class OldQualityLayout : Patch("old-quality-restore") { | ||
override fun execute(cache: Cache): PatchResult { | ||
val method = cache.methods["old-quality-patch"].findParentMethod( | ||
Signature( | ||
"old-quality-patch-method", | ||
ExtraTypes.Any, | ||
Opcodes.ACC_PUBLIC or Opcodes.ACC_FINAL, | ||
arrayOf(), | ||
arrayOf( | ||
Opcodes.ALOAD, | ||
Opcodes.GETFIELD, | ||
Opcodes.ISTORE, | ||
Opcodes.ICONST_3, | ||
Opcodes.ISTORE | ||
) | ||
) | ||
) ?: return PatchResultError("Parent method old-quality-patch-method has not been found") | ||
|
||
method.method.instructions.insertAt( | ||
0, | ||
MethodInsnNode( | ||
Opcodes.INVOKESTATIC, | ||
"fi/razerman/youtube/XGlobals", | ||
"useOldStyleQualitySettings", | ||
"()Z" | ||
), | ||
VarInsnNode(Opcodes.ISTORE, 1), | ||
VarInsnNode(Opcodes.ILOAD, 1), | ||
JumpInsnNode( | ||
Opcodes.IFNE, | ||
(method.method.instructions[method.scanData.endIndex + 3] as JumpInsnNode).label | ||
), | ||
) | ||
|
||
return PatchResultSuccess() | ||
} | ||
} |