#!/bin/sh
# tools/mgba-gba <script.lua> <rom> [timeout s]: our mGBA (mgba-cw.nix: + the fake Mobile Adapter,
# cw_mobile.c, + mgba.patch), headless, a Lua script as the test's eyes, paced to real time
# (CW_REALTIME=0: unthrottled). The fake Mobile Adapter is on the link port when CW_MOBILE_DIR is
# set. The script ends the run with os.exit(code). (consoles/gba/emu/mgba/mgba-gba, as a process.)
export CW_REALTIME="${CW_REALTIME-1}"
exec timeout "${3:-120}" "${MGBA_HEADLESS:-mgba-headless}" -l "${CW_LOG_LEVEL:-15}" --script "$1" "$2"
