Resource system: Difference between revisions
no edit summary
imported>Ginger (Added BFRES resource size estimation and analysis.) |
imported>Leoetlino No edit summary |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
In ''Breath of the Wild'', the '''resource system''' is a subsystem that is responsible for managing resources, i.e. content files. It is composed of [[ResourceMgrTask]], [[ResourceSystem]] and a few ancillary classes (such as "resource binders" and "handles"). | In ''Breath of the Wild'', the '''resource system''' is a subsystem that is responsible for managing resources, i.e. content files. It is composed of [[ResourceMgrTask]], [[ResourceSystem]] and a few ancillary classes (such as "resource binders" and "handles"). | ||
BotW's resource system is also used in ''[[wikipedia:Animal Crossing: New Horizons|Animal Crossing: New Horizons]]'' and called "ares" or "ARes". | |||
== Concepts == | == Concepts == | ||
Line 110: | Line 112: | ||
==== Resource size calculation ==== | ==== Resource size calculation ==== | ||
According to an internal source, Nintendo automatically generates the Resource Size Table using development builds of the game that are believed to contain instrumentation code (perhaps in the [[Patrol]] component) This is consistent with the fact that the RSTB asset has the "product" suffix in its name, which is used for machine-generated files, and also with the fact that a similar solution is used for actor instance heap size measurement. | |||
The resource loading heap is, for most factories, only used to allocate the file loading buffer (which is as large as the file to load), the C++ resource class, extra allocations depending on the resource class and some extra bytes to ensure data is aligned correctly in memory. | |||
Therefore, the following formula should give a correct size value for all resource types: | Therefore, the following formula should give a correct size value for all resource types: | ||
Line 118: | Line 122: | ||
PARSE_SIZE is the amount of memory allocated from the resource heap in the <code>Resource::parse</code> function. Determining the exact value of PARSE_SIZE requires reversing that function and tracking calls to <code>operator new()</code> because the amount of dynamically allocated memory depends on the resource. | PARSE_SIZE is the amount of memory allocated from the resource heap in the <code>Resource::parse</code> function. Determining the exact value of PARSE_SIZE requires reversing that function and tracking calls to <code>operator new()</code> because the amount of dynamically allocated memory depends on the resource. | ||
[[Category:Internals]] | [[Category:Internals]] | ||
<references /> | <references /> |