Im reading about the possibility of corruption of the save file when turning off the device while the cart is saving.
As simple solution would be.
1. Dont overwrite the existing save file.
2. Save a new file game.tmp.
3. On reboot/reset check for *.tmp files in the save folder, if they exist check they are not corrupt (file size ?).
4. If .tmp is ok then rename to .sav and overwrite old save file.
Another way would be.
1. Dont overwrite the existing save file.
2. Save a new file game.tmp.
3. When save is finished rename .sav file to .old
4. Rename .tmp to .sav
5. Delete .old
This way if the file is corrupt you still loose the latest save but atleast if you have 20 hours play on a game you dont loose everything.
As simple solution would be.
1. Dont overwrite the existing save file.
2. Save a new file game.tmp.
3. On reboot/reset check for *.tmp files in the save folder, if they exist check they are not corrupt (file size ?).
4. If .tmp is ok then rename to .sav and overwrite old save file.
Another way would be.
1. Dont overwrite the existing save file.
2. Save a new file game.tmp.
3. When save is finished rename .sav file to .old
4. Rename .tmp to .sav
5. Delete .old
This way if the file is corrupt you still loose the latest save but atleast if you have 20 hours play on a game you dont loose everything.
Last edited by steelseth,