Compare commits

...

23 Commits

Author SHA1 Message Date
semantic-release-bot
636aac1a28 chore(release): 1.10.2 [skip ci]
## [1.10.2](https://github.com/revanced/revanced-patches/compare/v1.10.1...v1.10.2) (2022-06-23)

### Bug Fixes

* `disable-create-button` not working with prebuilt jar file ([#55](https://github.com/revanced/revanced-patches/issues/55)) ([8ff6c15](8ff6c159fa))
2022-06-23 13:07:52 +00:00
Itroublve
8ff6c159fa fix: disable-create-button not working with prebuilt jar file (#55) 2022-06-23 15:06:00 +02:00
semantic-release-bot
a84766aad9 chore(release): 1.10.1 [skip ci]
## [1.10.1](https://github.com/revanced/revanced-patches/compare/v1.10.0...v1.10.1) (2022-06-23)

### Bug Fixes

* patcher not propagating dexlib ([a120be4](a120be4a79))
* update patcher version ([8cba2c0](8cba2c0f8f))
2022-06-23 10:25:07 +00:00
Sculas
a120be4a79 fix: patcher not propagating dexlib 2022-06-23 12:23:31 +02:00
Sculas
8cba2c0f8f fix: update patcher version 2022-06-23 12:15:00 +02:00
Itroublve
579297efa3 refactor: Migrate to new extension methods for String.toInstruction(...) and String.toInstructions(...) (#45) 2022-06-23 02:22:42 +02:00
semantic-release-bot
9094a69be8 chore(release): 1.10.0 [skip ci]
# [1.10.0](https://github.com/revanced/revanced-patches/compare/v1.9.1...v1.10.0) (2022-06-23)

### Features

* add compatibility for YouTube v17.23.36 and v17.24.34 ([20c77c1](20c77c1769))
2022-06-23 00:21:14 +00:00
Joey Peter
20c77c1769 feat: add compatibility for YouTube v17.23.36 and v17.24.34 2022-06-23 02:19:35 +02:00
semantic-release-bot
fcc450efb4 chore(release): 1.9.1 [skip ci]
## [1.9.1](https://github.com/revanced/revanced-patches/compare/v1.9.0...v1.9.1) (2022-06-21)

### Bug Fixes

* update patcher version ([f02e8b1](f02e8b13ac))
2022-06-21 22:03:16 +00:00
Sculas
f02e8b13ac fix: update patcher version 2022-06-22 00:01:36 +02:00
semantic-release-bot
4c4f7adbce chore(release): 1.9.0 [skip ci]
# [1.9.0](https://github.com/revanced/revanced-patches/compare/v1.8.2...v1.9.0) (2022-06-21)

### Features

* use `install` mode by default ([6662be8](6662be893c))
2022-06-21 16:44:01 +00:00
oSumAtrIX
6662be893c feat: use install mode by default 2022-06-21 18:30:06 +02:00
semantic-release-bot
41cf8e3fa9 chore(release): 1.8.2 [skip ci]
## [1.8.2](https://github.com/revanced/revanced-patches/compare/v1.8.1...v1.8.2) (2022-06-20)

### Bug Fixes

* migrate to breaking changes from patcher ([e002818](e00281819c))
* old usage of `toInstructions` extension method ([aec1602](aec1602a39))
2022-06-20 19:35:33 +00:00
oSumAtrIX
aec1602a39 fix: old usage of toInstructions extension method 2022-06-20 21:33:45 +02:00
oSumAtrIX
e00281819c fix: migrate to breaking changes from patcher 2022-06-20 21:29:55 +02:00
oSumAtrIX
48cf778d56 refactor: improve microg-support reference patches 2022-06-20 21:29:54 +02:00
semantic-release-bot
e6506bd4b4 chore(release): 1.8.1 [skip ci]
## [1.8.1](https://github.com/revanced/revanced-patches/compare/v1.8.0...v1.8.1) (2022-06-20)

### Bug Fixes

* add execute permission to `./gradlew` file ([3a29b6d](3a29b6db64))
2022-06-20 17:19:31 +00:00
MedzikUser
3a29b6db64 fix: add execute permission to ./gradlew file 2022-06-20 19:17:54 +02:00
semantic-release-bot
cecee8f70e chore(release): 1.8.0 [skip ci]
# [1.8.0](https://github.com/revanced/revanced-patches/compare/v1.7.0...v1.8.0) (2022-06-20)

### Features

* bump compatibility of patches for Youtube to v17.23.35 ([e5cad5f](e5cad5f022))
2022-06-20 08:56:19 +00:00
oSumAtrIX
e5cad5f022 feat: bump compatibility of patches for Youtube to v17.23.35 2022-06-20 10:54:37 +02:00
TheJeterLP
85e584f65a fix double character 2022-06-20 10:30:07 +02:00
TheJeterLP
78fe1b67ea bump youtube version to 12.23.35 2022-06-20 10:25:59 +02:00
Joey Peter
9c33d67d80 Update GeneralAdsCompatibility.kt 2022-06-20 10:20:19 +02:00
36 changed files with 158 additions and 110 deletions

View File

@@ -12,7 +12,7 @@ on:
jobs: jobs:
release: release:
name: Release name: Release
runs-on: ubuntu-latest runs-on: ubuntu-18.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@@ -30,8 +30,6 @@ jobs:
node-version: "lts/*" node-version: "lts/*"
- name: Setup Android SDK - name: Setup Android SDK
uses: android-actions/setup-android@v2 uses: android-actions/setup-android@v2
- name: Make gradlew executable
run: chmod +x gradlew
- name: Build with Gradle - name: Build with Gradle
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,3 +1,61 @@
## [1.10.2](https://github.com/revanced/revanced-patches/compare/v1.10.1...v1.10.2) (2022-06-23)
### Bug Fixes
* `disable-create-button` not working with prebuilt jar file ([#55](https://github.com/revanced/revanced-patches/issues/55)) ([78be64a](https://github.com/revanced/revanced-patches/commit/78be64accc2023281c0c376849cdb0213622dc5c))
## [1.10.1](https://github.com/revanced/revanced-patches/compare/v1.10.0...v1.10.1) (2022-06-23)
### Bug Fixes
* patcher not propagating dexlib ([980c486](https://github.com/revanced/revanced-patches/commit/980c48673259496d793bc7f864ad355188dcf7b6))
* update patcher version ([e3d0bb7](https://github.com/revanced/revanced-patches/commit/e3d0bb7ee1923ea996cf637267c62d233a74c7fa))
# [1.10.0](https://github.com/revanced/revanced-patches/compare/v1.9.1...v1.10.0) (2022-06-23)
### Features
* add compatibility for YouTube v17.23.36 and v17.24.34 ([1812bc3](https://github.com/revanced/revanced-patches/commit/1812bc39e0e88f1ab02ae8127e9000780eedf49c))
## [1.9.1](https://github.com/revanced/revanced-patches/compare/v1.9.0...v1.9.1) (2022-06-21)
### Bug Fixes
* update patcher version ([5f54bc9](https://github.com/revanced/revanced-patches/commit/5f54bc9aa8fd8b83448141a9b05746e3e977369d))
# [1.9.0](https://github.com/revanced/revanced-patches/compare/v1.8.2...v1.9.0) (2022-06-21)
### Features
* use `install` mode by default ([c2b2993](https://github.com/revanced/revanced-patches/commit/c2b299336a984d66a2d066e5ebe9c4f9bee5c2aa))
## [1.8.2](https://github.com/revanced/revanced-patches/compare/v1.8.1...v1.8.2) (2022-06-20)
### Bug Fixes
* migrate to breaking changes from patcher ([2c0a419](https://github.com/revanced/revanced-patches/commit/2c0a4196fed2fbdcd454ed882b720898d3050c51))
* old usage of `toInstructions` extension method ([65ddd52](https://github.com/revanced/revanced-patches/commit/65ddd522dca19e0590d9cb6fdb2d85ad7b98481e))
## [1.8.1](https://github.com/revanced/revanced-patches/compare/v1.8.0...v1.8.1) (2022-06-20)
### Bug Fixes
* add execute permission to `./gradlew` file ([ff7a560](https://github.com/revanced/revanced-patches/commit/ff7a5602f68428111fea6c60cbea694592039ef1))
# [1.8.0](https://github.com/revanced/revanced-patches/compare/v1.7.0...v1.8.0) (2022-06-20)
### Features
* bump compatibility of patches for Youtube to v17.23.35 ([3748d05](https://github.com/revanced/revanced-patches/commit/3748d0533e62a8871ab2202ce9b61170a90dae62))
# [1.7.0](https://github.com/revanced/revanced-patches/compare/v1.6.4...v1.7.0) (2022-06-20) # [1.7.0](https://github.com/revanced/revanced-patches/compare/v1.6.4...v1.7.0) (2022-06-20)

View File

@@ -18,7 +18,7 @@ repositories {
dependencies { dependencies {
implementation(kotlin("stdlib")) implementation(kotlin("stdlib"))
implementation("app.revanced:revanced-patcher:1.2.8") implementation("app.revanced:revanced-patcher:1.10.2")
} }
tasks { tasks {

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official kotlin.code.style = official
version = 1.7.0 version = 1.10.2

0
gradlew vendored Normal file → Executable file
View File

View File

@@ -25,13 +25,13 @@ class CodecsUnlockPatch : BytecodePatch(
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
var result = signatures.first().result!! var result = CodecsLockSignature.result!!
val implementation = result.method.implementation!! val implementation = result.method.implementation!!
val instructionIndex = result.scanResult.startIndex val instructionIndex = result.scanResult.startIndex
result = signatures.last().result!! result = AllCodecsReferenceSignature.result!!
val codecMethod = val codecMethod =
data.toMethodWalker(result.immutableMethod).nextMethod(result.scanResult.startIndex).getMethod() data.toMethodWalker(result.immutableMethod).nextMethod(result.scanResult.startIndex).getMethod()

View File

@@ -30,7 +30,7 @@ class ExclusiveAudioPatch : BytecodePatch(
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = signatures.first().result!!.findParentMethod(@Name("audio-only-enabler-method") @MatchingMethod( val result = ExclusiveAudioSignature.result!!.findParentMethod(@Name("audio-only-enabler-method") @MatchingMethod(
"Lgmd;", "Lgmd;",
"d" "d"
) @DirectPatternScanMethod @ExclusiveAudioCompatibility @Version( ) @DirectPatternScanMethod @ExclusiveAudioCompatibility @Version(
@@ -67,4 +67,4 @@ class ExclusiveAudioPatch : BytecodePatch(
return PatchResultSuccess() return PatchResultSuccess()
} }
} }

View File

@@ -9,7 +9,6 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.music.layout.tastebuilder.annotations.RemoveTasteBuilderCompatibility import app.revanced.patches.music.layout.tastebuilder.annotations.RemoveTasteBuilderCompatibility
import app.revanced.patches.music.layout.tastebuilder.signatures.TasteBuilderConstructorSignature import app.revanced.patches.music.layout.tastebuilder.signatures.TasteBuilderConstructorSignature
import org.jf.dexlib2.iface.instruction.formats.Instruction22c import org.jf.dexlib2.iface.instruction.formats.Instruction22c
@@ -25,20 +24,18 @@ class RemoveTasteBuilderPatch : BytecodePatch(
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = signatures.first().result!! val result = TasteBuilderConstructorSignature.result!!
val implementation = result.method.implementation!! val implementation = result.method.implementation!!
val insertIndex = result.scanResult.endIndex - 8 val insertIndex = result.scanResult.endIndex - 8
val register = (implementation.instructions[insertIndex] as Instruction22c).registerA val register = (implementation.instructions[insertIndex] as Instruction22c).registerA
val instructionList = """ result.method.addInstructions(
insertIndex, """
const/16 v1, 0x8 const/16 v1, 0x8
invoke-virtual {v${register}, v1}, Landroid/view/View;->setVisibility(I)V invoke-virtual {v${register}, v1}, Landroid/view/View;->setVisibility(I)V
""".trimIndent().toInstructions().toMutableList() """
implementation.addInstructions(
insertIndex, instructionList
) )
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -29,7 +29,7 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = signatures.first().result!! val result = PivotBarConstructorSignature.result!!
val implementation = result.method.implementation!! val implementation = result.method.implementation!!
val pivotBarElementFieldRef = val pivotBarElementFieldRef =

View File

@@ -9,7 +9,6 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.music.premium.backgroundplay.annotations.BackgroundPlayCompatibility import app.revanced.patches.music.premium.backgroundplay.annotations.BackgroundPlayCompatibility
import app.revanced.patches.music.premium.backgroundplay.signatures.BackgroundPlaybackDisableSignature import app.revanced.patches.music.premium.backgroundplay.signatures.BackgroundPlaybackDisableSignature
@@ -24,12 +23,12 @@ class BackgroundPlayPatch : BytecodePatch(
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
signatures.first().result!!.method.implementation!!.addInstructions( BackgroundPlaybackDisableSignature.result!!.method.addInstructions(
0, 0,
""" """
const/4 v0, 0x1 const/4 v0, 0x1
return v0 return v0
""".trimIndent().toInstructions() """
) )
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -148,11 +148,11 @@ class GeneralBytecodeAdsPatch : BytecodePatch(
mutableClass!!.findMutableMethodOf(method) mutableClass!!.findMutableMethodOf(method)
// TODO: dynamically get registers // TODO: dynamically get registers
mutableMethod!!.implementation!!.addInstructions( mutableMethod!!.addInstructions(
insertIndex, """ insertIndex, """
const/16 v1, 0x8 const/16 v1, 0x8
invoke-virtual {v0,v1}, Landroid/widget/FrameLayout;->setVisibility(I)V invoke-virtual {v0,v1}, Landroid/widget/FrameLayout;->setVisibility(I)V
""".trimIndent().toInstructions() """
) )
} }
@@ -242,25 +242,23 @@ class GeneralBytecodeAdsPatch : BytecodePatch(
BuilderInstruction21t(Opcode.IF_EQZ, 1, lithoRemoveLabel) BuilderInstruction21t(Opcode.IF_EQZ, 1, lithoRemoveLabel)
// create blocks // create blocks
val parameters = lithoMethod.parameterTypes.joinToString("") { it }
val registers = lithoMethodImplementation.registerCount
val block1 = """ val block1 = """
invoke-static/range {p3}, $thisType->getTemplateName($templateNameParameterType)Ljava/lang/String; invoke-static/range {p3}, $thisType->getTemplateName($templateNameParameterType)Ljava/lang/String;
move-result-object v0 move-result-object v0
""".trimIndent().toInstructions(parameters, registers, false) """.trimIndent().toInstructions(lithoMethod)
val block2 = """ val block2 = """
move-object/from16 v1, p3 move-object/from16 v1, p3
iget-object v2, v1, $templateNameParameterType->b:Ljava/nio/ByteBuffer; iget-object v2, v1, $templateNameParameterType->b:Ljava/nio/ByteBuffer;
invoke-static {v0, v2}, Lfi/razerman/youtube/litho/LithoAdRemoval;->containsAd(Ljava/lang/String;Ljava/nio/ByteBuffer;)Z invoke-static {v0, v2}, Lfi/razerman/youtube/litho/LithoAdRemoval;->containsAd(Ljava/lang/String;Ljava/nio/ByteBuffer;)Z
move-result v1 move-result v1
""".trimIndent().toInstructions(parameters, registers, false) """.trimIndent().toInstructions(lithoMethod)
val block3 = """ val block3 = """
move-object/from16 v2, p1 move-object/from16 v2, p1
invoke-static {v2}, $descriptor1 invoke-static {v2}, $descriptor1
move-result-object v0 move-result-object v0
iget-object v0, v0, $descriptor2 iget-object v0, v0, $descriptor2
return-object v0 return-object v0
""".trimIndent().toInstructions(parameters, registers, false) """.trimIndent().toInstructions(lithoMethod)
// insert blocks and branch instructions // insert blocks and branch instructions
lithoMethodImplementation.insertBlocks( lithoMethodImplementation.insertBlocks(

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -15,7 +15,6 @@ import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.signature.implementation.method.MethodSignature
import app.revanced.patcher.signature.implementation.method.annotation.DirectPatternScanMethod import app.revanced.patcher.signature.implementation.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
import app.revanced.patches.youtube.ad.video.signatures.ShowVideoAdsConstructorSignature import app.revanced.patches.youtube.ad.video.signatures.ShowVideoAdsConstructorSignature
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@@ -34,18 +33,18 @@ class VideoAdsPatch : BytecodePatch(
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = val result =
signatures.first().result!!.findParentMethod(@Name("show-video-ads-method-signature") @MatchingMethod( ShowVideoAdsConstructorSignature.result!!.findParentMethod(@Name("show-video-ads-method-signature") @MatchingMethod(
definingClass = "zai" definingClass = "zai"
) @DirectPatternScanMethod @VideoAdsCompatibility @Version("0.0.1") object : MethodSignature( ) @DirectPatternScanMethod @VideoAdsCompatibility @Version("0.0.1") object : MethodSignature(
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), null "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), null
) {}) ?: return PatchResultError("Required parent method could not be found.") ) {}) ?: return PatchResultError("Required parent method could not be found.")
// 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
result.method.implementation!!.addInstructions( result.method.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 v1 move-result v1
""".trimIndent().toInstructions() """
) )
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36") "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")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -11,7 +11,6 @@ import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultError import app.revanced.patcher.patch.implementation.misc.PatchResultError
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility
import app.revanced.patches.youtube.interaction.seekbar.signatures.SeekbarTappingParentSignature import app.revanced.patches.youtube.interaction.seekbar.signatures.SeekbarTappingParentSignature
import app.revanced.patches.youtube.interaction.seekbar.signatures.SeekbarTappingSignature import app.revanced.patches.youtube.interaction.seekbar.signatures.SeekbarTappingSignature
@@ -34,7 +33,7 @@ class EnableSeekbarTappingPatch : BytecodePatch(
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
var result = signatures.first().result!! var result = SeekbarTappingParentSignature.result!!
val tapSeekMethods = mutableMapOf<String, Method>() val tapSeekMethods = mutableMapOf<String, Method>()
@@ -59,7 +58,7 @@ class EnableSeekbarTappingPatch : BytecodePatch(
} }
// replace map because we dont need the upper one anymore // replace map because we dont need the upper one anymore
result = signatures.last().result!! result = SeekbarTappingSignature.result!!
val implementation = result.method.implementation!! val implementation = result.method.implementation!!
@@ -73,11 +72,11 @@ class EnableSeekbarTappingPatch : BytecodePatch(
val register = (instruction as Instruction35c).registerC val register = (instruction as Instruction35c).registerC
// the instructions are written in reverse order. // the instructions are written in reverse order.
implementation.addInstructions( result.method.addInstructions(
result.scanResult.endIndex + 1, """ result.scanResult.endIndex + 1, """
invoke-virtual { v$register, v2 }, ${oMethod.definingClass}->${oMethod.name}(I)V invoke-virtual { v$register, v2 }, ${oMethod.definingClass}->${oMethod.name}(I)V
invoke-virtual { v$register, v2 }, ${pMethod.definingClass}->${pMethod.name}(I)V invoke-virtual { v$register, v2 }, ${pMethod.definingClass}->${pMethod.name}(I)V
""".trimIndent().toInstructions() """
) )
// 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
@@ -85,11 +84,11 @@ class EnableSeekbarTappingPatch : BytecodePatch(
implementation.addInstruction( implementation.addInstruction(
result.scanResult.endIndex + 1, BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel) result.scanResult.endIndex + 1, BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel)
) )
implementation.addInstructions( result.method.addInstructions(
result.scanResult.endIndex + 1, """ result.scanResult.endIndex + 1, """
invoke-static { }, Lfi/razerman/youtube/preferences/BooleanPreferences;->isTapSeekingEnabled()Z invoke-static { }, Lfi/razerman/youtube/preferences/BooleanPreferences;->isTapSeekingEnabled()Z
move-result v0 move-result v0
""".trimIndent().toInstructions() """
) )
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -11,7 +11,6 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.layout.castbutton.annotations.CastButtonCompatibility import app.revanced.patches.youtube.layout.castbutton.annotations.CastButtonCompatibility
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@@ -26,14 +25,14 @@ class HideCastButtonPatch : BytecodePatch(listOf()) {
data.classes.forEach { classDef -> data.classes.forEach { classDef ->
classDef.methods.forEach { method -> classDef.methods.forEach { method ->
if (classDef.type.endsWith("MediaRouteButton;") && method.name == "setVisibility") { if (classDef.type.endsWith("MediaRouteButton;") && method.name == "setVisibility") {
val implementation = val setVisibilityMethod =
data.proxy(classDef).resolve().methods.first { it.name == "setVisibility" }.implementation!! data.proxy(classDef).resolve().methods.first { it.name == "setVisibility" }
implementation.addInstructions( setVisibilityMethod.addInstructions(
0, """ 0, """
invoke-static {p1}, Lfi/razerman/youtube/XGlobals;->getCastButtonOverrideV2(I)I invoke-static {p1}, Lfi/razerman/youtube/XGlobals;->getCastButtonOverrideV2(I)I
move-result p1 move-result p1
""".trimIndent().toInstructions("I", 2, false) """
) )
} }
} }

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -4,13 +4,13 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultError import app.revanced.patcher.patch.implementation.misc.PatchResultError
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patches.youtube.layout.createbutton.annotations.CreateButtonCompatibility import app.revanced.patches.youtube.layout.createbutton.annotations.CreateButtonCompatibility
import app.revanced.patches.youtube.layout.createbutton.signatures.CreateButtonSignature import app.revanced.patches.youtube.layout.createbutton.signatures.CreateButtonSignature
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@@ -29,7 +29,7 @@ class CreateButtonRemoverPatch : BytecodePatch(
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = signatures.first().result!! val result = CreateButtonSignature.result!!
// Get the required register which holds the view object we need to pass to the method hideCreateButton // Get the required register which holds the view object we need to pass to the method hideCreateButton
val implementation = result.method.implementation!! val implementation = result.method.implementation!!
@@ -38,9 +38,9 @@ class CreateButtonRemoverPatch : BytecodePatch(
val register = (instruction as Instruction35c).registerC val register = (instruction as Instruction35c).registerC
// 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
implementation.addInstruction( result.method.addInstruction(
result.scanResult.endIndex + 1, result.scanResult.endIndex + 1,
"invoke-static { v$register }, Lfi/razerman/youtube/XAdRemover;->hideCreateButton(Landroid/view/View;)V".toInstruction() "invoke-static { v$register }, Lfi/razerman/youtube/XAdRemover;->hideCreateButton(Landroid/view/View;)V"
) )
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.23.35") "com.google.android.youtube", arrayOf("17.23.35", "17.23.36", "17.24.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,13 +5,11 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.data.implementation.proxy import app.revanced.patcher.data.implementation.proxy
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultError
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patches.youtube.layout.fullscreenpanels.annotations.FullscreenPanelsCompatibility import app.revanced.patches.youtube.layout.fullscreenpanels.annotations.FullscreenPanelsCompatibility
@Patch @Patch
@@ -21,17 +19,17 @@ import app.revanced.patches.youtube.layout.fullscreenpanels.annotations.Fullscre
@Version("0.0.1") @Version("0.0.1")
class FullscreenPanelsRemovalPatch : BytecodePatch(listOf()) { class FullscreenPanelsRemovalPatch : BytecodePatch(listOf()) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val classDef = data.classes.first { it.type.endsWith("FullscreenEngagementPanelOverlay;") } val classDef = data.classes.first { it.type.endsWith("FullscreenEngagementPanelOverlay;") }
val method = data.proxy(classDef).resolve().methods.first { it.name == "<init>" } val method = data.proxy(classDef).resolve().methods.first { it.name == "<init>" }
val implementation = method.implementation!! val implementation = method.implementation!!
implementation.addInstructions( method.addInstructions(
implementation.instructions.count() - 1, implementation.instructions.count() - 1,
""" """
const/4 v1, 0x0 const/4 v1, 0x0
iput-boolean v1, v0, ${classDef.type}->a:Z iput-boolean v1, v0, ${classDef.type}->a:Z
""".trimIndent().toInstructions("", 2, true)) """
)
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -3,13 +3,12 @@ package app.revanced.patches.youtube.layout.minimizedplayback.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.layout.minimizedplayback.annotations.MinimizedPlaybackCompatibility import app.revanced.patches.youtube.layout.minimizedplayback.annotations.MinimizedPlaybackCompatibility
import app.revanced.patches.youtube.layout.minimizedplayback.signatures.MinimizedPlaybackManagerSignature import app.revanced.patches.youtube.layout.minimizedplayback.signatures.MinimizedPlaybackManagerSignature
@@ -27,11 +26,11 @@ class MinimizedPlaybackPatch : BytecodePatch(
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
// 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
signatures.first().result!!.method.implementation!!.addInstructions( MinimizedPlaybackManagerSignature.result!!.method.addInstructions(
0, """ 0, """
const/4 v0, 0x1 const/4 v0, 0x1
return v0 return v0
""".trimIndent().toInstructions() """
) )
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36") "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")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -15,7 +15,6 @@ import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.signature.implementation.method.MethodSignature
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQualityLayoutCompatibility import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQualityLayoutCompatibility
import app.revanced.patches.youtube.layout.oldqualitylayout.signatures.OldQualityParentSignature import app.revanced.patches.youtube.layout.oldqualitylayout.signatures.OldQualityParentSignature
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@@ -35,7 +34,7 @@ class OldQualityLayoutPatch : BytecodePatch(
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = signatures.first().result!!.findParentMethod(@Name("old-quality-signature") @MatchingMethod( val result = OldQualityParentSignature.result!!.findParentMethod(@Name("old-quality-signature") @MatchingMethod(
definingClass = "Libh" definingClass = "Libh"
) @FuzzyPatternScanMethod(2) @OldQualityLayoutCompatibility @Version("0.0.1") object : MethodSignature( ) @FuzzyPatternScanMethod(2) @OldQualityLayoutCompatibility @Version("0.0.1") object : MethodSignature(
"L", AccessFlags.FINAL or AccessFlags.PRIVATE, listOf("Z"), listOf( "L", AccessFlags.FINAL or AccessFlags.PRIVATE, listOf("Z"), listOf(
@@ -57,11 +56,11 @@ class OldQualityLayoutPatch : BytecodePatch(
Opcode.IF_NEZ, 0, implementation.instructions[result.scanResult.endIndex].location.labels.first() Opcode.IF_NEZ, 0, implementation.instructions[result.scanResult.endIndex].location.labels.first()
) )
implementation.addInstruction(5, jmpInstruction) implementation.addInstruction(5, jmpInstruction)
implementation.addInstructions( result.method.addInstructions(
0, """ 0, """
invoke-static { }, Lfi/razerman/youtube/XGlobals;->useOldStyleQualitySettings()Z invoke-static { }, Lfi/razerman/youtube/XGlobals;->useOldStyleQualitySettings()Z
move-result v0 move-result v0
""".trimIndent().toInstructions() """
) )
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.23.35", "17.23.36", "17.24.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -4,10 +4,10 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility
import app.revanced.patches.youtube.layout.reels.signatures.HideReelsSignature import app.revanced.patches.youtube.layout.reels.signatures.HideReelsSignature
@@ -22,14 +22,13 @@ class HideReelsPatch : BytecodePatch(
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = signatures.first().result!! val result = HideReelsSignature.result!!
val implementation = result.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
implementation.addInstruction( result.method.addInstruction(
result.scanResult.endIndex, result.scanResult.endIndex,
"invoke-static { v2 }, Lfi/razerman/youtube/XAdRemover;->HideReel(Landroid/view/View;)V".toInstruction() "invoke-static { v2 }, Lfi/razerman/youtube/XAdRemover;->HideReel(Landroid/view/View;)V"
) )
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -4,12 +4,12 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility
import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButtonTabenumSignature import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButtonTabenumSignature
import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButtonsViewSignature import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButtonsViewSignature
@@ -28,27 +28,27 @@ class ShortsButtonRemoverPatch : BytecodePatch(
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result1 = signatures.first().result!! val result1 = PivotBarButtonTabenumSignature.result!!
val implementation1 = result1.method.implementation!! val implementation1 = result1.method.implementation!!
val moveEnumInstruction = implementation1.instructions[result1.scanResult.endIndex] val moveEnumInstruction = implementation1.instructions[result1.scanResult.endIndex]
val enumRegister = (moveEnumInstruction as Instruction11x).registerA val enumRegister = (moveEnumInstruction as Instruction11x).registerA
val result2 = signatures.last().result!! val result2 = PivotBarButtonsViewSignature.result!!
val implementation2 = result2.method.implementation!! val implementation2 = result2.method.implementation!!
val moveViewInstruction = implementation2.instructions[result2.scanResult.endIndex] val moveViewInstruction = implementation2.instructions[result2.scanResult.endIndex]
val viewRegister = (moveViewInstruction as Instruction11x).registerA val viewRegister = (moveViewInstruction as Instruction11x).registerA
// Save the tab enum in XGlobals to avoid smali/register workarounds // Save the tab enum in XGlobals to avoid smali/register workarounds
implementation1.addInstruction( result1.method.addInstruction(
result1.scanResult.endIndex + 1, result1.scanResult.endIndex + 1,
"sput-object v$enumRegister, Lfi/razerman/youtube/XGlobals;->lastPivotTab:Ljava/lang/Enum;".toInstruction() "sput-object v$enumRegister, Lfi/razerman/youtube/XGlobals;->lastPivotTab:Ljava/lang/Enum;"
) )
// Hide the button view via proxy by passing it to the hideShortsButton method // Hide the button view via proxy by passing it to the hideShortsButton method
// It only hides it if the last tab name is "TAB_SHORTS" // It only hides it if the last tab name is "TAB_SHORTS"
implementation2.addInstruction( result2.method.addInstruction(
result2.scanResult.endIndex + 2, result2.scanResult.endIndex + 2,
"invoke-static { v$viewRegister }, Lfi/razerman/youtube/XAdRemover;->hideShortsButton(Landroid/view/View;)V".toInstruction() "invoke-static { v$viewRegister }, Lfi/razerman/youtube/XAdRemover;->hideShortsButton(Landroid/view/View;)V"
) )
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.03.38", "17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.03.38", "17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -31,16 +31,16 @@ class IntegrationsPatch : BytecodePatch(
if (data.findClass("Lapp/revanced/integrations/Globals") == null) if (data.findClass("Lapp/revanced/integrations/Globals") == null)
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.") return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.")
val result = signatures.first().result!! val result = InitSignature.result!!
val implementation = result.method.implementation!! val implementation = result.method.implementation!!
val count = implementation.registerCount - 1 val count = implementation.registerCount - 1
implementation.addInstructions( result.method.addInstructions(
result.scanResult.endIndex + 1, """ result.scanResult.endIndex + 1, """
invoke-static {v$count}, Lpl/jakubweg/StringRef;->setContext(Landroid/content/Context;)V invoke-static {v$count}, Lpl/jakubweg/StringRef;->setContext(Landroid/content/Context;)V
sput-object v$count, Lapp/revanced/integrations/Globals;->context:Landroid/content/Context; sput-object v$count, Lapp/revanced/integrations/Globals;->context:Landroid/content/Context;
""".trimIndent().toInstructions() """
) )
val classDef = result.definingClassProxy.resolve() val classDef = result.definingClassProxy.resolve()

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -16,6 +16,7 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
import app.revanced.patcher.util.smali.toInstruction import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patcher.util.smali.toInstructions import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.layout.castbutton.patch.HideCastButtonPatch import app.revanced.patches.youtube.layout.castbutton.patch.HideCastButtonPatch
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
import app.revanced.patches.youtube.misc.microg.patch.resource.MicroGResourcePatch import app.revanced.patches.youtube.misc.microg.patch.resource.MicroGResourcePatch
import app.revanced.patches.youtube.misc.microg.patch.resource.enum.StringReplaceMode import app.revanced.patches.youtube.misc.microg.patch.resource.enum.StringReplaceMode
@@ -29,9 +30,13 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction21c
import org.jf.dexlib2.iface.reference.StringReference import org.jf.dexlib2.iface.reference.StringReference
import org.jf.dexlib2.immutable.reference.ImmutableStringReference import org.jf.dexlib2.immutable.reference.ImmutableStringReference
@Patch(include = false) @Patch
@Dependencies( @Dependencies(
dependencies = [MicroGResourcePatch::class, HideCastButtonPatch::class] dependencies = [
MicroGResourcePatch::class,
HideCastButtonPatch::class,
FixLocaleConfigErrorPatch::class
]
) )
@Name("microg-support") @Name("microg-support")
@Description("Patch to allow YouTube ReVanced to run without root and under a different package name.") @Description("Patch to allow YouTube ReVanced to run without root and under a different package name.")
@@ -65,13 +70,11 @@ class MicroGBytecodePatch : BytecodePatch(
val replaceMode = if (stringValue.equalsAny( val replaceMode = if (stringValue.equalsAny(
"com.google.android.gms", "com.google.android.gms",
"com.google.android.youtube.fileprovider",
"com.google.android.c2dm.intent.REGISTER", "com.google.android.c2dm.intent.REGISTER",
"com.google.android.c2dm.permission.SEND", "com.google.android.c2dm.permission.SEND",
"com.google.iid.TOKEN_REQUEST", "com.google.iid.TOKEN_REQUEST",
"com.google", "com.google",
"com.google.android.gms.auth.accounts", "com.google.android.gms.auth.accounts",
"com.google.android.youtube.SuggestionProvider",
"com.google.android.c2dm.intent.REGISTRATION", "com.google.android.c2dm.intent.REGISTRATION",
"com.google.android.gsf.action.GET_GLS", "com.google.android.gsf.action.GET_GLS",
"com.google.android.gsf.login", "com.google.android.gsf.login",
@@ -117,13 +120,19 @@ class MicroGBytecodePatch : BytecodePatch(
} }
} }
signatures.last()
return PatchResultSuccess() return PatchResultSuccess()
} }
private fun disablePlayServiceChecksAndFixCastIssues() { private fun disablePlayServiceChecksAndFixCastIssues() {
for (i in 0 until signatures.count() - 1) { listOf(
val result = signatures.elementAt(i).result!! IntegrityCheckSignature,
ServiceCheckSignature,
GooglePlayUtilitySignature,
CastDynamiteModuleSignature,
CastDynamiteModuleV2Signature,
CastContextFetchSignature
).forEach { signature ->
val result = signature.result!!
val stringInstructions = when (result.immutableMethod.returnType.first()) { val stringInstructions = when (result.immutableMethod.returnType.first()) {
'L' -> """ 'L' -> """
const/4 v0, 0x0 const/4 v0, 0x0
@@ -138,12 +147,12 @@ class MicroGBytecodePatch : BytecodePatch(
else -> throw Exception("This case should never happen.") else -> throw Exception("This case should never happen.")
} }
result.method.implementation!!.addInstructions( result.method.addInstructions(
0, stringInstructions.trimIndent().toInstructions() 0, stringInstructions
) )
} }
val implementation = signatures.last().result!!.method.implementation!! val implementation = PrimeSignature.result!!.method.implementation!!
var register = 2 var register = 2
val index = implementation.instructions.indexOfFirst { val index = implementation.instructions.indexOfFirst {

View File

@@ -4,6 +4,7 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.ResourceData import app.revanced.patcher.data.implementation.ResourceData
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.ResourcePatch import app.revanced.patcher.patch.implementation.ResourcePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
@@ -39,10 +40,6 @@ class MicroGResourcePatch : ResourcePatch() {
"android:label=\"@string/application_name", "android:label=\"$REVANCED_APP_NAME" "android:label=\"@string/application_name", "android:label=\"$REVANCED_APP_NAME"
).replace( ).replace(
"android:authorities=\"com.google.android.youtube", "android:authorities=\"$REVANCED_PACKAGE_NAME" "android:authorities=\"com.google.android.youtube", "android:authorities=\"$REVANCED_PACKAGE_NAME"
).replace(
"com.google.android.youtube.fileprovider", "$REVANCED_PACKAGE_NAME.fileprovider"
).replace(
"com.google.android.youtube.SuggestionProvider", "$REVANCED_PACKAGE_NAME.SuggestionProvider"
).replace( ).replace(
"com.google.android.youtube.permission.C2D_MESSAGE", "$REVANCED_PACKAGE_NAME.permission.C2D_MESSAGE" "com.google.android.youtube.permission.C2D_MESSAGE", "$REVANCED_PACKAGE_NAME.permission.C2D_MESSAGE"
).replace( // TODO: might not be needed ).replace( // TODO: might not be needed