GLBasic forum

Main forum => Bug Reports => Topic started by: dreamerman on 2020-Apr-28

Title: ver. 16 crashes when loading sprites from ShoeBox...
Post by: dreamerman on 2020-Apr-28
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 ;-)

Title: Re: ver. 16 crashes when loading sprites from ShoeBox...
Post by: spacefractal on 2020-Apr-28
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.
Title: Re: ver. 16 crashes when loading sprites from ShoeBox...
Post by: dreamerman on 2020-Apr-28
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.
Title: Re: ver. 16 crashes when loading sprites from ShoeBox...
Post by: spacefractal on 2020-Apr-28
doh, im was testing without using shoebox. testing later. your files was not in the showbox
Title: Re: ver. 16 crashes when loading sprites from ShoeBox...
Post by: dreamerman on 2020-Apr-28
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.
Title: Re: ver. 16 crashes when loading sprites from ShoeBox...
Post by: spacefractal on 2020-Apr-28
im confirm. Can you check if its happens with other formats as well (jpg and bmp). Im do confirm the issue.
Title: Re: ver. 16 crashes when loading sprites from ShoeBox...
Post by: dreamerman on 2020-Aug-03
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?

Title: Re: ver. 16 crashes when loading sprites from ShoeBox...
Post by: Qedo on 2021-Mar-09
hi,
here, win10 steam version, don't work with any size, crash also with 64px.
ad maiora
Title: Re: ver. 16 crashes when loading sprites from ShoeBox...
Post by: Kitty Hello on 2021-Mar-13
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...
Title: Re: ver. 16 crashes when loading sprites from ShoeBox...
Post by: dreamerman on 2021-Mar-14
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 :-)

Title: Re: ver. 16 crashes when loading sprites from ShoeBox...
Post by: Kitty Hello on 2021-Mar-15
Fixed in current beta. Can you try?
Title: Re: ver. 16 crashes when loading sprites from ShoeBox...
Post by: dreamerman on 2021-Mar-15
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.
Title: Re: ver. 16 crashes when loading sprites from ShoeBox...
Post by: Kitty Hello on 2021-Mar-16
The packing was broken. Packed content was longer than the original -> buffer overflow. Get the new beta, it's fixed.
Title: Re: ver. 16 crashes when loading sprites from ShoeBox...
Post by: dreamerman on 2021-Mar-16
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 ;)