Quantcast

Jump to content

» «
Photo

San Andreas Save File Companion

74 replies to this topic
OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#61

Posted 5 days ago Edited by OrionSR, 4 days ago.

Sweet! I'm already tracking size of main to positively IDs script versions. Version differences within a console system don't effect the base template. It'll make more of a difference once I start working in constants for global names. 010 scripts on the other hand, are highly version dependent. An end thread instruction shouldn't be hard to find for PCv2, but my confidence is much lower for Android. 

 

I was using pointers > 0xA0000000 to test for Android saves. iOS saves are within the range of PC pointers but quite a bit higher. For iOS, maybe the pointers are higher because the offsets are actually higher, but I've only one save strand of known iOS saves so I can't draw any conclusions.

 

I have failed to install my custom main.scm so that it loads as I'd hoped. I'm pretty sure I'm doing it right as .dat files are loading as expect. I can probably use custom maps. at least I could before. But for some reason the new main isn't working. Maybe they patched it out. So... I'll try another shortcut. Fire up a mission and run a cleo script that loads up a task sequence that is never applied, then trigger whatever activates the checkpoint save. And then work up a checkpoint 1 script so I don't need to do anything for the mission. And if that doesn't work, I'll try pasting my modified mission into the retry save created for that mission.

 

And it looks like I'm going to need to go back and work in your updates or I won't know if there's anything new. Yeah, Seemann's right. We need a github page.

 

TaskTest - Task sequence is loaded but not applied by cleo immediately after starting Nines and AKs. Then it waits for a few seconds before triggering this checkpoint 1 save.

0615: define_AS_pack_begin 2@ 
078F: task_climb -1 flag 1
07CD: task_char_slide_to_coord -1 coord 2440.58 -1979.89 14.2 angle 270.0 radius 4.0
07C9: task_complex_pickup_object -1 object $3140[0]
0850: task_follow_footsteps -1 char $PLAYER_ACTOR
0859: task_walk_alongside_char -1 char $PLAYER_ACTOR
085B: task_set_kinda_stay_in_same_place -1 to 1
0A1D: task_hand_gesture -1 char $PLAYER_ACTOR
0616: define_AS_pack_end 2@  

tVehicle instead of PlayerCars 

add local int IsMissionSave = 0;

 

And... broke on too many objects. This was a drive-by save so I was expecting it to parse if I did it right. Wonder what went wrong.

 

Oh wait. It's IsMissionSave for isCheckpointSave. Still broken though.  Fixed! I think.

 

Woah. This save has 418 enex entries so I had to tweak the enex max loops a little. Currently at 500. I wonder what the max entries is for Android. I suppose I should check it out and verify my IPL mods still work on Android.

    for(i, EnexFlag = 0; i < 500; i++)

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#62

Posted 4 days ago Edited by OrionSR, 4 days ago.

Tasks by Cleo

 

TaskTest1TaskTest2 - TaskTest3TaskTest4TaskTest5TaskTest6

TaskTest7TaskTest8TaskTest9TaskTest10TaskTest11

 

TaskTest2B - Redo of broken save

 

TaskTest8a - (325,000 bytes) I tried stirring up trouble at the LV military base and a file size shrunk. Will redo.

 

I'm working my way through the task list script spoiling below. // lines are causing issues so I skipped those for now.

 

AllOpcodes - All sets wrapped into their own task sequence.

068B: task_everyone_leave_car $Smoke_Car // is new (Smoke gets out of his car)

//05DC: task_smart_flee_point $Actor_Smoke coord 2508.359 -1676.538 12.579 radius 80.0 time 5000 // can't save checkpoint
 
Spoiler

Nick007J
  • Nick007J

    Mark Chump

  • Members
  • Joined: 17 Jan 2010
  • Russia

#63

Posted 4 days ago Edited by Nick007J, 4 days ago.

Updating tTask from first of the saves. I will do one or two more saves and will continue in a few hours I think.
Spoiler


Save 2 seems broken.

Edit: done for given saves. Tasks with ID 907 have unusual structure, so I had to fix tTaskShell. I don't know if this task can be used in script command event, but if it does there might be problems. On the other hand, game would have had same problems if it was possible so I think there should not be problems with it.

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#64

Posted 4 days ago

Awesome! There are plenty of matches to confirm that the cleo tasks are saving. I couldn't be sure the new stuff was from cleo or from saving earlier in the mission. I figured that even if it didn't work with cleo that I would at least have a working task command list. Tracking down which of 9 opcodes is crashing the game is time consuming. 

 

My strategy for generating the task list was to use Sanny's opcode search for "task" while in SA SCR mode. Much of the time the codes can be intermixed. Opcodes that use a store_to variable are much more problematic. These look safe so far. I'll double check the troubled tasks before I finish.  Can you identify anything that should be tested but isn't on the command list?

 

I'll continue the task test progression tomorrow. I'm worn out for the night, but very pleased with the progress. How tough would it be to include comments about the opcode associated with each task? It's not always clear from the language used. I could always runs specific tests for opcodes and tasks in doubt.

 

And I'm sorry if I have overwhelmed you with too much all at once. Relax, enjoy the challenge, and share in my relief that it's not an impossible task to complete.


Nick007J
  • Nick007J

    Mark Chump

  • Members
  • Joined: 17 Jan 2010
  • Russia

#65

Posted 4 days ago Edited by Nick007J, 4 days ago.

My strategy for generating the task list was to use Sanny's opcode search for "task" while in SA SCR mode. Much of the time the codes can be intermixed. Opcodes that use a store_to variable are much more problematic. These look safe so far. I'll double check the troubled tasks before I finish.  Can you identify anything that should be tested but isn't on the command list?


There are some tasks that are unlikely to exist in opcodes. Like CTaskComplexMedicTreatInjuredPed is clearly a generic task from ped AI. I'll try to do something about them after we finish everything possible with opcodes.

Opcodes to task association can be calculated more or less easily. I'll try to do it later.

Tasks created by opcodes.
Spoiler
  • OrionSR likes this

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#66

Posted 4 days ago Edited by OrionSR, 4 days ago.

Save 2 seems broken.

Do you need a redo on save 2 or did it work out in the end? Making the save is easy enough if the codes don't crash or... freeze the script (the checkpoint save doesn't happen after 4 seconds).  Sometimes I run into trouble with my Windows browser being out of sync with the attached Android device. I must always re-jack if I want things to be accurate. I'll proceed with the new stuff and redo save 2 at the end before taking another shot at the problematic codes.

 

Ambulance and fire response might be tricky on Android. Their disappearance is a common complaint on mobile devices.

 

The Tasks by Cleo post above has been updated with a complete set of test files and a redo save.

 

I've got control of my map mods, script changes still aren't working. For the record, it looks like max enex on mobile is 456 - weird limit. This value simply stops the loop from running forever. One value for all versions will do just as well. I'm tempted to set max enexes at 500 but then it'd be harder to find exceptions.

  for(i, EnexFlag = 0; i < 456; i++)

\Android\data\com.rockstargames.gtasa\  (cleo files)

\Android\data\com.rockstargames.gtasa\files\  (saves)

\Android\data\com.rockstargames.gtasa\files\data (gta.dat)


Nick007J
  • Nick007J

    Mark Chump

  • Members
  • Joined: 17 Jan 2010
  • Russia

#67

Posted 3 days ago

Updated tasks for saves above.
Spoiler


It looks like the limit in enex block is 400 on mobile version, unless there is a version with increased limit.
  • OrionSR likes this

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#68

Posted 3 days ago Edited by OrionSR, 3 days ago.

I think it was this save that had the extra enexes. Don't have time to double check. I'll make a max enex save after work.


Nick007J
  • Nick007J

    Mark Chump

  • Members
  • Joined: 17 Jan 2010
  • Russia

#69

Posted 3 days ago Edited by Nick007J, 3 days ago.

I see, 1.08 version has a limit of 455 enexes. I previously checked a different version (which produces same "file id" as 1.08, which is hashed "GTASA4" string). I am not sure which exact version it was, but certainly 1.06+ according to file id.

Edit: it was 1.06. Limit was increased from 400 to 455 in 1.07.

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#70

Posted 2 days ago Edited by OrionSR, 2 days ago.

EnexTest - 455 Enexes
 
