mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-09 11:04:36 +02:00
remove enable-hdr-auto-brightness
patch
This commit is contained in:
parent
7db88c2dc8
commit
601e4d7b01
@ -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"),
|
||||
)
|
@ -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()
|
||||
}
|
||||
}
|
@ -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()
|
||||
}
|
||||
}
|
@ -217,9 +217,6 @@ Is it ready to submit?"</string>
|
||||
<string name="revanced_enable_external_browser_summary_off">External browser is disabled</string>
|
||||
<string name="revanced_enable_external_browser_summary_on">External browser is enabled</string>
|
||||
<string name="revanced_enable_external_browser_title">Enable external browser</string>
|
||||
<string name="revanced_enable_hdr_auto_brightness_summary_off">Auto HDR brightness is disabled</string>
|
||||
<string name="revanced_enable_hdr_auto_brightness_summary_on">Auto HDR brightness is enabled</string>
|
||||
<string name="revanced_enable_hdr_auto_brightness_title">Enable auto HDR brightness</string>
|
||||
<string name="revanced_enable_minimized_playback_summary_off">Minimized playback is disabled</string>
|
||||
<string name="revanced_enable_minimized_playback_summary_on">Minimized playback is enabled</string>
|
||||
<string name="revanced_enable_minimized_playback_title">Enable minimized playback</string>
|
||||
|
@ -264,9 +264,6 @@
|
||||
<!-- SETTINGS: ENABLE_MINIMIZED_PLAYBACK
|
||||
<SwitchPreference android:title="@string/revanced_enable_minimized_playback_title" android:key="revanced_enable_minimized_playback" android:defaultValue="true" android:summaryOn="@string/revanced_enable_minimized_playback_summary_on" android:summaryOff="@string/revanced_enable_minimized_playback_summary_off" />SETTINGS: ENABLE_MINIMIZED_PLAYBACK -->
|
||||
|
||||
<!-- SETTINGS: ENABLE_HDR_AUTO_BRIGHTNESS
|
||||
<SwitchPreference android:title="@string/revanced_enable_hdr_auto_brightness_title" android:key="revanced_enable_hdr_auto_brightness" android:defaultValue="false" android:summaryOn="@string/revanced_enable_hdr_auto_brightness_summary_on" android:summaryOff="@string/revanced_enable_hdr_auto_brightness_summary_off" />SETTINGS: ENABLE_HDR_AUTO_BRIGHTNESS -->
|
||||
|
||||
<!-- SETTINGS: CUSTOM_VIDEO_BUFFER
|
||||
<PreferenceScreen android:title="@string/revanced_custom_video_buffer_title" android:key="revanced_custom_video_buffer" android:summary="@string/revanced_custom_video_buffer_summary">
|
||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_custom_video_buffer_title" />
|
||||
@ -404,7 +401,6 @@
|
||||
<Preference android:title="enable-external-browser" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="enable-open-links-directly" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="enable-minimized-playback" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="enable-hdr-auto-brightness" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="custom-video-buffer" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
|
||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_video_settings_title" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user