From dd024cc697b64ef46f18b636cfef17366cf89e6b Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Wed, 10 Mar 2021 02:45:46 +0000 Subject: [PATCH 01/10] Allow configuration of backends for sdl1/sdl2 modules This replaces the dispmanx module functionality and reworks the way backend configuration is done, including adding support for choosing to use X11 for modules using sdl1 or sdl2. A new supplementary module "backends" handles the configuration (replacing the dispmanx module). On upgrade /opt/retropie/configs/all/dispmanx.cfg is renamed to /opt/retropie/configs/all/backends.cfg Existing settings in this file will still work, but will be updated when using the backends configuration. Previously for some modules that use sdl1, a flag "dispmanx" was set to specify that the code worked with the sdl1 dispmanx driver on videocore/fkms on the RPI. This has been replaced with the flags "sdl1" "sdl2" and "sdl1-videocore" The backend module will use the flags to determine which driver backends are available for current system. For modules such as advmame which use sdl1 on videocore and sdl2 on other systems, the sdl1-videocore flag can be used which will only apply to the rpi1-3 using the legacy drivers. The setDispmanx call to default a module to the dispmanx driver has been replaced with setBackend, but the setDispmanx function is left for 3rd party module compatibility. Calls to setDispmanx should be replaced with a call such as: setBackend "$md_id" "dispmanx" But support for dispmanx should be checked in the module - eg hasPlatform "dispmanx" && setBackend "$md_id" "dispmanx" Module hooks for configure_dispmanx_on / conigure_dispmanx_off are no longer used (only used by fuse). Instead a function _backend_set_ID is called, with the backend to use, and a force parameter. By default no existing backend configuration is changed when calling setBackend, unless an additional parameter of 1 is added. This is so a module won't overwrite a user's existing configuration. If a module is set to launch under dispmanx, runcommand will handle it as before, but will also now handle launching sdl1 and sdl2 modules under X. It will also run the matchbox-window-manager which is required by some software. If switching a module to launch under X it will check for the correct dependencies. If not installed the user will be asked to confirm installation. --- scriptmodules/helpers.sh | 31 +++- scriptmodules/supplementary/backends.sh | 136 ++++++++++++++++++ scriptmodules/supplementary/dispmanx.sh | 52 ------- .../supplementary/runcommand/runcommand.sh | 43 ++++-- 4 files changed, 189 insertions(+), 73 deletions(-) create mode 100644 scriptmodules/supplementary/backends.sh delete mode 100644 scriptmodules/supplementary/dispmanx.sh diff --git a/scriptmodules/helpers.sh b/scriptmodules/helpers.sh index 5be8303388..28fa58835f 100644 --- a/scriptmodules/helpers.sh +++ b/scriptmodules/helpers.sh @@ -647,19 +647,38 @@ function addUdevInputRules() { rm -f /etc/udev/rules.d/99-evdev.rules } +## @fn setBackend() +## @param module_id name of module to configure backend for +## @param backend name of the backend to set +## @param force set to 1 to force the change +## @brief Set a backend rendering driver for a module +## @details Set a backend rendering driver for a module - can be currently default, dispmanx or x11. +## This function will only set a backend if +## - It's not already configured, or +## - The 3rd parameter (force) is set to 1 +function setBackend() { + local config="$configdir/all/backends.cfg" + local id="$1" + local mode="$2" + local force="$3" + iniConfig "=" "\"" "$config" + iniGet "$id" + if [[ "$force" -eq 1 || -z "$ini_value" ]]; then + iniSet "$id" "$mode" + chown $user:$user "$config" + fi +} + ## @fn setDispmanx() ## @param module_id name of module to add dispmanx flag for ## @param status initial status of flag (0 or 1) -## @brief Sets a dispmanx flag for a module. +## @brief Sets a dispmanx flag for a module. This function is deprecated. ## @details Set a dispmanx flag for a module as to whether it should use the ## sdl1 dispmanx backend by default or not (0 for framebuffer, 1 for dispmanx). +## This function is deprecated and instead setBackend should be used. function setDispmanx() { isPlatform "dispmanx" || return - local mod_id="$1" - local status="$2" - iniConfig "=" "\"" "$configdir/all/dispmanx.cfg" - iniSet $mod_id "$status" - chown $user:$user "$configdir/all/dispmanx.cfg" + setBackend "$1" "dispmanx" } ## @fn iniFileEditor() diff --git a/scriptmodules/supplementary/backends.sh b/scriptmodules/supplementary/backends.sh new file mode 100644 index 0000000000..cada44c8d2 --- /dev/null +++ b/scriptmodules/supplementary/backends.sh @@ -0,0 +1,136 @@ +#!/usr/bin/env bash + +# This file is part of The RetroPie Project +# +# The RetroPie Project is the legal property of its developers, whose names are +# too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. +# +# See the LICENSE.md file at the top-level directory of this distribution and +# at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md +# + +rp_module_id="backends" +rp_module_desc="Configure display/driver backends for emulators" +rp_module_section="config" +rp_module_flags="!mali !x11" + +function _list_backends() { + local id="$1" + backends=() + + local flags="${__mod_info[$id/flags]}" + local sdl + if isPlatform "videocore" && hasFlag "$flags" "sdl1-videocore"; then + sdl="sdl1" + elif hasFlag "$flags" "sdl1" || hasFlag "$flags" "dispmanx"; then + sdl="sdl1" + elif hasFlag "$flags" "sdl2"; then + sdl="sdl2" + else + return 1 + fi + + local default + if [[ "$sdl" == "sdl1" ]]; then + backends["default"]="SDL1 Framebuffer driver" + isPlatform "dispmanx" && backends["dispmanx"]="SDL1 DispmanX driver" + backends["x11"]="SDL1 on X11/Desktop" + elif [[ "$sdl" == "sdl2" ]]; then + if isPlatform "videocore"; then + default="SDL2 videocore driver" + elif isPlatform "kms"; then + default="SDL2 KMS driver" + fi + backends["default"]="$default" + backends["x11"]="SDL2 on X11/Desktop" + fi + return 0 +} + +function _get_current_backends() { + local id="$1" + iniConfig " = " '"' "$configdir/all/backends.cfg" + iniGet "$id" + if [[ -n "$ini_value" ]]; then + # translate old value of 1 as dispmanx for backward compatibility + [[ "$ini_value" == "1" ]] && ini_value="dispmanx" + else + ini_value="default" + fi + echo "$ini_value" +} + +function _update_hook_backends() { + local dispmanx_cfg="$configdir/all/dispmanx.cfg" + local backends_cfg="$configdir/all/backends.cfg" + if [[ -f "$dispmanx_cfg" ]]; then + mv "$dispmanx_cfg" "$backends_cfg" + fi +} + +function gui_backends() { + declare -A backends + local id + local backend + local default + local flags + local valid + while true; do + local options=() + for id in "${__mod_id[@]}"; do + valid=0 + if rp_isInstalled "$id"; then + if _list_backends "$id"; then + backend="$(_get_current_backends "$id")" + options+=("$id" "Using ${backends[$backend]}") + fi + fi + done + local cmd=(dialog --backtitle "$__backtitle" --default-item "$default" --menu "Configure display/driver backends for emulators" 22 76 16) + local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) + [[ -z "$choice" ]] && break + default="$choice" + gui_configure_backends "$choice" + done +} + +function gui_configure_backends() { + local id="$1" + declare -A backends + + _list_backends "$id" + + while true; do + local current="$(_get_current_backends "$id")" + local options=() + local selected + local backend + local flags + for backend in "${!backends[@]}"; do + selected="" + [[ "$current" == "$backend" ]] && selected="(Currently selected)" + options+=("$backend" "${backends[$backend]} $selected") + done + local cmd=(dialog --default-item "$current" --backtitle "$__backtitle" --menu "Select backend for $id" 22 76 16) + local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) + if [[ -n "$choice" ]]; then + if [[ "$choice" == "x11" ]] && ( ! hasPackage "xorg" || ! hasPackage "matchbox-window-manager" ); then + if dialog --defaultno --yesno "To use the X11/Xorg backend, some additional packages are needed (xorg / matchbox-window-manager) - do you want to continue?" 22 76 2>&1 >/dev/tty; then + aptInstall xorg matchbox-window-manager + else + continue + fi + fi + local func="_backend_set_$id" + if fnExists "$func"; then + rp_callModule "$id" _backend_set "$choice" 1 + else + setBackend "$id" "$choice" 1 + fi + fi + break + done +} + + + diff --git a/scriptmodules/supplementary/dispmanx.sh b/scriptmodules/supplementary/dispmanx.sh deleted file mode 100644 index 4d170b343c..0000000000 --- a/scriptmodules/supplementary/dispmanx.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash - -# This file is part of The RetroPie Project -# -# The RetroPie Project is the legal property of its developers, whose names are -# too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. -# -# See the LICENSE.md file at the top-level directory of this distribution and -# at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md -# - -rp_module_id="dispmanx" -rp_module_desc="Configure emulators to use dispmanx SDL" -rp_module_section="config" -rp_module_flags="!mali !x11" - -function gui_dispmanx() { - iniConfig " = " '"' "$configdir/all/dispmanx.cfg" - while true; do - local count=1 - local options=() - local command=() - local id - for id in "${__mod_id[@]}"; do - if [[ "${__mod_info[$id/flags]}" =~ dispmanx ]] && rp_isInstalled "$id"; then - iniGet "$id" - if [[ "$ini_value" == "1" ]]; then - options+=($count "Disable for $id (currently enabled)") - command[$count]="$id off" - else - options+=($count "Enable for $id (currently disabled)") - command[$count]="$id on" - fi - ((count++)) - fi - done - [[ -z "${options[*]}" ]] && break - local cmd=(dialog --backtitle "$__backtitle" --menu "Configure emulators to use dispmanx SDL" 22 76 16) - local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) - if [[ -n "$choice" ]]; then - local params=(${command[$choice]}) - if [[ "${params[1]}" == "on" ]]; then - setDispmanx "${params[0]}" 1 - else - setDispmanx "${params[0]}" "0" - fi - rp_callModule "${params[0]}" configure_dispmanx_${params[1]} - else - break - fi - done -} diff --git a/scriptmodules/supplementary/runcommand/runcommand.sh b/scriptmodules/supplementary/runcommand/runcommand.sh index 47def030aa..1f1de4ea89 100755 --- a/scriptmodules/supplementary/runcommand/runcommand.sh +++ b/scriptmodules/supplementary/runcommand/runcommand.sh @@ -57,7 +57,7 @@ ## used as well as other options from the runcommand GUI. ## ## If SAVE_NAME is included, that is used for loading and saving of video output -## modes as well as SDL1 dispmanx settings for the current COMMAND. If omitted, +## modes as well as rendering backend settings for the current COMMAND. If omitted, ## the binary name is used as a key for the loading and saving. The savename is ## also displayed in the video output menu (detailed below), so for our purposes ## we send the emulator module id, which is somewhat descriptive yet short. @@ -73,7 +73,7 @@ LOG="/dev/shm/runcommand.log" RUNCOMMAND_CONF="$CONFIGDIR/all/runcommand.cfg" VIDEO_CONF="$CONFIGDIR/all/videomodes.cfg" EMU_CONF="$CONFIGDIR/all/emulators.cfg" -DISPMANX_CONF="$CONFIGDIR/all/dispmanx.cfg" +BACKENDS_CONF="$CONFIGDIR/all/backends.cfg" RETRONETPLAY_CONF="$CONFIGDIR/all/retronetplay.cfg" # modesetting tools @@ -189,7 +189,7 @@ function get_params() { IS_SYS=0 CONSOLE_OUT=1 EMULATOR="$3" - # if we have an emulator name (such as module_id) we use that for storing/loading parameters for video output/dispmanx + # if we have an emulator name (such as module_id) we use that for storing/loading parameters for video mode / backend # if the parameter is empty we use the name of the binary (to avoid breakage with out of date emulationstation configs) [[ -z "$EMULATOR" ]] && EMULATOR="${COMMAND/% */}" fi @@ -947,6 +947,13 @@ echo "Set mode ${MODE_CUR[2]}x${MODE_CUR[3]}@${MODE_CUR[5]}Hz on \$XRANDR_OUTPUT _EOF_ fi + if [[ "$XINIT_WM" -eq 1 ]]; then + cat >>"$xinitrc" <<_EOF_ +matchbox-window-manager -use_cursor no & +sleep 0.5 +_EOF_ + fi + # echo command line for runcommand log cat >>"$xinitrc" <<_EOF_ echo -e "\nExecuting (via xinit): "${COMMAND//\$/\\\$}"\n" @@ -1029,21 +1036,27 @@ function restore_fb() { switch_fb_res "${FB_ORIG[0]}x${FB_ORIG[1]}" "${FB_ORIG[2]}" } -function config_dispmanx() { - # if we are running under X then don't try and use dispmanx +function config_backend() { + # if we are running under X then don't try and use a different backend [[ -n "$DISPLAY" || "$XINIT" -eq 1 ]] && return local name="$1" - # if we have a dispmanx conf file and $name is in it (as a variable) and set to 1, + # if we have a backends.conf file and with an entry for the current emulator name, # change the library path to load dispmanx sdl first - if [[ -f "$DISPMANX_CONF" ]]; then - iniConfig " = " '"' "$DISPMANX_CONF" + if [[ -f "$BACKENDS_CONF" ]]; then + iniConfig " = " '"' "$BACKENDS_CONF" iniGet "$name" - if [[ "$ini_value" == "1" ]]; then - if [[ "$HAS_MODESET" == "kms" ]]; then - COMMAND="SDL_DISPMANX_WIDTH=${MODE_CUR[2]} SDL_DISPMANX_HEIGHT=${MODE_CUR[3]} $COMMAND" - fi - COMMAND="SDL1_VIDEODRIVER=dispmanx $COMMAND" - fi + case "$ini_value" in + 1|dispmanx) + if [[ "$HAS_MODESET" == "kms" ]]; then + COMMAND="SDL_DISPMANX_WIDTH=${MODE_CUR[2]} SDL_DISPMANX_HEIGHT=${MODE_CUR[3]} $COMMAND" + fi + COMMAND="SDL1_VIDEODRIVER=dispmanx $COMMAND" + ;; + x11) + XINIT=1 + XINIT_WM=1 + ;; + esac fi } @@ -1331,7 +1344,7 @@ function runcommand() { [[ -n "$FB_NEW" ]] && switch_fb_res $FB_NEW - config_dispmanx "$SAVE_EMU" + config_backend "$SAVE_EMU" # switch to configured cpu scaling governor [[ -n "$GOVERNOR" ]] && set_governor "$GOVERNOR" From de4a57ed08eeda23d923f612479087f2a6002ee7 Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Wed, 10 Mar 2021 02:48:20 +0000 Subject: [PATCH 02/10] dosbox - switch to using getBackend Adjust the dosbox launch script to add -fullscreen when launching under X --- scriptmodules/emulators/dosbox.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scriptmodules/emulators/dosbox.sh b/scriptmodules/emulators/dosbox.sh index 13996a4452..5c65a7e7f1 100644 --- a/scriptmodules/emulators/dosbox.sh +++ b/scriptmodules/emulators/dosbox.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .bat .com .exe .sh .conf\n\nCopy your DOS games rp_module_licence="GPL2 https://sourceforge.net/p/dosbox/code-0/HEAD/tree/dosbox/trunk/COPYING" rp_module_repo="svn https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk - 4252" rp_module_section="opt" -rp_module_flags="dispmanx !mali" +rp_module_flags="sdl1 !mali" function depends_dosbox() { local depends=(libasound2-dev libpng-dev automake autoconf zlib1g-dev "$@") @@ -117,6 +117,9 @@ else params+=(-exit) fi +# fullscreen when running in X +[[ -n "\$DISPLAY" ]] && params+=(-fullscreen) + midi_synth start "$md_inst/bin/dosbox" "\${params[@]}" midi_synth stop @@ -138,8 +141,8 @@ _EOF_ fi fi - # default to dispmanx on rpi4/kms - isPlatform "mesa" && setDispmanx "$md_id" 1 + # set dispmanx by default on rpi with fkms + isPlatform "dispmanx" && ! isPlatform "videocore" && setBackend "$md_id" "dispmanx" moveConfigDir "$home/.$md_id" "$md_conf_root/pc" From 0b3d686213bfe1443ec9cae67171e5518c6295a6 Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Wed, 10 Mar 2021 02:50:31 +0000 Subject: [PATCH 03/10] drastic - rework module to use setBackend Previously the module used XINIT: to force X on kms systems (rpi4), but now with the new backend configuration, we can use the same emulator.cfg launch parameters, but default it to X11 for kms. Also remove the X11 launch code, as runcommand will take care of this now. Moved the logic around also, to avoid install related configuration work on removal. --- scriptmodules/emulators/drastic.sh | 41 ++++++++++++------------------ 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/scriptmodules/emulators/drastic.sh b/scriptmodules/emulators/drastic.sh index f95693fd69..618ccd3aed 100644 --- a/scriptmodules/emulators/drastic.sh +++ b/scriptmodules/emulators/drastic.sh @@ -14,7 +14,7 @@ rp_module_desc="NDS emu - DraStic" rp_module_help="ROM Extensions: .nds .zip\n\nCopy your Nintendo DS roms to $romdir/nds" rp_module_licence="PROP" rp_module_section="exp" -rp_module_flags="!all arm !armv6 !mali" +rp_module_flags="sdl2 !all arm !armv6 !mali" function depends_drastic() { local depends=(libasound2-dev libsdl2-dev zlib1g-dev) @@ -36,38 +36,29 @@ function install_bin_drastic() { function configure_drastic() { mkRomDir "nds" - # wrong permissions on game_database.xml - chmod 644 "$md_inst/game_database.xml" + addEmulator 1 "$md_id" "nds" "$md_inst/drastic.sh %ROM%" + addSystem "nds" - mkUserDir "$md_conf_root/nds/drastic" - mkUserDir "$md_conf_root/nds/drastic/system" + [[ "$md_mode" == "remove" ]] && return - local file - for file in game_database.xml system/drastic_bios_arm7.bin system/drastic_bios_arm9.bin usrcheat.dat drastic_logo_0.raw drastic_logo_1.raw; do - ln -sfv "$md_inst/$file" "$md_conf_root/nds/drastic/$file" - done + isPlatform "kms" && ! isPlatform "x11" && setBackend "$md_id" "x11" - if [[ "$md_mode" == "install" ]]; then - cat > "$md_inst/drastic.sh" << _EOF_ + cat > "$md_inst/drastic.sh" << _EOF_ #!/bin/bash -# Don't start a window manager on x11 platforms -if [[ -n \$DISPLAY && "\$2" == "kms" ]]; then - matchbox-window-manager -use_cursor no & - sleep 0.5 -fi pushd "$md_conf_root/nds/drastic" $md_inst/drastic "\$1" popd _EOF_ - chmod +x "$md_inst/drastic.sh" - fi + chmod +x "$md_inst/drastic.sh" - # Launch DraStic in an x11 session for KMS platforms - if isPlatform "kms" && ! isPlatform "x11"; then - addEmulator 1 "$md_id" "nds" "XINIT:$md_inst/drastic.sh %ROM% kms" - else - addEmulator 1 "$md_id" "nds" "$md_inst/drastic.sh %ROM%" - fi + # wrong permissions on game_database.xml + chmod 644 "$md_inst/game_database.xml" - addSystem "nds" + mkUserDir "$md_conf_root/nds/drastic" + mkUserDir "$md_conf_root/nds/drastic/system" + + local file + for file in game_database.xml system/drastic_bios_arm7.bin system/drastic_bios_arm9.bin usrcheat.dat drastic_logo_0.raw drastic_logo_1.raw; do + ln -sfv "$md_inst/$file" "$md_conf_root/nds/drastic/$file" + done } From e66301947afbb69541f35f9c8be66c55c4ac30ad Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Wed, 10 Mar 2021 02:53:18 +0000 Subject: [PATCH 04/10] fuse - rework module to use setBackend The configure_dispmanx_* functions are now just a _backend_set_fuse function which is called by the backends module for modules that have this. This allows a module to --- scriptmodules/emulators/fuse.sh | 36 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/scriptmodules/emulators/fuse.sh b/scriptmodules/emulators/fuse.sh index 4b67ff1cf0..d70e747edd 100644 --- a/scriptmodules/emulators/fuse.sh +++ b/scriptmodules/emulators/fuse.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .sna .szx .z80 .tap .tzx .gz .udi .mgt .img .trd rp_module_licence="GPL2 https://sourceforge.net/p/fuse-emulator/fuse/ci/master/tree/COPYING" rp_module_repo="file $__archive_url/fuse-1.5.7.tar.gz" rp_module_section="opt" -rp_module_flags="dispmanx !mali" +rp_module_flags="sdl1 !mali" function depends_fuse() { getDepends libsdl1.2-dev libpng-dev zlib1g-dev libbz2-dev libaudiofile-dev bison flex @@ -50,29 +50,31 @@ function install_fuse() { function configure_fuse() { mkRomDir "zxspectrum" - mkUserDir "$md_conf_root/zxspectrum" + addEmulator 0 "$md_id-48k" "zxspectrum" "$md_inst/bin/fuse --machine 48 --full-screen %ROM%" + addEmulator 0 "$md_id-128k" "zxspectrum" "$md_inst/bin/fuse --machine 128 --full-screen %ROM%" + addSystem "zxspectrum" + + [[ "$md_mode" == "remove" ]] && return + mkUserDir "$md_conf_root/zxspectrum" moveConfigFile "$home/.fuserc" "$md_conf_root/zxspectrum/.fuserc" - setDispmanx "$md_id" 1 - configure_dispmanx_on_fuse + # default to dispmanx backend + isPlatform "dispmanx" && _backend_set_fuse "dispmanx" - cat > "$romdir/zxspectrum/+Start Fuse.sh" << _EOF_ + local script="$romdir/zxspectrum/+Start Fuse.sh" + cat > "$script" << _EOF_ #!/bin/bash $md_inst/bin/fuse --machine 128 --full-screen _EOF_ - - addEmulator 0 "$md_id-48k" "zxspectrum" "$md_inst/bin/fuse --machine 48 --full-screen %ROM%" - addEmulator 0 "$md_id-128k" "zxspectrum" "$md_inst/bin/fuse --machine 128 --full-screen %ROM%" - addSystem "zxspectrum" -} - -function configure_dispmanx_on_fuse() { - setDispmanx "$md_id-48k" 1 - setDispmanx "$md_id-128k" 1 + chown $user:$user "$script" + chmod +x "$script" } -function configure_dispmanx_off_fuse() { - setDispmanx "$md_id-48k" 0 - setDispmanx "$md_id-128k" 0 +function _backend_set_fuse() { + local mode="$1" + local force="$2" + setBackend "$md_id" "$mode" "$force" + setBackend "$md_id-48k" "$mode" "$force" + setBackend "$md_id-128k" "$mode" "$force" } From 4816c9a289855f6adcab5fccc71e11581fbfd041 Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Wed, 10 Mar 2021 03:01:00 +0000 Subject: [PATCH 05/10] update emulators to use setBackend and new sdl1/sdl2 flags --- scriptmodules/emulators/advmame.sh | 2 +- scriptmodules/emulators/basilisk.sh | 2 +- scriptmodules/emulators/capricerpi.sh | 2 +- scriptmodules/emulators/daphne.sh | 4 ++-- scriptmodules/emulators/dgen.sh | 4 ++-- scriptmodules/emulators/dosbox-sdl2.sh | 1 + scriptmodules/emulators/fbzx.sh | 4 ++-- scriptmodules/emulators/jzintv.sh | 6 ++---- scriptmodules/emulators/linapple.sh | 4 ++-- scriptmodules/emulators/np2pi.sh | 5 +++-- scriptmodules/emulators/pcsx-rearmed.sh | 4 ++-- scriptmodules/emulators/px68k.sh | 4 +--- scriptmodules/emulators/quasi88.sh | 2 +- scriptmodules/emulators/residualvm.sh | 2 +- scriptmodules/emulators/scummvm-sdl1.sh | 5 +++-- scriptmodules/emulators/scummvm.sh | 2 +- scriptmodules/emulators/snes9x.sh | 4 ++-- scriptmodules/emulators/ti99sim-sdl1.sh | 4 ++-- scriptmodules/emulators/uae4all.sh | 4 ++-- scriptmodules/emulators/zesarux.sh | 4 ++-- 20 files changed, 34 insertions(+), 35 deletions(-) diff --git a/scriptmodules/emulators/advmame.sh b/scriptmodules/emulators/advmame.sh index 58f77456f7..8cf405365d 100644 --- a/scriptmodules/emulators/advmame.sh +++ b/scriptmodules/emulators/advmame.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extension: .zip\n\nCopy your AdvanceMAME roms to either $rom rp_module_licence="GPL2 https://raw.githubusercontent.com/amadvance/advancemame/master/COPYING" rp_module_repo="git https://github.com/amadvance/advancemame v3.9" rp_module_section="opt" -rp_module_flags="" +rp_module_flags="sdl2 sdl1-videocore" function _update_hook_advmame() { # if the non split advmame is installed, make directories for 0.94 / 1.4 so they will be updated diff --git a/scriptmodules/emulators/basilisk.sh b/scriptmodules/emulators/basilisk.sh index e2138e1a9d..1c0e9c88aa 100644 --- a/scriptmodules/emulators/basilisk.sh +++ b/scriptmodules/emulators/basilisk.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .img .rom\n\nCopy your Macintosh roms mac.rom an rp_module_licence="GPL2 https://raw.githubusercontent.com/cebix/macemu/master/BasiliskII/COPYING" rp_module_repo="git https://github.com/cebix/macemu.git master" rp_module_section="opt" -rp_module_flags="dispmanx !mali" +rp_module_flags="sdl1 !mali" function depends_basilisk() { local depends=(libsdl1.2-dev autoconf automake oss-compat) diff --git a/scriptmodules/emulators/capricerpi.sh b/scriptmodules/emulators/capricerpi.sh index 2dde2a8199..ccaab45834 100644 --- a/scriptmodules/emulators/capricerpi.sh +++ b/scriptmodules/emulators/capricerpi.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .cdt .cpc .dsk\n\nCopy your Amstrad CPC games to rp_module_licence="GPL2 https://raw.githubusercontent.com/KaosOverride/CapriceRPI/master/COPYING.txt" rp_module_repo="git https://github.com/KaosOverride/CapriceRPI.git master" rp_module_section="opt" -rp_module_flags="dispmanx !all videocore" +rp_module_flags="sdl1 !all videocore" function depends_capricerpi() { getDepends libsdl1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev zlib1g-dev libpng-dev diff --git a/scriptmodules/emulators/daphne.sh b/scriptmodules/emulators/daphne.sh index 68a3177443..d9c8fb6822 100644 --- a/scriptmodules/emulators/daphne.sh +++ b/scriptmodules/emulators/daphne.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extension: .daphne\n\nCopy your Daphne roms to $romdir/daphn rp_module_licence="GPL2 https://raw.githubusercontent.com/RetroPie/daphne-emu/master/COPYING" rp_module_repo="git https://github.com/RetroPie/daphne-emu.git retropie" rp_module_section="opt" -rp_module_flags="dispmanx !x86 !mali" +rp_module_flags="sdl1 !x86 !mali" function depends_daphne() { getDepends libsdl1.2-dev libvorbis-dev libglew-dev zlib1g-dev @@ -57,7 +57,7 @@ function configure_daphne() { mkUserDir "$md_conf_root/daphne" - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" if [[ ! -f "$md_conf_root/daphne/dapinput.ini" ]]; then cp -v "$md_data/dapinput.ini" "$md_conf_root/daphne/dapinput.ini" diff --git a/scriptmodules/emulators/dgen.sh b/scriptmodules/emulators/dgen.sh index 1fb9ef32fe..e4426162d1 100644 --- a/scriptmodules/emulators/dgen.sh +++ b/scriptmodules/emulators/dgen.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .32x .iso .cue .smd .bin .gen .md .sg .zip\n\nCo rp_module_licence="GPL2 https://sourceforge.net/p/dgen/dgen/ci/master/tree/COPYING" rp_module_repo="file $__archive_url/dgen-sdl-1.33.tar.gz" rp_module_section="opt" -rp_module_flags="dispmanx !mali !kms" +rp_module_flags="sdl1 !mali !kms" function depends_dgen() { getDepends libsdl1.2-dev libarchive-dev @@ -104,5 +104,5 @@ function configure_dgen() { iniSet "joy_pad2_mode" "joystick1-button6" iniSet "joy_pad2_start" "joystick1-button7" - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" } diff --git a/scriptmodules/emulators/dosbox-sdl2.sh b/scriptmodules/emulators/dosbox-sdl2.sh index eaa95590f4..002a462bbe 100644 --- a/scriptmodules/emulators/dosbox-sdl2.sh +++ b/scriptmodules/emulators/dosbox-sdl2.sh @@ -15,6 +15,7 @@ rp_module_help="ROM Extensions: .bat .com .exe .sh .conf\n\nCopy your DOS games rp_module_licence="GPL2 https://sourceforge.net/p/dosbox/code-0/HEAD/tree/dosbox/trunk/COPYING" rp_module_repo="git https://github.com/duganchen/dosbox.git master" rp_module_section="exp" +rp_module_flags="sdl2" function depends_dosbox-sdl2() { local depends=(libsdl2-dev libsdl2-net-dev libfluidsynth-dev fluid-soundfont-gm libglew-dev) diff --git a/scriptmodules/emulators/fbzx.sh b/scriptmodules/emulators/fbzx.sh index 33f5ce137f..5b22e0e273 100644 --- a/scriptmodules/emulators/fbzx.sh +++ b/scriptmodules/emulators/fbzx.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .sna .szx .z80 .tap .tzx .gz .udi .mgt .img .trd rp_module_licence="GPL3 https://raw.githubusercontent.com/rastersoft/fbzx/master/COPYING" rp_module_repo="git https://github.com/rastersoft/fbzx :_get_branch_fbzx" rp_module_section="opt" -rp_module_flags="dispmanx !mali !kms" +rp_module_flags="sdl1 !mali !kms" function _get_branch_fbzx() { local branch @@ -53,6 +53,6 @@ function install_fbzx() { function configure_fbzx() { mkRomDir "zxspectrum" - addEmulator 0 "$md_id" "zxspectrum" "pushd $md_inst/share; $md_inst/bin/fbzx %ROM%; popd" + addEmulator 0 "$md_id" "zxspectrum" "pushd $md_inst/share; $md_inst/bin/fbzx -fs %ROM%; popd" addSystem "zxspectrum" } diff --git a/scriptmodules/emulators/jzintv.sh b/scriptmodules/emulators/jzintv.sh index 4df8061536..a89166325f 100644 --- a/scriptmodules/emulators/jzintv.sh +++ b/scriptmodules/emulators/jzintv.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .int .bin\n\nCopy your Intellivision roms to $ro rp_module_licence="GPL2 http://spatula-city.org/%7Eim14u2c/intv/" rp_module_repo="file $__archive_url/jzintv-20181225.zip" rp_module_section="opt" -rp_module_flags="dispmanx !mali" +rp_module_flags="sdl1 !mali" function depends_jzintv() { getDepends libsdl1.2-dev @@ -47,9 +47,7 @@ function install_jzintv() { function configure_jzintv() { mkRomDir "intellivision" - if ! isPlatform "x11"; then - setDispmanx "$md_id" 1 - fi + ! isPlatform "x11" && setBackend "$md_id" "dispmanx" addEmulator 1 "$md_id" "intellivision" "$md_inst/bin/jzintv -p $biosdir -q %ROM%" addSystem "intellivision" diff --git a/scriptmodules/emulators/linapple.sh b/scriptmodules/emulators/linapple.sh index e9cf342063..c6160a6018 100644 --- a/scriptmodules/emulators/linapple.sh +++ b/scriptmodules/emulators/linapple.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .dsk\n\nCopy your Apple 2 games to $romdir/apple rp_module_licence="GPL2 https://raw.githubusercontent.com/dabonetn/linapple-pie/master/LICENSE" rp_module_repo="git https://github.com/dabonetn/linapple-pie.git master" rp_module_section="opt" -rp_module_flags="dispmanx !mali" +rp_module_flags="sdl1 !mali" function depends_linapple() { getDepends libzip-dev libsdl1.2-dev libsdl-image1.2-dev libcurl4-openssl-dev @@ -59,7 +59,7 @@ function configure_linapple() { copyDefaultConfig "$file" "$md_conf_root/apple2/$file" done - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" mkUserDir "$md_conf_root/apple2" moveConfigDir "$home/.linapple" "$md_conf_root/apple2" diff --git a/scriptmodules/emulators/np2pi.sh b/scriptmodules/emulators/np2pi.sh index 77270bedee..b5038b7c2d 100644 --- a/scriptmodules/emulators/np2pi.sh +++ b/scriptmodules/emulators/np2pi.sh @@ -14,7 +14,7 @@ rp_module_desc="NEC PC-9801 emulator" rp_module_help="ROM Extensions: .d88 .d98 .88d .98d .fdi .xdf .hdm .dup .2hd .tfd .hdi .thd .nhd .hdd\n\nCopy your pc98 games to to $romdir/pc88\n\nCopy bios files 2608_bd.wav, 2608_hh.wav, 2608_rim.wav, 2608_sd.wav, 2608_tom.wav 2608_top.wav, bios.rom, FONT.ROM and sound.rom to $biosdir/pc98" rp_module_repo="git https://github.com/eagle0wl/np2pi.git master" rp_module_section="exp" -rp_module_flags="!all dispmanx rpi !aarch64" +rp_module_flags="sdl1 !all rpi !aarch64" function depends_np2pi() { getDepends libsdl1.2-dev libasound2-dev libsdl-ttf2.0-dev fonts-takao-gothic @@ -40,7 +40,8 @@ function configure_np2pi() { mkRomDir "pc98" mkUserDir "$md_conf_root/pc98" - setDispmanx "$md_id" 1 + + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" # we launch from $md_conf_root/pc98 as emulator wants to create files in # the current directory (eg font.tmp). diff --git a/scriptmodules/emulators/pcsx-rearmed.sh b/scriptmodules/emulators/pcsx-rearmed.sh index 6c47d54aa6..956d1d3aa7 100644 --- a/scriptmodules/emulators/pcsx-rearmed.sh +++ b/scriptmodules/emulators/pcsx-rearmed.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .bin .cue .cbn .img .iso .m3u .mdf .pbp .toc .z rp_module_licence="GPL2 https://raw.githubusercontent.com/notaz/pcsx_rearmed/master/COPYING" rp_module_repo="git https://github.com/notaz/pcsx_rearmed.git master" rp_module_section="opt" -rp_module_flags="dispmanx !all videocore" +rp_module_flags="sdl1 !all videocore" function depends_pcsx-rearmed() { getDepends libsdl1.2-dev libasound2-dev libpng-dev libx11-dev @@ -65,7 +65,7 @@ function configure_pcsx-rearmed() { # symlink config folder moveConfigDir "$md_inst/.pcsx" "$md_conf_root/psx/pcsx" - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" addEmulator 0 "$md_id" "psx" "pushd $md_inst; ./pcsx -cdfile %ROM%; popd" addSystem "psx" diff --git a/scriptmodules/emulators/px68k.sh b/scriptmodules/emulators/px68k.sh index 7ed11a04b0..c170011473 100644 --- a/scriptmodules/emulators/px68k.sh +++ b/scriptmodules/emulators/px68k.sh @@ -14,7 +14,7 @@ rp_module_desc="SHARP X68000 Emulator" rp_module_help="You need to copy a X68000 bios file (iplrom30.dat, iplromco.dat, iplrom.dat, or iplromxv.dat), and the font file (cgrom.dat or cgrom.tmp) to $biosdir/keropi. Use F12 to access the in emulator menu." rp_module_repo="git https://github.com/hissorii/px68k.git master" rp_module_section="exp" -rp_module_flags="!mali !kms" +rp_module_flags="sdl1 !mali !kms" function depends_px68k() { getDepends libsdl1.2-dev libsdl-gfx1.2-dev @@ -51,8 +51,6 @@ function configure_px68k() { ln -sf "$biosdir/keropi/$bios" "$md_conf_root/x68000/$bios" done - setDispmanx "$md_id" 0 - addEmulator 1 "$md_id" "x68000" "$md_inst/px68k %ROM%" addSystem "x68000" } diff --git a/scriptmodules/emulators/quasi88.sh b/scriptmodules/emulators/quasi88.sh index 93500ac24e..abbf2da93d 100644 --- a/scriptmodules/emulators/quasi88.sh +++ b/scriptmodules/emulators/quasi88.sh @@ -14,7 +14,7 @@ rp_module_desc="NEC PC-8801 emulator" rp_module_help="ROM Extensions: .d88 .88d .cmt .t88\n\nCopy your pc88 games to to $romdir/pc88\n\nCopy bios files FONT.ROM, N88.ROM, N88KNJ1.ROM, N88KNJ2.ROM, and N88SUB.ROM to $biosdir/pc88" rp_module_repo="file $__archive_url/quasi88-0.6.4.tgz" rp_module_section="exp" -rp_module_flags="dispmanx !mali !kms" +rp_module_flags="sdl1 !mali !kms" function depends_quasi88() { getDepends libsdl1.2-dev diff --git a/scriptmodules/emulators/residualvm.sh b/scriptmodules/emulators/residualvm.sh index 10259b633e..f3bd6f4460 100644 --- a/scriptmodules/emulators/residualvm.sh +++ b/scriptmodules/emulators/residualvm.sh @@ -15,7 +15,7 @@ rp_module_help="Copy your ResidualVM games to $romdir/residualvm" rp_module_licence="GPL2 https://raw.githubusercontent.com/residualvm/residualvm/master/COPYING" rp_module_repo="git https://github.com/ResidualVM/ResidualVM.git master" rp_module_section="exp" -rp_module_flags="dispmanx !mali" +rp_module_flags="sdl2 !mali" function depends_residualvm() { local depends=( diff --git a/scriptmodules/emulators/scummvm-sdl1.sh b/scriptmodules/emulators/scummvm-sdl1.sh index 092612719b..3e10dc0c99 100644 --- a/scriptmodules/emulators/scummvm-sdl1.sh +++ b/scriptmodules/emulators/scummvm-sdl1.sh @@ -15,7 +15,7 @@ rp_module_help="Copy your ScummVM games to $romdir/scummvm" rp_module_licence="GPL2 https://raw.githubusercontent.com/scummvm/scummvm/master/COPYING" rp_module_repo="git https://github.com/scummvm/scummvm.git v2.2.0" rp_module_section="opt" -rp_module_flags="dispmanx !mali !x11" +rp_module_flags="sdl1 !mali !x11" function depends_scummvm-sdl1() { depends_scummvm @@ -43,6 +43,7 @@ function install_scummvm-sdl1() { } function configure_scummvm-sdl1() { - isPlatform "kms" && setDispmanx "$md_id" 1 + # use dispmanx by default on rpi with fkms + isPlatform "dispmanx" && ! isPlatform "videocore" && setBackend "$md_id" "dispmmanx" configure_scummvm } diff --git a/scriptmodules/emulators/scummvm.sh b/scriptmodules/emulators/scummvm.sh index da4ccb9034..2c382c3530 100644 --- a/scriptmodules/emulators/scummvm.sh +++ b/scriptmodules/emulators/scummvm.sh @@ -15,7 +15,7 @@ rp_module_help="Copy your ScummVM games to $romdir/scummvm" rp_module_licence="GPL2 https://raw.githubusercontent.com/scummvm/scummvm/master/COPYING" rp_module_repo="git https://github.com/scummvm/scummvm.git v2.2.0" rp_module_section="opt" -rp_module_flags="" +rp_module_flags="sdl2" function depends_scummvm() { local depends=( diff --git a/scriptmodules/emulators/snes9x.sh b/scriptmodules/emulators/snes9x.sh index 004baade5a..b1de539ca8 100644 --- a/scriptmodules/emulators/snes9x.sh +++ b/scriptmodules/emulators/snes9x.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .bin .smc .sfc .fig .swc .mgd .zip\n\nCopy your rp_module_licence="NONCOM https://raw.githubusercontent.com/RetroPie/snes9x-rpi/master/snes9x.h" rp_module_repo="git https://github.com/RetroPie/snes9x-rpi.git retropie" rp_module_section="opt" -rp_module_flags="dispmanx !all videocore" +rp_module_flags="sdl1 !all videocore" function depends_snes9x() { getDepends libsdl1.2-dev libboost-thread-dev libboost-system-dev libsdl-ttf2.0-dev libasound2-dev @@ -45,7 +45,7 @@ function install_snes9x() { function configure_snes9x() { mkRomDir "snes" - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" addEmulator 0 "$md_id" "snes" "$md_inst/snes9x %ROM%" addSystem "snes" diff --git a/scriptmodules/emulators/ti99sim-sdl1.sh b/scriptmodules/emulators/ti99sim-sdl1.sh index c1015f3b62..1e4601f6ec 100644 --- a/scriptmodules/emulators/ti99sim-sdl1.sh +++ b/scriptmodules/emulators/ti99sim-sdl1.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extension: .ctg\n\nCopy your TI-99 games to $romdir/ti99\n\n rp_module_licence="GPL2 http://www.mrousseau.org/programs/ti99sim/" rp_module_repo="file $__archive_url/ti99sim-0.15.0.src.tar.gz" rp_module_section="exp" -rp_module_flags="dispmanx !mali" +rp_module_flags="sdl1 !mali" function depends_ti99sim-sdl1() { getDepends libsdl1.2-dev libssl-dev libboost-regex-dev @@ -41,7 +41,7 @@ function configure_ti99sim-sdl1() { [[ "$md_mode" == "remove" ]] && return - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" moveConfigDir "$home/.ti99sim" "$md_conf_root/ti99/" ln -sf "$biosdir/TI-994A.ctg" "$md_inst/TI-994A.ctg" diff --git a/scriptmodules/emulators/uae4all.sh b/scriptmodules/emulators/uae4all.sh index 9a70126e2c..7defcb6adb 100644 --- a/scriptmodules/emulators/uae4all.sh +++ b/scriptmodules/emulators/uae4all.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extension: .adf\n\nCopy your Amiga games to $romdir/amiga\n\ rp_module_licence="GPL2 https://raw.githubusercontent.com/RetroPie/uae4all2/retropie/copying" rp_module_repo="git https://github.com/RetroPie/uae4all2.git retropie" rp_module_section="opt" -rp_module_flags="dispmanx !all videocore" +rp_module_flags="sdl1 !all videocore" function depends_uae4all() { getDepends libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libsdl-ttf2.0-dev @@ -94,7 +94,7 @@ _EOF_ chmod a+x "$romdir/amiga/+Start UAE4All.sh" chown $user:$user "$romdir/amiga/+Start UAE4All.sh" - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" else rm -f "$biosdir/aros-amiga-m68k"* fi diff --git a/scriptmodules/emulators/zesarux.sh b/scriptmodules/emulators/zesarux.sh index d2d6086378..fedb177108 100644 --- a/scriptmodules/emulators/zesarux.sh +++ b/scriptmodules/emulators/zesarux.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .sna .szx .z80 .tap .tzx .gz .udi .mgt .img .trd rp_module_licence="GPL3 https://raw.githubusercontent.com/chernandezba/zesarux/master/src/LICENSE" rp_module_repo="git https://github.com/chernandezba/zesarux.git 9.1" rp_module_section="opt" -rp_module_flags="dispmanx !mali" +rp_module_flags="!mali" function depends_zesarux() { local depends=(libssl-dev libpthread-stubs0-dev libasound2-dev) @@ -99,7 +99,7 @@ _EOF_ copyDefaultConfig "$config" "$md_conf_root/zxspectrum/.zesaruxrc" rm "$config" - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" addEmulator 1 "$md_id" "zxspectrum" "bash $romdir/zxspectrum/+Start\ ZEsarUX.sh %ROM%" addEmulator 1 "$md_id" "samcoupe" "bash $romdir/zxspectrum/+Start\ ZEsarUX.sh --machine sam %ROM%" From 25b2e28abbb16bbbd0b5d1537605380c1ec8b142 Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Wed, 10 Mar 2021 03:03:13 +0000 Subject: [PATCH 06/10] update ports to use setBackend functionality and sdl1/sdl2 flags --- scriptmodules/ports/bombermaaan.sh | 4 ++-- scriptmodules/ports/cdogs-sdl.sh | 4 ++-- scriptmodules/ports/openbor.sh | 4 ++-- scriptmodules/ports/openttd.sh | 4 ++-- scriptmodules/ports/smw.sh | 4 ++-- scriptmodules/ports/wolf4sdl.sh | 4 ++-- scriptmodules/ports/xrick.sh | 5 +++-- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/scriptmodules/ports/bombermaaan.sh b/scriptmodules/ports/bombermaaan.sh index a16aeb118c..fc0c2d270e 100644 --- a/scriptmodules/ports/bombermaaan.sh +++ b/scriptmodules/ports/bombermaaan.sh @@ -14,7 +14,7 @@ rp_module_desc="Bombermaaan - Classic bomberman game" rp_module_licence="GPL3 https://raw.githubusercontent.com/bjaraujo/Bombermaaan/master/LICENSE.txt" rp_module_repo="git https://github.com/bjaraujo/Bombermaaan.git v1.9.7.2126" rp_module_section="exp" -rp_module_flags="dispmanx !mali" +rp_module_flags="sdl1 !mali" function depends_bombermaaan() { getDepends cmake libsdl1.2-dev libsdl-mixer1.2-dev @@ -44,7 +44,7 @@ function install_bombermaaan() { function configure_bombermaaan() { addPort "$md_id" "bombermaaan" "Bombermaaan" "$md_inst/bombermaaan" - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" local file="$romdir/ports/Bombermaaan.sh" cat >"$file" << _EOF_ diff --git a/scriptmodules/ports/cdogs-sdl.sh b/scriptmodules/ports/cdogs-sdl.sh index ab34643022..ec16a3af01 100644 --- a/scriptmodules/ports/cdogs-sdl.sh +++ b/scriptmodules/ports/cdogs-sdl.sh @@ -14,7 +14,7 @@ rp_module_desc="C-Dogs SDL - Classic overhead run-and-gun game" rp_module_licence="GPL2 https://raw.githubusercontent.com/cxong/cdogs-sdl/master/COPYING" rp_module_repo="git https://github.com/cxong/cdogs-sdl.git 0.7.2" rp_module_section="exp" -rp_module_flags="dispmanx !mali" +rp_module_flags="sdl1 !mali" function depends_cdogs-sdl() { getDepends cmake libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev @@ -49,7 +49,7 @@ function configure_cdogs-sdl() { [[ "$md_mode" == "remove" ]] && return - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" moveConfigDir "$home/.config/cdogs-sdl" "$md_conf_root/cdogs-sdl" } diff --git a/scriptmodules/ports/openbor.sh b/scriptmodules/ports/openbor.sh index a086ca210f..2d25846f01 100644 --- a/scriptmodules/ports/openbor.sh +++ b/scriptmodules/ports/openbor.sh @@ -15,7 +15,7 @@ rp_module_help="OpenBOR games need to be extracted to function properly. Place y rp_module_licence="BSD https://raw.githubusercontent.com/rofl0r/openbor/master/LICENSE" rp_module_repo="git https://github.com/rofl0r/openbor.git master" rp_module_section="exp" -rp_module_flags="dispmanx !mali !x11" +rp_module_flags="sdl1 !mali !x11" function depends_openbor() { getDepends libsdl1.2-dev libsdl-gfx1.2-dev libogg-dev libvorbisidec-dev libvorbis-dev libpng-dev zlib1g-dev @@ -47,7 +47,7 @@ function configure_openbor() { addPort "$md_id" "openbor" "OpenBOR - Beats of Rage Engine" "$md_inst/openbor.sh" mkRomDir "ports/$md_id" - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" cat >"$md_inst/openbor.sh" << _EOF_ #!/bin/bash diff --git a/scriptmodules/ports/openttd.sh b/scriptmodules/ports/openttd.sh index 1e654a331b..5e3a2d975c 100644 --- a/scriptmodules/ports/openttd.sh +++ b/scriptmodules/ports/openttd.sh @@ -13,7 +13,7 @@ rp_module_id="openttd" rp_module_desc="Open Source Simulator Based On Transport Tycoon Deluxe" rp_module_licence="GPL2 https://raw.githubusercontent.com/OpenTTD/OpenTTD/master/COPYING.md" rp_module_section="opt" -rp_module_flags="dispmanx !mali" +rp_module_flags="sdl1 !mali" function _update_hook_openttd() { # to show as installed in retropie-setup 4.x @@ -33,7 +33,7 @@ function configure_openttd() { [[ "$md_mode" == "remove" ]] && return - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" local dir for dir in .config .local/share; do diff --git a/scriptmodules/ports/smw.sh b/scriptmodules/ports/smw.sh index 5fd63eca4c..05cc838c4f 100644 --- a/scriptmodules/ports/smw.sh +++ b/scriptmodules/ports/smw.sh @@ -14,7 +14,7 @@ rp_module_desc="Super Mario War" rp_module_licence="GPL http://supermariowar.supersanctuary.net/" rp_module_repo="git https://github.com/HerbFargus/Super-Mario-War.git master" rp_module_section="opt" -rp_module_flags="!mali" +rp_module_flags="sdl1 !mali" function depends_smw() { getDepends libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev @@ -40,7 +40,7 @@ function configure_smw() { [[ "$md_mode" == "remove" ]] && return - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" moveConfigFile "$home/.smw.options.bin" "$md_conf_root/smw/.smw.options.bin" } diff --git a/scriptmodules/ports/wolf4sdl.sh b/scriptmodules/ports/wolf4sdl.sh index a05c55de94..22d551bc43 100644 --- a/scriptmodules/ports/wolf4sdl.sh +++ b/scriptmodules/ports/wolf4sdl.sh @@ -14,7 +14,7 @@ rp_module_desc="Wolf4SDL - port of Wolfenstein 3D / Spear of Destiny engine" rp_module_licence="NONCOM https://raw.githubusercontent.com/mozzwald/wolf4sdl/master/license-mame.txt" rp_module_repo="git https://github.com/mozzwald/wolf4sdl.git master" rp_module_section="opt" -rp_module_flags="dispmanx !mali" +rp_module_flags="sdl1 !mali" function depends_wolf4sdl() { getDepends libsdl1.2-dev libsdl-mixer1.2-dev rename @@ -144,5 +144,5 @@ _EOF_ moveConfigDir "$home/.wolf4sdl" "$md_conf_root/wolf3d" - setDispmanx "$md_id" 1 + isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" } diff --git a/scriptmodules/ports/xrick.sh b/scriptmodules/ports/xrick.sh index 40aa230cf0..11881513fe 100644 --- a/scriptmodules/ports/xrick.sh +++ b/scriptmodules/ports/xrick.sh @@ -15,7 +15,7 @@ rp_module_help="Install the xrick data.zip to $romdir/ports/xrick/data.zip" rp_module_licence="GPL https://raw.githubusercontent.com/RetroPie/xrick/master/README" rp_module_repo="git https://github.com/RetroPie/xrick.git master" rp_module_section="opt" -rp_module_flags="!mali" +rp_module_flags="sdl1 !mali" function depends_xrick() { getDepends libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev zlib1g @@ -43,7 +43,8 @@ function configure_xrick() { [[ "$md_mode" == "remove" ]] && return - isPlatform "kms" && setDispmanx "$md_id" 1 + # set dispmanx by default on rpi with fkms + isPlatform "dispmanx" && ! isPlatform "videocore" && setBackend "$md_id" "dispmanx" ln -sf "$romdir/ports/xrick/data.zip" "$md_inst/data.zip" From 6cb9ff13ecb80779f9c131e444dab8f7a48a9576 Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Wed, 10 Mar 2021 03:57:44 +0000 Subject: [PATCH 07/10] mupen64plus - add sdl2 flag to allow backend configuration --- scriptmodules/emulators/mupen64plus.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scriptmodules/emulators/mupen64plus.sh b/scriptmodules/emulators/mupen64plus.sh index 90ab4e874a..b3e73b7cdd 100644 --- a/scriptmodules/emulators/mupen64plus.sh +++ b/scriptmodules/emulators/mupen64plus.sh @@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .z64 .n64 .v64\n\nCopy your N64 roms to $romdir/ rp_module_licence="GPL2 https://raw.githubusercontent.com/mupen64plus/mupen64plus-core/master/LICENSES" rp_module_repo=":_pkg_info_mupen64plus" rp_module_section="main" -rp_module_flags="" +rp_module_flags="sdl2" function depends_mupen64plus() { local depends=(cmake libsamplerate0-dev libspeexdsp-dev libsdl2-dev libpng-dev libfreetype6-dev fonts-freefont-ttf libboost-filesystem-dev) From 3ae987686b11bd1fd51d8c26eacc71e0e56d8d3c Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Wed, 10 Mar 2021 05:20:21 +0000 Subject: [PATCH 08/10] zesarux - adjust build flags for build for sdl2 apart from on videocore Need to do some testing as to whether it's worth using SDL2 for all platforms - but enabling SDL2 just for kms seems unnecessary - and with sdl2 it should work on mali etc. --- scriptmodules/emulators/zesarux.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scriptmodules/emulators/zesarux.sh b/scriptmodules/emulators/zesarux.sh index fedb177108..aad77932bf 100644 --- a/scriptmodules/emulators/zesarux.sh +++ b/scriptmodules/emulators/zesarux.sh @@ -15,16 +15,16 @@ rp_module_help="ROM Extensions: .sna .szx .z80 .tap .tzx .gz .udi .mgt .img .trd rp_module_licence="GPL3 https://raw.githubusercontent.com/chernandezba/zesarux/master/src/LICENSE" rp_module_repo="git https://github.com/chernandezba/zesarux.git 9.1" rp_module_section="opt" -rp_module_flags="!mali" +rp_module_flags="sdl2 sdl1-videocore" function depends_zesarux() { local depends=(libssl-dev libpthread-stubs0-dev libasound2-dev) isPlatform "x11" && depends+=(libpulse-dev) - if isPlatform "kms"; then - depends+=(libsdl2-dev) - else + if isPlatform "videocore"; then depends+=(libsdl1.2-dev) + else + depends+=(libsdl2-dev) fi getDepends "${depends[@]}" @@ -38,7 +38,7 @@ function build_zesarux() { local params=() isPlatform "videocore" && params+=(--enable-raspberry) ! isPlatform "x11" && params+=(--disable-pulse) - isPlatform "kms" && params+=(--enable-sdl2) + ! isPlatform "videocore" && params+=(--enable-sdl2) cd src ./configure --prefix "$md_inst" "${params[@]}" --enable-ssl @@ -99,7 +99,7 @@ _EOF_ copyDefaultConfig "$config" "$md_conf_root/zxspectrum/.zesaruxrc" rm "$config" - isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" + isPlatform "videocore" && setBackend "$md_id" "dispmanx" addEmulator 1 "$md_id" "zxspectrum" "bash $romdir/zxspectrum/+Start\ ZEsarUX.sh %ROM%" addEmulator 1 "$md_id" "samcoupe" "bash $romdir/zxspectrum/+Start\ ZEsarUX.sh --machine sam %ROM%" From 6a0c5999fb25440a02c9396b348a896b823a01fa Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Mon, 19 Apr 2021 04:03:06 +0100 Subject: [PATCH 09/10] backends / runcommand - add x11-c option for desktop + cursor Adjust logic a bit, and wording in backends menu. Sort optional backends by key --- scriptmodules/supplementary/backends.sh | 9 +++++---- scriptmodules/supplementary/runcommand/runcommand.sh | 11 +++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/scriptmodules/supplementary/backends.sh b/scriptmodules/supplementary/backends.sh index cada44c8d2..fff7dabe6a 100644 --- a/scriptmodules/supplementary/backends.sh +++ b/scriptmodules/supplementary/backends.sh @@ -31,10 +31,10 @@ function _list_backends() { fi local default + local sdl_name="${sdl^^}" if [[ "$sdl" == "sdl1" ]]; then backends["default"]="SDL1 Framebuffer driver" isPlatform "dispmanx" && backends["dispmanx"]="SDL1 DispmanX driver" - backends["x11"]="SDL1 on X11/Desktop" elif [[ "$sdl" == "sdl2" ]]; then if isPlatform "videocore"; then default="SDL2 videocore driver" @@ -42,8 +42,9 @@ function _list_backends() { default="SDL2 KMS driver" fi backends["default"]="$default" - backends["x11"]="SDL2 on X11/Desktop" fi + backends["x11"]="$sdl_name on Desktop" + backends["x11-c"]="$sdl_name on Desktop + Cursor" return 0 } @@ -80,7 +81,7 @@ function gui_backends() { for id in "${__mod_id[@]}"; do valid=0 if rp_isInstalled "$id"; then - if _list_backends "$id"; then + if _list_backends "$id" >/dev/null; then backend="$(_get_current_backends "$id")" options+=("$id" "Using ${backends[$backend]}") fi @@ -106,7 +107,7 @@ function gui_configure_backends() { local selected local backend local flags - for backend in "${!backends[@]}"; do + for backend in $(echo "${!backends[@]}" | xargs -n1 | sort); do selected="" [[ "$current" == "$backend" ]] && selected="(Currently selected)" options+=("$backend" "${backends[$backend]} $selected") diff --git a/scriptmodules/supplementary/runcommand/runcommand.sh b/scriptmodules/supplementary/runcommand/runcommand.sh index 1f1de4ea89..0285924ddc 100755 --- a/scriptmodules/supplementary/runcommand/runcommand.sh +++ b/scriptmodules/supplementary/runcommand/runcommand.sh @@ -947,9 +947,12 @@ echo "Set mode ${MODE_CUR[2]}x${MODE_CUR[3]}@${MODE_CUR[5]}Hz on \$XRANDR_OUTPUT _EOF_ fi - if [[ "$XINIT_WM" -eq 1 ]]; then + if [[ "$XINIT_WM" -gt 0 ]]; then + local params=() + [[ "$XINIT_WM" -eq 1 ]] && params+=(-use_cursor no) + [[ "$XINIT_WM" -eq 2 ]] && params+=(-use_cursor yes) cat >>"$xinitrc" <<_EOF_ -matchbox-window-manager -use_cursor no & +matchbox-window-manager ${params[@]} & sleep 0.5 _EOF_ fi @@ -1056,6 +1059,10 @@ function config_backend() { XINIT=1 XINIT_WM=1 ;; + x11-c) + XINIT=1 + XINIT_WM=2 + ;; esac fi } From c829f32a07774e72293c9b73f45c311023cc5020 Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Sun, 25 Apr 2021 01:30:49 +0100 Subject: [PATCH 10/10] backends - show backend value after description This makes it easier to see which are set to the default. --- scriptmodules/supplementary/backends.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scriptmodules/supplementary/backends.sh b/scriptmodules/supplementary/backends.sh index fff7dabe6a..c2b568c44a 100644 --- a/scriptmodules/supplementary/backends.sh +++ b/scriptmodules/supplementary/backends.sh @@ -83,7 +83,7 @@ function gui_backends() { if rp_isInstalled "$id"; then if _list_backends "$id" >/dev/null; then backend="$(_get_current_backends "$id")" - options+=("$id" "Using ${backends[$backend]}") + options+=("$id" "Using ${backends[$backend]} ($backend)") fi fi done