From d304388bfe86dfb1905712abfea1b0812a635b9b Mon Sep 17 00:00:00 2001 From: fewtarius Date: Sun, 4 Jun 2023 17:55:09 +0000 Subject: [PATCH] Complete work to split es_systems. --- config/emulators/imageviewer.conf | 3 +- config/emulators/moonlight.conf | 3 ++ config/emulators/msx2.conf | 10 +++++ config/emulators/ports.conf | 6 +-- config/emulators/tools.conf | 3 +- config/functions | 63 ++++++++++++++------------- packages/virtual/emulators/package.mk | 14 +++--- 7 files changed, 59 insertions(+), 43 deletions(-) create mode 100644 config/emulators/msx2.conf diff --git a/config/emulators/imageviewer.conf b/config/emulators/imageviewer.conf index d46c1373b..8c4d18528 100644 --- a/config/emulators/imageviewer.conf +++ b/config/emulators/imageviewer.conf @@ -1,6 +1,7 @@ SYSTEM_NAME="imageviewer" +SYSTEM_FULLNAME="Screenshots" SYSTEM_MANUFACTURER="Various" -SYSTEM_RELEASE="unknown" +SYSTEM_RELEASE="2021" SYSTEM_HARDWARE="system" SYSTEM_PATH="/roms/screenshots" SYSTEM_EXTENSION=".jpg .jpeg .png .bmp .psd .tga .gif .hdr .pic .ppm .pgm .mkv .pdf .mp4 .avi" diff --git a/config/emulators/moonlight.conf b/config/emulators/moonlight.conf index ad2c47e74..efce8c49e 100644 --- a/config/emulators/moonlight.conf +++ b/config/emulators/moonlight.conf @@ -1,5 +1,8 @@ SYSTEM_NAME="moonlight" SYSTEM_FULLNAME="Moonlight Game Streaming" +SYSTEM_MANUFACTURER="JELOS" +SYSTEM_RELEASE="2021" +SYSTEM_HARDWARE="system" SYSTEM_PATH="/storage/roms/moonlight/" SYSTEM_EXTENSION=".sh .SH" SYSTEM_COMMAND="%ROM%" diff --git a/config/emulators/msx2.conf b/config/emulators/msx2.conf new file mode 100644 index 000000000..6bffe9781 --- /dev/null +++ b/config/emulators/msx2.conf @@ -0,0 +1,10 @@ +SYSTEM_NAME="msx2" +SYSTEM_FULLNAME="MSX2" +SYSTEM_MANUFACTURER="Microsoft" +SYSTEM_RELEASE="1988" +SYSTEM_HARDWARE="computer" +SYSTEM_PATH="/storage/roms/msx2" +SYSTEM_EXTENSION=".dsk .DSK .mx1 .MX1 .mx2 .MX2 .rom .ROM .zip .ZIP .7z .7Z .M3U .m3u" +SYSTEM_COMMAND="/usr/bin/runemu.sh %ROM% -P%SYSTEM% --core=%CORE% --emulator=%EMULATOR% --controllers=\"%CONTROLLERSCONFIG%\"" +SYSTEM_PLATFORM="msx" +SYSTEM_THEME="msx2" diff --git a/config/emulators/ports.conf b/config/emulators/ports.conf index 75678fde6..36a930140 100644 --- a/config/emulators/ports.conf +++ b/config/emulators/ports.conf @@ -1,10 +1,10 @@ SYSTEM_NAME="ports" SYSTEM_FULLNAME="Ports" SYSTEM_MANUFACTURER="Various" -SYSTEM_RELEASE="unknown" -SYSTEM_HARDWARE="various" +SYSTEM_RELEASE="2021" +SYSTEM_HARDWARE="PC" SYSTEM_PATH="/storage/roms/ports" SYSTEM_EXTENSION=".sh .SH" -SYSTEM_COMMAND="/USR/BIN/BASH %ROM% -P%SYSTEM% --CORE=%CORE% --EMULATOR=%EMULATOR% --CONTROLLERS="%CONTROLLERSCONFIG%"" +SYSTEM_COMMAND="/USR/BIN/BASH %ROM% -P%SYSTEM% --CORE=%CORE% --EMULATOR=%EMULATOR% --CONTROLLERS=\"%CONTROLLERSCONFIG%\"" SYSTEM_PLATFORM="pc" SYSTEM_THEME="ports" diff --git a/config/emulators/tools.conf b/config/emulators/tools.conf index aa4fc16fc..e93ddc716 100644 --- a/config/emulators/tools.conf +++ b/config/emulators/tools.conf @@ -1,11 +1,10 @@ SYSTEM_NAME="tools" SYSTEM_FULLNAME="Tools" SYSTEM_MANUFACTURER="Various" -SYSTEM_RELEASE="unknown" +SYSTEM_RELEASE="2021" SYSTEM_HARDWARE="system" SYSTEM_PATH="/storage/.config/modules" SYSTEM_EXTENSION=".sh" SYSTEM_COMMAND="/usr/bin/run %ROM%" SYSTEM_PLATFORM="tools" SYSTEM_THEME="tools" -SYSTEM_FULLNAME="Screenshots" diff --git a/config/functions b/config/functions index 6b0841d09..6ab4d127b 100644 --- a/config/functions +++ b/config/functions @@ -1782,19 +1782,19 @@ add_emu_core() { } mk_es_systems() { - cat <${ESTMP}/es_systems.cfg + cat <${ESTMP}/.es_systems.cfg EOF rm -f ${ESTMP}/*-emulators.tmp for essystem in $(ls ${ESTMP}/*.tmp | sort) do - sed -i -e '1,1d' -e '$ d' ${essystem} - cat ${essystem} >>${ESTMP}/es_systems.cfg + cat ${essystem} >>${ESTMP}/.es_systems.cfg done - cat <>${ESTMP}/es_systems.cfg + cat <>${ESTMP}/.es_systems.cfg EOF +xmlstarlet fo -t ${ESTMP}/.es_systems.cfg >${ESTMP}/es_systems.cfg 2>/dev/null } add_es_system() { @@ -1811,27 +1811,21 @@ add_es_system() { if [ ! -e "${ESTMP}/${SYSTEM_NAME}.tmp" ] then cat <${ESTMP}/${SYSTEM_NAME}.tmp - - - + + ${SYSTEM_NAME} + ${SYSTEM_FULLNAME} + ${SYSTEM_MANUFACTURER} + ${SYSTEM_RELEASE} + ${SYSTEM_HARDWARE} + ${SYSTEM_PATH} + ${SYSTEM_EXTENSION} + ${SYSTEM_COMMAND} + ${SYSTEM_PLATFORM} + ${SYSTEM_THEME} + EOF fi - xmlstarlet ed --omit-decl --inplace \ - -d '//systemList/system' \ - -s '//systemList' -t elem -n 'system' \ - -s '//systemList/system' -t elem -n 'name' -v "${SYSTEM_NAME}" \ - -s '//systemList/system' -t elem -n 'fullname' -v "${SYSTEM_FULLNAME}" \ - -s '//systemList/system' -t elem -n 'manufacturer' -v "${SYSTEM_MANUFACTURER}" \ - -s '//systemList/system' -t elem -n 'release' -v "${SYSTEM_RELEASE}" \ - -s '//systemList/system' -t elem -n 'hardware' -v "${SYSTEM_HARDWARE}" \ - -s '//systemList/system' -t elem -n 'path' -v "${SYSTEM_PATH}" \ - -s '//systemList/system' -t elem -n 'extension' -v "${SYSTEM_EXTENSION}" \ - -s '//systemList/system' -t elem -n 'command' -v "${SYSTEM_COMMAND}" \ - -s '//systemList/system' -t elem -n 'platform' -v "${SYSTEM_PLATFORM}" \ - -s '//systemList/system' -t elem -n 'theme' -v "${SYSTEM_THEME}" \ - -s '//systemList/system' -t elem -n "emulators" -v "" ${ESTMP}/${SYSTEM_NAME}.tmp 2>&1 >/dev/null - if [ -e "${ESTMP}/${SYSTEM_NAME}-emulators.tmp" ] then while read -r line @@ -1841,45 +1835,54 @@ EOF SYSTEM_DEFAULT=$(echo ${line} | awk 'BEGIN {FS="|"} {print $3}') ### Check to see if we've already added an emulator key. - EMTEST=$(xmlstarlet sel -t -c "////systemList/system/emulators/emulator[@name=\"${SYSTEM_EMULATOR}\"]" ${ESTMP}/${SYSTEM_NAME}.tmp 2>/dev/null ||:) + EMTEST=$(xmlstarlet sel -t -c "//system/emulators" ${ESTMP}/${SYSTEM_NAME}.tmp 2>/dev/null ||:) if [ -z "${EMTEST}" ] then ### Add the emulator element xmlstarlet ed --omit-decl --inplace \ - -s "//systemList/system/emulators" -t elem -n "emulator" -v "" \ + -s "//system" -t elem -n "emulators" -v "" \ + ${ESTMP}/${SYSTEM_NAME}.tmp 2>&1 >/dev/null + fi + + ### Check to see if we've already added an emulator key. + EETEST=$(xmlstarlet sel -t -c "//system/emulators/emulator[@name=\"${SYSTEM_EMULATOR}\"]" ${ESTMP}/${SYSTEM_NAME}.tmp 2>/dev/null ||:) + if [ -z "${EETEST}" ] + then + ### Add the emulator element + xmlstarlet ed --omit-decl --inplace \ + -s "//system/emulators" -t elem -n "emulator" -v "" \ ${ESTMP}/${SYSTEM_NAME}.tmp 2>&1 >/dev/null fi ### Add an attribute defining the emulator's name. xmlstarlet ed --omit-decl --inplace \ - -s "//systemList/system/emulators/emulator[not(@name)]" -t attr -n "name" -v "${SYSTEM_EMULATOR}" \ + -s "//system/emulators/emulator[not(@name)]" -t attr -n "name" -v "${SYSTEM_EMULATOR}" \ ${ESTMP}/${SYSTEM_NAME}.tmp 2>&1 >/dev/null ### Check to see if we've already added a core element. - COTEST=$(xmlstarlet sel -t -c "////systemList/system/emulators/emulator[@name=\"${SYSTEM_EMULATOR}\"]/cores/core" ${ESTMP}/${SYSTEM_NAME}.tmp 2>/dev/null ||:) + COTEST=$(xmlstarlet sel -t -c "//system/emulators/emulator[@name=\"${SYSTEM_EMULATOR}\"]/cores/core" ${ESTMP}/${SYSTEM_NAME}.tmp 2>/dev/null ||:) if [ -z "${COTEST}" ] then xmlstarlet ed --omit-decl --inplace \ - -s "//systemList/system/emulators/emulator[@name=\"${SYSTEM_EMULATOR}\"]" -t elem -n "cores" -v "" \ + -s "//system/emulators/emulator[@name=\"${SYSTEM_EMULATOR}\"]" -t elem -n "cores" -v "" \ ${ESTMP}/${SYSTEM_NAME}.tmp 2>&1 >/dev/null fi ### Add each core. xmlstarlet ed --omit-decl --inplace \ - -s "//systemList/system/emulators/emulator[@name=\"${SYSTEM_EMULATOR}\"]/cores" -t elem -n "core" -v "${SYSTEM_CORE}" \ + -s "//system/emulators/emulator[@name=\"${SYSTEM_EMULATOR}\"]/cores" -t elem -n "core" -v "${SYSTEM_CORE}" \ ${ESTMP}/${SYSTEM_NAME}.tmp 2>&1 >/dev/null if [ "${SYSTEM_DEFAULT}" = "true" ] then ### Add an attribute defining the default core xmlstarlet ed --omit-decl --inplace \ - -i "//systemList/system/emulators/emulator[@name=\"${SYSTEM_EMULATOR}\"]/cores/core" -t attr -n "default" -v "true" \ + -i "//system/emulators/emulator[@name=\"${SYSTEM_EMULATOR}\"]/cores/core" -t attr -n "default" -v "true" \ ${ESTMP}/${SYSTEM_NAME}.tmp 2>&1 >/dev/null fi done <${ESTMP}/${SYSTEM_NAME}-emulators.tmp fi - xmlstarlet fo -t ${ESTMP}/${SYSTEM_NAME}.tmp 2>&1 >/dev/null } # Use distribution functions if any diff --git a/packages/virtual/emulators/package.mk b/packages/virtual/emulators/package.mk index 21a562584..304ddfca4 100644 --- a/packages/virtual/emulators/package.mk +++ b/packages/virtual/emulators/package.mk @@ -380,7 +380,7 @@ makeinstall_target() { ### Atari Jaguar add_emu_core atarijaguar retroarch virtualjaguar true - add_es_system virtualjaguar + add_es_system atarijaguar ### Atari Lynx add_emu_core atarilynx retroarch handy true @@ -450,9 +450,9 @@ makeinstall_target() { add_es_system ngp ### SNK NeoGeo Pocket Color - add_emu_core ngc retroarch beetle_ngp true - add_emu_core ngc retroarch race false - add_es_system ngc + add_emu_core ngpc retroarch beetle_ngp true + add_emu_core ngpc retroarch race false + add_es_system ngpc ### Nintendo 64 add_emu_core n64 retroarch mupen64plus_next true @@ -546,9 +546,9 @@ makeinstall_target() { ### Sony Playstation 2 case ${TARGET_ARCH} in x86_64) - add_emu_core psx2 retroarch pcsx2 true - add_emu_core psx2 pcsx2 pcsx2-sa false - add_es_system psx2 + add_emu_core ps2 retroarch pcsx2 true + add_emu_core ps2 pcsx2 pcsx2-sa false + add_es_system ps2 ;; esac