generated from ReVanced/revanced-patches-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(FX File Explorer): Add Unlock Plus patch
- Loading branch information
1 parent
74e3611
commit 8672e96
Showing
4 changed files
with
55 additions
and
0 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
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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
[versions] | ||
revanced-patcher = "19.0.0" | ||
revanced-patches = "3.1.0" | ||
smali = "3.0.3" | ||
guava = "32.1.2-jre" | ||
gson = "2.10.1" | ||
|
||
[libraries] | ||
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" } | ||
revanced-patches = { module = "app.revanced:revanced-patches", version.ref = "revanced-patches" } | ||
smali = { module = "com.android.tools.smali:smali", version.ref = "smali" } | ||
guava = { module = "com.google.guava:guava", version.ref = "guava" } | ||
gson = { module = "com.google.code.gson:gson", version.ref = "gson" } |
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/your/org/patches/fxfileexplorer/unlockplus/UnlockPlusPatch.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,28 @@ | ||
package app.revanced.patches.fxfileexplorer.unlockplus | ||
|
||
import app.revanced.util.exception | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.fxfileexplorer.unlockplus.fingerprints.IsPlusUnlockedFingerprint | ||
|
||
@Patch( | ||
name = "Unlock FX Plus", | ||
description = "Unlock features like 'Web Access', 'Network' and 'FX Connect'.", | ||
compatiblePackages = [CompatiblePackage("nextapp.fx")] | ||
) | ||
|
||
@Suppress("unused") | ||
object UnlockPlusPatch : BytecodePatch( | ||
setOf(IsPlusUnlockedFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) = IsPlusUnlockedFingerprint.result?.mutableMethod?.addInstructions( | ||
0, | ||
""" | ||
const/4 v0, 0x1 | ||
return v0 | ||
""" | ||
) ?: throw IsPlusUnlockedFingerprint.exception | ||
} |
24 changes: 24 additions & 0 deletions
24
...tlin/your/org/patches/fxfileexplorer/unlockplus/fingerprints/IsPlusUnlockedFingerprint.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,24 @@ | ||
package app.revanced.patches.fxfileexplorer.unlockplus.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
import com.android.tools.smali.dexlib2.Opcode | ||
|
||
object IsPlusUnlockedFingerprint : MethodFingerprint( | ||
returnType = "Z", | ||
accessFlags = AccessFlags.PRIVATE or AccessFlags.STATIC, | ||
strings = listOf( | ||
"keysig= ", | ||
"\nlocalsig=", | ||
"nextapp.fx", | ||
), | ||
opcodes = listOf( | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.MOVE_RESULT_OBJECT, | ||
Opcode.CONST_16, | ||
Opcode.CONST_4, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.MOVE_RESULT_OBJECT | ||
) | ||
) |