From 284a7f0b1a7b46e36b5f3dd132bb36d6d3fef584 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 12 Dec 2023 01:50:18 +0100 Subject: [PATCH 1/3] fix(YouTube Music - GmsCore support): Change from correct package name to prevent the patch from failing --- .../revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt index 2d3d241fd..9b2dcec9e 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt @@ -9,8 +9,8 @@ import app.revanced.patches.youtube.misc.gms.fingerprints.CastContextFetchFinger @Suppress("unused") object GmsCoreSupportPatch : AbstractGmsCoreSupportPatch( - fromPackageName = REVANCED_MUSIC_PACKAGE_NAME, - toPackageName = MUSIC_PACKAGE_NAME, + fromPackageName = MUSIC_PACKAGE_NAME, + toPackageName = REVANCED_MUSIC_PACKAGE_NAME, primeMethodFingerprint = PrimeMethodFingerprint, earlyReturnFingerprints = setOf( ServiceCheckFingerprint, From a928c8c44104b5296fcff9e0b8cbad382680d74a Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 12 Dec 2023 01:50:32 +0100 Subject: [PATCH 2/3] refactor: Simplify implementation --- .../misc/gms/AbstractGmsCoreSupportPatch.kt | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportPatch.kt b/src/main/kotlin/app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportPatch.kt index 0ea31ed4d..dfb06c287 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportPatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportPatch.kt @@ -13,9 +13,11 @@ import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportPatch.Constant import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint.GET_GMS_CORE_VENDOR_METHOD_NAME import app.revanced.util.exception +import app.revanced.util.getReference import app.revanced.util.returnEarly import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c +import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c import com.android.tools.smali.dexlib2.iface.reference.StringReference import com.android.tools.smali.dexlib2.immutable.reference.ImmutableStringReference @@ -169,23 +171,20 @@ abstract class AbstractGmsCoreSupportPatch( } } - private fun transformPrimeMethod(packageName: String) = primeMethodFingerprint.result?.mutableMethod?.apply { - var register = 2 - val index = getInstructions().indexOfFirst { - if (it.opcode != Opcode.CONST_STRING) return@indexOfFirst false + private fun transformPrimeMethod(packageName: String) { + primeMethodFingerprint.result?.mutableMethod?.apply { + var register = 2 - val instructionString = ((it as Instruction21c).reference as StringReference).string - if (instructionString != fromPackageName) return@indexOfFirst false + val index = getInstructions().indexOfFirst { + if (it.getReference()?.string != fromPackageName) return@indexOfFirst false - register = it.registerA - return@indexOfFirst true - } + register = (it as OneRegisterInstruction).registerA + return@indexOfFirst true + } - replaceInstruction( - index, "const-string v$register, \"$packageName\"" - ) + replaceInstruction(index, "const-string v$register, \"$packageName\"") + } ?: throw primeMethodFingerprint.exception } - ?: throw primeMethodFingerprint.exception /** * A collection of permissions, intents and content provider authorities From 6150c9c41b385bab569e5331a3b008dd3d778c51 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 12 Dec 2023 00:53:09 +0000 Subject: [PATCH 3/3] chore(release): 3.0.1-dev.1 [skip ci] ## [3.0.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v3.0.0...v3.0.1-dev.1) (2023-12-12) ### Bug Fixes * **YouTube Music - GmsCore support:** Change from correct package name to prevent the patch from failing ([284a7f0](https://github.com/ReVanced/revanced-patches/commit/284a7f0b1a7b46e36b5f3dd132bb36d6d3fef584)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 842ce7684..05c384cec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [3.0.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v3.0.0...v3.0.1-dev.1) (2023-12-12) + + +### Bug Fixes + +* **YouTube Music - GmsCore support:** Change from correct package name to prevent the patch from failing ([284a7f0](https://github.com/ReVanced/revanced-patches/commit/284a7f0b1a7b46e36b5f3dd132bb36d6d3fef584)) + # [3.0.0](https://github.com/ReVanced/revanced-patches/compare/v2.202.0...v3.0.0) (2023-12-12) diff --git a/gradle.properties b/gradle.properties index 1f1222691..864cf6264 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 3.0.0 +version = 3.0.1-dev.1