GimConv

From PS3 Developer wiki
Revision as of 00:14, 8 March 2015 by Sandungas (talk | contribs) (→‎GIM formats used in PS3: images bigger than 512 pixels broken in the rebuild process as a consequence of rcomage custom gim config)
Jump to navigation Jump to search

Description

GimConv v1.20h was released with p3tcompiler v2.00 as part of the PS3 Custom Theme Toolbox

It manages the GIM image conversions to use inside Resource Container (RCO) files, PlayStation 3 Theme (P3T) files, etc...

Usage

The command line help of GimConv.exe displays a very limited list of options with an small explain, some are generic for the tool usage and others are loading another option from the config file (GimConv.cfg)

Type This
'''C:\PS3_Custom_Theme_v200\GimConv>GimConv.exe'''
gimconv ver 1.20h --- generic picture converter
 Copyright (C) 2006 Sony Computer Entertainment Inc.
  All Rights Reserved.

usage:
        gimconv <input files> [options]

options:
        -interact       input additional options
        -pictures       merge files as pictures
        -frames         merge files as frames
        -levels         merge files as levels
        -prompt         prompt always
        -warning        prompt on warning
        -error          prompt on error
        -viewer         start gimview.exe when process ends
        -o <filename>   specify output file name
        -s <w,h>        resize image data
        -S              output text format
        -P              resize image data to a power of two
        -N              output in normal pixel storage format
        -F              output in faster pixel storage format
        -R              re-convert ( don't swap RGBA <-> ABGR )

GimConv.exe

By specifying an option, or a group of options from command line by his labels (using the names that appears in the help screen, or using the names that appears inside the GimConv.cfg file)

Type This
'''gimconv.exe tex_psn.png -o tex_psn.gim --DXT'''

By specifying the options strictly from command line (using the names that appears inside the GimConv.cfg file) This is the most accurate way to specify options

Type This
'''gimconv.exe tex_psn.png -o tex_psn.gim --format_style psp --format_endian big --pixel_order normal'''

By passing GIM settings from rcomage.exe ---to---> gimconv.exe when compiling the .rco (see the "compile" help in rcomage page). There are 2 options in rcomage specific for this task, named: --gimconv-cmd and --gimconv-flags

Type This
rcomage.exe ...

GimConv.cfg

In this file is where are listed all the options availables of the tool and his default values

This is the original configuration file not modifyed, for more info about the modifications made in the config file supplyed with rcomage see the differences in the Discussion page

Code Sample

Note there are some modifications made officially by sony because GimComv was initially made for PSP, but this public release of GimConv was used to build PS3 themes, so it has some settings specific for PS3 themes

This group at top on the config file are default settings (for PS3) that overrides other default settings (for PSP) specifyed before in the file (and it adds an "extend_edge" that seems to be new)

Code Sample

And this other group seems to be options for some specific gim formats used in PS3

Code Sample

Custom configurations

The configuration file allows to modify the help screen of the command line, and to add your own options that can be composed of groups of settings, there is no need at all to do this (because doesnt really enables any new funcionallity) but is good to keep a record of the most common used formats for a console, also because allows to use cutom names so is posible to label them with an intuitive name that defines his format

The config file supplyed by rcomage contains some custom options for the formats used in PSP, some default settings changed that was common for PSP (that doesnt really affects much to the usage for PS3), and it also had one group of options added for PS3 (labeled -ps3 at this time) but this group seems to use wrong options

This wiki section proposes some new groups with new label names (to be able to use a new modifyed config file without breaking the compatibility of other tools that uses rcomage as a dependency)

The label names proposed here doesnt makes sense at this point, feel free to add more groups of settings with any label name following this same method, also add some info about how many images uses this format (if posible)

  • Inside explore_plugin_full.rco from firmware 4.70 there are 245 images, 198 of them (included the new icon tex_psn.gim) has been made by using this 3 options:
Code Sample
  • Inside explore_plugin_full.rco the old images has been made by using this 4 options:
Code Sample
  • Any other (this 2 options seems to be common for all ps3 4.70 rco's)
Code Sample

How to identify GIM settings

  • To identify the settings that was used to build a GIM file:
    • Use rcomagegui to make an extraction of the contents without conversion of images (this way the GIM are extracted as GIM)
    • Use rcomagegui to make another extraction of the contents with conversion of images (this way the GIM are extracted as PNG)
    • Use gimconv to convert a PNG ---to---> GIM by the old method of test-error by trying some of the options availables that appears in gimonv.cfg
    • Use a hexeditor to compare the original GIM extracted in step 1 with the rebuilt GIM from your test, there is no need to make accurate comparisons, just an overview of the first 0x80 bytes of the header, and how the pixel data is ordered starting at offset 0x80
    • When the header and pixel data seems similar make a hash comparison, original GIM and rebuild GIM should be exactly the same hash (is posible to create a GIM exactly like the original)

GIM formats used in PS3

Has been said here that PS3 uses at least 2 types of GIM images, both included inside rco's, and in some cases both types in the same rco

If an rco contains 2 or more images that was created with different gim settings... it means is not posible to compile this .rco with rcomage by using .png images as source (because rcomage.exe needs to pass some gim settings to gimconv.exe to make the png--->gim conversion and this settings are applyed to all png)

In other words, the only way to compile this rco's is in 2 steps, first is needed to make the different gim conversions with gimconv.exe (and all the other conversions in case exists vag audio or a vsmx script), and then is needed to compile the .rco with rcomage.exe by using the gims as source

Also means we have a big problem to document in wiki wich settings are used for each image (there are thousands of images so initially seems not posible), but probably they follows a rule, so the solution is to deduce or imagine the real reason of why the ps3 is using different gim formats inside the .rco's

image group or rco gim settings notes
explore_plugin_full.rco (and other explore_plugin_***.rco ?) --format_style psp --format_endian big --pixel_order normal candidate to "standard" gim format for main xmb images
xmb_plugin_normal.rco (and other xmb_***.rco ?) ? uses some variant of dxt5 ?

Notes about explore_plugin_full.rco from firmware 4.70:

  • There are 245 images
    • 201 was created by using options: --format_style psp --format_endian big --pixel_order normal (exact match of gims after rebuilding gim--->png--->gim)
    • 030 was created by using options: --format_style psp --format_endian big --pixel_order normal --update_fileinfo on (exact match of gims after removing footer from originals and rebuilding gim--->png--->gim)
    • 014 not identifyed yet

This is the footer of item_tex_cam_icon.gim (added to the gim by enabling update_fileinfo option, variable size)

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

00006AD0  00 FF 00 00 00 00 00 4C 00 00 00 4C 00 00 00 10  .ÿ.....L...L....
00006AE0  53 70 61 6E 61 2E 74 67 61 00 73 30 30 30 39 33  Spana.tga.s00093
00006AF0  37 00 53 75 6E 20 41 70 72 20 32 33 20 31 38 3A  7.Sun Apr 23 18:
00006B00  33 39 3A 34 38 20 32 30 30 36 00 47 69 6D 43 6F  39:48 2006.GimCo
00006B10  6E 76 20 31 2E 32 30 65 00 00 00 00              nv 1.20e....

And this is the footer of a rebuild gim

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

00002300  00 FF 00 00 00 00 00 54 00 00 00 54 00 00 00 10  .ÿ.....T...T....
00002310  74 65 78 5F 70 73 6E 2E 70 6E 67 00 41 64 6D 69  tex_psn.png.Admi
00002320  6E 69 73 74 72 61 64 6F 72 00 53 61 74 20 4D 61  nistrador.Sat Ma
00002330  72 20 30 37 20 30 31 3A 33 32 3A 30 31 20 32 30  r 07 01:32:01 20
00002340  31 35 00 47 69 6D 43 6F 6E 76 20 31 2E 32 30 68  15.GimConv 1.20h
00002350  00 00 00 00                                      ....

It seems the reason why this images are slighty different is because are ancient (has not been updated lot of firmwares ago, and uses the format they was using in the first firmwares)

As interesting details, in the footer of original files can be seen the name and format of the original image (.tga), the windows user name, timestamp (from 2006), an the version of GimConv (an old 1.20e)

The 00 00 00 4C (repeated 2 times) at top of the footer in the original gim example is the size of the whole footer

Speculation

Initially... it seems the gim format depends of who is the responsible of displaying them (as an example, in the link above it seems the images reported as "rare" belongs to "tex_indi_***" (are textures for the "indicator", is the information bar at top-right of xmb, are the tiny icons that appears eventually when you receive a message, etc..)

Note is posible to group them based in how his names starts, all "tex_indi" belongs to indicator so should share the same gim format, even if there are more "tex_indi" inside other rco's, doesnt matters in wich .rco are located what matters is his purpose is the same (to be displayed inside the indicator)