GimConv: Difference between revisions

From PS3 Developer wiki
Jump to navigation Jump to search
(reordered)
mNo edit summary
Line 17: Line 17:
**There is a [http://tizzyt-archive.blogspot.com.es/2013/10/gis2png.html GIS2PNG converter] made by TizzyT
**There is a [http://tizzyt-archive.blogspot.com.es/2013/10/gis2png.html GIS2PNG converter] made by TizzyT


=GimConv.cfg Overview (official version)=
=GimConv.cfg Overview=
Before explaining how works GimConv.exe is needed an introductory explain about how works GimConv.cfg (the settings file)
Before explaining how GimConv.exe works is needed an introduction about GimConv.cfg (the config file). All features of GimConv.exe are driven by the settings that appears on GimConv.cfg
  usage {
  usage {
         This is the help screen (only informative)
         This is the help screen (only informative)
Line 28: Line 28:
         Settings for input file formats
         Settings for input file formats
  }
  }
  option -* {
  option * {
         Groups of settings (overrides the defaults settings, are only used when you specify the option name at the command line)
         Groups of settings (overrides the defaults settings, are only used when you specify the option name at the command line)
  }
  }
  script filter {
  script * {
         Unknown usage
         Unknown usage
  }
  }


Is needed to take a look at the GimConv.cfg file to understand how it works because all features of GimConv.exe are supported by the settings (and options with settings) that appears on GimConv.cfg
Below is shown GimConv.cfg released by sony as part of the [http://uk.playstation.com/ps3/support/settings/detail/linked235336/item85346/Download-PlayStation-3-Custom-Theme-Guidelines/ PS3 Custom Theme Toolbox] (official version). If you are interested in the modifyed GimConv.cfg included with [[Rcomage]] see the {{talk}} page
 
Also, is needed to keep in mind that the contents of GimConv.cfg are loaded "from top to bottom" first are loaded the default settings, and then the settings inside the option (incase you choose an option)
 
By using an option (at bottom ofGimConv.cfg) you are actually "overriding" one or more default settings (at top of GimConv.cfg), this overriding applyes too to whatever setting or option you use in command line, as example, if you change the same setting 3 times in a single command line the only setting that counts is the last one
 
Below is shown GimConv.cfg released by sony as part of the [http://uk.playstation.com/ps3/support/settings/detail/linked235336/item85346/Download-PlayStation-3-Custom-Theme-Guidelines/ PS3 Custom Theme Toolbox]
<div style="height:520px; overflow:auto">
<div style="height:520px; overflow:auto">
{{Boxcode|content=<syntaxhighlight lang="c">
{{Boxcode|content=<syntaxhighlight lang="c">
Line 291: Line 285:
</syntaxhighlight>}}
</syntaxhighlight>}}
</div>
</div>
The contents of GimConv.cfg are loaded "from top to bottom" first are loaded the default settings, and then the settings inside the option (incase you choose an option). The settings inside the options (at bottom ofGimConv.cfg) are actually "overriding" one or more default settings (at top of GimConv.cfg), this overriding applyes too to whatever setting or option you use in command line, as example, if you change the same setting 3 times in a single command line the only setting that counts is the last one


=GimConv.exe usage=
=GimConv.exe usage=


==GimConv.exe help screen==
==Help screen==
The command line help screen of GimConv.exe displays a very limited list of predefined options with an small explain for them, the example below belongs to the official GimConv.cfg and shows the options sony considered was useful for them
The command line help screen of GimConv.exe displays a very limited list of predefined options with an small explain for them, the example below belongs to the official GimConv.cfg and shows the options sony considered was useful for them


Line 323: Line 319:
}}
}}


