You've already forked revanced-patcher
mirror of
https://github.com/revanced/revanced-patcher
synced 2025-09-06 16:38:50 +02:00
Compare commits
10 Commits
v2.2.0-dev
...
v2.3.0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
89a27dfbe6 | ||
![]() |
4ea030d0a0 | ||
![]() |
4cc2fa17f5 | ||
![]() |
48068cb3d7 | ||
![]() |
d107c7245c | ||
![]() |
4b2e3230ec | ||
![]() |
fb5b82da4e | ||
![]() |
5970e32aa5 | ||
![]() |
0f00d33f4e | ||
![]() |
83187c9edd |
41
CHANGELOG.md
41
CHANGELOG.md
@@ -1,3 +1,44 @@
|
||||
# [2.3.0](https://github.com/revanced/revanced-patcher/compare/v2.2.2...v2.3.0) (2022-07-05)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* nullability for `BytecodePatch` constructor ([#59](https://github.com/revanced/revanced-patcher/issues/59)) ([4ea030d](https://github.com/revanced/revanced-patcher/commit/4ea030d0a03f736bbecbd491317ba2167b18fe94))
|
||||
|
||||
## [2.2.2](https://github.com/revanced/revanced-patcher/compare/v2.2.1...v2.2.2) (2022-07-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* `MethodWalker` not accounting for all reference instructions ([48068cb](https://github.com/revanced/revanced-patcher/commit/48068cb3d79e283ff1cad9f3f78dc1d0fcd14f83))
|
||||
|
||||
## [2.2.1](https://github.com/revanced/revanced-patcher/compare/v2.2.0...v2.2.1) (2022-07-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* more useful error message ([4b2e323](https://github.com/revanced/revanced-patcher/commit/4b2e3230ec74fa3a57ae86067e5cb7cecbe45013))
|
||||
|
||||
# [2.2.0](https://github.com/revanced/revanced-patcher/compare/v2.1.2...v2.2.0) (2022-07-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* DomFileEditor opening in- and output streams on the same file ([83187c9](https://github.com/revanced/revanced-patcher/commit/83187c9edd7b088bc18960c5eb9a2042ca536b5f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* remove deprecated functions ([ada5a03](https://github.com/revanced/revanced-patcher/commit/ada5a033de3cf94e7255ec2d522520f86431f001))
|
||||
* streams overload for `XmlFileHolder` ([6f72c4c](https://github.com/revanced/revanced-patcher/commit/6f72c4c4c051e48c8d03d2a7b2cfc1c53028ed86))
|
||||
|
||||
# [2.2.0-dev.3](https://github.com/revanced/revanced-patcher/compare/v2.2.0-dev.2...v2.2.0-dev.3) (2022-07-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* DomFileEditor opening in- and output streams on the same file ([83187c9](https://github.com/revanced/revanced-patcher/commit/83187c9edd7b088bc18960c5eb9a2042ca536b5f))
|
||||
|
||||
# [2.2.0-dev.2](https://github.com/revanced/revanced-patcher/compare/v2.2.0-dev.1...v2.2.0-dev.2) (2022-07-02)
|
||||
|
||||
|
||||
|
@@ -1,2 +1,2 @@
|
||||
kotlin.code.style = official
|
||||
version = 2.2.0-dev.2
|
||||
version = 2.3.0
|
||||
|
@@ -268,7 +268,7 @@ class Patcher(private val options: PatcherOptions) {
|
||||
|
||||
if (result.isSuccess()) return@forEach
|
||||
|
||||
val errorMessage = result.error()!!.message
|
||||
val errorMessage = result.error()!!.cause
|
||||
return PatchResultError("'$patchName' depends on '${patchDependency.patchName}' but the following error was raised: $errorMessage")
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ class Patcher(private val options: PatcherOptions) {
|
||||
data.resourceData
|
||||
} else {
|
||||
val bytecodeData = data.bytecodeData
|
||||
(patchInstance as BytecodePatch).fingerprints.resolve(bytecodeData, bytecodeData.classes.internalClasses)
|
||||
(patchInstance as BytecodePatch).fingerprints?.resolve(bytecodeData, bytecodeData.classes.internalClasses)
|
||||
bytecodeData
|
||||
}
|
||||
|
||||
|
@@ -20,19 +20,23 @@ class ResourceData(private val resourceCacheDirectory: File) : Data, Iterable<Fi
|
||||
|
||||
inner class XmlFileHolder {
|
||||
operator fun get(inputStream: InputStream, outputStream: OutputStream) =
|
||||
DomFileEditor(inputStream, outputStream)
|
||||
DomFileEditor(inputStream, lazyOf(outputStream))
|
||||
|
||||
operator fun get(path: String) = DomFileEditor(this@ResourceData[path])
|
||||
}
|
||||
}
|
||||
|
||||
class DomFileEditor internal constructor(inputStream: InputStream, private val outputStream: OutputStream) : Closeable {
|
||||
constructor(file: File) : this(file.inputStream(), file.outputStream())
|
||||
class DomFileEditor internal constructor(inputStream: InputStream, private val outputStream: Lazy<OutputStream>) : Closeable {
|
||||
|
||||
// lazily open an output stream
|
||||
// this is required because when constructing a DomFileEditor the output stream is created along with the input stream, which is not allowed
|
||||
// the workaround is to lazily create the output stream. This way it would be used after the input stream is closed, which happens in the constructor
|
||||
constructor(file: File) : this(file.inputStream(), lazy { file.outputStream() })
|
||||
|
||||
val file: Document =
|
||||
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream).also(Document::normalize)
|
||||
|
||||
override fun close() =
|
||||
TransformerFactory.newInstance().newTransformer().transform(DOMSource(file), StreamResult(outputStream))
|
||||
TransformerFactory.newInstance().newTransformer().transform(DOMSource(file), StreamResult(outputStream.value))
|
||||
|
||||
}
|
||||
|
@@ -9,5 +9,5 @@ import app.revanced.patcher.patch.Patch
|
||||
* @param fingerprints A list of [MethodFingerprint] this patch relies on.
|
||||
*/
|
||||
abstract class BytecodePatch(
|
||||
internal val fingerprints: Iterable<MethodFingerprint>
|
||||
) : Patch<BytecodeData>()
|
||||
internal val fingerprints: Iterable<MethodFingerprint>? = null
|
||||
) : Patch<BytecodeData>()
|
||||
|
@@ -4,11 +4,9 @@ import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.data.impl.MethodNotFoundException
|
||||
import app.revanced.patcher.extensions.softCompareTo
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import org.jf.dexlib2.Format
|
||||
import org.jf.dexlib2.iface.Method
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import org.jf.dexlib2.iface.reference.MethodReference
|
||||
import org.jf.dexlib2.util.Preconditions
|
||||
|
||||
/**
|
||||
* Find a method from another method via instruction offsets.
|
||||
@@ -37,9 +35,7 @@ class MethodWalker internal constructor(
|
||||
currentMethod.implementation?.instructions?.let { instructions ->
|
||||
val instruction = instructions.elementAt(offset)
|
||||
|
||||
Preconditions.checkFormat(instruction.opcode, Format.Format35c)
|
||||
|
||||
val newMethod = (instruction as Instruction35c).reference as MethodReference
|
||||
val newMethod = (instruction as ReferenceInstruction).reference as MethodReference
|
||||
val proxy = bytecodeData.findClass(newMethod.definingClass)!!
|
||||
|
||||
val methods = if (walkMutable) proxy.resolve().methods else proxy.immutableClass.methods
|
||||
|
Reference in New Issue
Block a user