Author Topic: CUSTOM SHOEBOX  (Read 848 times)

Offline Qedo

  • Dr. Type
  • ****
  • Posts: 351
  • to program what I have todo how should I program?
    • View Profile
CUSTOM SHOEBOX
« on: 2021-Mar-29 »
at dreamerman (as promised in another thread) and at all interested friends:
a bit for fun and also because lately shoebox on the steam version was not working correctly (solved with beta version), I wrote my version.
Written in pure GLBasic it should work on more systems but I only tried it with win10. I'm curious if it also works on Android but to date I haven't been able to get Android Studio to work.
If anyone willing will do it I would be grateful.
By the way, is there a tutorial to use this damn AS?
Some information on the composition of the shoebox.sbx file compressed as png can be found in the sources.
I had to write custom functions for each native command that uses shoebox like LOADSPRITE LOADSOUND etc.
In practice, excluding LOADSPRITE which uses the MEM2SPRITE function for the other commands, unfortunately you have to save the file image to disk and then load it in the traditional way, and despite everything the saving / loading / execution speed remains at decent levels.
If you like, let me know your impressions.
the BUILDSHOEBOX project creates the shoebox.sbx file while USESHOEBOX is an example of how to use it.
ad maiora

Offline SnooPI

  • Dr. Type
  • ****
  • Posts: 415
    • View Profile
Re: CUSTOM SHOEBOX
« Reply #1 on: 2021-Mar-31 »
I had coded a similar style routine for my MJPEG encoder/decoder but yours is much more finalized.
It's really ingenious and even if the Shoebox function bug is fixed in the beta version, still very useful.

Unfortunately I don't do Android anymore at the moment, I should come back to it (I still haven't used AS  :()

Very good work Qedo  :good:

Offline Qedo

  • Dr. Type
  • ****
  • Posts: 351
  • to program what I have todo how should I program?
    • View Profile
Re: CUSTOM SHOEBOX
« Reply #2 on: 2021-Apr-12 »
Thank you SnooPI.
Has anyone tried it on Android?

Offline dreamerman

  • Global Moderator
  • Dr. Type
  • *******
  • Posts: 401
    • View Profile
    • my personal website
Re: CUSTOM SHOEBOX
« Reply #3 on: 2021-Oct-21 »
Very nice project, due to previous bugs with GLB shoebox I was looking for possibility to use it in next project, but main issue was that for sound/music it needed to save files on device and was opening them in standard way, so it makes loading times longer when there are many media files :/ (i was afraid specially about Android) And im also not sure how loading from custom shoebox and using Mem2Sprite would compare in terms of speed to normal shoebox. But nevertheless I looked even deeper, in SDL docs you can find function that creates sound/music objects from memory (like Mem2Sprite), but that isn't well documented if I remember correctly so that would be more tricky to do it in GLB. Beside all this it was very promising, and could be even better if additional files encryption could be used apart compressing them as PNG, some kind of password system or byte checks when uncompressing.
Thing about compression, there is minimal zlib.dll version that contains only basic functions for dictionary base compression, curious how this would compare to 'compress as PNG' method. Years ago I made some kind of LZ77/dictionary encoder in FreeBasic, wasn't so good as zlib but still it was only pure Basic code, maybe time to rewrite it in GLB just for fun.
But now with this load data from memory hack you can rework your shoebox to use this trick and that would be awesome, another possible way of protecting/packing files, I would like to see direct comparison to standard shoebox in some game project.
I also don't have AndroidStudio installed currently :D so can't test it that way..

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