mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-06 23:16:59 +01:00
feat(crunchyroll): enable-downloads
patch (#1119)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
d92c4970b8
commit
84d7bfdbf8
@ -0,0 +1,13 @@
|
||||
package app.revanced.patches.crunchyroll.downloads.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[
|
||||
Package("com.crunchyroll.crunchyroid")
|
||||
]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class DownloadsCompatibility
|
@ -0,0 +1,23 @@
|
||||
package app.revanced.patches.crunchyroll.downloads.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.crunchyroll.downloads.annotations.DownloadsCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("downloads-fingerprint")
|
||||
@DownloadsCompatibility
|
||||
@Version("0.0.1")
|
||||
object DownloadsFingerprint : MethodFingerprint(
|
||||
"Z", AccessFlags.PUBLIC or AccessFlags.FINAL, null,
|
||||
opcodes = listOf(
|
||||
Opcode.CONST_STRING,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.RETURN
|
||||
),
|
||||
strings = listOf("offline_viewing"),
|
||||
)
|
@ -0,0 +1,37 @@
|
||||
package app.revanced.patches.crunchyroll.downloads.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.crunchyroll.downloads.annotations.DownloadsCompatibility
|
||||
import app.revanced.patches.crunchyroll.downloads.fingerprints.DownloadsFingerprint
|
||||
|
||||
@Patch
|
||||
@Name("enable-downloads")
|
||||
@Description("Enables downloads for Crunchyroll.")
|
||||
@DownloadsCompatibility
|
||||
@Version("0.0.1")
|
||||
class DownloadsPatch : BytecodePatch(
|
||||
listOf(
|
||||
DownloadsFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
with(DownloadsFingerprint.result!!.mutableMethod) {
|
||||
val index = implementation!!.instructions.lastIndex
|
||||
replaceInstruction(
|
||||
index - 1,
|
||||
"""
|
||||
const/4 v0, 0x1
|
||||
"""
|
||||
)
|
||||
}
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user