Work on breaking up es_systems.

This commit is contained in:
fewtarius 2023-06-03 22:27:57 +00:00
parent 1df3b63a04
commit 5b846c258b
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A
5 changed files with 121 additions and 1 deletions

3
.gitignore vendored
View file

@ -43,5 +43,8 @@
.DS_Store
.directory
# es generation files
.es_cache/
# release images
release/

View file

@ -20,10 +20,13 @@ clean:
distclean:
rm -rf ./.ccache* ./$(BUILD_DIRS)
esclean:
rm -rf ./.es_cache
src-pkg:
tar cvJf sources.tar.xz sources .stamps
world: AMD64 RK3588 RK3326 RK3566 RK3566-X55 S922X
world: esclean AMD64 RK3588 RK3326 RK3566 RK3566-X55 S922X
AMD64:
PROJECT=PC DEVICE=AMD64 ARCH=i686 ./scripts/build_distro

View file

@ -0,0 +1,10 @@
SYSTEM_NAME="atari2600"
SYSTEM_FULLNAME="Atari 2600"
SYSTEM_MANUFACTURER="Atari"
SYSTEM_RELEASE="1977"
SYSTEM_HARDWARE="console"
SYSTEM_PATH="/storage/roms/atari2600"
SYSTEM_EXTENSION=".a26 .A26 .bin .BIN .zip .ZIP .7z .7Z"
SYSTEM_COMMAND="/usr/bin/runemu.sh %ROM% -P%SYSTEM% --core=%CORE% --emulator=%EMULATOR% --controllers=\"%CONTROLLERSCONFIG%\""
SYSTEM_PLATFORM="atari2600"
SYSTEM_THEME="atari2600"

View file

@ -1763,6 +1763,105 @@ exec_thread_safe() {
return ${result}
}
add_emu_core() {
TMPCACHE="${ROOT}/.es_cache"
if [ ! -d "${TMPCACHE}" ]
then
mkdir "${TMPCACHE}"
fi
# Schema: emulator|core|true/false
echo "${2}|${3}|${4}" >>${TMPCACHE}/${1}-emulators.tmp
}
add_es_system() {
if [ -e "${ROOT}/config/emulators/${1}.conf" ]
then
. ${ROOT}/config/emulators/${1}.conf
fi
TMPCACHE="${ROOT}/.es_cache"
if [ ! -d "${TMPCACHE}" ]
then
mkdir "${TMPCACHE}"
fi
if [ ! -e "${TMPCACHE}/${SYSTEM_NAME}.tmp" ]
then
cat <<EOF >${TMPCACHE}/${SYSTEM_NAME}.tmp
<?xml version="1.0" encoding="UTF-8"?>
<systemList>
</systemList>
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 "" ${TMPCACHE}/${SYSTEM_NAME}.tmp 2>&1 >/dev/null
if [ -e "${TMPCACHE}/${SYSTEM_NAME}-emulators.tmp" ]
then
while read -r line
do
SYSTEM_EMULATOR=$(echo ${line} | awk 'BEGIN {FS="|"} {print $1}')
SYSTEM_CORE=$(echo ${line} | awk 'BEGIN {FS="|"} {print $2}')
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}\"]" ${TMPCACHE}/${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 "" \
${TMPCACHE}/${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}" \
${TMPCACHE}/${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" ${TMPCACHE}/${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 "" \
${TMPCACHE}/${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}" \
${TMPCACHE}/${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" \
${TMPCACHE}/${SYSTEM_NAME}.tmp 2>&1 >/dev/null
fi
done <${TMPCACHE}/${SYSTEM_NAME}-emulators.tmp
fi
xmlstarlet fo -t ${TMPCACHE}/${SYSTEM_NAME}.tmp 2>&1 >/dev/null
}
# Use distribution functions if any
if [ -f "distributions/${DISTRO}/config/functions" ]; then
. distributions/${DISTRO}/config/functions

View file

@ -47,3 +47,8 @@ makeinstall_target() {
mkdir -p ${INSTALL}/usr/lib/libretro
cp ${PKG_BUILD}/src/os/libretro/stella_libretro.so ${INSTALL}/usr/lib/libretro/
}
post_makeinstall_target() {
add_emu_core atari2600 retroarch stella true
add_es_system atari2600
}