Wednesday, 16 December 2009

How to compile SDL_Mixer for the iPhone

So this is a question that has popped up more than once in SDL mailing list, so I decided to give my contribution to the howto-documentation. If you're looking for Ogg or MP3 decoders this is your guide; unfortunately i couldn't make it compile with MIDI support.

First: open the XCode.tar.gz archive in the SDL_mixer sources, and load the project file in Xcode.
Second: go the project preferences and modify the base sdk and architecture like in the pictureOf course you can choose a lower sdk, i successfully compiled the library for iphone 2.0. Once in the main windows again choose the "Static Library" from the Active Target list.
Third: Expand the Targets label on the left and double click on Static Library; this will show the specific target options. Select the Preprocessor macros doubleclicking it and modify it by removing MID_MUSIC, MOD_MUSIC and USE_NATIVE_MIDI and add __IPHONEOS__ definition.

Fourth: One last step, remove native_midi_macosx.c from the Compile Sources list in your Static Library target and the library is ready! It's compile time!

Sound great doesn't it? However here is bad news: for our application to correcly load OGG file (and most likely mp3 as well but i haven't tested it) we'll need another library to correctly link the various ogg functions. Don't worry, I'll guide you!

We have two options:
1- we can download ogg and vorbis and compile them from command line, set up the dependencies between the two, fix the paths and so on... if you're eager to try the command line is this:
< ./configure --prefix=/usr/local/iphone --host=arm-apple-darwin --enable-static=yes --enable-shared=no CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.2.1 CFLAGS="-pipe -mdynamic-no-pic -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=3.1 -gdwarf-2 -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/usr/include/libxml2 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk" CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar LDFLAGS="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk -Wl,-dead_strip -miphoneos-version-min=3.1" >
2- we can simply use Tremor, which is an ogg implementation designed for memory constrained device with only integer operations: perfect for the iphone!
It comes bundled in another project, Cocos2d, a great framework for games. If you download it and select the libvorbis target, you will get a single decoding library statically linked for the iphone. It's compile time again!

Place both libraries in the Frameworks folder of your application and... Enjoy your ogg audio on the iphone!
Please drop a comment for critics and suggestions (and appreciations too :) )

Thursday, 10 December 2009

So i've adhered to TNES campaign -- The New Exposé Sucks

well the title says it all...
i really really really DON'T like new Exposé features under Snow Leopard.

i could stand the WOW SO APPEALING elecritic blue for the glow... some guys like blue, i too like blue, but under the windows? glowing? a blue rectangle of BLUE color popping out when the windows are placing? not on my watch...
anyways you can change it easily so it's not a big deal

what really drives me crazy is something that itook a little to realize: the windows placement!
OH _ MY _ GOD _ (in blue)
what effect is that? all windows in a grid? where is the piece of art effect that would resize and place the windows according to their positions? am i running a compiz plugin? is that some rejected Windoze effect that somehow got in Snow Leopard sources?

i couldn't believe my eyes! Luckily then i found some scientific grounds to understand WHY i wasn't really liking the new exposè: it has to do with usability and feel experience, read more on these two posts

and so i've officially joined the anti-new-exposé campaign (all blue) and i hope that you join it too! To participate, just write some lines here telling 'em how much you dislike the new exposé and want an option to bring the old one back!

let's hope in a future service pack... whoops i meant software update!

Wednesday, 9 December 2009

New Xcode and New provisioning sk..ript

So i like the new Xcode 3.2, but i liked the provisioning skip more in previous versions...

Anyways this is the method i tried and it (miracously) worked

beware that python is indentation-sensitive so you have to carefully copy the script to make it work


Thursday, 19 November 2009

docs and news

besides the usual links for the stuff hosted on scribd

we also have great news! Due to popular deman of nobody, all the slides published on Scribd will be ALSO published on SlideShare, to achieve maximum visibility!

here is the new outstanding link! don't worry we'll keep both upload systems -- older slides have been uploaded to slideshare and kept on scribd -- newer slides will be published on both!

Enjoy it fully!!!

Thursday, 12 November 2009


