@Blendman
Not sure what you mean by 'interesting', but size and format won't matter with the technique I described involving saving out the memblock first. So it doesn't matter if you're working with PNG or JPG, the system is still the same. It's kind of like precompiling your media to go directly from memblock files to memory using AGK2/S compatible formats. The steps you'll need to do are (it's handy to have a separate app to handle this part whenever you need to rebuild your media into memblock files):
- Load the media file into the required type - LoadImage(1,"MyImage.jpg")
- Convert the media type to a memblock - CreateMemblockFromImage(1,1)
- Encrypt the memblock using your preferred method
- Save the memblock out to a file - CreateFileFromMemblock("MyNewImage.mem",1)
- Clear the memblock after use - DeleteMemblock(1)
- Compress the output file as may be desired to minimize disk overhead - CreateZip(1,"MyNewImage.zip") > AddZipEntry(1,"MyNewImage.mem") > CloseZip(1)
The zipped and encrypted memblock files are now all you need to bundle with your game, just keep the originals elsewhere for safe keeping and future editing. Then to load the media files:
- Unzip the memblock file as needed - ExtractZip("MyNewImage.zip","")
- Load the extracted memblock file from disk - CreateMemblockFromFile(1,"MyNewImage.mem")
- Decrypt the memblock using your preferred method
- Place the memblock into its required media type - CreateImageFromMemblock(1,1)
- Clear the memblock after use - DeleteMemblock(1)
Depending on the overhead of your encryption process, you'll likely find this is a pretty fast way to load protected media directly into memory.