fix(sponsorblock): wrong video-id-hook patch used https://github.com/inotia00/ReVanced_Extended/issues/777

This commit is contained in:
inotia00 2023-04-20 07:46:37 +09:00
parent 9e96f5d398
commit b1a4b1c91e
4 changed files with 13 additions and 6 deletions

View File

@ -9,14 +9,14 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.playercontrols.patch.PlayerControlsPatch
import app.revanced.patches.youtube.misc.videoid.mainstream.patch.MainstreamVideoIdPatch
import app.revanced.patches.youtube.misc.videoid.legacy.patch.LegacyVideoIdPatch
import app.revanced.util.integrations.Constants.BUTTON_PATH
@Name("overlay-buttons-bytecode-patch")
@DependsOn(
dependencies = [
PlayerControlsPatch::class,
MainstreamVideoIdPatch::class
LegacyVideoIdPatch::class
]
)
@YouTubeCompatibility

View File

@ -17,6 +17,7 @@ import app.revanced.patches.youtube.misc.playercontrols.patch.PlayerControlsPatc
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.sponsorblock.bytecode.fingerprints.*
import app.revanced.patches.youtube.misc.timebar.patch.HookTimebarPatch
import app.revanced.patches.youtube.misc.videoid.legacy.patch.LegacyVideoIdPatch
import app.revanced.patches.youtube.misc.videoid.mainstream.patch.MainstreamVideoIdPatch
import app.revanced.util.bytecode.BytecodeHelper.injectInit
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
@ -31,6 +32,7 @@ import org.jf.dexlib2.iface.reference.MethodReference
@Name("sponsorblock-bytecode-patch")
@DependsOn(
[
LegacyVideoIdPatch::class,
MainstreamVideoIdPatch::class,
OverrideSpeedHookPatch::class,
PlayerControlsPatch::class,
@ -54,12 +56,16 @@ class SponsorBlockBytecodePatch : BytecodePatch(
INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR,
"setVideoTime"
)
onCreateHook(
INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR,
"initialize"
)
}
/*
* Inject VideoIdPatch
*/
MainstreamVideoIdPatch.injectCall("$INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")
LegacyVideoIdPatch.injectCall("$INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")
/*

View File

@ -12,6 +12,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.videoid.legacy.fingerprint.LegacyVideoIdFingerprint
import app.revanced.util.integrations.Constants.VIDEO_PATH
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Name("video-id-hook-legacy")
@ -35,10 +36,13 @@ class LegacyVideoIdPatch : BytecodePatch(
offset++ // offset so setCurrentVideoId is called before any injected call
} ?: return LegacyVideoIdFingerprint.toErrorResult()
injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->setVideoId(Ljava/lang/String;)V")
return PatchResultSuccess()
}
companion object {
const val INTEGRATIONS_CLASS_DESCRIPTOR = "$VIDEO_PATH/VideoInformation;"
private var offset = 2
private var insertIndex: Int = 0

View File

@ -164,9 +164,6 @@ class MainstreamVideoIdPatch : BytecodePatch(
offset++ // offset so setVideoId is called before any injected call
} ?: return MainstreamVideoIdFingerprint.toErrorResult()
injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->setVideoId(Ljava/lang/String;)V")
return PatchResultSuccess()
}