San Andreas v2.0 Modding

From GTAMods Wiki
Revision as of 22:14, 29 May 2007 by Niku4ot (talk | contribs) (Step 1 - Backup)
Jump to navigation Jump to search

This article explains how to modify the archives of the second version of GTA: San Andreas, based on the work of DexX and jarjar. [1]


Introduction

Version 2.0 of GTA: San Andreas was released due to the Hot Coffee mod, it removed the script for the Hot Coffee scenes, as well as adding code to the game's exe (executable binary file that contains the game's program code) that checked the file size of the gta3.img file at start up. If you had modded it and it was bigger or smaller than the size programmed into the exe, then the game would automatically crash. The solution is to create a new .img file and put the map files in it, then use the gta.dat file in the game's install directory to have the map access this new .img file to get the files required for the map to show up in game. However, removing the old files won't work, because that would change the file's size, thus still crashing the game. But it is possible to rename the files in the archive (without rebuilding it) and the size would not be changed.

Required Tools

Basically the only tool needed is an archive (img) editor that allows to do the necessary modifications (creating archives; adding and renaming files).


Step 1 - Backup

It is highly recommended to make a backup of the gta3.img and gta.dat files, so in case of an accidental destruction they can be restored without having to reinstall the game. gta3.img is located in the "models" directory in the game's installation directory, which by default is C\D:\Program Files\Rockstar Games\GTA San Andreas\. The gta.dat file is located in the "data" directory.

Step 2 - Registering a new archive

Add the following line at the top after all the comments in the original gta.dat file (note: comments are lines that start with #):

IMG MODELS\VEHICLES.IMG
NOTE: "VEHICLES.IMG" is the new .img file you will be creating for the mods to be placed in. It can be called what ever you want, but in this guide it's called "VEHICLES.IMG".

Your first 7 lines of gta.dat should now look like this:

#
# Load IDEs first, then the models and after that the IPLs
#
IMG MODELS\VEHICLES.IMG
IMG DATA\PATHS\CARREC.IMG
IMG DATA\SCRIPT\SCRIPT.IMG
IMG MODELS\CUTSCENE.IMG


Step 3 - Creating the new archive

Now you need to make a new .img file. Now the one down side of IMG Tool 2.0 is you can't create new .img files. So to save time, effort and problems, we will instead be using Alci's IMG Editor 1.5, which is a great tool for this, although sadly is only available on two GTA Modding Websites.

Open Alci's IMG Editor 1.5 (double click the .exe included with the download, Alci's IMG Editor 1.5.exe) and create a new .img file:

http://img371.imageshack.us/img371/5597/step1gu4.jpg
Click File -> New to create a new .img file

Now you need to add whatever files you want to add to the game that would usually be put in the gta3.img file, for example the .dff and .txd file for a vehicle you'd like to replace. In Alci's IMG Editor 1.5 click "Actions -> Import", select the files to add and click "Open" to add them to the file:

http://img138.imageshack.us/img138/9707/step3jg8.jpg
Now import the files into the new .img file

Save it (Ctrl+S) to the models directory in your game's installation directory, call it what ever you called the .img file in Step 1. If it was VEHICLES.IMG, then that's was it needs to be named, if it was something else, then you need to back track, find the name and name it that.

Step 4 - Renaming the old files

Now we're nearly done, we've added the files, saved VEHICLES.IMG or whatever you decided to call it, now all that's left to do is stop the game from reading the same files as that in your new .img file that are also in the gta3.img file. How do we do this? Simple, we can rename the contents of .img files without the files size being effected (well as long as you do not rebuild the archive), so we do this:

Find the files with the same name as those in your new .img file in the gta3.img file using IMG Tool 2.0 (this is because Alci's IMG Tool does not support file renaming in .img files), rename them to {filename}.old. The .old extension is all you need to change, this is what we use because the game does not use the .old file format extension for any game files. Click "Commands -> Rename" while selecting only one of the files and change the .txd or .dff to .old. Then do the same for the next file of the same name which is usually above or below it if your viewing by "Name" and not "Offset". To change this click "Tools -> Sort -> Name".

http://img478.imageshack.us/img478/6853/step6my4.jpg
Commands -> Rename while selecting one of the files at a time and change the files extension to .old

Once you renamed all replaced files to .old you are done. Simple exit from IMG Tool 2.0, without rebuilding the archive, and you are finished and ready to play.

See Also

  • post any comments, ideas, problems, etc. in the original GTAForums thread [2]