fix(YouTube/Spoof player parameters): error toast shown when you first launch the app

This commit is contained in:
inotia00 2023-12-06 02:31:16 +09:00
parent 78da7f9ccd
commit 2eee2018fe
3 changed files with 5 additions and 4 deletions

View File

@ -80,7 +80,7 @@ object SpoofPlayerParameterPatch : BytecodePatch(
* Hook player parameter
*/
PlayerResponsePatch += PlayerResponsePatch.Hook.PlayerParameter(
"$INTEGRATIONS_CLASS_DESCRIPTOR->spoofParameter(Ljava/lang/String;Z)Ljava/lang/String;"
"$INTEGRATIONS_CLASS_DESCRIPTOR->spoofParameter(Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;"
)
/**

View File

@ -11,7 +11,7 @@ import java.io.Closeable
object PlayerResponsePatch : BytecodePatch(
setOf(PlayerParameterBuilderFingerprint)
), Closeable,MutableSet<PlayerResponsePatch.Hook> by mutableSetOf() {
), Closeable, MutableSet<PlayerResponsePatch.Hook> by mutableSetOf() {
private const val VIDEO_ID_PARAMETER = 1
private const val PLAYER_PARAMETER = 3
private const val IS_SHORT_AND_OPENING_OR_PLAYING_PARAMETER = 11
@ -31,7 +31,7 @@ object PlayerResponsePatch : BytecodePatch(
fun hookPlayerParameter(hook: Hook) = playerResponseMethod.addInstructions(
0, """
invoke-static {p$PLAYER_PARAMETER, p$IS_SHORT_AND_OPENING_OR_PLAYING_PARAMETER}, $hook
invoke-static {p$VIDEO_ID_PARAMETER, p$PLAYER_PARAMETER, p$IS_SHORT_AND_OPENING_OR_PLAYING_PARAMETER}, $hook
move-result-object p$PLAYER_PARAMETER
"""
)

View File

@ -155,7 +155,8 @@ object VideoIdPatch : BytecodePatch(
// Call before any other video id hooks,
// so they can use VideoInformation and check if the video id is for a Short.
PlayerResponsePatch += PlayerResponsePatch.Hook.PlayerBeforeVideoId(
"$INTEGRATIONS_CLASS_DESCRIPTOR->newPlayerResponseSignature(Ljava/lang/String;Z)Ljava/lang/String;")
"$INTEGRATIONS_CLASS_DESCRIPTOR->newPlayerParameter(Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;"
)
}
const val INTEGRATIONS_CLASS_DESCRIPTOR = "$VIDEO_PATH/VideoInformation;"