shithub: rc

ref: 5e6bd6f2655721469ef462d7bcbb39014b8bb727
dir: rc/nesj

View raw version
#!/bin/rc

n=`{sed -n '/ep.\.0/h;${g;s/^(ep.\.0).*/\1/p;}' /dev/usb/ctl}
while(~ $1 -?){
	switch($1){
	case -k	# just make /sys/src/9/boot/nusbrc do nothing if it sees your
		# device instead
		p=`{ps | sed -n '/ kb$/h;${g;s/^[^ ]+ +([0-9]+) .*/\1/p;}'}
		echo kill >/proc/$p/note
		wait $p
	case -n
		n=ep$2.0
		shift
	}
	shift
}

echo resize -dx 776 -dy 728 >/dev/wctl
nusb/joy /dev/usb/$n | joynes 1 | games/nes -a3 $*
# press Kdel again to kill nusb/joy...