Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
BlackEmperor

[SA] Save Editing (Gang Density)

Recommended Posts

BlackEmperor

Hey guys,

 

I wanted to ask if there's someone out here who has some experience with editing saves using a hex editor or similar device?

I would like to add Gang Density to a few zones after I downloaded Silent's excelent Extended Gang Wars mod. And yes, I know that there are Savegame Editors that allow me to change exactly that. However, there is one problem, I'm also using TTDISA.

 

1) The newest versions of Paul Breeuwsma's Savegame Editor (3.1+) refuse to open TTDISA save files. The older versions (the only one I found is 2.8) can open these files, but the Zone Editor within it is still incomplete (and it gives out weird numbers for density, so I think it wouldn't work anyway).

2) Ryosuke's Savegame Editor can open TTDISA save files, but the Zone editor itself is weird. It gives out wrong territory possessions and densities for several zones. I think the editor doesn't take the information from the save file or it doesn't read it properly due to the mod.

 

Since I've only read about another Savegame Editor that can't be downloaded as the page is down, I have to resolve to manually editing the save file. I've never done this before, but I do have some experience with hex editors (and editing more uncomplicated files).

 

I know that Zones can be found in Block 10 of the saves. I've already made out were the ZonePop Structure starts (Offset 0x0001b863 in my file, but I suppose it's the same for every other file). Each zone is made up of 17 bytes if I'm not mistaken.

 

I'll just take zone BATTP as an example, as it's near the beginning and has gang density. It is located just south of the Gant Bridge and belongs to the San Fierro Rifa.

 

00 00 00 19 00 00 00 00 00 00 00 00 00 c8 4b 22 0f

 

That's basically the ZonePop code of BATTP. The San Fierro Rifa have a density of 25 (19 in hex). If I wanted to add 40 Grove Street Families Density to that zone, I would have to change the code to

 

00 28 00 19 00 00 00 00 00 00 00 00 00 c8 4b 22 0f

 

Correct? (40 should be 28 in hex)

Now since Grove Street Families have higher density, I think the zone should be green. The current color is 00 00 c8 4b. I would change the code to

 

 

00 28 00 19 00 00 00 00 00 00 00 46 c8 00 78 22 0f

 

Optionally, I could remove the San Fierro Rifa by changing 19 to 00, right?

Also, could anyone elaborate why I would have to change 4b to 78? It seems to be the alpha value of the RGBA code, but the values don't make much sense to me. At least not in the way I know the alpha value of RGBA codes usually looks like.

 

If I understand correctly, the 22 in the penultimate byte says that the Pop Cycle is ENTERTAINMENT (02), but Gang members are present in the zone (20, together 22). Did I catch that right? 02 would only be ENTERTAINMENT, while 27 would be GANGLAND with gang members present.

 

Finally, I would have to alter the checksum. Let's say all I did was adding the GFS density (28) and I didn't alter the colour - I would basically have to add 40 to the total Checksum value?

My current Checksum value is 5c 0e 11 01 (0x01110e5c would be correct then, no?), in decimal number it would be 17.895.004. So in this case, I'd have to change it to 17.895.044 (since I added the 40), convert the new number to hex and insert it? (I'm really only trying to grasp the Checksum concept here, since it's the first file I'd edit where I have to do it) Otherwise the save would be corrupted. And if I added 40 GSF density and removed 25 SFR density, would I only have to add 15 to the Checksum value?

 

I hope some can help me with that. If there's anything else I've missed, please tell me!

 

EDIT: Corrected code, had the 28 on the Ballas byte instead of GSF.

 

EDIT: Well. It seems to work just as I thought after trying to add the LIND4c territory to the GSF.

Edited by BlackEmperor

Share this post


Link to post
Share on other sites
OrionSR

I'm in a bit of a hurry so I'll spam quick answers and let you sort it out.

 

I am very experienced with editing save files with a hex editor. I have been using the free HxD editor but recently started learning to use the 010 Editor. What do you use?

 

