Warcraft 3 Map Deprotection Masterclass (+ CheatPacks!)


Title

Warcraft 3 Map Deprotection Masterclass (+ CheatPacks!)

Description

"Welcome to the ultimate masterclass on Warcraft III's Map Deprotection! 🎮 Dive deep into the intricacies of Warcraft III maps, uncovering layers, secrets, and techniques you've never seen before. Whether you're a novice looking to enhance your gameplay or a seasoned pro aiming for a refreshed experience, this guide has something for you.

🔍 In this video:

A step-by-step guide to map deprotection, revealing the true potential of your favorite maps.

Essential tools, tips, and strategies to make your deprotection process seamless.

Exclusive insights into CheatPacks! Enhance your game, unlock characters, and redefine your Warcraft III journey.

Remember, gaming is all about exploration and fun. So, embark on this new adventure with us, and let's redefine the boundaries of Warcraft III together! And if you find value in our content, don't forget to hit the 'Like' button and subscribe for more in-depth gaming guides and secrets.

⚠️ Note: Always play responsibly. Using CheatPacks can alter the game's experience, so use with discretion and respect other players. Enjoy!"


Transcript

did you know that Warcraft 3 spawned entirely new game genres like tower defenses Auto chess and mobas the beauty of reforged is we can play the old maps for that Nostalgia kick without saying the old pixelated Graphics in fact there's even improvements to the map editor to support even better custom games the only problem is most of the best maps are protected and the developers are long gone an entire world of money potential hiding beneath the surface just waiting to be unlocked if only there was a way to de-protect all these Maps so we could breathe new life into them hmm I think I can do that if you're new here I'm Devin and this channel is for coders interested in gaming hacking and AI in this video I'm going to teach you how to deep protect any map and as a bonus if you stick around to the end you'll learn how to embed a cheat pack as well but please cheat responsibly you don't want to let your massive Advantage ruin the fun for everyone else okay let's get into it first let me explain to you what I mean by map protection so here I have the world editor if I hit open pests Invasion and hit OK you'll notice it crashes while it's trying to load so that's what we mean by protection if the map was not protected it would open just fine and you might wonder why I picked this specific list of maps every one of these was specifically requested by one of my viewers in order to de-protect a map first we need to understand how to protect a map now there are hundreds of possible techniques I'm just going to show you one because they're all very similar first I'm going to make a brand new map leave everything default and I'll say save it and I'll call it unprotected next I have a list of tools for deprotecting maps and I'll show each of these in a few minutes but first let's start with mpq master and I'm going to use this to extract all of the files out of my unprotected map and will corrupt intentionally one of the files in order to prevent the world editor from opening it if I do operation extract all and then go to the folder here we'll see all of these files I'm going to move them into a new folder called unprotected and I'll use that as a backup so that I can do a difference program against another copy of the map so we can learn what files are changed when we make edits in the world editor so for example let's think of something I could change in the world editor that does not affect the real game but only affects the world editor because that's the technique for protection is we want to crash the world editor but not crash the real game an example of that in the tool palette is Regions so I'm going to click here to add a region and I'm going to draw one box and then I'm going to save it and call it version two so now if I do a difference between these copies of the map I can see which file was changed and also how it changed the reason regions are only used by the world editor is because if I go into module trigger editor this is a graphical coding tool that's built into the world editor and something it uses is Regions but when the game actually runs all of that configuration is converted to real code so the game only needs the code it doesn't need this graphical representation of the code that's only to make it easy to edit so I'm going to use mpq Master again and open version 2 operation extract all and I'll put it into a version 2 folder a program I like to use this called win merge and in this case we're just going to use it to compare so I'll do file open and I'll put the first version in the first folder the second version and the second folder I'll hit compare the files highlighted in yellow have changes the others are identical so I can simply pick a file double click on it and on the left is the original code and on the right is the new code after I saved it with my changes so you can see here a region is simply a rectangle and a region just has coordinates so I could code this without visually drawing anything in the map editor if I knew what coordinates I wanted to use so the visual portion is just for ease of use the game doesn't actually need it to run now if I look at this w3r file you'll see that it's binary so it has weird symbols here those are the hexadecimal representation of the ones and zeros in those parts of the file something interesting to note is the left side which had zero regions it still had these eight values so I can assume it's some sort of metadata that tells me what else to expect in the file when a region is created so on the right side almost everything is identical in that metadata section except for I have a number one and that's intriguing because I added one region and then I can assume everything afterwards it's probably the region I created especially since it has the name of the region so what if I wanted to use this information to in some way break the world editor but still keep the game working one idea would be to change this number one to a really big value so that it tries to read regions that don't exist and just crashes so to do that I'm going to open up a hex editor one that I like is called XVI 32 but there are a ton of hex editors online you can just use whichever one you prefer so I'm going to open inside the unprotected folder the w3r file on the left side I can see a bunch of numbers so I'm going to assume that this 0 0 here is the number of regions it's going to read in the file we want to make a very large value to crash the map editor so the largest value possible is FF which is the number 255. and I'll put that in all four bytes so combined it's actually 2 billion so now I'm going to save this file and close it I'll open mpq Master again open up the version I renamed to protected and then I'll right click and say add file and I'll choose the corrupted version of the w3r file now if I open the protected map you'll see that it's trying to load regions but the count of regions is so large that it's looping forever so now you understand the concept of protection this particular protection specific to Regions is only one type of protection out of many and this is the difficulty of deprotecting is you have to understand every possible way that a map could be protected in order to reverse engineer it luckily there are a few common techniques that almost all the maps use and in addition there are generic tools that are designed to deprotect any map and in the event that they don't support a specific type of protection we'll also learn how to troubleshoot so that we can fix those by hand so let's start by going over the list of tools that we're going to use first of all we have a base map file that's simply I open the world editor made a new map and saved it and it's like a baseline I can use to compare against a corrupted map to see what files might have been intentionally corrupted I also used mpq Master to extract the files and I put them into this folder now I mentioned earlier that w3r is for Regions if you'd like to know what these files all are a quick Google search will show it to you this site I think is the best explanation so if I scroll down to the w3r file and clicked on it here it says it's a file for trigger regions which is exactly what we discovered on our own so you could read through all of the other files to learn about them so because these are the only files required for a map most likely any intentional Corruption of a map for the world editor is going to be inside of one of those 17 files because any other files are going to be sound effects 3D models Etc and corrupting them is likely to crash the actual game or the game will just work with broken sound or broken Graphics so a coder is not going to corrupt one of those files next we have a hex editor which simply allows looking at the binary ones and zeros in a file we have mpq Master which allows extracting files from an mpq archive as well as adding files to one and mpq is a proprietary file format used by most of Blizzard's games it's not only Warcraft 3 it's also World of Warcraft Diablo Starcraft Etc and it would be similar to like a zip file I'm not going to share the download links for each of these files you should be able to Google and find them pretty easily but if you can't find one just send me a message in the comments and I'll respond an alternative to mpq master that I use occasionally I have under other tools and it's called mpq editor I like mpq Master slightly better but mpq editor has one feature that is used occasionally for map protection and that is if I open a file like my base map sometimes files can be hidden because an mpq file has metadata that says a table of contents of what files are inside of it and that's inside of this list file and attributes file if those are intentionally corrupted you could have files that are in the archive but the mpq editor is not able to find them although the game is still able to find them so a tool inside of mpq editor is called w3x name scanner and a lot of other tools have this top portion which is a way that it searches the entire mpq file for hidden files things that have been removed from the list file but something that does not seem to exist in any of the other tools is this live game scanner and how this works is it actually attaches to the Warcraft 3 game engine while you're playing the game and it monitors what sections of the mpq file are being read at any given time and it uses that to discover files that it needs out of the mpq which are missing from the list file so the top portion which analyzes the mpq file itself it's going to find 90 of those hidden files but in the rare event that it misses one the live game scanner should be able to find the others and there may still be files in the mpq which don't really have a file name but if they're not used in the game while you're playing it then they're obviously useless files that are not needed so that's the only reason I would use the mpq editor instead of mpq Master Okay so the other tools we're going to use are mpq repacker and XD protect these four programs are really all you should need and then you can make your own base map files really easily the other tools I have in here in a rare scenario they may come in handy so I'll just show you that they exist but you probably don't need them this top one is called vexorians map Optimizer and it makes games run faster by deleting files that are not needed for the game itself that are only needed for the map editor D protect is a tool by Nathan MX that tries to undo some of the common protection techniques but this is an older program the XD protect and mpq repacker I think generally do a better job next is mpq recover this has that same mpq scanning concept that is this in mpq editor but it does not attach to the Warcraft game engine and mpq repacker and XD protect both have this concept built into them as well the last one is silk object console this is also built into mpq repacker so that's why I don't think you need it but silk is a file format for a simple database structure that can be opened in Excel and this would be for attributes like of a unit there are hit points their intelligence their list of abilities Etc and one protection technique is to corrupt the world editor version of these attributes because the game actually uses the compiled representation of those attributes which is inside of a silk file it does not use the visual representation that the world editor uses so this tool reverses the silk files back into the world editor files but again should not be necessary because repacker has it built-in so let's start the protecting from my list of map files I'm going to start with pest Invasion because it's the smallest and I'm going to Google mpq repacker and it takes me to GitHub this is where all the code for this program is stored but the one it takes me to is from the original author karasik you don't want this version because you'll notice on the right side it's eight years old and there's a few issues with it if instead you go to this version this is actually me and you'll notice I'm actively working on improving this tool so my version is going to work better for you if you want to actually modify the code you would click here to clone you would copy this get URL and you would use traditional coding tools to download the files modify them Etc and you need C plus plus Builder 2010 in order to run it unfortunately there are actually some compiler errors in the original code that I have not yet fixed so you can't even run the code so let me show you the changes I made if you just want to run the code click on code download zip and the files you want are going to be inside this releases folder you'll notice there's an English version and a Russian version the original version before I modified it was this Russian that's going to be very hard for you to use and that's why I created this English version and you're probably wondering if there's compiler errors how did I do that well I'll show you in a second but now that I've downloaded the zip from GitHub I'm going to extract it with 7-Zip you can also use the built-in Windows extractor you'll notice this virus and threat protection window pop-up I think this is incorrect I've been using the program and it seems to work fine for me all the code is on the GitHub if anyone wants to search through it figure out what Microsoft is complaining about then please submit a pull request to fix it so you're going to want to click into this threat protection and click allowed threats and click manage settings scroll down to exclusions add an exclusion and pick your folder if you don't use the the built-in Windows virus protection and use a third-party one instead you'll need to do something similar okay so inside this releases if we open the Russian you'll see that it's going to be really hard to use this since we have no idea what we're clicking on if you go back to my GitHub and scroll down I have screenshots of the Russian next to the English for most of the screens so if you want to use the original program this should help you figure out what to click on but I figured since this is a hacking tutorial why not do a short segue into how we could hack this program to turn it into English so I mentioned that the code doesn't compile if it did I would simply fix it directly in GitHub recompile it and run the code but since it doesn't I could just pretend I don't have the source code at all what would I do to hack this program there is a tool I like called resource hacker you can Google for it and it's basically what mpq Master is but to exe files in Windows so if I open this resource hacker program and I take the Russian version of the executable and open it on the left side you'll see a bunch of files that are embedded inside of the exe and if you search through these files and expand them all you'll be able to figure out what portions are in Russian so as an example this T main form a form is basically a window and it has a bunch of controls on it so this file has metadata about setting up the controls that the program needs on the screen and you'll notice all these sections that say caption have Russian text in them so all I have to do is open up Google translate set it from Russian to English and then I'll take each of these one at a time copy and paste in order to get the English translation and use resource hacker to modify it to the English then I can hit save and that's how I would make an English translation of a program if I don't have the source code now because I use resource hacker to translate it's only going to affect UI elements that were created at design time in this C plus Builder program any UI elements that are created with code are not going to be translated so for example if I click on batch repacking you'll notice this pop-up that asks me some kind of question this is still in Russian but enough of the program's been translated that you should be able to use it so let me explain how this works real quick while we hack this pest Invasion Map so Source map will be the protected version of pest Invasion and I made a new folder called hacked where I'll put put all the d protected versions for testing and the temp folder you can use as default the repacker program essentially extracts everything out of the mpq corrects the corrupted files and then repackages it into a new empty queue and so the temp folder is where it will do all of its extraction battery packing you'll probably never need to use that's if you want to de-protect 100 files all at once you can give it a folder and it'll go through each map one at a time I would avoid that personally because this tool is not perfect it requires a little bit of trial and error it's better to just work on one map at a time this first option to use XD protect the reason behind that is repacker and XD protect both do very similar things but there are certain protections that either one can handle that the other cannot and so this coder for repacker instead of adding everything from Deep protect into his program he just gives you the option to choose which one you want to use and the XD protect program is embedded in side of repacker it's a good option in some cases where repacker fails but in some cases we'll need to actually use XD protect itself so that we can change some of the config options now these two replace w3i and empty Doo if you Mouse over the tooltip will tell you what specific World editor exception it's designed to fix so this one's for an out of memory error this second one is for a unit data missing or invalid error so if you get those specific errors in map editor you'll want to check those boxes if you're not getting those errors don't check the boxes because you don't want to accidentally modify the map by removing a protection that was not even there in the first place we want to do the minimal changes possible pause before packing you probably won't need but that's in case before it repackages you want to make some manual edit or if you just want to analyze the files delete temp is going to clear this folder out out in between runs so if you need to troubleshoot something that's not working you'd want to uncheck that because extracting all the files takes a while and that would allow you to analyze them but also if you made a manual change you don't want it to clear out those files and re-extract them every time you want to keep your changes intact but in general I would leave the delete checked and the pause unchecked external list file is what I mentioned earlier about attaching to Warcraft while you're playing a map for it to analyze which files inside the mpq are referenced that's because if the mpq file has its internal list file corrupted you won't be able to find all the files otherwise so by generating a new list file with all of the hidden files restored you can select the list file so mpq repacker knows what file names to look for in the mpq a list file is simply just a list of file names and that's it in most cases you should not need to supply a file here because both repacker and XD protect have a deep scan option built in which does not attach to the Warcraft 3 game engine so it's not perfect but it should get most of the files and it does the same thing that this mpq recovery program does so most likely it won't be necessary to modify this file it should be automatic and then this unpack unknown files that is useful because if the list file is corrupted the mpq extraction can still find all of the files it simply just doesn't know what their file names are so as an example war 3map.j is the Jas scripting file if that file name is missing when it repacks the mpq the new copy of the map will not work but if you find it within the unknown files and rename it to ward3map.j then when you pack the mpq it'll work we're going to go over this cheat section later on under are additional settings compression just makes the final mpq file smaller give the map a name from w3i WTS I'll explain this in more detail later but in general I would leave this unchecked because it typically fails to work and it's not too hard to just do this D protection yourself that's a bug I would like to fix in repacker once I get it compiling and then the don't use embedded list file if you have that unchecked it will do the Deep scan I was talking about before a lot of maps do have this type of protection so it's probably good to check it however I typically don't mess with these settings at all because XD protect has those same options and I think XD protect does a slightly better job so I would just leave these both unchecked and keep XD protect checked in most situations next inside of plugins again this is a portion I could not translate so once we get the code compiling that can be fixed but if you scroll through these screenshots you can see the English translation for each of them if you need it plugins are additions to this program done by other coders which I think is a pretty useful feature you probably won't need cheat injector because this cheat settings does something very similar and it works just fine cheat pack detector is if you want to prevent other people from cheating patch w3i is the same as this checkbox and it's also similar to this other setting of give the map a name from w3i again I don't think you'll need any of those because XD protect can do it in most cases and if it fails you could do it by hand pretty easily script Auto replace allows you to configure a list of search and replace commands for the war 3map.j file which is the Jas code so this would allow you to embed your own custom code automatically each time you pack the file if you had like a generic script that you want in all the maps that you need protect SLK recover is what I mentioned earlier about this silk object console which extracts the unit metadata out of the SLK files and restores them into the world editor files and this is why I don't think you need silk object console because it's built into repacker but if for some reason this fails you could use the other silk object console and finally spazzler is a protection technique which takes the World of Warcraft mpq header and puts it on a Warcraft 3 file and the purpose of that is to confuse the mpq extraction programs so they think it's a World of Warcraft map instead of a Warcraft 3 map so they'll fail to extract it correctly so the unspazzler just reverses that form of protection next we have rebuild the map that's what you're going to click once you're all done setting everything up and then if you want to test it you would click launch and Warcraft three but in my case this has the wrong file path Warcraft 3 so when I click it it errors out I think it's easy enough just to have this file output directly to your Warcraft folder when you click to rebuild the map okay so let's try this with pest Invasion I'm going to uncheck all of the the protection options and just see if rebuilding the map is Enough by itself so that we can open it unfortunately the output is all in Russian but whenever it stops typing at you you can assume it's done if you needed to you could copy and paste into Google Translate to see what the message is uh for some reason it always thinks the word map is card when it translates from Russian to English so this says map repacking completed so it thinks it was successful let's see if it really was I'm going to open up the editor and first I will open the original pest Invasion to make sure that it crashes and it does with unit data missing or invalid then I'll try the hacked version okay same error so remember inside a repacker when I Mouse over this empty War 3 map units.do it specifically says it fixes the unit data missing or valid so I'm going to check that box and try again okay just finished let's try reopening nothing so this is an example where I feel like XD protect does a better job and that's why typically I don't use the empty or the replace or these additional settings I really just like repacker for these cheats that I'll show you later as well well as these plugins so instead I'll just say use XD protect and try again okay just as it finished let's try to open again okay it opened no problem at all one thing to keep in mind about deep protect it does have a UI program this x div 0.2 but if I open it it's all Russian this does not actually do anything other than changing the ini file so you may as well just change the ini yourself the original ini file is all in Russian but remember I have my own copy of repacker in GitHub where I've translated everything inside of it there's a dependencies folder which has XD protect I have translated the ini file in here so this is all in English and in addition I also have the source code to XD protect right here also translated to English so as we find bugs in XD protect we can work around them or fix them so now that I have pest Invasion the protected let me just prove that it it works so obviously you can see on the screen all of the graphics loaded but if I go to module object editor you can also see all of the modified units so anything in pink has been modified so for example skull cannon toy tank toy transport these are things specific to the pest invasion game that are not part of the base Warcraft game also if I go to module trigger editor you'll see there's one trigger called init that was deprotected with XD protect and it has all of the Jazz code for the entire map unfortunately none of the tools will convert the triggers back to the original GUI triggers so for example if I create a new trigger the user interface is drag and drop it's all a visual coding language I think the concept is really cool for new developers but in the end you really should learn real coding techniques and ideally you don't even want to learn jazz because it's a bad language you should upgrade to Lua since Warcraft 3 now supports that so in the case of pest Invasion basically we just had to hit the one check box and it worked let's move on to the next map based on file size Defiance open RPG is the next smallest so I assume it'll be the next easiest so in repacker I'll pick Defiance it automatically changed my file name but kept it in the Hacked directory I'm going to leave all the settings the same and just hit rebuild and see what happens okay it tells me it's finished so I'm going to open the Hacked Defiance open RPG and see if the world editor can open it okay it opened just fine let's double check though module object editor okay we've got our pink modified units so that looks good module trigger editor code in here looks fine when we get a map unprotected we want to make sure that it actually works because there's a possibility that the D protection actually broke something in the game so I'm going to take this hacked Defiance open RPG and I'm going to put it into my Warcraft Maps folder I made a folder inside of it called underscore hacking the underscore is to make it move to the top of the list so I can find it easily in the game and then I'll just paste the map into here the reason I like to have a folder called hacking is if I play the game online with other people I never want to accidentally host one of these hacked Maps because that will allow it to download onto other people's computers and I don't want to distribute a hacked copy of a game for two reasons one is map makers protect their maps in order to protect their intellectual property and if they didn't you would have a whole bunch of people that put in their own little cheats and that would ruin the game for everyone else so if you're going to cheat I think you should only do it in single player mode or only when you're playing with friends not online with random strangers or if you do it with random strangers rename the game so it doesn't taint the original and document all the cheats so everyone knows that they exist so everyone can use them together a classic example is one of my favorite games League of Legends has themed modes that they run occasionally one of them is called Earth which stands for Ultra rapid fire it basically removes all the cooldowns in the game so you just Spam your abilities as fast as possible it's probably the most popular game mode so there's no reason to not have a version of DOTA in Warcraft 3 that unlocks Earth mode so everyone can spam their abilities so as long as the cheats are public and the map is renamed so that it's obvious that it's a different version of the map I think it's fine the other thing is if a map has been discontinued the original author hasn't touched it in years it's probably good to host an unprotected copy of the map so other developers can find it and improve on it because that's what made Warcraft 3 so popular in the beginning was the custom maps were improved on constantly but if someone is actively working on their map you're going to really upset them by Deep protecting their map and making it available to everyone so that's why I keep it in this separate hacking folder so that I never accidentally host it when I'm playing online what I really wish blizzard would do instead so that protecting Maps was not necessary is I wish they would encrypt maps with a thumbprint or signature so that the map files themselves are still readable but if any modification is made it no longer matches the signature so that you can verify which maps are authentic and which ones are not and then they could open up all the maps to the community and let everyone iterate on them making improvements and use a ranking system based on play time and voting so that the best mods get promoted and the worst mods don't and then they could host their own database of maps and let Gamers search for which map they want to play that would be very similar to this concept of the lock inside of Google when you're looking at a website if you click on this lock says the certificate is valid and if you click on the certificate it has these fingerprints unfortunately I don't think blizzard will take my advice now I'm going to launch Warcraft and I'll load up that game single player custom download here's that hacking folder at the top Defiance open RPG so I'm going to hit start and ideally we'd want to run the original version First learn how it works so that way when we play the Hacked or d protected version we can see if it still matches the original I've never played this game but just by watching it load it seems pretty obvious that it is working correctly so it looks like it wants me to pick a hero from one of these towers I'll just pick one at random wants me to pick some kind of bonus I get I'll do attack speed I guess here's my character I can move around there's townspeople it seems obvious that this map is working great and remember this is the map that I opened in the world editor so that's proof that it was deep protected correctly now if I play this game for hours and hours it's possible I would find some random glitch somewhere where the Deep protection failed maybe if there's custom artwork or or sound effects for a boss when I go fight that boss it doesn't render correctly because that file was hidden during the extraction so if you're really wanting to be particular you may have to make a list of the little bugs you find and fix them by hand but most likely the map's gonna work great and not have any issues so let me quit out and I mentioned earlier I would explain cheat packs so let's do that real quick just for fun inside of repacker in the middle it has this section called cheat settings on the drop down there are a list of cheat packs and if you find others online you could add your own because this program is meant to be extensible but this is a decent list I think to start with so I'll just pick this first one if I want these cheats to be embedded into the map I need to click this checkbox embed sheets and it's designed to only do one cheat pack at a time because they might conflict with each other if you really wanted more than one cheat pack you would rebuild the map once with the first gpack then you would change your Source map to the the map that you have already hacked and already has cheats in it then you would pick a different cheat pack and rebuild again and in theory that could give you two cheat packs I wouldn't recommend it because there's a chance the two could conflict with each other but it should be fine now the activator is a message that you have to type in order to activate the cheat pack so by clicking on the commands I got the help for arrows pack notice it says that the activator is Dash cheats with a z well that should be true if I downloaded arrows cheat pack online and embedded it myself but because repacker is doing the embedding it's modifying the activator to be mpq repacker so ignore this built-in activator of cheats it will be incorrect if you're using repacker okay I will build the map it says it's completed I'm going to open up Warcraft again single player custom games download hacking Defiance RPG start okay everything's loading the same as before I'm going to pick my character and my bonus now I'm going to type Dash mpq repacker because that was the activator it now says cheats enabled so if I go back to my document let's find a few hacks we want to try mh4 map hack sounds interesting that basically will turn off fog of War gold is pretty obvious not necessarily that exciting um no cooldown sounds pretty cool modifying my character's attributes gaining levels turning off Paving so I can walk through anything those all sound interesting so let's try a few enter Dash MH for map pack okay that one surprisingly seem to fail the minimap definitely went visible for a split second and then it turned black again let me try again yeah it did that both times and you can see there's a little Knight right here that appears for a split second under my cursor and then he disappears so I think this game must have some kind of trigger that every time fog is disabled that it re-enables it so unfortunately that particular map pack is not working but let's try gold 1000 okay there's my gold at the top that worked um I'm gonna try to walk through things so right here I can't walk through this Fountain he just walks around it so I'm going to type Dash path off now I'll try to walk through hey I'm going right inside the fountain um okay path on okay now I can't walk through anymore okay my primary character is strength and I have 30 and each point in strength gives me hit points damage and hit point regeneration so if I type Dash str100 now it's 100 instead of 30 and you'll notice my damage went up as well so that's the concept of a cheat pack and if I went back into repacker and I picked a different cheat pack and opened up the commands you'll see it has a completely different list some of them are going to be similar gold Lumber those are fairly standard but for example this one will give me a random item I don't remember that being in the other cheat pack so it would be really fun to experiment with all the different cheat packs and see what different cheats exist and what's nice about it is it can be embedded into any map so the possibilities are kind of endless I imagine in some maps they've got a whole bunch of secret items so it would be fun to experiment with this way okay let's quit out of this map and let's move on to the next deep protection in our list so we've got bleach versus one piece so I'll pick bleach put it to hacked use XD protect I'm going to stop working with cheats since we've already covered that topic I'll leave the other settings the same as the previous maps and click rebuild now this black window that pops up is for XD protect repacker opens it waits for it to finish and then it takes the results and creates the final file one issue with that is it does not allow us to modify the xdep ini file and for this particular map it probably would work if if I was patient but it says inlining function and it's going through a long list and I've been waiting for several minutes already and it's going really slow I don't want to wait for this and I personally don't like this inlining function option I would only turn it on as a last resort if the map can't be de-protected without it so at this point I'm going to close the repacker program and run XD Protect by hand so I'll take the bleach map file and I'll go into my XD protect folder and paste it in and I'll open up the ini file and the inmap file parameter I will change to be bleach and for the out file I'll just call it the protected.w3x now let me go over the different settings that XD protect has first it has these clean temp directory settings I prefer on Startup to not clean the temporary folder it's fine for success but not fine if it errors what's going to happen is when it runs it'll make this new folder here called basically like bleach underscore temp something like that and that will be its working directory where it extracts all the files from if it's successful I'm fine if it deletes it but if it fails which is the on error I want to be able to analyze the files and see what failed and in addition I don't want it to clear on Startup because if it failed previously then if I fix something manually I want it to start off where it left off rather than starting from the beginning because if it starts over my manual fix will be gone so those are personal preference but I think they're good defaults the only downside to not clearing on start is there may be an occasion where you have to delete the folder by hand in case you really want to start from a clean slate okay pause on success and error that's only really useful if you're running the program by double clicking the exe I prefer instead to take my folder path open up a command prompt paste in CD space enter that stands for change directory and then I prefer to run the exe like this the reason is if you double click the exe when it's all finished the black command prompt box will disappear so you won't see any log messages and that's why pause is useful but typically I'm going to have to make some manual changes multiple times and keep retrying so I prefer to just keep this prompt open all the time so I can quickly rerun everything scan enable is what I talked about earlier with that deep scan where it's going to search the entire mpq archive for hidden files so I would always have that on and it should do a good job there will be a lot of unknown files when it's done for more complicated Maps but usually it still works fine without them in the rare event that the game has some kind of bug because of the missing file that's when you would use the mpq editor which I showed earlier and have it attached to the game itself and monitor which files are read out of the MP queue but I think the scan enables should be good enough in most cases the append list file means this list file.txt next to the xdep.exe this tells it which files to try to find in the mpq archive and anything that's in that list does not need to do the Deep scan so it's good to just leave this appendless file on halt on unknowns that would be after it's all done extracting the files if there's any file that it could not figure out the file name for it would close the program and not create your new d protected map file I don't think you want to turn this on because most of the time those unknown files can just be ignored the map's still going to work and it's quite common to have some files that it can't figure out the correct name for them okay these next set of options delete ALS that's the attribute list file and signature file for example the list file inside the mpq is usually corrupted and that's what causes all the unknown files so if you delete the built-in list file that and it will get replaced with a new one which is not corrupted and which has the correct list of files so generally you want to have this one turned on if you're wanting to be extra careful you could kind of turn off all the settings to start with try to unprotect and if it fails turn on one setting at a time just to kind of get the minimum number of patches necessary but in general I would have a set of default options that work for most maps and only modify the settings that failed delete ALS I would just keep on all the time the patch w3i I would also just keep on all the time this is the info file and that's what stores the map's name as well as the splash r that shows during the game loading screen so it's common for that to be corrupted so turning this on is beneficial in the rare event that this breaks something or makes it worse instead you would want to just copy the w3i from a blank map and paste it in that would remove any custom Splash art but then you could just run the real map to see what the splash art looks like and then recreate it from scratch in the world editor if you needed to and this particular setting it will actually try to detect if the w3i is corrupted so it won't modify it if it's fine this build imp is very important there is something called an import list in the War 3 map.imp file if you go into the world editor and go to module asset manager this is essentially the import list and this is where you would add custom models and custom sound effects if there is any file in the mpq that does not belong in the base map files and is not in this import list then when you hit save in World editor it will delete it because it tries to clean up files that don't belong so if you have custom artwork for a unit it can be in the mpq and work fine in the game and even open fine in the world editor the first time but as soon as you hit save if it's not in this import list it will delete it from the the map so then the next time you run it that artwork or sound effect will be gone so it's common for that import list to be corrupted and you need this setting turned on this build dummy do I would leave on in most cases this should not be necessary because there's a separate do setting at the bottom called build underscore do the bottom one is a bit more advanced and works better so I would turn on both because this top one will only execute if the bottom one fails the do file stands for doodads there's actually two files one is War 3 map units.do and the other is War 3 map.do doodads are essentially objects that have been placed onto your map if these files are not rebuilt then when you open in the map editor your units or trees that appear on Startup will be missing next is this recover script the wtg and wct files are for triggers basically jazz script and remember the world editor has a visual format for the script so the real file that matters in the game is war 3map.j but the wtg and wct files allow you to visualize the triggers in the coding tool inside of world editor so commonly these files are deleted and only the war 3map.j file is kept so recover script will analyze the war 3map.j and try to recreate these two files now it will never get them intact to the original so you won't be able to use the visual coding tool in the map editor but you'll just have one single trigger in the coding tool that's not visual that just has all of the text from or3map.j so if you don't have this setting turned on then either the world editor won't be able to open the map at all or it will open but as soon as you try to save all of your Jazz code will be deleted because it will take the corrupt visual triggers compile the them into a jazz file and replace your War 3map.j so you need this so that your Jas doesn't get re-corrupted after you save in the map editor finally the build w3x is what actually creates the final map file when it's done so if you have that turned off the temp directory would have all the files after they've been extracted and corrected but it would not actually create the final map file and you'd only have that turned off if you wanted to do manual edits first before creating the map file but then you would have to create the map file yourself rename reserved functions the world editor has specific reserved function names that it needs and if you make a function with one of those names the world editor will crash this will search for any of those functions and rename them I would recommend always having this on inline functions I would recommend having this turned off the reason is it is very very slow and basically it's taking code like like this this is just pseudo code but where that function is called it just takes the original code and replaces it and then comments out the original so it's just simplifying your code Now it only does that if the function is not used in multiple places because if it's used in multiple places you don't want it to make your code really long especially if this function is more complicated so this is just really slow but most importantly it's pretty rare for a map to need this so I would only turn it on if the Deep protection fails and you're able to narrow it down and determine that this particular feature will fix it rename globals I would turn on it's not necessary but it just makes your code easier to read so an obfuscated variable name is just like random variable names so normally you'd have something like this to be a region variable but instead it would just scramble it with random letters that's going to make the code harder to read and understand so rename globals will correct that so that it's easier to understand now it's still not going to be a user friendly name so for example a name like region hero spawn is really nice because you know exactly what the programmer's intention was for that variable whereas instead something like region one not super useful but at least you know it's a region and not an ability or something else so rename globals doesn't really fix protection generally but it just makes the code easier to read and that's actually the same purpose of this indent script as well is readability by default the code in war 3map.j has no tabs so an if statement is really hard to follow without tabs especially if there's multiple nested if statements so I think it's fine if you want to do the indent script but I personally have a better option so for example here's the war 3map.j that came in the base map if I select everything and hold shift tab that will just remove all tabs so you'll see for example here the tabs are missing here on this globals section and also so on this function section well this program Visual Studio code it has an extension you'll notice on the bottom right corner here it says Jas if you go into extensions here and search for jazz and install it then it can Auto format your code it also gives this highlighting so the color coding makes it easier to read as well but if I just right click and say format document it re-adds the tabs personally I would turn indent script off and I would use the vs code one instead but it's up to you okay parse W3 data what this does is inside of every map there's generally a main function and a config function these possibly could be renamed to something else but this has some basic setup for example it has the map's name and up here it has like the camera bounds if the w3i file which is the info file has been corrupted then the world editor doesn't know the name of the map and it will crash but it is still in code code because otherwise the game would crash parse W3 data simply grabs that data out of the Jazz script however it does not actually do anything with it this setting just tells it whether it should try to understand that data out of the Jazz so I don't really know why it's its own setting the only setting that depends on it is this build do the build do will figure out the starting points of each player which comes from this Define start location and it will put that into the w3i file because if that portion of the file has been corrupted the world editor won't open even though the game works fine I would recommend having build do turned on and for that to work you also have to have the parse W3 data turned on so that's all the settings the XD protector has there are a few types of protection that it does not handle but they're more rare and I have extracted the source code out of this XD protector program so if we find a protection that fails we can improve this program but I would recommend leaving everything on except the inline functions and the halt unknowns and the clean temp on start and error everything else I would leave on so when we ran the repacker before XD protector didn't crash but it was so slow on the inlining of functions that I didn't want to wait okay now I'm going to run XD protect now this is kind of odd it says it can't open War 3map.w3i but I know when I ran it with repacker the first time it was still using XD protect and it did not have this issue because it got down to the inlining of functions and I only killed it because I didn't want to be patient and wait for it let's see what we can do to work around this issue I have a couple of options first I could open up mpq master and open the Bleach one piece unfortunately you'll notice mpq Master just crashed so it can can't open the Bleach file either so it's weird that XD protect and mpq master fail yet repacker works fine and the reason for that is you'll notice mpq Master uses a dll called mpq lib that's how it extracts the files inside of the mpq archive but XD protect instead uses sfmpq so they're different tools and so most likely repacker uses its own technique so we could instead switch to mpq editor that I mentioned I don't like quite as much as mpq Master but sometimes you have to just use multiple tools until one of them works and so you'll notice that this one does have files in here so that's one option but I think I prefer to open it up in repacker instead since it was already working and I'll do bleach again and I'll keep the XD protect on which I know is going to take forever but I'll cancel it part way through and I'll say rebuild map so as soon as XD protector starts up I'm going to pause it if I just highlight something with my mouse it makes the program pause you'll see my temp folder here is appdata local temp mpq repacker temp so here you can see all of the files that were exported we want to essentially turn off the setting for inlining the other option is I could uncheck this pack with XD protect let repacker hack the map once then change my source map to that hacked version and then run it through XD protect a second time and then hopefully that would get rid of the w3i issue the reason for that is because XD protect has better D protections and so I really do want to run it through XD protect but since it's crashing I need to fix the crash first but I think I'll just take all of these files that were extracted out and I'll just copy them into my XD protect directory and let it go from there so here's my XD protect folder inside of temp files it was only able to extract one file before it gave up so I'm just going to delete it and then I'll copy all the files from repacker into the temp folder of XD protect so essentially I have two versions of the protect running one is the one that repacker started for me and the other is the one that I'm running by hand and the only difference is the one I'm doing by hand I have the inline functions turned off so that I don't have to wait forever and in case you were curious how repacker is able to run XD protect in the toolbar here you'll see the path is local temp xdep so the place I just copied from was local temp mpq repacker and this was all the files but the xdep folder has the XD protect and all the files as well as the ini the issue here is I know that repacker as soon as xdep is finished it will delete everything in here so that's why I kind of needed to pause the program so I could grab all the files so now that I have my files extracted from the mpq I'm going to cancel this XD protect which unfreezes repacker and I don't need it anymore so I'll just hit the X on it and then I've copied all the files into my own instance of XD protect where I've modified the ini to not inline functions so now if I try running it it should not give me this error about War 3 map w3i missing okay looks like it's working and hopefully it should be fairly quick because the inlining is not happening this time so it looks like it's finished it always says that there's errors those can just be ignored I think it's just a bug in the protect that it tries to delete this folder but the folder is not empty because I told it don't clear when you're finished in case I want to make some modifications and try again so you can just ignore those errors so here's my d protected file let's see if it opens in map editor so I'll move it to my hacked folder and I'll call it bleach deep protected file open map hacked bleach d protected okay it seems like it opened so that's good news let's go to module object editor okay all the units that have been modified are in pink and module trigger editor here's all my scripts code so it looks like a d protected since I still have four more maps to deep protect I'm not going to go to the effort of running the map and testing it I'm just going to assume that if the map editor opens it's been successfully protected unless there's something obviously wrong so let's move on to lordaeron file close map now this time I'm not going to start with repacker I'll just start with XD protect so I will delete the bleach files that I was working on and I'll copy and order on and the reason I'm starting with XD protect is just like in the last instance where XD protect needed custom modifications to the ini file which repacker does not allow I'm just assuming that's going to be the case for some of these more complicated Maps so I'm just skipping repacker altogether you should probably try it with repacker first but I'm skipping it this time okay open the ini change the inmap file to lordaeron leave the out as the protected leave all the settings how they were the last time which is basically everything enabled except for inline functions save it and we'll run xdep okay you'll notice here I'm going to pause it for a second it's extracting a bunch of unknowns and we've discussed that hopefully those are safe to ignore and if they're not we could use mpq editor attached to Warcraft while it's running and maybe you could find more of the correct names to add to the list file so they can extract correctly but most of the unknowns extracted okay even though it doesn't know the proper name for them but some of them say error that's slightly concerning but again we'll just ignore it and only worry about it if the unprotected map has issues when we actually try to play it or edit it so I'll continue another thing to keep in mind is there are a lot of files being extracted right now there is a bug in XD protect which I'll show in a minute how to fix but if there are too many files it will fail to recreate the new archive and repacker has the same exact issue so the fix for both will be the same okay after what seemed like forever it finally finished and the last few messages showed up really quickly and then disappeared I think there was an error but it was so fast it wasn't captured on the screen so let me test opening it with the map editor and then I'll show you how to debug that error if there was one so I'll take deep protected and put it in my hacked folder and try to open it with map editor and instantly you see level info data missing or invalid that error generally means that the mpq archive is actually completely corrupted and no program can open it so I'll prove that if I were to use the mpq master or any other mpq editor for that matter and do open if I try to open that file uh it says error opening archive the file is completely corrupt now let me show you how that happened if I rerun XD protect and I use the greater than sign and make up a file name like log.txt it will redirect all the output to that file now it should be very quick the second time around because it doesn't need to extract all the files like I did the first time that's the beauty of not clearing the temp directory each time and it looks like it's finished but it's waiting for me to hit the enter key I just don't see that on the screen because it's in the log file so I'll hit enter and it's done so if I open this log file and scroll through it you'll notice it says ok at the end of every file as it's adding it until part way down it starts saying error on every single one and it's a bit odd it seems like the command line console truncates at a certain number of characters so some of them don't show the full error but everything before was successful and everything afterwards was unsuccessful if I were to count how many succeeded so I'll just cut these delete everything else and paste it the line number is one zero two three so that's how many succeeded now next to XD protect there is a file called sfmpq if I run that by itself sfmpq it gives me some help for how that program works and I can assume it's how XD protect creates the mpq archive notice there's an option of Dash M which is the maximum number of files in the archive which defaults to one zero two four and that's exactly the number of files that succeeded before it started failing so I don't know why this setting exists I'm guessing the mpq can be optimized if it knows ahead of time that it has a small number of files or maybe there's something in the header metadata when the mpq is first created that takes up a certain amount of space for example with the list file and it needs to allocate extra space in advance if there's going to be more than a thousand files something like that because it specifically says it only matters when it creates a new archive so this in a way is kind of a bug or at least not a user-friendly feature of mpq because it seems like if it tries to add files to an archive that's full it could just make a new archive that supports twice as many files and move all the files to the new archive but regardless we're not going to rebuild the mpq program we're just going to work around its limitations so obviously this Dash m is not being sent when XD for text calls it so the problem here is I don't know the exact command that XD protect is using to add all these files to the mpq and I don't know if it does any extra manipulate position of the mpq after the fact so even though I could call it from the command line directly with a different Dash M parameter I'd be missing whatever else XD protect is doing so first we need to extract the source code out of XD protect so we can understand how it works and make sure we do this properly and before I forget I'm just going to right click on this files and do properties because windows will count for me how many files there are it shows that there are 3594. so when I do the dash M command I'm going to want to make sure I give it space for at least 4 000 files so there's room to grow typically I say maybe just round it to the nearest and then double it so maybe I'll just do 8 000 to be safe so how would I extract the code out of XD protect there's a few things I could do first I want to get metadata about the exe so that I know which programming language it was compiled with so first I'm going to open the same resource hacker that we used before and I'll open up XD protect and I'm just going to skim over some of the resources that are in here to see if there's anything promising so something interesting I noticed off the bat is under manifest it has kind of this metadata from when it was compiled and it says Pearl for the description and purl for this name right here that strikes me as odd because Pearl it's a scripting language however everything else in here looks more to me like a program compiled with Visual Studio probably like visual C plus plus or something so that's something that strikes me as interesting off the bat if I wanted to know how it was compiled there is a program called peid which you could Google and download and I'll just open XD protect in here and it tells me visual C plus plus six so now that I know what it was compiled with I would want to Google for a Microsoft Visual C plus plus six decompiler and you want to be very specific to the exact compiler you're using because Borland C plus plus or this C plus plus Builder that rad Studio uses they're all completely different compilers even though they're C plus plus and so the decompiler needs to be specific now if it's an obscure compiler it's likely that there's not a decompiler for it or at least not a good one and even if there's a decompiler C plus plus compiles down to assembly it's almost sometimes easier to read the disassembly than it is to try to read the decompiled C plus plus but um right now I'm just Gathering Clues so my favorite tool for disassembly is Ida so let's open that if I open up Ida freeware and I say new and pick my program xdep I'll just leave the defaults and hit ok now the first thing that pops up normally I just ignore but sometimes it's good to read error messages or Warnings just in case they give you clues about something so it's saying that it can't find the symbol file which is a pdb file that's completely normal when you're decompiling a commercial software or software that you downloaded online because pdb files are debugging information and most people don't distribute that debugging information unless it's an open source program so normally I would just ignore this but something interesting again we see Pearl which like I said before is a scripting language so the reason that's curious to me is scripting languages are usually not compiled but an exe is compiled and this particular case was compiled with C plus plus so C plus plus and pearl are completely different languages so I'm wondering could the C plus plus maybe just be a wrapper around the Pearl and the benefit to that is since the pearls probably not compiled I can possibly extract the original source code with no modifications and even having the comments and I everything which would be very nice for being able to modify and edit this code so I'm going to ignore this error now we see the assembly code here if I wanted to disassemble it back to C plus I would go to view open sub views generate pseudo code and this gives me something C plus plus like and I could skim over it and I could try to figure out what it's doing but first let me look for a few more clues so one view I think is very useful is the strings view the purpose of the strings view is to read through the entire executable specifically in its data section where variables are stored and look for anything that could be interpreted as ASCII text and that's because if your program has any type of user interface those messages have to be in the code so that they can be rendered to the screen so if you find an error message while you're running the program you could search for the error message in the strings View and that might give you a starting point to tell you where in the code or the disassembly that specific string is output to the screen but in addition you can see here a lot of these strings look like function names and normal functions once they're compiled down do not have their name anymore because they are just converted to memory addresses but any external functions that have to execute at the operating system level need the actual function name to remain intact so again you could use this to find where those operating system calls are made but I'm just going to scroll through here and see if I find anything interesting that gives me any clues so right off the bat I see a whole bunch of things that say Purl again I'm thinking this is not really a c plus program this is probably just a wrapper around a Perl script so I have kind of two approaches I could use to try to figure that out first of all this paper l dot C I feel like that's kind of the name of the wrapper the dash e looks to me like maybe it's going to execute something and this begin kind of looks to me like it could be the start of a pearl script as well as you've got the script name here so if I wanted to really disassemble this and debug it I would double click on the dot data it would take me to the disassembly then I would right click on the data and say list cross ref references and that would show me where in the code that piece of data is referenced and then I could add a break point and then I could step through it as it's executing but I think there might be an easier technique so if I just run the program somewhere in its memory it has to have the Perl script while it's executing so a program has a whole lot of memory so if I just dump the memory it might not be obvious where the pro script in that memory is but if I just look for one of these strings I might be able to find it really easily now unfortunately I did not see it anywhere in the strings Tab and that's probably because the Perl script could be located in an obscure place and in fact maybe I could search inside a resource hacker here for this message this like x d protect but I don't know if that will be the case because an executable if it has an embedded file it may be compressed and in a format that this strings tab or the resource hacker or program can't necessarily extract it but I know when it's running in memory it has to be the pure script decompressed Etc so that's what I want to try so what I'm going to do is I'm going to run XD protect and I'm going to highlight the screen like I did earlier just to pause the script while it's running because I don't want it to finish executing because I want to analyze this memory and then I'm going to open up the task manager you can get that from the start menu by typing task manager or I just hit Ctrl shift escape and then I'm going to click on details and I'm going to look for xdep here it is I'm going to right click on it and say create dump file that will take all of its current memory that's in Ram and output it to a file and it tells me the location is going to be in this temp folder so I clicked the open file location from that dialog and here is the xdep.dmp I'm just going to open this and because it's memory I expect the majority of it to be binary ones and zeros that are not useful but the part that's a Pearl script I'm hoping will just be user readable ASCII text okay so it says it's probably not a text file do you want to open anyways and I'm saying yes and I'll just use the built-in text editor okay so we got an ugly mess here but that's okay I could have also used my hex editor now in here I'm going to search for one of these messages that's on the screen and I'll search for xdp.ini okay look at this this is beautiful so you can see at the top it's calling execute line one with this Pearl script name a bunch of crazy characters but then the script starts right here with a this is a pearl script all of the code until at the end of the script we get a bunch of crazy characters again so I should just be able to highlight the whole thing and copy it out so now I have it in this xdep.pl file right here now we can read the code see how deep protector works and back to fixing the lordaeron map luckily no one else should ever have to extract the pro script again because I've already done it I just wanted to show you how it's possible so we found that with lordaeron it has more than a thousand files and sfmpq needs the dash M command to be given so that it preps the archive for a large number of files but obviously this Perl script is not doing that so if I go into the code and search for sfmpq I can see where the program is used and I'm not going to read or explain any of the code unless it's critical to what we're actually solving because the codes is long and complicated so we can see right here it's building the w3x file because it's an if statement based on the ini having that option enabled and when it calls sfmpq with the add command it does not have a dash M and the add command it's actually calling it with the list file so inside of XD protect we see there's a temp folder and that has two list files so now I know what it's doing I just need to go up into the lordaran temp folder and from here I should be able to execute this sfmpq command but next I need to know what does it do after the fact is there anything important I'm going to miss by doing it by hand since I can't actually fix this Perl script I want to just add M 8000 or some large numbers so that it preps the archive with enough files but then I had to figure out how to compile the pro script and either have to download the Pearl interpreter or I have to find the C plus wrapper that allow it's executing Pearl from an exe I don't want to deal with that right now I'll do that in the future so instead I'll just run these commands by hand so after it calls sfmpq I can see here that it reads a header file and it grabs 512 characters from one and then it writes those same 512 characters to the other and then afterwards it closes the mpq file and it says that the map has been created so because the map's been created at this point I think it's done so the only thing I need to be careful of is to make sure I do this 512 character replacement after I add the list files so first I'm going to delete the out mpq because that's what I'm going to create then I'm going to go up one more folder into the files folder the reason is if I open up files.txt it has all these file names but these files are not in the same directory they're up one level so I think if I run the command from the temp directory it will fail so from the files folder I'm going to go down two levels so that I can find sfmpq and if you hit the Tab Key it will auto complete so it did dll first but I want the exe so I'll hit that one more time then I'm going to do the a command for add I'll go down one level and choose my files.txt and then I'll specify dot dot slash out.mpq as my output but this is the command that Pearl was doing I need to add the dash M and I'll just say 8 000 to make it plenty large since this one has like 3 500 files I'll hit enter and it failed because I think I got a parameter in the wrong order so let me double check the pro script okay once the mpq file first and the list file second my mistake so remove out.mpq and put it before the files.txt okay that's working great now remember this is what we output to the log.txt earlier and after about a thousand of oks it started saying error on everything so if this this gets all the way to the bottom oh it did and nothing said error everything says okay so I think we're good now I would want to also do this off of this list file.text in this case it's empty so it won't matter but in the event that the list file also had extra files we would want to include those as well so I'll just hit the up key to retype my previous command and then I'll just change this to list file.txt and hit enter it won't do anything because that file is empty but I would need that for any future maps in case both of those files have something so this out mpq is almost our deep protected map but there's one issue and that is we need to copy those 512 bytes so if I take the original order on and get its 512 bytes and then I get this out mpq with the hex editor then I should be able to see what these five total bytes are that it's talking about so the Lord are on at the very front it says mpq and the new out mpq if I drag that in it also says mpq now I'm gonna not follow the Perl scripts advice ice in copying these 512 because this is actually one form of D protection that xdep does incorrectly for this particular map but instead I'll show you why and the proper way to fix it so if I were to highlight 512 bytes I would do edit block and chars and type the number 512 and hit OK so you'll see what's in red that is the 512 bytes that it wants to copy and that is normally correct but this Lord draw map has an extra form of D protection that XD protects does not recognize so let me open under the original any of these the pest Invasion Defiance or bleach in a hex editor so if I take pest Invasion you'll see that if I do the same thing edit block and chars 512 and hit OK it's highlighting from this hm3w all the way to this character and immediately afterwards is mpq well lordaran starts with MP Q so lordaeron's actually missing this entire header that header is similar to the w3i file it's just informational and it tells World editor about the map like its map name for example so if I copy these 500 told bytes from lordaeron into out mpq which is my d protected map it's actually the wrong 512 bytes and it'll actually mess up the archive because what I actually need is something like this hm3w header and I could prove that by first opening this out mpq with mpq Master to show that it actually does open and all the files are here and once I replace those 512 and reopen it mpq Master would fail and say that the archive was corrupted but I'm not going to bother with that just trust me um and also if I want to open the out mpq it would also fail because it's missing those 512 bytes from the header so what I'm going to do is take these 512 bytes from pest Invasion paste them into order on now that will mess up some of the metadata about the map for example to have the wrong file name so I'll also just change it to what I want so for example I'll do edit block and chars 512 then I'll do edit clipboard copy so now I have pest invasion in my clipboard then I'll go to out and instead of highlighting these 512 and pasting which I have a different clipboard paste I'm going to unhighlight because I don't want to replace these 512 that start with mpq because I would actually corrupt the archive those bytes need to stay the same I just want to insert it at the front so I'll say edit block unmark so that nothing's highlighted then I'll say edit clipboard paste so now I have the mpq which I should have and I have the hm3w and instead of calling it pest Invasion I'll type Lord Iran instead now you want to be really careful if you're editing directly in the hex editor because if you hit a delete key it will actually remove the entire byte and shift everything over and binary files are very susceptible to errors if any bytes change so for example there's a specific amount of space allocated for saving a file name all I want to do is just use the space key to clear them out and I also want to be careful not to go too far because that XL and this Square they are unrelated to the map name and so if I spaced them out it would actually break it and the way you can tell is most strings are null terminated what that means is where I have the word lordaeron it's the binary is 4c6f72 those are ASCII codes once I get to spaces it's all 20. the ASCII code for space is 20. the very end of the string ends with 0 0 that is a null character that means it's the end of the string so 78 and 4C are for something completely unrelated so I don't want to modify those because it could break the map so obviously this header is not the correct header for lordaeron so something in World editor might be slightly off if I went into the map info in the world editor I might be able to figure out what it is and fix it but it's going to be as close as I can get so I'm going to do file save as and go to my hacked folder and call it Florida on then I can close my hex editor so this map should be protected now so from my world editor I'm going to say open lordaran and let's hope it opens does seem like maybe it's freezing at loading custom object data so there may be one additional type of hack we need to do so I'm going to kill the world editor and I'm going to look at my base map files and I'm going to see what might be incorrect or missing in comparison with the lorder on temp so not all of these files are 100 required for example the conversation Json I rarely see that in files but I'll search for War 3 map dot so I have the do file I have the J file I have the MMP shd the w3c appears to be missing so I should keep a note of that the w3e is there the w3i is there W3 r c t p m t g t s and the blp and the units.due so the only one that was missing was the w3c so I should look at that and then in addition I should kind of do a diff between the files to see if any of them are possibly corrupted in some way so I'm going to look at the file format website again and see what the w3c is for it says it's the camera file I don't know if that's necessary or not so from this camera file from the base map files which I know is good I'm going to open it up in Notepad and it looks like it's just blank so I think it's probably fine to ignore it wouldn't hurt if I just pasted it in here but I have a suspicion something else in here is corrupted so something odd though is when I open the map lordaeron normally if you watch its progress you can see it get froze on a very specific thing that makes it obvious what's broken so for example it's specifically freezing at loading units so as you de-protect Maps more often you'll come to find certain patterns to always look for for example I also mentioned earlier that the Regents file is commonly corrupted so we should just look for that now just in case that's an issue unfortunately it's not something that XD protect or mpq repacker solve automatically for you but usually when that happens this loading screen would freeze loading regions and it'd have a really large number and in this case it's stuck on units so I don't suspect that's the issue but what you're out of ideas you just want to check every protection method you can think of so I'm going to kill World editor again and then inside of our loaderon files let's just look at this w3r in the hex Editor to see if there's anything odd going on okay so the I don't know if you see what I've seen but there's obviously something wrong so as we mentioned before these last four bytes say the number of I can't stop laughing it shows the number of regions that are supposed to be in the file well immediately after the number ends there are no regions so obviously they should be all zeros but in my case I did a really big number by doing ffff because that's the highest value in hexadecimal well this person chose very specific letters in the ASCII table that um I cannot repeat on YouTube or I'll get in trouble but they are also large numbers when considered as binary so that would cause it to crash reading regions so I'm just gonna erase the swear word and change it to zeros to say that there are no regions in your case if you actually saw like 20 regions here you'd need to count them out and make sure you put in the number 20 so that it actually does read the regions that are there okay I'm going to save this file and then I need to repack this mpq file which is a little bit annoying because then I've got to recopy these 512 bytes again so luckily I saw my command window open so I can just hit the up arrow and rerun it and I'm not going to bother to run a second time with the list file since I already know that that's empty so now that it's finished with the files.txt I will open the out mpq in a hex editor and then I will grab the pest Invasion 512 bytes and copy them and I'm going to be lazy when I paste here I'm not going to bother to change it from pest Invasion back to lordaeron and also there is a little bit of risk if you change it incorrectly you might break something so it's almost better to leave it and then fix it in the world editor instead okay I'll save this as lordaeron replace yes open the editor and open lordaran fingers crossed that it does not crash this time okay it got past the custom object data into doodads looking good so far this must be a pretty big map and that's kind of why I started from the smallest Maps first because once we get into like Twilight Z which is pretty big it's going to take a long time to load in the world editor it does seem like maybe it's frozen again so I may need to fix something with the doodads as well so let's see if we can find the doodads I'm going to kill World editor again and I thought that the doodad file was here in in both cases yeah they're both here but maybe one of them has a protection or corruption on it so this is kind of a last resort thing is where I have the base map files I've got a default file that I know is not corrupted that I can replace if I need to the problem is that's also going to delete part of the map so if you have to grab a base map file to paste it in you should do it just as a troubleshooting mechanic to figure out which file is corrupted so I would just do them one at a time paste in just the doodads and see if that fixes it and then paste in just the Jazz and see if that fixes it and narrow it down to only the files that are actually corrupted then once you find out what's corrupted do a diff in a hex editor and see if you can figure out what weird technique they did to corrupt that file so in my case I'm not going to do it one file at a time because I specifically Saw World editor was freezing when it got to doodads so it's going to be one of these two files so let's just try that and see if it fixes so I'm going to go to mpq master and I will open my hacked copy of lordaeron and something nice about mpq master compared to mpq editor is it does not lock the file so I can go into my base map files and right click and add the War 3 map.do and it's instantly saved I don't have to hit file save I don't have to hit file close the file does not stay locked so I can keep it here and keep troubleshooting if needed but I can go ahead and open the world editor and try to open loaderon and see if that fixes it whereas if I was doing that with mpq editor it would lock the file so World editor would not even be able to open the file at all until I closed mpq editor so let's hope this gets further this time it kind of feels Frozen and I remember it froze on this screen before except I think it froze loading doodads the last time one thing I'm noticing is I'm like almost out of memory I've got 27 gigs of memory being used by Warcraft so I really doubt that's intentional there's got to be another corrupt file so I'm going to kill Warcraft again and I'm going to add in the other do file which was for three map units.do and I'll try one more time okay that was awesome so this time it finally loaded so I don't know for sure if it was the units.due or the regular dot do that was causing the problem but it was one of the two we technically do have the map d protected I strongly suspect if I were to run this in game it would be broken because I had to replace both of the do files and in fact if you were to scroll around on the map you'll notice there are no trees anywhere and there are no buildings anywhere however generally those things are also in the script they just are in the do file to make the world editor able to load them visually without running the Jazz so there's a chance the game actually would still work it's a little iffy but let's just check here module object editor okay got all my modified units that are pink let's check the trigger editor okay I've got all my code so I'm going to say that that's bendy protected although it's not a hundred percent okay now let's start working on the DOTA All-Stars map same process as before I'm going to the XD protect folder I'll delete the order on files and I'll open the ini file for the in map I'll use DOTA All-Stars and I'll copy the DOTA file into the XD protect folder and I'll just leave all the settings the same as what we use with lordaeron and I'll come back to the command prompt and try to run XD protect okay it seems to be extracting just fine and obviously we could have tried mpq repacker but I suspect since these are large map files I'm going to come across the same 1000 file limit that I'll need to override since we have not fixed the Perl script inside of XD protect looks like it finally finished extracting it did have 591 unknown files so that's always a little bit concerning especially when it's a large number but as we've discussed in the past most likely it'll be okay now it's adding all the files and if you watch closely you can see the word error that keeps popping up here so that's obviously because it has more than a thousand files so I'm certain if I try to open the mpq file it's probably corrupted so I'm just going to delete the mpq and from the command line I will run sfmpq manually with the dash M 8000 command to make sure we have room for all of the files just to be safe first I'll right click on files and do properties and let Windows give me a count of the files so there are four thousand so if I do 8 000 I should be fine and you'll notice that both files and the list file have data inside them you do need to run sfmpq with both otherwise there will be files missing in your final map so I'll go into the DOTA temp folder and then into the files folder and then I'm just hitting the up Arrow to retype the command that I had previously so I'll run it with the dash m8000 against files.txt and after it finishes I'll do it again with the list file.txt okay just finished now I'll do list file now it's finished so remember from the Perl script it had to copy the 512 bytes from the header so we'll need to do that as well so I'm going to open my hex editor and load the out.mpq and you'll notice it does not have the header yet so I'll open a second hex editor and load the original DOTA All-Stars into it now luckily this one does have the 512 byte header the hm3 at the top whereas the lordaeron did not so instead of copying it from pest Invasion like we did for lordaeron we'll copy it from the original DOTA all-stars so I'll say edit block and chars 512 make sure I'm on decimal instead of hexadecimal and hit OK edit clipboard copy then I'll switch back to the out mpq and edit clipboard paste then file save as I'll go into my hacked folder and call it DOTA d protected dot w3x okay let's see if we can open this in the map editor file open map hacked folder DOTA d protected okay okay surprisingly it loaded just fine immediately so we didn't have to do anything extra besides fixing that 1000 maximum file issue with sfmpq but let's double check that everything really loaded correctly so if I go to module trigger editor I see all the code that looks good if I go to module object editor you'll notice that none of the units look custom there's no pink anywhere so this is an example where the unit data has been corrupted and luckily there is a backup in the SLK files that we could extract out and convert to the world editor format to fix this and if we open MP query Packer previously it had a plug-in in here called SLK recover I think let me go back to my GitHub so I can see the screenshots yes right here on the plug-in screenshots we see there should be an SLK recover it's odd that it's missing all of a sudden but something I noticed was on my notification bar it popped up a virus threat when I opened mpq recover and we previously white listed our folder so that it would not do a virus check on mpq repacker so it surprised me that it still was scanning so let's look at that if I click on this and then do protection history and look at the quarantine threat it says it's inside of app data roaming MP Q repacker plugins SLK recover so even though I whitelisted my temp folder where mpq Packer is installed and the query Packer is using this app data folder as well so I need to whitelist that also so I'm going to copy this folder and click on virus and threat protection then manage settings scroll down to exclusions add an exclusion folder and paste it in and we still don't see it and that's probably because repack has already installed itself into the app data folder and so it's not reinstalling itself it does not realize that file was deleted by the virus scanner so I'm actually going to need to clear out that app data folder so that repacker will reinstall itself into app data so I'll close this open the folder delete everything out of here


