# Tonc cleanup and fixes

I've uploaded some newer tonc files today, mostly for devkitArm r21 compatibility. Because the linkscript for multiboot got b0rken somehow, I had to change all the demos to default to cart-builds. I intended to change to cart-boot later anyway, but not being able to build the demos properly with the latest devkit kinda forces me to do it now. I've also had to change the tier-3 makefiles because it used -fno-expections' in the CXXFLAGS. This should of course have been -fno-exceptions' (thanks muff).

There have also been a few changes in the text parts: build-specs are set to cart-boot there too now, and I fixed some broken links. I've also fixed a slew of spelling and grammar issues that Patater sent in. These part of the text shouldn't be gibberish anymore – just unintelligible :P.

# Usenti 1.7.8 and TTE demo

One major and some smaller changes to usenti. The major one is that there is now a font exporter that can convert bitmaps to TTE-usable fonts. I'm not sure if it's final yet, but any later changes should be small. The text-tool has been altered to facilitate creation of fonts by adding an opaque mode, an align-to-grid option and proper clipboard support (so you should be able to just copy an ASCII table into it, at which point the font is practically made already).

Also, there are separate pasting modes: one that matches the colors to the current palette (potentially mixing up the colors) and a direct-pixel paste, regardless of colors. Thanks, gauauu, for finally making me do this. Secondly, Kawa's been badgering me (politely) about editing colors in raw hex rather than via RGB triplets. This can be found, for various bad reasons, under the Palette menu under ‘Advanced color edit’.

Both of these items have … interesting side effects. Through the former, you can replace colors of a given palette-entry by copy-all, swap and paste. The color-edit accepts multiple colors separated by white-space and, later on, by commas as well, meaning that accidentally it's now possible to take previously exported palettes and add them again. Yes, it's feep, but it's interesting, somewhat hidden and cheap feep, so that's alright. I'm thinking about adding something similar for the image itself as well (plus raw image imports), but only when I'm bored enough.

To show off the font exporter and the TTE system itself, there is a little demo of what it can do here. I'm still pondering over what it should and should not be able to do, but most of the things shown in the demo would be in the final version as well.

Oh, RE: that wordpress bug. A v2.3.1 has been released now with the fix. Interesting factoid: the error (#5088) was classified as “highestomgbbq”.

# new tonclib

I've been making a lot of changes to tonclib – mostly adding, but also some removals. The most important changes are:

• A more unified interface for the base drawing routines. Whereas I used to have something like bm8_foo(...), I now have bmp8_foo(..., void *dstBase, u32 dstPitch) for everything. Although the extra parameters make the routines a little slower, it makes it easier to switch video-modes.
• A few color routines like blending/fading, convert to rgbscale (like grayscale, but for any color vector) and a few color adjustments.
• I'm trying to include (well, annex, really) some of libgba's functionality. In terms of shared functionality, the libgba names can be used by including tonc_libgba.h. This is definitely not a finished item yet.
• Tonc's Text Engine. I already had some basic routines for text on different video types, but this is a good deal better. Instead of having separate foo_puts() routines, TTE uses function pointers for placing glyphs on screen. This means there can be a single interface for all modes, and customizable writers. Already provides are glyph renderers for 8/16bit bitmaps and 4bit tiles, using a 1bpp bitpacked font. In principle, the renderers can handle any sized fixed and variable-width fonts (within reason: 128x128 fonts would be impractical, for example). There are also hooks for the stdio functions (printf, yay!) and some simple commands for positioning, color and font changes. Example of use:
// Set-up 4bpp tile rendering bg 0 using cbb=0 and sbb=31.
// The default options set implicitly here are: verdana 9 font, yellow for
// text color
tte_init_chr4_dflt(0, BG_CBB(0)|BG_SBB(31));
// Init stdio hooks
tte_init_con();
// Print something at position (10,10)
iprintf("\\{P:10,10}'Ello world!, %d", 1337);

Aside from the initializer, using TTE is basically independent of what you're writing with or on. Of course, all this stuff does have a fair amount of per-character overhead (about 150 cycles, I believe). It shouldn't be too hard to port TTE to NDS; I am planning to do this at some point.

There are more smaller changes here and there, but those are of lesser consequence.

tonclib 1.3 linky.

# More tonc 1.3β

Dammit, just missed releasing this before the end of the day. Oh well. Anyway, I'm releasing tonc 1.3β officially now. Yes, it's still a beta, but I think I've got rid of all of the loose ends now. Or at least most of them

The changes with the last beta version are relatively few. The text remains mostly the same, except for regbg.htm and asm.htm. It's in the code where you'll find the most changes. I've removed the leading underscores from the zero-#defines (and there was much rejoicing), updated some graphics and ‘finished’ the bigmap demo. Also, tonclib is now fully doxygenated. Manual in CHM inside. The Doxygen configuration file is included, so if the CHM doesn't work for you, you can always generate the documentation yourself.

# tonc 1.3β

I'm close to another tonc release. It's not quite ready, but here are a few Work-in-Progress versions.

Many things have changed. Tonclib has gone through a rigorous overhaul, the demo hierarchy has been altered, with new and better makefiles. Most demos have been altered (mostly just using text), the ‘basic’ demos are now completely self-contained, and I've added a couple of new ones as well. Take particular note of the updated DMA and mode7_ex demos, and the new bigmap demo.

The text has undergone a few changes as well. Much of the set-up chapter has been moved to the back, and reg-tables have been prettified. The mode7-2 chapter has been enhanced and (drumroll) there's now an assembly chapter! A big assembly chapter. The numbering system now has chapter numbers, and each section, equation, etc, is now prefixed with it.

You might have noticed that there's now a PDF file as well. I've merged all the chapters with some perl-fu, and printed to PDF with cutePDF. The solution is not optimal yet (some bad page breaks here and there), but the result looks very nice indeed. If anyone's interested in helping me get rid of the page-break problem, I have 1.4MB html file if anyone's interested playing with that. I'll probably release the scripts I used for various items as well someday.

In other news, git 0.6 didn't quite do the NDS transparency bit correctly. In fact, it completely did it wrong. I'd release the fix soon, if it weren't for the fact that it will probably be released as part of the new devkitPro before that.