Monday 11 October 2010

Running Tsukihime on Ubuntu Linux.

Late yesterday evening, when I was heading home, pondering whatever people usually ponder in cold dark evenings, I saw the moon. It is quite rare to see it so clear in the town where I live, but there it was, big, incredibly beautiful, with a tinge of blue. Long story short, that hit the trigger in my head and I got a strong urge to play the Moon Princess again.

There is one problem, though: my desktop PC is running Linux. Actually, the problem is not that big, because the English translation of Tsukihime uses the ONScripter engine, which is open source and multi-platform. And although Mirror Moon, the folks who translated Tsukihime, did not release a separate set of binaries for Linux, they were very kind to provide their patch for Onscripter-en to make things work.
http://mirrormoon.org/news/2007-01-15-tsukihime_english_for_linux_and_osx

Just as it is always happening, the actual process is harder than it is supposed to be and has a couple of unexpected caveats. To begin with, you may have discovered that the Ubuntu repo actually has the Onscripter package. Well, surprise! It won't work with the game, because it does not have the patch! So let's compile the game from the source instead.

Let's get these two files:
$ ls
onscripter-20060724-insani.src.zip  onscripter-20060724-insani-zalas.patch2

Then unzip onscripter:
$ unzip onscripter-20060724-insani.src.zip ; cd onscripter-20060724-insani

Now let's apply the patch:
$ patch -p1 < ../onscripter-20060724-insani-zalas.patch2

After that, install all the dependences mentioned in the README file. You will know you're missing something if the compilation fails saying there is no header file.

Now, after these steps we WERE supposed to get a working binary by just running:
$ make -f Makefile.Linux.insani


However, there is a problem:


...
ONScripterLabel_command.cpp: In member function ‘int ONScripterLabel::savescreenshotCommand()’:
ONScripterLabel_command.cpp:861: error: invalid conversion from ‘const char*’ to ‘char*’
ONScripterLabel_command.cpp: In member function ‘int ONScripterLabel::exbtnCommand()’:
ONScripterLabel_command.cpp:2225: warning: suggest parentheses around ‘&&’ within ‘||’
make: *** [ONScripterLabel_command.o] Error 1



This is simple. GCC has become more strict since the time this code was written, so we need to re-declare *ext on line 861 from char * to const char *. Now, can we have the working program?

$ make -f Makefile.Linux.insani
...
/usr/bin/ld: cannot find -lartsc
collect2: ld returned 1 exit status
make: *** [onscripter] Error 1



Not yet! The Arts sound library which we are missing here is outdated, and it's not available in the modern Ubuntu distros. Instead, a compatible sound interface is provided through PulseAudio, which is default nowadays. After a lot of googling, I finally figured out the solution: you should substitute -lartsc with -lpulse inside Makefile.Linux.insani in the uncommented "LIBS = ..." string. In addition, you must get rid of "-static", because there is no static version of libpulse-simple which you will need. (Actually, I have no idea why static linking was enabled in the first place). After these changes, LIBS should look like this:

LIBS = -z muldefs -Wl,--start-group `sdl-config --static-libs` `smpeg-config --libs` -lSDL_ttf -lfreetype -lSDL_image -ltiff -lpng -lSDL_mixer -lbz2 -lz -ljpeg -lm -lvorbis -lvorbisenc -lvorbisfile -logg -lgpm -lncurses -lslang -ldirectfb -lfusion -ldirect -lvga -ldl -lesd -lpulse -lasound -lX11 -laa -Wl,--end-group

$ make -f Makefile.Linux.insani

Finally, the binary is ready! After copying it to the game dir (or vice versa), all the preparations have been made, and we can enjoy the game:

$ ./onscripter
ONScripter version 20060724-insani(2.55)
Autodetect: insanity spirit detected!
Display: 640 x 480 (32 bpp)
Audio: 44100 Hz 16 bit stereo


P.S. The steps above were valid for Ubuntu 9.10 Karmic Koala. Chances are very high that the steps for 10.04 and 10.10 will be exactly the same.

5 comments:

  1. Thanks for that! Greatly helped me on Ubuntu 10.10. Only think I wanted to add, I wasn't able to come by -lpulseaudio, so I compiled without it ... still worked.

    ReplyDelete
  2. My fault, -lpulseaudio was supposed to read as -lpulse. I think you won't get any sound if you don't include it. Post updated, thanks for noting that.

    ReplyDelete
  3. This helped me to install Tsukihime on my Archlinux.

    Thanks a lot, sir.

    ReplyDelete
  4. Thankyou very much for this - I have successfully ran Tsukihime on Debian Testing (Wheezy), using the cdemu (http://cdemu.sourceforge.net/debian/) to mount the mixed-mode CD image.

    The following packages were required to compile onscripter:

    sudo aptitude install libaa1-dev libasound2-dev libbz2-dev libcaca-dev libdirectfb-dev libesd0-dev libgpm-dev libjpeg62-dev libpulse-dev libsdl1.2-dev libsdl-image1.2 libsdl-image1.2-dev libsdl-mixer1.2 libsdl-mixer1.2-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev libsmpeg0 libsmpeg-dev libsvga1-dev libtiff4-dev ncurses-dev

    This is my first Visual Novel and has subsequently blown my mind.

    ReplyDelete
  5. Hell, After many hours doing this finally i can enjoy tsukihime on Linux

    Thanks a bunch Vovick! :D

    ReplyDelete