PDA

View Full Version : Process for dumping/replacing sub colours programatically?


Matthew
6th February 2006, 08:07
I'm writing a cli app for personal use that will dump the palette for a PGC in an ifo in its native format, or overwrite the palette of an authored IFO with one supplied.

Here is the process I am using to get the start of the colour values for PGC N:
-Seek to byte 204
-Read the following 4 bytes to get the sector pointer to VTS_PGCITI
-Multiple above value by 2048 to get the start byte of VTS_PGCITI - say X
-Seek to byte X + 8 + ((N - 1) * 8) + 4
-Read the following 4 bytes to get the start byte of PGC N - say Y.

Then it's a case of dumping the 64 bytes from X+Y+164+1, or alternatively replacing those bytes with the values in an input file.

Does this sound right? I was wondering, for example, if it's possible for the PGC order at the top of VTS_PGCITI to be nonsequential, in which case I could get the colours for the wrong PGC.

r0lZ
6th February 2006, 14:31
Right!
The PGCs are always sequentially stored in the VTS_PGCITI table.
(It's a little bit more complicated in the menu's VTSM_PGCI_UT tables, because you have to take the language units into account.)

IMO, the real beginning of the CLUT is at X+Y+164. The first byte is not used, but since there are 4 bytes per color, you should keep it also for color #0. The format of one color entry is:
<null byte><Y><CR><CB>

Note that there are functions in PgcEdit's PGC Editor to export and import the color table in raw or ASCII format. But of course, PgcEdit is not a CLI app.

Matthew
6th February 2006, 23:28
Thanks for the information, it's appreciated :)

After posting I realised I should have asked whether the colour table began with a null byte, it didn't seem to make sense, so that's why I added the +1 even though it didn't appear to align with the spec at sourceforge. I'll fix that.

This is part of an automated process (my brother plans to make 48 DVDs using it), and I wanted a way off copying across the palette after MuxMan is complete, and before mkisofs is run, so I needed cli. Only RGB can be specified in the mxp, and I didn't want the conversion error.