Bgdata: Difference between revisions

From ZeldaMods (Breath of the Wild)
Jump to navigation Jump to search
imported>Leoetlino
(→‎Contents: If any key is found, the game will stop parsing the rest of the file.)
(→‎Contents: Revival bool flag init value)
 
(6 intermediate revisions by 2 users not shown)
Line 24: Line 24:
* vector4_array_data
* vector4_array_data


The value for each of these keys is a dictionary:
The value for each of these keys is an array of dictionaries:
{|class="wikitable"
{|class="wikitable"
! Key !! Type !! Description
! Key !! Type !! Description
|-
|-
| Category || int || [Optional, present for some flags] Category{{check}}
| Category || int || [Optional, present for some flags] Category{{check}} (only present for boolean flags)
|-
|-
| DataName || str || Flag name (unused in release builds; only written for debug purposes)
| DataName || str || Flag name (unused in release builds; only written for debug purposes)
Line 43: Line 43:
   - Values: [0, 0, 0, 0, 0, 0, 0]
   - Values: [0, 0, 0, 0, 0, 0, 0]
</source>
</source>
Revival bool flags for objects under the RevivalRandom policy have the position of the object on the main map stored in the upper 7 bits of the initial flag value.
|-
|-
| IsEventAssociated || bool || Is associated with an event{{check}}
| 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 || ?{{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. Also called "change only once" mode ("一度しか変更しない").
|-
|-
| IsProgramReadable || bool || Whether the flag can be read by the game
| IsProgramReadable || bool || Whether the flag can be read by the game
Line 68: Line 70:


If any key is found, the game will stop parsing the rest of the file.
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. Some functions enable or disable permission checks explicitly; others follow GameDataMgr's global configuration, which has two sets of TriggerParam parameters. [[AIDef:Action/EventFlagONAction]] always bypasses checks.


== Examples ==
== Examples ==

Latest revision as of 13:39, 20 October 2020

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 an array of dictionaries:

Key Type Description
Category int [Optional, present for some flags] Category[check] (only present for boolean flags)
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]

Revival bool flags for objects under the RevivalRandom policy have the position of the object on the main map stored in the upper 7 bits of the initial flag value.

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. Also called "change only once" mode ("一度しか変更しない").
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. Some functions enable or disable permission checks explicitly; others follow GameDataMgr's global configuration, which has two sets of TriggerParam parameters. AIDef:Action/EventFlagONAction always bypasses checks.

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