Try pasting the entire zone block in your save over the zone block in a normal save that works with the Savegame Editor 3.x. Hopefully the blocks are the same or we're probably out of luck on the editors. Examine or edit the block, put it back, fix checksum (let's just assume we know this).

 

Please provide a link to a TTDISA save using GTASnP. I want to figure out why it won't work in the Savegame Editor.

 

I used to have problems with SASE messing up the zones but now I don't. It's a new install on the same OS (Win7) different machine - no additional clues are available. That editor has some other odd quirks that worry me. I'm not sure if there's a problem but I don't trust it for editing. I use it as a save viewer and make the edits myself.

 

Check out the SA Save File Wiki for reference on the structure of the save. 0x0F Popcycle Group is not a flag byte. Check Sanny Builder's help file for reference.

 

A powerful tool for editing gang information is Cleo. Sanny Builder is the place to start. Simple scripts of game codes are interjected over the top of the regular game scripts. It's an introduction to coding which is probably a more productive long-term endeavor than hex editing. I love hex editing though, so if you want to play then I'm game.

 

Download Sanny and decompile your main.scm so you have reference on how the game modifies the zones.

Check SA's DATA folder for popcycle.dat. pedgrp.dat, and cargrp.dat for more information on how zones are populated.

 

Yep, encode in hex, and the byte order is reversed for things like words and dwords so watch out in other fields, not just the checksum. little endian is how hex codes are encoded in the save.

 

I usually don't bother with colors unless I need to paint colors not available in the game. Missions and deaths and other strategies for resetting the map will get the game to recolor the zone for me. Any colors set contrary to what the game wants tend to get overwritten fairly quickly.

 

thehambone just released a simple checksum tool that I haven't tested yet. Please check it out and let me know how it works. Be careful though. This version doesn't check for compatibility so if you use it on the wrong file it'll screw up the last four bytes. Does it make a backup? The strategy I've been using is to zero out the last four bytes in the save and then run the checksum-32 analysis tool included with HxD. You already know how to encode it properly.

 

ric-013's Territory Glitch Cheat Device Code:PS2 topic probably has the most extensive documentation for hex editing gang wars. It might take a bit of effort to tease the hex data from the hex code format but it's all there.

 

Most of your other questions suggest that you understand correctly and just need to run the test to confirm your hypothesis. That shouldn't take long armed with a little more information. That was a lot of information and not a lot of detail but I get the impression that you'll be able to keep busy for while before getting stuck again. Keep me informed on your progress and let me know if you need clarification.

Edited by OrionSR

Share this post


Link to post
Share on other sites
BlackEmperor

Thank you for your reply!

 

As you may spot in my second edit, I already tried it the way I've written in my first post and it worked. I was able to turn the zone LIND4c into Grove Street territory with a density of 40.

Also, you're right that changing the colour is not required. I ran a second test where I added 30 San Fierro Rifa density to the same zone without altering the colour and in the game, the zone indeed had a darker turquoise color instead of green, which it should be according to the code. This saves some time since you only need to add one number to the Checksum in this case.

Also, it's nice to know that you can add more than one gang into one territory. I really want to spawn some Aztecas into conquered Vagos territory (of course after I've changed the Ped Acquaintances, otherwise Grove Street and Aztecas members would kill each other constantly I suppose).

 

I've created an Open Office table with all zones and their corresponding hex offsets in the save file yesterday. Using this map here to spot the zones and their names and then going to the corresponding offset in the file allows for quick editing.

Save files differ between versions. That's all I know for now. The starting offsets of the blocks are different in TTDISA save files than in vanilla save file - that's probably why the Editor(s) are unable to work with TTDISA files (the length of the files is the same though).

My assumption thus far is then, that my table only works with TTDISA save files. However, I'd first have to do another save and see if anything changes. I hope not, otherwise my efforts were useless.

 

