remove enable-hdr-auto-brightness patch

This commit is contained in:
inotia00
2023-01-10 04:33:13 +09:00
parent 7db88c2dc8
commit 601e4d7b01
5 changed files with 0 additions and 116 deletions

View File

@ -1,10 +0,0 @@
package app.revanced.patches.youtube.misc.hdrbrightness.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
object HDRBrightnessFingerprint : MethodFingerprint(
"V",
opcodes = listOf(Opcode.CMPL_FLOAT),
strings = listOf("c.SettingNotFound;", "screen_brightness", "android.mediaview"),
)

View File

@ -1,51 +0,0 @@
package app.revanced.patches.youtube.misc.hdrbrightness.bytecode.patch
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.youtube.misc.hdrbrightness.bytecode.fingerprints.HDRBrightnessFingerprint
import app.revanced.patches.youtube.misc.videoid.legacy.patch.LegacyVideoIdPatch
import app.revanced.shared.annotation.YouTubeCompatibility
import app.revanced.shared.util.integrations.Constants.MISC_PATH
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
import org.jf.dexlib2.iface.reference.FieldReference
@Name("enable-hdr-auto-brightness-bytecode-patch")
@YouTubeCompatibility
@Version("0.0.2")
@DependsOn([LegacyVideoIdPatch::class])
class HDRBrightnessBytecodePatch : BytecodePatch(
listOf(HDRBrightnessFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
val result = HDRBrightnessFingerprint.result!!
val method = result.mutableMethod
method.implementation!!.instructions.filter { instruction ->
val fieldReference = (instruction as? ReferenceInstruction)?.reference as? FieldReference
fieldReference?.let { it.name == "screenBrightness" } == true
}.forEach { instruction ->
val brightnessRegisterIndex = method.implementation!!.instructions.indexOf(instruction)
val register = (instruction as TwoRegisterInstruction).registerA
val insertIndex = brightnessRegisterIndex + 1
method.addInstructions(
insertIndex,
"""
invoke-static {v$register}, $MISC_PATH/HDRAutoBrightnessPatch;->getHDRBrightness(F)F
move-result v$register
"""
)
}
LegacyVideoIdPatch.injectCall("$MISC_PATH/HDRAutoBrightnessPatch;->newVideoStarted(Ljava/lang/String;)V")
return PatchResultSuccess()
}
}

View File

@ -1,48 +0,0 @@
package app.revanced.patches.youtube.misc.hdrbrightness.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patches.youtube.misc.hdrbrightness.bytecode.patch.HDRBrightnessBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.shared.annotation.YouTubeCompatibility
import app.revanced.shared.util.resources.ResourceHelper
@Patch
@Name("enable-hdr-auto-brightness")
@Description("Makes the brightness of HDR videos follow the system default.")
@DependsOn(
[
HDRBrightnessBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HDRBrightnessPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: MISC_SETTINGS",
"SETTINGS: ENABLE_HDR_AUTO_BRIGHTNESS"
)
ResourceHelper.patchSuccess(
context,
"enable-hdr-auto-brightness"
)
return PatchResultSuccess()
}
}