Port of https://github.com/yuzu-emu/yuzu/pull/12100. Co-authored-by: Charles Lombardo <clombardo169@gmail.com>