==GimConv.exe usage with options==
==Options==
For GIM-to-PNG conversions is not needed to use special options:
For GIM-to-PNG conversions is not needed to use special options:
{{Keyboard|content='''gimconv.exe in.gim -o out.png'''}}
{{Keyboard|content='''gimconv.exe in.gim -o out.png'''}}
Line 354: Line 350:
If you look at GimConv.cfg "from top to bottom" you are going to find at top the default settings '''output_object''' with value '''on''' and '''output_script''' with value '''off''' (so by default it outputs a GIM and doesnt outputs a GIS). The option '''-S''' is "switching" them (doesnt outputs a GIM but it outpputs a GIS)
If you look at GimConv.cfg "from top to bottom" you are going to find at top the default settings '''output_object''' with value '''on''' and '''output_script''' with value '''off''' (so by default it outputs a GIM and doesnt outputs a GIS). The option '''-S''' is "switching" them (doesnt outputs a GIM but it outpputs a GIS)


==GimConv.exe usage with explicit settings==
==Settings==
This is the most accurate way to have full controll of the settings, if you are picky enought you can write a long line of settings to be sure you are overriding all the defaults (just incase the GimConv.cfg has been modifyed by someone, by doing this you are overriding his/her changes made to default settings). If you are writing an script or any tool that sends actions to gimconv.exe you should use this method
This is the most accurate way to have full controll of the settings, if you are picky enought you can write a long line of settings to be sure you are overriding all the defaults (just incase the GimConv.cfg has been modifyed by someone, by doing this you are overriding his/her changes made to default settings). If you are writing an script or any tool that sends actions to gimconv.exe you should use this method
{{Keyboard|content='''gimconv.exe in.png -o out.gim --pixel_order normal --format_style psp --format_endian big'''}}
{{Keyboard|content='''gimconv.exe in.png -o out.gim --pixel_order normal --format_style psp --format_endian big'''}}
Line 367: Line 363:
</syntaxhighlight>}}
</syntaxhighlight>}}


==GimConv.exe usage driven by rcomage==
==From rcomage==
{{Boxwarning1|content='''Dont use this method for PS3'''. GIM files inside RCO files from PS3 firmware uses variated formats, this method applyes the same settings for all them and breaks some}}
{{Boxwarning1|content='''Dont use this method for PS3'''. GIM files inside RCO files from PS3 firmware uses variated formats, this method applyes the same settings for all them and breaks some}}
This works by sending GIM settings from rcomage.exe to gimconv.exe and is made at the time rcomage.exe is compiling the RCO (see the "compile" help in [[rcomage]] page)
This works by sending GIM settings from rcomage.exe to gimconv.exe and is made at the time rcomage.exe is compiling the RCO (see the "compile" help in [[rcomage]] page)

Revision as of 09:24, 23 April 2018

Description

GimConv.exe is a sony program for microsoft windows used to convert GIM images, see Graphic Image Map (GIM)

  • GimConv.exe versions:
    • 1.20c (GIM files made around 2005 included in pre-retail PS3 firmwares such 0.82.006)
    • 1.20e (GIM files made around 2006 and still present in PS3 4.82 firmware)
    • 1.20h released with p3tcompiler v2.00 as part of the PS3 Custom Theme Toolbox (this is the version included in rcomage using a modifyed GimConv.cfg)
  • Other notes:
    • GIM images can be previewed in PC by using Gim Viewer (unnofficial app made by hsreina, it has limited support for the "rgba based" GIM formats). See Multimedia Formats and Tools
    • The option -viewer (start gimview.exe when process ends) in the official config file (that was removed for rcomage) is intended to launch an official gimview.exe that doesnt exists in the public release
    • PSP Custom Theme Toolbox admits GIM files as inputs, but doesnt includes a GIM converter
    • Some of the settings (such merge_mode) are related with animated images but the support of animated GIM images on PlayStation consoles is unknown, see: http://endlessparadigm.com/forum/showthread.php?tid=5054
    • It supports AVI video as input, probably to convert the video frames to static images and build a GIM animation with them, unknown usage
    • Gimconv.exe supports an internal script format to automatize image conversions, it can be seen how appears as an option available at bottom of Gimconv.cfg and allows to create GIM-to-GIS conversions. The usage of this scripting features is mostly unknown
    • There is a GIS2PNG converter made by TizzyT

