GAM file format
Applies to:
BG1, BG1: TotS, IWD, IWD:HoW, IWD: TotL
General Description
This file format is used to hold game information in save games. The GAM file does not store area, creature or item information, instead, it stores information on the party members and the global variables which affect party members.
Detailed Description
Overall structure:
Header
Party members
Party member CRE file data
NPCs (who are not in the party)
NPC kills statistics (embedded in NPC struct)
NPC CRE file data
Variables (in the GLOBAL namespace)
Journal entries
Offset | Size (datatype) | Description |
---|---|---|
0x0000 | 4 (char array) | Signature ('GAME') |
0x0004 | 4 (char array) | Version ('V1.1') |
0x0008 | 4 (dword) | Game time (300 units == 1 hour). 7 hours (2100 units) ahead time displayed in game. |
0x000c | 2 (word) | Selected Formation |
0x000e | 2 (word) | Formation button 1 |
0x0010 | 2 (word) | Formation button 2 |
0x0012 | 2 (word) | Formation button 3 |
0x0014 | 2 (word) | Formation button 4 |
0x0016 | 2 (word) | Formation button 5 |
0x0018 | 4 (dword) | Party gold |
0x001c | 2 (word) | Count of NPC structs for party members (excluding Protagonist) |
0x001e | 2 (word) | Weather bitfield
|
0x0020 | 4 (dword) | Offset to NPC structs for party members |
0x0024 | 4 (dword) | Count of NPC structs for party members (including Protagonist) |
0x0028 | 4 (dword) | Offset to party inventory |
0x002c | 4 (dword) | Count of party inventory |
0x0030 | 4 (dword) | Offset to NPC structs for non-party members. |
0x0034 | 4 (dword) | Count of NPC structs for non-party members. |
0x0038 | 4 (dword) | Offset to GLOBAL namespace variables |
0x003c | 4 (dword) | Count of GLOBAL namespace variables |
0x0040 | 8 (resref) | Main area |
0x0048 | 4 (dword) | Unknown |
0x004c | 4 (dword) | Count of journal entries |
0x0050 | 4 (dword) | Offset to journal entries |
0x0054 | 4 (dword) | Party Reputation (*10) |
0x0058 | 8 (resref) | Current area |
0x0060 | 4 (dword) | GUI flags
|
0x0064 | 80 (bytes) | Unknown |
Offset | Size (datatype) | Description |
---|---|---|
0x0000 | 2 (word) | Character selection
|
0x0002 | 2 (word) | Party order (0x0-0x5 = PlayerXFill, 0xFFFF = not in party) |
0x0004 | 4 (dword) | Offset (from start of file) to CRE resource data for this character |
0x0008 | 4 (dword) | Size of CRE resource data for this character |
0x000c | 8 (bytes) | Character Name |
0x0014 | 4 (dword) | Character orientation |
0x0018 | 8 (resref) | Characters current area |
0x0020 | 2 (word) | Character X coordinate |
0x0022 | 2 (word) | Character Y coordinate |
0x0024 | 2 (word) | Viewing rectangle X coordinate |
0x0026 | 2 (word) | Viewing rectangle Y coordinate |
0x0028 | 2 (word) | Modal action |
0x002a | 2 (word) | Happiness |
0x002c | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0030 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0034 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0038 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x003c | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0040 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0044 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0048 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x004c | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0050 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0054 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0058 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x005c | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0060 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0064 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0068 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x006c | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0070 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0074 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0078 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x007c | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0080 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0084 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x0088 | 4 (dword) | NumTimesInteracted NPC count (unused) |
0x008c | 2 (word) | Index into slots.ids for Quick Weapon 1 (0xFFFF = none) |
0x008e | 2 (word) | Index into slots.ids for Quick Weapon 2 (0xFFFF = none) |
0x0090 | 2 (word) | Index into slots.ids for Quick Weapon 3 (0xFFFF = none) |
0x0092 | 2 (word) | Index into slots.ids for Quick Weapon 4 (0xFFFF = none) |
0x0094 | 2 (word) | Quick weapon slot 1 ability (0/1/2 or -1 disabled) |
0x0096 | 2 (word) | Quick weapon slot 2 ability (0/1/2 or -1 disabled) |
0x0098 | 2 (word) | Quick weapon slot 3 ability (0/1/2 or -1 disabled) |
0x009a | 2 (word) | Quick weapon slot 4 ability (0/1/2 or -1 disabled) |
0x009c | 8 (resref) | Quick Spell 1 resouce |
0x00a4 | 8 (resref) | Quick Spell 2 resouce |
0x00ac | 8 (resref) | Quick Spell 3 resouce |
0x00b4 | 2 (word) | Index into slots.ids for Quick Item 1 (0xFFFF = none) |
0x00b6 | 2 (word) | Index into slots.ids for Quick Item 2 (0xFFFF = none) |
0x00b8 | 2 (word) | Index into slots.ids for Quick Item 3 (0xFFFF = none) |
0x00ba | 2 (word) | Quick item slot 1 ability (0/1/2 or -1 disabled) |
0x00bc | 2 (word) | Quick item slot 1 ability (0/1/2 or -1 disabled) |
0x00be | 2 (word) | Quick item slot 1 ability (0/1/2 or -1 disabled) |
0x00c0 | 32 (bytes) | Name |
0x00e0 | 4 (dword) | Talkcount |
0x00e4 | 116 bytes | Character Stats for this character |
0x0158 | 8 (resref) | Voice Set (filename prefix) |
0x0160 | 32 (char array) | Path to Voice Set folder (IWD only) |
Offset | Size (data type) | Description |
---|---|---|
0x0000 | 4 (strref) | "Most powerful vanquished" - Name |
0x0004 | 4 (dword) | "Most powerful vanquished" - XP Reward |
0x0008 | 4 (dword) | Time in party (1/15 seconds) |
0x000c | 4 (dword) | Time Joined (1/15 seconds) |
0x0010 | 1 (byte) | Party member (0 = Not in party, 1 = In party) |
0x0011 | 2 (word) | Unused |
0x0013 | 1 (byte) | First letter of CRE resref (changed to *) |
0x0014 | 4 (dword) | Kills - XP Gained (chapter) |
0x0018 | 4 (dword) | Kills - Number (chapter) |
0x001c | 4 (dword) | Kills - XP (game) |
0x0020 | 4 (dword) | Kills - number (game) |
0x0024 | 4*8 (resref array) | Favourite spells |
0x0044 | 4*2 (word array) | Favourite spell count |
0x004c | 4*8 (resref array) | Favourite weapons |
0x006c | 4*2 (word) | Favourite weapon time (time equipped in combat - 1/15 seconds) |
Offset | Size (data type) | Description |
---|---|---|
0x0000 | 32 (char array) | Variable name |
0x0020 | 8 (bytes) | Unknown |
0x0028 | 4 (dword) | Variable value |
0x002c | 40 (bytes) | Unknown |
This section stores the strref, chapter and time for any entry added to the journal.
Offset | Size (data type) | Description |
---|---|---|
0x0000 | 4 (strref) | Journal text |
0x0004 | 4 (dword) | Time (seconds) |
0x0008 | 1 (byte) | Current chapter number |
0x0009 | 1 (byte) | Read by character x |
0x000a | 1 (byte) | Journal section
|
0x000b | 1 (byte) | Location flag (0x1F = external TOT/TOH, 0xFF = internal TLK) |