Skip to content

Commit

Permalink
feat(FX File Explorer): Add Unlock Plus patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ungeskriptet authored and indrastorms committed Feb 9, 2024
1 parent 74e3611 commit 8672e96
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ repositories {

dependencies {
implementation(libs.revanced.patcher)
implementation(libs.revanced.patches)
implementation(libs.smali)
// TODO: Required because build fails without it. Find a way to remove this dependency.
implementation(libs.guava)
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
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" }
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
}
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
)
)

0 comments on commit 8672e96

Please sign in to comment.