potential fix for sdl segfault, attempt at es_features refacotr

This commit is contained in:
Nicholas Ricciuti 2022-11-21 22:46:57 -05:00
parent 7b212b003c
commit fed764dc3e
No known key found for this signature in database
GPG key ID: CBB28CCF1964C6D1
3 changed files with 60 additions and 72 deletions

View file

@ -6,39 +6,9 @@
. /etc/profile
echo 'starting mupen64plus stand alone emulator...'
CORE="$1"
ROM="${2##*/}"
PLATFORM="n64"
SHARE="/usr/local/share/mupen64plus"
INPUTCFGBASE="$SHARE/InputAutoCfg.ini"
CONF="/storage/.config/system/configs/system.cfg"
M64PCONF="/storage/.config/game/configs/mupen64plussa/mupen64plus.cfg"
TMP="/tmp/mupen64plussa"
GAMEDATA="/storage/.config/game/configs/mupen64plussa"
rm -rf $TMP
mkdir -p $TMP
function get_setting() {
#We look for the setting on the ROM first, if not found we search for platform and lastly we search globally
PAT="s|^${PLATFORM}\[\"${ROM}\"\].*${1}=\(.*\)|\1|p"
EES=$(sed -n "${PAT}" "${CONF}" | head -1)
if [ -z "${EES}" ]; then
PAT="s|^${PLATFORM}[\.-]${1}=\(.*\)|\1|p"
EES=$(sed -n "${PAT}" "${CONF}" | head -1)
fi
if [ -z "${EES}" ]; then
PAT="s|^global[\.-].*${1}=\(.*\)|\1|p"
EES=$(sed -n "${PAT}" "${CONF}" | head -1)
fi
[ -z "${EES}" ] && EES="false"
}
if [[ ! -f "$GAMEDATA/custominput.ini" ]]; then
mkdir -p $GAMEDATA
cp $SHARE/default.ini $GAMEDATA/custominput.ini
@ -51,60 +21,66 @@ fi
cp $M64PCONF $TMP
#Emulation Station Features
CORE="$1"
GAME=$(echo "${2}"| sed "s#^/.*/##")
ASPECT=$(get_setting game_aspect_ratio n64 "${GAME}")
IRES=$(get_setting internal_resolution n64 "${GAME}")
RSP=$(get_setting rsp_plugin n64 "${GAME}")
FPS=$(get_setting show_fps n64 "${GAME}")
CON=$(get_setting input_configuration n64 "${GAME}")
SHARE="/usr/local/share/mupen64plus"
M64PCONF="/storage/.config/game/configs/mupen64plussa/mupen64plus.cfg"
TMP="/tmp/mupen64plussa"
GAMEDATA="/storage/.config/game/configs/mupen64plussa"
RESOLUTION=$(batocera-resolution "currentResolution")
echo ${RESOLUTION}
RESA=${RESOLUTION%x*}
RESB=${RESOLUTION#*x}
SCREENWIDTH=$((RESA>=RESB ? RESA : RESB))
echo ${SCREENWIDTH}
SCREENHEIGHT=$((RESA<RESB ? RESA : RESB))
echo ${SCREENHEIGHT}
SET_PARAMS="--set Core[SharedDataPath]=$TMP --set Video-Rice[ResolutionWidth]=$SCREENWIDTH"
# Game Aspect Ratio
# Get configuration from system.cfg
get_setting "game_aspect_ratio"
echo ${EES}
if [ "${EES}" == "fullscreen" ]; then
# TODO: Set aspect ratio to fullscreen
SET_PARAMS="$SET_PARAMS --set Video-General[ScreenWidth]=$SCREENWIDTH --set Video-General[ScreenHeight]=$SCREENHEIGHT --set Video-Glide64mk2[aspect]=2 --set Video-GLideN64[AspectRatio]=3"
else
# TODO: Set aspect ratio to 4:3
if [ $1 = "m64p_rice" ]; then
GAMEWIDTH=$(((SCREENHEIGHT * 4) / 3))
SET_PARAMS="$SET_PARAMS --set Video-General[ScreenWidth]=$GAMEWIDTH --set Video-General[ScreenHeight]=$SCREENHEIGHT"
#Aspect Ratio
if [ "${ASPECT}" == "fullscreen" ]; then
# TODO: Set aspect ratio to fullscreen
SET_PARAMS="$SET_PARAMS --set Video-General[ScreenWidth]=$SCREENWIDTH --set Video-General[ScreenHeight]=$SCREENHEIGHT --set Video-Glide64mk2[aspect]=2 --set Video-GLideN64[AspectRatio]=3"
else
SET_PARAMS="$SET_PARAMS --set Video-General[ScreenWidth]=$SCREENWIDTH --set Video-General[ScreenHeight]=$SCREENHEIGHT --set Video-Glide64mk2[aspect]=0 --set Video-GLideN64[AspectRatio]=1"
# TODO: Set aspect ratio to 4:3
if [ $1 = "m64p_rice" ]; then
GAMEWIDTH=$(((SCREENHEIGHT * 4) / 3))
SET_PARAMS="$SET_PARAMS --set Video-General[ScreenWidth]=$GAMEWIDTH --set Video-General[ScreenHeight]=$SCREENHEIGHT"
else
SET_PARAMS="$SET_PARAMS --set Video-General[ScreenWidth]=$SCREENWIDTH --set Video-General[ScreenHeight]=$SCREENHEIGHT --set Video-Glide64mk2[aspect]=0 --set Video-GLideN64[AspectRatio]=1"
fi
fi
fi
# Game Aspect Ratio
# Get configuration from system.cfg
get_setting "input_configuration"
echo ${EES}
if [ "${EES}" == "zlswap" ]; then
#cat $INPUTCFGBASE <(echo) $SHARE/zlswap.ini > $TMP/InputAutoCfg.ini
cp $SHARE/zlswap.ini $TMP/InputAutoCfg.ini
elif [ "${EES}" == "custom" ]; then
cp $GAMEDATA/custominput.ini $TMP/InputAutoCfg.ini
else
# Default
cp $SHARE/default.ini $TMP/InputAutoCfg.ini
fi
# Native Res Factor (Upscaling)
#UseNativeResolutionFactor
if [ $1 = "m64p_gliden64"]; then
SET_PARAMS="$SET_PARAMS --set Video-GLideN64[UseNativeResolutionFactor]=$IRES"
fi
# Input Config
if [ "${CON}" == "zlswap" ]; then
cp $SHARE/zlswap.ini $TMP/InputAutoCfg.ini
elif [ "${CON}" == "custom" ]; then
cp $GAMEDATA/custominput.ini $TMP/InputAutoCfg.ini
else
# Default
cp $SHARE/default.ini $TMP/InputAutoCfg.ini
fi
# Show FPS
# Get configuration from system.cfg
get_setting "show_fps"
echo ${EES}
if [ "${EES}" == "auto" ] || [ "${EES}" == "disabled" ] || [ "${EES}" == "false" ] || [ "${EES}" == "none" ] || [ "${EES}" == "0" ]; then
SET_PARAMS="$SET_PARAMS --set Video-Glide64mk2[show_fps]=0 --set Video-Rice[ShowFPS]=\"False\" --set Video-GLideN64[ShowFPS]=0"
else
SET_PARAMS="$SET_PARAMS --set Video-Glide64mk2[show_fps]=1 --set Video-Rice[ShowFPS]=\"True\" --set Video-GLideN64[ShowFPS]=1"
fi
if [ "${FPS}" == "true" ]; then
SET_PARAMS="$SET_PARAMS --set Video-Glide64mk2[show_fps]=0 --set Video-Rice[ShowFPS]=\"False\" --set Video-GLideN64[ShowFPS]=0"
else
SET_PARAMS="$SET_PARAMS --set Video-Glide64mk2[show_fps]=1 --set Video-Rice[ShowFPS]=\"True\" --set Video-GLideN64[ShowFPS]=1"
fi
# RSP
RSP=$(get_setting rsp_plugin n64)
if [ "${RSP}" == "default" ] || [ "${RSP}" == "hle" ]; then
SET_PARAMS="$SET_PARAMS --set UI-Console[RspPlugin]=mupen64plus-rsp-hle.so"
else

View file

@ -27,16 +27,18 @@ make_target() {
export HOST_CPU=aarch64
export VC=0
export CROSS_COMPILE="${TARGET_PREFIX}"
export USE_GLES=1
BINUTILS="$(get_build_dir binutils)/.aarch64-libreelec-linux-gnueabi"
case ${DEVICE} in
RG552|X86_64)
export USE_GLES=0
;;
esac
;;
esac
export SDL_CFLAGS="-I${SYSROOT_PREFIX}/usr/include/SDL2 -D_REENTRANT"
export SDL_LDLIBS="-lSDL2_net -lSDL2"
if [ "${DEVICE}" = "RG552" || "${DEVICE}" = "X86_64"]
then
export USE_GLES=1
fi
export V=1
export OSD=0
make -C projects/unix clean

View file

@ -6,6 +6,12 @@
<choice name="4/3" value="4:3" />
<choice name="fullscreen" value="fullscreen" />
</feature>
<feature name="internal resolution">
<choice name="native (240p)" value="1"/>
<choice name="2x (480p)" value="2"/>
<choice name="3x (720p)" value="3"/>
<choice name="4x (1080p)" value="4"/>
</feature>
<feature name="rsp plugin">
<choice name="fast" value="hle" />
<choice name="accurate" value="mle" />
@ -15,6 +21,10 @@
<choice name="z & l swap" value="zlswap" />
<choice name="custom" value="custom" />
</feature>
<feature name="show fps">
<choice name="yes" value="true"/>
<choice name="no" value="false"/>
</feature>
</features>
</emulator>
<emulator name="yabasanshiroSA">