HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

war3map.j Requirements

12-12-2002, 06:57 PM#1
Extrarius
I'm workingon a program that will obfusate the war3map.j file, but I'm running into a lot of difficulty. They first thing I made the program do was strip out all comments (defined as from a // to the end of a line), but when I do that, warcraft 3 will no longer load the map and declares the war3map.j file invalid. I also made my program turn multiple spaces into a single space, and made it eliminate blank lines. Doing any one of those three steps causes warcraft 3 to declare the file corrupt. I also made it change the names of all functions & variables declared in the file to O1, O2, O3 etc, and then replace all references to the function name with the new name, except for the main function and the config function. The same error occurs when only that step is done - warcraft 3 declares the file invalid.

I can't figure out why doing any of those things(stripping comments, extra spaces, extra newlines, and renaming functions) to the war3map.j file corrupts it. Any ideas?
12-12-2002, 07:05 PM#2
Guest
I'm not sure about that. Unfortunately my knowledge of JASS extends only to AI, though I plan on expanding that before long.

Just a question to satisfy my own curiosity: How come you're stripping the comments and such from the file?
12-12-2002, 07:23 PM#3
Extrarius
Its going to be part of my map protector, to make it harder to edit the jass file manually (stripping all that stuff makes it look ugly, and if all the functions/variables are called like O34598743987 and O4523947987 its going to be hard to tell them appart unless you rename them all yourself, and you'll have to figure out what they do before u can give them meaningfull names, so it will take a lot more work than normally needed to edit the jass file)

Its really the last thing that I need for my protector, I already have the standard protection methods coded and it already has support for encrypting a backup inside the map and decrypting it if you give it the right password.
12-12-2002, 08:18 PM#4
Guest
Ahh, good idea. Wish I could help you out :bgrun:
12-12-2002, 08:50 PM#5
AIAndy
It may be that some of the function names and even parameters are checked by War3. Zalamander told me that when he tried to add additional parameters to SingleMeleeAttack in common.ai, War3 crashed. I have not tested that yet, so I cannot verify it.

Did you try to remove some comments or newlines manually to verify that your program is working correct ?
Same with function and variable names.
12-12-2002, 09:10 PM#6
Extrarius
I figured it out - the (attributes) file in the map stores a checksum to detect any changes in the jass script, and deleting it fixes the problem.
12-13-2002, 12:35 PM#7
Guest
no thanks ;)

Keep up the good work. Bit of a shame that other thread got deleted somehow. Never read your answer.
12-13-2002, 10:09 PM#8
SuperIKI
Just wanted to say that I'm currently working on a similar program to obfuscate JASS.
It's written in Java. It has the functiononality that your protector has and it adds additional lines of code that will never be executed and some functions that are never used. This way the code will be completely unreadable.
How far is your JASS protector and do you release it as a single program? I would appreciate that.
And what language is it written in?

BTW: What attribute file contains the checksum?
12-13-2002, 11:51 PM#9
Extrarius
The file is called "(attributes)" without the quotes and its in the w3m.

The jass obfuscator is just one small part of my map protector, and it isnt available as an individual feature. With my program, you can protect or unprotect your map, and the only control you have over the process is the password to protect it with. If you fail to specify a password, no backup is stored and the map is permanently protected.

My program doesn't actually add code, it just changes variable names and function names to have no meaning (it converts them to O followed by a random number).

I was planning on releaseing it soon(sometime tommorow), but I would love to see the algorithm you use to create extra code to insert into the map and possibly integrate that into my program. Do you have an ICQ # so we could talk about it in realtime?

Its written entirely in C/C++ with no use of MFC, .NET, etc. Just plain old WinAPI and a few 3rd party libraries for the encryption and MPQ management.
12-14-2002, 10:51 AM#10
SuperIKI
Could you PLEASE release your JASS protector as a standalone open source program?
OK, I know that going open source is a hard step, but please do it.

For the code to add stuff: I have written it before, but not for JASS but for JavaScript. It was written in JavaScript to protect JavaScript, since in JavaScript you have the same problems like in JASS: It's open for everybody.
But I didn't have that much time to fully convert it to Java to crypt the JASS file. I'm rather busy right now. At the moment my program doesn't do much beyond yours.

By the way, I see a problem with your protector.
Do you know this JASS function:
Code:
native ExecuteFunc takes string funcName returns nothing
Your protector screws all triggers that use this.

As a last line I want to repeat my begging for a open source release of your code. This won't harm you. It'll only make you many new friends. Please think about it.
12-14-2002, 07:44 PM#11
Extrarius
It replaces every occuirence of the function name in the file, even if its in quotes. If you use variables and do something like "VariableFunc"+I2S(a) then that might cause problems, But you could instead do something like make an array of all the different functions like VarFunc[1] = "TestFunc" VarFunc[2] = "Blah" and then my program would see the full function name and replace it properly.

I'm definitely not going open source with the first version because my code is atrocious. I'm really an old school C coder, and I'm trying to change to hungarian notation, and lets just say its ugly having 10 different naming styles in 1 program =-)
Plus the code is a real mess, I really need to clean it up if I'm going to release the code, and, well, thats a lot of work and I'm lazy =-).

I wouldn't mind discussing with you how I did things, which would probably be more educational than just staring at my source anyways.
12-15-2002, 08:19 AM#12
Extrarius
In case anybody missed the thread in the editing forum, beta v0.1.0.1 has been released and you can get it at http://extprotect.psychosanity.com