/gta6-save-editor/FORMAT.txt

[DIR] Index of /gta6-save-editor
[TXT] FORMAT.txt  2026-12-03 16:21     17K  raw file

The title's save format, as VIctory stores it (2026-11-30)
Revised 2026-12-03: the story skip, header time, load-menu word.

A save container is a folder <name>~<16 hex digits>\v<N>\ holding
"manifest", blob 0 ("Save Game Data") and blob 1 ("Save Game
Header", 0x128 bytes). The highest v<N> is current. Containers:
SARC0015 (story), Player, SettingsProfileSettings.

Blob 0: a 0x170-byte ASAV header, then the payload.

  +0x00  "ASAV"            +0x04  version (2)
  +0x08  kind: 1 story, 2 settings, 3 player
  +0x0C  flags: 3 for the story (compressed and encrypted), else 1
  +0x14  header size (0x170)
  +0x18  0x170 + compressed size (story only)
  +0x1C  0x170 + uncompressed size
  +0x20  time (64-bit)     +0x28  label, UTF-16, 0x100 bytes
  +0x128 slot name, ASCII  +0x154 load-menu word (story only)
  +0x158 completion (float): the story %, or the overall % once
         the story is complete (see Completion)
  +0x160 checksum: Jenkins one-at-a-time over the 0x170 header
         with this field zeroed, seed 0x4BF672ED
  +0x168 length of blob 0

Jenkins one-at-a-time here sign-extends each byte.

The time is Unix seconds, the same value in blob 0 +0x20 and
blob 1 +0x10. At start the game opens the story save with the
newest time; file times do not matter (tested in game). An edited
save with its old time lost to a newer autosave beside it; the
same save stamped with the current time was the one opened.

The load-menu word, story saves only: bits 31-25 the overall
completion and bits 24-18 the story completion, each as
min(127, round(1.27 x percent)); bits 15-8 an index into the
game's mission list, which picks the name and text the load menu
shows; the other bits are zero. A story field of 127 makes the
menu show the overall figure. The menu reads this word, not the
label or the float at +0x158, and the game writes it itself with
each autosave. The index is that of the last mission passed. The
mission list is not decoded: the index is known for 13 missions
(from the game's own saves and live tests). The story skip
writes the word; for any other last mission it keeps the old
index, and the menu shows the old name until the next autosave.

Story payload, outermost first:
  1. AES-256 in counter mode, white-box (the key is folded into
     lookup tables and is not recovered). The counter starts at a
     constant. It covers everything up to the last 32 bytes.
  2. PKCS#7 padding to 16 bytes.
  3. LZ4 block format (no frame).
  4. A JSAV document: "JSAV", version 3, code-block count,
     script-block count, then per block (name hash, flag, 0,
     offset, size), then one JSON text
     {"CodeSaveBlocks":[...],"ScriptSaveBlocks":[...]} whose
     blocks those entries point at, NUL-padded to 16 bytes.
  The last 32 bytes are a tag over everything before them:
  SHA-256 from a fixed inner state (64 bytes already counted),
  finished by a white-box transform. The game checks it on load.
  editor.html computes it by running the game's own signing
  routine, translated to JavaScript.

Player and settings payloads are plain: a table of 32-bit words,
and indented JSON.

Blob 1:
  +0x00  6                 +0x04  length of blob 0
  +0x08  Jenkins hash of blob 0 (seed 0)
  +0x0C  Jenkins hash chained over blob 1's own fields: +0x10..18,
         +0x24..124, +0x18, +0x1C, +0x20, +0x08 (4 bytes each)
  +0x10  time              +0x18  copy of blob 0 +0x154
  +0x1C  copy of blob 0 +0x18
  +0x20  copy of blob 0 +0x1C
  +0x24  label, UTF-16, 0x100 bytes

On load the game checks blob 1's version, length and both hashes,
then blob 0's header checksum, then the story's tag.

Story blocks

The JSON is written by the game's reflection-driven parser. Every
struct a save uses is registered when the game starts, with each
member's name hash, type and offset, so the schema of every block
(lists that are empty in a given save included) was read from a
running game. editor.html carries that schema.

Code blocks sit under "$0x7a47cb05" (CodeSaveBlock); script blocks
under "$0x24d043f2" (ScriptSaveBlock), each with one more level,
"$0x45a134ec". Keys are case-sensitive Jenkins hashes of the
member names ("$0x" + 8 hex digits).

Value forms, by member type:
  bool, integers, float   JSON literals; floats with six decimals
  hash string             {"$data":"0x1234abcd"} (64-bit: 16 digits)
  text string             {"$data":"text"}
  GUID                    {"$data":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}
  vector                  {"$x":..,"$y":..,"$z":..}
  struct                  an object; a polymorphic one adds
                          "$type": the struct's name hash
  list of structs, hashes or bools
                          a JSON list
  list of numbers         {"$content":"int_array","$data":[..]}
                          (char_, short_, float_, int64_ too; no
                          "$data" when empty)
  bit set                 {"$bits":n,"$content":"int_array",
                          "$data":["0x.."]}
  map                     a list of {"$key":"0x..", value fields}

The blocks, in file order (names from the game; descriptions marked
"guess" in the editor are read from values):

   0 029bbf82 code   MasterVersion
        fields: #2d2c7d8c, saveVersion
   1 6ac593ca code   FogOfWar
        Revealed map regions (fog of war): region hash and type.
   2 765fb4e3 code   SimpleVariables
        Clock and calendar, plus player flags.
   3 d3f59a5e code   Inventory_2
        Inventories: one per owner, each a set of parallel item
        lists (guid, slot, item hash, category, quantity).
   4 6df5d2cf code   UnlockInfo_2_0
        Unlocks (part 1): content hashes and one flag byte each.
   5 7f587594 code   UnlockInfo_2_1
        Unlocks (part 2): content hashes and one flag byte each.
   6 038b7dfc code   UnlockInfo_2_2
        fields: #c17a88eb, #d681b464, BlockIndex
   7 84ca8078 code   UnlockInfo_2_3
        fields: #c17a88eb, #d681b464, BlockIndex
   8 148e710f code   UnlockInfo_FlagNew
        fields: #3d41a182
   9 7dae2735 code   MiniMap
        fields: #908e0d6f
  10 e528fe31 code   PlayerPed
        The player when the save loads: model, position and
        state.
  11 dbf71c51 code   PlayerDiscoverables_2
        Discoverables per character: name hashes with flags.
  12 56e4cf96 code   PersChars
        fields: #cb9a5ac1, #11aa129d, #24447d1b
  13 00894282 code   StuntJumps
        Stunt jumps.
  14 9eb34864 code   RadioStations
        fields: #1d8112f1, #d92a3060, #b850c717, RadioStations
  15 72194fcc code   Garages
        Garages and the vehicles parked in them (position,
        livery, mod bytes).
  16 7e56d644 code   Vehicles
        Owned vehicles, each stored as a binary blob (id,
        version, crc, bytes). Edit with care: the crc covers
        the bytes.
  17 c3fe6d91 code   PersistentDataStore
        fields: #60c3329f
  18 b2a81841 code   Camera
        fields: #9c736ae5, #c193844c, #5202d89d, #b43564ac,
        #a7718e06, #d3fafe6e
  19 227edfca code   AIDialogue
        fields: #5ee51a69, #27a470c4
  20 3000010d code   Challenges
        Challenges: tracked challenge progress, per challenge
        type.
  21 e4fcc5fa code   Collectibles_2
        Collectibles picked up: one entry per item (hash, key,
        stateFlags).
  22 5399d3f4 code   Persistence
        fields: dataVersion, GuidData, #ba974a88, ClearData,
        #96fbfaaf, ContainerData, ...
  23 b86613ff code   Audio
        fields: #d15a5287, #09244cb9, #a31128e4
  24 fdc1a7e8 code   Factions
        Faction standing.
  25 ba7a26ca code   ContentPools
        fields: #86ed7191
  26 e576e2f2 code   OpportunityDataStorage
        fields: #b75e2e50
  27 8496351d code   ContentTags
        fields: #87fcfc4b
  28 940e954d code   Discovery
        Discovered places and things.
  29 749dffa7 code   WorldEvents_2
        fields: CooldownGroups, #4eaa5ba8, #4355c489, #948aee30
  30 22a87829 code   PlayerCharacter
        Jason and Lucia: attribute sets and the relationship
        values between them.
  31 dee848ca code   Enterprises
        Businesses: per business Status, robbed and cooldown
        times, tasks and their progress.
  32 996ec08e code   Photos
        fields: #d85f622f
  33 f3b0a9d2 code   InGameMedia
        fields: #67035813
  34 f3401149 code   NonInteractiveEvents
        fields: InstanceCooldowns, #c82b5cf9
  35 3a4cbf5d code   Robbery
        Robbery history, per-location records and what the
        player knows.
  36 0635cbd9 code   Stats_2
        Every tracked stat. A stat is metric.subject at a
        scope; the three name tables are in this block.
  37 9653b39d code   PlayerAppearance
        Appearance: saved outfits and looks per character.
  38 d9851844 script ScriptFlow
        Story flow: the flow version, strands with activation
        counts, triggered results.
  39 bb410330 script ScriptFlowTaskLog
        Objective log: objectives shown and whether each is
        complete.
  40 b9d00096 script ScriptCellphoneGallery
        fields: #699c308d, #67cb23ad
  41 94038a79 script ScriptNewsApp
        fields: #fd98f03c, #0acab837
  42 557e6aef script ScriptSocialMedia
        Social media posts and state.
  43 d78473bf script ScriptTextMessage
        Text messages.
  44 c2789fda script ScriptCellphoneComms
        fields: #cbb26d47, #c65fa695, #cf1a8ccb, #bda4cbea,
        #e850a1ee, #c407d042, ...
  45 96f1a1c3 script ScriptCellphoneSim
        fields: #30aa3b16, #3c6eac0e
  46 bc20f32c script ScriptCellphoneDynamicMessage
        fields: #bfdf9444
  47 c5c89169 script ScriptContentPersistent
        fields: #a9539d28, #e9cc961a, #5eab02bd, #c4287722,
        #feb80b6f, #d29fa8c4, ...
  48 63872e4a script ScriptPersistentProps
        fields: #d18d6ae9, #70f131eb
  49 7459c1a4 script ScriptShops
        fields: #94a43d30, #322ce802, #1f2ee471, #30b2b9d2,
        #87ffdb7d, #0328bf05
  50 6296c122 script ScriptBankLedger
        Bank account ledger: transactions with Delta and the
        running Balance after each.
  51 dd2f5bec script ScriptFence
        fields: #11e36f92, #a5df1ac7, #c25cfb09, #46223446
  52 e20d2759 script ScriptOutfits
        fields: #49c1a68a, #3614fa8b
  53 46f14889 script ScriptCharacterPhysique
        Character physique (body stats and training history).
  54 39f9d084 script ScriptVehicleTracking
        Personal vehicles the scripts track: impound state,
        model, last position, mods and owner.
  55 8f773abc script ScriptArcadeGames
        fields: #bf0d99ef, #b934af6a, #d6b0d3fd, #6d50996e,
        #dd4657bd, #0ee9fd77, ...
  56 d7bab5ff script ScriptEntityInteraction
        fields: #8bd0696d, #4ffaec8e, #a432f0fd, #047f70c2
  57 a59a2a6d script ScriptAmbientInteraction
        fields: #7019b244, #e010903d, #5e202b2a
  58 f0e30b1d script ScriptTutorials
        fields: #f5f9b274, #f97544d0, kdlmlsl
  59 86572177 script ScriptAmbientObjective
        fields: #f0bdb803, #af556d70, #94a3467d
  60 20c37cf5 script ScriptAppearanceDirector
        fields: #c021de9b, #b77ca06f, #6d4684c7, #cdb100d4
  61 e9bcf3c7 script ScriptHeist
        fields: #13d56f77, #a68c48d1, #0be2a3c2
  62 138c815f script ScriptLaw
        fields: #d24a83ea, #9e9b78e2
  63 ec2a7ce9 script ScriptInitialSpawn
        fields: #dee94c27, #45cc2db9
  64 f74954e3 script ScriptPlayerCharacterSchedule
        fields: #bffc3ef4, #3be0822a
  65 5299e475 script ScriptGameCompletion
        Completion entries: one per finished piece of content,
        with its completion type.
  66 a9bfefa7 script ScriptVaultAchievementTracking
        fields: #c6ebeaca
  67 e83610aa script ScriptMissionChallenges
        Mission challenges: status and the challenges completed.
  68 c99f0815 script ScriptWorldEventSequence
        fields: #d1537274
  69 82d20a80 script ScriptCachedTimer
        fields: #fe1d55ef
  70 e239d1ec script ScriptUGCPhotos
        fields: #0859d77f
  71 4d0260c2 script ScriptPartnerSwitcher
        fields: #7e4bfe90
  72 822c98af script ScriptPartnerFencing
        fields: #a84126b5
  73 930cf081 script ScriptTemperament
        Temperament values.
  74 4bd07eca script ScriptVehicleSummoner
        Vehicle summoning state.
  75 f7b54200 script ScriptMediaDisplay
        fields: #f717d168
  76 8aea0b6b script ScriptSportsActivities
        fields: #07b07d11
  77 ded7dcd6 script ScriptTimeOfDayCheckpoint
        fields: #8926653a
  78 56115c7a script ScriptChitChat
        fields: #7d4dec28, #a1d9c8d8, #bbf26bff
  79 1f85d07f script ScriptItemEffect
        fields: #af2dd1c2
  80 658093ff script ScriptPodcastEpisode
        fields: #9a9d09df
  81 1ed95b5e script ScriptRadioFlow
        fields: #9628c93b, #bc15b440

Stats_2 keeps every stat as parallel lists per value type (int,
float, bool, string, char, short, int64): an index into a metric
name table, an index into a subject table, an index into a scope
table, and the value. The three name tables are hash lists in the
same block, so a stat reads as metric.subject at scope, for example
ammo.group_rifle or kills.<subject> at a character's scope.

Vehicles keeps each owned vehicle as {id, version, crc, bytes}.
id is the vehicle's save key (the same number is its item's SaveKeys
entry in Inventory_2); crc is the CRC-32 (zlib's) of bytes. bytes:
  +0  total length   +4  0   +8  chunk count (10)
  then chunks [id][size][flag][data] (chunk 1 has 14 more bytes
  after its id), then a 12-byte trailer (ff ff ff ff, then zeros).
  chunk 1  the vehicle itself: its 14 extra header bytes hold the
           model name hash (joaat) at +4, e.g. 0xcb84df29 "ganado";
           the body (colours, mods) is a u32 count, then that many
           u32 part ids: 140 on a stock car, 133 after modding it
           (25 removed, 18 added). Each id is the joaat of a part
           name (e.g. ganado_towbar_offr_03, rim_muscle_005); the
           game's part catalogue (in data.rpf) puts it in one of
           626 slots (engine, transmission, paint and so on)
  chunk 2  body damage: u32 16, u32 point count, then the
           deformation points; an undamaged car has 16 bytes with a
           count of 0, which is also what the game writes after a repair
  chunk 5  parked position: floats at data +12, +16, +20
  chunk 7  licence plate, 8 bytes, NUL-padded

Money is an inventory item: item hash 0x7c407083, category
0xf8248dc6, its Quantity the amount. The wallet is that item in
inventory c0000003, the bank in c0000002 (the HUD's two amounts;
confirmed in game by setting both). The bank is the house stash,
which the game caps at $20,000 when the save loads. Stats_2 keeps a copy of each
(int64 stats #6cd9e9f2 and #b2b08393 at a character's scope) that
lags behind the items. ScriptBankLedger is the transaction history
and does not set the amounts.

Completion: the story percentage is the Stats_2 float
#d3526971.story at the whole-game scope and the float at blob 0
+0x158: 0.99 per ScriptGameCompletion entry of type 1 (entries
of other types are not counted), at most 100, and exactly 100
once the story is complete. The game counts every type-1 entry,
so entries added by hand can bring it to 100 before the story
ends. From then on +0x158 holds the overall percentage (Stats_2
#d3526971 with no subject): half the story figure plus the other
categories (collectables and so on). The load menu shows
neither float: it reads the word at +0x154.

Marking missions completed works (tested in game): adding an entry
{"$0xea0ddfb4":{"$data":"0x<joaat(mission id)>"},"$0x56a4ee91":1}
to ScriptGameCompletion, kept sorted by the hash as a signed 32-bit
number, and raising both completion floats by 0.99 each. The game
shows the new completion in the pause menu, treats the missions as
done, and keeps them in its own later saves. That records them
only: the story itself does not move (see "Where a save resumes").
The story skip calls such an entry "ahead of the story" when the
story has not reached its mission, and by default removes the
ones still ahead after the skip: when the game later passes a
mission that already has an entry, it writes nothing more for it
(no further records, and the load menu keeps the old name; read
from the game's code, not tested).

Also tested in game (2026-12-01): an edited Jason/Lucia relationship
score is kept; a collectible's stateFlags of 1 means found (setting
five raised the in-game count by three, the other two are not in
that count); item quantities are capped on load (pistol ammo set
to 250 came back as 100).

Where a save resumes: the story position is the block ScriptFlow.
The story is a graph of 13,339 steps run by game script; the
block lists the steps in progress and the steps finished. A
mission is a step that waits for a result; its result ends some
steps and starts others. A consistent later position needs
ScriptFlow, ScriptGameCompletion, ContentTags,
ScriptContentPersistent, Discovery and four Stats_2 rows written
together, the way the game writes them when missions are passed.
editor.html's Missions tab does this by running the story graph
forward; it also sets the header's label, +0x154 and +0x158 as
the game's autosave would, and stamps the time (see above).
Tested in game (2026-12-03): saves skipped to the start of
chapters 2 to 5 and to the end of the story loaded. The game
wrote its own save from the ends and from chapters 2, 3 and 5;
at chapter 4 the chapter's first mission started by itself and
no save was written while it was watched. What the passed
missions would have handed out (money, items, unlocks) is not
written. Not tested: playing missions by hand after a skip.
Copying blocks from a later save into an earlier one does not
work (tested 2026-11-30: the game fell back to the earlier
point).

Generated 2026-12-03 17:20 UTC by indexgen