Help:Updating the RSTB: Difference between revisions

From ZeldaMods (Breath of the Wild)
Jump to navigation Jump to search
imported>Leoetlino
No edit summary
imported>Ginger
 
(13 intermediate revisions by 2 users not shown)
Line 12: Line 12:
== Prerequisites ==
== Prerequisites ==
* Python 3.6+ 64 bit (more details at [[Help:Setting up tools]])
* Python 3.6+ 64 bit (more details at [[Help:Setting up tools]])
* [[Help:Tools/rstb|rstbtool]]
* [[Help:Tools/rstb|rstbtool]] or [[Help:Tools/Wild_Bits|Wild Bits]]


== Updating entries ==
== Updating entries ==
Open a terminal / command prompt and run the following command:
 
=== Using rstbtool ===
Open a terminal / command prompt and run the following command {{CLI help}}
<pre>
<pre>
rstbtool [path to RSTB] set [resource path] [new size]
rstbtool [path to RSTB] set [resource path] [new size]
Line 34: Line 36:
</pre>
</pre>


''To make it clear'': the first path (the one that comes right after <code>set</code>) does not depend on where your modified file is. Think of it like a unique identifier for the resource file.}}
''To make it clear'': the first path (the one that comes right after <code>set</code>) does not depend on the location of your modified file. Think of it as a unique identifier for the resource.}}


If everything goes well, no errors will be shown on the screen. If rstbtool says it is unable to calculate the resource size, then read the following section.
If everything goes well, no errors will be shown on the screen. If rstbtool says it is unable to calculate the resource size, then read the following section.
=== Using Wild Bits ===
Open Wild Bits from the command line using the command <code>wildbits</code> {{CLI help}}. Then:
# Go to the RSTB Editor tab.
# Click "Open" and select the [[ResourceSizeTable.product.rsizetable|RSTB]] file you want to edit.
# Find the RSTB entry you want to edit. Each game file is listed by its [[canonical resource path]].  Generally, this is the path of the resource (relative to any archive) without the "s" prefix in the extension for compressed files. If you're not sure what this is, look at the second column in the [[Canonical resource path#List of resources and associated canonical paths|lists of resources]]. If necessary, use the search bar at the bottom of screen.
# Click "Update." You can either enter the size for the RSTB entry yourself (measured in bytes) or select the file using the "Detect size from file" option.
# Click "Ok." You can then save the RSTB or edit more entries.
If everything goes well, no errors will be shown on the screen. If Wild Bits says it is unable to calculate the resource size, then read the following section.


== Deleting entries ==
== Deleting entries ==
Run the following command:
 
=== Using rstbtool ===
Run the following command {{CLI help}}:
<pre>
<pre>
rstbtool [path to RSTB] del [resource path]
rstbtool [path to RSTB] del [resource path]
Line 55: Line 69:
rstbtool -b botw/System/Resource/ResourceSizeTable.product.srsizetable del Actor/GeneralParamList/Item_Fruit_A.bgparamlist
rstbtool -b botw/System/Resource/ResourceSizeTable.product.srsizetable del Actor/GeneralParamList/Item_Fruit_A.bgparamlist
</pre>}}
</pre>}}
=== Using Wild Bits ===
Open Wild Bits from the command line using the <code>wildbits</code> command. {{CLI help}} Then:
# Open the RSTB file in Wild Bits.
# Select the entry you wish to delete and click "Delete."
# Save the RSTB or modify more entries.
{{warning|text='''Deleting entries does not always work!'''
Some parts of the game require valid RSTB entries and will crash or refuse to load if you delete them. Avoid deleting entries for the Animation Sequence (AS) files: .bas, .baslist
For those files, you must determine the required size manually by trial and error.}}