GimConv.cfg Overview

Before explaining how GimConv.exe works is needed an introduction about GimConv.cfg (the config file). All features of GimConv.exe are driven by the settings that appears on GimConv.cfg

usage {
        This is the help screen (only informative)
}
default {
        Default predefined settings (loaded "from top to bottom", if a setting is repeated two or more times the most at bottom overrides the other/s at top)
}
input * {
        Settings for input file formats
}
option * {
        Groups of settings (overrides the defaults settings, are only used when you specify the option name at the command line)
}
script * {
        Unknown usage
}

Below is shown GimConv.cfg released by sony as part of the PS3 Custom Theme Toolbox (official version). If you are interested in the modifyed GimConv.cfg included with Rcomage see the Discussion page

Code Sample

The contents of GimConv.cfg are loaded "from top to bottom" first are loaded the default settings, and then the settings inside the option (incase you choose an option). The settings inside the options (at bottom ofGimConv.cfg) are actually "overriding" one or more default settings (at top of GimConv.cfg), this overriding applyes too to whatever setting or option you use in command line, as example, if you change the same setting 3 times in a single command line the only setting that counts is the last one

GimConv.exe usage

Help screen

The command line help screen of GimConv.exe displays a very limited list of predefined options with an small explain for them, the example below belongs to the official GimConv.cfg and shows the options sony considered was useful for them

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 )

Options

For GIM-to-PNG conversions is not needed to use special options:

Type This
'''gimconv.exe in.gim -o out.png'''

If you create a PNG-to-GIM (or any of the supported input image formats to GIM) without specifying special options it will generate a GIM with the "default settings" of GimConv.cfg "from top to bottom", you can achieve it by doing:

Type This
'''gimconv.exe in.png -o out.gim'''

Additionally to the options that appears on the help screen there are a lot more special options inside GimConv.cfg, all them can be used in the same way, actually the help screen is just informative and the options that appears in it are not much useful for us

To specify an option is needed to use the name of the -option at the end of the line. At the time GimConv.exe processes this command it loads the settings of GimConv.cfg file "from top to bottom" (so it starts loading the default settings) and then it loads the option we have choosen (and the option contains settings that overrides the defaults)

Type This
'''gimconv.exe in.png -o out.gim -DXT'''
  • Note the option -DXT at bottom of GimConv.cfg is composed by 3 settings (this is an example of the official GimConv.cfg, the one used inside rcomage is different):
Code Sample

Another example where can be seen better how the options contains settings that overrides the default settings:

Type This
'''gimconv.exe in.gim -o out.gis -S'''
  • The option -S contains this settings that are going to override the defaults:
Code Sample

If you look at GimConv.cfg "from top to bottom" you are going to find at top the default settings output_object with value on and output_script with value off (so by default it outputs a GIM and doesnt outputs a GIS). The option -S is "switching" them (doesnt outputs a GIM but it outpputs a GIS)

Settings

This is the most accurate way to have full controll of the settings, if you are picky enought you can write a long line of settings to be sure you are overriding all the defaults (just incase the GimConv.cfg has been modifyed by someone, by doing this you are overriding his/her changes made to default settings). If you are writing an script or any tool that sends actions to gimconv.exe you should use this method

Type This
'''gimconv.exe in.png -o out.gim --pixel_order normal --format_style psp --format_endian big'''
  • Note the 3 options used in the example are overriding the default settings at top of GimConv.cfg (this is an example of the official GimConv.cfg, the one used inside rcomage is different):
Code Sample

From rcomage

Warning
Warning
Dont use this method for PS3. GIM files inside RCO files from PS3 firmware uses variated formats, this method applyes the same settings for all them and breaks some

