2022-03-13 20:41:31 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
# Copyright (C) 2021-present Shanti Gilbert (https://github.com/shantigilbert)
|
|
|
|
# Copyright (C) 2022-present Fewtarius
|
|
|
|
|
|
|
|
# Source predefined functions and variables
|
|
|
|
. /etc/profile
|
|
|
|
|
|
|
|
ROM_DIR="/storage/roms/saturn/yabasanshiro"
|
2022-06-21 21:04:58 +00:00
|
|
|
CONFIG_DIR="/storage/.config/game/yabasanshiro"
|
|
|
|
SOURCE_DIR="/usr/config/game/yabasanshiro"
|
2022-03-14 12:56:04 +00:00
|
|
|
BIOS_BACKUP="/storage/roms/bios/yabasanshiro"
|
2022-03-13 20:41:31 +00:00
|
|
|
|
|
|
|
if [ ! -d "${ROM_DIR}" ]
|
|
|
|
then
|
|
|
|
mkdir -p "${ROM_DIR}"
|
|
|
|
fi
|
|
|
|
|
2022-03-14 12:56:04 +00:00
|
|
|
if [ ! -d "${BIOS_BACKUP}" ]
|
|
|
|
then
|
|
|
|
mkdir -p "${BIOS_BACKUP}"
|
|
|
|
fi
|
|
|
|
|
2022-03-13 20:41:31 +00:00
|
|
|
if [ ! -e "${ROM_DIR}/${ROM_DIR}/input.cfg" ]
|
|
|
|
then
|
|
|
|
GAMEPAD=$(grep -b4 $(readlink ${DEVICE_CONTROLLER_DEV} | sed "s#^.*/##") /proc/bus/input/devices | awk 'BEGIN {FS="\""}; /Name/ {printf $2}')
|
|
|
|
GAMEPADCONFIG=$(xmlstarlet sel -t -c '//inputList/inputConfig[@deviceName="'${GAMEPAD}'"]' -n /storage/.emulationstation/es_input.cfg)
|
|
|
|
|
|
|
|
if [ ! -z "${GAMEPADCONFIG}" ]
|
|
|
|
then
|
|
|
|
cat <<EOF >${ROM_DIR}/input.cfg
|
|
|
|
<?xml version="1.0"?>
|
|
|
|
<inputList>
|
|
|
|
${GAMEPADCONFIG}
|
|
|
|
</inputList>
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2022-03-14 11:33:11 +00:00
|
|
|
BIOS=""
|
|
|
|
for BIOS in saturn_bios.bin sega_101.bin mpr-17933.bin mpr-18811-mx.ic1 mpr-19367-mx.ic1 stvbios.zip
|
|
|
|
do
|
|
|
|
BIOS=$(find /storage/roms/bios -name ${BIOS} -print 2>/dev/null)
|
|
|
|
if [ ! -z "${BIOS}" ]
|
|
|
|
then
|
|
|
|
BIOS="-b ${BIOS}"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2022-06-21 21:04:58 +00:00
|
|
|
GAME=$(echo "${1}"| sed "s#^/.*/##")
|
|
|
|
if [ ! -e "${CONFIG_DIR}/${GAME}.config" ]
|
|
|
|
then
|
|
|
|
cp -f ${SOURCE_DIR}/.config "${CONFIG_DIR}/${GAME}.config"
|
|
|
|
fi
|
|
|
|
|
2022-03-19 16:53:00 +00:00
|
|
|
yabasanshiroSA -r 2 -i "${1}" ${BIOS} >/var/log/exec.log 2>&1 ||:
|