and now I'll reopen the program and if that doesn't work for you there's also this plugins folder inside is this plug-in pack which is an install file so you could also run this okay now when I open repacker I see SLK recover so this is the program that's necessary to get the units deprotected on the DOTA map unfortunately because both repacker and XD protect have the bug where they cannot handle more than a thousand files if I use SLK recover inside of repacker it will corrupt the map since it will crash after a thousand files so that's not an option so what I really need to do is fix the XD protect Pearl script and recompile it to an exe for this to work very well but what I could do is turn off all of the deep protections from repacker as well as the embed sheets and allow it to run with XD protect and pause before packing and turn on this SLK recover plugin and the SLK recover should run before it packs with XD protect and then I can do my manual script to pack with XD protect to fix the 1000 file limit another option is you could go into the silk object console app that I mentioned earlier and extract the unit data that way but I prefer to use repacker since it's built in even though it's a little buggy first let me show you what the SLK files look like so if I go to XD protect temp that is where it has extracted everything from the original map file so if I search for asterisk period SLK in this folder here are all the SLK files so if I open one unit abilities you'll notice it opens in Excel sometimes it will have an error that's fine to ignore just don't save the file because Excel will corrupt it so here's the data that shows in Excel if I open it in notepad and instead you'll see it's almost a CSV file which is comma separated but it's using a semicolon instead of a comma there are also specialty tools you can download that are designed for viewing Warcraft 3 SLK files but for example hamg is the ability name and that's just a code so if we went back into the map editor and did module object editor and went to abilities here we see the real names and surprisingly under neutral hostile there are some pink abilities for example this attribute bonus so some of them did de-protect correctly but very few but if I click on view display values as raw data you'll notice all of the ability names change to special codes those four letter codes are the IDS of the abilities that are used by the game engine rather than the full name that's displayed to the user so if I take this hamg ability ID and do edit find and paste it if the ability had imported correctly it would find it but in this case it is a custom ability that was lost and that's why we need to extract it from the SLK file convert it to the world editor format and add it to our deep protected map so that we can view the abilities correctly so that's an example of an SLK file and obviously there are many more besides just the abilities so for example with the unit data we can see all of the attributes about a unit this first unit moves on ground rather than flying like some units this is its turning speed it can attack ground units not air units Etc so this would correspond in the map editor if I clicked on a unit to all of these different properties of the unit and not all of the properties are going to be in one SLK file there may be multiple SLK files that need to be combined together and anything that's missing from the SLK will just use the unit d faults so let's try to recover this data in mpq repacker I'm going to pick the DOTA map and I'll export to my hacked folder and call it SLK and I'm going to pause before packing so that I can manually copy the files to my XD protect folder and then run the sfmpq commands myself and I'll make sure in the plugins folder SLK recover is turned on then I'll click rebuild you just have to be patient if it feels like it's frozen because it will slowly move on to the rest of the files so you'll notice that mpq repacker popped up this command line running silk object Optimizer so it mentions that it could not create this file so that seems like maybe a permissions issue of some sort let's take this file path users Devon app data roaming mpq repacker and see what we can find out so I'm going to hit Windows R to open the Run command and type app data with percent signs and then I'll navigate to mpq repacker plugin ends SLK recover and here you'll notice a few things inside the STD and meta folders are SLK files just like we saw previously and most likely these are similar to our base map files because the dates on them are from 2008 they're very old so I don't think they're specific to the DOTA map that we're deep protecting but this temp map w3x it has a new date so mpq repacker must have taken all the SLK files created a new w3x file and sent it to the silk object Optimizer program so we need to figure out what this error is it says it could not create this file so I have a suspicion that maybe this updater roaming folder is protected in some way so maybe if I run this silk object Optimizer as an admin it might change things but first let's look at this config ini as well so I'm curious what settings are in here that we might want to manipulate but first off we see that there's quite a bit that's in Russian if you want the fulling translation rather than copying and pasting this into Google translate if you go to my GitHub under the repacker plugins silk recover Soo I have a copy of the config ini that has been fully translated to English so I'm going to click download on this file and again I don't know why sometimes Windows thinks that certain files are dangerous it's saying that it's blocked I'm going to say keep there's no possible way an ini file can have a virus inside of it because it's not an executable program it is just a configuration file with settings so I'm going to consider it safe so I'll open up this config ini and I'll copy all of it and I'll paste it into the original config ini that was in Russian file save and I'll keep the file name the same so that it will replace and hit yes to replace now this is strange it says the file is set to read only so that's a little different than not having permissions where you need to run it as an admin so let's check that file if I go back to the app roaming's SLK recover and and right click on config ini and do properties it says read only here that's strange I'm not sure why when it was installed by this plug-in pack exe it chose to put it as read-only but I'm going to uncheck that box just because I want to save the English version and I'll hit ok now I'll try to save from notepad again save replace yes it seemed to work that fine so it doesn't seem like it really needs admin access which makes me a little surprised that this object Optimizer could not save the file but just to be safe I'm going to go up one level to plugins and I'll right click on SLK recover and do properties to see if anything else is read only and it does have a checkbox here but it's a square checkbox if everything in the folder was read only it would be a standard checkbox for example if I uncheck read only it clears it if I check it again it makes it a checkbox so that means that half of the files are read only in half are not just to be safe I don't want any of them to be read only so I'll just uncheck the box and hit OK and it says it's going to change all the files in the subfolders that's probably not necessary because I doubt that this program is trying to modify existing files it's probably just reading them and then creating new files but just to be safe I want to avoid any possible errors and then in addition I think I will try to run this with admin permissions just in case app data is a protective operating system folder I don't think it is because notepad was able to save just fine even though I did not run notepad as an administrator so to do that on my start menu I will type CMD for command prompt I'll right click and say run as administrator I'll hit yes on the permissions dialog and I'll go to the same folder change directory paste my folder and I want to run this silk object Optimizer my only concern is it may fail to run two copies at the same time and I suspect if I close this program repacker will stop waiting for SLK recover to finish and it'll move on and mess up my files so I'll just try running it but if there's an issue I might also try copying all these files to my temp directory and running from there and you'll notice my command prompt says administrator at the front so I know I have elevated permissions okay to run the program I'll type silk and I'll hit the tab to autocomplete and you'll notice because the program has spaces in it it puts quotes all around it I'll hit enter to run it's giving me the same error the other thing I wonder is is list file with parentheses possibly considered an invalid file name let me try to create a file like that parentheses list file parenthesis enter okay that created just fine so that should not be the issue let's try copying this entire SLK recover folder and go into the temp and paste it and let's run the same program from there change to Temp folder change to SLK recover folder and run silk object Optimizer same issue so here we're going to need to do the same thing as we did before which is basically Analyze This executable and figure out what's wrong with it it might also be interesting to open this config ini and see what settings it has one thing I notice is it has a work directory called out and it's trying to save to that out directory let's try creating that folder and see if that makes a difference because maybe the bug is simply that it does not create the folder first out re-run the program hey look at that all of a sudden it seems to be working so you know these programs were not made by professional companies and they're also quite old so it could be that this bug crept in because of a new version of Windows that had a slightly different default setting where maybe the old windows automatically created the folder and the new windows doesn't or it could just be that the tool has always had this bug and people just worked around it by creating that folder but that knowledge has not been passed down no one ever fixed the bug and they didn't create any documentation to explain the bug so to be a good hacker you have to learn how to just troubleshoot and you'll notice I did not know ahead of time what was wrong I had to try 10 different things and most likely the read-only that I changed did not matter and most likely the app data roaming folder did not matter so don't be afraid to Tinker and try to discover what's wrong so I think I will just kill the repacker program and the object Optimizer program repacker and task and I probably could have also just hit the X and another thing to note is D protect has already done its job I already have a hacked copy of DOTA d protected it simply is missing the the object editor data but the map does open in the world editor so I don't even need to run deeper text this time I can just open the mpq master and drag these files in in one at a time and reopen a world editor and see what happens so I'll just make a backup of DOTA d protected in case I accidentally corrupt it and I'll take my mpq master I'm going to switch to DOTA d protected and I'll take this out folder and I'll just right click in mpq master and say add directory and I'll pick that out folder and hit OK and it will automatically replace any files so now I can open it up in the world editor and it looks like the world editor has crashed on opening so I'm guessing one of these files probably is corrupted in the SLK version whereas XD protect had fixed that corruption so this time let's do a diff between the XD protect folder and the out folder to see what actually changed so I'll open Win merge file open paste in my SLK folder and also the DOTA temp files folder from XD protect and hit compare now there's going to be a ton of files that are right only which means XD protect has those files and SLK does not so here if I go to view I can exclude unique items from the right side and that will show me just the identical files that did not change as well as the files that did change so I could open up each of these one at a time and kind of analyze what exactly each program did to make the files different so from this do file it seems quite obvious that the one on the right is very different than the one on the left the one on the left is missing basically everything and that one from the left is from SLK recover so remember the XD protect ini has these settings for building a do file so I suspect this is an order of operations thing SLK since it was working with the original extracted files from repacker and it was only given the SLK files not the entire map it did not not know how to recreate the do file like XD protected so where I copied everything from SLK recover into my map I should not have done it with this do file let's check the others so these are quite different and again the one on the left looks almost blank like it's missing all of the DOTA code so it's probably also just a blank base map script so again I don't think I should have replaced that let's check the next one MMP looks similar so I probably should not have replaced that the one on the left has much less data and this one's weird shd which I believe is for Shadows it says that the files are different but when I compare it says they're identical so that seems like a bug in Wind merge w3a okay these look very different and these codes seem to be like abilities or units and you'll notice on the left side the yellow shows all the changes on the right side you'll notice the yellow ends quite early so this is one where I think the xlk file is correct we could look up from this documentation w3a it says it's a custom unit file so this makes sense we were missing our units and abilities in the object editor the purpose of SLK is to recover them so let's keep a note of that I think so far we want to keep the XD protect version on everything except for w3a now w3c it says left only so it was completely missed by XD protect but SLK recover has it so we'll want to keep both of those let's check w3e okay these are quite different but here on the left side we see that the SLK version is cut short whereas the XD protects version is longer so I think we want to keep the XD protect version w3h is left only so we'll keep the SLK recover w3i it looks like the right side the XD protect is longer so I'll keep that version the w3q RT and U all only come from SLK so we'll keep the SLK version on the wct it looks like the XD protect version is much longer so we'll keep that version and I believe that's the trigger file for the visual copy of the Jazz code wpm again the XD protect looks better wtg it's not very obvious but I think the XD protect version is better because it has one extra line WTS the XD protect looks much longer so we'll keep that blp this one it looks like both have a lot of unique changes but because XD protect is longer I'll keep that one and I think blp is like an image file so I could actually use a Warcraft 3 blp viewer to see what those differences are but it doesn't make sense that the SLK files would recover an image they're only going to recover units and ability data so the one on the left is probably just a default image and the do file it looks like the XD protect version is better because it's longer okay so now that we have a list let's go back to World editor surprisingly it looks like it did finally open even though I thought it was frozen but you'll notice previously when we had it opened we had a lot of terrain and now all of a sudden the train is gone but we do seem to have some units so if I go to module object editor we can see all of these pink units that have been recovered and let's check abilities it also has recovered a bunch of abilities I'm going to switch back to the names instead of the four digit codes because I think it's easier to read not that it matters so this kind of shows what I was discovering with win merge is that XD protect has half of the files correct and SLK has the other half of the files correct so we're going to need to make a merged copy of our map and if XD protect didn't have the Thousand file bug probably we could have just ran everything smoothly the first time and not had to manually merge everything together but because we're having to go out of the normal process to work around these bugs and manually do things that's what's caused these issues so let me close this from the map editor and let me delete my DOTA d protected because I made a backup ahead of time and I don't want to lose my backup so I'll just make another copy and rename it back to DOTA d protected then inside of mpq Master I will do file reopen since I've now replaced the file I want it to reload and here I want to be very careful when I right click and say add directory I want to only add the files I intentionally want to keep and the easiest way to do that might be in the temp SLK recover out maybe I make a copy of this out folder and then in the original I can delete all the files that I don't want to be replaced so if I go back to win merge from do down to shd we determined that all of those the XD protect version was better so we want to delete them out of the SLK folder so I'll highlight do J M p and shd and delete those and in case we need them back we have them in the backup still next we determined that for w3a the SLK version was better but w3e and I the XD protect version was better so we'll delete the w3e and I from slk's out folder w3e w3i delete and these ones that only existed in SLK will just leave them so that they can be added to the mpq archive and for wct down to do we decided all of those XD protect was better so we'll delete them all from the SLK out folder wct wpm wtg WTS blp and do delete okay let's try one more time I could hit refresh and win merch to make sure but I'm pretty confident I got it right so I'll right click in mpq master choose add directory and choose my SLK recover out and hit OK previously it said it added 25 files this time it was only 13. so I'm hoping this is a better copy of the DOTA map so I'll go file open DOTA d protected not the copy since that was the backup before we restored the unit data and hit OK and last time it seemed to freeze as it was loading and it took a really long time but it did finally load correctly so even if it feels like it's frozen I'm just going to be patient we have to remember this is a very large file it's 200 megabytes so that may be why World editor takes a long time to load and that kind of demonstrates a little bit of the benefit of protection is by deleting all of the world editor specific files then someone that just wants to play the game the game will load more quickly in the Warcraft 3 engine and also download faster from Battlenet when you're queuing up with other players if the file is smaller I don't think that's generally why people protect their Maps I think it's more because they don't want them to be tampered with to have people throw in cheats or to have people take the map in a different direction than how they Envision which I don't blame the authors for doing that protection but I dislike that it prevents programmers from opening the map to learn the techniques because by studying how DOTA was designed someone that wants to make a completely different map can learn techniques to make more advanced maps by reading the DOTA code and that that's not really plagiarism because they're still going to write the code themselves and come up with their own ideas they're just learning and it's not the type of intellectual property that needs to be protected because we're not competing against each other we're all making these games for fun to help each other so I'd prefer a different alternative than protecting Maps but I do like the benefit of it loading quicker in game okay it finally unfrows and appears to be loading I was very close to killing World editor because I thought maybe it had crashed and I thought maybe I'd made a mistake so I have an extremely fast PC and it took like 10 minutes to load so on your PC make sure you're very patient before you assume that it's failed okay so we have all of our environment loading which we did not have the last time let's see if we go into the object editor if we have units and abilities and it looks like we do so I would say this is a fully protected map obviously as discussed before we technically should be actually going into file test map or copying it to our Maps folder and running it directly in Warcraft and checking for bugs making sure everything works correctly and it's quite possible there's something that's broken but it's 99 there I think and those little kinks could be worked out by hand if needed but it to me it feels like a fully protected map so that is how to use the SLK recover tool which is needed for DOTA and that's the interesting thing about deprotecting these Maps we found that with seven different Maps every single one of them had different types of protection some of them had things in common but each one added a new type of protection that we had to work around so we still have two maps left demonic sword and Twilight's Eve let's work on those so I'll do file close map and I'll take demonic sword and copy it into my XD protect folder I'll also delete the files from DOTA that we were working with and I'll open my XD protect ini and change it to use demonic sword for the nmap file close and save then I'll go back to my command prompt for XD protect and run the EXE looks like it's extracting fine scanning for unknowns okay we have an issue here it says cannot read war3map.j let's see if we can fix that so obviously if I search in here War 3 map I'm not going to find the J file because it's probably in one of these unknowns and there must just be something formatted strangely so the XD protect could not find it so I'll just take this folder path and copy it and I'll go into Visual Studio code and I'll click this search icon and then these three dots which gives me extra settings and inside of files to include I'll paste in this folder so that it only searches this folder and under search I want to type something in that I expect to be inside of a jazz file so if you're not familiar with what a jazz file typically looks like you'd want to go into the base map files that you extracted from making a default map open it and then just look for or patterns of how a typical file is structured so for example this keyword function is all over the place so if I searched for that it's likely it would find our file but there's other things we could search for as well for example all of these methods here set camera bounds Etc I know a lot of them have a prefix of blz so that's another thing I could search for as well it doesn't necessarily matter what you search for and if it doesn't find it the first time you could try other things but I wouldn't necessarily search for something like this this map configuration comment because even though it's in the base map file since it's a comment it doesn't actually execute in the game it gets ignored so a programmer might delete that comment or change the comment so there's no guarantee that the Demonic sword map has this particular comment as well there are certain functions that are required to happen like if you never set your camera boundaries then it probably will just you use a default camera boundary and not necessarily crash or if you never set your music it'll probably just play default music but I'm assuming if you never run in it blizzard the game will probably just crash and not work so I'll just search for blz okay I found 18 000 results in one file so if I Collapse this you'll see there is not more than one file there's only one but it's this unknown 1a62 file so if I open this this obviously looks like a jazz file so all I need to do is right click reveal in file explorer right click rename War 3 map.j and then I'll move it right click cut up to files right click paste and that probably will fix our issue so let's go back to XD protect previously we had this error about not finding that file so let's just run XD protect exe and see what happens looks like it is reading the file so that particular area is is fixed okay so here we had an issue it says out of memory and that is while creating the wct file which is for triggers so again that's going to be a bug in XD protect there must be something in the war 3map.j file that is malformed in some way so that XD protect crashes when it's trying to read it and that might be why I didn't find it the first time now this is probably okay because if we remember the trigger file is just so that the map editor can't show us visually what the triggers are but we already know that the war 3map.j is the only thing the game engine actually cares about and for these very complicated Maps you're not going to do the visual trigger editor anyways and if you were to ever hit save it's just going to replace the word3map.j with a compiled version of what we see visually XD protector in the past has simply made one single node in here and on the right side it wasn't even visual it was just the plain text so it's really done a poor job at resurrecting the visual triggers anyways so what I think we could do in this situation is just disable the restoring of the visual triggers in XD protect to remove the out of memory error and then we can just use the visual triggers from a base map file if we do that we'll have to remember we can never hit save in the world editor without corrupting our file the file will still work but the war 3map.j will be deleted so we'll just always remember to keep our own copy of the war 3map.j and edit it with our own tools like Visual Studio code and after World editor saves the map we'll want to copy in the War 3 map.j that we've been editing with the external tool so it's a little bit annoying it almost means the map's not fully protected because you can't hit save in World editor without ruining your triggers but the workaround to fix that is very simple it's just an extra step to remember so I think that will be fine in this case now if we wanted to take the time we could also debug the Perl script figure out why it's getting the out of memory error and fix that but that will have to wait for another day so I'm going to XD protect opening the ini and I'm going to look for where it's restoring the triggers so right here it says recover script create wtg wct files and enable additional options based on map scripts recovery so by looking at the command line I know it failed on the wtgwct files so I definitely want to disable the setting however I'm a little bit nervous about the additional options below that are enabled by this if I scroll down it has this rename reserved functions inline functions rename globals indent script so I think all of these will be disabled because we're not recovering the script most likely that'll be fine but there's a slight chance for example renaming the reserved functions by that not run running our map might not be protect fully without us fixing those by hand these others the inline functions globals and indent script probably don't matter the inline is very rarely going to cause a compiler error if it's not done and the renaming and indenting is just to make the script easier to read so I think we're probably fine with those turned off but I am a little bit nervous without recovering the script I don't think it'll be able to parse the W3 data and without parsing the W3 data I don't think it will recover the do file so if that happens we may need to actually figure out why it's getting the out of memory error and fix that so that it can recover correctly but let's just cross our fingers so I'll save this where it's not going to recover the script and I'll go back to my command line run XD protect hope that it gets past the out of memory error and it looks like it did but I know that because it has more than a thousand files the mpq file is going to be correct so I'm going to need to rerun sfmpq manually from the command line okay so back to the temp folder I'm going to delete the out mpq then I will go into the temp folder in the command line with the change directory command and then go into the files folder and I'll clear my screen with CLS just so I can see when I'm doing better I'll hit the up Arrow to get my original sfmpq command that I was using previously again we'll want to make sure we run it for both files since they both have content and we'll want to right click on files and do properties to get account to make sure we're doing it large enough so we're doing 8000 there are only 2 460 files so we should be fine I'll run it first for the list file now that it's ended I'll run it again for files.txt and now I'm going to look with a hex editor at the mpq file and the original w3x file so I can copy the 512 bytes header with my hex editor I'm going to open the original w3x and I instantly see that the hmw header is missing it only has the mpq so that's not going to help me so instead I'll open one of the other maps that I was deprotecting and I remember for example pest Invasion had that header so I'll copy this header it will give my map the wrong name and that's fine I can fix it in a world editor afterwards so edit block and chars 512 okay edit clipboard copy then with my other hex editor open in the temp folder for demonic sword out.mpq and edit clipboard paste file save as go up to my hacked folder and I'll call this demonic.w3x so let's see if this will open in the world editor pick demonic hit OK there's a chance there will be some other form of protection that we did not check for for example having a large number of regions but I generally don't look for every type of protection every time I just try to open it in the world editor and see what errors I get and only try to fix those particular ones so it looks like it failed because triggered data is missing or invalid and that makes perfect sense because we told XD protect not to recover the wct or wtg files so I'll hit OK I'm just going to copy them from the base map because we already discussed that if this trigger editor tab is missing the script it'll be fine I'll just remember whenever I save to get it from or3map.j but before I do that I will double check this file format and just look at those two files wtg says it's triggers wct also says it's trigger so I'm pretty confident it'll be fine to replace those with the base map file so I'll go to mpq master open my hacked copy of demonic I'll right click add file go to my base map folder and pick those two files and at the bottom it says two files added so I should be safe to reopen in the world editor the Demonic hacked map so uh it looks like the map loaded correctly all the environment Graphics are there let me go to module object editor all our units are pink meaning they've been modified from the defaults so it looks to me like a fully d protected map let's just try if I go into the trigger editor you'll see all these visual triggers they're completely wrong they're just the default and they're not going to match the actual code for demonic so I'll just delete the melee initialization visual trigger and I'll right click and make a new trigger but instead of a visual trigger I'm going to do a custom script so that I just get a plain text box and I'll try pasting in the code which was our war 3map.j file that we got from that unknown file I'll copy it and paste it in here I'm just curious if World editor can understand it when I hit save okay now it says it's going to generate start locations that has me a little bit nervous because that's one thing it probably misunderstood about the war 3map.j if we look at the base map file for war 3map.j here it has Define start location and it's inside of the config function I suspect in the War 3 map.j that we resurrected from the unknown file it's probably missing this call or it's missing a config function so let's just search and find it Ctrl f for find paste and Define start location it is here and it's actually even in a function called config so there's no reason that the world editor shouldn't have recognized this but there must be something in this file that's just slightly malformed which confused both XD protect and the world editor because remember XD protects got an out of memory error trying to analyze the script so really we should do some trial and error here to figure out what portion of the file is corrupted so that we can fix the out of memory error and that will probably also fix the world editor error and I would do that probably by highlighting large sections of code and deleting them to essentially make a simplified version of the script and do trial and error where I would run it against XD protect after each section has been deleted until the out of memory error goes away and then I would restore small sections at a time until the auto memory error comes back and that would help me narrow down what specific piece of the code is the issue and then from there I would figure out how to fix it but honestly I don't think it's worth messing with any of that because the truth is we don't want to use this trigger editor anyways it's only useful for very simple maps for someone that does not know proper coding and wants to use the visual tool in our case I'll just delete this script and restore the original visual script that we had and I'll just always remember anytime I save I need to take my external war 3map.j and paste it with mpq Master into my map before I run it so in that instance I would say this map is only 99 d protected but fixing that trigger issue is going to take a while of troubleshooting and it's probably just not worth the effort so I'm going to call that good enough and move on to our last map close this map don't save and let's do Twilight's Eve so I'll copy that and go into the XD protect folder delete demonic and be protected


