Libcastor 0.1


Super Duper Mega GP Mania
Mar 22, 2006
For anybody who already has a Wiz, here is something to try if you are bored. For everybody else, maybe it will be interesting to look at, who knows? ;)

libcastor is a small library designed to give direct hardware access under Linux on the Wiz. Somewhat similar to Minimal Library on the GP2X, however [I would like to think] it is a bit simpler to use and doesn't require that you include the source into your tree (so if there were a hardware update and you had dynamically linked for example, a new library could simply be copied over to deal with any changes).

It is currently usable, though not complete (no alpha blending etc.). The README has a bit of information, though the documentation it refers to does not yet exist :D. Just look through <castor.h> for now, it has information on all the functions and constants included as comments.

Thanks for working on this Orkie :) I finally got some free time to play around with it a bit, looks very promising. It's nice that it doesn't conflict with SDL_mixer, that's the only part of SDL I wouldn't like to give up.

Do you have any plans for implementing accurate tick counters? Those are something really lacking in the default libs.

By the way, I found that drawing to a malloc'ed buffer and copying that to fb1 every frame produces smoother results than drawing directly to fb1 and calling lc_flipfb(1) at the end. Perhaps I'm using it wrong though, looking forward to the documentation :) By the way, why are there 2 layers? Does the hardware support alpha-blending one over the other?
To be honest, I haven't tested the drawing completely - I just use coloured bars to test :D. If there are any free DMA channels, maybe one of those could be used, I don't know yet. I do plan to put in support for the accurate hardware timers.

There are various things you can do with the 2 RGB layers. You can make both of them whatever sizes and place them however you like. You can set a background colour for areas where no picture data is drawn. For each layer you can have transparent colours. Also, you can set an 'inversion' colour so that any colours below it are inverted where an upper layer has the specified colour set. There is alpha blending between the surfaces possible and I think per-pixel alpha is also supported.

There is also another layer for which I have no support in libcastor at the moment, which is YUV. That supports the same resizing/positioning options as the RGB layers and I think transparency and alpha too (but I'm not certain about those two). It also has scaling in hardware with optional bilinear filtering.
That sounds wonderful, all those effects will open the doors for some really nifty homebrew :) Thanks again for your work, hopefully a lot of people will make good use of it!
Yeah, I did think the YUV layer in particular could be neat if a video library were set up to output to it. Video backgrounds would be fun, and what about a TV in a game which actually plays video? :D