AINB: Difference between revisions

53 bytes added ,  10 months ago
switched to module terminology
m (figured out the other one too)
(switched to module terminology)
Line 2: Line 2:


=== File Structure ===
=== File Structure ===
AINB is a little endian format similar to most Switch file formats. An AINB file consists of a set of interconnected nodes which act like a syntax tree and control the behavior of actors. These nodes can also be calls to external AINB files, allowing AINB files to form entire trees of files. The root file of the tree will have <code>.root.ainb</code> as their extension while each module in the tree will have the extension <code>.module.ainb</code>. There are three primary categories of AINB files in ''TotK'': AI, Logic, and Sequence. For AI and Sequence files, the file's entry point is one or more commands which is linked to one or two child nodes. All nodes are accessed by their index (references to precondition nodes will use their precondition node index which is local to the amount of precondition nodes in the file).
AINB is a little endian format similar to most Switch file formats. An AINB file consists of a set of interconnected nodes which act like a syntax tree and control the behavior of actors. These nodes can also be calls to external AINB files (known as modules), allowing AINB files to form entire trees of files. The root file of the tree will have <code>.root.ainb</code> as their extension while each module in the tree will have the extension <code>.module.ainb</code>. There are three primary categories of AINB files in ''TotK'': AI, Logic, and Sequence. For AI and Sequence files, the file's entry point is one or more commands which is linked to one or two child nodes. All nodes are accessed by their index (references to precondition nodes will use their precondition node index which is local to the amount of precondition nodes in the file).


All string offsets in the file are relative to the beginning of the string pool and name hashes are 32-bit murmur3 hashes. There are six possible types for AINB parameters: int (signed 32-bit integer), bool, float (32-bit), vector3f, and pointer. Pointer parameters are pointers to objects.
All string offsets in the file are relative to the beginning of the string pool and name hashes are 32-bit murmur3 hashes. There are six possible types for AINB parameters: int (signed 32-bit integer), bool, float (32-bit), vector3f, and pointer. Pointer parameters are pointers to objects.
Line 21: Line 21:
# Precondition Nodes
# Precondition Nodes
# Expression Binary
# Expression Binary
# Embedded AINB Files
# AINB Modules
# Entry Strings
# Entry Strings
# File Hashes
# File Hashes
Line 158: Line 158:
|0x04
|0x04
|u32
|u32
|Embedded AINB Files Offset
|AINB Modules Array Offset
|-
|-
|0x60
|0x60
Line 495: Line 495:
|-
|-
|Element_ModuleIF_Input_S32
|Element_ModuleIF_Input_S32
|Passes a signed int as output to another node as input
|Receives a signed int input from the calling AINB file
|-
|-
|Element_ModuleIF_Input_F32
|Element_ModuleIF_Input_F32
|Passes a 32-bit float as output to another node as input
|Receives a 32-bit float input from the calling AINB file
|-
|-
|Element_ModuleIF_Input_Vec3f
|Element_ModuleIF_Input_Vec3f
|Passes a vector3f as output to another node as input
|Receives a vector3f input from the calling AINB file
|-
|-
|Element_ModuleIF_Input_String
|Element_ModuleIF_Input_String
|Passes a string as output to another node as input
|Receives a string input from the calling AINB file
|-
|-
|Element_ModuleIF_Input_Bool
|Element_ModuleIF_Input_Bool
|Passes a boolean int as output to another node as input
|Receives a bool input from the calling AINB file
|-
|-
|Element_ModuleIF_Input_Ptr
|Element_ModuleIF_Input_Ptr
|Passes a pointer as output to another node as input
|Receives an object pointer input from the calling AINB file
|-
|-
|Element_ModuleIF_Output_S32
|Element_ModuleIF_Output_S32
|Passes a signed int as output to another node as output
|Returns a signed int output from the module to the calling AINB file
|-
|-
|Element_ModuleIF_Output_F32
|Element_ModuleIF_Output_F32
|Passes a 32-bit float as output to another node as output
|Returns a 32-bit float output from the module to the calling AINB file
|-
|-
|Element_ModuleIF_Output_Vec3f
|Element_ModuleIF_Output_Vec3f
|Passes a vector3f as output to another node as output
|Returns a vector3f output from the module to the calling AINB file
|-
|-
|Element_ModuleIF_Output_String
|Element_ModuleIF_Output_String
|Passes a string as output to another node as output
|Returns a string output from the module to the calling AINB file
|-
|-
|Element_ModuleIF_Output_Bool
|Element_ModuleIF_Output_Bool
|Passes a boolean int as output to another node as output
|Returns a bool output from the module to the calling AINB file
|-
|-
|Element_ModuleIF_Output_Ptr
|Element_ModuleIF_Output_Ptr
|Passes a pointer as output to another node as output
|Returns an object pointer output from the module to the calling AINB file
|-
|-
|Element_ModuleIF_Child
|Element_ModuleIF_Child
|Unsure, appears to just be a node connected to a ModuleIF node as a child node
|Returns the node connection name from the module to the calling AINB file
|-
|-
|Element_StateEnd
|Element_StateEnd
Line 548: Line 548:
|-
|-
|1
|1
|Is External AINB File
|Is Module
|-
|-
|1
|1
Line 1,853: Line 1,853:
The string pool is an array of null-terminated strings encoded with UTF-8. All string offsets in this section are relative to the beginning of the string pool.
The string pool is an array of null-terminated strings encoded with UTF-8. All string offsets in this section are relative to the beginning of the string pool.


==== Embedded AINB Files ====
==== AINB Modules ====
This section contains an array of all external AINB files linked to the current AINB file. The first four bytes specify the entry count.
This section contains an array of all AINB modules linked to the current AINB file. The first four bytes specify the entry count.
{| class="wikitable"
{| class="wikitable"
|+Embedded AINB File Entry
|+AINB Module Entry
!Offset
!Offset
!Size
!Size
28

edits