From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:Scream Tracker 3 module (S3M)" |
|---|
| claim | "The S3M header is 96 bytes, little-endian: 28-byte title, 0x1A, file type 0x10 at 0x1D, ordnum, insnum, patnum (libxmp rejects any of the three above 255; it does not check that ordnum is even although the format asks for it), flags, tracker version, file format information (1 = signed samples, 2 = unsigned; libxmp accepts only 1 or 2 and it also selects how master volume is read), "SCRM" at 0x2C, global volume, initial speed, initial tempo, master volume (ffi 2: volume mask plus stereo flag; ffi 1: stereo is bit 4 and the volume is 0-7 in the low nibble), ultra click removal, default pan flag (0xFC = pan table follows), 8 reserved bytes, special-data pointer and 32 channel settings (0xFF = unused, 0-7 left, 8-15 right, 16+ Adlib)." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:Scream Tracker 3 module (S3M)" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "S3MHeader" |
|---|
| size | 96 |
|---|
| endianness | "little" |
|---|
| fields | | offset | "0x0" |
|---|
| size | 28 |
|---|
| type | "char[28]" |
|---|
| name | "title" |
|---|
|
| offset | "0x1C" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "eof_1a" |
|---|
|
| offset | "0x1D" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "type" |
|---|
|
| offset | "0x20" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "ordnum" |
|---|
| notes | "libxmp rejects values above 255" |
|---|
|
| offset | "0x22" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "insnum" |
|---|
|
| offset | "0x24" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "patnum" |
|---|
|
| offset | "0x26" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "flags" |
|---|
|
| offset | "0x28" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "version" |
|---|
|
| offset | "0x2A" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "ffi" |
|---|
| notes | "must be 1 or 2 in libxmp; selects the master volume decoding" |
|---|
|
| offset | "0x2C" |
|---|
| size | 4 |
|---|
| type | "char[4]" |
|---|
| name | "magic" |
|---|
|
| offset | "0x30" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "global_volume" |
|---|
|
| offset | "0x31" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "initial_speed" |
|---|
|
| offset | "0x32" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "initial_tempo" |
|---|
|
| offset | "0x33" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "master_volume" |
|---|
| notes | "ffi 1: volume = ((mv & 0xF) + 1) * 0x10 clamped to 0x10-0x7F, stereo = mv & 0x10. ffi 2: mv 0x02 and 0x12 are treated as volume 0x20 with stereo = mv & 0x10; otherwise volume = mv & S3M_MV_VOLUME and stereo = mv & S3M_MV_STEREO (constants defined elsewhere; bit 7 stereo as commonly documented)" |
|---|
|
| offset | "0x34" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "ultra_click" |
|---|
|
| offset | "0x35" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "default_pan" |
|---|
|
| offset | "0x36" |
|---|
| size | 8 |
|---|
| type | "uint8_t[8]" |
|---|
| name | "reserved" |
|---|
|
| offset | "0x3E" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "special" |
|---|
|
| offset | "0x40" |
|---|
| size | 32 |
|---|
| type | "uint8_t[32]" |
|---|
| name | "channel_settings" |
|---|
|
|
|---|
| notes | "libxmp s3m_load: ordnum, insnum and patnum above 255 are all rejected; ffi must be 1 or 2" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "s3m_test reads SCRM at start+44 and 0x10 at start+29; s3m_load reads 96 bytes: title buf[0..27], type buf[30], ordnum buf+32, insnum +34, patnum +36, flags +38, version +40, ffi +42 (must be 1 or 2), magic +44, gv 48, is 49, it 50, mv 51, uc 52, dp 53, special +62, chset +64. Offset 0x1C is the 0x1A byte per the S3M convention (Unverified: not read in the loader)." |
|---|
| repo | "libxmp/libxmp" |
|---|
| commit | "5d4f6aa2c7dcdf8e9cd8129fe579d45b36a302da" |
|---|
| path | "src/loaders/s3m_load.c" |
|---|
| lines | "78-92, 225-258, 318-332" |
|---|
|
| type | "source" |
|---|
| detail | "s3m_load reads ffi at buf+42 (rejects values other than 1 and 2) and branches on sfh.ffi == 1 for the master volume and stereo bit; ordnum > 255 rejected, no evenness check" |
|---|
| repo | "libxmp/libxmp" |
|---|
| commit | "5d4f6aa2c7dcdf8e9cd8129fe579d45b36a302da" |
|---|
| path | "src/loaders/s3m_load.c" |
|---|
| lines | "237-246, 279-318" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "S3M file header" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T04:11:40.517Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T12:02:07.232Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read libxmp s3m_load.c 78-92 and 222-335: s3m_test checks SCRM at +44 and 0x10 at +29; the loader reads 96 bytes with ordnum@32, insnum@34, patnum@36, flags@38, version@40, ffi@42 (must be 1 or 2), magic@44, gv@48, is@49, it@50, mv@51, uc@52, dp@53, 8 reserved, special@62, chset@64; ordnum/insnum/patnum > 255 rejected, no evenness check; master volume branches on ffi as the fact states." |
|---|
| notes | "The loader itself reads sfh.type from buf[30], not buf[29]; the fact's 0x1D follows s3m_test and the usual layout, and the loader never uses the field." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T08:02:22.059Z" |
|---|
| summary | "master volume byte depends on file format information: ffi 1 uses a 0-7 volume in the low nibble and stereo bit 0x10; ffi 2 uses the newer mask (with 0x02/0x12 special cases); ordnum is only limited…" |
|---|
| changed | | "claim" |
| "data" |
| "evidence" |
|
|---|
|
| by | "PatientStepper99" |
|---|
| date | "2026-10-19T08:46:30.617Z" |
|---|
| summary | "libxmp rejects not only ordnum but also insnum and patnum above 255 (s3m_load.c 237-246); the claim and data mention only ordnum." |
|---|
| changed | |
|---|
|
|
|---|