Freeserf code is up

I just decided to release all the code for my Settlers 1 clone to GitHub. You can find more info here. It’s working, and semi-playable, but still pretty far from the full experience. I don’t know if I’ll ever get time to finish it, but at least now someone also can pick it up and hopefully do something nice with it.

Redshift 1.7

I finally had some time to throw a new release of Redshift together. The most important change, for most of you, is probably the Geoclue location provider by Mathieu Trudel-Lapierre. The old GNOME clock location provider has stopped working for many, as Ubuntu no longer includes a clock applet in the unity desktop. This is fixed now with this new location provider, which should work right out-of-the-box on Ubuntu Natty systems.

Other news are:

  • Allow brightness to be adjusted (-b).
  • Provide option to set color temperature directly (Joe Hillenbrand).
  • Add option to show program version (-V).
  • Add configure.ac option to install ubuntu icons. They will no longer be installed by default (Francesco Marella).
  • config: Look in %userprofile%/.config/redshift.conf on windows platform.
  • Fix: w32gdi: Obtain a new DC handle on every adjustment. This fixes a bug where redshift stops updating the screen.

More free software to flattr

So you’ve just created a Flattr account and now you can’t find anything to flattr? Are you using free software every day? Raphaël Hertzog (of Debian fame) is running a monthly Flattr FOSS newsletter where he recommends free software to flattr. You can see all the previous newsletter posts here.

If you don’t know what Flattr is, have a look here.

AccurateRip tools

I have made some tools for calculating AccurateRip checksums as described here available here: http://github.com/jonls/accuraterip-tools. There is also a tool in the repository for calculating the kind of CRC32 that is included in EAC log files.

  • ar_crc: Calculate AccurateRip checksums the naive way (for one offset) and for frame 450.
  • ckcdda: Calculate AccurateRip checksums for all offsets (only offset 0 is actually printed).
  • eac_crc32: Calculate EAC CRC32 both with and without silent samples.

The code is the documentation, but it should be easy enough to follow. The tools read raw CD audio data from stdin. Track lengths must be given in sector size.

<raw audio output> | ar_crc <offset> <track 1 length> .. <track N length>
<raw audio output> | ckcdda <track 1 length> .. <track N length>
<raw audio output> | eac_crc32

The raw audio output can for example be produced from FLAC files in the following manner:

flac --decode --stdout --force-raw-format --endian=little --sign=signed Track*.flac

Redshift 1.6 released

