News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

Compiling for MAC

Started by prissi, August 04, 2008, 09:36:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

prissi

I had on my PowerMAC emulator a try to compile allegro and simutrans for Allegro. I worked quite nice, much faster imho than with SDL. Also it should be able to use sound and midis (which crash my emulator). It could be even bundled to a simple one click install. Maybe Allegro (http://www.liballeg.org) is another good way to go for MAC.

topchrisher

I will investigate this as quickly as possible, which means that in six months there will be a result.  And I'm only half-kidding.

leopard

on the assumption I can get it to compile as part of the game I've sort of got an apple native midi routine running, expanding this to wave audio is theoretically pretty simple. just having fun mixing objective-c and c++ currently.

not given up but will almost certainly end up back on the command line

:-)
My Simutrans on the apple mac homepage http://www.aleopardstail.com/simutrans/Index.html

leopard

Now have managed to get my little objective-c MIDI playing routine functioning, using the quicktime library. the quality is much better than the SDL MIDI routine.

compile problem solved by changing the file name from *.m to *.mm, go figure (something about the difference between c and c++).

there are still a few compile warnings I want to eliminate, and it needs fully testing but it works.

then the wave audio engine, which will be basically the same functions.

not got a clue how to integrate this into the main source, and don't want access, since I will break something, but once its tested the *.m file and the required linker flags will get posted somewhere for general review

:-)

My Simutrans on the apple mac homepage http://www.aleopardstail.com/simutrans/Index.html

topchrisher

I'm not really sure what this is about - is it compiling without Allegro or SDL?  Or is it about moving to Allegro?  Please explain!

leopard

well its still using SDL for the display, and using apple native libraries for sound, in this case QuickTime driving core audio & core audio midi (indirectly).

looking at porting SDL to work in a cocoa window, and eventually direct drawing (maybe)
My Simutrans on the apple mac homepage http://www.aleopardstail.com/simutrans/Index.html

leopard

Ok this is a test binary, should work on a normal intel mac (this is not universal). based on 100.01.19.

this should only require the normal frameworks as opposed to anything "funny" on my own system.

been looking at how to make this 'mac native' in so far as double clickable from within finder, apparently this binary can be put into an application bundle, along with an info file and it should "just work". I just need to sort out how to write the info file to see if thats actually true.

if it is then compiling a PPC version for the same bundle is possible.

but if someone with an intel mac can see if this works, and if they get midi files to play then I know my build process is working.

http://www.aleopardstail.com/res/sim-100.01-1930.zip 150k Zip file
My Simutrans on the apple mac homepage http://www.aleopardstail.com/simutrans/Index.html

prissi

Direct Drawing may not really help you speedwise. Quicktime windows will be fast enough, looking at OpenTTD code. Simutrans is just a big bitmap, that is copied to the screen.

The most tedious part will be the event catching a distributing on MAC imho.

EDIT: wow, this was fast. Do you have the diff for this?

leopard

diff?

not as yet, the source isn't fully error trapped as yet, also my makefiles etc have been butchered slightly, if this works what I plan to do is download a new 'clean' nightly, and merge my changes with that, so you don't get all the rubbish.

the binary has my midi & wave audio code included, but otherwise no changes
My Simutrans on the apple mac homepage http://www.aleopardstail.com/simutrans/Index.html

Ashley

Do svn diff > somefile.diff from within the repository root on your local machine.
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

leopard

I think I may have this right, least I hope I have.

attached are the diff file which will (I think) adjust:
- common.mk (To add the support for objective-c files)
- makefile (adding a section for a cocoa backend)
- config.template (to add the cocoa backend option)

in addition there are two new files, which add the sound support
core-audio_sound.mm --> /sound
core-audio_midi.mm --> /music

the audio routines are not fully error trapped as yet, but they work here, will be very interested to see if they work for other people. these files will be updated as I get more testing done.

for people used to c++ and c these files may look a tad odd, but thats objective-c for you.

the cocoa backend current uses SDL for everything except audio, I will at some point try to change this.
My Simutrans on the apple mac homepage http://www.aleopardstail.com/simutrans/Index.html

leopard

if this doesn't work, let me know and I'll try to upload the actual makefile etc. not used to diff but this appears to be right.
My Simutrans on the apple mac homepage http://www.aleopardstail.com/simutrans/Index.html

prissi

Commited your changes (after some Makefile editing) to the trunk. Instead of cocoa it is still sdl as backend, together with mac. Please test the makefile.