Skip to content

Warnings and Errors

grunt-lucas edited this page Jul 15, 2024 · 44 revisions

This page covers the command line semantics of the various warning options, as well as the details of each specific warning. Warnings can occur in compilation or decompilation modes. However, most warnings are specific to one more or the other. I suggest you always enable -Wall, no matter which mode you are using.

Table Of Contents

Warning Options

-Wsome-warning

Enable the warning some-warning (see below for a full list of warnings).

-Wno-some-warning

Disable the warning some-warning (see below for a full list of warnings).

-Wall

Enable all warnings.

-Wnone

Disable all warnings.

-Werror

Set all enabled warnings to generate errors instead.

-Werror=some-warning

Enable warning some-warning, and set it to generate an error.

-Wno-error=some-warning

Downgrade warning some-warning from an error to a regular warning. If some-warning is already at the warning level, or some-warning is not enabled, this will no op.

Warning Option Semantics

By default, Porytiles disables most warnings, since input assets that generate warnings upon (de)compilation will technically still (de)compile to a valid tileset. However, I recommend that you enable warnings to catch silly mistakes or usage misundertandings. The best setting is to just enable -Wall and be done with it. However, you can enable or disable particular warnings with -Wsome-warning, where some-warning is the name of some warning listed in the next section.

Warning Command Line Precedence

Warning options on the command line follow some simple precedence rules. Higher priority options always take precedence over lower priority options. The option priority is as follows, from highest to lowest:

  1. -Wnone
    1. This option will supersede any other supplied warning option. If -Wnone is suppled anywhere on the command-line, all warnings will be disabled regardless of any other supplied warning options.
  2. -Werror / -Werror=some-warning
    1. The next highest priority is -Werror and family. This means that specifying both -Wsome-warning and -Werror=some-warning on the same command line will always result in some-warning generating an error, no matter in which order these two options were supplied.
  3. -Wsome-warning
    1. -Wsome-warning takes priority only over -Wall. This is useful because you may want to enable all warnings, and then specifically disable a particular warning like: -Wall -Wno-some-warning or -Wno-some-warning -Wall
  4. -Wall
    1. -Wall takes the lowest priority of all options. Specific warning or warning-as-error requests will always override the general -Wall setting.

Warning options at the same level of precedence are evaluated such that the right-most supplied option always takes precedence. For example, the following commandline would result in some-warning being enabled: -Wsome-warning -Wno-some-warning -Wsome-warning, since -Wsome-warning is the right-most option related to some-warning.

Specific Warnings

Compilation Warnings

-Wcolor-precision-loss

The GBA uses BGR15 colors while Porytiles input tile assets use 32 bit RGBA, so there will be some precision loss when converting the input colors into GBA colors (i.e. 8 bit RGBA channels get turned into 5 bit BGR15 channels). This means that you can possibly provide two distinct RGBA colors in the input that ultimately collapse into the same BGR color in the output. This warning alerts you when that happens, so you can know when some color detailing that may be apparent on the RGBA sheets won't show up on the GBA display. This precision loss is left as a warning because it is quite common, and doesn't technically break your tileset in any real way. Defaults to off.

-Wkey-frame-no-matching-tile

The animation frame specified in key.png, for a given animation, should be used on the layer sheets to specify that a particular tile is animated. This warning alerts you when the tiles specified in a certain animation's key.png do not appear anywhere on the layer sheet. This typically indicates an oversight on your part. Defaults to off.

-Wused-true-color-mode

Porytiles provides an option (-tiles-output-pal=true-color) to output tiles.png using a special 8bpp format. This format preserves the actual colors of your tiles (as opposed to the greyscale format used by the vanilla tilesets) while remaining compatible with the pokeemerald engine. For Porymap versions older than 5.2.0, this tiles.png format was not supported. As of Porymap 5.2.0, this format is now supported. If you specified true-color mode, this warning alerts you that you must have Porymap 5.2.0 or greater. In a future Porytiles release, true-color mode will become the default. Defaults to on.

-Wattribute-format-mismatch

This warning alerts you when the attributes specified in the header of attributes.csv do not match the target base game. Base games pokeemerald/pokeruby and pokefirered have different attribute formats. Specifically, pokefirered metatiles contain the same id and behavior attributes as pokeemerald/pokeruby, but they additionally contain terrain_type and encounter_type attributes. This warning will display if attributes.csv is missing these extra attributes while the target base game is set to pokefirered. It will also display if you specify fields beyond id and behavior for target base games pokeemerald/pokeruby. Defaults to off.

-Wmissing-attributes-csv

This warning alerts you when attributes.csv is missing. When there is no attributes.csv in the source folder, Porytiles will apply the default values to all metatile attributes. Defaults to off.

-Wunused-attribute

This warning alerts you when attributes.csv specifies an attribute for a metatile ID that does not exist in the layer sheet. Defaults to off.

-Wtransparency-collapse

As noted in the description for -Wcolor-precision-loss, the GBA uses BGR15 colors while Porytiles input tile assets use 32 bit RGBA. This warning is like -Wcolor-precision-loss, except that it notifies you when a non-transparent RGBA color in the input tile assets will collapse to the transparent BGR15 color. For example, the default Porytiles transparent color is set to RGBA=255,0,255, which translates to BGR15=248,0,248 when precision loss is accounted for. This means that if you use RGBA=250,0,250 in the input tile assets, it will collapse to the transparent color upon compilation. This warning will alert you to the collapse, which was probably unintentional. Defaults to off.

-Wassign-cache-override

This warning alerts you when there is an assign.cache file present for the current input tile assets, but you have also provided an explicit command line override. In this case, Porytiles will ignore assign.cache entirely and use the provided override, with default values for the other compile parameters. Defaults to off.

-Winvalid-assign-cache

This warning alerts you when the compile settings cached in assign.cache fail to successfully build the tile assets. In this case, Porytiles will re-run the assignment parameter search matrix. Defaults to off.

-Wmissing-assign-cache

This warning alerts you when there is no assign.cache file present, i.e. there are no cached compilation settings. In this case, Porytiles will run the assignment parameter search matrix. Defaults to off.

Decompilation Warnings

-Wtile-index-out-of-range

This warning alerts you when one of the input metatile entries contains a tile index that is out of range. This issue exists in the vanilla tilesets, whose metatile entries occasionally contain garbage tile indexes. It can also occur in a manually-managed tileset if you are not careful when making edits. You usually don't notice this problem because the pokeemerald engine doesn't actually care if a tile index is out of range. It will happily display the garbage VRAM content corresponding to the out-of-range index. However, for Porytiles decompilation, this won't work. Porytiles must choose something to display. So by default, it will simply substitute primary tile 0 (i.e. the transparency tile) for the invalid index and continue decompilation. Defaults to off.

-Wpalette-index-out-of-range

Similar to the -Wtile-index-out-of-range warning above, but triggers when the palette index is out of range. By default, Porytiles will substitute palette index 0 and continue decompilation. Defaults to off.

Clone this wiki locally