Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Modloader can not coop with capital letters in v0.9.1 #172

Closed
Taludas opened this issue Nov 2, 2022 · 1 comment
Closed

Modloader can not coop with capital letters in v0.9.1 #172

Taludas opened this issue Nov 2, 2022 · 1 comment

Comments

@Taludas
Copy link

Taludas commented Nov 2, 2022

Every file associated with a capital letter leeds to the modloader not recognising it.
Tested mods: Halloween Ornaments Pack By Ricky and me, and Industrialized low tier productions by lordys.

File structure with vanilla downloaded mods:
capital letters iltp
With low tier productions mod, there are several texture files named with file extension .DDS instead of .dds
This leads to invisibility of the corresponding parts of the buildings in game:
bug industiraliezed low tier
The cfg et al. files of the advanced sausages factory is named "sausages_II.*" with two capital Is. This leads to the typical warning in game "cannot be build" whcih happens when the ifo file is missing.

After renaming the Sausage Factory and re-exporting the dds files from gimp, everything worked as expected:
after renaming everything to small letters

Same issue with the Halloween pack. The marketplace skin is stored in a folder named "halloween_MARKETPLACE" with capital letters. This leads to invisibility after changing the skin from the normal marketplace to halloween skin:
bug market

After renaming to "halloween_marketplace" everything worked as expected. So image above for reference.

This issue only effects v0.9.1!!! I tested everything with v0.9.0 and the capital letters were no problem at all.

Capital letters seam to be no problem in the Title of the mod-folder inside "Anno 1800/mods".

This is the fixed version of the two mods for reference.
[Ornamental] Halloween Decorations_fixed.zip
[Gameplay] Industrialized Low Tier Production_fixed.zip

@Shad0wlife
Copy link

Shad0wlife commented Nov 3, 2022

I dug around the code a bit, and I think there are only two options where the file itself is accessed in some way.

Either in external-file-loader.cc when the Files get opened with CreateFileW (Either in ReadGameFile or ReadFileFromContainer), or while they are discovered with fs::recursive_directory_iterator in mod.cc

Now, there are some more options where the file loading could fail:

  1. fs::recursive_directory_iterator doesn't find the file (HIGHLY unlikely)
  2. The "game_path" of the file is stored with the uppercase letters, the game requests the file with lowercase letters (either by default or because the path from eg. the .cfg or asset or so is lowercase) and the check if a modded file of that name exists (also during ReadGameFile or ReadFileFromContainer) then is case sensitive and doesn't find anything.
  3. the file path was turned to lowercase during discovery or during parsing to canonical form, and CreateFileW is case sensitive and doesn't find the file anymore.

Personally I guess it's either 2 or 3, but what's confusing for me is that the corresponding code hasn't been changed since 0.9.0... so IF it's actually from one of those, the issue is a regression introduced eg. with dependency updates. And that could actually be, as https://github.com/microsoft/wil got updated, and there were changes to filesystem.h. in there. And those changes actually affect path stuff since an import for pathcch.h got removed there. EDIT: The import got moved, not removed. Oops.

@xforce xforce closed this as completed in c6dfcb6 Nov 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants