Sunday 26 December 2010

Display all the answers to a question in Anki

I finally decided to publish the Anki plugin I've been using for the last few months. It's called "Display all the answers to a question" and it does exactly what its name says, that is, allows you to review decks with some cards containing the same question, but different answers. How does it work? Each time Anki picks a new card to revise, the plugin searches the database for other cards that have the same question and remembers them. When you click the "show answer" button, it shows the answers for all the cards it has found and changes their repetition times accordingly.




Saturday 11 December 2010

Sentenced to death? Just for monopolizing sushi?

I really hope at least Emma will be OK after all that hanging craze.

In any case, this is an awesome game with an awesome concept, awesome art and awesome bosses. You should definitely give it a try or at least watch some videos if you're a fan of shmups/danmaku or just like challenging and original games.

Monday 22 November 2010

I wonder where I've seen that before...

Oh, wait, I know!

Rebinding AltGr to Alt in Windows

I've had enough with that AltGr key on my laptop. I've never used it, and I still vaguely understand who actually needs it. In any case, this blasted key does not work as the usual Meta key in Putty! You can't, say, use AltGr+b to jump a word back in Bash or Emacs. Several solutions of this outrage can be found on the Internet, the most popular one is to use the AutoHotKey utility and assign a dynamical rule to rebind that key to the normal Alt. That solution does appear to work for most of the time, however, there seems to be a better way. Instead of using a third-party program, we can use the facilities provided by Windows itself, namely, the Scancode Map key in the Windows registry. The problem above can be solved by adding the following information to the registry:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,38,00,38,e0,00,00,00,00
Basically, the only thing it does is that it makes the RAlt key (That is, Alt Gr) act exactly as the LAlt key. To make things work you just need to save the text above into a file with a .reg extention and double-click on it.

Additional information can be found at
http://www.microsoft.com/whdc/archive/w2kscan-map.mspx
Although the article was written for Win2k, the solution still works for WinXP and Windows 7. Still claiming Windows is user-friendly? :P.

Tuesday 16 November 2010

No English text in Symphonic Rain

Note to self: don't forget to add (and probably modify first) SR.reg (located in the game's directory) to your registry before wondering why you cannot see any English text. Indeed, sometimes the issue may lie not in the "alternative" OS (works fine in Wine, woohoo!), but somewhere in between the keyboard and the chair.

P.S. The songs are charming and the game mechanics looks really fun, mind you, I've never played Guitar Hero or other rhytm games. The only one thing that's bothering me is that after 5 attempts I managed to get only 4 stars for the intro song. My years of piano practice went for nothing.

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.