Pay lot of attention when purchasing a Nintendo DS videogame on Internet, eBay in particular... if the price is too good to be true, it's most likely a fraud.
The general advice is that everything that comes from china/hongkong is fake, that is, is a pirated version of the game built in mocked up ds cartrige. While it is true that 99% of what comes from those places is fake, importers can bring faked games worldwide, so geographic scanning is a no go.

There are ways to tell if a gamecard is fake ( but untill the game is arrived you have no way to determine it.

Well no more, thanks to the DSi!
In fact the dsi has shrunk a little its slot, so that good games can enter, but fake ones cannot!
So every fake ds game on ebay will have "for DS/DSL but not DSi"



Saturday, 7 November 2009

another xcode goody

Xcode is a really good IDE and you never end to delve into his internals!
Today i have found how syntax highlighting works! Every type of language has its own syntax definitions and its own file where such definition is specified.

ALL files are found here


The syntax for the syntax (all puns intended) is quite symple and quite commented considering that they're internal files.

by tweaking the Pascal syntax file specification i was able to fix a nasty glitch that was affecting the single line comments present in FreePascal files -- a // comment was ignored by the syntax highlighter and printed in black, while as a comment should be printed in green (colors may vary according to configurations)

at line 101 of file Pascal.xlangspec to fix the glitch!

There might be more fun in tweaking these files (or bricking xcode) but i simply hadn't time to dedicate! If you know other tweaks post them in the comments!


Sunday, 18 October 2009

Hedgewars 0.9.12 released!

Let's deepen into Mac developing

Today a new version of hedgewars has been released!
You can find the big changelog in the website homepage, but i wanted to give some insights on the exclusive mac development.

M3 Install Controller
This is a neat feature, for new users of the Mac world, that helps Hedgewars installation. New users in fact tend not to know about what a diskimage really is and so they may be tempted to run it directly from the diskimage. Luckily Hedgewars runs fine even on the diskimage (other programs do not) but it'd be better if the application were run from the hard disk.

Now i've added this controller (available at this site) to the sources and when you run Hedgewars from the diskimage here's what you get:

pretty neat huh?

Sparkle Framework
The Sparkle framework is one of the most well known application helpers for the mac world! Many famouse programs use it (Adium is the first that comes into my mind) because it makes it very easy to include an autoupdater feature to you application! It's free, opensource and quite customizable! Now when the next release is out, you'll be prompted to install it; Sparkle will download and update Hedgewars in a matter of clicks.

I can't show you the image because there is not yet any updates, but i can assure you it rocks!

One of the hidden features of the new release is that we've added compilation time optimizations! Faster executables thanks to the -O2 flag! However mac users, thanks to the single type of processor installed (intel) we can enable even more efficient optimization, that couldn't have been enabled in other cases (because of the different and wider processor environment).

Stay tuned for 0.9.13 for which i have other interesting "exclusive" features to add!

Friday, 25 September 2009

yet again, another sdk update with provisioning skip

Welcome back from (my) holidays, rather long this year!

A lot of updates have been published and new stuff is being put forward at constant rate!
However some things never change, both in life and in software!

For example, the way to skip provisioning file with the new iphone firmware, is the same as described here:

isn't that nice? :)
cya later in this year

Tuesday, 18 August 2009

oh well, SWARM patch for gcc4 will be for you only then

i really hate when abandoned software remains abandoned even if patches are sent for bugfixes and stuff! You'd just need to apply it, check it doesn't break anything and publish the new release! then you could continue keeping your software abandoned

SWARM is a SoftWare ARM emulator - nice idea - too bad that doesn't compile cleanly with new gcc4! i wrote a patch for updating all non-standard C++ apis and succeeded in having it compiled with modern compilers!
you can guess that the patch was completely ignored! i didn't expect full credit on the homepage but at least a "hey thanks, but not interested" or something!

since i don't like my work to be wasted i'm posting the patch here, hoping that other poor guys that have to use it can at least have it compiled on their own machine (instead of a virtual machine as slug as hell like i ended up)


Monday, 20 July 2009

what do phone assistance lines have against me???

I don't know, maybe I sound rude on the phone, or maybe i just have bad luck, but every time I have to deal with phone lines for assistance I never get what i want, or i have to wait indefinetely for very simple tasks!

let me show you three examples from my life, one ended, one in couse and one future

Nintendo Odissey
one of my Wiimotes breaks down and i send it for repairs under warranty; they misteriously lost a SIGNED package and refuse to give it back to me! I spent on the phone almost as twice as the value of a brand new Wiimote because I called Nintendo assistance almost 3 times a week for a WHOLE YEAR!!! They claimed that their lab never received anything and most likely i wasn't worth a repair... i ended up mailing the consumer defence association and the repair company directly begging for my poor wiimote...
in the end they sent it back without saying anything or being sorry

The missing bite
i sent my first gen aluminium iMac for a check up and for a silly problem they switched me to a more noisy second generation iMac... this is almost my fault but the funny part begins with the refund for the AppleCare on that iMac: since a couple of years in Europe you just need a (very long) single code to send money between banks and this has simplified things a lot! However, assistance wanted a further code (the SWIFT or BIC) that i didn't have, but actually i didn't want to give because there's no real need for it! What really set me angry is that they asked me for it only after three months after request for refund! Couldn't they tell me they needed it right away???
in the end i found the code, email them, but the person charge for handling my refund moved department, so i have to return to level 1 support (which mean more time waste to get what i want)

Click and run
i subscribed for a deagostini course and every month had to pay a given sum; after some time i didn't like the course any more and thought that by not paying they'd stop sending me useless stuff. That was very dumb of me, because i ended up in having to pay other three issues... I was even dumber in believing that paying all three in a single solution (instead of three single payments) would save me time, but it appears that they haven't found my money order in their records! So now i have to send the receipt by fax and hope for the best

well they're all very silly problems and nothing i should really worry about, but these events tend to rise your need of daily blood in general, as temptation to kill is maximum when you end the call. You can see how near to the solution but are forced to stay away from it for very stupid problems; and when you win your case, you always feel a bitter taste for all the time you've wasted!

i'm posting here all the details i was able to gather about my nintendo case! I hope they might be useful if they someone gets in similar problems
servicetrade -- via palù, 36040 grumolo delle abbadesse (VI)
fax: 0444 263520 / 0444 263540
tel: 0444 263511 / 0444 263544
person in charge: margaret / EMTS
nintendo info: 199191199
nintendi service: 199309067
Have a nice summer :)

