From bbde91cf9df4b410a34147bbe5f359e39a71ad4c Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Thu, 3 Aug 2023 04:06:28 +0200 Subject: [PATCH] feat(Nova Launcher): Remove `Unlock prime` patch --- .../annotations/UnlockPrimeCompatibility.kt | 12 ----- .../fingerprints/UnlockPrimeFingerprint.kt | 16 ------- .../nova/prime/patch/UnlockPrimePatch.kt | 48 ------------------- 3 files changed, 76 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/nova/prime/annotations/UnlockPrimeCompatibility.kt delete mode 100644 src/main/kotlin/app/revanced/patches/nova/prime/fingerprints/UnlockPrimeFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/patches/nova/prime/patch/UnlockPrimePatch.kt diff --git a/src/main/kotlin/app/revanced/patches/nova/prime/annotations/UnlockPrimeCompatibility.kt b/src/main/kotlin/app/revanced/patches/nova/prime/annotations/UnlockPrimeCompatibility.kt deleted file mode 100644 index 8ab3cc780..000000000 --- a/src/main/kotlin/app/revanced/patches/nova/prime/annotations/UnlockPrimeCompatibility.kt +++ /dev/null @@ -1,12 +0,0 @@ -package app.revanced.patches.nova.prime.annotations - -import app.revanced.patcher.annotation.Compatibility -import app.revanced.patcher.annotation.Package - -@Compatibility( - [ - Package("com.teslacoilsw.launcher") - ] -) -@Target(AnnotationTarget.CLASS) -internal annotation class UnlockPrimeCompatibility \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/nova/prime/fingerprints/UnlockPrimeFingerprint.kt b/src/main/kotlin/app/revanced/patches/nova/prime/fingerprints/UnlockPrimeFingerprint.kt deleted file mode 100644 index 69d2902a4..000000000 --- a/src/main/kotlin/app/revanced/patches/nova/prime/fingerprints/UnlockPrimeFingerprint.kt +++ /dev/null @@ -1,16 +0,0 @@ -package app.revanced.patches.nova.prime.fingerprints - -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import org.jf.dexlib2.Opcode - -object UnlockPrimeFingerprint : MethodFingerprint( - "V", - opcodes = listOf( - Opcode.IPUT_OBJECT, - Opcode.CONST_STRING, - Opcode.CONST_4, - Opcode.INVOKE_INTERFACE, - Opcode.MOVE_RESULT - ), - strings = listOf("1") -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/nova/prime/patch/UnlockPrimePatch.kt b/src/main/kotlin/app/revanced/patches/nova/prime/patch/UnlockPrimePatch.kt deleted file mode 100644 index 4c1546041..000000000 --- a/src/main/kotlin/app/revanced/patches/nova/prime/patch/UnlockPrimePatch.kt +++ /dev/null @@ -1,48 +0,0 @@ -package app.revanced.patches.nova.prime.patch - -import app.revanced.extensions.toErrorResult -import app.revanced.patcher.annotation.Description -import app.revanced.patcher.annotation.Name -import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.extensions.InstructionExtensions.addInstruction -import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.PatchResult -import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patcher.patch.annotations.Patch -import app.revanced.patches.nova.prime.annotations.UnlockPrimeCompatibility -import app.revanced.patches.nova.prime.fingerprints.UnlockPrimeFingerprint -import org.jf.dexlib2.builder.instruction.BuilderInstruction11x - -@Patch -@Name("Unlock prime") -@Description("Unlocks Nova Prime and all functions of the app.") -@UnlockPrimeCompatibility -class UnlockPrimePatch : BytecodePatch( - listOf( - UnlockPrimeFingerprint - ) -) { - private companion object { - // Any value except 0 unlocks prime, but 512 is needed for a protection mechanism - // which would reset the preferences if the value on disk had changed after a restart. - const val PRIME_STATUS: Int = 512 - } - - override fun execute(context: BytecodeContext): PatchResult { - UnlockPrimeFingerprint.result?.apply { - val insertIndex = scanResult.patternScanResult!!.endIndex + 1 - - val primeStatusRegister = - (mutableMethod.implementation!!.instructions[insertIndex - 1] as BuilderInstruction11x).registerA - - mutableMethod.addInstruction( - insertIndex, - """ - const/16 v$primeStatusRegister, $PRIME_STATUS - """ - ) - } ?: return UnlockPrimeFingerprint.toErrorResult() - - return PatchResultSuccess() - } -}