From 888db3507956be13f96b00244dcadecf6136b3a3 Mon Sep 17 00:00:00 2001 From: tobid7 Date: Mon, 12 Jan 2026 21:36:40 +0100 Subject: [PATCH] Move docs --- README.md | 4 +- docs/bcstm_doku.md | 179 --------------------------------------------- docs/bcwav_doku.md | 157 --------------------------------------- 3 files changed, 2 insertions(+), 338 deletions(-) delete mode 100644 docs/bcstm_doku.md delete mode 100644 docs/bcwav_doku.md diff --git a/README.md b/README.md index 3f688db..5da1276 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Tool/Library to work with Nintendo 3ds File formats ## Note -**CTRFF Requires Palladium Headers from branch devel040 (as this is the branch the lib was latest tested with)** +The Docs can be found in the [Wiki](https://github.com/tobid7/ctrff/wiki) now. ## Building @@ -38,7 +38,7 @@ Not all Planned formates are listed here yet | bcstm | Loading of almost every Data | Fully done and playable by BCSTM-Player | | bcwav | Basic Loading (not tested yet) | Not finished yet | | bclim | Creating A4,A8,LA4,LA8,L4,L8,RGB24,RGBA32,RGBA4444,RGB565 done | WIP | -| lz11 | Encoder done, Decoder missing | WIP | +| lz11 | Encoder done, Decoder done | | | romfs | Nothing Done yet (Started creating header) | | | smdh | Almost done | missing safetey checks | | cbmd | Nothing done yet | | diff --git a/docs/bcstm_doku.md b/docs/bcstm_doku.md deleted file mode 100644 index d793863..0000000 --- a/docs/bcstm_doku.md +++ /dev/null @@ -1,179 +0,0 @@ -# BCSTM File Format - -**Note that this Docs are based on Current State of development and are very unfinished** - -## Contents - -- 1 [Header](#header) -- 2 [Reference](#reference) - - 2.1 [Sized Reference](#sized-reference) - - 2.2 [Reference Table](#reference-table) - - 2.3 [Reference Types](#reference-types) -- 3 [Block Header](#block-header) -- 4 [Info Block](#info-block) - - 4.1 [Stream Info](#stream-info) - - 4.2 [Channel Info](#channel-info) -- 5 [DSP ADPCM Info](#dsp-adpcm-info) - - 5.1 [DSP ADPCM Param](#dsp-adpcm-param) - - 5.2 [DSP ADPCM Context](#dsp-adpcm-context) -- 6 [Basic Data Types](#basic-datatypes) -- 7 [Tools Devices used for Research](#tools--devices--file-sources-used-for-research) - -## Header - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 4 | [u32](#u32) | Magic **'CSTM'** `0x4D545343` | -| 0x04 | 2 | [u16](#u16) | Endianness `Big == 0xfffe` `Little == 0xfeff` | -| 0x06 | 2 | [u16](#u16) | Header Size `0x40` | -| 0x08 | 4 | [u32](#u32) | Version | -| 0x0c | 4 | [u32](#u32) | File Size | -| 0x10 | 2 | [u16](#u16) | Num Blocks (Should be 3) | -| 0x12 | 2 | [u16](#u16) | Reserved | -| 0x14 | 12 | [Sized Reference](#sized-reference) | Info Block Sized Reference | -| 0x20 | 12 | [Sized Reference](#sized-reference) | Seek Block Sized Reference | -| 0x2c | 12| [Sized Reference](#sized-reference) | Data Block Sized Reference | - -## Reference - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 2 | [Reference Type](#reference-types) | TypeID | -| 0x02 | 2 | [u16](u16) | Padding | -| 0x04 | 4 | [u32](u32) | Offset **(0xffffffff represents null)** | - -### Sized Reference - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 8 | [Reference](#reference) | Reference | -| 0x08 | 4 | [u32](u32) | Size | - -### Reference Table - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 4 | [u32](#u32) | Count | -| 0x04 | Count*8 | [Reference](#reference) | References | - -### Reference Types - -| ID | Type | -|---|---| -| 0x0100 | Byte Table | -| 0x0101 | [Reference Table](#reference-table) | -| 0x0300 | [DSP ADPCM Info](#dsp-adpcm-info) | -| 0x0301 | IMA ADPCM Info | -| 0x1f00 | Sample Data | -| 0x4000 | [Info Block](#info-block) | -| 0x4001 | Seek Block | -| 0x4002 | Data Block | -| 0x4100 | [Stream Info](#stream-info) | -| 0x4101 | Track Info | -| 0x4102 | [Channel Info](#channel-info) | - -## Block Header - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 4 | [u32](#u32) | Magic | -| 0x04 | 4 | [u32](#u32) | Size | - -## Info Block - -All Reference Offsets at the beginning of Info Block are Relative to the **Infoblock + 0x08 (size of Block Header) Position** - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 8 | [Block Header](#block-header) | Block Header | -| 0x08 | 8 | [Reference](#reference) | Stream Info Reference | -| 0x10 | 8 | [Reference](#reference) | Track Info Reference Table Reference | -| 0x18 | 8 | [Reference](#reference) | Channel Info Reference Table Table Reference | -| 0x20 | 56 | [Stream Info](#stream-info) | Stream Info | - -### Stream Info - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 1 | [u8](#u8) | Encoding | -| 0x01 | 1 | [u8](#u8) | Loop `1 == true -- 0 == false` | -| 0x02 | 1 | [u8](#u8) | Num Channels | -| 0x03 | 1 | [u8](#u8) | Padding | -| 0x04 | 4 | [u32](#u32) | Sample Rate | -| 0x04 | 4 | [u32](#u32) | Loop Start | -| 0x04 | 4 | [u32](#u32) | Loop End | -| 0x04 | 4 | [u32](#u32) | Sample Blocks | -| 0x04 | 4 | [u32](#u32) | Sample Block Size | -| 0x04 | 4 | [u32](#u32) | Sample Block Samples | -| 0x04 | 4 | [u32](#u32) | Last Sample Block Size | -| 0x04 | 4 | [u32](#u32) | Last Sample Block Samples | -| 0x04 | 4 | [u32](#u32) | Last Sample Block Padded Size | -| 0x04 | 4 | [u32](#u32) | Seek Data Size | -| 0x04 | 4 | [u32](#u32) | Seek Interval Samples | -| 0x04 | 4 | [Reference](#reference) | Sample Data Reference | - -### Channel Info - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 8 | [Reference](#reference) | Reference to [DSP ADPCM Info](#dsp-adpcm-info) **!!! The Offsets are Relative to the start Pos of the Channel Info Object !!!** | - -## DSP ADPCM Info - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 32 | [Param](#dsp-adpcm-param) | Coefficients | -| 0x20 | 6 | [DSP Context](#dsp-adpcm-context) | Context | -| 0x26 | 6 | [DSP Context](#dsp-adpcm-context) | Loop Context | -| 0x2c | 2 | [u16](#u16) | Padding | - -### DSP ADPCM Param - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 32 | [u16](#u16) | 16 Bit Coefficients | - -### DSP ADPCM Context - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 1 | [u8](#u8) | 4Bit Predictor and 4Bit Scale | -| 0x01 | 1 | [u8](#u8) | Reserved | -| 0x02 | 2 | [16](#u16) | Previous Sample | -| 0x02 | 2 | [16](#u16) | Second Previous Sample | - -## Basic Datatypes - -### u32 - -```cpp -using u32 = unsigned int; // or uint32_t -``` - -### u16 - -```cpp -using u16 = unsigned short; // or uint16_t -``` - -### u8 - -```cpp -using u8 = unsigned char; // or uint8_t -``` - -## Tools / Devices / File Sources used for research - -| Name | Description | -|---|---| -| Visual Studio Code | Used for creating ctrff c++ code for bcstm | -| ImHex | Used to Analyze the Hex Code of the bcstm Files | -| LoopingAudioConverter | Used to create some files for testing | -| Citra | Fast way to generate Log files when developing ctrff | -| ctrff-cli | Tool to generate Debug Output on Desktop OS like seen in BCSTM-Player File inspector | -| New 3ds XL | Testing on Real Hardware (BCSTM-Player) | -| Mario Kart 7 (Cartridge) | Used to get Test files | -| CTGP 7 | Used to get Test files | -| Super Mario Maker 3ds (Cartridge) | Used to get Test files | -| Mario and Luigi Bowsers inside story (Cartridge) | Used to get Test files | -| Donkey Kong Country Returns 3D (Cardridge) | Used to get Test files | diff --git a/docs/bcwav_doku.md b/docs/bcwav_doku.md deleted file mode 100644 index de2b5f7..0000000 --- a/docs/bcwav_doku.md +++ /dev/null @@ -1,157 +0,0 @@ -# BCWAV File Format - -**Note that this Docs are based on Current State of development and are very unfinished** - -**This file can be very incorect due to copying from bcstm_doku.md** - -## Contents - -- 1 [Header](#header) -- 2 [Reference](#reference) - - 2.1 [Sized Reference](#sized-reference) - - 2.2 [Reference Table](#reference-table) - - 2.3 [Reference Types](#reference-types) -- 3 [Block Header](#block-header) -- 4 [Info Block](#info-block) - - 4.1 [Channel Info](#channel-info) -- 5 [DSP ADPCM Info](#dsp-adpcm-info) - - 5.1 [DSP ADPCM Param](#dsp-adpcm-param) - - 5.2 [DSP ADPCM Context](#dsp-adpcm-context) -- 6 [Basic Data Types](#basic-datatypes) -- 7 [Tools Devices used for Research](#tools--devices--file-sources-used-for-research) - -## Header - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 4 | [u32](#u32) | Magic **'CWAV'** `0x56415743` | -| 0x04 | 2 | [u16](#u16) | Endianness `Big == 0xfffe` `Little == 0xfeff` | -| 0x06 | 2 | [u16](#u16) | Header Size `0x40` | -| 0x08 | 4 | [u32](#u32) | Version | -| 0x0c | 4 | [u32](#u32) | File Size | -| 0x10 | 2 | [u16](#u16) | Num Blocks (Should be 2) | -| 0x12 | 2 | [u16](#u16) | Reserved | -| 0x14 | 12 | [Sized Reference](#sized-reference) | Info Block Sized Reference | -| 0x20 | 12| [Sized Reference](#sized-reference) | Data Block Sized Reference | - -## Reference - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 2 | [Reference Type](#reference-types) | TypeID | -| 0x02 | 2 | [u16](u16) | Padding | -| 0x04 | 4 | [u32](u32) | Offset **(0xffffffff represents null)** | - -### Sized Reference - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 8 | [Reference](#reference) | Reference | -| 0x08 | 4 | [u32](u32) | Size | - -### Reference Table - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 4 | [u32](#u32) | Count | -| 0x04 | Count*8 | [Reference](#reference) | References | - -### Reference Types - -| ID | Type | -|---|---| -| 0x0300 | [DSP ADPCM Info](#dsp-adpcm-info) | -| 0x0301 | IMA ADPCM Info | -| 0x1f00 | Sample Data | -| 0x7000 | [Info Block](#info-block) | -| 0x7001 | Data Block | -| 0x7100 | [Channel Info](#channel-info) | - -## Block Header - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 4 | [u32](#u32) | Magic | -| 0x04 | 4 | [u32](#u32) | Size | - -## Info Block - -All Reference Offsets at the beginning of Info Block are Relative to the **Infoblock + 0x08 (size of Block Header) Position** - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 8 | [Block Header](#block-header) | Block Header | -| 0x08 | 1 | [u8](#u8) | Encoding | -| 0x09 | 1 | [u8](#u8) | Loop `1 == true -- 0 == false` | -| 0x0a | 1 | [u16](#u16) | Padding | -| 0x0c | 4 | [u32](#u32) | Sample Rate | -| 0x10 | 4 | [u32](#u32) | Loop Start | -| 0x14 | 4 | [u32](#u32) | Loop End | -| 0x18 | 4 | [u32](#u32) | Reserved | -| 0x18 | 8 | [Reference Table](#reference-table) | Channel Info Reference Table | - -### Channel Info - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 8 | [Reference](#reference) | Reference to [DSP ADPCM Info](#dsp-adpcm-info) **!!! The Offsets are Relative to the start Pos of the Channel Info Object !!!** | - -## DSP ADPCM Info - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 32 | [Param](#dsp-adpcm-param) | Coefficients | -| 0x20 | 6 | [DSP Context](#dsp-adpcm-context) | Context | -| 0x26 | 6 | [DSP Context](#dsp-adpcm-context) | Loop Context | -| 0x2c | 2 | [u16](#u16) | Padding | - -### DSP ADPCM Param - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 32 | [u16](#u16) | 16 Bit Coefficients | - -### DSP ADPCM Context - -| Offset | Size | Datatype | Description | -|---|---|---|---| -| 0x00 | 1 | [u8](#u8) | 4Bit Predictor and 4Bit Scale | -| 0x01 | 1 | [u8](#u8) | Reserved | -| 0x02 | 2 | [16](#u16) | Previous Sample | -| 0x02 | 2 | [16](#u16) | Second Previous Sample | - -## Basic Datatypes - -### u32 - -```cpp -using u32 = unsigned int; // or uint32_t -``` - -### u16 - -```cpp -using u16 = unsigned short; // or uint16_t -``` - -### u8 - -```cpp -using u8 = unsigned char; // or uint8_t -``` - -## Tools / Devices / File Sources used for research - -| Name | Description | -|---|---| -| Visual Studio Code | Used for creating ctrff c++ code for bcstm | -| ImHex | Used to Analyze the Hex Code of the bcstm Files | -| Citra | Fast way to generate Log files when developing ctrff | -| LoopingAudioConverter | Used to create some files for testing | -| ctrff-cli | Tool to generate Debug Output on Desktop OS like seen in BCSTM-Player File inspector | -| New 3ds XL | Testing on Real Hardware (BCSTM-Player) | -| Mario Kart 7 (Cartridge) | Used to get Test files | -| CTGP 7 | Used to get Test files | -| Super Mario Maker 3ds (Cartridge) | Used to get Test files | -| Mario and Luigi Bowsers inside story (Cartridge) | Used to get Test files | -| Donkey Kong Country Returns 3D (Cardridge) | Used to get Test files |