Wednesday, February 13, 2008

How to shut wine audio output

As I've mentioned before, I play to Morrowind (III) using Wine. Fine. Thanks to a nice guy on the AppDB Forum, I found out that what was causing Morrowind to segfault was simply that I had not set any audio device in my configuration... So I did with winecfg, and it worked, and I was quite delighted.

So far, nothing fantastic. It so happens that I hate to play any game with the game's music/sounds/voices, as I prefer to be quietly listening to music of my taste (I have delicate ears). As in any other game, you can switch them off in Morrowind, which is what I immediately did. However, it happens that some sounds - so far, only the sound corresponding to a shield blocking an attack (a graceful and delicate sound as you imagine) - go through even with all sound volumes are turned down to 0. It is annoying to the point I had to stop using the computer for listening music and falling back to my old CD player. Painful ! Or at least so it was until today, when I finally took my courage and found out how to fool wine into believing it is playing sounds when in fact it is not. First step, create a null ALSA output device, by adding the following to your .asoundrc:

# Null audio output
pcm.null {
  type null               # Null PCM
}

Then, you need to have wine use it (and only this one). For this, a quick look at the Useful Registry Keys showed that I had to add the following to my .wine/user.ref configuration file:

[Software\\Wine\\Alsa Driver] 1202930020
"DevicePCM1"="null"
"AutoScanCards"="N"
"DeviceCount"="1"

Just make sure wine is using ALSA output, and that's all ! Morrowind plays, without sound and does not segfault ! I'll be able to listen to my music again...

Note I'm unsure about the value 1202930020. The best is to add the key Software\Wine\Alsa Driver using regedit and then edit the configuration file -- or even do everything with regedit.

Friday, February 8, 2008

Microsoft advertises embedded windows under "Embedded Debian" !

[embedded-debian-microsoft.png] Few days ago, I was looking at my gmail mails. As usual, there was a couple of ads on the right hand side of the screen (they never really bothered me before). But that day, there was something quite different: an advertisement for Microsoft under the term "Embedded Debian" ! Well, I can understand that Microsoft wants to advertise for the keywords "Embedded Debian". After all, if they do provide good embedded OS services, that is only fair. But to do so with a title "Embedded Debian" does not really qualify as fair use of the Debian trademark !

The trouble is that this is something hard to prove, as it appears seldom and apparently randomly. When I google for the terms Embedded Debian, I come up around every second time with nearly the same ad, but taking to www.microsoftembedded-de2.com. This domain does not appear to be connected to Microsoft anyhow (see its whois entry). Some other people tried and never saw the ad, as I did when I looked from another computer (a Windows one, funnily). The www.windowsembeddedsolutions.com link which is depicted above did only show up in my gmail account so far. However, that domain is owned by Microsoft, so they can't deny this comes from them. Why, are we scaring them so much ??

Wednesday, February 6, 2008

Wine versus Vista for gaming

Another day starting well: apparently Wine is a better alternative than Vista for gaming (admittedly, this guy only tested four different games, but Wine was the clear winner). Great !

As for me, I finally got Morrowind working under Wine, which is one of the reasons why I haven't been that active for Debian recently.

Tuesday, February 5, 2008

gs saved the day again !

Some time ago, I was delighted at the power of Ghostscript. Well, it saved the day again, with an article that didn't want to get printed. Quite naively, I always thought that doing first pdf2ps (or pdftops, based on Xpdf, that often produces smaller and nicer postscript) and then ps2pdf was a good way to deal with unfriendly PDF files. But, in real, nothing is better than working without intermediates. The following produces a pretty neat PDF file:

gs -sOutputFile=output.pdf -sDEVICE=pdfwrite \
  -dCompatibilityLevel=1.4 input.pdf < /dev/null

As side benefits, as this command also embeds postscript fonts, the output looks better in xpdf, and it is decently smaller !

Friday, January 25, 2008

Creating and booting an ia32 debian system from an amd64 one

I've recently gone back to use wine to play "old" Windows games. Unfortunately, Morrowind, the one I'd like to play - really great one, if I daresay, is not working on my computer, though it should, according to its AppDB page. I tweaked wine's configuration, but no success so far. I decided it would be worth to try from within a real IA32 environment, just to check if that could be a bug linked to this. So, today's game is to create an IA32 debian system from my own, set it up and boot it.

First thing, create a i386 chroot using debootstrap:

debootstrap --arch=i386 sid /chroots http://ftp.fr.debian.org/debian

The target, here /chroots must be the root directory of a given device -- else booting won't work. Then, you must set up a proper /etc/fstab file, so it actually can mount things once you've decided to boot it.

Then, for fun, I've decided to cross-compile the kernel I would be using, so, after download/extracting recent kernel source, this is what I did. First, spawn the configuration tool:

make xconfig ARCH=i386
make -j2 ARCH=i386 

Then, I copied the kernel images using

cp arch/i386/boot/bzImage /chroots/boot/vmlinux
cp arch/i386/boot/compressed/vmlinux.bin /chroots/boot

The latter is important for the kexec kernel call. I also copied the kernel sources from the current system to the chroot, so as to be able to build kernel modules in the target system. Then, I did use the kexec utility to boot my new kernel:

telinit 1
kexec -l /chroots/boot/vmlinux.bin --append=root=0342
kexec -e

And there you go !! Then, you probably need to setup new users and also configure the network (try to copy from your current config).

So I did all this, to finally realize that it didn't work any better with a full ia32 system... Pity !

Thursday, January 24, 2008

A very annoying sound bug - and a workaround

Quite some time ago, I posted a bug report against ALSA because my sound would lock from time to time. No error message from any program using the sound, but they simply hang, and nothing is to be heard. I tracked the problem down to a blocking call to a semaphore operation, for all programs that were concerned. The thing was that I could not find a way to recover from this situation until the computer was rebooted, which, admittedly, is very painful. However, I found a way to do so today: you can actually kill semaphores by hand using ipcrm. If that happens, have a look in your /proc/sysvipc/sem file:

~ cat /proc/sysvipc/sem 
       key      semid perms      nsems   uid   gid  cuid  cgid      otime      ctime
   5678293     163840   660          1  1000    29  1000  1000 1201199302 1201198890

The only semaphore listed here is the one we're interested about. Kill it with the following command-line (probably only works as root):

~ ipcrm -S 5678293

And then, magic ! Sound works again !

Monday, January 21, 2008

The real limitation of Qt...

I've been posting here quite often that I like using this wonderful GUI library that is Qt. I've always found it really comfortable to work with. But it looks like I've finally hit a limitation:

[  5%] QT Wrapped File
/home/vincent/Prog/UltimateRipper/src/genericcombo.hh:26: Error: Template classes not supported by Q_OBJECT
make[2]: *** [moc_genericcombo.cxx] Error 1
make[1]: *** [CMakeFiles/ur.dir/all] Error 2
make: *** [all] Error 2

I knew that it is technically delicate to deal with that... I hope they had found a solution. Well, pity. After all, there must be a very good reason why they wrote so much code for QVariant, to provide an alternative to templates. Pity ! I'll have to go on with this class without specific signals/slots.