fix build error

This commit is contained in:
inotia00 2023-10-10 00:28:26 +09:00
parent 6b457685d5
commit 9c58a5a1ee
2 changed files with 40 additions and 36 deletions

View File

@ -23,6 +23,42 @@ object ComponentParserPatch : BytecodePatch(
IdentifierFingerprint IdentifierFingerprint
) )
) { ) {
internal lateinit var emptyComponentLabel: String
private lateinit var insertMethod: MutableMethod
private var emptyComponentIndex by Delegates.notNull<Int>()
private var insertIndex by Delegates.notNull<Int>()
private var identifierRegister by Delegates.notNull<Int>()
private var objectRegister by Delegates.notNull<Int>()
private var stringBuilderRegister by Delegates.notNull<Int>()
internal fun generalHook(descriptor: String) {
insertMethod.apply {
addInstructionsWithLabels(
insertIndex,
"""
invoke-static {v$stringBuilderRegister, v$identifierRegister, v$objectRegister}, $descriptor(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/Object;)Z
move-result v$stringBuilderRegister
if-nez v$stringBuilderRegister, :filter
""", ExternalLabel("filter", getInstruction(emptyComponentIndex))
)
}
}
internal fun pathBuilderHook(descriptor: String) {
insertMethod.apply {
addInstructionsWithLabels(
insertIndex,
"""
invoke-static {v$stringBuilderRegister}, $descriptor(Ljava/lang/StringBuilder;)Z
move-result v$stringBuilderRegister
if-nez v$stringBuilderRegister, :filter
""", ExternalLabel("filter", getInstruction(emptyComponentIndex))
)
}
}
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
/** /**
@ -75,40 +111,4 @@ object ComponentParserPatch : BytecodePatch(
} }
} }
lateinit var emptyComponentLabel: String
lateinit var insertMethod: MutableMethod
var emptyComponentIndex by Delegates.notNull<Int>()
var insertIndex by Delegates.notNull<Int>()
var identifierRegister by Delegates.notNull<Int>()
var objectRegister by Delegates.notNull<Int>()
var stringBuilderRegister by Delegates.notNull<Int>()
fun generalHook(descriptor: String) {
insertMethod.apply {
addInstructionsWithLabels(
insertIndex,
"""
invoke-static {v$stringBuilderRegister, v$identifierRegister, v$objectRegister}, $descriptor(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/Object;)Z
move-result v$stringBuilderRegister
if-nez v$stringBuilderRegister, :filter
""", ExternalLabel("filter", getInstruction(emptyComponentIndex))
)
}
}
fun pathBuilderHook(descriptor: String) {
insertMethod.apply {
addInstructionsWithLabels(
insertIndex,
"""
invoke-static {v$stringBuilderRegister}, $descriptor(Ljava/lang/StringBuilder;)Z
move-result v$stringBuilderRegister
if-nez v$stringBuilderRegister, :filter
""", ExternalLabel("filter", getInstruction(emptyComponentIndex))
)
}
}
} }

View File

@ -3,8 +3,10 @@ package app.revanced.patches.youtube.utils.settings
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.patches.shared.patch.settings.AbstractSettingsResourcePatch import app.revanced.patches.shared.patch.settings.AbstractSettingsResourcePatch
import app.revanced.patches.youtube.utils.integrations.IntegrationsPatch import app.revanced.patches.youtube.utils.integrations.IntegrationsPatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
import app.revanced.util.resources.IconHelper.YOUTUBE_LAUNCHER_ICON_ARRAY import app.revanced.util.resources.IconHelper.YOUTUBE_LAUNCHER_ICON_ARRAY
import app.revanced.util.resources.IconHelper.copyFiles import app.revanced.util.resources.IconHelper.copyFiles
import app.revanced.util.resources.IconHelper.makeDirectoryAndCopyFiles import app.revanced.util.resources.IconHelper.makeDirectoryAndCopyFiles
@ -24,6 +26,8 @@ import java.util.concurrent.TimeUnit
description = "Applies mandatory patches to implement ReVanced Extended settings into the application.", description = "Applies mandatory patches to implement ReVanced Extended settings into the application.",
dependencies = [ dependencies = [
IntegrationsPatch::class, IntegrationsPatch::class,
ResourceMappingPatch::class,
SharedResourceIdPatch::class,
SettingsBytecodePatch::class SettingsBytecodePatch::class
], ],
compatiblePackages = [ compatiblePackages = [