Skip to content

Common Error Codes

Spotlight edited this page Aug 16, 2022 · 5 revisions

The following is a non-exhaustive list of error codes. Contributions are more than welcome.

XML Error codes

XML errors are typically within the range of 3541xx.

Error Meaning
354116 A node is missing.
354117

A node contained a dictionary, but lacked sufficient children.

Typically this error is thrown when either too many or too little children nodes were provided.

This error can be set by two individual functions. Please see How to debug for more information.

How to debug XML/node errors

Node errors are typically set via helper functions instead of directly to their object. Between Wii no Ma version v1025 and v770, there are five functions that set the XML error code directly: XMLError, XMLErrorOther, SetNodeMissing, SetNodeMissingDict, and SetNodeMissingDictContents.

We hope the following table assists labeling efforts throughout reverse engineering.

Version Symbol Address
v770 XMLError 8025e454
XMLErrorOther 8025e44c
SetNodeMissing 8025e474
SetNodeMissingDict 8025e48c
SetNodeMissingDictContents 8025e498
v1025 XMLError 802b0d64
XMLErrorOther 802b0d5c
SetNodeMissing 802b0db0
SetNodeMissingDict 802b0dc8
SetNodeMissingDictContents 802b0e20

XMLError is used to set a specific error by an integer. It is worth breakpointing on it in general. XMLErrorOther is sparingly used throughout XML verification methods. If a specific XML error occurs and XMLError was not called, it is worth breakpointing on this as well before investigating otherwise.

While SetNodeMissingDict produces the same error code as SetNodeMissingDictContents (354117), it is used differently:

  • SetNodeMissingDict is called when a node that should contain a dictionary is missing and therefore had a child count of 0.
  • SetNodeMissingDictContents is called whenever its contents are not within range of what is expected. It is typically called directly after instructions resembling the following:
lwz        r0, 0x0(r3)
cmplw      r6, r0
blt        MISSING_DICT
lwz        r0, 0x4(r3)
cmplw      r6,r0
ble        MISSING_DICT

MISSING_DICT:
; in which r3 is the current XML object
or         r3,r29,r29
; and in which r4 is a pointer to this node's name, such as "categinfo"
or         r4,r24,r24
bl         SetNodeMissingDictContents

If you are looking for these functions yourself, a good way to orient yourself while reverse engineering is to find any instance of a reference to the string ver for SetNodeMissing, which can look like similar to this when decompiled:

int len = strlen("ver");
char* nodeContents = FindNodeContents(buffer, "ver", len);
verNode = GetNode(nodes, "ver");
if (nodeContents == NULL) {
  SetNodeMissing(xmlObject, "ver");
  success = 0;
}

Images

Some images are related to assets, and should be debugged differently.

Error Meaning
354402 Incorrect image height
354403 Incorrect image width
354405 Invalid image data. The image may be a PNG, or a progressive/interlaced JPEG.

How to debug images

Debugging images is way simpler than XML. The channel checks for the image size via if statements. It looks like this:

int correct_height = GetNeededPosterHeight(uVar5);

// It first checks for the height
if (poster_height == correct_height) {
    // Next width
    correct_width = GetNeededPosterWidth(uVar5);
    if (poster_width == correct_width) {
        // Do rendering code
    }
}

Their addresses are as follows:

Version Symbol Address
v770 GetNeededPosterHeight 80023b80
GetNeededPosterWidth 8025e44c
v1025 GetNeededPosterHeight 800274c0
GetNeededPosterWidth 80027504

You should look at two registers when you breakpoint:

  • r0, containing the dimension the channel wants in hexadecimal.
  • r30, containing the current image's dimension in hexadecimal.

Clone this wiki locally