Difference between revisions of "Saves (GTA 4)"

From GTAMods Wiki
Jump to navigation Jump to search
m (Block 13: Stats)
(Block 12: CarGenerators)
Line 116: Line 116:
 
==== Block 11: Gangs ====
 
==== Block 11: Gangs ====
 
==== Block 12: CarGenerators ====
 
==== Block 12: CarGenerators ====
 +
This block stores Car Generators managed by scripts in GTA 4. This includes mission rewards and boats or helicopters disabled before Algonquin and Alderney are unlocked.
 +
 +
{|class="wikitable"
 +
!OFFSET
 +
!TYPE
 +
!DESCRIPTION
 +
|-
 +
| 0x0000 || CarGenerator[25] || Car Generators array (see below)
 +
|-
 +
| 0x044C || Unknown[15] || Unknown is 16 bytes each
 +
|}
 +
 +
<div style="margin-left: 3em;">
 +
{|class="wikitable"
 +
|+ CarGenerator
 +
!OFFSET
 +
!TYPE
 +
!DESCRIPTION
 +
|-
 +
| 0x0000 || float[3] || Position of the Parked Vehicle
 +
|-
 +
| 0x000C || float[2] || Rotation (X,Y)
 +
|-
 +
| 0x0014 || float[2] || Unknown (has something to do with Z rotation)
 +
|-
 +
| 0x001C || uint16_t || Model ID
 +
|-
 +
| 0x001E || uint16_t || Pool index (normally always 0)
 +
|-
 +
| 0x0022 || uint8_t || Color 1
 +
|-
 +
| 0x0023 || uint8_t || Color 2
 +
|-
 +
| 0x0024 || uint8_t || Color 3
 +
|-
 +
| 0x0025 || uint8_t || Color 4
 +
|-
 +
| 0x0026 || uint8_t[5] || Unknown (flags)
 +
|-
 +
| 0x002B || uint8_t || Enabled (0 = disabled, 101 = enabled)
 +
|}
  
 
====Block 13: Stats====
 
====Block 13: Stats====

Revision as of 22:47, 10 January 2019

This article deals with the format of a save game file for the PC version of GTA 4.

Location

By default, the game places its save game files into the "%LocalAppData%\Rockstar Games\GTA IV\savegames\user_XXXXXXXXXXXXXXXX\" folder where XXXXXXXXXXXXXXXX is a 16-character string tied to the user's Games for Windows Live account.

The save files themselves are named in the format SGTA4XX where XX represents the in-game slot number. There are 12 slots available in the game (1-12) plus an additional auto-save slot (SGTA400).

Format Details

  • Save file size varies but is typically just under 2 megabytes.
  • Byte order is little endian. For example, the number 3452 (0x0D7C) is represented as as 0x7C 0x0D.
  • A savegame consists of 32 data blocks, two blocks with metadata and a checksum number.

Savegame Metadata

A savegame file starts with this block, which has a constant length of 0x110 bytes.

OFFSET TYPE DESCRIPTION
0x00 dword savegame version number
0x04 dword savegame size in bytes
0x08 dword global variables size (?)
0x0C char[4] "SAVE" string
0x10 wchar_t[128] Name of last mission passed
0x110 end

Notes:

  • Savegame version number value is set under the [SAVEGAME_VERSION_NUMBER] section in the GTA IV/common/data/version.txt file
  • Last mission name is prefixed with either "TLAD - " or "TBoGT - " for Episodes From Liberty City saves

Data Blocks

Each data block consists of the 5 characters BLOCK followed by a variable amount of data; in general, each block has its own unique internal format. Following the BLOCK character is always a dword specifying the size of the block, starting at the beginning of BLOCK characters.

Block 0: SimpleVars

OFFSET TYPE DESCRIPTION
0x00 char[5] a "BLOCK" string
0x04 dword size of block in bytes (always 0xB9)
0x09 dword start of data; see below
SimpleVars
OFFSET TYPE DESCRIPTION
0x00 byte[32] unknown data
0x20 dword length (ms) of in-game minute
0x24 dword weather timer (?)
0x28 dword in-game month
0x2C dword in-game day
0x30 dword in-game hours
0x34 dword in-game minutes
0x38 dword in-game day of week
0x3C byte[116] unknown data
0xB0 end

