GothicKit / ZenKit

A re-implementation of file formats used by the early 2000's ZenGin
http://zk.gothickit.dev/
MIT License
49 stars 9 forks source link

`Vfs::child` : Name comparison fails due to extra whitespace #75

Closed thokkat closed 1 year ago

thokkat commented 1 year ago

Old german mod Karibik has the world PINTA_GANG.ZEN but the corresponding trigger_change_level has attribute level_name="PINTA_GANG.ZEN " with a trailing whitespace. When triggered in OpenGothic loading does not work because the extra whitespace makes the equality check fail in Vfs::child.

Original Gothic works so it seems whitespaces are ignored there.

lmichaelis commented 1 year ago

Yes, that would be correct. Gothic has its own hand-rolled file path parsing implementation which fully parses paths passed into it and re-creates them again before opening a file. Potential fix: in VfsNode::child and VfsNode::remove, trim trailing whitespace from name.

lmichaelis commented 1 year ago

Could you verify if 9e8458ed fixes this issue, please?

Elgcahlxukuth commented 1 year ago

Not sure if this is the same bug, but I just noticed the file "OWFIREDRAGON VOLCANO_03-C.TEX" (contains space character) would not be found within my "Textures.vdf" archive of Gothic 2 NOTR, even though the file is there. Using find() method of Vfs class.

lmichaelis commented 1 year ago

Not sure if this is the same bug, but I just noticed the file "OWFIREDRAGON VOLCANO_03-C.TEX" (contains space character) would not be found within my "Textures.vdf" archive of Gothic 2 NOTR, even though the file is there. Using find() method of Vfs class.

That is indeed not the same issue. A quick check reveals that the name is cut off and not actually stored in the Vfs: image

Elgcahlxukuth commented 1 year ago

Not sure if this is the same bug, but I just noticed the file "OWFIREDRAGON VOLCANO_03-C.TEX" (contains space character) would not be found within my "Textures.vdf" archive of Gothic 2 NOTR, even though the file is there. Using find() method of Vfs class.

That is indeed not the same issue. A quick check reveals that the name is cut off and not actually stored in the Vfs: image

Ok. Anyhow, I found it :D I can raise another ticket, if it helps ;)

thokkat commented 1 year ago

Issue is gone, thanks.