shithub: rc

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