Sunday, 5 July 2009

Xcode template madness

so today i wanted to order a little the list of Xcode templates, as user templates normally are placed in random locations: some in the preferences, some in the user library and so on

this is the list were both the standard templates and the user templates are
/Developer/Library/Xcode/Project Templates
/Library/Application Support/Apple/Developer Tools/Project Templates
~/Library/Application Support/Developer/Shared/Xcode/Project Templates/
/Library/Application Support/Developer/Shared/Xcode/Project Templates/
/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates

you can move templates where you like them

Sunday, 14 June 2009

Hedgewars on the iPhone?? perhaps one day...

Let me first clarify that the blog posts across the internet claiming that an iPhone version is "near completion" are nowhere near the truth!

In fact the idea of porting the game originally started one year ago, but was soon dismissed because of lack of manpower/equipment. Everything remained silent until i joined development and i was proposed to resume developing the iPhone version; i was shocked by this because i never did anything with the iPhone and my SDL/Pascal was (and still is) very limited! However i received so much help by unC0Rr, nemo, tiy and many other people at #hedgewars that all together we managed to pull something off! With a lot of patience and trial&error, here's what we've got so far:

What we're showing now is a very BASIC demo, running in the iPhone simulator! The code compiles fine and graphics too, but there is still no support for audio and no way to control the game. This is where current development is at the moment, but now you can rest assured that you'll see one iPhone version of your favourite game in the future!!!

Monday, 8 June 2009

animals yet again

yummy, inserito originariamente da Vittorio's.

from the USA trip set, i've updated the animals set with the squirrels!!

Saturday, 30 May 2009

second shot

lovin' tree, inserito originariamente da Vittorio's.

bird album is ready!
where's the bird in this photo? in the lower left corner!
ok it should have gone into the tree ones, but i like the blur behind the tree

Thursday, 28 May 2009

and we're back

addams hotel, inserito originariamente da Vittorio's.

