mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-01 21:54:24 +02:00
feat: remaining mutable EncodedValue
classes
This commit is contained in:
parent
1db735b1e2
commit
3f97cc8e1f
@ -4,8 +4,8 @@ import app.revanced.patcher.cache.Cache
|
|||||||
import app.revanced.patcher.cache.findIndexed
|
import app.revanced.patcher.cache.findIndexed
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.signature.resolver.SignatureResolver
|
|
||||||
import app.revanced.patcher.signature.MethodSignature
|
import app.revanced.patcher.signature.MethodSignature
|
||||||
|
import app.revanced.patcher.signature.resolver.SignatureResolver
|
||||||
import app.revanced.patcher.util.ListBackedSet
|
import app.revanced.patcher.util.ListBackedSet
|
||||||
import lanchon.multidexlib2.BasicDexFileNamer
|
import lanchon.multidexlib2.BasicDexFileNamer
|
||||||
import lanchon.multidexlib2.DexIO
|
import lanchon.multidexlib2.DexIO
|
||||||
@ -37,6 +37,7 @@ class Patcher(
|
|||||||
opcodes = dexFile.opcodes
|
opcodes = dexFile.opcodes
|
||||||
cache = Cache(dexFile.classes.toMutableList())
|
cache = Cache(dexFile.classes.toMutableList())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add additional dex file container to the patcher.
|
* Add additional dex file container to the patcher.
|
||||||
* @param files The dex file containers to add to the patcher.
|
* @param files The dex file containers to add to the patcher.
|
||||||
@ -66,6 +67,7 @@ class Patcher(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the patched dex file.
|
* Save the patched dex file.
|
||||||
*/
|
*/
|
||||||
@ -113,7 +115,10 @@ class Patcher(
|
|||||||
* PatchResultSuccess will always be returned in the wrapping Result object.
|
* PatchResultSuccess will always be returned in the wrapping Result object.
|
||||||
* If the patch failed to apply, an Exception will always be returned in the wrapping Result object.
|
* If the patch failed to apply, an Exception will always be returned in the wrapping Result object.
|
||||||
*/
|
*/
|
||||||
fun applyPatches(stopOnError: Boolean = false, callback: (String) -> Unit = {}): Map<String, Result<PatchResultSuccess>> {
|
fun applyPatches(
|
||||||
|
stopOnError: Boolean = false,
|
||||||
|
callback: (String) -> Unit = {}
|
||||||
|
): Map<String, Result<PatchResultSuccess>> {
|
||||||
if (!sigsResolved) {
|
if (!sigsResolved) {
|
||||||
SignatureResolver(cache.classes, signatures).resolve(cache.methodMap)
|
SignatureResolver(cache.classes, signatures).resolve(cache.methodMap)
|
||||||
sigsResolved = true
|
sigsResolved = true
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package app.revanced.patcher.proxy.mutableTypes
|
package app.revanced.patcher.proxy.mutableTypes
|
||||||
|
|
||||||
import app.revanced.patcher.proxy.mutableTypes.MutableEncodedValue.Companion.toMutable
|
import app.revanced.patcher.proxy.mutableTypes.encodedValue.MutableEncodedValue
|
||||||
|
import app.revanced.patcher.proxy.mutableTypes.encodedValue.MutableEncodedValue.Companion.toMutable
|
||||||
import org.jf.dexlib2.base.BaseAnnotationElement
|
import org.jf.dexlib2.base.BaseAnnotationElement
|
||||||
import org.jf.dexlib2.iface.AnnotationElement
|
import org.jf.dexlib2.iface.AnnotationElement
|
||||||
import org.jf.dexlib2.iface.value.EncodedValue
|
import org.jf.dexlib2.iface.value.EncodedValue
|
||||||
|
@ -94,4 +94,10 @@ class MutableClass(classDef: ClassDef) : ClassDef, BaseTypeReference() {
|
|||||||
override fun getMethods(): MutableSet<MutableMethod> {
|
override fun getMethods(): MutableSet<MutableMethod> {
|
||||||
return _methods
|
return _methods
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun ClassDef.toMutable(): MutableClass {
|
||||||
|
return MutableClass(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,28 +0,0 @@
|
|||||||
package app.revanced.patcher.proxy.mutableTypes
|
|
||||||
|
|
||||||
import org.jf.dexlib2.iface.value.EncodedValue
|
|
||||||
|
|
||||||
// TODO: We need to create implementations for the interfaces
|
|
||||||
// TypeEncodedValue, FieldEncodedValue, MethodEncodedValue,
|
|
||||||
// EnumEncodedValue, ArrayEncodedValue and AnnotationEncodedValue or the cast back to the immutable type will fail
|
|
||||||
class MutableEncodedValue(encodedValue: EncodedValue) : EncodedValue {
|
|
||||||
private var valueType = encodedValue.valueType
|
|
||||||
|
|
||||||
fun setValueType(valueType: Int) {
|
|
||||||
this.valueType = valueType
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun compareTo(other: EncodedValue): Int {
|
|
||||||
return valueType - other.valueType
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getValueType(): Int {
|
|
||||||
return valueType
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun EncodedValue.toMutable(): MutableEncodedValue {
|
|
||||||
return MutableEncodedValue(this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,8 @@
|
|||||||
package app.revanced.patcher.proxy.mutableTypes
|
package app.revanced.patcher.proxy.mutableTypes
|
||||||
|
|
||||||
import app.revanced.patcher.proxy.mutableTypes.MutableAnnotation.Companion.toMutable
|
import app.revanced.patcher.proxy.mutableTypes.MutableAnnotation.Companion.toMutable
|
||||||
import app.revanced.patcher.proxy.mutableTypes.MutableEncodedValue.Companion.toMutable
|
import app.revanced.patcher.proxy.mutableTypes.encodedValue.MutableEncodedValue
|
||||||
|
import app.revanced.patcher.proxy.mutableTypes.encodedValue.MutableEncodedValue.Companion.toMutable
|
||||||
import org.jf.dexlib2.HiddenApiRestriction
|
import org.jf.dexlib2.HiddenApiRestriction
|
||||||
import org.jf.dexlib2.base.reference.BaseFieldReference
|
import org.jf.dexlib2.base.reference.BaseFieldReference
|
||||||
import org.jf.dexlib2.iface.Field
|
import org.jf.dexlib2.iface.Field
|
||||||
@ -11,6 +12,7 @@ class MutableField(field: Field) : Field, BaseFieldReference() {
|
|||||||
private var name = field.name
|
private var name = field.name
|
||||||
private var type = field.type
|
private var type = field.type
|
||||||
private var accessFlags = field.accessFlags
|
private var accessFlags = field.accessFlags
|
||||||
|
|
||||||
private var initialValue = field.initialValue?.toMutable()
|
private var initialValue = field.initialValue?.toMutable()
|
||||||
private val _annotations by lazy { field.annotations.map { annotation -> annotation.toMutable() }.toMutableSet() }
|
private val _annotations by lazy { field.annotations.map { annotation -> annotation.toMutable() }.toMutableSet() }
|
||||||
private val _hiddenApiRestrictions by lazy { field.hiddenApiRestrictions }
|
private val _hiddenApiRestrictions by lazy { field.hiddenApiRestrictions }
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import app.revanced.patcher.proxy.mutableTypes.MutableAnnotationElement.Companion.toMutable
|
||||||
|
import org.jf.dexlib2.base.value.BaseAnnotationEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.AnnotationElement
|
||||||
|
import org.jf.dexlib2.iface.value.AnnotationEncodedValue
|
||||||
|
|
||||||
|
class MutableAnnotationEncodedValue(annotationEncodedValue: AnnotationEncodedValue) : BaseAnnotationEncodedValue(),
|
||||||
|
MutableEncodedValue {
|
||||||
|
private var type = annotationEncodedValue.type
|
||||||
|
|
||||||
|
private val _elements by lazy {
|
||||||
|
annotationEncodedValue.elements.map { annotationElement -> annotationElement.toMutable() }.toMutableSet()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getType(): String {
|
||||||
|
return this.type
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setType(type: String) {
|
||||||
|
this.type = type
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getElements(): MutableSet<out AnnotationElement> {
|
||||||
|
return _elements
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun AnnotationEncodedValue.toMutable(): MutableAnnotationEncodedValue {
|
||||||
|
return MutableAnnotationEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import app.revanced.patcher.proxy.mutableTypes.encodedValue.MutableEncodedValue.Companion.toMutable
|
||||||
|
import org.jf.dexlib2.base.value.BaseArrayEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.ArrayEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.EncodedValue
|
||||||
|
|
||||||
|
class MutableArrayEncodedValue(arrayEncodedValue: ArrayEncodedValue) : BaseArrayEncodedValue(), MutableEncodedValue {
|
||||||
|
private val _value by lazy {
|
||||||
|
arrayEncodedValue.value.map { encodedValue -> encodedValue.toMutable() }.toMutableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getValue(): MutableList<out EncodedValue> {
|
||||||
|
return _value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun ArrayEncodedValue.toMutable(): MutableArrayEncodedValue {
|
||||||
|
return MutableArrayEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseBooleanEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.BooleanEncodedValue
|
||||||
|
|
||||||
|
class MutableBooleanEncodedValue(booleanEncodedValue: BooleanEncodedValue) : BaseBooleanEncodedValue(),
|
||||||
|
MutableEncodedValue {
|
||||||
|
private var value = booleanEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): Boolean {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: Boolean) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun BooleanEncodedValue.toMutable(): MutableBooleanEncodedValue {
|
||||||
|
return MutableBooleanEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseByteEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.ByteEncodedValue
|
||||||
|
|
||||||
|
class MutableByteEncodedValue(byteEncodedValue: ByteEncodedValue) : BaseByteEncodedValue(), MutableEncodedValue {
|
||||||
|
private var value = byteEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): Byte {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: Byte) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun ByteEncodedValue.toMutable(): MutableByteEncodedValue {
|
||||||
|
return MutableByteEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseCharEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.CharEncodedValue
|
||||||
|
|
||||||
|
class MutableCharEncodedValue(charEncodedValue: CharEncodedValue) : BaseCharEncodedValue(), MutableEncodedValue {
|
||||||
|
private var value = charEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): Char {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: Char) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun CharEncodedValue.toMutable(): MutableCharEncodedValue {
|
||||||
|
return MutableCharEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseDoubleEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.DoubleEncodedValue
|
||||||
|
|
||||||
|
class MutableDoubleEncodedValue(doubleEncodedValue: DoubleEncodedValue) : BaseDoubleEncodedValue(),
|
||||||
|
MutableEncodedValue {
|
||||||
|
private var value = doubleEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): Double {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: Double) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun DoubleEncodedValue.toMutable(): MutableDoubleEncodedValue {
|
||||||
|
return MutableDoubleEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.ValueType
|
||||||
|
import org.jf.dexlib2.iface.value.*
|
||||||
|
|
||||||
|
interface MutableEncodedValue : EncodedValue {
|
||||||
|
companion object {
|
||||||
|
fun EncodedValue.toMutable(): MutableEncodedValue {
|
||||||
|
return when (this.valueType) {
|
||||||
|
ValueType.TYPE -> MutableTypeEncodedValue(this as TypeEncodedValue)
|
||||||
|
ValueType.FIELD -> MutableFieldEncodedValue(this as FieldEncodedValue)
|
||||||
|
ValueType.METHOD -> MutableMethodEncodedValue(this as MethodEncodedValue)
|
||||||
|
ValueType.ENUM -> MutableEnumEncodedValue(this as EnumEncodedValue)
|
||||||
|
ValueType.ARRAY -> MutableArrayEncodedValue(this as ArrayEncodedValue)
|
||||||
|
ValueType.ANNOTATION -> MutableAnnotationEncodedValue(this as AnnotationEncodedValue)
|
||||||
|
ValueType.BYTE -> MutableByteEncodedValue(this as ByteEncodedValue)
|
||||||
|
ValueType.SHORT -> MutableShortEncodedValue(this as ShortEncodedValue)
|
||||||
|
ValueType.CHAR -> MutableCharEncodedValue(this as CharEncodedValue)
|
||||||
|
ValueType.INT -> MutableIntEncodedValue(this as IntEncodedValue)
|
||||||
|
ValueType.LONG -> MutableLongEncodedValue(this as LongEncodedValue)
|
||||||
|
ValueType.FLOAT -> MutableFloatEncodedValue(this as FloatEncodedValue)
|
||||||
|
ValueType.DOUBLE -> MutableDoubleEncodedValue(this as DoubleEncodedValue)
|
||||||
|
ValueType.METHOD_TYPE -> MutableMethodTypeEncodedValue(this as MethodTypeEncodedValue)
|
||||||
|
ValueType.METHOD_HANDLE -> MutableMethodHandleEncodedValue(this as MethodHandleEncodedValue)
|
||||||
|
ValueType.STRING -> MutableStringEncodedValue(this as StringEncodedValue)
|
||||||
|
ValueType.BOOLEAN -> MutableBooleanEncodedValue(this as BooleanEncodedValue)
|
||||||
|
ValueType.NULL -> MutableNullEncodedValue()
|
||||||
|
else -> this as MutableEncodedValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseEnumEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.reference.FieldReference
|
||||||
|
import org.jf.dexlib2.iface.value.EnumEncodedValue
|
||||||
|
|
||||||
|
class MutableEnumEncodedValue(enumEncodedValue: EnumEncodedValue) : BaseEnumEncodedValue(), MutableEncodedValue {
|
||||||
|
private var value = enumEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): FieldReference {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: FieldReference) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun EnumEncodedValue.toMutable(): MutableEnumEncodedValue {
|
||||||
|
return MutableEnumEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.ValueType
|
||||||
|
import org.jf.dexlib2.base.value.BaseFieldEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.reference.FieldReference
|
||||||
|
import org.jf.dexlib2.iface.value.FieldEncodedValue
|
||||||
|
|
||||||
|
class MutableFieldEncodedValue(fieldEncodedValue: FieldEncodedValue) : BaseFieldEncodedValue(), MutableEncodedValue {
|
||||||
|
private var value = fieldEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValueType(): Int {
|
||||||
|
return ValueType.FIELD
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getValue(): FieldReference {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: FieldReference) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun FieldEncodedValue.toMutable(): MutableFieldEncodedValue {
|
||||||
|
return MutableFieldEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseFloatEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.FloatEncodedValue
|
||||||
|
|
||||||
|
class MutableFloatEncodedValue(floatEncodedValue: FloatEncodedValue) : BaseFloatEncodedValue(), MutableEncodedValue {
|
||||||
|
private var value = floatEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): Float {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: Float) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun FloatEncodedValue.toMutable(): MutableFloatEncodedValue {
|
||||||
|
return MutableFloatEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseIntEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.IntEncodedValue
|
||||||
|
|
||||||
|
class MutableIntEncodedValue(intEncodedValue: IntEncodedValue) : BaseIntEncodedValue(), MutableEncodedValue {
|
||||||
|
private var value = intEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): Int {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: Int) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun IntEncodedValue.toMutable(): MutableIntEncodedValue {
|
||||||
|
return MutableIntEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseLongEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.LongEncodedValue
|
||||||
|
|
||||||
|
class MutableLongEncodedValue(longEncodedValue: LongEncodedValue) : BaseLongEncodedValue(), MutableEncodedValue {
|
||||||
|
private var value = longEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): Long {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: Long) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun LongEncodedValue.toMutable(): MutableLongEncodedValue {
|
||||||
|
return MutableLongEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseMethodEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.reference.MethodReference
|
||||||
|
import org.jf.dexlib2.iface.value.MethodEncodedValue
|
||||||
|
|
||||||
|
class MutableMethodEncodedValue(methodEncodedValue: MethodEncodedValue) : BaseMethodEncodedValue(),
|
||||||
|
MutableEncodedValue {
|
||||||
|
private var value = methodEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): MethodReference {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: MethodReference) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun MethodEncodedValue.toMutable(): MutableMethodEncodedValue {
|
||||||
|
return MutableMethodEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseMethodHandleEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.reference.MethodHandleReference
|
||||||
|
import org.jf.dexlib2.iface.value.MethodHandleEncodedValue
|
||||||
|
|
||||||
|
class MutableMethodHandleEncodedValue(methodHandleEncodedValue: MethodHandleEncodedValue) :
|
||||||
|
BaseMethodHandleEncodedValue(),
|
||||||
|
MutableEncodedValue {
|
||||||
|
private var value = methodHandleEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): MethodHandleReference {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: MethodHandleReference) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun MethodHandleEncodedValue.toMutable(): MutableMethodHandleEncodedValue {
|
||||||
|
return MutableMethodHandleEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseMethodTypeEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.reference.MethodProtoReference
|
||||||
|
import org.jf.dexlib2.iface.value.MethodTypeEncodedValue
|
||||||
|
|
||||||
|
class MutableMethodTypeEncodedValue(methodTypeEncodedValue: MethodTypeEncodedValue) : BaseMethodTypeEncodedValue(),
|
||||||
|
MutableEncodedValue {
|
||||||
|
private var value = methodTypeEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): MethodProtoReference {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: MethodProtoReference) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun MethodTypeEncodedValue.toMutable(): MutableMethodTypeEncodedValue {
|
||||||
|
return MutableMethodTypeEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseNullEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.ByteEncodedValue
|
||||||
|
|
||||||
|
class MutableNullEncodedValue : BaseNullEncodedValue(), MutableEncodedValue {
|
||||||
|
companion object {
|
||||||
|
fun ByteEncodedValue.toMutable(): MutableByteEncodedValue {
|
||||||
|
return MutableByteEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseShortEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.ShortEncodedValue
|
||||||
|
|
||||||
|
class MutableShortEncodedValue(shortEncodedValue: ShortEncodedValue) : BaseShortEncodedValue(), MutableEncodedValue {
|
||||||
|
private var value = shortEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): Short {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: Short) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun ShortEncodedValue.toMutable(): MutableShortEncodedValue {
|
||||||
|
return MutableShortEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseStringEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.ByteEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.StringEncodedValue
|
||||||
|
|
||||||
|
class MutableStringEncodedValue(stringEncodedValue: StringEncodedValue) : BaseStringEncodedValue(),
|
||||||
|
MutableEncodedValue {
|
||||||
|
private var value = stringEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): String {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: String) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun ByteEncodedValue.toMutable(): MutableByteEncodedValue {
|
||||||
|
return MutableByteEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patcher.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
|
import org.jf.dexlib2.base.value.BaseTypeEncodedValue
|
||||||
|
import org.jf.dexlib2.iface.value.TypeEncodedValue
|
||||||
|
|
||||||
|
class MutableTypeEncodedValue(typeEncodedValue: TypeEncodedValue) : BaseTypeEncodedValue(), MutableEncodedValue {
|
||||||
|
private var value = typeEncodedValue.value
|
||||||
|
|
||||||
|
override fun getValue(): String {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setValue(value: String) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun TypeEncodedValue.toMutable(): MutableTypeEncodedValue {
|
||||||
|
return MutableTypeEncodedValue(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user