diff --git a/packages/ui/emulationstation/package.mk b/packages/ui/emulationstation/package.mk index fcfc086c8..05b38dd0f 100644 --- a/packages/ui/emulationstation/package.mk +++ b/packages/ui/emulationstation/package.mk @@ -90,6 +90,9 @@ makeinstall_target() { rm -rf ${INSTALL}/usr/config/emulationstation/resources/logo.png mkdir -p ${INSTALL}/usr/bin + cp ${PKG_BUILD}/es_settings ${INSTALL}/usr/bin + chmod 0755 ${INSTALL}/usr/bin/es_settings + cp ${PKG_BUILD}/start_es.sh ${INSTALL}/usr/bin chmod 0755 ${INSTALL}/usr/bin/start_es.sh diff --git a/packages/ui/emulationstation/sources/es_settings b/packages/ui/emulationstation/sources/es_settings new file mode 100755 index 000000000..1c651a82c --- /dev/null +++ b/packages/ui/emulationstation/sources/es_settings @@ -0,0 +1,43 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Shanti Gilbert (https://github.com/shantigilbert) +# Copyright (C) 2020-present Fewtarius + +# Source predefined functions and variables +. /etc/profile + +set_audio alsa +export SDL_AUDIODRIVER=alsa + +TZ=$(get_setting system.timezone) +echo -n "TIMEZONE=${TZ}" > /storage/.cache/timezone +echo -n "${TZ}" >/storage/.cache/system_timezone +systemctl restart tz-data.service + +# create charmap used for translations +locale=$(get_setting system.language) +if [[ -n "${locale}" ]] +then + charmap="UTF-8" + lang="${locale}.${charmap}" + locpath="/storage/.config/emulationstation/locale" + i18npath="$locpath/i18n" + localepath="$locpath/$lang" + + if [ ! -d $localepath ]; then + export I18NPATH=$i18npath + performance + /usr/bin/localedef -f $charmap -i $locale $localepath + ${DEVICE_CPU_GOVERNOR} + fi + + export LOCPATH=$locpath + export LANG=$lang + export LANGUAGE=$lang + systemctl import-environment LANG + systemctl import-environment LOCPATH + systemctl import-environment I18NPATH + systemctl import-environment LANGUAGE +fi + diff --git a/packages/ui/emulationstation/sources/start_es.sh b/packages/ui/emulationstation/sources/start_es.sh index 3c2d90197..05da881fc 100755 --- a/packages/ui/emulationstation/sources/start_es.sh +++ b/packages/ui/emulationstation/sources/start_es.sh @@ -16,7 +16,7 @@ systemctl restart tz-data.service # create charmap used for translations locale=$(get_setting system.language) -if [ $? == "0" ] +if [[ -n "${locale}" ]] then charmap="UTF-8" lang="${locale}.${charmap}" diff --git a/packages/ui/emulationstation/system.d/emustation.service b/packages/ui/emulationstation/system.d/emustation.service index 08a68f1a6..5eec79b08 100644 --- a/packages/ui/emulationstation/system.d/emustation.service +++ b/packages/ui/emulationstation/system.d/emustation.service @@ -5,7 +5,8 @@ ConditionPathExists=/var/lock/start.games [Service] Environment=HOME=/storage Environment=SDL_AUDIODRIVER=alsa -ExecStart=/usr/bin/start_es.sh +ExecStartPre=/usr/bin/es_settings +ExecStart=/usr/bin/emulationstation --log-path /var/log KillMode=process TimeoutStopSec=3 Restart=always