refactor: integrations (#44)

This commit is contained in:
Joey Peter 2022-06-24 00:17:49 +02:00 committed by GitHub
parent e1f37bf7c7
commit a8f17948ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 18 additions and 19 deletions

View File

@ -1,2 +1 @@
# revanced-patches
Repo for all ReVanced patches

View File

@ -10,7 +10,7 @@ internal fun MutableMethodImplementation.injectHideCall(
) {
this.addInstruction(
index,
"invoke-static { v$register }, Lfi/razerman/youtube/XAdRemover;->HideView(Landroid/view/View;)V".toInstruction()
"invoke-static { v$register }, Lapp/revanced/integrations/patches/HideHomeAdsPatch;->HideHomeAds(Landroid/view/View;)V".toInstruction()
)
}

View File

@ -249,7 +249,7 @@ class GeneralBytecodeAdsPatch : BytecodePatch(
val block2 = """
move-object/from16 v1, p3
iget-object v2, v1, $templateNameParameterType->b:Ljava/nio/ByteBuffer;
invoke-static {v0, v2}, Lfi/razerman/youtube/litho/LithoAdRemoval;->containsAd(Ljava/lang/String;Ljava/nio/ByteBuffer;)Z
invoke-static {v0, v2}, Lapp/revanced/integrations/patches/GeneralBytecodeAdsPatch;->containsAd(Ljava/lang/String;Ljava/nio/ByteBuffer;)Z
move-result v1
""".trimIndent().toInstructions(lithoMethod)
val block3 = """

View File

@ -42,7 +42,7 @@ class VideoAdsPatch : BytecodePatch(
// Override the parameter by calling shouldShowAds and setting the parameter to the result
result.method.addInstructions(
0, """
invoke-static { }, Lfi/vanced/libraries/youtube/whitelisting/Whitelist;->shouldShowAds()Z
invoke-static { }, Lapp/revanced/integrations/patches/VideoAdsPatch;->shouldShowAds()Z
move-result v1
"""
)

View File

@ -86,7 +86,7 @@ class EnableSeekbarTappingPatch : BytecodePatch(
)
result.method.addInstructions(
result.scanResult.endIndex + 1, """
invoke-static { }, Lfi/razerman/youtube/preferences/BooleanPreferences;->isTapSeekingEnabled()Z
invoke-static { }, Lapp/revanced/integrations/patches/SeekbarTappingPatch;->isTapSeekingEnabled()Z
move-result v0
"""
)

View File

@ -30,7 +30,7 @@ class HideCastButtonPatch : BytecodePatch(listOf()) {
setVisibilityMethod.addInstructions(
0, """
invoke-static {p1}, Lfi/razerman/youtube/XGlobals;->getCastButtonOverrideV2(I)I
invoke-static {p1}, Lapp/revanced/integrations/patches/HideCastButtonPatch;->getCastButtonOverrideV2(I)I
move-result p1
"""
)

View File

@ -54,8 +54,8 @@ class CreateButtonRemoverPatch : BytecodePatch(
// Hide the button view via proxy by passing it to the hideCreateButton method
result.method.addInstruction(
moveResultIndex + 1,
"invoke-static { v${moveResultInstruction.registerA} }, Lfi/razerman/youtube/XAdRemover;->hideCreateButton(Landroid/view/View;)V"
result.scanResult.endIndex + 1,
"invoke-static { v$moveResultInstruction.registerA }, Lapp/revanced/integrations/patches/HideCreateButtonPatch;->hideCreateButton(Landroid/view/View;)V"
)
return PatchResultSuccess()

View File

@ -58,7 +58,7 @@ class OldQualityLayoutPatch : BytecodePatch(
implementation.addInstruction(5, jmpInstruction)
result.method.addInstructions(
0, """
invoke-static { }, Lfi/razerman/youtube/XGlobals;->useOldStyleQualitySettings()Z
invoke-static { }, Lapp/revanced/integrations/patches/OldStyleQualityPatch;->useOldStyleQualitySettings()Z
move-result v0
"""
)

View File

@ -28,7 +28,7 @@ class HideReelsPatch : BytecodePatch(
// so we pass the view to the HideReel method
result.method.addInstruction(
result.scanResult.endIndex,
"invoke-static { v2 }, Lfi/razerman/youtube/XAdRemover;->HideReel(Landroid/view/View;)V"
"invoke-static { v2 }, Lapp/revanced/integrations/patches/HideReelsPatch;->HideReel(Landroid/view/View;)V"
)
return PatchResultSuccess()

View File

@ -41,14 +41,14 @@ class ShortsButtonRemoverPatch : BytecodePatch(
// Save the tab enum in XGlobals to avoid smali/register workarounds
result1.method.addInstruction(
result1.scanResult.endIndex + 1,
"sput-object v$enumRegister, Lfi/razerman/youtube/XGlobals;->lastPivotTab:Ljava/lang/Enum;"
"sput-object v$enumRegister, Lapp/revanced/integrations/patches/HideShortsButtonPatch;->lastPivotTab:Ljava/lang/Enum;"
)
// Hide the button view via proxy by passing it to the hideShortsButton method
// It only hides it if the last tab name is "TAB_SHORTS"
result2.method.addInstruction(
result2.scanResult.endIndex + 2,
"invoke-static { v$viewRegister }, Lfi/razerman/youtube/XAdRemover;->hideShortsButton(Landroid/view/View;)V"
"invoke-static { v$viewRegister }, Lapp/revanced/integrations/patches/HideShortsButtonPatch;->hideShortsButton(Landroid/view/View;)V"
)
return PatchResultSuccess()

View File

@ -28,7 +28,7 @@ class IntegrationsPatch : BytecodePatch(
)
) {
override fun execute(data: BytecodeData): PatchResult {
if (data.findClass("Lapp/revanced/integrations/Globals") == null)
if (data.findClass("Lapp/revanced/integrations/utils/Globals") == null)
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.")
val result = InitSignature.result!!
@ -38,8 +38,8 @@ class IntegrationsPatch : BytecodePatch(
result.method.addInstructions(
result.scanResult.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;
invoke-static {v$count}, Lapp/revanced/integrations/sponsorblock/StringRef;->setContext(Landroid/content/Context;)V
sput-object v$count, Lapp/revanced/integrations/utils/Globals;->context:Landroid/content/Context;
"""
)
@ -55,7 +55,7 @@ class IntegrationsPatch : BytecodePatch(
null,
ImmutableMethodImplementation(
1, """
invoke-static { }, Lapp/revanced/integrations/Globals;->getAppContext()Landroid/content/Context;
invoke-static { }, Lapp/revanced/integrations/utils/Globals;->getAppContext()Landroid/content/Context;
move-result-object v0
return-object v0
""".trimIndent().toInstructions(), null, null