Aaaand, 0.8.3

Well that was fast.

Dovoto discovered some quirks in the way names were used under shared data runs and had a nice suggestion to allow images to be added via grit files as well. There was also some other small niggly bits that needed straightening out. So yeah, grit v0.8.3.

grit 0.8.2 / usenti 1.7.10

Apparently, the GRF format didn't quite follow the official RIFF specs, so I had to fix it (thanks for pointing it out, Daniel). While I was at it, I also changed the names of the meta-tile arrays if a meta-map was asked for. In stead of the -Map affix, it now uses the more logical -MetaTiles. Yes, this probably will break something, but in the long run it's better this way and it's a compiler error, so it's easy to fix.

Usenti's been updated to match.

 

Grit 0.8.1

Grit 0.8.1 is out now. I've made three somewhat small changes here. First, there was some trouble with shared palettes/tiles if there was no -O or -S option. “Trouble”, as in segmentation fault. This should now be fixed.

I've also reformatted the include guards from __FOO__ to GRIT_FOO_H. GCC uses that format for internal #defines and it is very territorial about such matters. So, say, when you have elf.png, GCC gets cranky because that would hide its own __ELF__, and guess who wins out there? Again, thanks for pointing these things out, Quirky.

The last item is the addition of column-major tiling. This can be useful for horizontal scrolling games, since the data or the columns are all adjacent instead of a whole scanline apart. A second benefit of this mode is that rendering to tiles is made considerably easier (and a little bit faster too).

In case you hadn't noticed yet, I've also put the manual on-line. This shows the basic options for grit and wingrit, and now there's a description of how to use it in makefiles as well. This includes how the building the grit-demo project works. This one's quite interesting, so please check it out.


Project link.

grit 0.8

It's time for another Grit release. There are three important changes compared to previous versions.

First, palette merging is in (and there was much rejoicing). If you use the -pS option, a shared palette will be created and used in the graphics. Note that I still think palette merging should be performed on the images themselves and not in the output phase. If anyone's interested, I do have a small app that can do just this.

Another big change is that handling of shared data is now done correctly. The previous version required two runs for this: one for the non-shared stuff, and then another for the tileset itself. You also had to take care to disable the shared item for the individual runs, otherwise the (useless) intermediates would be exported as well. Grit 0.8 fixes all this. You can provide multiple images and request a shared tileset and/or palette (with -pS, -gS, or -fx) and it should work right. Grit will export the individual parts first and save exporting the shared data for the end. For example, if you have 5 files to be converted to maps with a shared tileset, you'll get 5 maps, and one tileset and palette (instead of 5 of each like 0.7 did). You can tune the shared output names with -S and -O (uppercase s and o) if necessary.

Thirdly, there is a new binary file-type available. I'm calling it GRF, for Grit RIFF File. This places the graphics, maps and palette in RIFF chunks. The idea behind this was to have related data in a single file instead of three different binaries. The chunked data-format also allows easier extension and it's easy to make a generic loader for it too. For details (including such a loader), see the the manual. The -ftr option creates a GRF file, and you can also create GRF-formatted C/asm arrays using -fr.

I've also added something I like to call ‘fake’ compression, -Z0 (Z zero). This adds a header word to the data similar to the ones that the compressed data have. This consistency of data-formats is essential for the generic data-loader.


As I mentioned before, there is also a proper demo project to show how you can use grit and its various options. Take note of how it uses a separate makefile to prepare the graphics. This way you can keep the main makefile pretty clean and it makes it easier to insert customized conversion rules. Note: to build the demo project, make sure GRIT points to the updated binary.


Linkies

A grit demo, part I


Grit demo menu.

I think I finally have a nice demonstration of the capabilities and use of grit again. The figure on the right shows its main menu. Each entry shows one or more capabilities of grit and how to make use of the data it outputs. Pressing start returns to the menu.

The source for the project is included in the demo, as is the most recent tonclib because the demo would not have been possible without it (at least not with a lot more code in the project itself). In a sense, it's a tonclib demo as well.

The way that grit is invoked and how its output is made available is pretty neat. I'm running a separate makefile called gfxmake which runs grit, assembles its output into a library called libgfx.a. It also collects all the separate headers into a main header file called all_gfx.h, so there will be no need to include dozens of graphics headers – just the one. I also have three sets of grit rules in here: for bitmap+.grit pairs, for .grit-less bitmaps (which use the directories main grit file) and fully custom rules for really special occasions. Like I said, pretty neat ^_^. I am pulling a few Clever Tricks in gfxmake to get all of this done and I hope to discuss these in more detail at a later time.

I'll probably add a few more examples in this demo (feel free to suggest some), but the way grit's invoked here will probably stay. Using a secondary makefile means a minimum of interference with the template makefiles and it also makes it easy to customize your projects w.r.t. graphics. As far as I'm concerned, this is the recommended path … until anyone informs me of a better plan.


