You don't need deprotection - small tutorial.

Cheatpacks and learning how to use them, as well as other guides for manipulating maps.

Moderator: Cheaters

owner123
Super Moderator
Posts: 1943
Joined: February 3rd, 2009, 11:28 pm
Been thanked: 1 time

You don't need deprotection - small tutorial.

Post by owner123 »

It seems there's a lot of misconceptions about what deprotection can do for you and when to request it. I thought I'd write this up to help people understand how pointless it is in most cases.

Understanding WC3 Maps
WC3 maps are a .w3x or .w3m file. Regardless of the extension, though, these files are referred to as an "MPQ". An MPQ is a type of file that Blizzard invented, and it's basically a file that contains other files - imagine a .zip file on your computer*.

When you launch the World Editor and save your map, the World Editor generates an MPQ Archive for you and then adds the files that WC3 needs to have in order to play the map. For example, the scripts file (war3map.j), the units file (war3map.w3u), etc.

It also adds certain "world editor only" files that are used in opening up the map in the World Editor, but not used in actually playing the map.

What does protection do

To keep this at a very basic level, protection removes those world editor only files. These are things like: trigger editor data, preplaced unit data, level info, etc. It also scrambles up the map script so that it's very difficult for a human to read.

These effects cannot be reversed.

The data that was used to build the map is gone permanently. There is nothing you can do about it. So if you think we're going to deprotect a map and you'll open it up to a fully functional map with GUI triggers in it - I'm sorry but it's just not going to happen.

What deprotection actually does - it restores some basic template files to the map so that it opens. It also combines the entire map script into one huge trigger. It makes an attempt to save the variables as wc3 editor data. It doesn't do any of this particularly well, but it makes it openable.

Your deprotected map will probably not be saveable. You aren't going to deprotect and edit a map.

Why is deprotection so bad and unusable? Well basically, no one ever wrote a good tool for it. Because no one really needs depotection. The Russians wrote xdep which is the best (but still poor) tool and never improved it. Probably because they didn't need it.

You can do almost everything without deprotection

You can edit the scripts (war3map.j)
You can edit the object data (war3map.u,t,b,etc) by importing into a blank map, editing, and exporting
You can edit the imports by importing/deleting from the archive
You can edit the player options in the .w3i
You can edit the map name directly in the mpq archive header

Uses of deprotection

Even though it's useless in 99% of cases, there is one case where deprotection is useful: terrain editing.

Terrain files are found in the war3map.w3e file. The spec for this file is known, but it's pretty intimating and I have no interest in coding a tool to modify it at the current time. And I guess no one else does either. So if you want to edit the terrain of a protected map, you better deprotect it, modify terrain, and the re-import all the working scripts and object data into the map.

Map restoration

It's worth pointing out that there is a way of restoring readable triggers, variables, and such to a deprotected map. It's called map restoration.

In order to restore a map, you must read through the war3map.j script yourself. Learn what every function does and fix up the names so they are readable again. Add comments to every function as you go so you don't forget. Now find all the triggers in the map and organize the map by trigger. After you have every function split into a trigger section, now you categorize them logically. These categorizations are going to be your folders in the Trigger Editor.

Then you go into the trigger editor, delete the existing script, manually restore the variables from the globals -> endglobals section if needed, then create trigger categories, and make every trigger you found in the JASS script (exception for function main; move the main functions to an initialization trigger). Copy in each of your functions along with an initializer in the function main equivalent to set up your triggers, add events/actions/etc.

Now you have a working, restored map.

This effort can take several months for complex maps. You won't find anyone to do this for you, and it's only really possible if you're a JASS expert. There is no tool for this and never will be. If there's interest in this, I can make a full tutorial on how to restore a map. But in my experience no one wants to put in the effort to do this.


* MPQ files hash the file internally using a low-collision lookup. Hashing is a one-way algorithm. Brute forcing this hash lookup is not realistic so we use a listfile with a bunch of files we think may exist in order to find what exists in the map. This doesn't discover everything, however we CAN discover everything by static analysis. Ask if you want more info.
User avatar
nuzamacuxe
Also Not an Admin, but closer than devoltz
Posts: 1655
Joined: February 14th, 2018, 5:35 am
Title: Just Another S.Mod
Been thanked: 6 times

Re: You don't need deprotection - small tutorial.

Post by nuzamacuxe »

Thanks for doing that. Now people will stop asking such useless thing (or not xd).
owner123
Super Moderator
Posts: 1943
Joined: February 3rd, 2009, 11:28 pm
Been thanked: 1 time

Re: You don't need deprotection - small tutorial.

Post by owner123 »

Yeah I don't think so, but now I'm just going to link to them to this rather than typing up a description of why they don't need it.
User avatar
Vegas
Shopping Maul USA Creator
Posts: 1761
Joined: January 18th, 2007, 11:07 am
Title: No Comment
Location: Calgary Canada
Has thanked: 48 times
Been thanked: 9 times

Re: You don't need deprotection - small tutorial.

Post by Vegas »

The only problem with editing the object data is if you write any text descriptions for those units they will not be saved in the WTS file, leaving a blank tooltip during game play.
owner123
Super Moderator
Posts: 1943
Joined: February 3rd, 2009, 11:28 pm
Been thanked: 1 time

Re: You don't need deprotection - small tutorial.

Post by owner123 »

Well, that's only true if you don't recover the wtsfiles into the object data beforehand.
I believe RMPQEx is the tool that can restore Strings so that you can edit them in the objects themselves and won't have them stored in the .wts