I'm using Hex Editor Neo. The free version pretty much does all that I need. Is HxD Editor free as well? That analysis tool for the checksum sounds very useful and would save some time again.

 

By the way, do you happen to know if zones which you assign to gangs but which are not assigned in vanilla automatically change ownership after the Green Sabre mission? For example if I added Grove Street territory in the docks, would it become Ballas territory after the mission or not? Same with Aztecas territory becoming Vagos territory. It would determine whether I add the new territories now or later since I don't want Grove Street/Aztecas members spawning in added territories after that mission.

 

I might try out the checksum tool you've linked on that occasion as well. Also, thanks for linking me to the Territory Glitch thread, I'll have a look at it later. But first, I'll do the annoying Car Salesman missions that were added in TTDISA. :D

 

EDIT: Okay, all save files are different. But I got a workaround for my table, I simply created a blank file and I'll insert the code there to match the offsets, edit it and then paste it back into the save. That should work.

Edited by BlackEmperor

Share this post


Link to post
Share on other sites
OrionSR

Hold off on that checksum tool for now. It's missing some dependencies. HxD is free. Give it a shot for this purpose if your editor doesn't have a similar tool. I've been really happy with it. My main motivation for upgrading to 010 was to maintain compatibility with other people on a project.

 

Please send me a link to a TTDISA save file so I can take a closer look.

 

I suspect that TTDISA will progress in a similar fashion to the standard scripts, just enhanced a little, and that means that block 1 will change size as old threads shut down and new threads are launched. Block 2 changes as objects are destroyed or created Block 10 car generators can change if cargens are added or removed but usually it doesn't without mods, Block 24 unique jumps could change with mods that add new jumps, and block 25 enex is a bit smaller if the game is saved outside. In general, you can't count on absolute offsets in the long run. You'll need a better strategy.

 

In this case, try searching for the name of the last zone, which is a little ahead of the start of the zonepop structure. You'll probably find it by eye by now but use the reference in the wiki I provide to help you zero in. Use your spreadsheet to calculate the offset to the field you'd like to edit based on the formula: zone index * record length + field offset. Use the Goto search function to jump from the current location (start of zone pop) to the desired field. Alternatively, record the current offset of the start of zone pop in the spreadsheet, add it to the end of the formula, and Goto the field using an offset relative to the beginning of the file.

 

My standard strategy for finding the start of a particular block is to test search for BLOCK and then repeat search as I count the blocks.

Share this post


Link to post
Share on other sites
BlackEmperor

Alright, I might give HxD a try if Neo doesn't have this function!

 

Yep, I always search for "BLOCK" until I get to the zones, then I scroll down until the last one. I created that spreadsheet however to find zones that are right in the middle or so. Since I already have the offset values, I just created a blank file up to the first offset and I'll then just copy and paste the ZonePop code from that point on, do the edits and then put it back into the save file. That way I can still use it despite all saves being different from each other. The length of the ZonePop Structure at least should remain the same. But it's not so bad.

 

Anything on my territory owner change question after Green Sabre?

 

Here's my current TTDISA save, maybe you can work something out with it.

http://gtasnp.com/download/45741

 

What I also forgot to say, I already used the wiki page before as reference, but thanks nontheless. :)

 

EDIT: Used the Save N Play link instead you gave me, didn't see that!

Edited by BlackEmperor

Share this post


Link to post
Share on other sites
OrionSR

The only zones that change during missions are the zones that are assigned by default. There are some rather odd quirk based on mission choice about assigning vagos or aztecas to the the el corona turfs but otherwise everything is fairly straight forward. At one point I pulled all the zone chance codes out of the scripts but I don't remember where I posted it. Probably ric-013's topic. You can probably pull those out of the decompiled scripts again if you can't find them.

Share this post


Link to post
Share on other sites
BlackEmperor

Alright, thanks. I just turned a few zones into gang territory after finishing Green Sabre, this should suffice and not cause any problems in the future. When I finish that game and choose to start a new one for some reason, I might try to add these zones as default. No idea how to do that at the moment, but there's still time to learn I guess.

 

