speige / WC3MapDeprotector

Warcraft 3 Custom Map deprotector
https://www.youtube.com/@ai-gamer
MIT License
21 stars 3 forks source link

[Bug] Endless loop #18

Closed kmlkmljkl2 closed 9 months ago

kmlkmljkl2 commented 9 months ago

You've helped me previously with this map in the YouTube comments but the deprotecter doesnt seem to be able to tackle it yet. Its not the missing 2 methods mentioned in https://github.com/speige/WC3MapDeprotector/issues/4 we dont get that far.

Map: FOA S3 Rebirth v1.1b.w3x (https://www.epicwar.com/maps/331384/)

Left it running for 40 minutes and came to the conclusion that its an endless loop. Default settings (nothing checked) and latest code from master was used. (in Debug mode)

Stuck at function: Deprotector.cs protected List<string> ScanTextForPotentialUnknownFileNames(string text, List<string> unknownFileExtensions)

 foreach (var entry in strings.ToList())
 {
     var directory = Path.GetDirectoryName(entry) ?? "";
     string multipleExtensions = entry;
     string lastValue;
     do
     {
         lastValue = multipleExtensions;
         multipleExtensions = Path.Combine(directory, Path.GetFileNameWithoutExtension(lastValue));
         strings.Add(multipleExtensions);
     } while (multipleExtensions != lastValue);
 }

It keeps iterating the same hash with "\\." and without.

Disclaimer: It takes 10 minutes for me to reach that point with a workstation PC.

speige commented 9 months ago

Thanks for the bug report, I'll get this fixed.

The master branch is kind of like an unstable nightly build. (I've been too lazy to create feature branches since I'm the only one working on this right now)

If you look here https://github.com/speige/WC3MapDeprotector/releases you'll see the latest is 1.1.1.0. That will be the most stable. There's a corresponding tag v1.1.1.0 that you can checkout, instead of master.

kmlkmljkl2 commented 9 months ago

I noticed that there was a recent push adding new seperators. I now tried with the old ones:

var nonVisibleCharacters = Enumerable.Range((int)'\0', (int)' ' - (int)'\0').Concat(Enumerable.Range(127, 256 - 127)).Select(x => (char)x).ToList();
var separators = (new char[] { '\'', ';', ',', '|', '=', '[', ']', '{', '}', '(', ')', ' ', '\t', '\r', '\n', '"' }).Concat(nonVisibleCharacters).Distinct().ToArray();

same issue

Will try the release and update

kmlkmljkl2 commented 9 months ago

The relase version 1.1.1.0 does not get stuck and managed to somewhat deprotect the map. Opening the map editor I get the somewhat funny error "could not load .mdl.mdl"

And ingame I dont have spells. It seems to find more textures by default than X-Deprotect.

speige commented 9 months ago

I've seen those weird "could not load .mdl.mdl" errors before as well. I think it's related to unknown files. I'm working on improving that.

As far as "ingame I don't have spells", I don't have time right now to research map-specific bugs. Deprotection is not perfect, so you will need to fix those types of issues on your own.

If you can find a bug that's consistent for all deprotected maps, then I'm happy to investigate. For example, if all deprotected maps are missing spells.

Glad it found more textures than x-deprotect :)

speige commented 9 months ago

Fixed in 7daa2f8 will release new version soon