Devo's Map Doctor 1.1
Diagnose and remove the protection of Warcraft III maps, and make protected maps open in the World Editor.
Spoiler:
It is a single .exe of 12.8 MB. There is nothing to install and you don't need Python. Your original map is never changed.
The three buttons
1. Diagnose protection
- Lists every protection it finds, in plain English, and what the World Editor still needs to open the map. It only reads the map.
- Saves <map>_unprotected.w3x next to the map. The MPQ archive is fixed, so MPQ Editor opens it in edit mode, and the fake files are removed, so MPQ Editor no longer freezes trying to list 30,000 junk entries. You also get a real (listfile) with every file name the map itself mentions.
- Saves <map>_editor.w3x. It removes the protection first if there is any, restores the end of war3map.w3i that protectors cut off, and adds the files only the editor needs: triggers, custom script, regions, cameras, preplaced units and the imports list. The whole map script goes into the custom script section with //! inject main and //! inject config, so saving with JassHelper enabled builds the same script again.
Spoiler:
Version history
Spoiler:
What it removes
- A tampered MPQ header, which is why MPQ Editor opens a map read-only: the header size marks left by the Vexorian optimizer ("VxOP"), the w3p protector (02 01 20 00), PG2 and SProtect, a wrong format version, and hash or block tables placed before the header, including the negative block table position.
- A fake MPQ header in front of the real one, and an MPQ "user data" block where the HM3W header should be. The game skips both. Most tools don't.
- Fake files: the tens of thousands of junk entries the w3p protector adds, copies of real files under random names, extra fake names on real files (a hash table filled to 100%, so nothing can be added), and entries that point to data that doesn't exist. They stop being listed. The junk bytes stay inside the file as dead space, so the file size doesn't change.
- A decoy scripts\war3map.j that nothing can read, sitting next to the real script.
- Virtual file tables (PG2): tables that start inside the header and run past the end of the file, every name repeated several times, and decoy files named after public name lists. The map gets new tables with only the files it really uses, and the file data stays where it was.
- Scrambled object IDs (PG2): units, items and abilities renamed to four random bytes, with the script reaching them through sums of two rawcodes. Each one gets a clean ID in the object data, in every field that refers to it and in the script.
- SProtect: scrambled block indexes and the block table hidden under the header.
What it can't do
- Maps encrypted by the KK platform. The real map (script, terrain, objects, models) is stored encrypted outside the MPQ archive, and only the KK client can decrypt it. The program says so and stops.
- File names. Protectors delete the file list. The program gets back every name the map itself mentions: script, object data, models, textures, imports list, UI files and so on. A file that nothing mentions stays unnamed. It stays in the map, because the game may still load it, but MPQ Editor shows it without a name.
- Extra fake names on files it can't name are kept on purpose (Castle Fight has 119 such files). Without the real name there is no way to tell which entry the game uses, and deleting the wrong one breaks the map. The report tells you when this happens.
- The original GUI triggers. Optimizers and protectors compile them away, so you get the complete map script as custom script. Since 1.1 the regions, cameras and preplaced units that the script creates are rebuilt from it and do show in the editor; the items and abilities of a unit, and the sounds that only the script uses, still exist only in the game.
Is it safe?
- Your original map is never written to. The new copy goes next to it and never overwrites an existing file.
- Every copy is checked before it gets its final name: the files are read back and compared byte for byte with the original. If anything differs, nothing is saved.
- Only the archive's headers and tables are rewritten. File data stays byte for byte, except where changing it is the fix (the new object IDs and the script lines that use them).
- It doesn't connect to the internet and it doesn't change the game.
Tested on
1705 maps from 0.4 MB to 407 MB: w3p and w3pro maps (Zombie Defense, Castle Fight, Forest Defense, Sunken Defense, ORDR S2 with tens of thousands of fake files), Vexorian-optimized maps (WoW Reanimated, invalid Defense), a map with a broken header and a negative block table (Fish RPG), a PG2-protected RPG with virtual tables and 1,391 scrambled object IDs, SProtect (Heaven RPG S2), maps with entries that point to missing data, a fully encrypted archive, three clean maps (nothing to do, no false alarms).The 1.1 changes were measured as well: 271 real maps for the layout of the preplaced unit file, 133 Reforged maps for the neutral owners, and the maps reported in this thread, opened and closed in the editor (the map of the crash report, and Legion TD 3.47g, which used to die on "Loading Units").
Small maps take a few seconds. A 100+ MB map with tens of thousands of fake files takes 2 to 5 minutes.
Spoiler:
Download
Thread attachment;VirusTotal: https://www.virustotal.com/gui/file/371c56fd26fa516c2afc400884bf297da86474ec7594cea636ddaa0791d09c71?nocache=1
Some antivirus programs flag new, unsigned programs built with PyInstaller. It is a known false positive. The program only reads the map you pick and writes the new copy next to it.
If a map beats it, post the text from "Diagnose protection" and a link to the map, and I'll take a look. If the World Editor crashes, the newest folder under Documents\Warcraft III\Errors\ is what found this one.
Credits
- StormLib by Ladislav Zezula. The program follows its rules for reading MPQ archives, and its PKWARE DCL and WAVE decompressors are ports of StormLib code (MIT License; the notice ships with the program).
- WC3MapDeprotector by speige, for the ideas of repairing the cut war3map.w3i and of recovering file names from the map's own files.


