The following information covers my efforts to port “Blob Wars : Metal Blob Solid 1.17” as an Xcode project with SDL, SDL_image, SDL_mixer, SDL_ttf, SDL_net and libintl libraries on OS X 10.4.11 Tiger. These instructions use Xcode version 2.5 and the source files from Parallel Realities. The Xcode SDL Development Setup tutorial at The No Quarter Arcade is used as a reference.
Install SDL and the SDL project templates
Download and install the Mac OS X Runtime Libraries and the Mac OS X Development Libraries from the SDL downloads page. Make sure to install the correct Xcode template for your operating system.
Blob Wars requires the SDL_image, SDL_mixer, SDL_ttf and SDL_net libraries. Download and install them as well. Blob Wars also needs libintl. This is not distributed as a Framework. I chose to copy the Framework from the Adium 1.3.10 source code.
NOTE: I had to use version 1.2.7 of the SDL_image and SDL_mixer libraries. Anything higher caused problems with graphics and crashed when loading certain audio.
Create the project
After unpacking the source files, create a new SDL Application. I placed my project inside the blobwars-1.17 folder with hopes that it will make it easy to copy the project over to new folders as updates are released. Name the project “Blob Wars”.
Set up the include paths
Edit the project settings and add the following lines to the Header Search Path:
Now, add the Frameworks to the project. After the Frameworks are added, drag and drop them into the “Copy Frameworks into .app bundle” folder.
On “Link Binary with Libraries”, Right click (Control click) and select Add Existing Frameworks and select
‘/usr/bin/libz.dylib’ ‘/usr/lib/libz.dylib’ . If /usr is not visable, run ‘sudo /Developer/Tools/SetFile -a v /usr’ from the Terminal and restart Xcode to be able to see the directory.
Other Linker Flags
Xcode 2.5 has some issues with sub Frameworks. Add the following two lines to Other Linker Flags:
NOTE: The above lines may not display correctly due to being so long. View page source to see the complete line if this is the case.
Set up the compiler flags
Edit the project settings and modify Other C Flags to read as follows:
$(inherited) -DUNIX -DFRAMEWORK_SDL=1 -DVERSION=1.17 -DRELEASE=0 -DLOCALEDIR=\"$(PREFIX)/share/locale/\" -DMEDAL_SERVER_HOST=\"www.parallelrealities.co.uk\"
NOTE: Setting RELEASE=1 will cause problems with the version in Git repository.
Add the source files
Delete the main.c file and import the source files from the /src folder. The folder as a whole may be selected. Select “Recursivley create groups for any added folders” to ensure the project does not copy them over to the target when building.
Under the Target ‘Blob Wars’ in the ‘Compile Sources’ section, delete references to CHashtable.cpp, CReference.cpp, CString.cpp, mapEditor.cpp and pak.cpp.
Modify headers.h to include the SDL_net Framework.
NOTE: This patch has been applied to the Git repository on Sourceforge.
Go back to the “Copy Frameworks into .app bundle” and delete all the header files as these do not need to be copied to the .app bundle. Make sure to leave the Frameworks.
The SDLMain.m file included in the Xcode project templates will need to be modified in order for the Help menus to work without crashing the application. I was able to get the files from the Mac OS X port of version 0.99 from here and work out the changes that needed to be made.
Compile the pak file
Create a new target and select BSD Shell Tool. The Target Name will be pak. Under the Build menu, set Per-configuration Build Products Path to
From the project root, drag CFileData.cpp and pak.cpp into Compile Sources in the new target and drag libz.dylib into Link Binary With Libraries.
Create a new Run Script Build Phase with the following script:
./pak data gfx music sound blobwars.pak
Edit pak.h and add the following lines:
Double click the Blob Wars target and add pak as a direct dependency.
Build pak so we can add the pak file in the next step.
Handling the document folder and pak file
Add blobwars.pak and the /doc folder to the project.
Select the “Create Folder References for any added folders” option.
Build and Go. A Debug build should compile and launch.
Odds and Ends
Double click the Target and modify Properties to add the version number and copyright notice. For more control over the settings, select “Open Info.plist as File”. The version and build number are located in makefile. The copyright notice can be found in any of the source files. In the Target folder delete InfoPlist.strings from Copy Bundle Resources or when clicking “About” from the menu bar, those values will display rather than the values we set in the Info.plist.
Img2icons can be used to create the .icns file. I copied the old icon form the 0.99 Mac OS X port into my Xcode Project folder and modified the Info.plist file to reference it. Add the .icns file the same way as the pak file and the /doc folder.
For the icon to work correctly without being overridden by the game, edit init.cpp and change
A patch has been submitted to fix this.
The Debug Build compiles and runs perfectly.
The Release Build produces errors when attempting to strip the DEBUG symbols. This appears to be due to some of my libraries containing x86_64 code that Xcode 2.5 cannot process.
Deselect Strip Debug Symbols During Copy in the Project Build settings to get around this for now.
I really need to upgrade my OS and Xcode to correct this! I believe newer versions of Xcode will resolve these errors and make it easier to rename project files and executables.