#!/usr/bin/env bash # Launch the built DOS example in DOSBox. Defaults to PATTERN. # # scripts/run-dos.sh # runs PATTERN # scripts/run-dos.sh hello # runs HELLO # scripts/run-dos.sh keys # runs KEYS set -euo pipefail prog=${1:-pattern} repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) bin_dir=$repo/build/dos/bin case $prog in hello) file=HELLO.EXE ;; pattern) file=PATTERN.EXE ;; keys) file=KEYS.EXE ;; joy) file=JOY.EXE ;; sprite) file=SPRITE.EXE ;; audio) file=AUDIO.EXE ;; *) echo "usage: $0 [hello|pattern|keys|joy|sprite|audio]" >&2; exit 2 ;; esac if [[ ! -f "$bin_dir/$file" ]]; then echo "$bin_dir/$file not built. Run 'make dos' first." >&2 exit 1 fi # mouse_capture=seamless is required for DOSBox-Staging when running # inside a VM whose host already manages the pointer; without it the # default capture-on-click behavior fights the VM's grab and mouse # input is unusable. On plain DOSBox this -set flag is unknown and is # logged once as a warning, then ignored -- harmless either way. exec dosbox \ -set "mouse_capture=seamless" \ -c "C:" \ -c "$file" \ -c "pause" \ --exit "$bin_dir"