#1 Port to Windows done.

open
None
5
2010-05-23
2010-01-23
Carlo Bramini
No

I ported Asteroids3D to Windows platform.
I compiled it successfully under mingw+msys, cygwin+XWin and with Microsoft visual Studio Express.
Here there is the listing of all my changes.

Makefile.am
* The LDADD field is replaced with something constructed into the configure script.
* Added $(srcdir) to gamedata_DATA othewise the installation will fail if configuration has been done outside the source tree.

configure.ac
* Added AC_CANONICAL_SYSTEM for detecting system type; it is required for constructing the right LDADD flags; mingw needs its right flags but it will be useful for other platforms too if required.
* Checked the presence of some header files.
* Checked the presence of strsep() function (it's missing in mingw).

src/asteroid.c
src/calc_frame.c
src/collision.c
src/debug.c
src/display.c
src/explosion.c
src/hud.c
src/light.c
src/main.c
src/oglutils.c
src/pause.c
src/shield.c
src/split.c
src/sun.c
src/thrust.c
src/torpedo.c
src/view.c
* moved include files into asteroids3D.h

src/asteroids3D.h
* moved various include files here, plus a specific space for Windows. For example, many (all?) sources include gl/gl.h or gl/glut.h, but under Windows these files require that windows.h is included first. Some include files are also not available, while you may need to include also others. I believe that the best solution is to move all complexity here instead of patching with a copy-paste all source codes.

src/rcfile.c
* moved include files into asteroids3D.h
* if $HOME variable is undefined, the game will crash badly. This will normally happen on Windows if the error condition is not detected. So, if $HOME is undefined, we will point to the current directory.

src/score.c
* moved include files into asteroids3D.h
* the empty declaration of score_entry array is supported by GCC, but not by MSVC. I would suggest to simply memset() this array when required.
* added replacement for strsep() if it's missing.

src/sound.c
* moved include files into asteroids3D.h; some extra include files are conditioned by autotools results.
* Added support for sound under windows, so I renamed init_oss_sound_device() to a more generic init_sound_device(). Next I added functions is_audio_ready() and write_audio_data() for feeding sounds to the stream (it replaces the simple write() call).

src/target.c
* moved include files into asteroids3D.h
* Fixed empty declaration of target[] vector.

src/texture.c
* moved include files into asteroids3D.h
* Added alternative support if mmap capabilities are not available.

I hope this could be used for releasing a new version with Windows support.
Sincerely,

Carlo Bramini.

Discussion

  • Carlo Bramini
    Carlo Bramini
    2010-01-23

    Patch for Windows support.

     
    Attachments
  • Jan Engelhardt
    Jan Engelhardt
    2010-05-23

    I noticed this a little late... :-)

    Git-style chopping up is preferred over singular huge patches, though.

     
  • Jan Engelhardt
    Jan Engelhardt
    2010-05-23

    • assigned_to: nobody --> jengelh