I may be going around this all wrong but basically I wanted to put some light obfuscation on assets.
I have been able to successfully load files, encrypt them, and then save the output (and successfully decrypt them)
however I am having trouble when it comes to loading the files into memory, decrypting them, and then reading the file.
Apologies, it's a bit messy as I'm just trying to figure it out first before I clean it up.
this is the code portion below for handling encrypted images. This assumes the file is already encrypted.
The image variable just becomes NULL at the end and I can't figure out why.
Looking at the documentation [1] of al_open_memfile:
The mode can be any combination of "r" (readable) and "w" (writable).
You pass a "+" as well as a "b" both of which are invalid.
I... okay that uhh... that fixed it by just changing it to "rw"... hmm. I thought it just meant that it would use the same "Mode" identifiers that functions like fopen() used.
Thank you for clarifying that for me. I'm both happy it was something simple and also bashing my face against the desk.
Works perfectly now, and surprisingly fast considering the filesize I was testing this on. Everything decrypts and shows up like I had intended.
Thank you very much!
Yes, I think it would be a good idea allowing "r+" to mean the same as "rw" (the "b" seems to actually be ignored already anyway)... it's how al_fopen works already. Patch welcome I suppose
I usually use;
Not sure if it's relevant to the question, but this is an example of map saving/loading I use.