Refactor more code/code duplication in retroarch.c