Skip to content

Commit 24a442c

Browse files
authored
Merge pull request #3845 from cmitu/sdl12-compat-backend
backends: add SDL1.2 Compat backend
2 parents 7f55988 + 9f6e198 commit 24a442c

File tree

12 files changed

+89
-10
lines changed

12 files changed

+89
-10
lines changed

scriptmodules/emulators/atari800.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .a52 .bas .bin .car .xex .atr .xfd .dcm .atr.gz
1515
rp_module_licence="GPL2 https://raw.githubusercontent.com/atari800/atari800/master/COPYING"
1616
rp_module_repo="git https://github.com/atari800/atari800.git ATARI800_5_2_0"
1717
rp_module_section="opt"
18-
rp_module_flags="sdl1 !mali"
18+
rp_module_flags="sdl1"
1919

2020
function depends_atari800() {
2121
local depends=(libsdl1.2-dev autoconf automake zlib1g-dev libpng-dev)
@@ -94,6 +94,9 @@ function configure_atari800() {
9494
# if we are on fkms, use the sdl1 dispmanx backend by default for good performance without using X11/opengl
9595
isPlatform kms && isPlatform "dispmanx" && _backend_set_atari800 "dispmanx"
9696

97+
# when no dispmanx is available, but still on KMS, use 'sdl12-compat' and go through SDL2
98+
isPlatform "kms" && ! isPlatform "dispmanx" _&& _backend_set_atari800 "sdl12-compat"
99+
97100
# this is split out so we can call it via _backend_set_atari800
98101
_add_emulators_atari800
99102
addSystem "atari800"

scriptmodules/emulators/capricerpi.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .cdt .cpc .dsk\n\nCopy your Amstrad CPC games to
1515
rp_module_licence="GPL2 https://raw.githubusercontent.com/KaosOverride/CapriceRPI/master/COPYING.txt"
1616
rp_module_repo="git https://github.com/KaosOverride/CapriceRPI.git master"
1717
rp_module_section="opt"
18-
rp_module_flags="sdl1 !all videocore"
18+
rp_module_flags="sdl1"
1919

2020
function depends_capricerpi() {
2121
getDepends libsdl1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev zlib1g-dev libpng-dev
@@ -44,4 +44,8 @@ function configure_capricerpi() {
4444

4545
addEmulator 0 "$md_id" "amstradcpc" "$md_inst/capriceRPI %ROM%"
4646
addSystem "amstradcpc"
47+
48+
[[ $mode == "remove" ]] && return
49+
# use sdl12-compat backend on KMS
50+
! isPlatform "dispmanx" && isPlatform "kms" && setBackend "$md_id" "sdl12-compat"
4751
}

scriptmodules/emulators/fbzx.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .sna .szx .z80 .tap .tzx .gz .udi .mgt .img .trd
1515
rp_module_licence="GPL3 https://raw.githubusercontent.com/rastersoft/fbzx/master/COPYING"
1616
rp_module_repo="git https://github.com/rastersoft/fbzx :_get_branch_fbzx"
1717
rp_module_section="opt"
18-
rp_module_flags="sdl1 !mali !kms"
18+
rp_module_flags="sdl1"
1919

2020
function _get_branch_fbzx() {
2121
local branch
@@ -55,4 +55,6 @@ function configure_fbzx() {
5555

5656
addEmulator 0 "$md_id" "zxspectrum" "pushd $md_inst/share; $md_inst/bin/fbzx -fs %ROM%; popd"
5757
addSystem "zxspectrum"
58+
59+
! isPlatform "dispmanx" && isPlatform "kms" && setBackend "$md_id" "sdl12-compat"
5860
}

scriptmodules/emulators/fuse.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ function configure_fuse() {
6363
# default to dispmanx backend
6464
isPlatform "dispmanx" && _backend_set_fuse "dispmanx"
6565

66+
# without dispmanx, but with KMS, then use sdl12-compat
67+
! isPlatform "dispmanx" && isPlatform "kms" && _backend_set_fuse "sdl12-compat"
68+
6669
local script="$romdir/zxspectrum/+Start Fuse.sh"
6770
cat > "$script" << _EOF_
6871
#!/bin/bash

scriptmodules/emulators/linapple.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ function configure_linapple() {
6060
done
6161

6262
isPlatform "dispmanx" && setBackend "$md_id" "dispmanx"
63+
! isPlatform "dispmanx" && isPlatform "kms" && setBackend "$md_id" "sdl12-compat"
6364

6465
mkUserDir "$md_conf_root/apple2"
6566
moveConfigDir "$home/.linapple" "$md_conf_root/apple2"

scriptmodules/emulators/osmose.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rp_module_help="ROM Extensions: .bin .gg .sms .zip\nCopy your Game Gear roms to
1515
rp_module_licence="GPL2 https://raw.githubusercontent.com/RetroPie/osmose-rpi/master/license.txt"
1616
rp_module_repo="git https://github.com/RetroPie/osmose-rpi.git master"
1717
rp_module_section="opt"
18-
rp_module_flags="!mali !kms"
18+
rp_module_flags="!mali sdl1"
1919

2020
function depends_osmose() {
2121
getDepends libsdl1.2-dev
@@ -48,4 +48,6 @@ function configure_osmose() {
4848
addEmulator 0 "$md_id" "mastersystem" "$md_inst/osmose %ROM% -tv -fs"
4949
addSystem "gamegear"
5050
addSystem "mastersystem"
51+
52+
[[ $mode == "configure" ]] && isPlatform "kms" && setBackend "$md_id" "sdl12-compat"
5153
}

scriptmodules/ports/openbor.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ function configure_openbor() {
4848

4949
mkRomDir "ports/$md_id"
5050
isPlatform "dispmanx" && setBackend "$md_id" "dispmanx"
51+
! isPlatform "dispmanx" && isPlatform "kms" && setBackend "$md_id" "sdl12-compat"
5152

5253
cat >"$md_inst/openbor.sh" << _EOF_
5354
#!/bin/bash

scriptmodules/ports/xrick.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rp_module_help="Install the xrick data.zip to $romdir/ports/xrick/data.zip"
1515
rp_module_licence="GPL https://raw.githubusercontent.com/RetroPie/xrick/master/README"
1616
rp_module_repo="git https://github.com/RetroPie/xrick.git master"
1717
rp_module_section="opt"
18-
rp_module_flags="sdl1 !mali"
18+
rp_module_flags="sdl1"
1919

2020
function depends_xrick() {
2121
getDepends libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev zlib1g
@@ -43,14 +43,15 @@ function configure_xrick() {
4343

4444
[[ "$md_mode" == "remove" ]] && return
4545

46+
ln -sf "$romdir/ports/xrick/data.zip" "$md_inst/data.zip"
4647
# set dispmanx by default on rpi with fkms
4748
isPlatform "dispmanx" && ! isPlatform "videocore" && setBackend "$md_id" "dispmanx"
48-
49-
ln -sf "$romdir/ports/xrick/data.zip" "$md_inst/data.zip"
49+
# on KMS and without dispmanx, use sdl12-compat
50+
! isPlatform "dispmanx" && isPlatform "kms" && setBackend "$md_id" "sdl12-compat"
5051

5152
local file="$md_inst/xrick.sh"
5253
cat >"$file" << _EOF_
53-
#!/bin/bash
54+
#!/usr/bin/env bash
5455
pushd "$md_inst"
5556
./xrick "\$@"
5657
popd

scriptmodules/supplementary/backends.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ function _list_backends() {
1818
local id="$1"
1919
backends=()
2020

21+
# skip the 'depends' packages
22+
[[ ${__mod_info[$id/section]} == "depends" ]] && return 1
23+
2124
local flags="${__mod_info[$id/flags]}"
2225
local sdl
2326
if isPlatform "videocore" && hasFlag "$flags" "sdl1-videocore"; then
@@ -35,6 +38,7 @@ function _list_backends() {
3538
if [[ "$sdl" == "sdl1" ]]; then
3639
backends["default"]="SDL1 Framebuffer driver"
3740
isPlatform "dispmanx" && backends["dispmanx"]="SDL1 DispmanX driver"
41+
isPlatform "kms" && ! isPlatform "dispmanx" && backends["sdl12-compat"]="SDL1 Compat driver"
3842
elif [[ "$sdl" == "sdl2" ]]; then
3943
if isPlatform "videocore"; then
4044
default="SDL2 videocore driver"
@@ -109,6 +113,9 @@ function gui_configure_backends() {
109113
continue
110114
fi
111115
fi
116+
if [[ "$choice" == "sdl12-compat" ]] && ! rp_isInstalled "sdl12-compat"; then
117+
rp_callModule "sdl12-compat" _auto_
118+
fi
112119
local func="_backend_set_$id"
113120
if fnExists "$func"; then
114121
rp_callModule "$id" _backend_set "$choice" 1

scriptmodules/supplementary/runcommand/runcommand.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,9 @@ function config_backend() {
10621062
fi
10631063
COMMAND="SDL1_VIDEODRIVER=dispmanx $COMMAND"
10641064
;;
1065+
sdl12-compat)
1066+
COMMAND="LD_PRELOAD=\"$ROOTDIR/supplementary/sdl12-compat/libSDL-1.2.so.0\" $COMMAND"
1067+
;;
10651068
x11)
10661069
XINIT=1
10671070
XINIT_WM=1

0 commit comments

Comments
 (0)