Skip to content

doc: Guide for migrating patches code from ReVanced to Morphe #22

Description

@LisoUseInAIKyrios

Instructions to migrate your patches codebase from ReVanced to Morphe:

Required project changes:

Rebase your patches off the morphe-patches-template repo (if you forked it), or manually apply the following changes to your repo:

libs.versions.toml
morphe-patcher = "1.3.2"
smali = "b6365a84f4"
settings.gradle.kts
pluginManagement {
    repositories {
        mavenLocal()
        gradlePluginPortal()
        google()
        maven {
            name = "GitHubPackages"
            url = uri("https://maven.pkg.github.com/MorpheApp/registry")
            credentials {
                username = providers.gradleProperty("gpr.user").getOrElse(System.getenv("GITHUB_ACTOR"))
                password = providers.gradleProperty("gpr.key").getOrElse(System.getenv("GITHUB_TOKEN"))
            }
        }
        maven { url = uri("https://jitpack.io") }
    }
}

plugins {
    id("app.morphe.patches") version "1.2.0"
}

Required patch code changes

  1. Change all patcher class imports from app.revanced.* to app.morphe.*
  2. Change iterating using ProxyClassList.forEach{} to classDefForEach()
  3. Change class lookup using ProxyClassList.find{} to classDefBy(classDef) or mutableClassDefBy(classDef)
  4. Change proxy(classDef).mutableClass to mutableClassDefBy(classDef)
  5. Fuzzy pattern scan is no longer supported. Either change to instruction filters or update the opcode pattern one last time and remove fuzzy.
  6. Replace patternMatch.firstIndex -> instructionMatches.first().index and patternMatch.lastIndex -> instructionMatches.last().index
  7. Update extension hook if needed.

Optional patch code changes

  1. Change from DSL fingerprints to object fingerprints so exception stack traces show fingerprint class names (recommended but not required). Migrate DSL fingerprint opcodes { Opcode... } to class parameter filters = OpcodesFilter.opcodesToFilters(Opcode...)
  2. Read the patcher guide on how to start using instruction filters.

Other changes

Update/rename the repo patch name to use a supplemental description of "Compatible with Morphe" or "XYZ patches for Morphe". See template repo for exact details.

 

Getting your patches into Morphe Manager

The template repo is setup to automatically create patches-bundle.json when creating releases. See other notes and setup steps in the patches template repo: https://github.com/morpheapp/morphe-patches-template

 

Motivation

Because developers want the best!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions