Chapter 3 Binary Format
3-21. SwitchList

2. Switch Area

The Switch Area is the actual Switch Node. When compared with other nodes, the Switch Node has a slightly different nature. For example, there is occasionally a desire to change the link from node A to node C through a certain conditionality, when extending the link from node A to node B. In this case, it is possible to link node B as a default value and determine a constant for the u32 type needed to switch to node C. The mapping is as follows.

The method specified when linking from each node to Switch Node is 0x80000000 | N, if the index of the Switch area in the SwitchList area being specified is N. By doing this, the index number is determined to be the index number in the SwitchList (and not in the list of nodes that should be indexed), when the highest bit of the field described on the NIFF converter side is 1. Therefore, it means that indexes of 0x80000000 or more will not exist in each list. (Of course, a file having an index of that magnitude is not realistic.)

u32 switch_tag
u32 this_switch_index
u32 switch_size
u32 link_list_type
u32 default_link_index
u32 case_node_num
u32 switch_condition
u32 nintendo_extension_block_size
u32 user_extension_block_size
u32 case_val(0)
u32 case_val(case_node_num - 1)
cese_dest_index(case_node_num - 1)

Figure: Switch Area Memory Map

u32 switch_tag Tag indicating Switch Switch. Set the following tag
TAG_SWITCH	0x00130100
u32 this_switch_index Index number of this Switch
u32 switch_size Size of this Switch
u32 link_list_type Index number of node to be linked to this Switch node
u32 default_link_index Index number of node to be linked as default
u32 case_node_num Number of nodes to be conditionally branched
u32 switch_condition Condition at branch
u32 nintendo_extension_block_size Nintendo extension block size
u32 user_extension_block_size User extension block size
u32 case_val Branching condition
u32 cese_dest_index Index number of conditional branch destination
NintendoExtensionBlock Nintendo extension block
UserExtensionBlock User extension block