Hi there !
I’m using XML files to deal with my savegames. The thing is right now, if you manage to get access to the XML file in your systme file, you can actually read and even rewrite some stuff in it.
So, I’m trying to encode the data : it won’t be perfect since people will still probably be able to decode it, but that’s enough.
Without encryption, this is what I was doing :
- In my game, everything is currently saved into a LUA table.
- Everytime I (re)write the save file, the LUA table is converted into a XML structure and saved as a XML file.
- Everytime I load the XML save file, I simply convert it to a LUA table and use it.
Now that I’ve added the encryption, I’ve got this :
- In my game, everything is currently saved in a LUA table.
- Everytime I write the save file, the LUA table is converted to a XML structure, then encrypted and saved as TXT file.
- Everytime I load the TXT save file, I try to decrypt it, convert it to a XML structure and then, convert it as a LUA table in order to use it.
I’m stuck at the 3rd point : Is there a way to actually convert a text string into XML structure without having to save it as an XML file and then loading it again ?
EDIT : If I save the decrypted data into a new temporary XML file, it works, except the data seems to be corrupted like this (looks like some text encoding issue) :
\<?xml version="1.0"?\> ¦¡]:¡ $\_ö(ºl¨üµJ ù¯V¥on\>