Refactor rarch_take_screenshot