from our tour in the USA!
I'll be publishing slots of photos as soon as i finish sorting them!
As always, the best one on flickr and the album on picasa!

I'll pick one (more) "best" shots from flickr and post it here!

stay tuned

Monday, 20 April 2009

the WHOLE SDL libraries availalbe for the iPhone

So i have been toying with this toolchain lately... i must say that i'm constantly surpised by Xcode power! it's something that you have to get used to, but once there it can almost whatever you want!

anyways, i am in the middle of porting a certain game from a normal Mac framework to a iPhone/iPod Touch device! Most of the stuff is already there, like the Pascal compiler, but the main libraries are missing!

I'm talking about SDL, but after some thinkering i got everything done! Here is what i did after checking out every repository

well this was the easiest, porting this lib started in a past google SoC and they did a pretty good job. To get the lib it's sufficient to unpack the Xcode_iPhone.tar.gz and press "build".

this one wasn't particuarly difficult, as it required just a correct configuration in the Xcode.tar.gz project. In the project settings, set the Base SDK to Device - iPhoneOS (or Simulator according to your needs) and Architectures to Standard.

i had to google a little to get this done: ttf is built exactly as SDL_net, but all the applications built with it are hard depending on libfreetype. Of course this library is available for the iphone, but it's difficult to configure it correctly. Luckily i read this site which clearly explained what to do; include that file in your application frameworks and add the -lz flag to the linker options, and you are done!

the hardest of all, just because the svn repository was out of date! In fact there's this guy who did a neat job for introducing a native support for png, jpeg etc instead of third party libraries. His patches were accepted in mainstream, but the iphone project in the repo has not been updated and can't compile!!! I emailed sdl-list but got no reply... for now it's sufficient to download his updated package and compile from it.

this was not as easy as net but i guess that porting for this project has yet to start. For the moment i got a working library just by removing all the native_midi_mac stuff, as it's the only part that relies on a framework which is not present in the iPhone. I didn't need any midi support, so i was satisfied with it already.
Beware that while simulation will give no problems, there's an issue for the device! In fact the simluator is likely to load the ogg functions from the shared libs of the system, but since ogg is nowere in the iphone, we have to provide our own!
so let's grab libvorbis and libogg and compile them the same way we compiled libfreetype; i had some problems with the paths when compiling libvorbis, due to the macports installations. I resolved by placing the arm version of libogg.a into the lib directory of macports (/opt/local/lib) and creating a symlink to it named libogg.dylib. Obviously make backups so you can restore your installation!

Now that you know what to do, you can keep updated the freely available versions that i compiled! they are the latest revision... of today! If something doesn't work complain with the SDL guys! I do hope that by the 1.3 release, SDL for iPhone will become officially supported

click here to download all the libraries, both for the simulator and for the device (debug version obv)

if you find them useful, drop a comment here, it'll mean that my work is appreciated :)

Saturday, 18 April 2009

CMake configuration for Universal Binaries

So since i committed my partecipation in Hedgewars development, i wanted to support as many platform as i could

... and i ended up deploying only for Intel Leopards

why? well not that hedgewars can't compile on tiger (at least after a patch from mischi) or in powerpc environment is just that i couldn't set a working configuration for it! For quite a long time Qt was compiled statically which helped in reducing the number of relocated libraries, but forbidding any universal build
moreover the "Build once, Deploy everywhere" from Qt was not working even when i switched to the standard sdk!

At last, today I have found where was the problem! CMAKE
it appears that setting -arch ppc -arch i386 in the CMAKE_CXX_FLAGS flag has no effect! you have to specifically set the following two