Okay, I see what you mean. My enextest save has 456 entries, but index 455 is simply the stopper word, which isn't usable as an enex. This is an unusual structure. It might be worth the trouble to confirm the logic of the routine for multiple versions. How to keep the stopper word out of enex entry structure?
 
I wouldn't mind adding another local for is107 but how would one detect the version difference? I'm having enough trouble distinguishing between Android and iOS.

Well, crap. Does opcode 085A: ever work?
 

085A: create_emergency_services_car #FIRETRUK at 2340.637 -1152.722 25.9686

Not sure why a firetruck is used as an example. The only scripted use is to spawn a couple of SF cop cars on the road next to the Wang's Auto's if CJ has a wanted level during Deconstruction when he runs out of time to destroy the portables or bury the foreman. When tested in game the cop cars don't spawn, and when tested with cleo on Android nothing every happens.

085A=4,spawn_emergency_vehicle_modelID %1d% on_street_nearest_3D_coord %2d% %3d% %4d%
spawns at default radius of spawning, with crew and ready to action vehicle.

I don't know what I'm doing wrong.
 
Any thought on the odd size of this save? TaskTest8a- (325,000 bytes) I tried stirring up trouble at the LV military base and the file size shrunk. I'm curious about why this save is the next size smaller. And, if we added enough jumps, objects, cargens, enexs, and anything else we can think of (threads?) that will increase the amount of data to be saved, can we force a 455000 sized file?

 

Ooooh, 455 max enex entries, and 455,000 max file size... Probably a coincidence. 

 

A hypothesis to test tomorrow. Rural and remote missions, and missions with ghost town effects, might result in the... Check.325 saves.  The main point to the file size investigation is that Samutz must adjust SnP for unknown files. This is not upgrade season for SnP so I'd prefer not to bother him for frequent updates.


Nick007J
  • Nick007J

    Mark Chump

  • Members
  • Joined: 17 Jan 2010
  • Russia

#71

Posted 2 days ago

I would expect 085A to work. It does nothing if vehicle model isn't loaded, maybe this is the issue?

I think saves size can exceed 390000, game has no limit, it just writes in blocks of 65000 bytes.

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#72

Posted 2 days ago

My basic hypothesis is holding true. Checkpoints during Badlands mission have the larger file size in town, but if CJ proceeds away from congested areas the smaller file size is written. I need to finish updating my template, and adding a checkpoint condition for this file size before examining my sample. I'm expecting to find far few peds -- not sure what else.

 

I'm thinking, if we are on the cusp between two file sizes depending on congestion, then it's pretty unlikely that we could push things far enough to push things to the next level. Maybe as a test save that doesn't function properly, but unlikely in normal play. Still, might be worth a test.

 

Main questions:

  • Can the two larger file sizes (>300KB) always be associated with checkpoint saves? Probably yes.
  • Is a file size of 260,000 bytes unique to mission saves? Can this size be forced by a bloated standard save?
  • How low can we go? (cue limbo music) Can a file size of 130,000 bytes be forced by a stripped main and IPL files modified to remove garages, enexes, or other structures that effect the size of the structure?

I think the question of extremes can wait, for now. But it looks like the 325,000 isn't a fluke, and will need to be accounted for.

 

Yeah, I thought of loading models and went looking for scripted examples and forgot about it when it didn't work in the mission either. Thanks. Will I need to load the crew models as well? (I'll try without first.)


Nick007J
  • Nick007J

    Mark Chump

  • Members
  • Joined: 17 Jan 2010
  • Russia

#73

Posted 2 days ago Edited by Nick007J, 2 days ago.

Formally speaking, 'checkpoint save' (a type of save that contains ped, vehicles and other data) is determined by IsMissionSave variable which is set if following conditions are true:
1) save has a mission thread (one with a negative index of a script)
2) variable preceeding threads array equals to 0 OR a variable that follows script resource array equals to 1.

If condition 2 is false but condition 1 is true, then it's 'mission save'. If condition 1 is false, it's a normal save. I think you can make a save of ususual size if you try or mod the game, so size is not always a guaranteed sign of save type.

As far as I understand, you don't need to load peds models for 085A opcode.

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#74

Posted 2 days ago Edited by OrionSR, A day ago.