Block 1: PlayerInfo

This block has a constant length of 0xD4 bytes.

OFFSET TYPE DESCRIPTION
0x00 dword Size of block
0x04 byte[18] unknown
0x1C dword Player money
0x20 byte[4] unknown
0x24 dword Player money (Again. Perhaps one is amount shown on screen.)
0x28 byte[172] unknown
0xD4 end

Block 2: ExtraContent

Block 3: Scripts

Block 4: Garages

Block 5: GameLogic

Block 6: PathFind

Block 7: Pickups

Block 8: Restart

Block 9: Radar

Block 10: Zones

Block 11: Gangs

Block 12: CarGenerators

This block stores Car Generators managed by scripts in GTA 4. This includes mission rewards and boats or helicopters disabled before Algonquin and Alderney are unlocked.

OFFSET TYPE DESCRIPTION
0x0000 CarGenerator[25] Car Generators array (see below)
0x044C Unknown[15] Unknown is 16 bytes each
CarGenerator
OFFSET TYPE DESCRIPTION
0x0000 float[3] Position of the Parked Vehicle
0x000C float[2] Rotation (X,Y)
0x0014 float[2] Unknown (has something to do with Z rotation)
0x001C uint16_t Model ID
0x001E uint16_t Pool index (normally always 0)
0x0022 uint8_t Color 1
0x0023 uint8_t Color 2
0x0024 uint8_t Color 3
0x0025 uint8_t Color 4
0x0026 uint8_t[5] Unknown (flags)
0x002B uint8_t Enabled (0 = disabled, 101 = enabled)

Block 13: Stats

This block has a constant length of 0x1724 bytes and stores various statistics; most of which can be viewed the game's Stats menu.

OFFSET TYPE DESCRIPTION
0x00 dword Size of block
0x04 byte[80] unknown stats
0x54 float game_progress (GTA IV main story only. TLAD and TBoGT variables are below.)
0x58 float roman_like
0x5C float roman_respect
0x60 float roman_mission_progress
0x64 float vlad_mission_progress
0x65 float jacob_like
0x6C float jacob_respect
0x70 float jacob_mission_progress
0x74 float faustin_mission_progress
0x78 float manny_mission_progress
0x7C float elizabeta_mission_progress
0x80 float dwayne_like
0x84 float dwayne_respect
0x88 float dwayne_mission_progress
0x8C float brucie_like
0x90 float brucie_respect
0x94 float brucie_mission_progress
0x98 float playboy_mission_progress
0x9C float francis_mission_progress
0xA0 float ulpc_mission_progress
0xA4 float packie_like
0xA8 float packie_respect
0xAC float packie_mission_progress
0xB0 float ray_mission_progress
0xB4 float gerry_mission_progress
0xB8 float derrick_mission_progress
0xBC float bernie_mission_progress
0xC0 float bell_mission_progress
0xC4 float gambetti_mission_progress
0xC8 float jimmy_mission_progress
0xCC float carmen_ortiz_fondness
0xD0 float carmen_trust
0xD4 float alex_chilton_fondness
0xD8 float alex_trust
0xDC float kiki_jenkins_fondness
0xE0 float kiki_trust
0xE4 float michelle_fondness
0xE8 float michelle_trust
0xEC float kate_fondness
0xF0 float kate_trust
0xF4 byte[93] unknown stats
0x268 float tlad_game_progress
0x26C byte[53] unknown stats
0x340 float tbogt_game_progress
0x344 byte[65] unknown stats
0x448 dword missions_passed
0x44C dword missions_failed
0x450 dword missions_attempted
0x454 dword replays_used
0x458 dword people_killed
0x45C dword taxi_fares_completed
0x460 dword times_cheated
0x464 dword days_passed
0x468 dword times_died
0x46C dword people_run_down
0x470 dword vehicles_exploded
0x474 dword flips_done_in_vehicle
0x478 dword most_vehicle_air_spins
0x47C dword air_launches
0x480 dword helicopter_tours_taken
0x484 dword taxis_hailed
0x488 dword stunt_jumps_found
0x48C dword stunt_jumps_completed
0x490 dword kills_since_last_save
0x494 dword fires_started
0x498 dword criminals_killed
0x49C dword cars_stolen
0x4A0 dword bikes_stolen
0x4A4 dword boats_stolen
0x4A8 dword helicopters_stolen
0x4AC dword stars_attained
0x4B0 dword stars_evaded
0x4B4 dword vehicles_exported
0x4B8 dword bridges_flown_under
0x4BC dword paynspray_visits
0x4C0 dword times_got_drunk
0x4C4 dword drug_packages_delivered
0x4C8 dword cars_sold_to_stevie
0x4CC dword random_characters_met
0x4D0 dword bullets_fired
0x4D4 dword bullets_hit
0x4D8 dword kills_by_headshot
0x4DC dword melee_kills
0x4E0 dword armed_kills
0x4E4 dword __stat
0x4E8 dword __stat
0x4EC dword cars_exploded
0x4F0 dword bikes_exploded
0x4F4 dword boats_exploded
0x4F8 dword helicopters_exploded
0x4FC dword tires_popped_by_gunshot
0x500 dword weapons_pickedup
0x504 dword texts_received
0x508 dword calls_made_on_phone
0x50C dword calls_received_on_phone
0x510 dword prostitute_visits
0x514 dword tramps_given_money_to
0x518 dword emails_sent
0x51C dword meals_eaten
0x520 dword hotdogs_eaten
0x524 dword burgers_eaten
0x528 dword nuts_eaten
0x52C dword binoculars_used
0x530 dword player_died_by_melee
0x534 dword player_shot_to_death
0x538 dword player_was_blown_up
0x53C dword player_was_roadkill
0x540 dword scored_with_girl
0x544 dword pool_wins
0x548 dword pool_defeats
0x54C dword pool_clearances_from_break
0x550 dword darts_wins
0x554 dword darts_defeats
0x558 dword darts_180s_hit
0x55C dword darts_bullseyes
0x560 dword darts_shortest_checkout
0x564 dword bowling_high_score
0x568 dword bowling_wins
0x56C dword bowling_draws
0x570 dword bowling_defeats
0x574 dword bowling_spares
0x578 dword bowling_perfects
0x57C dword bowling_strikes
0x580 dword total_races_lost
0x584 dword total_races_won
0x588 dword south_broken_wins
0x58C dword south_broker_races
0x590 dword airport_run_wins
0x594 dword airport_run_races
0x598 dword dukes_blvd_wins
0x59C dword dukes_blvd_races
0x5A0 dword south_algonquin_wins
0x5A4 dword south_algonquin_races
0x5A8 dword star_junction_wins
0x5AC dword star_junction_races
0x5B0 dword road_to_bohan_wins
0x5B4 dword road_to_bohan_races
0x5B8 dword north_alderny_wins
0x5BC dword north_alderny_races
0x5C0 dword elevated_wins
0x5C4 dword elevated_races
0x5C8 dword south_alderny_wins
0x5CC dword south_alderny_races
0x5D0 dword qub3d_high_score
0x5D4 dword boating_destinations
0x5D8 dword heli_ride_destinations
0x5DC dword activities_with_roman
0x5E0 dword activities_with_jacob
0x5E4 dword activities_with_brucie
0x5E8 dword activities_with_dwayne
0x5EC dword activities_with_packie
0x5F0 dword vigilante_levels_done
0x5F4 dword most_wanted_completed
0x5F8 dword pigeons_exterminated
0x5FC dword first_aid_collected
0x600 dword islands_unlocked
0x604 dword total_dates
0x608 dword successful_dates
0x60C dword bad_dates
0x610 dword girls_dumped
0x614 dword emails_received
0x618 dword photos_taken
0x61C dword mocap_cutscenes_skipped
0x620 dword mocap_cutscenes_watched
0x624 dword cutscenes_skipped
0x628 dword cutscenes_watched
0x62C dword sodas_drunk
0x630 dword kills_with_unarmed
0x634 dword kills_with_baseball_bat
0x638 dword kills_with_poolcue
0x63C dword kills_with_knife
0x640 dword kills_with_grenade
0x644 dword kills_with_molotov
0x648 dword kills_with_rocket
0x64C dword kills_with_pistol
0x650 dword kills_with_combat_pistol
0x654 dword kills_with_pump_shotgun
0x658 dword kills_with_combat_shotgun
0x65C dword kills_with_micro_smg
0x660 dword kills_with_smg
0x664 dword kills_with_assault_rifle
0x668 dword kills_with_carbine_rifle
0x66C dword kills_with_combat_sniper
0x670 dword kills_with_sniper_rifle
0x674 dword kills_with_rpg
0x678 dword kills_with_flame_thrower
0x67C dword kills_with_minigun
0x680 dword kills_with_episodic_1
0x684 dword kills_with_episodic_2
0x688 dword kills_with_episodic_3
0x68C dword kills_with_episodic_4
0x690 dword kills_with_episodic_5
0x694 dword kills_with_episodic_6
0x698 dword kills_with_episodic_7
0x69C dword kills_with_episodic_8
0x6A0 dword kills_with_episodic_9
0x6A4 dword kills_with_episodic_10
0x6A8 dword kills_with_episodic_11
0x6AC dword kills_with_episodic_12
0x6B0 dword kills_with_episodic_13
0x6B4 dword kills_with_episodic_14
0x6B8 dword kills_with_episodic_15
0x6BC dword kills_with_episodic_16
0x6C0 dword kills_with_episodic_17
0x6C4 dword kills_with_episodic_18
0x6C8 dword kills_with_episodic_19
0x6CC dword kills_with_episodic_20
0x6D0 dword kills_with_episodic_21
0x6D4 dword kills_with_episodic_22
0x6D8 dword kills_with_episodic_23
0x6DC dword kills_with_episodic_24
0x6E0 dword times_busted
0x6E4 dword saves_made
0x6E8 byte[4156] unknown stats
0x1724 end

