mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-25 18:55:51 +01:00
feat(Nova Launcher): Remove Unlock prime
patch
This commit is contained in:
parent
76bab10919
commit
bbde91cf9d
@ -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
|
|
@ -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")
|
|
||||||
)
|
|
@ -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()
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user