feat: fix-metanav-scaling patch (#831)

This commit is contained in:
Caroline Joy Bell 2022-10-24 23:39:28 -07:00 committed by GitHub
parent 91c03c5624
commit 4808e09985
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 0 deletions

View file

@ -0,0 +1,10 @@
package app.revanced.patches.metanav.scaling.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.metanav", arrayOf("1.0"))])
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
annotation class FixScalingCompatibility {
}

View file

@ -0,0 +1,37 @@
package app.revanced.patches.metanav.scaling.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.metanav.scaling.annotations.FixScalingCompatibility
import org.w3c.dom.Element
/**
* Fixes the scaling in the Metaverse Navigator app for Persona 5, aka "metaNav"
*
* @author halotroop2288
*/
@Patch
@Name("fix-metanav-scaling")
@Description("Scales the content properly.")
@FixScalingCompatibility
@Version("0.0.1")
class FixScalingPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
context.xmlEditor["assets/startScreenCanvas.html"].use { editor ->
val svgNode = editor
.file
.getElementsByTagName("svg")
.item(0) as Element
svgNode.setAttribute("height", "750")
}
return PatchResultSuccess()
}
}