Merge remote-tracking branch 'origin/dalvik-patches' into dalvik-patches

This commit is contained in:
baiorett 2022-04-16 23:52:08 +03:00
commit b63a4af4d5
5 changed files with 11 additions and 10 deletions

View File

@ -154,14 +154,14 @@ class EnableSeekbarTappingPatch : Patch(
val oMethod = tapSeekMethods["O"]!!
// get the required register
val instruction = implementation.instructions[result.scanData.endIndex - 1]
val instruction = implementation.instructions[result.scanData.endIndex]
if (instruction.opcode != Opcode.INVOKE_VIRTUAL)
return PatchResultError("Could not find the correct register")
val register = (instruction as Instruction35c).registerC
// the instructions are written in reverse order.
implementation.addInstructions(
result.scanData.endIndex,
result.scanData.endIndex + 1,
"""
invoke-virtual { v$register, v2 }, ${oMethod.definingClass}->${oMethod.name}(I)V
invoke-virtual { v$register, v2 }, ${pMethod.definingClass}->${pMethod.name}(I)V
@ -169,13 +169,13 @@ class EnableSeekbarTappingPatch : Patch(
)
// if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label
val elseLabel = implementation.newLabelForIndex(result.scanData.endIndex)
val elseLabel = implementation.newLabelForIndex(result.scanData.endIndex + 1)
implementation.addInstruction(
result.scanData.endIndex,
result.scanData.endIndex + 1,
BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel)
)
implementation.addInstructions(
result.scanData.endIndex,
result.scanData.endIndex + 1,
"""
invoke-static { }, Lfi/razerman/youtube/preferences/BooleanPreferences;->isTapSeekingEnabled()Z
move-result v0

View File

@ -76,14 +76,14 @@ class CreateButtonRemoverPatch : Patch(
// Get the required register which holds the view object we need to pass to the method hideCreateButton
val implementation = result.method.implementation!!
val instruction = implementation.instructions[result.scanData.endIndex]
val instruction = implementation.instructions[result.scanData.endIndex + 1]
if (instruction.opcode != Opcode.INVOKE_STATIC)
return PatchResultError("Could not find the correct register")
val register = (instruction as Instruction35c).registerC
// Hide the button view via proxy by passing it to the hideCreateButton method
implementation.addInstruction(
result.scanData.endIndex,
result.scanData.endIndex + 1,
"invoke-static { v$register }, Lfi/razerman/youtube/XAdRemover;->hideCreateButton(Landroid/view/View;)V".toInstruction()
)

View File

@ -53,6 +53,7 @@ class HideReelsPatch : Patch(
"[B",
"[B",
"[B",
"[B",
"[B"
),
listOf(
@ -100,7 +101,7 @@ class HideReelsPatch : Patch(
// HideReel will hide the reel view before it is being used,
// so we pass the view to the HideReel method
implementation.addInstruction(
result.scanData.endIndex - 1,
result.scanData.endIndex,
"invoke-static { v2 }, Lfi/razerman/youtube/XAdRemover;->HideReel(Landroid/view/View;)V".toInstruction()
)

View File

@ -98,7 +98,7 @@ class OldQualityLayoutPatch : Patch(
// if useOldStyleQualitySettings == true, jump over all instructions
val jmpInstruction =
BuilderInstruction21t(Opcode.IF_NEZ, 0, implementation.instructions[result.scanData.endIndex - 1].location.labels.first())
BuilderInstruction21t(Opcode.IF_NEZ, 0, implementation.instructions[result.scanData.endIndex].location.labels.first())
implementation.addInstruction(5, jmpInstruction)
implementation.addInstructions(
0,

View File

@ -85,7 +85,7 @@ class IntegrationsPatch : Patch(
val count = implementation.registerCount - 1
implementation.addInstructions(
result.scanData.endIndex,
result.scanData.endIndex + 1,
"""
invoke-static {v$count}, Lpl/jakubweg/StringRef;->setContext(Landroid/content/Context;)V
sput-object v$count, Lapp/revanced/integrations/Globals;->context:Landroid/content/Context;