Block 14: IplStore

Block 15: StuntJumps

OFFSET TYPE DESCRIPTION
0x00 dword Size of block
0x04 byte[5] unknown
0x09 dword number of stunt jumps
0x0E byte[4] unknown
0x11 start of stunt jump structs (0x64 bytes each; see below)
StuntJump
OFFSET TYPE DESCRIPTION
0x00 byte unknown
0x01 byte id
0x02 byte[2] unknown, maybe padding/align
0x04 float[3] Start zone point 1 (x,y,z)
0x10 byte[4] unknown
0x14 float[3] Start zone point 2 (x,y,z)
0x20 byte[4] unknown
0x24 float[3] Land zone point 1 (x,y,z)
0x30 byte[4] unknown
0x34 float[3] Land zone point 2 (x,y,z)
0x40 byte[4] unknown
0x44 float[3] Camera coordinates (x,y,z)
0x50 byte[4] unknown
0x54 dword Reward ammount
0x58 byte is completed
0x59 byte is found
0x5A byte[10] unknown, maybe align/padding

Block 16: Radio

Block 17: Objects

Block 18: Relationships

Block 19: Inventory

Block 20: Pools

Block 21: PhoneInfo

Block 22: AudioScriptObject

Block 23: SetPieces

Block 24: Streaming

Block 25: PedType

Block 26: Tags

Block 27: Shopping

Block 28: GangWars

Block 29: EntryExits

Block 30: 3dMarkers

Block 31: Vehicles

Checksum

After the last data block the checksum value goes. The checksum appears to be the sum of most of the bytes preceding it, however, which bytes exactly is unknown (See discussion).

End Block

This block has a constant length of 0x16C bytes. Data in this block appears to relate to Games For Windows Live data.

OFFSET TYPE DESCRIPTION
0x00 char[4] END\0
0x04 dword Unknown, appears to always be 0x128
0x08 byte[292] Unknown, appears to always be a mix of 0x0, 0x1, 0x2 and 0x3 bytes
0x12C byte[64] Unknown
0x16C end