Skip to content

Commit

Permalink
Fast Download Speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Keeperorowner committed Dec 20, 2024
1 parent 622fbe9 commit 86a2bfb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions app/src/main/java/cc/ioctl/tmoe/hook/func/FasterDownloadSpeed.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package cc.ioctl.tmoe.hook.func

import cc.ioctl.tmoe.base.annotation.FunctionHookEntry
import cc.ioctl.tmoe.hook.base.CommonDynamicHook
import com.github.kyuubiran.ezxhelper.utils.*

@FunctionHookEntry
object FasterDownloadSpeed : CommonDynamicHook() {
override fun initOnce(): Boolean = tryOrFalse {
findMethod(loadClass("org.telegram.messenger.FileLoadOperation")){
name=="updateParams"
}.hookBefore {
if (!isEnabled) return@hookBefore
setField("downloadChunkSizeBig", it.thisObject, 1024 * 1024)
setField("maxDownloadRequests", it.thisObject, 12)
setField("maxDownloadRequestsBig", it.thisObject, 12)
setField("maxCdnParts", it.thisObject, 2097152000 / 1048576)
}
}
}

private fun setField(fieldName: String, obj: Any, value: Any?) {
findField(obj::class.java) {
name == fieldName
}.set(obj, value)
}

0 comments on commit 86a2bfb

Please sign in to comment.