This works by sending GIM settings from rcomage.exe to gimconv.exe and is made at the time rcomage.exe is 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 compile in.xml out.rco --gimconv-cmd ".\gimconv\gimconv.exe" --gimconv-flags "--pixel_order normal --format_style psp --format_endian big"'''

How to identify GIM settings

  • GIM--->GIM method (prefered)
    • Use gimconv with .gim files as input and output (this preserves dxt pixel info, because dxt images doesnt suffers a conversion)
Type This
'''gimconv.exe test.gim -o test.gim --format_style psp --format_endian big --image_format dxt5 --pixel_channel default --pixel_alpha default'''
  • GIM--->PNG--->GIM method (fails when there is involved a DXT conversion because DXT conversions are lossy, works fine for rgba**** image formats):
    • 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

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

When an .RCO contains 2 or more images that was created with different .GIM settings... it means is not posible to compile the .RCO with rcomage by using .PNG images as source (because rcomage.exe sends the GIM settings to gimconv.exe to make the PNG--->GIM image conversion and this settings are applyed to all PNG images)

In other words, the only way to compile this RCO's is in 2 steps. In the first step is needed to make the different .GIM conversions with gimconv.exe (and all the other conversions in case exists .VAG audio a WAV2VAG conversion or a JS2VSMX for the .VSMX script). In the second step is needed to compile the .RCO with rcomage.exe by using the .GIM's .VAG's and .VSMX's as sources without any kind of file conversions

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
ps3bpp32 --format_style psp --format_endian big --image_format rgba8888 --pixel_order normal Most used GIM format inside .rco's
ps3dxt5 --format_style psp --format_endian big --image_format dxt5 Second most used GIM format inside rco's

Notes about explore_plugin_full.rco from firmware 4.70:

  • There are 245 images
    • 201 was created by using settings: --format_style psp --format_endian big --image_format rgba8888 --pixel_order normal (exact match of gims after rebuilding gim--->png--->gim)
    • 030 was created by using settings: --format_style psp --format_endian big --image_format rgba8888 --pixel_order normal --update_fileinfo on (exact match of gims after removing footer from originals and rebuilding gim--->png--->gim)
    • 014 was created by using settings: --format_style psp --format_endian big --image_format dxt5 (exact match of gims after rebuilding gim--->gim)
      • item_tex_trophy.gim, trophy_tex_grade_bronze.gim, trophy_tex_grade_gold.gim, trophy_tex_grade_hidden.gim, trophy_tex_grade_platinum.gim, trophy_tex_grade_silver.gim, item_tex_CardBallon.gim, item_tex_Profile_Game.gim, item_tex_Profile_Highlight.gim, item_tex_Profile_Onlines.gim, tex_indi_Me.gim, tex_sb_base.gim, tex_sb_base_s.gim, tex_sb_slider.gim

PS3 Custom Options

The configuration file allows to modify the help screen of the command line by adding custom labels, or by removing useless options to make room for more custom labels, this labels can be composed of groups of options, there is no need at all to do this because doesnt really enables any new funcionallity as you can specify all the options you need one by one from command line included the hability to override default values, but is good to keep a record of the most common used formats for a console by using custom labels with intuitive names that defines the GIM format

The config file supplyed by Rcomage contains some custom options for the formats that are used in PSP, some changes in the default settings that was common for PSP (included a size limit that breaks compatibility with PS3), and a group of options was added for PS3 (labeled -ps3) but this group seems to use wrong options. For more info about the modifications made in the config file supplyed with rcomage see the differences in the Discussion page

This wiki section proposes new groups of options 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)

  • Inside explore_plugin_full.rco from firmware 4.70 there are 245 images, 201 of them (included the new icon tex_psn.gim) has been made by using this settings:
Code Sample
  • Inside explore_plugin_full.rco from firmware 4.70 there are 245 images, 30 of them has been made by using the settings above and update_fileinfo = on, see: fileinfo:
  • Inside explore_plugin_full.rco from firmware 4.70 there are 245 images, 14 of them has been made by using this settings:
Code Sample