Skip to content

Commit

Permalink
fix(Twitter): fix Enable app icon settings patch
Browse files Browse the repository at this point in the history
  • Loading branch information
swakwork committed Sep 9, 2024
1 parent 3461bd0 commit c2b6f79
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package crimera.patches.twitter.premium.customAppIcon

import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.fingerprint.MethodFingerprint
Expand All @@ -9,6 +12,7 @@ import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import crimera.patches.twitter.misc.settings.SettingsPatch
import crimera.patches.twitter.misc.settings.fingerprints.SettingsStatusLoadFingerprint

Expand All @@ -33,13 +37,14 @@ object CustomiseAppIcon:BytecodePatch(
val result = CustomiseAppIconFingerprint.result
?:throw PatchException("CustomiseAppIconFingerprint not found")

val methods = result.mutableClass.methods.last()
val loc = methods.getInstructions().last { it.opcode == Opcode.CONST }.location.index
val method = result.mutableClass.methods.last()
val loc = method.getInstructions().last { it.opcode == Opcode.MOVE_RESULT }.location.index

//removes toast condition
methods.removeInstruction(loc)
methods.removeInstruction(loc-1)
val reg = method.getInstruction<OneRegisterInstruction>(loc).registerA

method.addInstruction(loc+1,"""
const v$reg, 0x0
""".trimIndent())

SettingsStatusLoadFingerprint.enableSettings("customAppIcon")
//end
Expand Down

0 comments on commit c2b6f79

Please sign in to comment.