Editing GimConv

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 437: Line 437:
==Identifying GIM settings by bruteforce==
==Identifying GIM settings by bruteforce==
{{Boxinfo1|content='''GIM-to-GIM''' is the only conversion method that is '''[https://en.wikipedia.org/wiki/Lossless_compression lossless]''' for all image formats supported by GimConv.exe}}
{{Boxinfo1|content='''GIM-to-GIM''' is the only conversion method that is '''[https://en.wikipedia.org/wiki/Lossless_compression lossless]''' for all image formats supported by GimConv.exe}}
The word [https://en.wikipedia.org/wiki/Brute-force_search bruteforce] sounds a bit ridiculous when used to identify image settings but defines pretty well how this identification method works. Consist in rebuilding the original GIM file several times by using different GimConv settings until we generate a GIM file identical to the original. In other words... if you find how to create a GIM file exactly like the original you can be 100% sure the GIM settings you are using are exactly the same used by sony to create that GIM
The word [https://en.wikipedia.org/wiki/Brute-force_search bruteforce] sounds a bit ridiculous used in this enviroment, but it defines pretty well how this identification method works. Consist in rebuilding the GIM file several times by using different GimConv settings until we generate a GIM file identical to the original. In other words... if you find how to create a GIM file exactly like the original you can be 100% sure the settings you are using are exactly the same used by sony to create that GIM


The only way to create a GIM file exactly like the original (that works with all image formats) is by making a GIM-to-GIM conversion, GimConv rebuilds the file when doing a GIM-to-GIM conversion and in the conversion is preserved the pixel data of dxt based image formats, otherway if the GIM image is dxt based and you try to convert it to other format (such PNG) and back to dxt it will never be like the original because dxt conversions are [https://en.wikipedia.org/wiki/Lossy_data_conversion lossy]
The only way (that works with all image formats) to create a GIM file exactly like the original is by making a GIM-to-GIM conversion, this is not so retarded as it sounds, GimConv really rebuilds the file when doing a GIM-to-GIM conversion and in the process is preserved the pixel data of DXT based image formats, there are other rebuild method that allows to create GIM files identical to the original such GMI-to-PNG-to-GIM but only works for rgba based image formats, the point is GIM-to-GIM is the only that preserves pixel info for DXT formats, adnd for this reason the GIM-to-GIM conversion superceedes all other methods


For bruteforce is used a "dictionary" that contains the posible "candidates" to solve the "problem", our dictionary (with the GIM formats found in PS3) only contains 3 candidates, this means in the worst scenario is need to rebuild the GIM file a max of 3 times. If none of the 3 GIM files matches with the original we have a problem (please report back and we will add the rare format to this wiki page)
In bruteforce is used a "dictionary" that contains the posible candidates that solves the "problem"... the good thing is our dictionary (with the GIM formats found in PS3) only contains 3 candidates, this means in the worst scenario you are going to need to rebuild the GIM file 3 times... if none of the 3 GIM files matches with the original we have a problem (please report back and we will add the rare format to this wiki page)


*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)
'''1st most common'''
'''1st most common'''
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe original.gim -o try1.gim -ps3rgba8888</syntaxhighlight>}}
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe original.gim -o try1.gim -ps3rgba8888</syntaxhighlight>}}
Line 450: Line 453:
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe original.gim -o try3.gim -dxt5</syntaxhighlight>}}
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe original.gim -o try3.gim -dxt5</syntaxhighlight>}}


After every GIM-to-GIM conversion is needed to compare the hashes, first "original.gim VS try1.gim", then "original.gim VS try2.gim", then "original.gim VS try3.gim"
*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)


===GimConv.exe version patch===
===GimConv.exe version patch===
The reason to use this patch is because by enabling the setting '''--update_fileinfo on''' is added a block of data (named "fileinfo" with block id 0x00FF) at bottom of the GIM file, in a GIM-to-GIM conversion this block of data (from the original.gim) is preserved (added in the rebuild GIM file) but the GimConv version included at the end of this block is updated. The GimConv versions in the original PS3 retail GIM files are '''GimConv 1.20e''' and when you do the GIM-to-GIM conversion it changes to '''GimConv 1.20h''', the difference is a single byte but doesnt allows to create a GIM file identical to the original (the hash check fails, and this sucks). If you are using some external code you can modify this byte by other means (so you dont need to use this patch for GimConv.exe) but for normal usage of GimConv.exe in command line this patch is handy because it allows to create identical GIM files
The reason to use this patch is because when enabling the setting '''--update_fileinfo on''' is added a block of data named "fileinfo" (block id 0x00FF) at bottom of the GIM file, in a GIM-to-GIM conversion this block of data (from the original file) is preserved (added in the rebuild GIM file) but the version of GimConv.exe included in this block is updated. The original versions in PS3 retail GIM files are '''GimConv 1.20e''' and when you do the GIM-to-GIM conversion it changes to '''GimConv 1.20h''', is a single byte but this single bytes doesnt allows us to create a GIM file identical to the original (and this sucks). The last step of the bruteforce method is to make a hash comparison original GIM VS rebuilt GIM and should be identical. If you are using some external code you can modify this byte by other means (so you dont need this patch or you can solve it by other means) but for normal usage of GimConv.exe in command line this is handy because it allows to create identical GIM files


  GimConv.exe v1.20h original (MD5:425B2E4D9684BCE1FC79A37247618AC8)
  GimConv.exe v1.20h original (MD5:425B2E4D9684BCE1FC79A37247618AC8)
Line 460: Line 468:
  GimConv.exe v1.20h patched to v1.20e (MD5:6C9B0E47273EFA6D34121A46E65EEDC6)
  GimConv.exe v1.20h patched to v1.20e (MD5:6C9B0E47273EFA6D34121A46E65EEDC6)


As far i know all the GIM files from PS3 retail firmwares that was created using '''--update_fileinfo on''' was build with GimConv.exe v1.20'''e''', and the patch changes the GimConv.exe version from v1.20'''h''' (the public GimConv.exe) by v1.20'''e''' (the internal GimConv.exe not available for us), so it should work for most GIM files... if at some point someone finds other GIM files that was made with other GimConv.exe versions (c, d, f, g) and you want to use this bruteforce identification process you can make others GimConv.exe patched with different versions and rename them to GimConvC.exe, GimConvD.exe, GimConvE.exe, GimConvF.exe, GimConvG.exe etc... and keep all them in the same folder next to the original v1.20h
As far i know all the GIM files from PS3 retail firmwares that was created using '''--update_fileinfo on''' was build with GimConv.exe v1.20'''e''' so it should work for most of them... if at some point someone finds other GIM files that was made with with other GimConv.exe versions (c, d, f, g) and you want to use this bruteforce identification process you can make another GimConv.exe patched with different versions and rename them to GimConvC.exe, GimConvD.exe, GimConvE.exe, GimConvF.exe, GimConvG.exe etc... and keep all them in the same folder next to the original v1.20h


==Examples==
==Examples==
Please note that all contributions to PS3 Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PS3 Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)