Graphic Image Map (GIM): Difference between revisions

From PS3 Developer wiki
Jump to navigation Jump to search
 
(77 intermediate revisions by the same user not shown)
Line 2: Line 2:


=Description=
=Description=
'''G'''raphic '''I'''mage '''M'''ap ? ('''GIM''') is an image format, allows for tenths of different storage settings and by combining settings results in hundreds (or thousands) of different GIM files that are structurally different, to simplify concepts people is naming this different GIM files as "GIM formats" but strictly speaking the GIM format is always the same, the amount of GIM formats used in PlayStation consoles is limited though (restricted by the graphic enviroment, libraries, etc...). GIM files was found used in PSP and PS3 firmwares inside [[Resource Container (RCO)]] files, [[PlayStation 3 Theme (P3T)]] files, etc... See [[GimConv]] and [[Multimedia Formats and Tools#GIM]]
'''G'''raphic '''I'''mage '''M'''ap ? ('''GIM''') is an image format that allows for lot of different settings that results in lot of different GIM files that are structurally different, strictly speaking the GIM format is always the same, but generally speaking it can be said that this different GIM files are "GIM formats", the amount of GIM formats supported by PlayStation consoles is limited though (restricted by the graphic enviroment, libraries, etc...). GIM files was found in PSP and PS3 firmwares inside [[Resource Container (RCO)]] files, [[PlayStation 3 Theme (P3T)]] files, etc... See [[GimConv]] and [[Multimedia Formats and Tools#GIM]]


The acronym of GIM used in this wiki ('''G'''raphic '''I'''mage '''M'''ap) is an speculative unnofficial name based in how the data is stored in the internal GIM structure, if someone finds the official codename somewhere please report back and we will change it <!-- no luck on facebook https://www.facebook.com/hhhhhyuk? -->
The meaning of the "GIM" acronym used in this wiki ('''G'''raphic '''I'''mage '''M'''ap) is an speculative unnofficial name based in how the data is stored in the internal GIM structure, if someone finds the official codename please report back and we will change it<!-- no luck on facebook https://www.facebook.com/hhhhhyuk? -->


=Structure=
=Structure=
 
*Overview (4 unknown values left, marked in intense red)
*Overview
  Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
  Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
   
   
  00000000  <span style="background:#666666; color:#ffffff;">2E 47 49 4D</span> <span style="background:#666666; color:#ffffff;">31 2E 30 30</span> <span style="background:#666666; color:#ffffff;">00 50 53 50</span> <span style="background:#666666; color:#ffffff;">00 00 00 00</span>  .GIM1.00.PSP....    <- GIM header
  00000000  <span style="background:#000000; color:#ffffff;">2E 47 49 4D</span> <span style="background:#000000; color:#ffffff;">31 2E 30 30</span> <span style="background:#000000; color:#ffffff;">00 50 53 50</span> <span style="background:#000000; color:#ffffff;">00 00 00 00</span>  .GIM1.00.PSP....    <- GIM header
  00000010  <span style="background:#ff9933; color:#ffffff;">00 02</span> <span style="background:#FF7777;">00 00</span> <span style="background:#ffff00;">00 00 00 EC</span> <span style="background:#ffff99;">00 00 00 10</span> <span style="background:#FF7777;">00 00 00 10</span>  .......ì........    <- Block 0x02 header
  00000010  <span style="background:#ff8c1a; color:#ffffff;">00 02</span> <span style="background:#FF4444;">00 00</span> <span style="background:#ffcc00;">00 00 00 EC</span> <span style="background:#ffff00;">00 00 00 10</span> <span style="background:#ffffb3;">00 00 00 10</span>  .......ì........    <- Block 0x02 header (Root)
  00000020  <span style="background:#ff9933; color:#ffffff;">00 03</span> <span style="background:#FF7777;">00 00</span> <span style="background:#ffff00;">00 00 00 80</span> <span style="background:#ffff99;">00 00 00 10</span> <span style="background:#FF7777;">00 00 00 10</span>  .......€........     <- Block 0x03 header
  00000020  <span style="background:#ff8c1a; color:#ffffff;">00 03</span> <span style="background:#FF4444;">00 00</span> <span style="background:#ffcc00;">00 00 00 80</span> <span style="background:#ffff00;">00 00 00 10</span> <span style="background:#ffffb3;">00 00 00 10</span>  .......€........       <- Block 0x03 header (Picture)
  00000030  <span style="background:#ff9933; color:#ffffff;">00 04</span> <span style="background:#FF7777;">00 00</span> <span style="background:#ffff00;">00 00 00 70</span> <span style="background:#ffff99;">00 00 00 70</span> <span style="background:#FF7777;">00 00 00 10</span>  .......p...p....     <- Block 0x04 header
  00000030  <span style="background:#ff8c1a; color:#ffffff;">00 04</span> <span style="background:#FF4444;">00 00</span> <span style="background:#ffcc00;">00 00 00 70</span> <span style="background:#ffff00;">00 00 00 70</span> <span style="background:#ffffb3;">00 00 00 10</span>  .......p...p....           <- Block 0x04 header (Image)
  00000040  00 30 00 00 00 03 00 00 00 04 00 02 00 20 00 10  .0........... ..     <- Block 0x04 Info
  00000040  <span style="background:#11bbee;">00 30</span> <span style="background:#FF4444;">00 00</span> <span style="background:#240B7B; color:#ffffff;">00 03</span> <span style="background:#3212A3; color:#ffffff;">00 00</span> <span style="background:#6144c7;">00 04</span> <span style="background:#6144c7;">00 02</span> <span style="background:#826ad5;">00 20</span> <span style="background:#b49aed;">00 10</span> .0........... ..             <- Block 0x04 Data
  00000050  00 01 00 02 00 00 00 00 00 00 00 30 00 00 00 40  ...........0...@     <- Block 0x04 Info
  00000050  <span style="background:#b49aed;">00 01</span> <span style="background:#FF4444;">00 02</span> <span style="background:#FF4444;">00 00 00 00</span> <span style="background:#CA2691;">00 00 00 30</span> <span style="background:#CA2691;">00 00 00 40</span> ...........0...@             <- Block 0x04 Data
  00000060  00 00 00 60 00 00 00 00 00 01 00 01 00 03 00 01  ...`............     <- Block 0x04 Info
  00000060  <span style="background:#CA2691;">00 00 00 60</span> <span style="background:#009933;">00 00 00 00</span> <span style="background:#33cc33; color:#ffffff;">00 01</span> <span style="background:#33cc33;">00 01</span> <span style="background:#4dff4d; color:#ffffff;">00 03</span> <span style="background:#4dff4d;">00 01</span> ...`............             <- Block 0x04 Data
  00000070  00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00  ...@............     <- Block 0x04 Info
  00000070  <span style="background:#555555; color:#ffffff;">00 00 00 40</span> <span style="background:#D3D3D3;">00 00 00 00 00 00 00 00 00 00 00 00</span> ...@............             <- Block 0x04 Index
  00000080  <span style="background:#CA5E24;">CA 5E 11 00 CA 5E 12 00 CA 5E 13 00 CA 5E 14 00</span>  Ê^..Ê^..Ê^..Ê^..     <- Block 0x04 Pixels
  00000080  <span style="background:#CA5E24;">CA 5E 11 00 CA 5E 12 00 CA 5E 13 00 CA 5E 14 00</span>  Ê^..Ê^..Ê^..Ê^..                 <- Block 0x04 Frame
  00000090  <span style="background:#CA5E24;">CA 5E 21 00 CA 5E 22 00 CA 5E 23 00 CA 5E 24 00</span>  Ê^!.Ê^".Ê^#.Ê^$.     <- Block 0x04 Pixels
  00000090  <span style="background:#CA5E24;">CA 5E 21 00 CA 5E 22 00 CA 5E 23 00 CA 5E 24 00</span>  Ê^!.Ê^".Ê^#.Ê^$.                 <- Block 0x04 Frame
  000000A0  <span style="background:#ff9933; color:#ffffff;">00 FF</span> <span style="background:#FF7777;">00 00</span> <span style="background:#ffff00;">00 00 00 5C</span> <span style="background:#ffff99;">00 00 00 5C</span> <span style="background:#FF7777;">00 00 00 10</span>  .ÿ.....\...\....     <- Block 0xFF header
  000000A0  <span style="background:#ff8c1a; color:#ffffff;">00 FF</span> <span style="background:#FF4444;">00 00</span> <span style="background:#ffcc00;">00 00 00 5C</span> <span style="background:#ffff00;">00 00 00 5C</span> <span style="background:#ffffb3;">00 00 00 10</span>  .ÿ.....\...\....       <- Block 0xFF header (Fileinfo)
  000000B0  <span style="background:#ccaa88;">34 78 32 5F 43 41 35 45 78 79 5F 33 32 62 69 74</span>  4x2_CA5Exy_32bit     <- Block 0xFF Data
  000000B0  <span style="background:#ccaa88;">34 78 32 5F 43 41 35 45 78 79 5F 33 32 62 69 74</span>  4x2_CA5Exy_32bit           <- Block 0xFF Strings
  000000C0  <span style="background:#ccaa88;">73 2E 62 6D 70 00</span> <span style="background:#ccaa88;">41 64 6D 69 6E 69 73 74 72 61</span>  s.bmp.Administra     <- Block 0xFF Data
  000000C0  <span style="background:#ccaa88;">73 2E 62 6D 70 00</span> <span style="background:#ddbb99;">41 64 6D 69 6E 69 73 74 72 61</span>  s.bmp.Administra           <- Block 0xFF Strings
  000000D0  <span style="background:#ccaa88;">74 6F 72 00</span> <span style="background:#ccaa88;">53 75 6E 20 41 70 72 20 31 35 20 30</span>  tor.Sun Apr 15 0     <- Block 0xFF Data
  000000D0  <span style="background:#ddbb99;">74 6F 72 00</span> <span style="background:#eeccaa;">53 75 6E 20 41 70 72 20 31 35 20 30</span>  tor.Sun Apr 15 0           <- Block 0xFF Strings
  000000E0  <span style="background:#ccaa88;">31 3A 32 35 3A 30 32 20 32 30 31 38 00</span> <span style="background:#ccaa88;">47 69 6D</span>  1:25:02 2018.Gim     <- Block 0xFF Data
  000000E0  <span style="background:#eeccaa;">31 3A 32 35 3A 30 32 20 32 30 31 38 00</span> <span style="background:#ffddbb;">47 69 6D</span>  1:25:02 2018.Gim           <- Block 0xFF Strings
  000000F0  <span style="background:#ccaa88;">43 6F 6E 76 20 31 2E 32 30 68 00</span> <span style="background:#aaaaaa;">00</span>              Conv 1.20h..         <- Block 0xFF Data
  000000F0  <span style="background:#ffddbb;">43 6F 6E 76 20 31 2E 32 30 68 00</span> <span style="background:#D3D3D3;">00</span>              Conv 1.20h..               <- Block 0xFF Strings
 
*Blocks are aligned to 4 bytes boundary, the byte at the end in the example is padding


==GIM header==
==GIM header==
Line 36: Line 33:
! Offset !! Length !! Example !! Name !! Description !! Notes
! Offset !! Length !! Example !! Name !! Description !! Notes
|-
|-
| 0x00 || 0x04 || 2E 47 49 4D || {{cellcolors|#666666|#ffffff}} '''gim_signature''' || .GIM ||  
| 0x00 || 0x04 || .GIM || {{cellcolors|#000000|#ffffff}} '''signature''' || little = MIG.<br>big = .GIM || This is the first place affected by '''format_endian''' in [[GimConv]].cfg
|-
|-
| 0x04 || 0x04 || 31 2E 30 30 || {{cellcolors|#666666|#ffffff}} '''gim_version''' || 1.00 ||
| 0x04 || 0x04 || 1.00 || {{cellcolors|#000000|#ffffff}} '''version''' || || Always 1.00 ?
|-
|-
| 0x08 || 0x04 || 00 50 53 50 || {{cellcolors|#666666|#ffffff}} <abbr title="this is named format_style in gimconv.exe with only 3 options available: std, psp, ps3">'''gim_style'''</abbr> || PSP ||  
| 0x08 || 0x04 || PSP || {{cellcolors|#000000|#ffffff}} '''format_style''' || std = nothing<br>ps3 = nothing<br>psp = PSP || Configured by '''format_style''' in [[GimConv]].cfg
|-
|-
| 0x0C || 0x04 || 00 00 00 00 || {{cellcolors|#666666|#ffffff}} <abbr title="Always 0x00 ?">''gim_unk''</abbr> || Unknown ||  
| 0x0C || 0x04 || 00 00 00 00 || {{cellcolors|#000000|#ffffff}} ''padding/unused'' ? || Unknown || Always 0 ?
|}
|}


Line 51: Line 48:
! Offset !! Length !! Example !! Name !! Description !! Notes
! Offset !! Length !! Example !! Name !! Description !! Notes
|-
|-
| 0x00 || 0x02 || 00 02 || {{cellcolors|#ff9933|#ffffff}} '''block_id''' || Block identifyer || 0x02 = Root ? (first level)<br>0x03 = ? (second level)<br>0x04 = ? (third level)<br>0xFF = Footer (second level)
| 0x00 || 0x02 || 00 02 || {{cellcolors|#ff8c1a|#ffffff}} '''block_id''' || 0x02 = Root (first level)<br>0x03 = Picture (second level)<br>0x04 = Image (third level)<br>0x05 = Palette (third level)<br>0xFF = Fileinfo (second level) || Block identifyer
|-
|-
| 0x02 || 0x02 || 00 00 || {{cellcolors|#FF7777}} <abbr title="unknown">''block_unk1''</abbr> || Unknown || 0x00 = ?<br>0x10 = ?
| 0x02 || 0x02 || 00 00 || {{cellcolors|#FF4444}} <abbr title="block header unknown">''block_unk''</abbr> || 0x00 = ?<br>0x10 = ? || <abbr title="Filling this area with 0xFF doesnt causes any change">Unknown</abbr>
|-
|-
| 0x04 || 0x04 || 00 00 01 0C || {{cellcolors|#ffff00}} '''block_size''' || Size of this block + children blocks ||  
| 0x04 || 0x04 || 00 00 00 EC || {{cellcolors|#ffcc00}} '''block_size''' || Size of this block + children blocks ||  
|-
|-
| 0x08 || 0x04 || 00 00 00 10 || {{cellcolors|#ffff99}} '''block_next''' || Next block relative offset ||  
| 0x08 || 0x04 || 00 00 00 10 || {{cellcolors|#ffff00}} '''block_header_next''' || Next block relative offset ||  
|-
|-
| 0x0C || 0x04 || 00 00 00 10 || {{cellcolors|#FF7777}} <abbr title="block_data_offset">''block_unk2''</abbr> || Block data relative offset ? || 0x10 = ?
| 0x0C || 0x04 || 00 00 00 10 || {{cellcolors|#ffffb3}} '''block_data_offset''' || Block data relative offset ||  
|}
|}
This is a representation of the block hierarchy in the example:
-0x02
  -0x03
    -0x04
  -0xFF


==Block data (by block ID)==
==Block data (by block ID)==


===0x02 (root)===
===0x02 (Root)===
Empty/unknown. Is the parent of 0x03 and 0x0FF
Is the parent of block 0x03 (Picture) and 0x0FF (Fileinfo)


===0x03===
===0x03 (Picture)===
Empty/unknown. Is the parent of 0x04
Is the parent of block 0x04 (Image) and block 0x05 (Palette)
*Experimental notes
**This block is repeated when using the option '''merge_mode''' = picture


===0x04 (bitmap)===
===0x04 (Image)===
Some of the values on this area are the same than in the GIS file. Also are directly related with the available settings on GimConv.cfg (the configuration file of GimConv.exe)
The image block contains some info about the image, and the pixel color info at bottom stored as '''levels''' or '''frames'''
*Experimental notes
**This block is repeated when using the option '''merge_mode''' = image


  Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
  Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
   
   
  00000040  <span style="background:#FF7777;">00 30</span> <span style="background:#FF7777;">00 00</span> <span style="background:#6666ff; color:#ffffff;">00 03</span> <span style="background:#0000ff; color:#ffffff;">00 00</span> <span style="background:#aaaaff;">00 04</span> <span style="background:#aaaaff;">00 02</span> <span style="background:#bb77bb;">00 20</span> <span style="background:#ddddff;">00 10</span>  .0........... ..     <- Block 0x04 Info
  00000040  <span style="background:#11bbee;">00 30</span> <span style="background:#FF4444;">00 00</span> <span style="background:#240B7B; color:#ffffff;">00 03</span> <span style="background:#3212A3; color:#ffffff;">00 00</span> <span style="background:#6144c7;">00 04</span> <span style="background:#6144c7;">00 02</span> <span style="background:#826ad5;">00 20</span> <span style="background:#b49aed;">00 10</span>  .0........... ..
  00000050  <span style="background:#ddddff;">00 01</span> 00 02 00 00 00 00 00 00 00 30 00 00 00 40  ...........0...@     <- Block 0x04 Info
  00000050  <span style="background:#b49aed;">00 01</span> <span style="background:#FF4444;">00 02</span> <span style="background:#FF4444;">00 00 00 00</span> <span style="background:#CA2691;">00 00 00 30</span> <span style="background:#CA2691;">00 00 00 40</span> ...........0...@
  00000060  00 00 00 60 00 00 00 00 00 01 00 01 00 03 00 01  ...`............     <- Block 0x04 Info
  00000060  <span style="background:#CA2691;">00 00 00 60</span> <span style="background:#009933;">00 00 00 00</span> <span style="background:#33cc33; color:#ffffff;">00 01</span> <span style="background:#33cc33;">00 01</span> <span style="background:#4dff4d; color:#ffffff;">00 03</span> <span style="background:#4dff4d;">00 01</span> ...`............
00000070  00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00  ...@............    <- Block 0x04 Info


{| class="wikitable" style="font-size:small;"
{| class="wikitable" style="font-size:small;"
Line 90: Line 84:
! Offset !! Length !! Example !! Name !! Description !! Notes
! Offset !! Length !! Example !! Name !! Description !! Notes
|-
|-
| 0x00 || 0x02 || 00 30 || {{cellcolors|#FF7777}} <abbr title="block 0x04 unknown 1">''b4_unk1''</abbr> || ? ||  
| 0x00 || 0x02 || 00 30 || {{cellcolors|#11bbee}} '''block_data_lenght''' || Size of the block data|| Indicates the relative offset of the area located inmediatly after '''frame_count'''<!--modifying this value some bytes up or down "mutilates" the user_data/index areas in a GIM to GIS conversion-->
|-
| 0x02 || 0x02 || 00 00 || {{cellcolors|#FF4444}} <abbr title="block 0x04 and 0x05 unknown 1">''b45_unk1''</abbr> || ? || <abbr title="Filling this area with 0xFF doesnt causes any change">Ignored ?</abbr>
|-
| 0x04 || 0x02 || 00 03 || {{cellcolors|#240B7B|#ffffff}} '''image_format''' || {{cellcolors|lightgrey}} 0x00 = rgba5650 (16 bit no alpha)<br>0x01 = rgba5551 (16 bit sharp alpha)<br>0x02 = rgba4444 (16 bit gradient alpha)<br>0x03 = rgba8888 (32 bit gradient alpha)<br>0x04 = index4 (16 colors)<br>0x05 = index8 (256 colors)<br>0x06 = index16 (16 colors with alpha ?)<br>0x07 = index32 (256 colors with alpha ?)<br>0x08 = dxt1 (no alpha)<br>0x09 = dxt3 (sharp alpha)<br>0x0A = dxt5 (gradient alpha)<br>0x108 = dxt1ext<br>0x109 = dxt3ext<br>0x10A = dxt5ext || Configured by '''image_format''' in [[GimConv]].cfg<br>'''Format''' in the GIS
|-
| 0x06 || 0x02 || 00 00 || {{cellcolors|#3212A3|#ffffff}} '''pixel_order''' || {{cellcolors|lightgrey}} 0x00 = normal<br>0x01 = faster || Configured by '''pixel_order''' in [[GimConv]].cfg with values: normal (default) or faster<br>'''Order''' in the GIS with values: NORMAL or PSPIMAGE
|-
| 0x08 || 0x02 || 00 04 || {{cellcolors|#6144c7}} '''width''' || Image/palette width in pixels || Restricted by '''limit_image_width''' in [[GimConv]].cfg<br>'''Width''' in the GIS
|-
| 0x0A || 0x02 || 00 02 || {{cellcolors|#6144c7}} '''height''' || Image/palette height in pixels || Restricted by '''limit_image_height''' in [[GimConv]].cfg<br>'''Height''' in the GIS
|-
| 0x0C || 0x02 || 00 20 || {{cellcolors|#826ad5}} '''bpp_align''' || Image/palette <abbr title="RSX memory alignment ?. This value is used to navigate the GIM structure, doesnt represents the color depth of the image, for indexed colors is used as a counter to know how many color ID there are in the palette">alignment BPP</abbr> ||
|-
| 0x0E || 0x02 || 00 10 || {{cellcolors|#b49aed}} '''pitch_align''' || Image/palette <abbr title="RSX memory alignment ?">alignment X</abbr> || '''PitchAlign''' in the GIS
|-
|-
| 0x02 || 0x02 || 00 00 || {{cellcolors|#FF7777}} <abbr title="block 0x04 unknown 2">''b4_unk2''</abbr> || ? ||
| 0x10 || 0x02 || 00 01 || {{cellcolors|#b49aed}} '''height_align''' || Image/palette <abbr title="RSX memory alignment ?">alignment Y</abbr> || '''HeightAlign''' in the GIS
|-
|-
| 0x04 || 0x02 || 00 03 || {{cellcolors|#6666ff|#ffffff}} '''image_format''' || 0x00 = rgba5650<br>0x01 = rgba5551<br>0x02 = rgba4444<br>0x03 = rgba8888<br>0x04 = index4<br>0x05 = index8<br>0x06 = index16<br>0x07 = index32<br>0x08 = dxt1<br>0x09 = dxt3<br>0x0A = dxt5<br>0x108 = dxt1ext<br>0x109 = dxt3ext<br>0x10A = dxt5ext || '''image_format''' in [[GimConv]].cfg<br>'''Format''' in the GIS
| 0x12 || 0x02 || 00 02 || {{cellcolors|#FF4444}} <abbr title="block 0x04 and 0x05 unknown 2">''b45_unk2''</abbr> || ? || <abbr title="Filling this area with 0xFF doesnt causes any change">Ignored ?</abbr>
|-
|-
| 0x06 || 0x02 || 00 00 || {{cellcolors|#0000ff|#ffffff}} '''pixel_order''' || 0x00 = normal<br>0x10 = faster || '''pixel_order''' in [[GimConv]].cfg with values: normal (default) or faster<br>'''Order''' in the GIS with values: NORMAL or PSPIMAGE
| 0x14 || 0x04 || 00 00 00 00 || {{cellcolors|#FF4444}} <abbr title="block 0x04 and 0x05 unknown 3">''b45_unk3''</abbr> || ? || <abbr title="Filling this area with 0xFF doesnt causes any change">Ignored ?</abbr>
|-
|-
| 0x08 || 0x02 || 00 04 || {{cellcolors|#aaaaff}} '''image_width''' || Image width in pixels || '''Width''' in the GIS
| 0x18 || 0x04 || 00 00 00 30 || {{cellcolors|#CA2691}} '''index_start''' || Index relative start offset ||  
|-
|-
| 0x0A || 0x02 || 00 02 || {{cellcolors|#aaaaff}} '''image_height''' || Image height in pixels || '''Height''' in the GIS
| 0x1C || 0x04 || 00 00 00 40 || {{cellcolors|#CA2691}} '''pixels_start''' || First plane/level/frame relative start offset ||  
|-
|-
| 0x0C || 0x02 || 00 20 || {{cellcolors|#bb77bb}} '''image_bpp''' || Bits per pixel ||  
| 0x20 || 0x04 || 00 00 00 60 || {{cellcolors|#CA2691}} '''pixels_end''' || Last plane/level/frame relative end offset ||  
|-
|-
| 0x0E || 0x02 || 00 10 || {{cellcolors|#ddddff}} '''pitch_align''' || ? || '''PitchAlign''' in the GIS
| colspan="6" {{cellcolors|lightgrey}}
|-
|-
| 0x10 || 0x02 || 00 01 || {{cellcolors|#ddddff}} '''height_align''' || ? || '''HeightAlign''' in the GIS
| 0x24 || 0x04 || 00 00 00 00 || {{cellcolors|#009933}} '''plane_mask''' || Indicates a color (for alpha mask ?) || '''PlaneMask''' in the GIS
|-
| 0x28 || 0x02 || 00 01 || {{cellcolors|#33cc33|#ffffff}} '''level_type''' || {{cellcolors|lightgrey}} 0x00 = Illegal<br>0x01 = MIPMAP<br>0x02 = MIPMAP2 (used for palettes) || '''LevelType''' in the GIS
|-
| 0x2A || 0x02 || 00 01 || {{cellcolors|#33cc33}} '''level_count''' || Number of mipmaps || Restricted by '''limit_level_count''' in [[GimConv]].cfg (default max 8)<br>'''LevelCount''' in the GIS
|-
| 0x2C || 0x02 || 00 03 || {{cellcolors|#4dff4d|#ffffff}} '''frame_type''' || {{cellcolors|lightgrey}} 0x00 = Illegal ?<br>0x01 = Illegal ?<br>0x02 = Illegal ?<br>0x03 = SEQUENCE || '''FrameType''' in the GIS
|-
| 0x2E || 0x02 || 00 01 || {{cellcolors|#4dff4d}} '''frame_count''' || Number of frames || Restricted by '''limit_frame_count''' in [[GimConv]].cfg (default no limit)<br>'''FrameCount''' in the GIS
|-
| colspan="6" {{cellcolors|lightgrey}}
|-
| 0x30 || <abbr title="max lenght not verifyed">''any''</abbr> || {{cellcolors|lightgrey|#000000|center}} ''N/A'' || {{cellcolors|#aa8866}} '''user_data''' || Optional User Data area || Enabled by '''update_userdata = on''' in [[GimConv]].cfg. Stores the contents of '''<filename>.dat'''
|-
| <abbr title="block_data_leght + user_data length">''varies''</abbr> || <abbr title="0 up to 3">''varies''</abbr> || {{cellcolors|lightgrey|#000000|center}} ''N/A'' || {{cellcolors|#D3D3D3}} ''padding''  || Optional padding || To align '''user_data''' to 4 bytes
|}
|}


===0x05===
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000070  <span style="background:#555555; color:#ffffff;">00 00 00 40</span> <span style="background:#D3D3D3;">00 00 00 00 00 00 00 00 00 00 00 00</span>  ...@............


===0xFF (footer)===
{| class="wikitable" style="font-size:small;"
*Footer size is composed by strings of variable lenght null terminated:
|+IMAGE_INDEX (contains IMAGE_PLANE/IMAGE_LEVEL/IMAGE_FRAME) ?<br>PALETTE_INDEX (contains PALETTE_LEVEL/PALETTE_FRAME) ?
**'''4x2_CA5Exy_32bits.bmp''' (original file name)
! Offset !! Length !! Example !! Name !! Description !! Notes
**'''Administrator''' (windows user account)
|-
**'''Sun Apr 15 01:25:02 2018''' (timestamp)
| 0x30 || 0x04 || 00 00 00 40 || {{cellcolors|#555555|#ffffff}} '''frame_n_offset''' || Where <n> is the frame number || This entry is repeated one time for every '''level_count''' or '''frame_count'''
**'''GimConv 1.20h''' (GimConv.exe version used to create the GIM file)
|-
| <abbr title="block data size + userdata size + userdata padding + (index n entries * 4)">0x34</abbr> || <abbr title="0 up to 0x0C">0x0C</abbr> || <abbr title="00 00 00 00 00 00 00 00 00 00 00 00">00 00 00 ...</abbr> || {{cellcolors|#D3D3D3}} ''padding''  || Optional padding || To align the block to 16 bytes
|}
 
After this index comes the planes/levels/frames (the bytes with pixels color info), are one or several images concatenated, for experimental purposes can be added manually by using [[GimConv]].cfg setting '''merge_mode''' with values '''frame''' and '''level''', and probably '''plane''' too, see {{talk}} page
 
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000080  <span style="background:#CA5E24;">CA 5E 11 00 CA 5E 12 00 CA 5E 13 00 CA 5E 14 00</span>  Ê^..Ê^..Ê^..Ê^..
00000090  <span style="background:#CA5E24;">CA 5E 21 00 CA 5E 22 00 CA 5E 23 00 CA 5E 24 00</span>  Ê^!.Ê^".Ê^#.Ê^$.
 
===0x05 (Palette)===
The palette block is used for [https://en.wikipedia.org/wiki/Indexed_color indexed color] formats (index4 index8 index16 index32), to create a GIM with a palette is needed to use as input an image that already contains a color palette (such BMP or DDS)
 
The concept of "palette" is a bit confusing because here is used for two different things, the block 0x05 is codenamed palette as a general concept, the file structure is the same than the block 0x04 (image), both ends with the '''user_data''' (optional), then it comes an '''index''' to indicate how many palettes there are and its offsets (usually only one palette), and then starts an area where are stored the pixel colors... this area to store pixel colors is the real palette in design slang but to avoid this name confussion we can call it the '''colormap'''
 
*The differences in between block 0x04 (image) and block 0x05 (palette) are minor, only differs in how are used
**The palette (block 0x05) is located before the image (block 0x04) in the block hierarchy of the GIM structure, doesnt seems to be anything that connects them, other than the fact that "the palette goes first"
**The palette stores the "colormap", and the image stores an "indexmap" (and every index value in the image loads a color from the palette colormap)
**The palette only allows for '''palette_format''' = rgba8888 rgba4444 rgba5551 rgba5650
**The "colormap" is stored as an image of 256x1 pixels ('''image_width''' = 0x100 '''image_height''' = 0x1) and allows to store 256 colors
**The "colormap" has a reserved bytes size in the GIM file structure based on the palette format, 0x400 bytes in rgba8888, 0x200 in rgba4444, etc...), if the number of colors is smaller than 256 the "colormap" area will have some bytes filled with zeroes (not used)
**The palette is stored as '''level_type''' = MIPMAP2
 
===0xFF (Fileinfo)===
This block only exists if the GIM is build using the setting '''update_fileinfo = on'''. Initially in old PS3 firmwares all the GIM files was made this way, eventually sony stopped using this setting and GIM files was updated/replaced by new ones without this fileinfo block. But there are many GIM files inside latest PS3 firmware that contains this fileinfo block (are GIM files made years ago and never was updated, this can be seen in the timestamps stored in them around 2005/2006)
 
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
000000B0  <span style="background:#ccaa88;">34 78 32 5F 43 41 35 45 78 79 5F 33 32 62 69 74</span>  4x2_CA5Exy_32bit
000000C0  <span style="background:#ccaa88;">73 2E 62 6D 70 00</span> <span style="background:#ddbb99;">41 64 6D 69 6E 69 73 74 72 61</span>  s.bmp.Administra
000000D0  <span style="background:#ddbb99;">74 6F 72 00</span> <span style="background:#eeccaa;">53 75 6E 20 41 70 72 20 31 35 20 30</span>  tor.Sun Apr 15 0
000000E0  <span style="background:#eeccaa;">31 3A 32 35 3A 30 32 20 32 30 31 38 00</span> <span style="background:#ffddbb;">47 69 6D</span>  1:25:02 2018.Gim
000000F0  <span style="background:#ffddbb;">43 6F 6E 76 20 31 2E 32 30 68 00</span> <span style="background:#D3D3D3;">00</span>              Conv 1.20h..
 
{| class="wikitable" style="font-size:small;"
|-
! Offset !! Length !! Example !! Name !! Description !! Notes
|-
| 0x00 || 0x16 || 4x2_CA5Exy_32bits.bmp || {{cellcolors|#ccaa88}} '''project_name''' || Original file name and file extension || '''ProjectName''' in the GIS
|-
| 0x16 || 0x0E || Administrator || {{cellcolors|#ddbb99}} '''user_name''' || Microsoft windows user account || '''UserName''' in the GIS
|-
| 0x24 || 0x19 || Sun Apr 15 01:25:02 2018 || {{cellcolors|#eeccaa}} '''saved_date''' || Timestamp || '''SavedDate''' in the GIS
|-
| 0x3D || 0x0E || GimConv 1.20h || {{cellcolors|#ffddbb}} '''originator''' || GimConv version || '''Originator''' in the GIS
|-
| 0x4B || <abbr title="0 up to 3">0x01</abbr> || 00 || {{cellcolors|#D3D3D3}} ''padding'' || Optional padding || To align '''fileinfo''' block to 4 bytes
|}


=Links=
=Links=

Latest revision as of 12:02, 27 April 2018

Description[edit | edit source]

Graphic Image Map ? (GIM) is an image format that allows for lot of different settings that results in lot of different GIM files that are structurally different, strictly speaking the GIM format is always the same, but generally speaking it can be said that this different GIM files are "GIM formats", the amount of GIM formats supported by PlayStation consoles is limited though (restricted by the graphic enviroment, libraries, etc...). GIM files was found in PSP and PS3 firmwares inside Resource Container (RCO) files, PlayStation 3 Theme (P3T) files, etc... See GimConv and Multimedia Formats and Tools#GIM

The meaning of the "GIM" acronym used in this wiki (Graphic Image Map) is an speculative unnofficial name based in how the data is stored in the internal GIM structure, if someone finds the official codename please report back and we will change it

Structure[edit | edit source]

  • Overview (4 unknown values left, marked in intense red)
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000000  2E 47 49 4D 31 2E 30 30 00 50 53 50 00 00 00 00  .GIM1.00.PSP....     <- GIM header
00000010  00 02 00 00 00 00 00 EC 00 00 00 10 00 00 00 10  .......ì........     <- Block 0x02 header (Root)
00000020  00 03 00 00 00 00 00 80 00 00 00 10 00 00 00 10  .......€........        <- Block 0x03 header (Picture)
00000030  00 04 00 00 00 00 00 70 00 00 00 70 00 00 00 10  .......p...p....           <- Block 0x04 header (Image)
00000040  00 30 00 00 00 03 00 00 00 04 00 02 00 20 00 10  .0........... ..              <- Block 0x04 Data
00000050  00 01 00 02 00 00 00 00 00 00 00 30 00 00 00 40  ...........0...@              <- Block 0x04 Data
00000060  00 00 00 60 00 00 00 00 00 01 00 01 00 03 00 01  ...`............              <- Block 0x04 Data
00000070  00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00  ...@............              <- Block 0x04 Index
00000080  CA 5E 11 00 CA 5E 12 00 CA 5E 13 00 CA 5E 14 00  Ê^..Ê^..Ê^..Ê^..                 <- Block 0x04 Frame
00000090  CA 5E 21 00 CA 5E 22 00 CA 5E 23 00 CA 5E 24 00  Ê^!.Ê^".Ê^#.Ê^$.                 <- Block 0x04 Frame
000000A0  00 FF 00 00 00 00 00 5C 00 00 00 5C 00 00 00 10  .ÿ.....\...\....        <- Block 0xFF header (Fileinfo)
000000B0  34 78 32 5F 43 41 35 45 78 79 5F 33 32 62 69 74  4x2_CA5Exy_32bit           <- Block 0xFF Strings
000000C0  73 2E 62 6D 70 00 41 64 6D 69 6E 69 73 74 72 61  s.bmp.Administra           <- Block 0xFF Strings
000000D0  74 6F 72 00 53 75 6E 20 41 70 72 20 31 35 20 30  tor.Sun Apr 15 0           <- Block 0xFF Strings
000000E0  31 3A 32 35 3A 30 32 20 32 30 31 38 00 47 69 6D  1:25:02 2018.Gim           <- Block 0xFF Strings
000000F0  43 6F 6E 76 20 31 2E 32 30 68 00 00              Conv 1.20h..               <- Block 0xFF Strings

GIM header[edit | edit source]

Offset Length Example Name Description Notes
0x00 0x04 .GIM signature little = MIG.
big = .GIM
This is the first place affected by format_endian in GimConv.cfg
0x04 0x04 1.00 version Always 1.00 ?
0x08 0x04 PSP format_style std = nothing
ps3 = nothing
psp = PSP
Configured by format_style in GimConv.cfg
0x0C 0x04 00 00 00 00 padding/unused ? Unknown Always 0 ?

Block headers (generic)[edit | edit source]

Offset Length Example Name Description Notes
0x00 0x02 00 02 block_id 0x02 = Root (first level)
0x03 = Picture (second level)
0x04 = Image (third level)
0x05 = Palette (third level)
0xFF = Fileinfo (second level)
Block identifyer
0x02 0x02 00 00 block_unk 0x00 = ?
0x10 = ?
Unknown
0x04 0x04 00 00 00 EC block_size Size of this block + children blocks
0x08 0x04 00 00 00 10 block_header_next Next block relative offset
0x0C 0x04 00 00 00 10 block_data_offset Block data relative offset

Block data (by block ID)[edit | edit source]

0x02 (Root)[edit | edit source]

Is the parent of block 0x03 (Picture) and 0x0FF (Fileinfo)

0x03 (Picture)[edit | edit source]

Is the parent of block 0x04 (Image) and block 0x05 (Palette)

  • Experimental notes
    • This block is repeated when using the option merge_mode = picture

0x04 (Image)[edit | edit source]

The image block contains some info about the image, and the pixel color info at bottom stored as levels or frames

  • Experimental notes
    • This block is repeated when using the option merge_mode = image
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000040  00 30 00 00 00 03 00 00 00 04 00 02 00 20 00 10  .0........... ..
00000050  00 01 00 02 00 00 00 00 00 00 00 30 00 00 00 40  ...........0...@
00000060  00 00 00 60 00 00 00 00 00 01 00 01 00 03 00 01  ...`............
Offset Length Example Name Description Notes
0x00 0x02 00 30 block_data_lenght Size of the block data Indicates the relative offset of the area located inmediatly after frame_count
0x02 0x02 00 00 b45_unk1 ? Ignored ?
0x04 0x02 00 03 image_format 0x00 = rgba5650 (16 bit no alpha)
0x01 = rgba5551 (16 bit sharp alpha)
0x02 = rgba4444 (16 bit gradient alpha)
0x03 = rgba8888 (32 bit gradient alpha)
0x04 = index4 (16 colors)
0x05 = index8 (256 colors)
0x06 = index16 (16 colors with alpha ?)
0x07 = index32 (256 colors with alpha ?)
0x08 = dxt1 (no alpha)
0x09 = dxt3 (sharp alpha)
0x0A = dxt5 (gradient alpha)
0x108 = dxt1ext
0x109 = dxt3ext
0x10A = dxt5ext
Configured by image_format in GimConv.cfg
Format in the GIS
0x06 0x02 00 00 pixel_order 0x00 = normal
0x01 = faster
Configured by pixel_order in GimConv.cfg with values: normal (default) or faster
Order in the GIS with values: NORMAL or PSPIMAGE
0x08 0x02 00 04 width Image/palette width in pixels Restricted by limit_image_width in GimConv.cfg
Width in the GIS
0x0A 0x02 00 02 height Image/palette height in pixels Restricted by limit_image_height in GimConv.cfg
Height in the GIS
0x0C 0x02 00 20 bpp_align Image/palette alignment BPP
0x0E 0x02 00 10 pitch_align Image/palette alignment X PitchAlign in the GIS
0x10 0x02 00 01 height_align Image/palette alignment Y HeightAlign in the GIS
0x12 0x02 00 02 b45_unk2 ? Ignored ?
0x14 0x04 00 00 00 00 b45_unk3 ? Ignored ?
0x18 0x04 00 00 00 30 index_start Index relative start offset
0x1C 0x04 00 00 00 40 pixels_start First plane/level/frame relative start offset
0x20 0x04 00 00 00 60 pixels_end Last plane/level/frame relative end offset
0x24 0x04 00 00 00 00 plane_mask Indicates a color (for alpha mask ?) PlaneMask in the GIS
0x28 0x02 00 01 level_type 0x00 = Illegal
0x01 = MIPMAP
0x02 = MIPMAP2 (used for palettes)
LevelType in the GIS
0x2A 0x02 00 01 level_count Number of mipmaps Restricted by limit_level_count in GimConv.cfg (default max 8)
LevelCount in the GIS
0x2C 0x02 00 03 frame_type 0x00 = Illegal ?
0x01 = Illegal ?
0x02 = Illegal ?
0x03 = SEQUENCE
FrameType in the GIS
0x2E 0x02 00 01 frame_count Number of frames Restricted by limit_frame_count in GimConv.cfg (default no limit)
FrameCount in the GIS
0x30 any N/A user_data Optional User Data area Enabled by update_userdata = on in GimConv.cfg. Stores the contents of <filename>.dat
varies varies N/A padding Optional padding To align user_data to 4 bytes
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000070  00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00  ...@............
IMAGE_INDEX (contains IMAGE_PLANE/IMAGE_LEVEL/IMAGE_FRAME) ?
PALETTE_INDEX (contains PALETTE_LEVEL/PALETTE_FRAME) ?
Offset Length Example Name Description Notes
0x30 0x04 00 00 00 40 frame_n_offset Where <n> is the frame number This entry is repeated one time for every level_count or frame_count
0x34 0x0C 00 00 00 ... padding Optional padding To align the block to 16 bytes

After this index comes the planes/levels/frames (the bytes with pixels color info), are one or several images concatenated, for experimental purposes can be added manually by using GimConv.cfg setting merge_mode with values frame and level, and probably plane too, see Discussion page

Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000080  CA 5E 11 00 CA 5E 12 00 CA 5E 13 00 CA 5E 14 00  Ê^..Ê^..Ê^..Ê^..
00000090  CA 5E 21 00 CA 5E 22 00 CA 5E 23 00 CA 5E 24 00  Ê^!.Ê^".Ê^#.Ê^$.

0x05 (Palette)[edit | edit source]

The palette block is used for indexed color formats (index4 index8 index16 index32), to create a GIM with a palette is needed to use as input an image that already contains a color palette (such BMP or DDS)

The concept of "palette" is a bit confusing because here is used for two different things, the block 0x05 is codenamed palette as a general concept, the file structure is the same than the block 0x04 (image), both ends with the user_data (optional), then it comes an index to indicate how many palettes there are and its offsets (usually only one palette), and then starts an area where are stored the pixel colors... this area to store pixel colors is the real palette in design slang but to avoid this name confussion we can call it the colormap

  • The differences in between block 0x04 (image) and block 0x05 (palette) are minor, only differs in how are used
    • The palette (block 0x05) is located before the image (block 0x04) in the block hierarchy of the GIM structure, doesnt seems to be anything that connects them, other than the fact that "the palette goes first"
    • The palette stores the "colormap", and the image stores an "indexmap" (and every index value in the image loads a color from the palette colormap)
    • The palette only allows for palette_format = rgba8888 rgba4444 rgba5551 rgba5650
    • The "colormap" is stored as an image of 256x1 pixels (image_width = 0x100 image_height = 0x1) and allows to store 256 colors
    • The "colormap" has a reserved bytes size in the GIM file structure based on the palette format, 0x400 bytes in rgba8888, 0x200 in rgba4444, etc...), if the number of colors is smaller than 256 the "colormap" area will have some bytes filled with zeroes (not used)
    • The palette is stored as level_type = MIPMAP2

0xFF (Fileinfo)[edit | edit source]

This block only exists if the GIM is build using the setting update_fileinfo = on. Initially in old PS3 firmwares all the GIM files was made this way, eventually sony stopped using this setting and GIM files was updated/replaced by new ones without this fileinfo block. But there are many GIM files inside latest PS3 firmware that contains this fileinfo block (are GIM files made years ago and never was updated, this can be seen in the timestamps stored in them around 2005/2006)

Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

000000B0  34 78 32 5F 43 41 35 45 78 79 5F 33 32 62 69 74  4x2_CA5Exy_32bit
000000C0  73 2E 62 6D 70 00 41 64 6D 69 6E 69 73 74 72 61  s.bmp.Administra
000000D0  74 6F 72 00 53 75 6E 20 41 70 72 20 31 35 20 30  tor.Sun Apr 15 0
000000E0  31 3A 32 35 3A 30 32 20 32 30 31 38 00 47 69 6D  1:25:02 2018.Gim
000000F0  43 6F 6E 76 20 31 2E 32 30 68 00 00              Conv 1.20h..
Offset Length Example Name Description Notes
0x00 0x16 4x2_CA5Exy_32bits.bmp project_name Original file name and file extension ProjectName in the GIS
0x16 0x0E Administrator user_name Microsoft windows user account UserName in the GIS
0x24 0x19 Sun Apr 15 01:25:02 2018 saved_date Timestamp SavedDate in the GIS
0x3D 0x0E GimConv 1.20h originator GimConv version Originator in the GIS
0x4B 0x01 00 padding Optional padding To align fileinfo block to 4 bytes

Links[edit | edit source]