=== Why deleting entries is sometimes necessary ===
=== Why deleting entries is sometimes necessary ===
Currently, rstbtool cannot calculate sizes for complex resources (e.g. [[bfres]], [[AAMP]] files). The workaround is to delete their RSTB entry: doing that causes the game to allocate a lot of memory, enough to ensure that the resource can be loaded correctly. This wastes a significant amount of memory, but it is a quick and simple workaround that is perfectly fine if you only do it for a limited number of resources (100 should be safe).
Currently, rstbtool cannot calculate sizes for complex resources (e.g. [[bfres]], [[AAMP]] files). The workaround is to delete their RSTB entry: doing that causes the game to allocate a lot of memory, enough to ensure that the resource can be loaded correctly. This wastes a significant amount of memory, but it is a quick and simple workaround that is perfectly fine if you only do it for a limited number of resources (100 should be safe). Note that for BFRES files, it is possible to generate a workable estimate for an appropriate RSTB value using the method below instead of deleting entries.
 
== Estimating resource sizes for BFRES (Wii U only) ==
[[File:Allrstb.png|alt=All BFRES RSTB entries|thumb|RSTB size analysis for all BFRES files. Y-axis: ratio, X-axis: BFRES file size, dot size: RSTB entry size.]]
Though current tools cannot yet calculate exact RSTB values for BFRES files, by analyzing the BFRES files Nintendo shipped with the game and their RSTB entries, it is possible to make some general observations which permit loose estimates for setting BFRES RSTB values.
 
There are two types of BFRES file: model and texture. (Texture files are further divided into regular textures, which include <code>Tex1</code> in the name, and mipmaps, which contain <code>Tex2</code> in the name, but there seems to be no difference in RSTB calculations concerning these two types of textures.)
 
[[File:Modelrstb.png|thumb|RSTB size analysis for BFRES model files. Y-axis: ratio, X-axis: BFRES file size, dot size: RSTB entry size.]]
For models, the ratio of RSTB entry size to BFRES file size increases early, but lazily, as BFRES file size decreases. The estimations are trickier for models than they are for textures, but they are still fairly simple overall.
 
* If your model BFRES is less than 100KB, your RSTB entry should be 200% of your BFRES file size.
* If your model BFRES is greater than 100KB, but less than 1MB, your RSTB entry should be 175% of your BFRES file size.
* If your model BFRES is greater then 1MB, but less than 2MB, your RSTB entry should be 150% of your BFRES file size.
* If your model BFRES is greater than 2MB, your RSTB entry should be 125% of your BFRES file size.
 
[[File:Tex1rstb.png|thumb|RSTB size analysis for BFRES tex1 texture files. Y-axis: ratio, X-axis: BFRES file size, dot size: RSTB entry size.]]
For textures, the ratio of RSTB entry size to BFRES file size increases late, but sharply, as BFRES file size decreases. This makes the estimates for RSTB entry size for textures incredibly easy.
 
* If your texture BFRES is less than 100KB, your RSTB entry should be 200% of your BFRES file size.
* If your texture BFRES is greater than 100KB but less than 500KB, your RSTB entry should be 110% of your BFRES file size.
* If your texture BFRES is greater than 500KB, your RSTB entry should be 105% of your BFRES file size.
 
[[File:Tex2rstb.png|thumb|RSTB size analysis for BFRES tex2 texture files. Y-axis: ratio, X-axis: BFRES file size, dot size: RSTB entry size.]]
Note: These analyses were done on the Wii U 1.5.0 version. Switch version calculations will vary.


[[Category:Guides]]
[[Category:Guides]]

Latest revision as of 08:55, 1 August 2019

The resource size table (RSTB) determines how much memory is allocated for a resource. If after editing a game resource its uncompressed file size has increased, the RSTB entry must be edited to avoid load failures.

If the file has become smaller after editing, you do not need to edit the RSTB.

Symptoms of RSTB issues:

  • The game crashes when loading a resource.
  • The game fails to load a resource.
  • The game gets stuck on the loading screen.

This guide explains how to update the RSTB.

Prerequisites

Updating entries

Using rstbtool

Open a terminal / command prompt and run the following command [help]

rstbtool [path to RSTB] set [resource path] [new size]
  • [path to RSTB] is a path to the ResourceSizeTable.product.rsizetable file. It can be found in System/Resource.
  • [resource path] is the canonical resource path of the resource. Generally, this is the path of the resource (relative to any archive) without the "s" prefix in the extension for compressed files. If you're not sure what this is, look at the second column in the lists of resources.
  • [new size] is a path to your edited file.
  • If you're editing a Wii U RSTB, add -b (Big Endian) at the end of the line.


