scmJS docs

Protected maps

Starcraft itself reads maps different than how editors do, which allows one to 'protect' a map by modifying it in a special way. None of it is encryption. Each trick relies on one of the rules on this page that the game follows and a simple reader does not, which also means a reader that follows them reads the map as the game does. The archive around the scenario has tricks of its own, such as a missing file list or a renamed scenario; those are in Opening and saving maps.

In the container#

What the file does What the game does What a reader has to do
Repeats a section Combines the copies by the section's rule: only the last counts, every copy's records count, or each copy is written over the start of one fixed space (Repeated sections) Keep every copy in file order and combine them by the same rule. A reader that takes the first copy, or the last, sees a decoy wherever the rule is a different one.
Gives a terrain, fog or location section a copy shorter than the section's size Writes it over the start of the space, leaving the rest as it was: zeros, or what an earlier copy wrote Start from a zeroed space of the full size and write every copy over it in turn.
Gives a section more bytes than the game reads Reads what it needs and ignores the rest Read only the size the section's page gives.
Ends a record section in part of a record Reads the whole records Drop the remainder.
Declares a length that runs past the end of the file Reads the bytes that are there Take what is there rather than rejecting the file.
Declares a negative length Moves backwards by that much and reads on from there, so bytes are read a second time as different sections Stop there, or follow the jump; nothing after it can be read as ordinary sections.
Includes sections whose names mean nothing, or are not text at all Skips them Skip them rather than rejecting the file.
Leaves bytes after the last section Nothing Keep them or drop them; they are not part of the map.
Puts the sections in an unusual order Reads them in any order Do not depend on StarEdit's order.

In the sections#

Section What the file does What it means
ISOM, TILE, DD2 Leaves them out, or fills them with zeros The game never reads them, so the map plays the same. An editor loses the isometric brush, the ground under each doodad, and the doodads as objects it can select. ISOM can be rebuilt from the tiles (exactly where the terrain was painted isometrically), and a new TILE copied from MTXM, which gives back the ground but keeps the doodads' tiles in it.
IVER, IVE2, IOWN, UPUS, SWNM, WAV Leaves them out Only editors read these either. The switch names and the list of sounds are gone; the sounds themselves stay in the archive, and the trigger actions that play them still name them.
MTXM, MASK, MRGN Splits them into several copies, some of them short or full of junk Only the combined result counts: each copy written over the one before, in file order. A copy of junk followed by a full copy of the real terrain draws the real terrain.
UNIT, THG2, TRIG, MBRF Splits the records across several copies Every copy's records count, in file order. A reader that keeps only one copy loses units or triggers.
STR Makes strings overlap, share bytes, or start inside the offset table A string is whatever lies between its offset and the next 0 byte. Read each one from its own offset and assume nothing about where it sits. An editor that writes the table back has to lay the strings out afresh.
ERA Sets bits above the low three Only the low three bits pick the tileset.
Any fixed-size section Makes it longer than its size The game reads the size it needs; the rest can hold anything.

Reading a protected map#

A reader that does these things reads a protected map as the game does:

  1. Read the headers one after another, and keep every section with its place in the file, repeats included.
  2. At a negative length, stop, unless you mean to follow the game back through the file.
  3. At a length past the end of the file, take the bytes that are there.
  4. Skip any name you do not know.
  5. Combine the copies of each section by its rule, the More than one copy row of its page. For the sections whose copies are written over one space, start from zeros at the size the page gives.
  6. In a record section, drop a partial record at the end.
  7. Read each string from its own offset.

Writing the result back as one copy of each section, in StarEdit's order, gives an ordinary file that holds the same map.

scmJS 0.6.2 + main@dd79a77 · Generated from the repository. The source is under the MIT license, which does not cover what ATTRIBUTION.md lists. StarCraft and Brood War are trademarks of Blizzard Entertainment; this project ships none of their data.