shithub: rc

ref: 7fd1655df9afc31dd60db92ebd81b3f479e7d865
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