chore: lint code

This commit is contained in:
inotia00 2024-09-01 03:10:53 +09:00
parent 4fff1ca4cb
commit db3d1c5740
2 changed files with 26 additions and 13 deletions

View File

@ -125,7 +125,8 @@ object DownloadActionsPatch : BaseBytecodePatch(
reference?.definingClass == OFFLINE_PLAYLIST_ENDPOINT_OUTER_CLASS_DESCRIPTOR &&
reference.type == "Ljava/lang/String;"
}
val playlistIdReference = getInstruction<ReferenceInstruction>(playlistIdIndex).reference
val playlistIdReference =
getInstruction<ReferenceInstruction>(playlistIdIndex).reference
val targetIndex = indexOfFirstInstructionOrThrow {
opcode == Opcode.CHECK_CAST &&
@ -134,13 +135,15 @@ object DownloadActionsPatch : BaseBytecodePatch(
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstructionsWithLabels(
targetIndex + 1, """
targetIndex + 1,
"""
iget-object v$freeRegister, v$targetRegister, $playlistIdReference
invoke-static {v$freeRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->inAppPlaylistDownloadMenuOnClick(Ljava/lang/String;)Z
move-result v$freeRegister
if-eqz v$freeRegister, :show_native_downloader
return-void
""", ExternalLabel("show_native_downloader", getInstruction(targetIndex + 1))
""",
ExternalLabel("show_native_downloader", getInstruction(targetIndex + 1))
)
}
}

View File

@ -61,7 +61,8 @@ object SpoofStreamingDataPatch : BaseBytecodePatch(
BuildInitPlaybackRequestFingerprint.resultOrThrow().let {
it.mutableMethod.apply {
val moveUriStringIndex = it.scanResult.patternScanResult!!.startIndex
val targetRegister = getInstruction<OneRegisterInstruction>(moveUriStringIndex).registerA
val targetRegister =
getInstruction<OneRegisterInstruction>(moveUriStringIndex).registerA
addInstructions(
moveUriStringIndex + 1,
@ -79,8 +80,10 @@ object SpoofStreamingDataPatch : BaseBytecodePatch(
BuildPlayerRequestURIFingerprint.resultOrThrow().let {
it.mutableMethod.apply {
val invokeToStringIndex = BuildPlayerRequestURIFingerprint.indexOfToStringInstruction(this)
val uriRegister = getInstruction<FiveRegisterInstruction>(invokeToStringIndex).registerC
val invokeToStringIndex =
BuildPlayerRequestURIFingerprint.indexOfToStringInstruction(this)
val uriRegister =
getInstruction<FiveRegisterInstruction>(invokeToStringIndex).registerC
addInstructions(
invokeToStringIndex,
@ -100,11 +103,13 @@ object SpoofStreamingDataPatch : BaseBytecodePatch(
result.mutableMethod.apply {
val buildRequestIndex =
BuildRequestFingerprint.indexOfBuildUrlRequestInstruction(this)
val requestBuilderRegister = getInstruction<FiveRegisterInstruction>(buildRequestIndex).registerC
val requestBuilderRegister =
getInstruction<FiveRegisterInstruction>(buildRequestIndex).registerC
val newRequestBuilderIndex =
BuildRequestFingerprint.indexOfNewUrlRequestBuilderInstruction(this)
val urlRegister = getInstruction<FiveRegisterInstruction>(newRequestBuilderIndex).registerD
val urlRegister =
getInstruction<FiveRegisterInstruction>(newRequestBuilderIndex).registerD
// Replace "requestBuilder.build()" with integrations call.
replaceInstruction(
@ -143,10 +148,13 @@ object SpoofStreamingDataPatch : BaseBytecodePatch(
CreateStreamingDataFingerprint.resultOrThrow().let { result ->
result.mutableMethod.apply {
val setStreamingDataIndex = result.scanResult.patternScanResult!!.startIndex
val setStreamingDataField = getInstruction(setStreamingDataIndex).getReference<FieldReference>().toString()
val setStreamingDataField =
getInstruction(setStreamingDataIndex).getReference<FieldReference>().toString()
val playerProtoClass = getInstruction(setStreamingDataIndex + 1).getReference<FieldReference>()!!.definingClass
val protobufClass = ProtobufClassParseByteBufferFingerprint.resultOrThrow().mutableMethod.definingClass
val playerProtoClass =
getInstruction(setStreamingDataIndex + 1).getReference<FieldReference>()!!.definingClass
val protobufClass =
ProtobufClassParseByteBufferFingerprint.resultOrThrow().mutableMethod.definingClass
val getStreamingDataField = getInstructions().find { instruction ->
instruction.opcode == Opcode.IGET_OBJECT &&
@ -155,10 +163,12 @@ object SpoofStreamingDataPatch : BaseBytecodePatch(
?: throw PatchException("Could not find getStreamingDataField")
val videoDetailsIndex = result.scanResult.patternScanResult!!.endIndex
val videoDetailsClass = getInstruction(videoDetailsIndex).getReference<FieldReference>()!!.type
val videoDetailsClass =
getInstruction(videoDetailsIndex).getReference<FieldReference>()!!.type
val insertIndex = videoDetailsIndex + 1
val videoDetailsRegister = getInstruction<TwoRegisterInstruction>(videoDetailsIndex).registerA
val videoDetailsRegister =
getInstruction<TwoRegisterInstruction>(videoDetailsIndex).registerA
val overrideRegister = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
val freeRegister = implementation!!.registerCount - parameters.size - 2