This commit is contained in:
inotia00
2023-08-05 07:32:16 +09:00
parent 1fbb5c4bee
commit 374617d61e
11 changed files with 32 additions and 20 deletions

View File

@ -119,6 +119,7 @@ class MixPlaylistsPatch : BytecodePatch(
return PatchResultSuccess()
}
private companion object {
fun MutableMethod.inject(
freeIndex: Int,

View File

@ -43,7 +43,8 @@ class ExternalBrowserPatch : BytecodePatch(
).forEach { fingerprint ->
fingerprint.result?.let {
it.mutableMethod.apply {
val targetIndex = getStringIndex("android.support.customtabs.action.CustomTabsService")
val targetIndex =
getStringIndex("android.support.customtabs.action.CustomTabsService")
val register = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstructions(

View File

@ -95,6 +95,7 @@ class NewSplashAnimationPatch : BytecodePatch(
return PatchResultSuccess()
}
companion object {
fun MutableMethod.inject(
index: Int

View File

@ -78,14 +78,16 @@ class HideFilmstripOverlayPatch : BytecodePatch(
val initialIndex = setOnClickListenerIndex - 1
if (SettingsPatch.upward1828) {
for (index in insertIndex .. initialIndex) {
for (index in insertIndex..initialIndex) {
if (getInstruction(index).opcode != Opcode.CONST_16 &&
getInstruction(index).opcode != Opcode.CONST_4 &&
getInstruction(index).opcode != Opcode.CONST)
getInstruction(index).opcode != Opcode.CONST
)
continue
val register = getInstruction<OneRegisterInstruction>(index).registerA
val value = getInstruction<WideLiteralInstruction>(index).wideLiteral.toInt()
val value =
getInstruction<WideLiteralInstruction>(index).wideLiteral.toInt()
val line =
when (getInstruction(index).opcode) {
@ -93,21 +95,25 @@ class HideFilmstripOverlayPatch : BytecodePatch(
const/16 v$register, $value
""".trimIndent()
Opcode.CONST_4 -> """
const/4 v$register, $value
""".trimIndent()
Opcode.CONST -> """
const v$register, $value
""".trimIndent()
else -> ""
}
fixComponent += line
}
} else {
val fixRegister = getInstruction<FiveRegisterInstruction>(initialIndex).registerE
val fixRegister =
getInstruction<FiveRegisterInstruction>(initialIndex).registerE
for (index in initialIndex downTo insertIndex) {
if (getInstruction(index).opcode != Opcode.CONST_16) continue
@ -116,7 +122,8 @@ class HideFilmstripOverlayPatch : BytecodePatch(
if (register != fixRegister) continue
val fixValue = getInstruction<WideLiteralInstruction>(index).wideLiteral.toInt()
val fixValue =
getInstruction<WideLiteralInstruction>(index).wideLiteral.toInt()
fixComponent = "const/16 v$fixRegister, $fixValue"
break
}

View File

@ -11,8 +11,8 @@ import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
import app.revanced.patches.youtube.player.playerbuttonbg.fingerprints.PlayerPatchFingerprint
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
import app.revanced.patches.youtube.utils.playerbutton.patch.PlayerButtonHookPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH

View File

@ -107,7 +107,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
TextComponentAtomicReferenceFingerprint.also {
it.resolve(context, parentResult.classDef)
}.result
?:TextComponentAtomicReferenceLegacyFingerprint.also {
?: TextComponentAtomicReferenceLegacyFingerprint.also {
it.resolve(context, parentResult.classDef)
}.result
?: return TextComponentAtomicReferenceLegacyFingerprint.toErrorResult()
@ -117,7 +117,8 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
}.result?.let {
it.mutableMethod.apply {
val startIndex = it.scanResult.patternScanResult!!.startIndex
val originalRegisterA = getInstruction<TwoRegisterInstruction>(startIndex + 2).registerA
val originalRegisterA =
getInstruction<TwoRegisterInstruction>(startIndex + 2).registerA
replaceInstruction(
startIndex + 2,