Fix for black screen on Linux upon starting a game

Depends on @magcius's branch to be merged.
Once your branch is pushed I will rebase to fix conflicts.