#!/bin/bash # Produce a per-instruction V30 trace of R-Type from MAME 0.285. # usage: scripts/mame/trace_rtype.sh [start-frame] [stop-frame] # Output: /error.log (register lines) and trace_disasm.txt. # ROMs are read in place from the MAME set directory; nothing is copied. # See docs/mame-oracle.md for what the output means and how fast it grows. set -euo pipefail out=${1:?output directory}; start=${2:-0}; stop=${3:-60} mame=${MAME:-/usr/games/mame} rompath="${ROMPATH:-${MAME_ROMPATH:?set MAME_ROMPATH (or ROMPATH) to the MAME non-merged ROM folder}}" here=$(cd "$(dirname "$0")" && pwd) mkdir -p "$out/cfg" "$out/nvram" cd "$out" TRACE_START_FRAME=$start TRACE_STOP_FRAME=$stop TRACE_DISASM_FILE=trace_disasm.txt \ "$mame" rtype -rompath "$rompath" -homepath "$out" \ -cfg_directory "$out/cfg" -nvram_directory "$out/nvram" \ -video none -sound none -nothrottle -noreadconfig -skip_gameinfo \ -debug -debugger none -log -autoboot_script "$here/trace_rtype.lua" 2>&1 | grep -v '^ALSA' || true wc -l "$out/error.log" "$out/trace_disasm.txt"