Resource system: Difference between revisions

Jump to navigation Jump to search
imported>Leoetlino
imported>Leoetlino
Line 2: Line 2:


== Concepts ==
== Concepts ==
=== Resource ===
=== Resource ===
Resources (in the context of the codebase) are C++ classes that are responsible for parsing raw data from content files and storing them in a more convenient data structure.
Resources (in the context of the codebase) are C++ classes that are responsible for parsing raw data from content files and storing them in a more convenient data structure.
Line 7: Line 8:
In general, there is one resource class per file type, not format. As an example, [[bgparamlist]] and [[bxml]] do not share the same class even though both are [[AAMP]] files.
In general, there is one resource class per file type, not format. As an example, [[bgparamlist]] and [[bxml]] do not share the same class even though both are [[AAMP]] files.


In some cases, the resource is nothing more than a thin wrapper over the underlying file bytes. This is the case for [[BYML]]s and other simple resource types that don't require any additional memory allocation. Such a wrapper is (unofficially) called ResourceBase.
In some cases, the resource is nothing more than a thin wrapper over the underlying file bytes. This is the case for [[BYML|BYMLs]] and other simple resource types that don't require any additional memory allocation. Such a wrapper is (unofficially) called ResourceBase.


=== Resource factory ===
=== Resource factory ===
Line 25: Line 26:


== Special cases ==
== Special cases ==
=== Compressed files ===
=== Compressed files ===
Compressed files can be automatically decompressed and loaded if their extension starts with an 's'. The 's' prefix indicates that a file is [[Yaz0]] compressed.
Compressed files can be automatically decompressed and loaded if their extension starts with an 's'. The 's' prefix indicates that a file is [[Yaz0]] compressed.
Line 67: Line 69:
* <code>Physics/TeraMeshRigidBody/AocField/*</code>
* <code>Physics/TeraMeshRigidBody/AocField/*</code>
* <code>Voice/*/Stream_Demo6*/*.bfstm</code>
* <code>Voice/*/Stream_Demo6*/*.bfstm</code>
* <code>System/Version.txt</code>
There are two other situations where the <code>Aoc/0010/</code> prefix is supposed to be prepended:
There are two other situations where the <code>Aoc/0010/</code> prefix is supposed to be prepended:
* If the load file device is set to the <code>Pack/AocMainField.pack</code> archive file device explicitly
* If the load file device is set to the <code>Pack/AocMainField.pack</code> archive file device explicitly
Line 73: Line 76:


== Memory allocation ==
== Memory allocation ==
=== Heap size ===
=== Heap size ===
The size of the resource loading heap the system allocates every time a resource is loaded depends on the value that is listed in the [[#Resource size table]] (RSTB). If lookup fails, the game will fall back to the following formula (Switch on 1.5.0):
The size of the resource loading heap the system allocates every time a resource is loaded depends on the value that is listed in the [[#Resource size table]] (RSTB). If lookup fails, the game will fall back to the following formula (Switch on 1.5.0):
Anonymous user

Navigation menu