Move more stuff to emu.lua, broke rendering