and before issuing make
Beware that using Carbon API from Tiger will slow down a bit execution on Leopard! for this reason i think it might be better to add an Intel-only Leopard optimized release of the software, since the new version of QT (4.5) supports Cocoa natively (which actually speeded up loading times.

I hope this helps desperate developers trying to support as many architecture as possible!
if you want to know more, follow this link, where it's explained how to include even additional configurations.


Monday, 13 April 2009

Hedgewars 0.9.10 available

Hey guys, after much work, the new version of Hedgewars is finally available!
It seems i have been added to the developers list and that's really rewarding :)

the changelog is really long but the part that i've contributed most is

  • The game now officially works on windows, linux and mac!

Hedgewars is now a 100% cross platform game! w00t!!!!

Copies have just been uploaded, grab them while they're hot

Tuesday, 17 March 2009

the biggest Scribd upload you'll ever see

so what now? this is not the usual Scribd advertisement!
we've got 6 (and i repeat _SIX_) new documents for your pleasure

Fault Tolerance
Video Encoding
Low-pass Filter
Laboratory Experience
Radiofrequency Devices
Custom Instruction

all top notch quality! Authors include Matteo Ainardi, Matteo Bosio, Salvatore Campione, Vittorio Giovara, Alberto Grand, Fabio Margaglia and last but not least Alberto Tibaldi (plus other minor contributors)

Monday, 9 February 2009

autocompletion always on

i like yahoo services and i believe that always relying on one company only (like google) is wrong both for privacy and competition

one of the downsides of yahoo systems is that authentication is set not to allow autocompletion! It's true that it asks the password only once every 15 days but it might be annoying when you often delete your cookies

i've just deleted my cookies after 4 months and now i decided to fix this: a quick google and solution found in the ubuntu forums

basically you can
i choose for the greasemonkey one because what it does is really simple (just turns on the 'autocompletion=off' field)

Saturday, 31 January 2009

Wednesday, 28 January 2009

yay first page

ok this is rather old news but i wanted to put it in this blog all the same

the efforts i put for getting a testing bundle package of the hedegwars game were recognized and i was cited in the front page as "cool contributor" yay!

go hedge team!!

ps if you want to try the mac bundle of version 0.9.9 you can! the link is hidden somewhere in the general discussion forum! just take in consideration that it's still in testing

Tuesday, 13 January 2009

HEDGEWARS finally compiles on Mac OS X

Hi all!
I believe that Hedgewars is really a neat game and i'm sure it will increasly become more popular with such development pace.

I really like the development choices like QT4 and cmake because with them it's really easy to port to several archs.
In fact the linux and windows builds are there and work fine! What about MacOSX?

i've seen many others in the forums asking this question and so i started looking at the problem, making up my mind that i had to find it!

It was a long night, but completely worth it :)
The problem is at the linking stage for the final hwengine executable! the freepasacal compiler seems to forget every library path that was configured; so with a small modification we finally get the mac executable!


1 - download and install MacPorts from to the default install dir

2 - from a Terminal, install all the necessary software

sudo port install qt4-mac libsdl libsdl_mixer libsdl_image libsdl_ttf libsdl_net cmake

it is a rather long procedure, manly due to qt framework; if you're an impatient guy there are some builds around (like these)

i also installed SDL (and all its friends) from the SDL homepage ( just to be on the safe side... i don't know whether they're compulsory or not

3 - unpack the hedgewars source and run this command

cmake ../hedgewars-src-0.9.8 -DCMAKE_CXX_FLAGS="-O2" -DQT_QMAKE_EXECUTABLE=/opt/local/bin/qmake-mac -Wno-dev -DCMAKE_BUILD_TYPE=Release

if you like, you can change the default install location by setting -DCMAKE_INSTALL_PREFIX and -DDATA_INSTALL_DIR

4 - before running make, you have to modify the following file: CMakeFiles/hwengine.dir/build.make, so open it and find the line that invokes the freepascal compiler

mine was like this
/usr/local/bin/fpc -B -FE../bin -Cs2000000 -vwi -O2 /(path-to-sources)/hedgewars-src-0.9.8/hedgewars/hwengine.dpr

you just have to add -Fl/opt/local/lib at the end, like
/usr/local/bin/fpc -B -FE../bin -Cs2000000 -vwi -O2 /(path-to-sources)/hedgewars-src-0.9.8/hedgewars/hwengine.dpr -Fl/opt/local/lib

5 - run make and sudo make install

6 - PLAY!!! just open terminal and write hedgewars

it's rather long for an install procedure but it really works :)
right now i'm working on the bundle archive, but i believe it'll take from me more than i thought

i hope that someone can find it useful :)
(and that the dev correct the workaround at 4)


All the projects here are under a Creative Commons 3.0 licence! You can use and distribute them as you like (just quote the author so he knows his work is not useless)!

If you wish to get in touch with me write at