and then I'll paste in Twilight's Eve copy the name of the map open my ini file paste in my new map name and I want to remember to undo the change I made earlier which was telling it not to recover the script because even though it failed for demonic there's a good chance it will work just fine for Twilight's Eve and we definitely want to try every type of deep protection possible and only disable the ones that are failing okay now I'll go back to my XD protect command line and run the program looks like it's extracting this one's taking a really long time there must be a lot of files but I guess that happened with DOTA and demonic as well a good clue if you're wondering is it working should I give up obviously if the program's acting responsive it's fine but in the case of world editor sometimes I thought it was unresponsive when it wasn't well just look at your file size if your map is 250 Megs that's a good indicator that it's going to take a long time so just be extra patient if it's a really long math file maybe go take a snack break in the kitchen and come back it looked like it finally finished so let's see how it did I don't see any specific errors but I suspect since there were more than a thousand files it did probably say it errored adding the files to the mpq but unfortunately that message only shows for a split second and disappears so I'll just assume I have to rerun that by hand so I'll close out of this go back to my temp folder delete my out mpq and then go into my temp folder in the command line into the files folder and then I'll hit the up Arrow to get my sfmpq command back and first let's just double check both files and list file have contents so we need to run it for both and if I do properties on files I have 2 400 files roughly so 8 000 should be plenty with my Dash M command so I'll hit enter and now that that's finished I'll do the same thing with list file.txt up Arrow list file enter now that that's finished we're going to need to copy the 512 bytes out of the header so I'll go to my hex editors and remember previously with demonic we copied in the header from pest Invasion so really in the world editor I should have gone into the map settings and fixed the name back to demonic but that's okay so let's close out of these files in the hex editor and open the out mpq from XD protect Temp and we know that should be missing the header but let's check if it was in the original Twilights w3x it looks like it's missing so again we're going to have to get it from pest Invasion or any other random map okay edit block and chars 512 okay edit clipboard copy switch to our out mpq edit clipboard paste file save as in the Hacked folder we'll call it Twilight w3x save now let's see if it will open in the world editor maybe we'll get lucky this time and there's no extra deep protections but I kind of doubt it it looks like it might be frozen on loading units I'm going to leave it running in the background but while it's running I'm just going to check for some common protection issues to try to multitask so if we go to the Twilights file let's first check the region file or three map dot w3r I thought but I don't even see it in here so let's check the base map files to see what files are even just missing okay yes it is called w3r I'm not sure why it's not here so that may be one thing we'll need to copy over it looks like the do file is there now we don't know if any of them are corrupted but at least we know it's there we already determined conversation Json is not needed it looks like both have a j file okay the world editor actually crashed with some kind of error so I have no idea what the cause of that was but at least we know the maps failing and we didn't just need to wait longer so I'll close this and I think since I already suspect the w3r has an issue I might just copy over the base map files one at a time until that error goes away but I'll keep a backup of the original so that way I can figure out which file is corrupt and go from there so I'll go to my hacked folder copy and paste Twilights to dash broken and in mpq master open the Twilight which we've hacked but it's still not working in the map editor and if we compare each of these files from left to right we can see that the base map files has a conversation Json a w3c and a w3r that are missing on the right side which was extracted from the Twilight map with XD protector but before we do a diff between each file to see what might be corrupt in the Twilight map let's first just add the missing files so I'll add those three to see if that fixes anything so in mpq master right click add file and in the folder that pops up I'll switch to base map files and pick those three files and hit OK we'll notice at the bottom it says three added zero replaced it wouldn't be important to monitor that replaced because if we accidentally replace the file that already existed we'd want to know that because it may have been a file that wasn't corrupt and we've now deleted the custom Twilight code since we took it from the base map so it's good we didn't replace anything let's open the Twilight and see if it loads this time because maybe those files being missing was the issue and I'll try to keep an eye on where it crashes because that might give a clue since last time the entire program just crashed so far it looks like it's somewhere inside of loading units but we'll see if it ever gets past this and I'll be patient because I know this is a big math but it does feel like it might possibly be frozen while I'm at it let's just look at those base map files to remember what they're used for so the region file since that's just the visual regions that later get converted to code inside of War 3map.j I don't think that file being missing in Twilight will hurt anything if I wanted to recover the original region I could open this kind of analyze the binary data inside of it I'd probably need to use a hex editor instead and then I could search the unknown files and see if there's any with a similar format and that's how we recovered the Jas file with the previous map but I don't think that's necessary for the region file since they probably just actually deleted it considering it's only needed by the world editor and not by the game itself and even without regions we can still edit the Jas file looks like World editor crashed again I'm curious about the wct file so I'm going to go back to the file format and I remember from the previous map it was a trigger file so again that one should be fine to get just from the base map it's a little strange though that the wtg I believe is also a trigger file and that one XD protector was able to recover considering these two kind of go hand in hand but that's okay since we're still crashing I'm going to assume that one of these files is corrupt inside of Twilight but I don't necessarily know which one it is so I'm going to now start replacing files and I'll keep a backup so maybe I'll rename this broken to Broken one and I'll make another copy of Twilight and call it broken two that way I have a history of each file that I replace as I'm testing so that if I get to a scenario where I fixed it I can kind of revert the changes I made to get to that point and make sure I only replace the files that I have to for example right now maybe I right click to add files and I'll just select all of them which I know is going to delete a lot of custom code out of Twilight and I just want to make sure that at least one of the files is the issue so now I'll launch in the editor and open Twilight and if this loads then I know for sure I can fix it by at least replacing one file but I don't necessarily know which file it was but a lot of trial and error is about narrowing down your problem as quick as possible and so where I've got 15 files here if I did them one at a time it's going to take a long time to test each one and what if none of them actually fixes it and I'm actually analyzing the wrong files and it's something else that's corrupt well that's where I in the beginning you want to start with big changes and keep a backup and then once you discover something that works narrow it down to a smaller change so maybe now I would go back to my previous backup and replace just the top five or six files and see if that fixes it if it does I know I've narrowed it down within that list if it doesn't I can skip down to the second group of six and then I can do the final few that are remaining so obviously it did open which is great so I'm going to close the map go back to Broken two delete this Twilight I'm working on that is fixed but missing a lot of code and I'll copy broken two back down to the original file I'm working with then an mpq master I will reopen so that it refreshes then I'll right click to add and this time I'll just pick a few of the files now it seems like it was crashing while it was loading units so my first suspicion is maybe this units.do and then my second guess might just be this regular do so maybe I'll start with both of those and see if that fixes it so I'll add them it says two were replaced now I'll reopen in World editor and if this fixes it then I might try each of those two files individually okay it looks like that did fix it but obviously because I replace those even though I still have the terrain I'm missing all of my units so let's close this and revert again to the broken two reload in mpq master and this time instead of replacing both of the do files I'll just do the units.do and let's reload in Warcraft My Hope Is this time at least maybe we'll have trees but not buildings and it looks like that is correct so now we have our trees and other random doodads but we are missing all the units that are placed down by default now I think that's just going to be a visual thing I believe the War 3 map.j still has the code to create the units but it's nice to be able to visualize it too I could be wrong on that so I would not call this a fully the protected map since those units are not rendering but it's close so what we'd want to do in this situation is go back to our Twilight files look at the War 3 map units.do and figure out what's wrong with it and then also go back to our XD protector ini and figure out what happened here so we have the setting turned on for build dummy do we have recover script we have parse data and we have build do so this should have recovered it however in the comment here it says so far only starting points so I suspect that this code was never finished and if we were to open the war 3map.j with Visual Studio code we could probably find code in here that creates the units during the config or startup and the ini says that it gets the starting point which comes from right here and puts them into the do file but it looks like it's unfinished code they did not script it to grab the units out of the Jas file and put them into the do file so this is a situation where someone's going to need to finish XD protector to add this additional feature to to remove this type of corruption and that's going to be out of the scope of this particular video but maybe I can do an update in the future when that code has been corrected so in this case I would still call it a mostly d protected map but what you'd want to do is any code changes you make when you go to test the map if the map is broken because the units are not displaying on the screen which I think will not be the case I think it'll still work but if it did you'd want to open an mpq Master the new map you saved with World editor and the old map that's still protected and you'd want to go to operation extract all with both of them and then do win merge and find out what changes you made intentionally in the world editor and copy over just those changes to the protected map and that should be a safe approach the other thing you could do is since we've replaced the do file for units in our map with a base map copy of the file there are no units anywhere on the screen if I simply click on the units I want and place them down then when I save I should have a valid do file the only problem is there's probably not supposed to be a peasant right here in the real map so I would actually want to open my Jas file read through it and figure out what those starting units are supposed to be and then intentionally pick the correct unit and put it in the right spot and then save it to get my do file so the best way to do that would be if I create a brand new map and I save it as no units and just so I don't have to use the mpq master to extract it I'm going to save it as a folder and I'll make a new folder called No units and save now if I go into that folder all the files are already extracted I prefer to use this method when I'm working on a map because then I can commit my map directly to GitHub with all of the files separate and it gives me a full history of every change I've made with each version of the map but now I'm going to add a single peasant somewhere file save map as one unit as a folder save and do a win merge between these two one unit w3x and no unit w3x okay so we can see that the w3i changed the blp changed the do changed and the J changed what I'm most curious about is the J because I suspect we should be able to parse the Jazz script to figure out which units have been added and use that to afterwards reconstruct the do file because I suspect that's what XD protect is doing for the starting unit locations so let's open up the J we see there's a section called Unit creations and it's calling blizzard create unit with skin and I imagine if we had multiple units then this same line would just be copied and pasted a bunch of times and it looks like it also has a section for buildings so let's see if we can find something like blizz create unit with skin inside of the Twilight War 3 map.j okay by searching for it there are a bunch here and the function names have really weird names so I suspect if we renamed these function to something like create units for player then if XD protect was coded to parse it correctly it could do it but remember this is something that XD protect was not even coded for so instead we would probably need to take these coordinates and these unit codes find them in the palette and find that exact coordinate and click it down and then save in order to get our do file hopefully there's not too many units that are created by default and we would want to be careful which functions we're doing this from because we only want to do it with ones that are part of the initialization code because there could be code that runs based on a specific event in the game like when you enter a specific region that's like a Coliseum or a Arena maybe it spawns a bunch of units that you have to kill we don't want something like that to be added to the do file because the do file is only the units that are created by default when the map first loads so you want to be careful for which functions you copy it from and you could determine that by taking this function name searching for it to see where it's used so here I see another weird function name which I'll want to copy but that's the only place that this function is called so then I just want to trace up the stack to see which function calls this parent function and again I got a weird function name but I suspect pretty soon I'll get to the top and it looks like I did it's from function main so this is definitely something that would run at startup and if it wasn't I would see something like Trigger action like this these are things that happen only on a specific event and so you'll see for the trigger right above it registered the event which is when a neutral player purchases an item so if this remove purchased item function was creating a unit that's not something we would want to add from the palette to get it saved into our do file because that's based on a specific event it's not the main function so really we just want to start with the main function go through all of these weird function names and trace the path down and find every unit that is created by code and add it directly with a palette and save so unfortunately that's a very manual process if there's enough interest I think it would definitely be valuable to modify the Perl script to parse this directly I don't know how difficult that would be but it'd be a fun exercise for the future so I apologize that this video was so long but I wanted to make sure I covered every possible the protection technique there may be some I missed so if you have a map that you cannot de-protect after following all the steps in this video please mention it in the comments and I will do my best to help you de-protect it and I think I'll call that a success with the Twilight map because it's as close as we can get with automated tools and we have a manual process for for the final piece I hope this video was helpful for you if you have any questions please write them in a comments and I'll see you in the next one

Popular posts from this blog

AoE4 Mod Tutorial: Making a Crafted Map in the Content Editor

TeamFightTactics - Rules & Strategy - Coding an AI - Part 2

Intro to JavaScript - Coding a TFT AI - Part 3