Nick Bowler [Thu, 4 Feb 2010 19:02:44 +0000 (14:02 -0500)]
lbxtool: Remove - as a synonym for stdin.
Modern Unix-like systems have interfaces such as /dev/stdin which mean
the same thing. Furthermore, the tools read from stdin by default.
Lastly, -f some_file -f - doesn't work anyway.
Nick Bowler [Thu, 4 Feb 2010 16:47:18 +0000 (11:47 -0500)]
liblbx: Don't ignore whence parameter in pipe_seek.
The code from which this derived only supported SEEK_SET-like
operations, so SEEK_CUR was forgotten when converting it.
SEEK_END obviously cannot be supported on pipes.
Nick Bowler [Thu, 4 Feb 2010 05:07:20 +0000 (00:07 -0500)]
build: Don't use a semicolon after sed's 't' command.
Some (namely, FreeBSD's) sed implementations fail when a semicolon is
used after a 't' command. This behaviour appears to be acceptable
according to POSIX, so appease these implementations.
Nick Bowler [Thu, 4 Feb 2010 01:47:40 +0000 (20:47 -0500)]
liblbx: Parameterise I/O functions to allow custom streams.
This eliminates the need for lbx_mopen and friends, so remove them. We
also now leave it to the caller to handle "seeking" on pipes, to
eliminate yet another hack. Only the core LBX handling code is updated
for now.
Nick Bowler [Wed, 3 Feb 2010 20:13:06 +0000 (15:13 -0500)]
test: Fix up regression test script.
The script uses a hodge-podge of portable and non-portable constructs
and declares the interpreter as /bin/sh. Change it to use my favourite
shell and exploit its features.
Nick Bowler [Fri, 4 Jan 2008 10:52:55 +0000 (05:52 -0500)]
Implement image masks to handle transparency in images.
This makes a whole bootload of images work properly.
LBX doesn't translate nicely to PNG when there are transparent pixels.
Therefore, lbximg will use 256-colour paletted PNG when there are no such
pixels, and 32-bit RGBA PNG when there is at least one such pixel. This choice
is mainly because working with 32-bit RGBA PNGs takes forever on my laptop.
Apparently the simtex logo image contains some transparent pixels, thus the
regression test has been suitably updated.
Nick Bowler [Fri, 4 Jan 2008 07:48:19 +0000 (02:48 -0500)]
Implement new handling of the LBX image header data.
* Change "#offsets" to "#frames". This makes lbximg capable of decoding all
frames of images such as the TANM_ family and science.lbx.001
* Change interpretation of "pal" to a bitmask containing flags. Current flags
handled are
- 0x0400: render each frame on a blank slate (makes TANM_ family work).
- 0x1000: image contains embedded palette, as previously understood.
- 0x2000: image loops over all frames.
* Change interpretation of previously-thought "#frames" to "leadin" - that is,
indicates the first frame that is part of a looping animation. This is
superseded by flag 0x2000, and yes - leadin == 0 means the same thing as that
flag. This will allow science.lbx.001 to be looped correctly. This leads to
the somewhat strange notion that all images loop, just that some simply loop
over the last frame.
Also update lbx_getinfo() to reflect the new information.
Nick Bowler [Mon, 31 Dec 2007 10:24:40 +0000 (05:24 -0500)]
Update handling of embedded palette data in image files.
The pal (formerly wtf2) value indicates the presence of a palette: 0x1000 if
present; 0 otherwise. Then, immediately following the offsets comes the
palette header: 2 bytes always zero, 2 bytes for the number of entries.
Entries are sequential starting from zero.
Nick Bowler [Mon, 31 Dec 2007 09:40:18 +0000 (04:40 -0500)]
Fixes to image processing.
The noffsets and nframes values stored in image files appear to be one less
than what they actually are, so increment them on load. This makes single
frame images work.
If the xval read on a 'type 0' row command is 1000, stop processing the frame.
This makes the 50th frame of mainmenu.lbx.000 work.
Nick Bowler [Sun, 23 Dec 2007 23:06:44 +0000 (18:06 -0500)]
Add lbx_mmap() to map archive members into memory.
Currently, the whole LBX archive is mapped into memory on the first call, then
offsets from that are returned. If this proves to be problematic, it may have
to be changed.