Mac OS X: Patch/add-on to make MIDI music work

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Post Reply
jking_ok
Engineer
Engineer
Posts: 6
Joined: 25 Apr 2004 08:22
Location: Perth, Australia
Contact:

Mac OS X: Patch/add-on to make MIDI music work

Post by jking_ok »

So I've downloaded the v0.3 Mac OS X binary and am very impressed (I'm supposed to be studying though :P).

I've made a little hack this afternoon that allows me to use the music features of OpenTTD under Mac OS X and I share this with you here. Note that I have Mac OS X 10.3.3 (Panther) and this comes under the category of being a little messy. (You'll probably need at least Jaguar and the Java 1.4 update).

Basically, I've fooled my Mac into using the (handy) extmidi module for the Linux port.

There are two files in the hack, and no OpenTTD changes are needed (which is handy), and they are attached.

I have a shell script called 'timidity' which uses features of Bash to run a Java program which plays the MIDI files (note that the .gm files are simply MIDI files renamed - QuickTime and iTunes both recognise them *after* they have been renamed to .mid).

You need to put the script "timidity" into your /usr/bin folder, along with OpenTTDMidi.class, and make sure it is executable (you'll probably have to sudo to get access).

Then make sure the .gm TT files are in a gm folder inside the Open Transport Tycoon folder (created by the OpenTTD binary).

Then, to run OpenTTD, open a Terminal and change to the Open Transport Tycoon folder and type "Open\ Transport\ Tycoon.app\Contents\MacOS\ttd -m extmidi" and OpenTTD should pick up the music.

Let me know how it goes -- if it works for others I might post a .pkg installer file to automatically handle the installing.

Happy transporting.

Joshua King
Attachments
midi-patch.zip
Files for patch (readme and source included)
(2.36 KiB) Downloaded 162 times
jking_ok
Engineer
Engineer
Posts: 6
Joined: 25 Apr 2004 08:22
Location: Perth, Australia
Contact:

Fixing missing attachment

Post by jking_ok »

Sorry, Safari is not working for me, so I'll try to upload this attachment again.

If it doesn't work this time, I'll put a link on my web site at http://www.geocities.com/jking_ok

Joshua King[/url]
Attachments
midi-patch.zip
The files (including readme and source) for this simple patch.
(2.36 KiB) Downloaded 165 times
jking_ok
Engineer
Engineer
Posts: 6
Joined: 25 Apr 2004 08:22
Location: Perth, Australia
Contact:

Installer version

Post by jking_ok »

OK so I have an installer version now, just double-click it and install it (you'll need an administrator password).

Then run OpenTTD with the following command:

Code: Select all

Open\ Transport\ Tycoon.app/Contents/MacOS/ttd -m extmidi
in a Terminal window from your "Open Transport Tycoon" folder.

Problem: Forum (and my website) don't support .dmg files so the package is in a disk image inside a zip file.

PS. The forum is reporting 0 bytes for the lengths of my attachments - I tested the one above and it downloaded okay.

Joshua King
Attachments
openttd-midi-patch.dmg.zip
Installer version of above patch - double-click to extract, double-click on openttd-midi-patch.dmg to mount drive (Stuffit Expander will do this for you, Finder won't), double-click on the package icon in the new drive and follow the instructions. Then ru
(7.86 KiB) Downloaded 240 times
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

Nice job
I will include it in the svn and next release if you agree on that (I guess you do :wink: )

I modified it a bit, so it doesn't look for timidity in /usr/bin, but in a midi_driver folder in the TTD dir. This way, it works for people, who haven't got root access

I will fix it so midi is used when the app is doubleclicked soon
xbastianx
Engineer
Engineer
Posts: 2
Joined: 12 Apr 2004 16:21
Contact:

Post by xbastianx »

Code: Select all

Error: No available language packs
ttd.c:71: failed assertion `0'
Abort trap
Bastians-Powerbook:~ xbastianx$ 
got this error ... without extmidi it's running perfectly
Last edited by xbastianx on 25 Apr 2004 10:51, edited 2 times in total.
jking_ok
Engineer
Engineer
Posts: 6
Joined: 25 Apr 2004 08:22
Location: Perth, Australia
Contact:

Add to subversion? yes

Post by jking_ok »

You're welcome to apply it in whatever way works best - I just applied it to /usr/bin because I was too lazy to work out how to download the source.

I'm testing it now, it works fine so far, only track 11 (the alien one) has a long period of silence in it - could be my copy of the file, I'll look into it.

Joshua King
jking_ok
Engineer
Engineer
Posts: 6
Joined: 25 Apr 2004 08:22
Location: Perth, Australia
Contact:

Post by jking_ok »

xbastianx wrote:Error: No available language packs
You get this error if you're in the wrong directory when you load ttd.

It appears that ttd wants the current directory to have all the data files in it, but the program itself is NOT in that directory in order to make it double-clickable.

You have to a 'cd' before the command I posted. For example, if OpenTTD was installed into Applications, do

Code: Select all

cd /Applications/Open\ Transport\ Tycoon
and then,

Code: Select all

Open\ Transport\ Tycoon.app/Contents/MacOS/ttd -m extmidi
The forward slashes and the single space that follows them is important.

I'm told (read above) that you'll be able to double-click the next version of the game rather than do this.

Joshua King
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

it's in 0.3.1
you can't see the files because they are inside the app and it should use it by default when you doubleclick on it
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

jking_ok wrote:

Code: Select all

cd /Applications/Open\ Transport\ Tycoon

Code: Select all

Open\ Transport\ Tycoon.app/Contents/MacOS/ttd -m extmidi
The forward slashes and the single space that follows them is important.
*BLAM*
The forward slashes up there do not have spaces after them.
'\' is a BACKslash
'/' is a [FRONT|FORWARD] slash
The distinction is a subtle one, but vital.
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

DaleStan wrote:
jking_ok wrote:

Code: Select all

cd /Applications/Open\ Transport\ Tycoon

Code: Select all

Open\ Transport\ Tycoon.app/Contents/MacOS/ttd -m extmidi
The forward slashes and the single space that follows them is important.
*BLAM*
The forward slashes up there do not have spaces after them.
'\' is a BACKslash
'/' is a [FRONT|FORWARD] slash
The distinction is a subtle one, but vital.
and on top of that, it's obsolite from 0.3.1
If you don't tell it anything, it will play music by default, so just doubleclick it
besides, I included a little (one line) script called ttd, so now you can write
./ttd -m extmidi
jking_ok
Engineer
Engineer
Posts: 6
Joined: 25 Apr 2004 08:22
Location: Perth, Australia
Contact:

Post by jking_ok »

DaleStan wrote:The distinction is a subtle one, but vital.
Point taken. Back to punctuation class for me :(

Bjarnl, good to hear about 0.3.1.

Joshua King
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 9 guests