From b59cb28766ab19d6b1899e87b416e9712f05b06c Mon Sep 17 00:00:00 2001 From: cmitu <31816814+cmitu@users.noreply.github.com> Date: Fri, 9 Feb 2024 04:40:21 +0000 Subject: [PATCH] dolphin: updates to build and configuration Modified the module to update the dependencies and improve the initial configuration * Build changes: - build dependencies modified to include SDL2. Latest version (as of Jan 2024) enable SDL2 by default on Linux and use it for input auto-configuration. Gamepads detected using SDL's GameController API are automatically configred based on their mappings. - disable analytics and update support durign the build. Updates are handled by RetroPie-Setup and - unfortunately - analytics require a keyboard/mouse to get over the initial agreement pop-up that is presented to the user on the 1st run. * Configuration updates: - on KMS systems, start Dolphin via X11 by using the `XINIT-WM` launc prefix, which instructs `runcommand` to start a minimal desktop env. - change the location of the configuration folder, since now Dolphin follows the XDG specs and uses `$XDG_CONFIG_HOME` to store its settings. It will not affect existing installations, since we symlink-it to the configuration folder anyway and Dolphin will look in the previous location first. - pre-set a few initial configuration options in the main `Dolphin.ini` configuration file, upating existing options - add a new pre-set for the graphics backend configuration file in `GFX.ini` to switch to GLES3 on platforms where it is available. It should help the Pi5 but also other SBCs we support (i.e. OrangePi5 / RK3399) to startw the correct rendering backend. - set the '-gui' variant as default. Since the 'nogui' doesn't seem to read the configuration files correctly (i.e. no Fullscreen or Hotkeys are working), use the main program started with '--batch' to run a game --- scriptmodules/emulators/dolphin.sh | 49 ++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/scriptmodules/emulators/dolphin.sh b/scriptmodules/emulators/dolphin.sh index 089d533f31..886e14d952 100644 --- a/scriptmodules/emulators/dolphin.sh +++ b/scriptmodules/emulators/dolphin.sh @@ -48,6 +48,12 @@ function depends_dolphin() { else depends+=(qtbase5-private-dev) fi + # on KMS use x11 to start the emulator + isPlatform "kms" && depends+=(xorg matchbox-window-manager) + + # if using the latest version, add SDL2 as dependency, since it's mandatory + [[ "$(_get_commit_dolphin)" == "" ]] && depends+=(libsdl2-dev) + getDepends "${depends[@]}" } @@ -58,8 +64,8 @@ function sources_dolphin() { function build_dolphin() { mkdir build cd build - # use the bundled 'speexdsp' libs, distro versions before 1.2.1 produce a 'cmake' error - cmake .. -DBUNDLE_SPEEX=ON -DCMAKE_INSTALL_PREFIX="$md_inst" + # use the bundled 'speexdsp' libs, distro versions before 1.2.1 trigger a 'cmake' error + cmake .. -DBUNDLE_SPEEX=ON -DENABLE_AUTOUPDATE=OFF -DENABLE_ANALYTICS=OFF -DUSE_DISCORD_PRESENCE=OFF -DCMAKE_INSTALL_PREFIX="$md_inst" make clean make md_ret_require="$md_build/build/Binaries/dolphin-emu" @@ -74,23 +80,40 @@ function configure_dolphin() { mkRomDir "gc" mkRomDir "wii" - moveConfigDir "$home/.dolphin-emu" "$md_conf_root/gc" + local launch_prefix + isPlatform "kms" && launch_prefix="XINIT-WM:" + + addEmulator 0 "$md_id" "gc" "$launch_prefix$md_inst/bin/dolphin-emu-nogui -e %ROM%" + addEmulator 1 "$md_id-gui" "gc" "$launch_prefix$md_inst/bin/dolphin-emu -b -e %ROM%" + addEmulator 0 "$md_id" "wii" "$launch_prefix$md_inst/bin/dolphin-emu-nogui -e %ROM%" + addEmulator 1 "$md_id-gui" "wii" "$launch_prefix$md_inst/bin/dolphin-emu -b -e %ROM%" + + addSystem "gc" + addSystem "wii" + [[ "$md_mode" == "remove" ]] && return + + moveConfigDir "$home/.config/dolphin-emu" "$md_conf_root/gc/Config" + mkUserDir "$md_conf_root/gc/Config" + # preset a few options on a first installation if [[ ! -f "$md_conf_root/gc/Config/Dolphin.ini" ]]; then - mkdir -p "$md_conf_root/gc/Config" cat >"$md_conf_root/gc/Config/Dolphin.ini" <<_EOF_ [Display] -FullscreenResolution = Auto +FullscreenDisplayRes = Auto Fullscreen = True +RenderToMain = True +KeepWindowOnTop = True +[Interface] +ConfirmStop = False _EOF_ - chown -R $user:$user "$md_conf_root/gc/Config" + fi + # use the GLES(3) render path on platforms where it's available + if [[ ! -f "$md_conf_root/gc/Config/GFX.ini" ]] && isPlatform "gles3"; then + cat >"$md_conf_root/gc/Config/GFX.ini" <<_EOF2_ +[Settings] +PreferGLES = True +_EOF2_ fi - addEmulator 1 "$md_id" "gc" "$md_inst/bin/dolphin-emu-nogui -e %ROM%" - addEmulator 0 "$md_id-gui" "gc" "$md_inst/bin/dolphin-emu -b -e %ROM%" - addEmulator 1 "$md_id" "wii" "$md_inst/bin/dolphin-emu-nogui -e %ROM%" - addEmulator 0 "$md_id-gui" "wii" "$md_inst/bin/dolphin-emu -b -e %ROM%" - - addSystem "gc" - addSystem "wii" + chown -R $user:$user "$md_conf_root/gc/Config" }