bgdata

From ZeldaMods (Breath of the Wild)
Revision as of 21:41, 28 March 2019 by imported>Leoetlino
Jump to navigation Jump to search

bgdata (binary game data) files are BYMLs containing lists of GameData flags. They are stored in gamedata.sarc and loaded by GameDataMgr.

bgdata files are most likely machine generated.

Contents

The root node is always a dictionary that contains one of the following keys:

  • bool_data
  • s32_data
  • f32_data
  • string_data
  • string64_data
  • string256_data
  • vector2f_data
  • vector3f_data
  • vector4_data
  • bool_array_data
  • s32_array_data
  • f32_array_data
  • string32_array_data
  • string64_array_data
  • string256_array_data
  • vector2f_array_data
  • vector3f_array_data
  • vector4_array_data

The value for each of these keys is a dictionary:

Key Type Description
Category int [Optional, present for some flags] Category[check]
DataName str Flag name (unused in release builds; only written for debug purposes)
DeleteRev int First game revision where this flag has been deleted[check]. Always -1 in all released versions.
HashValue int Flag name CRC32
InitValue varies Initial flag value

For array types, this is an array that contains a dictionary that in turn contains an array of values, like so:

  InitValue:
  - Values: [0, 0, 0, 0, 0, 0, 0]
IsEventAssociated bool Is associated with an event. If set, GameDataMgr will set the "need gimmick reset" flag (which is ignored in release builds?[check]) after any update. Ignored for non-boolean flags[check]
IsOneTrigger bool Whether the flag can only be updated once. More specifically: If true, TriggerParam will not allow updates to the flag if its value is different from the initial value.
IsProgramReadable bool Whether the flag can be read by the game
IsProgramWritable bool Whether the flag can be written to by the game
IsSave bool Whether the flag should be saved[check]
MaxValue varies Maximum flag value

For array types, this is the maximum value each item in the array can take.

MinValue varies Minimum flag value

For array types, this is the minimum value each item in the array can take.

ResetType int Reset type (see GameDataMgr)

For vector types (vec2, vec3, vec4), a value is stored as an array which further contains an array of values (e.g. [ [-1.0, 0.0] ] for a vec2).

If any key is found, the game will stop parsing the rest of the file.

Note: some of the read/write restrictions (IsOneTrigger, IsProgramReadable, IsProgramWritable) are bypassed whenever the "force" argument in read/write TriggerParam functions is true.

Examples

s32_data:
- {DataName: dummy, DeleteRev: -1, HashValue: 1000, InitValue: 0, IsEventAssociated: false,
  IsOneTrigger: false, IsProgramReadable: false, IsProgramWritable: false, IsSave: false,
  MaxValue: 0, MinValue: 0, ResetType: 0}
- {DataName: CurrentRupee, DeleteRev: -1, HashValue: 588553208, InitValue: 0, IsEventAssociated: false,
  IsOneTrigger: false, IsProgramReadable: true, IsProgramWritable: true, IsSave: true,
  MaxValue: 999999, MinValue: 0, ResetType: 0}
vector4f_data:
- DataName: dummy_vec4
  DeleteRev: -1
  HashValue: -645927712
  InitValue:
  - [0.0, 0.0, 0.0, 0.0]
  IsEventAssociated: false
  IsOneTrigger: false
  IsProgramReadable: false
  IsProgramWritable: false
  IsSave: false
  MaxValue:
  - [255.0, 255.0, 255.0, 255.0]
  MinValue:
  - [0.0, 0.0, 0.0, 0.0]
  ResetType: 0
bool_array_data:
- DataName: Horse_IsFamiliarityChecked
  DeleteRev: -1
  HashValue: -2025648995
  InitValue:
  - Values: [0, 0, 0, 0, 0, 0]
  IsEventAssociated: false
  IsOneTrigger: false
  IsProgramReadable: true
  IsProgramWritable: true
  IsSave: true
  MaxValue: true
  MinValue: false
  ResetType: 0