OpenSWE1R / openswe1r

An Open-Source port of the 1999 Game "Star Wars Episode 1: Racer"
https://openswe1r.github.io/
GNU General Public License v2.0
315 stars 26 forks source link

Work towards portability #75

Closed JayFoxRox closed 6 years ago

JayFoxRox commented 6 years ago

Work on portability to attract more developers.

First, this adds include guards to the common.h header

Then it replaces replaces memalign with a custom function (as suggested in #52 ). A solution for win32 and posix is provided. Better conditional checking is possible, but for now, the posix fallback should be fine. The naming for this function is very unfortunate. It's very similar to the Win32 function, but I only noticed this after writing the posix version. To make matters worse, the order of the parameters for the Win32 function is swapped.

Lastly, this replaces the existing timer code with SDL timer functions. I've added the SDL calls directly in the code, without abstraction. Wether we replace SDL by another platform abstraction (possibly our own as a stable interface) in the future, could be discussed. However, for now, this should be fine as SDL and Unicorn are considered stable interfaces for most things.

A second SDL related commit also replaces usleep with SDL_Delay.

(If nobody vetos this within a day or so, it will get merged)