mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-02 07:34:31 +02:00
fix(youtube/navbar-index-hook): library shelves are hidden under certain circumstances
This commit is contained in:
parent
a6264daf76
commit
aa46ddf4c9
@ -7,6 +7,7 @@ import app.revanced.patcher.data.BytecodeContext
|
|||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
@ -36,21 +37,16 @@ class NavBarIndexHookPatch : BytecodePatch(
|
|||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
arrayOf(
|
OnBackPressedFingerprint.result?.let {
|
||||||
OnBackPressedFingerprint,
|
it.mutableMethod.apply {
|
||||||
TopBarButtonFingerprint
|
addInstruction(
|
||||||
).forEach { fingerprint ->
|
0,
|
||||||
fingerprint.result?.let {
|
"invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->setLastNavBarIndex()V"
|
||||||
it.mutableMethod.apply {
|
)
|
||||||
addInstructions(
|
}
|
||||||
0, """
|
} ?: return OnBackPressedFingerprint.toErrorResult()
|
||||||
const/4 v0, 0x0
|
|
||||||
invoke-static {v0}, $UTILS_PATH/NavBarIndexPatch;->setNavBarIndex(I)V
|
TopBarButtonFingerprint.injectIndex(0)
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: return fingerprint.toErrorResult()
|
|
||||||
}
|
|
||||||
|
|
||||||
NavBarBuilderFingerprint.result?.let {
|
NavBarBuilderFingerprint.result?.let {
|
||||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
@ -74,7 +70,7 @@ class NavBarIndexHookPatch : BytecodePatch(
|
|||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
targetIndex,
|
targetIndex,
|
||||||
"invoke-static {v$targetRegister}, $UTILS_PATH/NavBarIndexPatch;->setNavBarIndex(I)V"
|
"invoke-static {v$targetRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->setCurrentNavBarIndex(I)V"
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -83,4 +79,21 @@ class NavBarIndexHookPatch : BytecodePatch(
|
|||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
companion object {
|
||||||
|
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"$UTILS_PATH/NavBarIndexPatch;"
|
||||||
|
|
||||||
|
fun MethodFingerprint.injectIndex(index: Int) {
|
||||||
|
result?.let{
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
addInstructions(
|
||||||
|
0, """
|
||||||
|
const/4 v0, 0x$index
|
||||||
|
invoke-static {v0}, $INTEGRATIONS_CLASS_DESCRIPTOR->setCurrentNavBarIndex(I)V
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: throw toErrorResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user