From 68a36cec9df29786062fe83bcdc11732ce4f52ac Mon Sep 17 00:00:00 2001 From: BetaRays Date: Thu, 18 Apr 2019 15:41:31 +0200 Subject: [PATCH] Allow using per-game and global dosbox config --- play.it-2/src/30_launchers.sh | 2 ++ play.it-2/src/30_launchers_dosbox.sh | 25 ++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/play.it-2/src/30_launchers.sh b/play.it-2/src/30_launchers.sh index 5d22f1ce..8fb2ace1 100644 --- a/play.it-2/src/30_launchers.sh +++ b/play.it-2/src/30_launchers.sh @@ -55,12 +55,14 @@ launcher_write_script() { launcher_write_script_headers "$target_file" case "$application_type" in ('dosbox') + CONFIG_FILES="$CONFIG_FILES dosbox.conf" launcher_write_script_dosbox_application_variables "$application" "$target_file" launcher_write_script_game_variables "$target_file" launcher_write_script_user_files "$target_file" launcher_write_script_prefix_variables "$target_file" launcher_write_script_prefix_functions "$target_file" launcher_write_script_prefix_build "$target_file" + launcher_write_script_dosbox_generate_config "$target_file" launcher_write_script_dosbox_run "$application" "$target_file" ;; ('java') diff --git a/play.it-2/src/30_launchers_dosbox.sh b/play.it-2/src/30_launchers_dosbox.sh index d1221d79..7e29a0ec 100644 --- a/play.it-2/src/30_launchers_dosbox.sh +++ b/play.it-2/src/30_launchers_dosbox.sh @@ -26,6 +26,29 @@ launcher_write_script_dosbox_application_variables() { return 0 } +# DOSBox - generate the play.it config file if missing +# USAGE: launcher_write_script_dosbox_generate_config $file +# NEEDED_VARS: GAME_IMAGE GAME_IMAGE_TYPE PACKAGES_LIST PATH_GAME +# CALLED BY: launcher_write_script +launcher_write_script_dosbox_generate_config() { + # parse arguments + local file + file="$1" + + cat >> "$file" <<- 'EOFEOF' + # Generate the play.it config file if missing + [ -d "$HOME/.dosbox" ] || mkdir "$HOME/.dosbox" + if [ ! -f "$HOME/.dosbox/play.it.conf" ]; then + cat >> "$HOME/.dosbox/play.it.conf" <<- 'EOF' + [sdl] + output=overlay + #fullscreen=true # enable this if you want fullscreen by default + fullresolution=desktop # makes dosbox use the right screen resolution in fullscreen: BROKEN FOR >1 SCREEN, use your smallest used resolution instead + EOF + fi + + EOFEOF +} # DOSBox - run the game # USAGE: launcher_write_script_dosbox_run $application $file # NEEDED_VARS: GAME_IMAGE GAME_IMAGE_TYPE PACKAGES_LIST PATH_GAME @@ -42,7 +65,7 @@ launcher_write_script_dosbox_run() { # Run the game cd "$PATH_PREFIX" - dosbox -c "mount c . + dosbox -userconf -conf ~/.dosbox/play.it.conf -conf dosbox.conf -c "mount c . c: EOF -- GitLab