NintendoClients icon indicating copy to clipboard operation
NintendoClients copied to clipboard

`AnyDataHolder`/`Data` and their inconsistent/possibly incorrect documentation

Open jonbarrow opened this issue 9 months ago • 0 comments

The current wiki has some issues/inconsistencies when it comes to what is currently documented as "AnyDataHolder". This can be broken up into 2 parts:

  1. Inconsistent documentation in the wiki itself
  2. Misunderstanding of what the structure actually seems to be

The wiki seems to refer to "AnyDataHolder" by several names, some of which can be confusing as some of the names it goes by are reused by other types (at times incorrectly as well). Such as:

  • https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol#request-1 where oExtraData is documented as Any< AuthenticationInfo>. In this case Any links to AnyDataHolder
  • https://github.com/kinnay/NintendoClients/wiki/Secure-Protocol#request-3 where hCustomData is simply documented as Data. In this case Data links to AnyDataHolder
  • https://github.com/kinnay/NintendoClients/wiki/Messaging-Protocol#usermessage-structure which says that it inherits from Data, but links to AnyDataHolder when in reality it inherits from Data https://github.com/kinnay/NintendoClients/blob/2373fbe6d685af037b81bc6604c5623ce8c8e141/nintendo/nex/messaging.py#L39
  • https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol#nulldata-structure which correctly says it inherits from Data and links to the proper Data
  • There is likely also more, these are just the first few I found while searching

This inconsistent naming of types can make it sometimes confusing at a glance as to what these types actually are when reading the wiki

Additionally some areas seem to be incorrectly documenting some fields/types as using what is called "AnyDataHolder" when they actually use something else. In reality it seems like the true name is AnyObjectHolder (in fact, I could not find any mentions of "AnyDataHolder" in any of the games I looked at), and then other types build off this type to form more type-specific *Holder types, such as DataHolder and GatheringHolder (these names were confirmed to be the real names based on old debug logs found in some games). That explains both:

  1. Why the documentation of the current "AnyDataHolder" reads This class can hold any object derived from a given base class (usually nn::nex::Data). The "usually" implying that sometimes non-Data types can be found here. Which seems to be wrong, they can't be found here it's a different *Holder type
  2. Why types like Gathering are documented as being found inside AnyDataHolder types despite not inheriting from Data (it uses GatheringHolder)

It also seems that, based on some implications of some signatures found in some Wii U titles, that the "type name" portion of the holder does NOT need to be a string? AnyObjectHolder seems to be a template class which takes in a base parent type (Data, Gathering, etc.), and then a 2nd type. In all cases we have seen the 2nd type is nn::nex::String, which we believe is how the holder determines what the "identifier" type will be (what is currently called the "type name"). For example, the signature for SecureConnection::RegisterEx types the hCustomData field as nn::nex::AnyObjectHolder<nn::nex::Data, nn::nex::String>

@DaniElectra and I did quite a bit of research into this a while ago on Discord, and I've compiled our notes on these changes in 2 places:

  • https://github.com/PretendoNetwork/nintendo-wiki/issues/34
  • https://github.com/PretendoNetwork/nex-go/issues/74 (has most of the details from our notes)

jonbarrow avatar Mar 17 '25 19:03 jonbarrow