SEL (File Format)
SEL files are helper tables that accompany RSO files. They link function calls from a module to the main executable (main.dol). Super Mario Galaxy and Super Mario Galaxy 2 each contain only one SEL file, located in ModuleData/product.sel.
File specifications
Header
| Offset | Type | Description |
|---|---|---|
| 0x00 | Byte[8] | Unknown |
| 0x08 | UInt32? | Unknown. 0x16 in SMG, 0x17 in SMG2 |
| 0x0C | UInt32 | Length of header |
| 0x10 | UInt32 | Offset to executable filename. Likely disregarded by the code |
| 0x14 | UInt32 | Length of the executable filename string. Apparently not null terminated? |
| 0x18 | UInt32 | Unknown. 0x1 in SMG and SMG2 |
| 0x1C | Byte[20] | Unknown. Likely padding |
| 0x30 | UInt32 | Offset to function name list |
| 0x34 | Byte[4] | Unknown. 0x0 in SMG and SMG2 |
| 0x38 | UInt32 | Offset to function name list (again?) |
| 0x3C | Byte[4] | Unknown. 0x0 in SMG and SMG2 |
| 0x40 | UInt32 | Offset to linker table |
| 0x44 | UInt32 | Length of linker table |
| 0x48 | UInt32 | Offset to function name list (again?) |
| 0x4C | UInt32 | Offset to function name list (again?) |
| 0x50 | Byte[4] | Unknown. 0x0 in SMG and SMG2 |
| 0x54 | UInt32 | Filesize, padded to the nearest 0x4 but excludes the rest of the file's padding |
Executable filename
This is a single-entry-table containing the name of the executable that this .sel file links to. product.sel in SMG and SMG2.
Linker table
This table links function names used by the .rso to the main executable (main.dol).
| Offset | Type | Description |
|---|---|---|
| 0x0 | UInt32 | Offset to the function name within the .sel file |
| 0x4 | UInt32 | Address within the specified section. For 0x1 and 0x2: relative to the section start*. For 0xFFF1: absolute address |
| 0x8 | UInt32 | Section within the executable (main.dol) |
| 0xC | UInt32 | Hash of the function name |
* The section start can be determined by looking at the main.dol executable. Section 1 address is found at offset 0x48, section 2 address is found at offset 0x4C.
Function name list
This is a pool of null-terminated strings holding various function names. According to the header this pool is padded to the nearest 0x4.
The rest of the file is padded to the nearest 0x20.