Difference between revisions of "San Andreas v2.0 Modding"

From GTAMods Wiki
Jump to navigation Jump to search
 
(shortened, various fixes, see talk)
Line 1: Line 1:
'''Making GTA: San Andreas v2.0 Fully Moddable - Modding The GTA3.IMG File - by [http://www.gtamodding.com/index.php?title=User:Jarjar jarjar]'''
+
This article explains how to modify the [[archive]]s of the second version of GTA: San Andreas, based on the work of [[User:DexX|DexX]] and [[User:jarjar|jarjar]]. [http://www.gtaforums.com/index.php?showtopic=257627]
 +
 
  
 
==Introduction==
 
==Introduction==
First of all, I must thank DexX for contacting me about this, he saw it as a possibility to fix our San Andreas v2.0 modding problems involving the gta3.img file, he was unable to test it because he has version 1, I have spent the last  6 hours testing and troubleshooting his idea. And it was all worth it, GTA San Andreas Version 2.0 is now 100% moddable. So thanks to DexX, if it wasn't for him and his genius ideas, we would not have been able to make this possible.
 
  
Now, there are properly mixed ideas up to this point about what this topic is about, well let me give you the overview now. Late yesterday DexX contacted me on MSN with an idea for how we might be able to make GTA San Andreas Version 2.0, which is unmoddable up to the point of game textures, models, vehicles, peds and so on that are located in the games gta3.img file. Version 2.0 of the game was released due to the Hot Coffee mod, it removed the script for the Hot Coffee scenes, as well as adding code to the games exe (executable that starts the game) that checked the file size of the gta3.img file at start up, if you had modded it an it was bigger or smaller than the size programmed into the exe, then the game would automatically crash. DexX's idea was easy to understand, why? Well because it followed the normal modding protocol for Mapping. Creating a new .img file and putting the map files in it. Then using the gta.dat file in your games install directory to have the map access this new .img file to get the files required for the map to show up in game. So after speaking to him about it for about 30 minutes, I understood what he was on about and decided to test the theory.
+
Version 2.0 of GTA: San Andreas was released due to the [[Wikipedia:Hot Coffee mod|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.
  
At first testing I created a new .img file and placed it in the models folder of your games installation directory. Then I edited the first non-comment line of the gta.dat file in the data folder of the games installation directory to point to the new .img file I had created in the models folder. From here I extracted a vehicles TXD and DFF from the gta3.img file and then added them to the new .img file I had created. Now I couldn't remove the old files, because that would change the files size, thus still crashing the game. What we did know was that you could rename a file in the gta3.img and no re-build the img archive and the size would not be edited. So I used the format suggested by DexX, one that's not used by any of the game files, .old. Not only is it easy to find that way, but it stops game read problems.
+
===Required Tools===
  
From this I then saved the new .img file I had created for the game as VEHICLES.img and started the game for the first test. The game did not crash, glitch or create any errors. Experiment One was a success. Now it was time for Experiment Two, to do the same steps for an already spawned vehicle so we could see if it was drivable. Experiment Two passed with flying colors. Now it was the most important experiment. I had to install a third-party vehicle modification and test it. I downloaded JVT's Hummer for San Andreas and went through the same process as before only this time adding the hummer to the new file and renaming it to another vehicles name. The experiment was a success, and you can see by the image below of me driving a Ryder's Picadoor that I had modded to be the Hummer, on San Andreas Version 2.0.
+
Basically the only tool needed is an [[archive]] (img) editor that allows to do the necessary modifications (creating archives; adding and renaming files).
  
[http://img172.imageshack.us/my.php?image=proofisinthescreenshotcz0.jpg|Image:http://img172.imageshack.us/img172/5267/proofisinthescreenshotcz0.th.jpg]
+
* [http://www.gtagarage.com/mods/show.php?id=63 '''IMG Tool 2.0'''] - allows to rename files
 +
* [http://www.gta-downloads.com/database.php?act=view&id=8200 '''Alci's IMG Editor 1.5'''] - allows to add files easily and create new .img files
  
Okay, that I think that's enough of the overview of what we did, now let me show you how to do it yourself and make your game, if it's GTA San Andreas Version 2.0, fully moddable.
 
  
==The Guide To Making GTA San Andreas V2.0 Fully Moddable==
+
==Step 1 - Backup==
  
First of all, doing this is very simple, but it requires two tools, there may be more that do all the hard work for you, but these are the two I used that worked for me, so it's what I will be doing the tutorial on. Once you have done this once, you'll be able to test it out using different tools yourself.
+
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 <code>C:\Program Files\Rockstar Games\GTA San Andreas\</code>. The gta.dat file is located in the "data" directory.
  
===Tools Required===
 
*[http://www.gtagarage.com/mods/show.php?id=63 '''IMG Tool 2.0''' - ''Allows you to rename files.'']
 
*[http://www.gta-downloads.com/database.php?act=view&id=8200 '''Alci's IMG Editor 1.5''' - ''Allows you to add files easily and create new .img files.'']
 
  
===Step 1===
+
==Step 2 - Registering a new archive==
Make a backup of your games gta3.img and gta.dat files, I know you hear it all the time, but with this, it is extremely important, one slip up and you'll have to reinstall your game all over again to get the game working again. And at times you may get confused and end up making a mistake, so take don't take the risk. Backup your games gta3.img and gta.dat files. gta3.img file is located in your "models" directory in you games installation directory, which by default is "'''C:\Program Files\Rockstar Games\GTA San Andreas\'''". Then your gta.dat file is located in the "data" folder in the same installation.
 
  
===Step 2===
+
Add the following line at the top after all the comments in the original gta.dat file (note: comments are lines that start with #):
Add the following line to the first line (without the quotation marks) after all the comments in the original gta.dat file (note: comments are lines that start with #):
 
  
  "IMG MODELS\VEHICLES.IMG"
+
  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 I'm calling it "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:
 
Your first 7 lines of gta.dat should now look like this:
 
E.g:
 
 
   
 
   
 
  #
 
  #
Line 44: Line 37:
 
  IMG MODELS\CUTSCENE.IMG
 
  IMG MODELS\CUTSCENE.IMG
  
===Step 3===
 
Now you need to make a new .img file. Now the one down side of IMG Tool 2.0, is you can not create new .img files. So to save time, effort and problems, we will instead be using Alci's IMG Editor 1.5, which it a creat tool for this, although sadly is only available on two GTA Modding Websites. It's the only IMG Tool I have found so far that allows you to create new.img files. But of course, there is more than likely, others out there that I have not used.
 
 
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|frame|none|Click File -> New to create a new .img file.]]
 
 
Now you need to add what ever files you are wanting to add to the game that would usually be put in the gta3.img file, in this case I will be adding JYC's Hummer for San Andreas Vehicle Modification to the game. So when I downloaded it and extracted the .zip file, I renamed the TXD and DFF files to the name of the vehicle I would be replacing, which in this case is the picadoor, which in the gta3.img is called picador.txd and picador.dff. Remember that there TXD and DFF file names may vary from what there game name is, so watch out for that.
 
 
So I renamed the to files from landstal.txd and landstal.dff (landstal is the gta3.img's code name for Landstalker):
 
 
[[http://img174.imageshack.us/img174/3397/step2hk8.jpg|frame|none|Click Rename the files your adding to the new .img file to the name of the file they will be replacing if they we're to be placed in the gta3.img file.]]
 
 
===Step 4===
 
 
Now we need to add the files to the new .img file. In Alci's IMG Editor 1.5 click "Actions -> Import" and select the files your adding and click "Open" to add them to the file:
 
 
[[http://img138.imageshack.us/img138/9707/step3jg8.jpg|frame|none|Now import them files into the new .img file.]]
 
  
Your IMG Archive should now look like this:
+
==Step 3 - Creating the new archive==
  
[[http://img177.imageshack.us/img177/9789/step4me3.jpg|frame|none|This is how the IMG file should now look, note that it may look graphically different in different IMG Editors.]]
+
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.
  
Save it (Ctrl+S) to your the models directory in your games installation directory, call it what ever you called the .img file in Step 1. If it was VEHICLES.IMG like I it was for us in this guide, 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.
+
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:
  
===Step 5===
+
http://img371.imageshack.us/img371/5597/step1gu4.jpg <br>''Click File -> New to create a new .img file''
  
Now we're nearly done, we've added the files, saved VEHICLES.IMG or what ever 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:
+
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:
  
You need to 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. For example, if you we're doing adding the hummer over Ryders Picadoor like we are, you need to change picador.txd and picador.dff in your gta3.img file to picador.old and picador.old. Where picador is the name of the vehicle, skin, files, etc that your modding.
+
http://img138.imageshack.us/img138/9707/step3jg8.jpg <br>''Now import the files into the new .img file''
  
Your gta3.img file should look like this to begin with (remember if your not replacing the picadoor, then the file name will be different):
+
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.
  
[[http://img127.imageshack.us/img127/9995/step5yd1.jpg|frame|none|Using IMG Tool 2.0, select the files of the same name as the files you just added to the new .img file.]]
+
==Step 4 - Renaming the old files==
  
The two selected files are what we will be renaming. 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".
+
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:
  
[[http://img478.imageshack.us/img478/6853/step6my4.jpg|frame|none|Commands -> Rename" while selecting one of the files at a time and change the files extension to .old. In this case, we haves renamed the file from picadoor.dff to picadoor.old.]]
+
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".
  
Once you have named both the files TXD and DFF file(s) to .old you are done. Simple exit from IMG Tool 2.0, [i][b]without[/b][i] rebuilding the archive, and you are finished and ready to play.
+
http://img478.imageshack.us/img478/6853/step6my4.jpg <br>''Commands -> Rename while selecting one of the files at a time and change the files extension to .old''
  
That's how easy it is, it may look like a lot of steps but once you've done it once, you'll be fine and you'll soon be doing it just like how you do normal modding of the gta3.img on version 1 of the game.
+
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.
  
===What next?===
 
''I'm also soon going to begin work on a tool soon that will create a new .img file, copy the contents of the current gta3.img file into the new .img file and rename all the other ones in the gta3.img file to .old format. Meaning, you can mod your game without going through all these steps each time, because you'll be using the new .img file to replace, delete, add and rename files in. No need to even touch the gta3.img file then.''
 
  
'''Any comments, ideas, problems, etc. post [http://www.gtaforums.com/index.php?&act=ST&f=109&t=257627 here].'''
+
==See Also==
 +
* post any comments, ideas, problems, etc. in the original GTAForums thread [http://www.gtaforums.com/index.php?showtopic=257627]
  
Cheers'
+
[[Category:GTA SA]][[Category:Documentation]][[Category:Tutorials]]

Revision as of 01:22, 3 November 2006

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:\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]