Author Topic: Computer shutdown during save  (Read 534 times)

Computer shutdown during save
« on: 15 Jan 2021, 11:56 »
Guys it happened right now, i have this error right now. Is there any way to restore it?

eri0o

Re: Computer shutdown during save
« Reply #1 on: 15 Jan 2021, 12:30 »
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?
« Last Edit: 15 Jan 2021, 12:35 by eri0o »

Re: Computer shutdown during save
« Reply #2 on: 15 Jan 2021, 12:35 »
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

Re: Computer shutdown during save
« Reply #3 on: 15 Jan 2021, 12:40 »
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.
« Last Edit: 15 Jan 2021, 12:42 by eri0o »

Re: Computer shutdown during save
« Reply #4 on: 15 Jan 2021, 12:45 »
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

Re: Computer shutdown during save
« Reply #5 on: 16 Jan 2021, 00:57 »
Can i see dialogue in game.agf?

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

Re: Computer shutdown during save
« Reply #6 on: 16 Jan 2021, 09:24 »
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

  • The Man with No Name
    • I can help with AGS tutoring
    • I can help with proof reading
    • I can help with scripting
    • I can help with voice acting
    • Danvzare worked on one or more games that was nominated for an AGS Award!
Re: Computer shutdown during save
« Reply #7 on: 16 Jan 2021, 15:53 »
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.

Re: Computer shutdown during save
« Reply #8 on: 16 Jan 2021, 16:11 »
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 😭

Re: Computer shutdown during save
« Reply #9 on: 21 Jan 2021, 01:26 »
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.

Re: Computer shutdown during save
« Reply #10 on: 21 Jan 2021, 07:46 »
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?

Re: Computer shutdown during save
« Reply #11 on: 21 Jan 2021, 15:31 »
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).