[emu] a little bit of cleanup, added getopt, moved a pointer to a ref