shithub: rc

ref: 227f873058da9b5c099b6fde577d8980bad7364a
dir: /bin/pemu/

View raw version
#!/bin/rc
rfork n
if(~ $#* 0){
	echo usage: $0 '[-j ep]' rom.ext >[1=2]
	exit usage
}
if(~ $1 -j){
	j=$1
	shift
}
if not
	j=`{sed -n '/^ep[0-9]+\.0/h;${g;s/^ep([0-9]+)\.0.*/\1/p;}' /dev/usb/ctl}
ext=`{echo $1 | sed 's/.*\.([^\.]+)$/\1/'}
switch($ext){
case 2600 gb gbc gba md nes snes
	e=$ext
case smc
	e=snes
case bin
	if(~ `{file $1} *SEGA*)
		e=md
	if not
		e=2600
case *
	echo unknown rom type >[1=2]
	exit usage
}
exec $e -j $j $1