Jump to content

[REL|BIN/SRC|Beta] SparkIV


Recommended Posts



IMG/RPF Archive Viewer/Editor for GTA:IV


Latest version can be found at the Google Code page:




This program is provided under the GPL v3 license. The source code for this program can be obtained from its Google Code page.


Comments/Requests/Bug Reports/etc are welcome!


NOTE: This is a public beta, and as such it is crucial that you backup all files you save/rebuild with SparkIV! I won't be held responsible for any loss of files/limbs/cake/etc that may result due to the use of SparkIV.


Version 0.6.2 Features

- Support for previewing FragType Model (*.wft) files

- Support for viewing LOD models

- Support for exporting audio as multichannel WAV files

- Support for Russian patched version (

- Workaround for Windows 7 textures bug for older betas (should already be fixed in newest beta of Windows 7)

- Updated list of audio filesnames (thanks to DerPlaya78)

- Other minor bug fixes/speed improvements


Version 0.6.1 Features

- Critical bug fix with import/export textures.

- Fixed a few bugs in WHM preview

- Auto-check for readonly when opening IMG/RPF files


Version 0.6.0 Features

- Support for version 1.0.2 of GTAIV

- Support for previewing WHM files (might not preview exactly as shown in game)

- Support for all Audio files, with playback and export support (thanks to DerPlaya78!)

- Default filenames are now shown when exporting/importing textures in Edit mode

- Support for loading IMG/RPF/Directories by passing a command line argument

- IMG/RPF files are opened in read/write share mode now instead of just read share

- Work around for Windows 7's GDI+ bug

- Added support for "type 3" vertices in models

- Fixed bug with textures that have a name of less than 6 characters


Version 0.5.4 Features

- Fixed critical bug in texture size calculation for mipmaps

- Added support for 8bit grayscale (L8) textures

- Added support for "type 8" vertices in models


Version 0.5.3 Features

- Improved model loading, most models should display correctly now.

- Added support for 32bit ARGB textures

- Fixed a few texture file memory leaks

- Fixed bug in texture mapping in 3D preview

- Fixed bug in size calculation for thumbnail generation


Version 0.5.2 Features

- Support for editing textures embedded in Model (wdr) and HTML (whm) files

- Added View/Edit buttons. Default action is View now, so use the Edit button if you wish to edit textures.

- Fixed bug with texture encoding producing low quality mipmaps.

- Fixed bug with loading SparkIV.Config.xml file


Version 0.5.1 Features

- Support for Texture File editing with Import (replace only) functionality

- Support for viewing Texture mipmaps and viewing colour channels seperately

- Support for showing most of the filenames in Audio RPF (v3) files.

- Support for launching external registered editors based on extension

- Fixed some bugs with IMG file saving


Version 0.5.0 Features

- New "Browse" feature loads up GTAIV directory into view allowing easy access to open IMG/RPF files, as well as previewing resource files not in archives.

- Experimental support for saving RPF files (hasn't been extensively tested)

- Experimental support for previewing script (*.sco) files in a pseudo C-like decompiled form as well as a disassembled form.

- Support for previewing XML and other text files

- Support for previewing Model Dictionary (*.wdd) files

- Experimental support for texture mapping in model preview (will automatically load filename.wtd if present or display textures embedded in model -- mapping may not be accurate for all models!)

- Model meshes without textures will now show in a random colour

- Model preview has a tree control allowing to view submeshes

- Model preview allows viewing model in wireframe mode (might be slow)

- Some minor bug fixes


Version 0.4.5 Features

- Texture (*.wtd) preview and support for exporting textures

- Experimental Model (*.wdr) preview

- Double click/Press enter on a supported file to preview it

- Fixed bug in resource file segment size calculation when importing data in Resoursaur.


Version 0.4.0 Features

- Opens IMGs (ver 3), and RPFs (ver 2/3). Old style IMGs (GTA3/VC/SA) are unfortunately not supported.

- Saves/Rebuilds IMGs. Saving RPFs is currently not supported, but will be added eventually.

- Allows you to import/export files.



- Microsoft .NET Framework 3.5. If SparkIV does not run, you need to download and install this from here.

- Version 1.0, 1.01 or 1.02 of GTAIV.exe. This is required for the cryptographic keys.


Resource Files

Exported Resource files will be exported as-is and compressed. To extract the data segments out of the resource file, a tool called Resoursaur (yes, creative... aren't I? smile.gif) is available in versions of Spark 0.5.4 and older (download available at the Google code link). This tool will be quite useful to those wishing to explore the resource file formats in a hex editor.


Legal Issues

A cryptographic encryption key is required for running SparkIV. For legal reasons (DMCA/EUCD/etc), this key is not included in SparkIV but rather extracted from GTAIV.exe on startup. So, you will need a supported version of GTAIV installed, or have a GTAIV.exe placed in the same directory as SparkIV.



Please don't reupload this to your website. Link to this forum topic instead. This tool is still a WIP and there are many many more updates/fixes to come.

Edited by aru
Link to comment
Share on other sites

..You can import files now?



This may be a stupid question, but is there any way to view an exported file? That would open so many doors to modding IV.

user posted image


mod it with Nitrous Oxide and chassis dyno.
Link to comment
Share on other sites

Another good job, Aru !


Note you have to remove the "read only" attribute for the file you want to open, or you'll get an error (at least, it was the case for me).


Now, how to edit the wbn, wdr, wad, ... ?


Off topic : are you gonna work in "team" with the OpenIV crew ? Your goal is, I guess, to create the same kind of tool.

Link to comment
Share on other sites

Excellent. The game doesn't check img files in the models folder, so i'll be happily testing stuff there soon, hopefully. I did do some testing with the resource segment import/export, i didn't have much progress ingame. I get the following error, just as my model (Huntley, as the case may be) should appear:



"GTA IV Fatal Error: RC20

Invalid Resource Detected - Please re-install the game"


What i did was this:

-extract the Huntley.wft, and make a backup copy

-open huntley.wft in Resoursaur.exe

-extract system data, and gfx data

-import system data, and gfx data back into huntley.wft

-save huntley.wft

-import huntley.wft into vehicles.img, and start the game

-wait impossibly long time for game to load (thats normal, your img tool seems to work fine)

-wait for huntley to spawn, then crash!


The huntley.wft that is saved from Resoursaur is 571,426 bytes, vs the 573,440 bytes of the original, unmodified huntley.wft file. There appears to be a giant block of '00' padding on the end of the original huntley.wft, that is completely absent from the one your app saves out.


Otherwise, good start to what will be an invaluable tool.

Link to comment
Share on other sites

Great work aru! As you seem to have some great insight to GTA4 fileformats and related cryptography, maybe you can help me out with something:


I'm working on an easy-to-use modmanager for GTA4 (made some for other games already). However, if the modmanager replaces the original game files, chances are, that patches or stuff in combination with modified files will mess up the installation. thus it would be best to have one package file that contains all modified files and has preference over all other files. best bet for such a package would be the filelist.pak . the file format is very easy, however, contained files haven't got filenames and instead an integer value which identifies the file (i.e. 80E49686 = common\data\fonts.dat , A4E833EF = common\data\decision\cop.ped). My guess is, that this integer is a hash of the filename, but i haven't got a clue which algorithm might be used to generate the hash. do you have any idea? the rpf files seem to use such hashes too.

Link to comment
Share on other sites

@gorgeprofondegta4... I think the goal of OpenIV is the same as mine, but our methodology for going about this is quite different. When I'm happy with the maturity of SparkIV, its going to be open source. I'm more than happy to share what I know/learnt with others, as long as they are willing to do the same. I think OpenIV wants to be a bit more closed (i.e. see this)... and IMHO, that really doesn't work well with a dynamic community like this where we have a lot of talented programmers around.


@DexX... good catch! I was testing Resoursaur with the the RSCs that were already outside the archives so I never ended up getting that error. I guess I'll have to pad it properly when importing in SparkIV. smile.gif


@HazardX... try the One-at-a-Time hash function. R* seems to like that. See http://www.gtaforums.com/index.php?showtop...st&p=1058720528

Edited by aru
Link to comment
Share on other sites

When I'm happy with the maturity of SparkIV, its going to be open source.

open source = open mind (and vice versa).

I like the way you think, dude.

I will follow every release of SparkIV, it looks promising. Keep on this way !

Link to comment
Share on other sites

Can this program open gta IV x360 archives?


Good job icon14.gif

In theory, yes (atleast it used to)... but I haven't tested it since I added support for the PC version.

Link to comment
Share on other sites

aru, you are coolest coder! icon14.gificon14.gificon14.gif

Your programm will be brilliant if it will support opening&editing Xbox360 GTAIV files cookie.gif


What about WTD/XTD supporting in future realises?

Edited by mr.Dageron
user posted image
Link to comment
Share on other sites


Does anyone know where are all the models and textures for Niko are kept? I haven't found any niko.img or player.img.

Link to comment
Share on other sites


Does anyone know where are all the models and textures for Niko are kept? I haven't found any niko.img or player.img.

There is a playerped.rpf in the \pc\models\cdimages folder.. Think that contains the player models/textures.

Link to comment
Share on other sites


Does anyone know where are all the models and textures for Niko are kept? I haven't found any niko.img or player.img.

There is a playerped.rpf in the \pc\models\cdimages folder.. Think that contains the player models/textures.

That's for the multiplayer character.

Link to comment
Share on other sites

Nice work aru. I'm really impatient to get things ingame now. turn.gif

Link to comment
Share on other sites

Perfect work, aru


@Wersaq: When OpenIV is ready for public, then we are able to open .wtd-files (textures) icon14.gif

Link to comment
Share on other sites


nice one, but seems like the resource dinosaur smile.gif can't import bigger files properly. i tried to export graphic resource from cashmachine.wtd, import it back and save, and it worked. then i tried a bigger file (uncompressed >1MB) and after importing and saving it always says that the size of the graphic segment is 0 bytes. simply said, the graphic part isnt readable anymore. hope you fix this soon, i was about to import font textures smile.gif

Edited by MixerX
Link to comment
Share on other sites

This program will be the best if it has function of Xbox360 files editing smile.gif Much better than OpenIV

user posted image
Link to comment
Share on other sites

@Wersaq... I might be adding a texture previewer to SparkIV, but there won't be a full editor from me. Someone else from here is working on one though... wink.gif


@MixerX... Yes, theres some problems with the dinosaur calculating the sizes... Also, I think I should enforce that all segments must be a multiple of 4096 bytes... which they usually are.


@mr.Dageron... Why the need to edit xbox360 files? Anyway, IMG opening/saving for 360 should work with SparkIV, but I have no way of testing that. Resoursaur will currently export the segments out of a 360 resource file, but not import.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.