just re-read that first post and it may appear confusing. i thought maybe i'll use one of the example files above and display hex offsets of what i know... and what i think may be...
i skipped ahead and read to the offset where the vertices count is found. the first mesh has 2103 vertices.
just an observation of below, where i read 4 byte unsigned ints in some areas, may be 2 byte unsigned ints followed by 0000? eg. "20000000" may be seen as "2000" (2) and "0000" (0)? or it could just be the id of the file type? *iunno*
***
another update to this file; i've found a second "clut" just above the second character model...! i was just reading back through the data below and thought why not search for unusual numbers from the clut like (0C000000 - 12) and (0E000000 - 14). i found alot of "0C000000" but one actually landed me around 0x00029A3C (slightly above the second character model...!). i recognised this section was similar to the "clut" at the top of the file... the top clut (as far as i could tell) ended at 0x000000DC (just before 03000000) - and is 0x000000D0 (208 bytes) long. so from 0x00029A3C - 0x00029B0C is 0x000000D0 (208 bytes) long. this lands me just before 03000000! this must be the start of the second character model? 8 bytes before 0x00029A3C is "03000000" & "00000000"...! its late here and im tired... also tired of staring at 0's and 1's... for now!
***
Code: Select all
file # [5245] - 388,432 bytes
@ 0x00000000
07000000 - (7) id [4 byte unsigned int]
40ED0500 - (388416) chunk size [4 byte 32 int]
00000000 - (zero) unknown, always [4 byte unsigned int]
9567 - (26517) unknown, maybe the size of the first section of data? [2 byte unsigned int]
68DE - (56936) unknown, maybe the size of the second section of data? [2 byte unsigned int]
02000000 - (2) unknown, maybe the file type/id of the first section of data? [4 byte unsigned int]
5094 - (37968) unknown, size for something? [2 byte unsigned int] - [4 byte signed int reads a negative value]
0100 - (1) unknown, appears alot in the following data. maybe its a value to describe how to read the following data? [2 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
8508 - (2181) unknown, size for something? [2 byte unsigned int]
0839 - (14600) unknown, size for something? [2 byte unsigned int]
47000000 - (71) id? [4 byte unsigned int] appears alot in the following data. maybe it describes models with bones?
3092 - (37424) unknown, size for something? [2 byte unsigned int]
0100 - (1) unknown, appears alot in the following data. [2 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
FA6C - (27898) unknown, size for something? [2 byte unsigned int]
1E4C - (19486) unknown, size for something? [2 byte unsigned int]
10000000 - (1) unknown, maybe its a value to describe how to read the following data? [4 byte unsigned int]
1B92 - (37403) unknown, size for something? [2 byte unsigned int]
0100 - (1) unknown, appears alot in the following data. [2 byte unsigned int]
0A00 - (10) unknown, [2 byte unsigned int]
021C - (7170) unknown, appears alot in the following data. [2 byte unsigned int]
10000000 - (1) unknown, maybe its a value to describe how to read the following data? [4 byte unsigned int]
0C000000 - (12) unknown, id? [4 byte unsigned int]
0A00 - (10) unknown, [2 byte unsigned int]
021C - (7170) unknown, appears alot in the following data. [2 byte unsigned int]
10000000 - (1) unknown, maybe its a value to describe how to read the following data? [4 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
0E000000 - (14) unknown, id? [4 byte unsigned int]
5C0D - (3420) unknown, [2 byte unsigned int]
0000 - (zero) unknown, [2 byte unsigned int]
0A00 - (10) unknown, [2 byte unsigned int]
021C - (7170) unknown, [2 byte unsigned int]
01000000 - (1) unknown, maybe its a value to describe how to read the following data? [4 byte unsigned int]
3C07 - (1852) unknown, [2 byte unsigned int]
0000 - (zero) unknown, [2 byte unsigned int]
0A00 - (10) unknown, [2 byte unsigned int]
021C - (7170) unknown, [2 byte unsigned int]
2100 - (33) unknown, [2 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
803F - (16256) unknown, [2 byte unsigned int]
0000 - (0) unknown, [2 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
803F - (16256) unknown, [2 byte unsigned int]
0000 - (0) unknown, [2 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
803F - (16256) unknown, [2 byte unsigned int]
0000 - (0) unknown, [2 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
0000 - (0) unknown, [2 byte unsigned int]
0000 - (0) unknown, [2 byte unsigned int]
FFFF - (???) unknown, [4 byte ???]
FFFF - (???) unknown, [4 byte ???]
0300 - (3) unknown, [2 byte unsigned int]
02000000 - (2) unknown, maybe the file type/id of this section of data? [4 byte unsigned int]
803F - (16256) unknown, [2 byte unsigned int]
0000 - (0) unknown, [2 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
00000000 - unknown, [4 byte unsigned int]
803F - (16256) unknown, [2 byte unsigned int]
0000 - (zero) unknown, [2 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
00000000 - unknown, [4 byte unsigned int]
803F - (16256) unknown, [2 byte unsigned int]
0000 - (zero) unknown, [2 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
00000000 - (zero) unknown, [4 byte unsigned int]
0000 - (zero) unknown, [2 byte unsigned int]
<end of clut?>
03000000 - unknown, maybe the file type/id of the first section of data? (3) [4 byte unsigned int]
<more data?>
...
i just wanted to run this past you folk. this is how i read the file in my hex editor. am i on the right track? i find it confusing sometimes whether i am meant to read two or four byte unsigned ints?
the wikipedia page for the gta sa clut structure is not the same as this... damn it.
...
onto the juicy stuff. searching for "140000000A00021C0100000001000000" takes me to offset 0x00000ED0 (from the top of the page).
Code: Select all
@ 0x00000ED0
37080000 - vertices count (2103) [4 byte unsigned int]
37080000 - vertices count, again? (2103) [4 byte unsigned int]
...
the following data i have no idea what it is. i highlight 00000000 in my hex editor and set the background colour for every instance of it to blue and i begin to see a pattern. i dont have the foggiest what this data is. i hope its the skeleton?
...
searching for "000000170000001100000011" takes me to offset 0x00004080 (from the top of the page).
Code: Select all
@ 0x00004080 - 0x00008238 (16824 bytes)
read [16824 bytes] (2103 * 8 = 16824). this is the vertices data. x,y,z,w?
@ 0x00008238 - 0x0000C400 (16840 bytes)
at the end of the vertex data, i visually scroll down until i see a change/break in data. i end up with a value of 0x000041C8 (16840). i know theres a break in the data because the next set of data is "000000FF". 16840 - 16824 (vertices count) = 16. whatever the data is, its a division of 4. i would store my model data as vertex, normals, uv, skeleton. however, normals, as far as i am aware, are stored as three floats? unless theres some type of averaging value at the end? can this be the normals data?
@0x0000C400 - 0x0000E4DC (8412 bytes)
at the end of the previous data, i can visually see lots of "000000FF"'s. in fact, theres 2103 (same number as our vertices count!) of them. 2103 * 4 = 8412. is this the uv coords? the model is stored in a triangle strip... would this be correct?
@0x0000E4DC - 0x000194B4 (45016 bytes)
at the end of the previous data, i visually scroll down until i see a change/break in data. i make my way down and bump into some recognisable ascii text! "PS2" (50533200 - finished with a 0 termination) and "orph_bo_v1" (6F7270685F626F5F76310000 - finished with a 00 termination - a fixed 12 bytes long!). this appears at the start of what i suspect is an image file. i have found other image files that are labled loading screens that are 68 bytes from 0x00000000 (start of file) to "PS2". so i am reading from 0x0000E4DC to 0x000194B4 (45016 bytes). it's a large read, and i am convinced theres possibly multiple things between 0x0000E4DC and 0x000194B4 that i visually could not pin point. i may also be off by 36 bytes here (45016 - 36 bytes?)???
@0x000194B4 - 0x0002A1D0 (68892 bytes)
after the last chunk of data, i only sligtly scroll down and can see "PS2" 68 bytes from 0x000194B4. i then scroll down and believe theres a pallette, followed by rgba? this is definately the texture data...
***
another update to this texture data; i did a search on "PS2" (50533200) and found five instances! they were called;
Code: Select all
@ 0x000194E4
"orph_bo_v1" (6F7270685F626F5F76310000) // "bo" stands for boss? this is the first result after the first character model...!
@ 0x000416E4
"orph_lt_va" (6F7270685F6C745F76610000) // "lt" stands for leutenant? this is the first result after the second character model...!
@ 0x00051C94
"orph_so_va2" (6F7270685F736F5F76613200) // "so" stands for soldier?
@ 0x00056244
"orph_so_vb1" (6F7270685F736F5F76623100)
@ 0x0005A7F4
"orph_so_vb2" (6F7270685F736F5F76623200)
side note; when you beat the snot out of a character, the texture changes to a "bloodied" version! so cool
***
...
following the above, there appears to be another clut just before the second character model!
...
wheeew!
thanks!