Friday, May 1, 2015

Heroes of Might and Magic II

The latest Humble Bundle comes with HOMM2 Gold in the pay-what-you-want group. While it's for Windows only, the installer works in Wine flawlessly.
When it's started I noticed the game actually runs in DosBox, which sounds somewhat silly - to run a game inside a DOS emulator which runs in a Windows emulator :-)
The natural instinct lead me to try to remove the unnecessary levels.
I used lnk-parser to find out what the HOMM2 Desktop link was actually doing:
$ lnk-parse-1.0/lnk-parse-1.0.pl  /home/hajma/.wine/dosdevices/c\:/users/Public/Desktop/Heroes\ of\ Might\ and\ Magic\ 2\ Gold.lnk 

Link File:  /home/hajma/.wine/dosdevices/c:/users/Public/Desktop/Heroes of Might and Magic 2 Gold.lnk
Link Flags:  HAS SHELLIDLIST | POINTS TO FILE/DIR | NO DESCRIPTION | NO RELATIVE PATH STRING | HAS WORKING DIRECTORY | HAS CMD LINE ARGS | HAS CUSTOM ICON |
File Attributes: 
Create Time: Mon Jan 01 1601 00:57:44
Last Accessed time: Mon Jan 01 1601 00:57:44
Last Modified Time: Mon Jan 01 1601 00:57:44
Target Length: 0
Icon Index: 0
ShowWnd: 1 SW_NORMAL
HotKey: 0
Target is on local volume
Volume Type: Fixed (Hard Disk)
Volume Serial: 00000000
Vol Label: 
Base Path: C:\Program Files\Ubisoft\Heroes of Might and Magic 2 Gold\dosbox.exe
(App Path:) Remaining Path: 
Working Dir: C:\Program Files\Ubisoft\Heroes of Might and Magic 2 Gold\
Command Line: -conf dosboxhomm2.conf -noconsole
Icon filename: C:\Program Files\Ubisoft\Heroes of Might and Magic 2 Gold\Icon.ico

but when I run
dosbox -conf ./dosboxhomm2.conf -noconsole
the game doe not run in full version, complaining about missing CD in the drive.
Here's the necessary change to the config file:

$ diff -u dosboxhomm2.conf.orig dosboxhomm2.conf
--- dosboxhomm2.conf.orig 2015-05-01 00:38:24.937021111 +0200
+++ dosboxhomm2.conf 2015-05-01 01:05:30.530285702 +0200
@@ -193,8 +193,8 @@
 
 @ECHO OFF
 mount C "."
-imgmount d ".\homm2.inst" -t iso -fs iso
 c:
+imgmount d "./homm2.inst" -t iso -fs iso
 cls
 heroes2.exe
-exit
\ No newline at end of file
+exit

Monday, April 27, 2015

Fixating testing to Jessie

So, Jessie is released, and I'd like to keep it on my laptop for some time.
It turns out it's reather trivial to do, just make sure all entries in one's sources.list point to jessie instead of testing:

--- /etc/apt/sources.list.bak    2015-04-27 22:23:17.664326851 +0200
+++ /etc/apt/sources.list    2015-04-27 22:27:33.559723639 +0200
@@ -1,10 +1,5 @@
-deb http://ftp.cz.debian.org/debian/ testing main  non-free
-deb-src http://ftp.cz.debian.org/debian/ testing main non-free
-
-deb http://security.debian.org/ testing/updates main non-free
-deb-src http://security.debian.org/ testing/updates main non-free
-
-# testing-updates, previously known as 'volatile'
-deb http://ftp.cz.debian.org/debian/ testing-updates main non-free
-deb-src http://ftp.cz.debian.org/debian/ testing-updates main non-free
+deb http://ftp.cz.debian.org/debian/ jessie main  non-free
+deb-src http://ftp.cz.debian.org/debian/ jessie main non-free

+deb http://security.debian.org/ jessie/updates main non-free
+deb-src http://security.debian.org/ jessie/updates main non-free