Again, thank you for helping me out, it's much appreciated.

Share this post


Link to post
Share on other sites
OrionSR

Modifying main.scm is one strategy, but I don't recommend it. I prefer to leave my scripts and data files alone and make changes with cleo. For automatic new game changes my script watches for the marker to be active on the bicycle in the alley and then starts applying the tweaks. Zone changes are really easy to code in cleo. It's a great place to learn to start coding.

 

I took a peek at your TTDISA save and found a couple of odd structural differences. I think the complete lack of shopping data is what is causing the save to be rejected by the Savegame Editor 3.x. But there's also a few records missing in the Wasted Busted structure missing. Either way there doesn't seem to be an easy way to make the editor work on TTDISA saves.

Share this post


Link to post
Share on other sites
BlackEmperor

Yep, main.scm and CLEO are the two options I came across as well, but I don't have any knowledge with either of them. I especially didn't even know CLEO existed before I reinstalled GTA SA and started looking for mods. :D

Guess I may learn it if it's not too hard to understand. Considering that I don't really want to create large-scale mods but just add a few gang territories. But I'm not sure if TTDISA works with CLEO mods. That mod really seems to have problems with a large range of other mods.

 

That's a shame, thanks for taking a look though. At least it's good to have some input on why the save files may not work instead of just randomly having to guess something.

Share this post


Link to post
Share on other sites
OrionSR

Try to hook up with Jeansowaty and ric-013. Jean has been playing around with gang wars mods on PC for quite a while and ric-013 is adapting his old PS2 codes for Android. It shouldn't take long, maybe an hour or a weekend depending on your background, to get the basics of cleo and have a testable mod. I'm reasonably sure that cleo won't even notice TTDISA as long as the codes you use are adapted to any changes - try it, test it, fix it.

Share this post


Link to post
Share on other sites
BlackEmperor

Any idea on position editing in saves?

