HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How does Wc3 checks if 2 maps are the same ?

12-04-2008, 02:19 PM#1
akolyt0r
Hey Folks,
i wondered how does Warcraft III detect that 2 maps are the same, and if not, issue the warcraft of a player with a different version of the map (but same filename obviously) to download the version the host has.
And how can you bypass this check, e.g. for a map in different laguages (like e.g DotA has ..i dont any other map yet) and be able to play together with this different versions ...(without dl the version host has).

Any Ideas ?
12-04-2008, 03:32 PM#2
TotallyAwesome
It's probably map's version number. Go to scenario > something and you'll see it. DotA uses a third party MPQ editor in order to get strings from other language imported, after the map is saved.
12-04-2008, 04:18 PM#3
akolyt0r
i dont think its so simple ..i cant access a warcraft III at the time ...
maybe tomorrow to check that..
but if it would be so simple there would probably be more maps with multiple languages like dota
12-04-2008, 04:46 PM#4
Ammorth
http://www.wc3campaigns.net/showthread.php?t=102381
12-04-2008, 07:43 PM#5
PitzerMike
Short answer: It uses a checksum.
12-04-2008, 09:49 PM#6
akolyt0r
dooh ..i am currently too drunk to gte any of that code 0.o..
mb tomoroow
eh ...and btw ..what languge is that ????
defiently not C++,C#,JASS ...mb Jvaa ? i dunno Java :(
12-04-2008, 11:05 PM#7
Bobo_The_Kodo
There is a way to get around the check, and modify a map while making wc think it is the same, to gain an advantage. Though I don't know how to do it
12-05-2008, 09:38 PM#8
akolyt0r
maybe somehow modify the checked files in a way that the checksum would still be the same ...

Still i dont get that checksum algorithm.
Somebody got it in a different language the VB maybe ?

The Code posted in the Thread Ammorth mentioned seems to use functions that are not in the standard libraries ...
Hidden information:

Public Function xorRotateStream(ByVal s As IO.Stream, Optional ByVal length As Integer = -1) As UInteger
If length = -1 Then length = CInt(s.Length)
Dim val As UInteger = 0
Dim r As New IO.BinaryReader(s)
For repeat As Integer = 1 To length - 3 Step 4
val = ShiftRotateLeft(val Xor r.ReadUInt32(), 3)
Next repeat
For repeat As Integer = 1 To length Mod 4
val = ShiftRotateLeft(val Xor CUInt(r.ReadByte()), 3)
Next repeat
Return val
End Function

Public Function xorRotateMap(ByVal mpqa As MPQ.Archive) As UInteger
Dim val As UInteger = 0
Dim backupMPQA As New MPQ.Archive(My.Settings.war3path + "Copy of War3Patch.mpq")

Dim ssj() As String = {"Scripts\common.j", "Scripts\blizzard.j"}
For Each s As String In ssj
Dim f As MPQ.FileStream
If mpqa.hashTable.contains(s) Then
f = New MPQ.FileStream(mpqa, s)
Else
f = New MPQ.FileStream(backupMPQA, s)
End If
val = val Xor xorRotateStream(f)
Next s
val = ShiftRotateLeft(val, 3)
val = ShiftRotateLeft(val Xor CUInt(&H3F1379E), 3)

Dim ss() As String = {"war3map.j", "scripts\war3map.j", "war3map.w3e", "war3map.wpm", "war3map.doo", "war3map.w3u", "war3map.w3b", "war3map.w3d", "war3map.w3a", "war3map.w3q"}
For Each s As String In ss
If mpqa.hashTable.contains(s) Then
Dim f As New MPQ.FileStream(mpqa, s)
val = ShiftRotateLeft(val Xor xorRotateStream(f), 3)
f.Close()
End If
Next s

Return val
End Function

e.g. ShiftRotateLeft ...what does it do ?
takes a bit and inserts it 3 bits to the left ?!
Problem is i cant read VB properly...
Someone can write it c++ ...or in a more readable way ..(dont has to be real code ...german word for that is "Pseudocode" dunno in english xD)
12-08-2008, 05:37 PM#9
akolyt0r
hmpf...
Does ShiftRotateLeft(SomeBit Sequence,3) something like:
01011101 => 11101010
or maybe vice versa ?:
01011101 => 10101011

hmpf Strilancs code is not documented :/ and it totally seems to miss the context..
12-10-2008, 09:00 PM#10
Karawasa
Agreed with the OP that some explanation would be nice. I too would be interested in learning how to host multiple language versions that do not conflict.

If all else fails OP I will just ask Icefrog on AIM sometime...
12-11-2008, 03:47 PM#11
Karawasa
@OP: Talked with Icefrog, he said he would email me directions when he gets a chance. It has something to do with strings in .txt and not in .w3a, but I'll know more when I get the email.
12-11-2008, 05:11 PM#12
akolyt0r
well it seems like the strings in *.txt files are not checked to check if maps are same ...at least in the ghost++ script of Strilancs code they arent ..