Okay... I think I follow the logic for checkpoint, but I need to step through some examples to solidify the matter in my thoughts. My primary concern is that I want to positively identify the save type without processing any template variables. I try to rely on variables found a fixed offsets. Anything after the main thread gets progressively more difficult to target.

 

I suppose I can safely flag mobile saves as any file size that's a multiple of 65000, and work to get more specific from there.

 

Okay, gotta work in my model loads for 058A:. I'm determined to save those exclusive emergency tasks.

 

Ambulance Checkpoint

 

I'll need to update my template to see if this worked for the unique tasks. EMT models needed to be loaded too or it would crash. On PC, ambulances spawn quite a distance away, approach the coordinates, and medics will revive any dead bodies in the area. On Android, ambulances spawn at a distance and appear to either fall through the ground or simply disappear after a few seconds. 

 

If I need to get the medic to engage a dead body before the specialty tasks are loaded I may need to learn to scan for ambulances and mark them so they don't disappear. I read about this, but haven't tried it myself. And, the examples are for PC, and I'm not sure if I've got a good handle on Android memory pools. The offsets I was using before probably don't apply to v1.07+, or whatever I'm using with the increased enexes. Hopefully CleoA will offer a solution.

 

I'm having the same problem with an emergency firetruck response. The truck spawns, and is removed after a couple of seconds. I'm not having any luck keeping it alive by approaching.

 

Well... This is disappointing. I lost all of my template update for the tasks. I need to go back and rebuild everything, one update at a time plus revisions, and my notes on omissions, and hopefully I'll have a working template and can run more tests. 


OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#75

Posted A day ago Edited by OrionSR, A day ago.

Now that my template seems to be working again, I added a line to treat the 325000 sized files just like checkpoint saves. I should probably work in some or statements but this is working for now.

if (FileSize() == 325000) IsMissionSave = 1, isMobile = 1;

The primary difference between two checkpoint saves of different sizes (the Ryder and TaskTest8a checkpoint saves linked above) is that the TaskTest save only has 6 peds (436 bytes), 6 vehicles (200 bytes) and 30 threads (298 bytes), where as the Ryder save has 6 peds, 8 vehicles and 29 threads (mob_la1 shut down when I unlocked the cities). It seems like the checkpoint saves will always be teetering on the edge of this limit.

 

Other structures that can influence file size are objects, but this only varies a by 1 or two (unless glitched, then figure an extra 120 or more) and are fairly small (64 bytes). Enex records (6 bytes) can increase naturally from the 376 IPL enexes if CJ saves outside near burglary houses. 

 

Other structures tend to remain static without mods. Variable structures include garages (50 max, 80 bytes) and Unique Stunt Jumps (255 max, 68 bytes). It looks like the busted/wasted restart structures (20 bytes) might be variable. I've got no guess of the limits. I suspect zones can be adjusted, I don't know the limits. Each of the 378 standard zones (32 bytes) has an associated zonepop record (17 bytes).

 

Most of the structures appear to have fixed parameters that would be unlikely to vary without a tool like a limits adjuster. I'm undecided about adding support for saves with adjusted limits or extended IPL. 

 

Estimating Max File Size:

 

Rounding a bit, and dropping max enexes as trivial, this is still within a few hundred of my best estimate for maxing out the file size with easy mods.

  • 185 jumps, 12500 bytes
  • 292 cargens, 10000
  • 150 objects, 9500
  • 20 pool peds, 9000
  • 20 pool cars, 4000
  • Total, 45000 - 20000 short of 65000

The max added jumps and cargens numbers are fixed limits on PC, but should probably be tested considering all the other limit adjustments. But if we double the peds and cars in the pool, and glitch in another 100 objects, we're within a few hundred bytes of pushing things to the next level. 1 more ped and car ought to do it. I'm not sure how many peds and cars I can actually save in a pool. I've seen 28 peds so far, but I'm counting added peds to the cusp of 6. Lots of peds seems easier than lots of cars. Maybe. It'll be close. Object are key as there's no hard limit, but add too many (hardly any on PC) and the game starts to crash. Mobile hasn't shown any signs of trouble though.

 

Kill addresses for saved mission threads:

  • PCv1 {61825} 004E: terminate_this_script (confirmed)
  • PCv2 {61804} 004E: terminate_this_script (confirmed)
  • Mobile {69015} 004E: end_thread




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users