ClutAdd V0.1 TIM File CLUT Table Appender. ------- ---- --- ---- ---- ----- --------- 0. Index. -- ------ 1 - Legal Info 2 - What is CLUTADD? 3 - How to use CLUTADD 4 - Command line options 5 - Miscellaneous 6 - Version history. 1. Legal info. -- ----------- Copyright 1998 Dominic F. A. Collins. This program has been released as freeware. You may freely distribute copies of this program for non-profit purposes, as long as this text file always accompanies it, and you do not modify it or try to pass it off as your own work. This program was written for my own personal use. I have made it available to others in case it may be useful to them. In no way do I offer any guarantee that this software is bug-free, or suitable for a particular purpose. By using this program, you agree not to hold me responsible for any harmful consequences this may bring, up to the legal limits of exclusion of liability which apply to you. 2. What is CLUTADD? -- ---------------- When I tried writing a game for the Net Yaroze, I had an array of GsSPRITEs as a background, with varying R, G, and B values to make them look nicer. Then, I decided to save a few hlines by using GsSortFastBG16 instead. Unfortunately, this does not support RGB manipulations. I altered the palettes of the original bitmaps and got a few TIMs with different CLUTs, but identical pixel data, and gave the pixel data the same coordinates in each TIM. However, this was a waste of space and downloading time, so I used a hex editor to cut the CLUTs out of all of the TIMs, then inserted them into one TIM and altered the header to make it work. Then I wished that there was a program to do it automatically... so I wrote this. 3. How to use CLUTADD. -- ------------------- Make a bitmap file of the sprite you want to use. Make several copies of this bitmap, then edit the palette of each bitmap in a suitable program. (You should not alter the actual pixel data unless you want to use several sprites with the same CLUT). For example, you can have several palettes with different brightnesses, or use palette transformations such as colour rotate etc. to generate special effects. Then convert the bitmaps into TIMs. Finally, use CLUTADD to add the CLUTs from all the new bitmaps to the original TIM. E.G if you have the original TIM file, 'sprite.tim', and two new files 'sprite2.tim' and 'sprite3.tim', and you want a file 'sprite123.tim' which contains the CLUTs from all three TIM files, simply type: CLUTADD sprite sprite1 sprite2 -o sprite123.tim 4. Command Line Options. -- --------------------- Syntax: CLUTADD filename.tim [[-][/]options] [filename.ext] filename.tim TIM file to add CLUTs to. filename.ext TIM/CLT/PAL file to take CLUT from Options: -help, /Help, -? Prints a help screen -d, -DEBUG Extra debug output. -c, -CLUT Import files as raw 16-bit Playstation format CLUT data. As far as I know, there is no program to extract CLUTs from TIMs, so this isn't much use yet. Default extension 'clt' -p, -PAL Import files as raw 24-bit RGB palette This will import a raw 256-colour (768-byte) or 16 colour (48 byte) RGB palette. (Not tested.) Default extension 'pal' Note that Microsoft/RIFF palettes are not supported. -t, -TIM Import files as TIM CLUTs Used to cancel -c and -p switches. Default extension 'tim' -o, -OUTPUT Sets name for output file. (Defaults to 'A.TIM'.) The '.tim' extension is NOT added automatically. -4, -4BITCLUT Adds new 4-bit (16-colour) clut to TIM with no clut Used for adding 16-colour CLUTs to a TIM file with no CLUT block. (Not tested.) -b, -BLACKTRANSPARENT Makes black (from raw palette) transparent Only useful with .PAL palette files. (Not tested.) This is a toggle switch; to cancel, add another -b. -s, -SEETHROUGH Makes non-black colours (from raw palette) semitransparent Only useful with .PAL palette files. (Not tested.) This is a toggle switch; to cancel, add another -s. 5. Miscellaneous. -- -------------- This program has not been fully tested; in particular, I have not tested any 16-colour TIMs, or adding CLUT blocks to TIMs without them. As this program reads the input pixel data and writes the output file concurrently, things may go wrong if the pixel input file (the first file) and the output file have the same name. If you have a read cache, and don't add many CLUTs, then you can often get away with this, but it is not recommended. If the first TIM file does not have a CLUT block, the program should automatically add a CLUT block header and set the CLUT flag. However, I have not tested this feature, so I cannot promise that it will work. Also, if you mix 16-colour and 256-colour CLUTs, the results will be unpredictable; adding 16-colour CLUTs to a 256-colour TIM will join them into 256-colour CLUTs, then ignore any partially-filled 256 colour CLUTs. Adding 256-colour CLUTs to a 16-colour TIM will slice the CLUTs into 16x16-colour CLUTs. Adding a mixture of CLUTs to a CLUTless TIM will depend on whether you specify the '-4' switch or not. This program was compiled with GCC V2.7.2. You might need CWSDPMI, or another suitable DPMI program, to run it under DOS. Under Windows, it should be OK. This program will support up to 50 additional CLUT files, excluding switches and the pixel data input/output files. Only the first letter of each command line switch is significant. Upper case and lower case are interchangeable. The '-' or '/' characters can be used as switch characters, whichever you prefer. This program does not support RIFF or Microsoft palettes because I do not know the format of these files. If you desperately need these features, email me a URL where I can get file format information for these palette types. My university email address is; u6dfac@csc.liv.ac.uk This address is valid until June 1999. My email is checked once a fortnight in vacations, and every weekday in term time. 6. Version History. -- ---------------- 0.1: 256-colour CLUTs work (I think). Nothing else tested. First public release. 0.0: Didn't work. Wouldn't compile.