garcia / simfile

A modern simfile parsing & editing library for Python 3
MIT License
62 stars 7 forks source link

Asset discovery does not take image dimensions into account #46

Open som1sezhi opened 5 months ago

som1sezhi commented 5 months ago

After looking at filename hints, if some assets are still not found yet, StepMania will look at the dimensions of the remaining images to try to match them to the remaining asset fields; see TidyUpData() in Song.cpp for the exact behavior.

Currently, simfile.assets.Assets does not look at image dimensions, leading to some assets not being found when they should be. For example, Assets fails to find the banner for ITL Online 2023/[10] SUPERHERO [SX], since the simfile #BANNER field is blank and the banner's filename is bn-superhero.png, which does not match any of the known banner filename patterns. However, the image's dimensions are 832x328, which matches this condition that allows StepMania to detect it as a banner.

As an aside, in response to this comment, I believe this behavior is why StepMania is able to find banners named bn.png, even though that name doesn't match any of the banner filename patterns. It's just that the images themselves have the right dimensions to be picked up as banners by the game.

garcia commented 5 months ago

What a nightmare of a computer program I've decided to emulate! Thank you so much for figuring this out. I'll take a look at adding this to the 3.0 release.