If everything goes well, no errors will be shown on the screen. If rstbtool says it is unable to calculate the resource size, then read the following section.

Using Wild Bits

Open Wild Bits from the command line using the command wildbits [help]. Then:

  1. Go to the RSTB Editor tab.
  2. Click "Open" and select the RSTB file you want to edit.
  3. Find the RSTB entry you want to edit. Each game file is listed by its canonical resource path. Generally, this is the path of the resource (relative to any archive) without the "s" prefix in the extension for compressed files. If you're not sure what this is, look at the second column in the lists of resources. If necessary, use the search bar at the bottom of screen.
  4. Click "Update." You can either enter the size for the RSTB entry yourself (measured in bytes) or select the file using the "Detect size from file" option.
  5. Click "Ok." You can then save the RSTB or edit more entries.

If everything goes well, no errors will be shown on the screen. If Wild Bits says it is unable to calculate the resource size, then read the following section.

Deleting entries

Using rstbtool

Run the following command [help]:

rstbtool [path to RSTB] del [resource path]
  • [path to RSTB] and [resource path]: see above.
  • If you're editing a Wii U RSTB, add -b (Big Endian) at the end of the line.


Using Wild Bits

Open Wild Bits from the command line using the wildbits command. [help] Then:

  1. Open the RSTB file in Wild Bits.
  2. Select the entry you wish to delete and click "Delete."
  3. Save the RSTB or modify more entries.


Why deleting entries is sometimes necessary

Currently, rstbtool cannot calculate sizes for complex resources (e.g. bfres, AAMP files). The workaround is to delete their RSTB entry: doing that causes the game to allocate a lot of memory, enough to ensure that the resource can be loaded correctly. This wastes a significant amount of memory, but it is a quick and simple workaround that is perfectly fine if you only do it for a limited number of resources (100 should be safe). Note that for BFRES files, it is possible to generate a workable estimate for an appropriate RSTB value using the method below instead of deleting entries.

Estimating resource sizes for BFRES (Wii U only)

All BFRES RSTB entries
RSTB size analysis for all BFRES files. Y-axis: ratio, X-axis: BFRES file size, dot size: RSTB entry size.

Though current tools cannot yet calculate exact RSTB values for BFRES files, by analyzing the BFRES files Nintendo shipped with the game and their RSTB entries, it is possible to make some general observations which permit loose estimates for setting BFRES RSTB values.

There are two types of BFRES file: model and texture. (Texture files are further divided into regular textures, which include Tex1 in the name, and mipmaps, which contain Tex2 in the name, but there seems to be no difference in RSTB calculations concerning these two types of textures.)

RSTB size analysis for BFRES model files. Y-axis: ratio, X-axis: BFRES file size, dot size: RSTB entry size.

For models, the ratio of RSTB entry size to BFRES file size increases early, but lazily, as BFRES file size decreases. The estimations are trickier for models than they are for textures, but they are still fairly simple overall.

  • If your model BFRES is less than 100KB, your RSTB entry should be 200% of your BFRES file size.
  • If your model BFRES is greater than 100KB, but less than 1MB, your RSTB entry should be 175% of your BFRES file size.
  • If your model BFRES is greater then 1MB, but less than 2MB, your RSTB entry should be 150% of your BFRES file size.
  • If your model BFRES is greater than 2MB, your RSTB entry should be 125% of your BFRES file size.
RSTB size analysis for BFRES tex1 texture files. Y-axis: ratio, X-axis: BFRES file size, dot size: RSTB entry size.

For textures, the ratio of RSTB entry size to BFRES file size increases late, but sharply, as BFRES file size decreases. This makes the estimates for RSTB entry size for textures incredibly easy.

  • If your texture BFRES is less than 100KB, your RSTB entry should be 200% of your BFRES file size.
  • If your texture BFRES is greater than 100KB but less than 500KB, your RSTB entry should be 110% of your BFRES file size.
  • If your texture BFRES is greater than 500KB, your RSTB entry should be 105% of your BFRES file size.
RSTB size analysis for BFRES tex2 texture files. Y-axis: ratio, X-axis: BFRES file size, dot size: RSTB entry size.

Note: These analyses were done on the Wii U 1.5.0 version. Switch version calculations will vary.