Comments

Log in with itch.io to leave a comment.

xzip_create doesn't create anything, sandbox is disabled.

When I call the function, game freezes for a second so I guess it's doing something, xzip_create returns the correct path, but there just is no file created.

xzip_exists also returns false when I enter the path I got from xzip_create.

To keep it simple for the test, I just tried to zip projects .yyp file.

Hi, thanks for using  Xzip!

Please keep in mind that even with the filesystem sandbox disabled, GameMaker projects are still subject to Windows filesystem permissions. Most likely, the application does not have permission to access  your project directory. If needed, you  can give GameMaker access to protected locations with the "get_open_filename" or "get_save_filename" functions, then pass the returned file path to Xzip functions.

Xzip does attempt to validate access permissions on its own, but GameMaker can silently redirect filepaths to the sandbox in some cases, so you may not be getting an error if, say, the file is being created under %AppData% instead.

Thanks. As you said, file was being created in project folder in %appdata%. Unfortunately I couldn't make it work outside sandboxed folder, but that not an issue for me right now.

I was just thinking of looking into writing something like this. Is there a way to extract a PNG (or whatever) from a XZip and decode it to a surface (if not I'll still have to look into writing my own version). Basically I want to download an encoded archive with licensed assets and load them into a game - you know, DLC...
I've got as far as downloading assets (un-encrypted) and creating sprites from them but encryption is vital when it comes to keeping to license terms so any assets need decoding - not something I can get GMS2 to do (without writing a PNG extension I guess which seems like re-creating the wheel)

Hi peardox,

Xzip can store any binary formats, including image files, but they would have to be briefly extracted to a temp location and then imported to GameMaker (the temp file could then be deleted).

A more straightforward way would be to use surfaces rather than sprites, then use the xzip_write function to store the image data directly within an archive. The xzip_read function can then fetch the image data without the need for extraction to a temp location first.

Both approaches have their pros and cons, so which is preferable simply depends on the demands of your project.

Temp file storage breaks license terms - particularly as there are undelete utilities.

Surfaces are not a solution here as a 4k x 4k RGBA takes up 67,108,864 bytes and GZ compression won't get that back to PNG sizes (only PNG will do that). 

Guess a decode buffer to surface extension is required...