Download link: /files/gritdemo.zip


Note to quirky: sorry, no palette merging in this demo yet. It will be in its follow-up.

memset16 fix

Although I know I tested the memset16() presented earlier, one instruction miraculously disappeared when posting it here. There should have been an `mov r12, r1' in the initializing of the registers for the stmia. I have no idea where it disappeared to, but with this fix the routine should run properly.

I've been having a number of this sort of errors lately, actually. I've also recently found out that the shared-tileset in the current distribution is broken because of a single character that handles it in grit_prep_map. This:

// in grit_prep.cpp, grit_prep_map
    if(gr->img_flags & GRIT_IMG_SHARED)
        rdxDib= grit_tile_reduce(&mapRec, tileDib, flags, NULL);
    else
        rdxDib= grit_tile_reduce(&mapRec, tileDib, flags, gr->shared->dib);

should have been this:

// in grit_prep.cpp, grit_prep_map
    if(~gr->img_flags & GRIT_IMG_SHARED)
        rdxDib= grit_tile_reduce(&mapRec, tileDib, flags, NULL);
    else
        rdxDib= grit_tile_reduce(&mapRec, tileDib, flags, gr->shared->dib);

The missing ~ means that the the code did exactly the wrong thing. And again, during testing I had it right (cue Twilight-zone theme).

grit mini-fix

Small fix for grit. The function that handles the extensions didn't add the extension-period as it should if no extension was given in the -o option. ‘-ofoo’ would result in things like foos and foosh.

This is a one-line fix, by the way. In /libgrit/pathfun.cpp, function path_repl_ext(), replace this:

    if(pext)
        strcpy(pext, ext);			
    else
        strcat(str, ext);
by this
    if(pext)
        strcpy(pext, ext);			
    else
    {
        strcat(str, ".");
        strcat(str, ext);
    }

This is not really a critical update. As long as there's an extension-period inside the -o option, or if there was no -o to start with, it should work fine as is.

grit mini-fix

The quantizer for true-color to paletted wasn't properly prepared for the BGR order that big-endian systems use. This has been fixed. As this has no effect on little-endian systems (such as the binaries that you can find here), only the source archive has been updated.

grit and usenti updates

Git is now fully at 0.7. Or, rather, grit is at 0.7. As mentioned before, a name-change was in order and this has now taken place.

Other than that, there is little difference. Dovoto pointed to a bug in the tileset directory code which made me finally deal with the way directories were being handled. Unless told otherwise, the output goes into the current working directory. This is how it should be anyway. Non-binary changes are: updated documentation (for grit itself too) and a modified Makefile because it was out of date with the code itself (thanks Richard).

What's not been added are palette reduction and a more general tileset reducer. I have functions that can do these things (inside cldib), but applying them in the grit code base is … icky. There are so many potential problems with options here that I prefer to wait and add them later. Or maybe make separate tools for them.


I've also added the new Wingrit exporter to Usenti, which is now at v1.7.7.

git/grit 0.7β

Guess this'll be it then. Like the last Tonc, this is beta, which is my way of saying “lots of nice, new stuff, but might not be completely ready yet”.

So what's new? Well ...

  • The transparency options (-pT, -gT) should be sorted out now. I've tried to make them work intelligently when the options and bitdepths don't really match well.
  • It's now also possible to convert multiple bitmaps in one single call of git. Be careful which options you use here, though, as they're still pretty much considered separate runs internally. For instance specifying the output file and not using -fa would overwrite the file. Obvious, yes, but still something to be aware of.
  • Also added are logging functions (option -Wnumber). If you see your files converted incorrectly, try using -W3 and see what comes up.
  • And finally, something pretty cool: the use of an external tileset. With the -fx option, you can use an external bitmap containing an already reduced tileset. This is useful if you want to guarantee the order of the tiles. New tiles will be added and saved to this bitmap as well, so you could run it over multiple bitmaps and build up a shared tileset. It's still a little experimental, but seems to work well enough. For now, stick to 8bpp BMP or PNG (preferably pre-tiled or start with an empty bitmap). I hope to add meta-tiling options later.

Wingit has also been updated a little: transparency options are now included in the GUI, as it the external tileset option. However, the documentation hasn't been updated for these yet. That's one of the todo items.


The git downloads can be found here. Once again, this is still beta. On the outside it looks alright, but internally it's still a bit of a mess now. It's also quite possible that there are still some lose pointers dangling about; if you see it crash, please tell me.


It's been brought to my attention that the name ‘git’ was already taken by that pinko, commie tree-huggering bunch from Linux. So, a name change is in order. Shame; I really liked the name.

Anyway, unless someone can give me a nice and descriptive acronym (sorry, Dave, but ‘dmit’, as much as I like it, fails on the second criterion), the new name be ‘grit’.


And now for something moderately different: I've added the readme's of most projects to the projects page. This should be especially useful for git, as the distribution that comes with devkitPro leaves it out >_>.