Finally, a new release of Redshift, and at the same time packages have been built for the newly released Ubuntu Maverick (to be found in the PPA as usual). There is a bunch of bug fixes in this release and some hastily thrown-together configuration file support. It works, but there is no documentation other than the example at the end of this post. Here is the list of changes:
  • Support for optional configuration file (fixes #590722).
  • Add man page for redshift written by Andrew Starr-Bochicchio (fixes #582196).
  • Explain in help output that 6500K is the neutral color temperature (fixes #627113).
  • Fix: Handle multiple instances of the GNOME clock applet; contributed by Francesco Marella (fixes #610860).
  • Fix: Redshift crashes when VidMode fails (fixes #657451).
  • Fix: Toggle menu item should not be of class gtk.ImageMenuItem (fixes #620355).
  • New translations and translation updates: Lithuanian (Aurimas Fišeras); Brazilian Portuguese (Matteus Sthefano Leite da Silva); Finnish (Jani Välimaa); Italian (Simone Sandri); French (Emilien Klein); Russian (Anton Chernyshov).

Looking forward to 1.6.1

I hope to release Redshift 1.6.1 before the end of the month. It will include some small bug fixes, updated documentation and updated translations, but for this to happen I will need your help:

  • Please help get the translations finished for 1.6.1 if you are fluent in one of the languages that Redshift has been translated to. The text strings will not change before 1.6.1.
  • Are you familiar with writing man pages? Please help document the configuration file syntax (#662632).

Configuration file

Redshift will look for a configuration file in “~/.config/redshift.conf” (or in XDG_CONFIG_HOME if that has been set). A different configuration file can be loaded with the command line option “-c”. Here is an example:

; Global settings
[redshift]
temp-day=5700
temp-night=3500
transition=1
gamma=0.8:0.7:0.8
location-provider=manual
adjustment-method=vidmode

; The location provider and adjustment method settings
; are in their own sections.
[manual]
lat=55.0
lon=12.0

[vidmode]
screen=1

Windows gamma adjustments

When porting Redshift to Windows I ran into trouble when setting a color temperature lower than about 4500K. The problem is that Windows sets limitations on what kinds of gamma adjustments can be made, probably as a means of protecting the user against evil programs that invert the colors, blank the display, or play some other annoying trick with the gamma ramps. This kind of limitation is perhaps understandable, but the problem is the complete lack of documentation of this feature (SetDeviceGammaRamp on MSDN). A program that tries to set a gamma ramp that is not allowed will simply fail with a generic error leaving the programmer wondering what went wrong.

There are workarounds, but you will not find them anywhere unless you have the patience to work your way through assembly listings of Windows DLLs. So here they are, for your convenience; these two tricks will work at least on a Windows 7 machine:

  • Go to the registry database and create the following key: “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\GdiIcmGammaRange”. The type must be DWORD. The value determines the amount of adjustment that can be made, where 0 means no adjustments possible at all, and 256 means any adjustment is allowed.
  • Run your program from the Local System account.

So if you want to run the experimental build of Redshift on Windows, you need to use one of the above methods if you want to use the same color temperatures as are available on the linux version.

Redshift 1.5 released

I had wanted to release redshift 1.5 last month but for various reasons I never got around to it. Today I received a very generous donation which reminded me that I really needed to get this release out.  The source is available from the launchpad project page as usual. Packages for Ubuntu Lucid are available in the PPA. The contributors for this release are: Francesco Marella, Gabriel de Perthuis, aleth and the translators.

  • Application launcher and autostart feature contributed by Francesco Marella (fixes #590550, #612710).
  • Improve GNOME location provider (patch by Gabriel de Perthuis) (fixes #598277).
  • New ubuntu-mono-dark icons that fit the color guidelines better. Contributed by aleth (semi-fixes #596536).
  • Improve error message when first adjustment method fails (fixes #596537).
  • Translation updates: Basque (Ibai Oihanguren); Chinese (Jonathan Lumb);
    French (Hangman, XioNoX); German (Jan-Christoph Borchardt); Hebrew
    (dotancohen); Spanish (Fernando Ossandon)

Thank you contributors and donators! (btw, the donation will be spent on hosting for this website).

Redshift 1.4 released

I’ve released redshift 1.4 today. The source is available from the launchpad project page as usual. Packages for Ubuntu Lucid are available in the PPA. There’s lots of exiting new stuff in this release thanks to several contributors: Francesco Marella, Dan Helfman and all the translators.

  • Command line options for color adjustment methods changed. Procedure for setting specific screen (-s) or CRTC (-c) changed. See redshift -h for more information.
  • Automatically obtain the location from the GNOME Clock applet if possible.
  • Add application indicator GUI (by Francesco Marella) (fixes #588086).
  • Add reset option (-x) that removes any color adjustment applied. Based on patch by Dan Helfman (fixes #590777).
  • configure options for GUI changed; see configure --help for more information.
  • New translations: German (Jan-Christoph Borchardt), Italian (Andrea Amoroso), Czech (clever_fox), Spanish (Fernando Ossandon), Finnish (Ilari Oras).

UPDATE: 1.4.1 released. It includes mono icons for Ubuntu (by Joern Konopka); the status icon toggles to show whether Redshift is on or off; and it has updated translations: Spanish (Fernando Ossandon), Russian (Чистый).

Settlers 1 remake

Update: More info here.

Here’s a quick preview of something I’ve been working on.

As you can see, it uses the graphics from the original game. It is beginning to approach a state where it’s actually playable. Here’s some more screens for your viewing pleasure:

Showing huge images with Google Maps

The Google Maps API can be used for other things than maps.

The tiles were created with this python script: http://gist.github.com/618639. It will convert a PNG image to PNG tiles. The script depends on pycairo to do the cutting and scaling of the images. This example converts master.png to tiles of size 256×256 with 1 being the minimum zoom level and 4 being the maximum zoom:

$ pngmaptiler.py master.png 256 256 1 4