#!/bin/bash
### BEGIN BOOT SCRIPT INFO
#Long-Name: em1900
### END BOOT SCRIPT INFO
### BEGIN BOOT SCRIPT INSTALLATION DEFAULTS
#Launch-Mode: gui-only
### END BOOT SCRIPT INSTALLATION DEFAULTS
#
#This script uses a standard run scriptlet (RUN_EM1900). Before calling
#run_em1900 with the appropriate options, $EM1900_MACHINE should be set to the
#machine name (the base name of the emulator in bin/ without the .exe
#extension).
#
#This will automatically launch bin/tw7071.exe for a 1904s configuration.
#
#See icl1900/SUPPORT/README.TXT for more information on the directory structure
#expected by the emulator (this script doesn't use the shortcuts, so it doesn't
#matter where the emulator directory is located).

. bootscriptfunctions.sh

run_em1900()
{
	wine_setup
	if [ ! "$EM1900_MACHINE" ]
	then
		echo "EM1900_MACHINE unset" >&2
		exit 1
	fi
	if [ "$EM1900_MACHINE" == 1904s ]
	then
		tw7071_path=`winepath -w "$PWD/bin/tw7071.exe"`
		(sleep 10; wineconsole "$tw7071_path" localhost 10001 1 2) &
	fi
	exec_emu wineconsole bin/"${EM1900_MACHINE}.exe" "$@"
}

call_run_scriptlet em1900
