slightly better patch method

This commit is contained in:
inotia00
2023-01-08 01:10:42 +09:00
parent a1a74e7c51
commit 500055e046
12 changed files with 82 additions and 31 deletions

View File

@ -6,10 +6,10 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.shared.annotation.YouTubeCompatibility
import app.revanced.shared.extensions.findMutableMethodOf
import app.revanced.shared.extensions.toResult
import app.revanced.shared.patches.mapping.ResourceMappingPatch
import app.revanced.shared.util.integrations.Constants.SEEKBAR_LAYOUT
import org.jf.dexlib2.Opcode
@ -27,6 +27,7 @@ class OldSeekbarColorBytecodePatch : BytecodePatch() {
).map { name ->
ResourceMappingPatch.resourceMappings.single { it.name == name }.id
}
private var patchSuccessArray = Array(resourceIds.size) {false}
override fun execute(context: BytecodeContext): PatchResult {
context.classes.forEach { classDef ->
@ -49,6 +50,8 @@ class OldSeekbarColorBytecodePatch : BytecodePatch() {
move-result v$viewRegister
"""
)
patchSuccessArray[0] = true;
}
}
}
@ -58,6 +61,6 @@ class OldSeekbarColorBytecodePatch : BytecodePatch() {
}
}
}
return PatchResultSuccess()
return toResult(patchSuccessArray.indexOf(false))
}
}