Computer shutdown during save

Started by rmonic79, Fri 15/01/2021 11:56:41

Previous topic - Next topic

rmonic79

Guys it happened right now, i have this error right now. Is there any way to restore it?

eri0o

#1
Check if the game directory has a Game.agf.bak file and copy this file somewhere for safety.

Then you can rename the current Game.agf to Game.agf.old and rename Game.agf.bak to Game.agf and try loading again.

always make backups of your game

my guess is you have a corrupted Game.agf but I am not sure if this is the case. Do you have backups of your game?

rmonic79

already did same error, i made a backup yesterday mate, but i'm near release and i did a lot of stuff this morning. So it will be an entire day to restore everything F!"£$ laptop

eri0o

#3
The error should be just on Game.agf, if you can open it on notepad++ or other text editor my guess is it will not be complete. Your scripts you can probably update the code fine by copying and pasting.

You can also try to just use the backup of game.agf with the other files, but it's hard to say. Dialogs are stored in game.agf, so loading the corrupted one in notepad++ may be helpful to find them and be able to restore what has changed in the new one.

There are softwares that can compare text files, like meld, that can be helpful in this situation - load both Game.agf the one that is corrupted and the one from the backup and see what has changed.

I don't particularly remember other XML files in the game project so this is why I guessed the problem is in game.agf from the stack referring a XML reading library.

rmonic79

I'm using beyond compare, but i've imported a lot of file so it will be a pain in the %%ss aniway. Can i see dialogue in game.agf? Cause i made change in them too and i don't remember exactly everything and i can't open them in the editor

Crimson Wizard

Quote from: rmonic79 on Fri 15/01/2021 12:45:10Can i see dialogue in game.agf?

You can search for "<Dialogs>" in Game.agf, this is where they are located in an order.

rmonic79

Good to know Crimson, unfortunately the crashed agf either .bak and normal were empty. Probably shut down on creation of a new ones. By the way i spent all yesterday to mirror a backup so at the end it went good, thanks guys.

Danvzare

Quote from: rmonic79 on Sat 16/01/2021 09:24:51
Good to know Crimson, unfortunately the crashed agf either .bak and normal were empty. Probably shut down on creation of a new ones. By the way i spent all yesterday to mirror a backup so at the end it went good, thanks guys.
Glad to hear you got it sorted out.
It sucks when stuff like this happens, but it does. At least you had a backup for the worst case scenario.

rmonic79

Quote from: Danvzare on Sat 16/01/2021 15:53:16
Quote from: rmonic79 on Sat 16/01/2021 09:24:51
Good to know Crimson, unfortunately the crashed agf either .bak and normal were empty. Probably shut down on creation of a new ones. By the way i spent all yesterday to mirror a backup so at the end it went good, thanks guys.
Glad to hear you got it sorted out.
It sucks when stuff like this happens, but it does. At least you had a backup for the worst case scenario.

Yes the problem this time is that we are less than 10 days from backers distrubution so... every hour counts 😭

morganw

Maybe it is a long shot, but I changed the write of the main XML file to go via a temporary file first. This was to stop it getting damaged during an interrupted write of the actual file, but if the computer turned off then you wouldn't have seen the message boxes to indicate that it was a two stage write (possibly the messages need to be clearer too). But... it makes a temp file using the built-in .NET function:
https://docs.microsoft.com/en-us/dotnet/api/system.io.path.gettempfilename

So try looking in %TEMP% and see if there is a timestamp on a file around the time that you pressed save. It might have a strange name, but it might be your main project file.

Crimson Wizard

Quote from: morganw on Thu 21/01/2021 01:26:14
Maybe it is a long shot, but I changed the write of the main XML file to go via a temporary file first. This was to stop it getting damaged during an interrupted write of the actual file, but if the computer turned off then you wouldn't have seen the message boxes to indicate that it was a two stage write (possibly the messages need to be clearer too). But... it makes a temp file using the built-in .NET function:
https://docs.microsoft.com/en-us/dotnet/api/system.io.path.gettempfilename

So try looking in %TEMP% and see if there is a timestamp on a file around the time that you pressed save. It might have a strange name, but it might be your main project file.

I was not aware, of did not remember this was a thing... and actually opened a ticket after seeing this forum thread: https://github.com/adventuregamestudio/ags/issues/1177
So, that is partially done?

morganw

It didn't have this use case in-mind, it was added for protection against write errors that the OS can handle (like the disk being full). It probably doesn't account for the OS having acknowledged the write but the changes not actually having made it to the disk yet, which is probably the default behaviour for writing to hard disks (because waiting for the sync in all cases would be considered too inefficient and slow).

SMF spam blocked by CleanTalk