wurstscript / WurstScript

Programming language and toolkit to create Warcraft III Maps
https://wurstlang.org
Apache License 2.0
224 stars 30 forks source link

Map version check in RunMap can fail #543

Closed muzzel closed 7 years ago

muzzel commented 7 years ago

The detection of warcraft3 version 1.27 or lower in WurstScript/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/RunMap.java fails in some cases. If the user has installed version 1.28 directly (not upgraded from a previous version) the file "BlizzardPrepatch.exe" does not exist, which causes WurstScript to assume <=1.27 is installed.

// 1.27 and lower compat
        if (!(new File(wc3Path, "BlizzardPrepatch.exe")).exists()) {
            print("Version 1.27 or lower detected, changing file location");
            documentPath = wc3Path;
        }

Workaround: create an empty textfile in the wc3 directory and rename it to "BlizzardPrepatch.exe".

Frotty commented 7 years ago

Yes, suggest a better way to detect game version?

I suppose the user could be asked, but he also might not know.

muzzel commented 7 years ago

There is a textfile with the changelog in the wc3 directory, Release Notes.txt. For each patch it contains a line "Patch ", ordered so that newer patches are on the top. You could use a regex to find the first of those lines and extract the version number.

For me, the document looks like this:

--------------------------------------------------------------------------
  WARCRAFT III: THE FROZEN THRONE VERSION HISTORY
--------------------------------------------------------------------------

--------------------------------------------------------------------------
Patch 1.28a
--------------------------------------------------------------------------

Specific Changes & Improvements
- Added view options: windowed fullscreen (default), windowed (-window), and native fullscreen (-nativefullscr)
- Added cursor clamping in game while windowed; unclamped in menus
- Data migration now removes the need to run as admin to access saved games
- Improved installation and patching performance

Bug Fixes
- Fixed WorldEdit to include proper icon and strings for Map Script Validation
- Fixed command cards to be hidden again with special coordinates (0, -11) and (-2147483648, 
  -2147483648) within CommandFunc.txt; invalid coordinates will now be ignored
- Fixed disconnects from Battle.net at the conclusion of games
- Fixed the cinematic player to keep the entire video on screen at whatever resolution
- Fixed an issue that prevented Windows GameDVR from functioning properly
- Fixed various bugs and exploits

Known Issues
- Players must run as admin during patching process

--------------------------------------------------------------------------
Patch 1.27b
--------------------------------------------------------------------------

Specific Changes & Improvements
  - Bug fixes and general maintenance

--------------------------------------------------------------------------
Patch 1.27
--------------------------------------------------------------------------

Specific Changes & Improvements
- Throw away that old PowerPC Mac in the closet, we’ve created a new installer to support Mac 10.10 and 10.11 

etc...

Frotty commented 7 years ago

Interesting idea, but it seems like the name changed from "Patch.txt" till 1.27 to "Release Notes.txt" with 1.28+

Taking that into account it should cover most cases.