ver. 16 crashes when loading sprites from ShoeBox...

Previous topic - Next topic

dreamerman

Hi, unfortunatelly during final release tests of my project I encoutered serious bug in Steam version v16.
Trying to load sprite larger than 128px from shoebox will fail with fatal error like this:
Code (glbasic) Select
Error: 3. Not a JPEG file: starts with 0x02 0x00
This wasted me couple of hours figuring what's wrong with my game, as that info is outputted in stderr stream so wont appear in editor, and I forgot to include stderr in *bat file for outputting stdout..
Problem appears in v16 (Steam version), I checked and v15 ofc is working properly.
Simple project to show the issue. Baisically put larger sprite like 1024x1024px in shoebox then:
Code (glbasic) Select
SETSHOEBOX "Media.sbx", ""
LOADSPRITE "sprite.png", 0

Will crash app... Hope that this will be an easy fix ;-)

Check my source code editor for GLBasic - link Update: 20.04.2020

spacefractal

Android? or Windows?

none 24png files might crash for some reasons, which is why im allways uses full png with alpha with png files.

Its works here on Windows, if you uncomment SETCURRENTDIR("Media")

On Android, you cannot load png and jpg on android 5 and lower.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

dreamerman

Windows 7.. same code, GLB v16 - Steam crashes, older standalone v15 works without problems.. 32bit PNG images.. will check on Win 10 laptop later, and with other png depths..
That's it if You uncomment SETCURRENTDIR than LoadSprites first goes to Media dir and load sprites from that location, not from ShoeBox, loading normal files is ofc ok, but loading from Shoebox fails.

Edit: reuploaded with 32bit png's and it crashes as mentioned above on my machine, only happens with Steam version, don't have previous v16 backups before updates so can't tell if it;s something new or what.
Check my source code editor for GLBasic - link Update: 20.04.2020

spacefractal

doh, im was testing without using shoebox. testing later. your files was not in the showbox
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

dreamerman

File is in the shoebox, as I said, same code, same shoebox file: compiled with GLB v16 doesn't work, but compiled with v15 work without problems. Host OS not important, same results on win7 and win10.
Maybe some compression code for unpacking shoebox files was changed or something.. other thing is that shoebox tool from v16 makes a little different file than v15, image packing is same, differences only aplies to *wav files, difference in size in negligible (literally few bytes per file or something).
To get that error just compile with v16, and run that bat file that's in 'shoebox_bug.app' directory. Don't know if that's some internal GLB error or image processing library dependend.
Check my source code editor for GLBasic - link Update: 20.04.2020

spacefractal

#5
im confirm. Can you check if its happens with other formats as well (jpg and bmp). Im do confirm the issue.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

dreamerman

As this problem is still an issue..
Anyone tried to implement zip/7z or some other compression libraries? Mostly to protect graphic assets, so they can't be easy copied, or maybe some other encoding functions?

Check my source code editor for GLBasic - link Update: 20.04.2020

Qedo

hi,
here, win10 steam version, don't work with any size, crash also with 64px.
ad maiora

Kitty Hello

Shoebox compression is totally broken. I'm trying to fix, but I think I will have to reimplement another compression library, making your old sbx files broken. I'll add a header to give you a warning.
I'm sorry. This is a lot of work and I hope to find time for it, soon. I spend a few hours just to track the bug...

dreamerman

Generally do what's best in Your opinion, will it be fixing Shoebox or adding some other lib to pack media files into one, it's irrelevant, just that it would work and hopefully it would be cross-platform. Repacking all packed media files is not an issue, I always do it before building 'release' version of projects.

Thanks for looking at this issue and fixing it mostly, I checked new beta (ver 16.833) and most files are packed/loaded properly but there is a new problem: Shoebox app (that packer) has some issues with 24bit depth PNG files, it crashes when I try to pack folder with such files, even if that's only file in directory. Whats more interesting it looks like 8bit PNG or 24bit BMP images doesn't cause such issue. Hopefully this little issue would be fast to track and fix :-)

Check my source code editor for GLBasic - link Update: 20.04.2020

Kitty Hello


dreamerman

I checked latest beta and this problem still appears, but now after some test I'm not sure if it's bit depth dependent or it's caused by something else. Simplest way it would be to test ShoeBox packer on attached files:
- base file is bitmap font (24bit PNG) from DingsFont tool, it will cause error,
- black image sized same as above file, saved/exported from Gimp 24bit PNG, will cause error,
- same black image but saved from Paint.Net, wont raise the error,
I hope that this will help somewhat to find the issue, if You prefer You can send me only 'ShoeBox.exe', as there is no need to do all those Steam app update stuff before it's fixed.
Check my source code editor for GLBasic - link Update: 20.04.2020

Kitty Hello

The packing was broken. Packed content was longer than the original -> buffer overflow. Get the new beta, it's fixed.

dreamerman

Checked on normal game projects, packing&loading images/audio works fine, no issues, later I will double check on my re-uploaded Steam game, but looks that everything is working as it should.
Thanks for fixing this bug  :)

btw. interesting is that new ShoeBox packer takes much longer to pack files, previously it was ~2seconds for 20MB media file, now it takes around 40seconds, final file is little bigger but as it's working it's not an issue. Thanks again ;)
Check my source code editor for GLBasic - link Update: 20.04.2020