Difference between revisions of "CHANS"

From WiiBrew
Jump to navigation Jump to search
(IOS, too!)
Line 3: Line 3:
  
 
This page shall describe said bytecode and the header for CHANS files. You may find a CHANS file in the News Channel as content index 5.
 
This page shall describe said bytecode and the header for CHANS files. You may find a CHANS file in the News Channel as content index 5.
 +
 +
Here is what is known of the structure for the header:
 
<pre>
 
<pre>
 
typedef struct {
 
typedef struct {
Line 17: Line 19:
 
         u32    unk20; // 0x00000024
 
         u32    unk20; // 0x00000024
 
         u32    unk30; // 0x00000028
 
         u32    unk30; // 0x00000028
 +
 
         // First data section (this is the bytecode)
 
         // First data section (this is the bytecode)
 
         u32    fds_size;  // 0x0000002C
 
         u32    fds_size;  // 0x0000002C
 
         u32    fds_offset; // 0x00000030
 
         u32    fds_offset; // 0x00000030
  
         u32    table4_count;
+
         u32    table4_count; // 0x00000034
         u32    unk5;
+
 
         u32    unk6;
+
         u32    unk5; // 0x00000038
 +
         u32    unk6; // 0x0000003C
 +
 
 
         // Table 1 is made up of 8 byte chunks
 
         // Table 1 is made up of 8 byte chunks
         u32    table1_count;
+
         u32    table1_count; // 0x00000040
         u32    table1_offset;
+
         u32    table1_offset; // 0x00000044
 +
 
 
         // Table 2 is the method name list
 
         // Table 2 is the method name list
         u32    table2_count;
+
         u32    table2_count; // 0x00000048
         u32    table2_offset;
+
         u32    table2_offset; // 0x0000004C
 +
 
 
         // Table 3 is a string literal table.
 
         // Table 3 is a string literal table.
         // Each string is in utf-16 and ends with 0x00240020 (.$. )
+
         // Each string is in utf-16, preceded by a u16 which specifies BYTE length of utf-18 string
         u32    table3_count;
+
         u32    table3_count; // 0x00000050
         u32    table3_offset;
+
         u32    table3_offset; // 0x00000054
 +
 
 
         // Possibly unused table
 
         // Possibly unused table
         u32    unk7;
+
         u32    unk7; // 0x00000058
         u32    unk8;
+
         u32    unk8; // 0x0000005C
 
          
 
          
         u32    table4_offset;
+
         u32    table4_offset; // 0x00000060
         u32    unk9_offset;
+
 
 +
         u32    unk9_offset; // 0x00000064
 +
       
 +
        u32 unk11; // 0x00000068
 +
        u32 unk12;  // 0x0000006C
 +
        u8 unk13[0x10]; // 0x00000070
 +
 
 
} chans_header;
 
} chans_header;
  

Revision as of 04:33, 26 May 2009

ChannelScript (abbreviated as CHANS) is the system used by the Wii's system menu to display "dynamic" banners. It seems to be some form of interpreted bytecode, which resembles JavaScript in many ways. The same bytecode can also apparently be interpreted on the Starlet while the Wii is off; this is performed by the /dev/kd module and forms the basis of WiiConnect24.

This page shall describe said bytecode and the header for CHANS files. You may find a CHANS file in the News Channel as content index 5.

Here is what is known of the structure for the header:

typedef struct {
        //START: Main Header
        u32     head; // 0x00000000
        u32     version; // 0x00000004
        u32     file_size; // 0x00000008
        u8      unk[0x14]; // 0x0000000C
        //END: Main Header


        // All offsets are from 0x20
        u32     unk10; // 0x00000020
        u32     unk20; // 0x00000024
        u32     unk30; // 0x00000028

        // First data section (this is the bytecode)
        u32     fds_size;  // 0x0000002C
        u32     fds_offset; // 0x00000030

        u32     table4_count; // 0x00000034

        u32     unk5; // 0x00000038
        u32     unk6; // 0x0000003C

        // Table 1 is made up of 8 byte chunks
        u32     table1_count; // 0x00000040
        u32     table1_offset; // 0x00000044

        // Table 2 is the method name list
        u32     table2_count; // 0x00000048
        u32     table2_offset; // 0x0000004C

        // Table 3 is a string literal table.
        // Each string is in utf-16, preceded by a u16 which specifies BYTE length of utf-18 string
        u32     table3_count; // 0x00000050
        u32     table3_offset; // 0x00000054

        // Possibly unused table
        u32     unk7; // 0x00000058
        u32     unk8; // 0x0000005C
        
        u32     table4_offset; // 0x00000060

        u32     unk9_offset; // 0x00000064
        
        u32 unk11; // 0x00000068
        u32 unk12;  // 0x0000006C
        u8 unk13[0x10]; // 0x00000070

} chans_header;

typedef struct {
        u8      length;
        u8      padding;
        u16     offset;
} table2_entry;

This data is in no way 100% complete, so far it works but table 1 and 2, but in future this could break with further files tested.

TODO: A lot! Keep adding data, people!