Line 116: |
Line 116: |
| u8 crypto[16]; // MD5 of 0x40 to 0x640 in header. crypto should be all 0's when calculating final MD5 | | u8 crypto[16]; // MD5 of 0x40 to 0x640 in header. crypto should be all 0's when calculating final MD5 |
| } IMET; | | } IMET; |
| + | </source> |
| + | === BNS === |
| + | <source lang="c"> |
| + | // Header |
| + | typedef struct { |
| + | u32 bns; // 'BNS ' |
| + | u32 version; // 0xFEFF0100 endianness and format version check |
| + | u32 filesize; // size of entire BNS |
| + | u16 headersize; // size of BNS header (including chunkinfo) |
| + | u16 chunkcount; // number of chunks |
| + | struct { |
| + | u32 offset; // offset from start of BNS of chunk header |
| + | u32 size; // size of chunk including header |
| + | } chunkinfo[chunkcount]; // info for each chunk |
| + | } BNS; |
| + | |
| + | // Chunk header |
| + | typedef struct { |
| + | u32 type; // 'INFO' or 'DATA' |
| + | u32 size; // size including header |
| + | } BNS_chunk; |
| + | |
| + | // INFO chunk |
| + | typedef struct { |
| + | u8 unk[2]; // 0, possibly format control |
| + | u8 channels; // channel count |
| + | u8 unk2; // 0, possibly loop flag |
| + | u16 samplerate; // sample rate (Hz) |
| + | u16 pad; // 0 |
| + | u32 unk3; // 0, probably loop start |
| + | u32 samples; // total sample count |
| + | u32 offset; // offset (in INFO) to channel info offset list |
| + | u32 unk4; // 0, padding? |
| + | } INFO_chunk; |
| + | |
| + | // channel info offset list |
| + | typdef struct { |
| + | u32 offset[channels]; // offset (in INFO) to channel info for each channel |
| + | } channel_info_offset_list |
| + | |
| + | // channel info (for DSP ADPCM) |
| + | typedef struct { |
| + | u32 data_offset; // offset (in DATA) of audio data for channel |
| + | u32 info_offset; // offset (in INFO) of DSP info (0x30 byte block) |
| + | u32 unk; // 0 |
| + | } channel_info; |
| </source> | | </source> |
| | | |