and run the usual

apt-get update

apt-get dist-upgrade

Monday, December 29, 2014

Yes, Debian stinks

# apt-get dist-upgrade
...
dpkg: dependency problems prevent processing triggers for hal:
 hal depends on libdbus-glib-1-2 (>= 0.78); however:
  Package libdbus-glib-1-2:amd64 is not configured yet.
 hal depends on pciutils; however:
  Package pciutils is not configured yet.
 hal depends on dbus (>= 0.61); however:
  Package dbus is not configured yet.

dpkg: error processing package hal (--configure):
 dependency problems - leaving triggers unprocessed
dpkg: dependency problems prevent processing triggers for hal:
 hal depends on libdbus-glib-1-2 (>= 0.78); however:
  Package libdbus-glib-1-2:amd64 is not configured yet.
 hal depends on pciutils; however:
  Package pciutils is not configured yet.
 hal depends on dbus (>= 0.61); however:
  Package dbus is not configured yet.

...
dpkg: error processing package hal (--configure):
 dependency problems - leaving triggers unprocessed
dpkg: too many errors, stopping
Processing triggers for libc-bin (2.19-13) ...
Errors were encountered while processing:
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
 hal
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)



Jesus, do you guys really have no QA???

Monday, October 20, 2014

Democracy 3 on Debian Jessie

Note to self:
To be able to run Democracy 3 on Debian one needs to:
# dpkg --add-architecture i386
# apt-get update
# apt-get install libpng12-0:i386 libsdl-image1.2:i386 libgl1-mesa-glx:i386

Friday, June 6, 2014

Rearming KitKat with a frickin' laser (and USB)

The kids returned from a Children's day festival with a bag of more or less worthless trinkets, among them a lovely KitKat promotional ball mouse. Its fatal handicap is the connector - the last time I had a PS/2 in my machine was a decade ago ...
I contemplated building a PS/2-USB interface with an Arduino, but lacked the 3.6V Zeners used in the circuit I found on the intertubes.

Fortunately there was an old USB laser optical mouse lying in my drawer.
I decided to transplant its innards to KitKat.
The scroll-wheel is broken, but since KitKat doesn't have one it's not a problem :-)

The PCB was too large to fit into the enclosure and the switches needed to be repositioned.
Cut, resolder, rewire, fasten with hot glue,

et voilà - a USB KitKat laser mouse!














Thursday, April 24, 2014

Opening cheap chinese USB charger

My USB charger has died so I ordered a new one. I chose a neat pink one :-)

While the seller claimed it to be a EU plug it turned out to be only compatible with the other part of the EU - it won't work with the ground pin of the CEE 7/5 socket.
I got a refund from the seller and kept the product. Since it's not usable anyway (apart from the cables) I looked inside.
First I pushed a thin screwdriver into the seam and pried gently
Then I was able to pull the insides out of the box
I guess there's no room for the ground pin there :-)
The PCB contains standard parts - Vishay MB6S bridge rectifier, Sharp PC817c optocoupler a power NPN 13003, a bunch of capacitors, diodes, resistors and a transformer.
I'm not desperate enough to repackage it to work with my sockets ... yet.

Wednesday, April 9, 2014

tail -f /dev/ttyUSB0 in Debian

After a recent Debian 7.4 (I hate the codenames!) update I was no longer able to read data from the Arduino's USB serial.
I found out that
cat /dev/ttyUSB0
worked, while
tail -f /dev/ttyUSB0
did nothing. Strangely enough, running the command in strace revealed that tail was reading the data correctly, it just failed to display them ...

I'm not sure whom to blame - coreutils or Debian. Anyway, here's the solution/workaround I found at debianforum.de:

$ stty -F /dev/ttyUSB0 0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
$ stty -F /dev/ttyUSB0 9600 raw hupcl min 0
$ tail ---disable-inotify -f /dev/ttyUSB0