Part of https://github.com/hrydgard/ppsspp/pull/5264