GLBasic forum

Main forum => Bug Reports => Topic started by: adaz on 2014-Jun-17

Title: GETFILE does not work with shoebox
Post by: adaz on 2014-Jun-17
test.sbx contains a file: test.txt
test.txt contains 20 lines of text

Code (glbasic) Select

SETSHOEBOX "test.sbx",""

GETFILE "test.txt", 0, a$
PRINT a$,0,200
//correctly displays line 0 of test.txt

GETFILE "test.txt", 1, a$
PRINT a$,0,250
//displays: "NO_DATA"


The above code works when I don't use shoebox.
V12.096
Title: Re: GETFILE does not work with shoebox
Post by: MrTAToad on 2014-Jun-17
Thats right - most of the file commands dont.
Title: Re: GETFILE does not work with shoebox
Post by: adaz on 2014-Jun-17
Quote from: MrTAToad on 2014-Jun-17
Thats right - most of the file commands dont.

And now? This is the "solution"? It would have been the last step to finish my iPhone game, and create my level packs. Great.
I can only hope that Gernot knows about this bug, and he will fix it soon. I don't know of any other solution to pack different kind of files into one.

Thanks
Title: Re: GETFILE does not work with shoebox
Post by: kanonet on 2014-Jun-17
I dont think its a bug, at least it have been always known that shoebox can only be used together with media files etc. - on the other had the helpfile clearly states GETFILE is one of the few commands that do work with shoebox (you line 0 works as you said). So bug or error in the help file?

If you want hide your data from the user, you could instead use ENCRYPT and DECRYPT to be a but saver.
Title: Re: GETFILE does not work with shoebox
Post by: adaz on 2014-Jun-17
Thanks, I already use encrypt, but I wanted to protect my level map data with the necessary image files in one big file. So this is impossible because of some bugs.

If there was some kind of multiplatform (un)zip/rar etc. packer (with password support) we could use in GLB, that'd be marvelous!

Adaz
Title: Re: GETFILE does not work with shoebox
Post by: MrTAToad on 2014-Jun-17
It was mentioned ages ago, but there are no plans to allow I/O commands to access shoeboxed data.
Title: Re: GETFILE does not work with shoebox
Post by: kanonet on 2014-Jun-18
Since SHOEBOX works with sprites etc. and just not with your text file, you could simply pack all sprites etc. into the shoebox and only leave your text file outside and store it encrypted instead. Or even cooler, you convert your data in a way so that you can store it in an integer array - then you can save this array with MEM2SPRITE as PNG and load it with LOADMEMSPRITE from the shoebox.
Title: Re: GETFILE does not work with shoebox
Post by: matchy on 2014-Jun-18
Quote from: adaz on 2014-Jun-17
If there was some kind of multiplatform (un)zip/rar etc. packer (with password support) we could use in GLB, that'd be marvelous!

The SHELL command can issue a bat/bash script, such as a zip command line or any other alternative encrypt-er/packager/application.

Title: Re: GETFILE does not work with shoebox
Post by: spacefractal on 2014-Jun-18
http://www.glbasic.com/forum/index.php?topic=7639.0 can do the trick, by convert the tile data format to a png file? Im have not tested this one, but its one of the clever way to store data into a png file.
Title: Re: GETFILE does not work with shoebox
Post by: kanonet on 2014-Jun-19
Yes Spacefractal that is what I was meaning, Wampus just had an awesome idea,that we can use to store any data in a SHOEBOX.
Title: Re: GETFILE does not work with shoebox
Post by: adaz on 2014-Jun-24
I just tried to store a simple JPG in shoebox, but it cannot be read back! Error:3 (not found)
PNG and BMP work, but I cannot read jpg's from it...
Very annoying, now I have to rethink my idea and rewrite my whole file handling/compressing algorithm because of an old, unhandled bug:(( http://www.glbasic.com/forum/index.php?topic=6858.msg55507#msg55507 (http://www.glbasic.com/forum/index.php?topic=6858.msg55507#msg55507)
Moreover, if this is an old bug (or known deficiency), why the shoebox creator doesn't display an error message like "JPG's currently not supported!"?
Title: Re: GETFILE does not work with shoebox
Post by: Ian Price on 2014-Jun-24
Yep. Confirmed.
Title: Re: GETFILE does not work with shoebox
Post by: Schranz0r on 2014-Jun-24
Write youre own method to pack all files and leveldata in one file then crypt it...
Its easy!
Title: Re: GETFILE does not work with shoebox
Post by: adaz on 2014-Jun-25
Quote from: Schranz0r on 2014-Jun-24
Write youre own method to pack all files and leveldata in one file then crypt it...
Its easy!
I's not so easy for me... I has to work on iPhone as well.
Do you have an idea or plan for implementation?
Thanks
Title: Re: GETFILE does not work with shoebox
Post by: spacefractal on 2014-Jun-25
Also a shoebox file is not secure too, they are easy to extract all files on it.