See Porting “Blob Wars : Metal Blob Solid” to Mac OS X (Rev. A) for updated notes.
The following 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. I am using 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.
This is still a work in progress!
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”.
Change the executable name
Right click (Control click) on the Target. Select “Get info” to open the properties panel. Click on the Build tab then select Packaging from the Collection menu. Change the value in the Product Name setting to blobwars. Do Build Clean All. This will ensure the executable file within the .app bundle is called “blobwars” to conform to other builds. Sadly, it also renames the .app bundle. This will have to get renamed later back to 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.
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=1 -DLOCALEDIR=\"$(PREFIX)/share/locale/\" -DMEDAL_SERVER_HOST=\"www.parallelrealities.co.uk\"
$(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 on Sourceforge.
Add the source files
Delete the main.c file and import the source files from the /src folder.
Delete CHashtable.cpp, CHastable.h, CReference.cpp, CReference.h, CString.cpp and CString.h as they are not used and are likely to create problems when compiling.
Delete mapEditor.cpp and mapEditor.h as the current version does not compile.
Modify headers.h to include the SDL_net Framework by changing
I need to get this patch applied to future releases.
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
A pak file needs to be made for the program to run. Until I figure out the correct way to do this, it will have to be done from the command line.
In the main source folder, edit makefile.
NOTE: These changes assume that Fink is being used and that the SDL libraries have been installed.
CXXFLAGS += $(CFLAGS) -Werror
CXXFLAGS += $(CFLAGS) -Werror -I$(PREFIX)/include/
Using Terminal, go to the main source file folder and run the following commands:
Handling the data 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.
NOTE: The game produces it’s own icon that it will place in the dock when it is ran.
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.
strip errors and will not build correctly.
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.