#!/bin/sh
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
# Minimal OS variable loading for performance
. /etc/profile.d/02-distribution
tocon "Configuring display..."
### Variables may need to be device specific here.
BRIGHTNESS=$(get_setting system.brightness)
if [[ -z ${BRIGHTNESS} ]]
then
BRIGHTNESS="6"
fi
# Ensure user doesn't get "locked out" with super low brightness
if [[ "${BRIGHTNESS}" = "0" ]]
then
BRIGHTNESS=1
fi
brightness set ${BRIGHTNESS}
### Set the aspect ratio in ES.
ASPECT=$(get_aspect_ratio)
ES_CONFIG="/storage/.config/emulationstation/es_settings.cfg"
ES_ASPECT="${ASPECT/:/-}"
if [ "$(grep subset.aspect-ratio ${ES_CONFIG})" ]
then
sed -i 's||g' ${ES_CONFIG}
else
sed -i '/<\/config>/i \\t' ${ES_CONFIG}
fi