mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-16 14:12:27 +01:00
Compare commits
11 Commits
v2.185.0-d
...
v2.185.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1fade09694 | ||
|
|
90e32eac54 | ||
|
|
a0632c8a92 | ||
|
|
9da2bc32a1 | ||
|
|
89fed3874f | ||
|
|
e4adaebad4 | ||
|
|
0b78e8377b | ||
|
|
6b2f7862d1 | ||
|
|
4668861d65 | ||
|
|
c5c63537ff | ||
|
|
5de8ee51c1 |
35
CHANGELOG.md
35
CHANGELOG.md
@@ -1,3 +1,38 @@
|
|||||||
|
# [2.185.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v2.185.0-dev.5...v2.185.0-dev.6) (2023-07-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Tiktok - Settings:** bump compatibility ([#2656](https://github.com/ReVanced/revanced-patches/issues/2656)) ([6641356](https://github.com/ReVanced/revanced-patches/commit/6641356d41813a20c77faac67c37ea517690d25b))
|
||||||
|
|
||||||
|
# [2.185.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v2.185.0-dev.4...v2.185.0-dev.5) (2023-07-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Trakt - Unlock pro:** constraint to last known working version ([#2662](https://github.com/ReVanced/revanced-patches/issues/2662)) ([324bbde](https://github.com/ReVanced/revanced-patches/commit/324bbde92a851e855c11f266e92fa14c39d88160))
|
||||||
|
|
||||||
|
# [2.185.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v2.185.0-dev.3...v2.185.0-dev.4) (2023-07-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **TikTok - Show seekbar:** fix seekbar not always showing ([#2660](https://github.com/ReVanced/revanced-patches/issues/2660)) ([f2742f1](https://github.com/ReVanced/revanced-patches/commit/f2742f1ba117809971a10780823fca99c19a4f34))
|
||||||
|
|
||||||
|
# [2.185.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v2.185.0-dev.2...v2.185.0-dev.3) (2023-07-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Sync for Reddit - Disable ads:** fix compatibility with latest version ([1456577](https://github.com/ReVanced/revanced-patches/commit/1456577f11c4a7e49d6c1ba0103b919dc487f4cf))
|
||||||
|
|
||||||
|
# [2.185.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.185.0-dev.1...v2.185.0-dev.2) (2023-07-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* allocate for more than eight `LithoFilter` array items ([#2643](https://github.com/ReVanced/revanced-patches/issues/2643)) ([fc8660b](https://github.com/ReVanced/revanced-patches/commit/fc8660b740bec2747e5f82b7321027bb8a51e0cf))
|
||||||
|
|
||||||
# [2.185.0-dev.1](https://github.com/revanced/revanced-patches/compare/v2.184.1-dev.1...v2.185.0-dev.1) (2023-07-15)
|
# [2.185.0-dev.1](https://github.com/revanced/revanced-patches/compare/v2.184.1-dev.1...v2.185.0-dev.1) (2023-07-15)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.185.0-dev.1
|
version = 2.185.0-dev.6
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,11 +1,10 @@
|
|||||||
package app.revanced.patches.syncforreddit.detection.piracy.fingerprints
|
package app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import org.jf.dexlib2.iface.reference.TypeReference
|
|
||||||
|
|
||||||
object PiracyDetectionFingerprint : MethodFingerprint(
|
object PiracyDetectionFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
package app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.patch
|
package app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.patch
|
||||||
|
|
||||||
import app.revanced.extensions.toErrorResult
|
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patches.syncforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint
|
import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint
|
||||||
|
|
||||||
@Description("Disables detection of modified versions.")
|
@Description("Disables detection of modified versions.")
|
||||||
@Version("0.0.1")
|
|
||||||
class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerprint)) {
|
class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerprint)) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
// Do not return an error if the fingerprint is not resolved.
|
||||||
|
// This is fine because new versions of the target app do not need this patch.
|
||||||
PiracyDetectionFingerprint.result?.mutableMethod?.apply {
|
PiracyDetectionFingerprint.result?.mutableMethod?.apply {
|
||||||
addInstruction(
|
addInstruction(
|
||||||
0,
|
0,
|
||||||
@@ -21,7 +20,7 @@ class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerpr
|
|||||||
return-void
|
return-void
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
} ?: return PiracyDetectionFingerprint.toErrorResult()
|
}
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
package app.revanced.patches.tiktok.interaction.seekbar.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
|
|
||||||
object AwemeGetVideoControlFingerprint : MethodFingerprint(
|
|
||||||
"L",
|
|
||||||
AccessFlags.PUBLIC.value,
|
|
||||||
customFingerprint = { methodDef, _ ->
|
|
||||||
methodDef.definingClass.endsWith("/Aweme;") && methodDef.name == "getVideoControl"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.revanced.patches.tiktok.interaction.seekbar.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
|
object SetSeekBarShowTypeFingerprint : MethodFingerprint(
|
||||||
|
strings = listOf(
|
||||||
|
"seekbar show type change, change to:"
|
||||||
|
),
|
||||||
|
)
|
||||||
@@ -6,17 +6,14 @@ import app.revanced.patcher.annotation.Name
|
|||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.tiktok.interaction.seekbar.annotations.ShowSeekbarCompatibility
|
import app.revanced.patches.tiktok.interaction.seekbar.annotations.ShowSeekbarCompatibility
|
||||||
import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.AwemeGetVideoControlFingerprint
|
import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.SetSeekBarShowTypeFingerprint
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.iface.instruction.formats.Instruction22t
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction11n
|
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("Show seekbar")
|
@Name("Show seekbar")
|
||||||
@@ -25,27 +22,20 @@ import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
|
|||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ShowSeekbarPatch : BytecodePatch(
|
class ShowSeekbarPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
AwemeGetVideoControlFingerprint
|
SetSeekBarShowTypeFingerprint,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
//Get VideoControl FieldReference
|
SetSeekBarShowTypeFingerprint.result?.mutableMethod?.apply {
|
||||||
val videoControl = context.findClass { it.type.endsWith("/VideoControl;") }
|
val typeRegister = getInstruction<Instruction22t>(1).registerB
|
||||||
?: return PatchResultError("Can not find target class")
|
|
||||||
val fieldList = videoControl.immutableClass.fields.associateBy { field -> field.name }
|
|
||||||
|
|
||||||
AwemeGetVideoControlFingerprint.result?.mutableMethod?.implementation?.apply {
|
|
||||||
val ifNullLabel = newLabelForIndex(1)
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
1,
|
0,
|
||||||
listOf(
|
"""
|
||||||
BuilderInstruction11n(Opcode.CONST_4, 1, 1),
|
const/16 v$typeRegister, 0x64
|
||||||
BuilderInstruction21t(Opcode.IF_EQZ, 0, ifNullLabel),
|
"""
|
||||||
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["showProgressBar"]!!),
|
|
||||||
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["draftProgressBar"]!!)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
} ?: return AwemeGetVideoControlFingerprint.toErrorResult()
|
} ?: return SetSeekBarShowTypeFingerprint.toErrorResult()
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
package app.revanced.patches.tiktok.misc.settings.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object AboutPageFingerprint : MethodFingerprint(
|
|
||||||
opcodes = listOf(
|
|
||||||
Opcode.CONST, // copyrightPolicyLabel resource id
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.CONST_STRING
|
|
||||||
),
|
|
||||||
customFingerprint = { methodDef, _ ->
|
|
||||||
methodDef.definingClass == "Lcom/ss/android/ugc/aweme/setting/page/AboutPage;" &&
|
|
||||||
methodDef.name == "onViewCreated"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patches.tiktok.misc.settings.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object AddSettingsEntryFingerprint : MethodFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST_CLASS,
|
||||||
|
Opcode.APUT_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef, _ ->
|
||||||
|
methodDef.definingClass.endsWith("/SettingNewVersionFragment;") &&
|
||||||
|
methodDef.name == "onViewCreated"
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.revanced.patches.tiktok.misc.settings.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
|
object SettingsEntryFingerprint : MethodFingerprint(
|
||||||
|
strings = listOf(
|
||||||
|
"pls pass item or extends the EventUnit"
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package app.revanced.patches.tiktok.misc.settings.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
|
object SettingsEntryInfoFingerprint : MethodFingerprint(
|
||||||
|
strings = listOf(
|
||||||
|
"ExposeItem(title=",
|
||||||
|
", icon="
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package app.revanced.patches.tiktok.misc.settings.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
object SettingsOnViewCreatedFingerprint : MethodFingerprint(
|
|
||||||
customFingerprint = { methodDef, _ ->
|
|
||||||
methodDef.definingClass.endsWith("/SettingNewVersionFragment;") &&
|
|
||||||
methodDef.name == "onViewCreated"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -6,24 +6,19 @@ import app.revanced.patcher.annotation.Name
|
|||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.tiktok.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.tiktok.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.tiktok.misc.settings.annotations.SettingsCompatibility
|
import app.revanced.patches.tiktok.misc.settings.annotations.SettingsCompatibility
|
||||||
import app.revanced.patches.tiktok.misc.settings.fingerprints.AboutPageFingerprint
|
import app.revanced.patches.tiktok.misc.settings.fingerprints.*
|
||||||
import app.revanced.patches.tiktok.misc.settings.fingerprints.AdPersonalizationActivityOnCreateFingerprint
|
|
||||||
import app.revanced.patches.tiktok.misc.settings.fingerprints.SettingsOnViewCreatedFingerprint
|
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([IntegrationsPatch::class])
|
@DependsOn([IntegrationsPatch::class])
|
||||||
@@ -33,65 +28,44 @@ import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class SettingsPatch : BytecodePatch(
|
class SettingsPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
AboutPageFingerprint,
|
|
||||||
AdPersonalizationActivityOnCreateFingerprint,
|
AdPersonalizationActivityOnCreateFingerprint,
|
||||||
SettingsOnViewCreatedFingerprint,
|
AddSettingsEntryFingerprint,
|
||||||
|
SettingsEntryFingerprint,
|
||||||
|
SettingsEntryInfoFingerprint,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
SettingsOnViewCreatedFingerprint.result?.mutableMethod?.apply {
|
// Find the class name of classes which construct a settings entry
|
||||||
val instructions = implementation!!.instructions
|
val settingsButtonClass = SettingsEntryFingerprint.result?.classDef?.type?.toClassName()
|
||||||
|
?: return SettingsEntryFingerprint.toErrorResult()
|
||||||
|
val settingsButtonInfoClass = SettingsEntryInfoFingerprint.result?.classDef?.type?.toClassName()
|
||||||
|
?: return SettingsEntryInfoFingerprint.toErrorResult()
|
||||||
|
|
||||||
// Find the indices that need to be patched.
|
// Create a settings entry for 'revanced settings' and add it to settings fragment
|
||||||
val copyrightPolicyLabelId = AboutPageFingerprint.result?.let {
|
AddSettingsEntryFingerprint.result?.apply {
|
||||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
scanResult.patternScanResult?.startIndex?.let {
|
||||||
it.mutableMethod.getInstruction<WideLiteralInstruction>(startIndex).wideLiteral
|
val settingsEntries = mutableMethod.getInstruction(it + 3)
|
||||||
} ?: return AboutPageFingerprint.toErrorResult()
|
val addEntry = mutableMethod.getInstruction(it + 5)
|
||||||
|
// Add the settings entry created to the settings fragment
|
||||||
val copyrightIndex = instructions.indexOfFirst {
|
mutableMethod.addInstructions(
|
||||||
(it as? ReferenceInstruction)?.reference.toString() == "copyright_policy"
|
it + 6,
|
||||||
} - 6
|
listOf(
|
||||||
|
settingsEntries,
|
||||||
|
addEntry
|
||||||
// fixme: instead use Method.indexOfFirstConstantInstructionValue()
|
)
|
||||||
val copyrightPolicyIndex = instructions.indexOfFirst {
|
|
||||||
(it as? WideLiteralInstruction)?.wideLiteral == copyrightPolicyLabelId
|
|
||||||
} + 2
|
|
||||||
|
|
||||||
// Replace an existing settings entry with ReVanced settings entry.
|
|
||||||
arrayOf(
|
|
||||||
copyrightIndex,
|
|
||||||
copyrightPolicyIndex
|
|
||||||
).forEach { index ->
|
|
||||||
val instruction = getInstruction(index)
|
|
||||||
if (instruction.opcode != Opcode.MOVE_RESULT_OBJECT)
|
|
||||||
return PatchResultError("Hardcoded offset changed.")
|
|
||||||
|
|
||||||
val settingsEntryStringRegister = (instruction as OneRegisterInstruction).registerA
|
|
||||||
|
|
||||||
// Replace the settings entry string with a custom one.
|
|
||||||
replaceInstruction(
|
|
||||||
index,
|
|
||||||
"""
|
|
||||||
const-string v$settingsEntryStringRegister, "ReVanced Settings"
|
|
||||||
"""
|
|
||||||
)
|
)
|
||||||
|
// These instructions call a method that create a settings entry use reflection base on the class name of classes that construct settings entry
|
||||||
// Replace the OnClickListener class with a custom one.
|
mutableMethod.addInstructions(
|
||||||
val onClickListener = getInstruction<ReferenceInstruction>(index + 4).reference.toString()
|
it + 6,
|
||||||
|
|
||||||
context.findClass(onClickListener)?.mutableClass?.methods?.first {
|
|
||||||
it.name == "onClick"
|
|
||||||
}?.addInstructions(
|
|
||||||
0,
|
|
||||||
"""
|
"""
|
||||||
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->startSettingsActivity()V
|
const-string v1, "$settingsButtonClass"
|
||||||
return-void
|
const-string v2, "$settingsButtonInfoClass"
|
||||||
|
invoke-static {v1, v2}, $CREATE_SETTINGS_ENTRY_METHOD_DESCRIPTOR
|
||||||
|
move-result-object v1
|
||||||
"""
|
"""
|
||||||
) ?: return PatchResultError("Could not find the onClick method.")
|
)
|
||||||
}
|
}
|
||||||
|
} ?: return AddSettingsEntryFingerprint.toErrorResult()
|
||||||
} ?: return SettingsOnViewCreatedFingerprint.toErrorResult()
|
|
||||||
|
|
||||||
// Initialize the settings menu once the replaced setting entry is clicked.
|
// Initialize the settings menu once the replaced setting entry is clicked.
|
||||||
AdPersonalizationActivityOnCreateFingerprint.result?.mutableMethod?.apply {
|
AdPersonalizationActivityOnCreateFingerprint.result?.mutableMethod?.apply {
|
||||||
@@ -101,18 +75,25 @@ class SettingsPatch : BytecodePatch(
|
|||||||
|
|
||||||
val thisRegister = getInstruction<FiveRegisterInstruction>(initializeSettingsIndex - 1).registerC
|
val thisRegister = getInstruction<FiveRegisterInstruction>(initializeSettingsIndex - 1).registerC
|
||||||
|
|
||||||
addInstructions(
|
addInstructionsWithLabels(
|
||||||
initializeSettingsIndex,
|
initializeSettingsIndex,
|
||||||
"""
|
"""
|
||||||
invoke-static {v$thisRegister}, $INITIALIZE_SETTINGS_METHOD_DESCRIPTOR
|
invoke-static {v$thisRegister}, $INITIALIZE_SETTINGS_METHOD_DESCRIPTOR
|
||||||
|
move-result v0
|
||||||
|
if-eqz v0, :notrevanced
|
||||||
return-void
|
return-void
|
||||||
"""
|
""",
|
||||||
|
ExternalLabel("notrevanced", getInstruction(initializeSettingsIndex))
|
||||||
)
|
)
|
||||||
} ?: return AdPersonalizationActivityOnCreateFingerprint.toErrorResult()
|
} ?: return AdPersonalizationActivityOnCreateFingerprint.toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun String.toClassName(): String {
|
||||||
|
return substring(1, this.length - 1).replace("/", ".")
|
||||||
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/tiktok/settingsmenu/SettingsMenu;"
|
"Lapp/revanced/tiktok/settingsmenu/SettingsMenu;"
|
||||||
@@ -120,6 +101,11 @@ class SettingsPatch : BytecodePatch(
|
|||||||
private const val INITIALIZE_SETTINGS_METHOD_DESCRIPTOR =
|
private const val INITIALIZE_SETTINGS_METHOD_DESCRIPTOR =
|
||||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->initializeSettings(" +
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->initializeSettings(" +
|
||||||
"Lcom/bytedance/ies/ugc/aweme/commercialize/compliance/personalization/AdPersonalizationActivity;" +
|
"Lcom/bytedance/ies/ugc/aweme/commercialize/compliance/personalization/AdPersonalizationActivity;" +
|
||||||
")V"
|
")Z"
|
||||||
|
private const val CREATE_SETTINGS_ENTRY_METHOD_DESCRIPTOR =
|
||||||
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->createSettingsEntry(" +
|
||||||
|
"Ljava/lang/String;" +
|
||||||
|
"Ljava/lang/String;" +
|
||||||
|
")Ljava/lang/Object;"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,6 @@ package app.revanced.patches.trakt.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("tv.trakt.trakt")])
|
@Compatibility([Package("tv.trakt.trakt", arrayOf("1.1.1"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class UnlockProCompatibility
|
internal annotation class UnlockProCompatibility
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ class LithoFilterPatch : BytecodePatch(
|
|||||||
"""
|
"""
|
||||||
new-instance v1, $classDescriptor
|
new-instance v1, $classDescriptor
|
||||||
invoke-direct {v1}, $classDescriptor-><init>()V
|
invoke-direct {v1}, $classDescriptor-><init>()V
|
||||||
const/4 v2, ${filterCount++}
|
const/16 v2, ${filterCount++}
|
||||||
aput-object v1, v0, v2
|
aput-object v1, v0, v2
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
@@ -187,7 +187,7 @@ class LithoFilterPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun close() = LithoFilterFingerprint.result!!
|
override fun close() = LithoFilterFingerprint.result!!
|
||||||
.mutableMethod.replaceInstruction(0, "const/4 v0, $filterCount")
|
.mutableMethod.replaceInstruction(0, "const/16 v0, $filterCount")
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val MethodFingerprint.patternScanResult
|
private val MethodFingerprint.patternScanResult
|
||||||
@@ -208,4 +208,4 @@ class LithoFilterPatch : BytecodePatch(
|
|||||||
|
|
||||||
private var filterCount = 0
|
private var filterCount = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user