Port to Pandora.

Thanks to ptitSeb.

Tested Linux SDL and it still works after the changes.
Unable to test Pandora but the original diff worked for ptitSeb so hopefully this does too.