Okay.. I guess the real point of this topic was to understand why the technique would work... and I provided the batch file only for simplicity but I guess a lot of people are having trouble with it.
Use opium/s0biet's loader patch if you can. This is a much more harder way to go about things, but its a logical way if you understand whats happening in the background.
There are essentially a few things going on here:
1. When the game loads, it opens files.txt and verifies the files in there -- this means, all of the files listed in files.txt need to be the original unmodified files... and all the files need to be in that list (just removing a file won't solve our problem).
2. In addition to verifying the files in files.txt, the game also loads a pre-cached copy of the files from filelist.pak.
3. When the game loads the real data from the files... it checks if it was in the precached filelist.pak. If not, it'll load from the real path of the file (not the path given in files.txt).
We cheat the verification system by:
1. Making copies of all the files in the files.txt list as filename.ext.magic
2. Modifying files.txt to point to the filename.ext.magic files.
3. Replacing filelist.pak with an empty file containing no files in the cached file list.
4. Editing the original files that the game looks for when it needs the data.
5. Now the game is fooled into checking the original files during the checking phase, but loads the modified files during the loading phase.
So.. step by step... here's what I would do:
1. Make sure you have all the original files (restore from backups if you don't... or worst case scenario reinstall/fix your install).
2. Make sure you can run the game and start/load a game and actually get in game. Don't use the loader if you're using this method.
3. Ensure that your windows is setup to show file extensions (In Explorer... Tools (ALT+T) -> Options -> View... Uncheck Hide extensions for known file types)
4. Ensure that your GTA IV directory/files are not readonly.... this is particularly important if you're on Vista and installed into Program Files -- I've seen some of my files there being write protected. To fix this, right click on the "Grand Theft Auto IV" folder, and click on Properties... uncheck Readonly and then click on OK.
5. Make a backup of pc\files\filelist.pak as filelist.pak.magic and overwrite it with the provided patched filelist.pak (the batch file doesn't do the overwriting with the patched file for you!)
6. Now, try modding one file.... for example, try the common\data\WeaponInfo.xml file. The changes are easily visible, and having a saved game doesn't affect the changes in the file. To mod this we will do the following:
6a. Make a copy of files.txt and call it files.txt.magic. (We're using .magic... but it could be anything you like... just name it differently) Don't ever ever edit any of the .magic files. If you did -- you messed up... start over again.
6b. Go into common\data and make a copy of WeaponInfo.xml and name it as WeaponInfo.xml.magic
6c. Edit common\data\WeaponInfo.xml and make your changes... for an easily visible example, check out opium's change here: http://www.gtaforums...st&p=1058712412
6d. Edit files.txt with notepad...
6e. Find the line saying "common\data\WeaponInfo.xml", and change it to "common\data\WeaponInfo.xml.magic" (no quotes)
6f. Find the line saying "pc\data\filelist.pak", and change it to "pc\data\filelist.pak.magic" (no quotes)
6g. Find the line saying "files.txt" (should be at the very bottom), and change it to "files.txt.magic" (no quotes again)
6h. What you've done now is to point checking part of the game to the WeaponInfo.xml.magic file but the game will still load WeaponInfo.xml when it needs to load the data. Run the game, and test your changes.
6i. If it didn't work at this point... you did something wrong -- don't go any further. If you're happy with the progress and don't mind doing the steps above for each file... don't go any further either!
7. Now that you've proven that it works for one file... you can use the batch file to "automagically" do it for all the files... but before we do, we have to undo the test changes we made in step 5/6. To do this:
7a. Delete common\data\WeaponInfo.xml and rename WeaponInfo.xml.magic to WeaponInfo.xml
7b. Delete files.txt, and rename files.txt.magic to files.txt
7c. Delete pc\data\filelist.pak and rename pc\data\filelist.pak.magic (We do this because the magic.bat will copy filelist.pak to filelist.pak.magic and screw everything up if filelist.pak is already patched before running the magic.bat file)
8. Now extract the magic.bat file to your GTAIV directory. Before you run it, make sure you have admin rights on your computer.
9. If you're on Vista, right click on magic.bat and click on Run as Administrator. Approve any UAC screen you get. If you're on XP, you can just double click on the magic.bat file.
10. When its complete... it has essentially completely done Step 6 for ALL the files mentioned in files.txt (i.e. it just saved you some trouble and some time).
11. Overwrite pc\data\filelist.pak with the provided patched filelist.pak (the batch file doesn't do the overwriting with the patched file for you!)
If you want to be extra safe... make backups of anything you edit (even though the .magic file essentially a backup).
Edited by aru, 09 December 2008 - 09:40 PM.