My current save crashes all the time after loading. What happened was the following, I finished Black Project and then did a few unqiue jumps. When I fell off my bike, my camera froze (it just didn't move anymore, I could move CJ as normal). That's usually fixed when I restart the game, but I didn't want to lose the progress again, so I used the GTA SA Control Center to teleport to a savehouse. The camera glitches afterwards heavily and you have to navigate the map in order to get into the house (which is when the camera starts to work again so that you can save), I already did that once and it worked. However, this time I somehow wasn't able to get into the marker, so I teleported to Toreno's ranch and saved there (which was outside and thus easy to get to). After saving, the game froze and I had to quit. Since then when I'm trying to reload, the game crashes when the Tierra Robada font appears in the lower right corner of the screen.

 

I tried editing the position via Savegame Editor 2.8 (which can open TTDISA as I said earlier) and moved the location to the Johnson House, but it still crashes. I thought maybe I could fix that by editing the save manually without the use of other programmes, but it seems difficult after taking a look at the wiki page.

Share this post


Link to post
Share on other sites
OrionSR

Um.. I have a pretty good understanding of positions, enough to get started on my own saves if I wanted. But I don't think anything I could do could possibly help a crashing save. If you've got the save with the messed up map then usually you can fix most problems with the map by using an enex to enter and exit an interior.

 

Another option, assuming you can load the save but can't find an enex (they might be invisible but still work): Cleo should work just fine with TTDISA, but fewer scripts are safe to use. If you pick good mods or make them yourself with TTDISA in mind then you shouldn't have any problems. In general, cleo can't do any harm in itself - it allows you to run custom scripts. You only run into trouble with poorly written or incompatible scripts.

 

Cleo is really easy to learn, hence all the bad scripts. It is not too hard for a beginner to get started and make something that seems really cool but causes problems they never thought of. But then again, it's also really easy for a beginner to make a pretty decent and popular mod given a good idea and a little background info on how the coding might interact with the main scripts or other mods.

 

ZAZ's teleport to marker script has a pretty robust map reset routine. It might help.

 

Actually, I'm really worried about this save. It sounds more messed up that your observations can account for. You didn't save over your only good save with a glitchy camera did you? These are tiny little files. You could keep every save you ever made in a backup folder and never miss the hard disk space. Anyway, the link for that save you posted above is still active.

Share this post


Link to post
Share on other sites
BlackEmperor

My last working save is Tanker Commander (so a bit further than the save I posted here), while it would be better to start from there again and do all of Badlands, San Fierro and the Desert again (including a gold medal in that "90" Driving School mission that drove me crazy) instead of having to start all over again, it's still quite bad. Maybe I'll use the other options of the CC to breeze through missions and such.

I don't really know what's actually wrong with the save. If I'm quick enough, I'm able to pause the game shortly after loading, maybe that way I can use some teleporters to try and teleport in an interior or somewhere else. I hope at least. It crashes quite shortly after loading, so I'm unable to do anything ingame.

 

EDIT: Nope, seems like all that stuff only works from that point on when the game crashes, so I think I can forget this save. I love that stupid camera glitch.

Edited by BlackEmperor

Share this post


Link to post
Share on other sites
OrionSR

I think you should do the humane thing and put your save out of it's misery.If your goal is to invest months in an effort to become an expert save editor then have fun and good luck. I'll try to advise whenever I can. If your goal is to play and have fun altering gang wars then revert to your best backup. It is by far the quickest and easiest strategy.

 

False Hope: If you set your global timer to 0 and the save will load without crashing then revert the save and this time add ten thousand to the wake timer for psave1 and see if the game crashes ten seconds after loading. If that works then revert again and examine the psave1 thread in main.scm and use SASE to check the values of the globals in an effort to figure out what might be wrong. Research and verify the correct settings for anything else documented in the save wiki that might have something to do with cameras or coordinates. It is possible to paste known good blocks into a bad save and isolate glitches. Pasting suspicious blocks into a good save might also help.

Share this post


Link to post
Share on other sites
BlackEmperor

Thanks. I just reloaded the earlier save and I'm currently setting everything up for my San Fierro stay (Snapshots, assets, etc...). That's probably going to be a lot faster than trying to, well, save my save.

 

Seems like the camera glitch appears sometimes after using ALT+TAB and doing some stuff outside of the game (like searching and opening maps on the internet), so maybe I know how to prevent it from happening now. There are also some indicators I have only noticed now like the "Unique Jump Completed" notification not disappearing. After getting off your vehicle, the camera stops to move, so if I notice that again next time, I'll just drive to a savehouse immediately and trying not to leave the vehicle.

Share this post


Link to post
Share on other sites
Yosuke
On 1/19/2015 at 7:11 PM, BlackEmperor said:

 

00 00 00 19 00 00 00 00 00 00 00 00 00 c8 4b 22 0f

hey can u explain which gang is assigned to each number? and how to change color value, how to find zone id and also how to put it to this line.

Edited by Yosuke

Share this post


Link to post
Share on other sites
BlackEmperor

Should be:

Ballas - Grove Street - Vagos - Rifa - Da Nang - Mafia - Triads - Aztecas - Unused - Unused (each two bytes represent a gang in that order, so 19 would be the Rifa)

 

I don't know what you mean by color value. I think that the opacity is determined by gang density. So the higher the number you put for a gang, the more "visible" the color will be on the map. If you mean how to change the color of each gang, no idea. The color seems to be set automatically, so even if you put a different value for the color, it will still revert to default.

Zone IDs, why do you need them? The zones are in a set order in the block. Unfortunately I don't have the map and spreadsheet I talked about in my opening post conveniently available at the moment (new PC, but I might have deleted them anyway on my older one).

No idea what you mean by the last bit.

 

Sorry for the late reply, but I haven't been active for, like, three years roughly? I only came back because I'd like to play SA again and remembered that I did some gang related editing and stuff. 😅

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 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.