Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Ali on Mon 09/07/2012 13:06:48

Title: Delete / Overwrite save games not working in win 7? [SOLVED]
Post by: Ali on Mon 09/07/2012 13:06:48
Hello,

Perhaps I'm being an idiot, but deleting and overwriting save games doesn't seem to work on win 7. I imagine it must be a permissions issue with the windows save game folder. Deleting save games simply does nothing, but overwiting creates a file named this: agssave.-01 (This is the new save game, not the old one.)

I couldn't find if this is a known issue, is there a way around it?

- Al
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: xerca on Wed 11/07/2012 09:31:30
I'm not really sure about this but did you try to "run as administrator"?
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: FlintMike on Fri 13/07/2012 12:51:38
Did your problem get resolved? How did you get it done?
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: Ali on Sat 14/07/2012 10:43:16
I assumed "Run as Administrator" would fix the problem, but I don't think player should have to run the game as an administrator. Especially since there will be no clear sign this problem exists, it will just look like the game is broken.

It would be particularly annoying if you reached the maximum of 50 save games, because it would become impossible to keep saving after that without running as an administrator or deleting save games, neither of which the player should have to do.

Has any one else had this problem? Can anyone suggest an AGS-side solution?
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: Khris on Sat 14/07/2012 11:38:18
Try using Game.SetSaveGameDirectory("Saves"); (http://www.adventuregamestudio.co.uk/manual/Game.SetSaveGameDirectory.htm).

That will create a folder called "Saves" in the game's dir and put savegames there. I haven't tested it myself, but hopefully there shouldn't be any restrictions that way.
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: Ali on Sat 14/07/2012 12:02:05
I will try that, but I'm not sure it's ideal.

If the game happened to be installed in Program Files, wouldn't that folder be protected in the same way? It would also prevent the game from being played on two accounts (not that this is a terribly likely scenario!).
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: JJS on Sat 14/07/2012 12:17:12
You can only write to the documents and the appdata folder. The program files directory is indeed not writable by an application.
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: Ali on Sat 14/07/2012 13:15:25
That's what I thought. But if the Save Games folder is protected how do other games overwrite and delete saves?
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: cat on Sat 14/07/2012 16:30:35
Which AGS version are you using? I think there were some changes with the early 3.x versions.
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: Crimson Wizard on Sat 14/07/2012 17:59:13
Quote from: JJS on Sat 14/07/2012 12:17:12
You can only write to the documents and the appdata folder. The program files directory is indeed not writable by an application.
Hmm, does not AGS 3.0+ writes there by default?
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: Ali on Sat 14/07/2012 18:22:55
Quote from: cat on Sat 14/07/2012 16:30:35
Which AGS version are you using? I think there were some changes with the early 3.x versions.

Build 3.2.1.111, which I think was the most recent official release. Right?
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: OneDollar on Tue 17/07/2012 20:16:00
Check you've got a "Save games folder name" set in the General Settings? I think this is set by default to the name of your game in AGS 3.2, but if you've updated your game from an older version it might be missing?

In Windows Vista and 7 applications aren't allowed to write to the Program Files or Program Files (x86) folders unless they are started with the 'run as administrator' option. Older versions of AGS (2.x and maybe early 3.x?) used to just put save files in whatever folder you ran the game from, but when Windows introduced this feature this became a problem. AGS changed to create a folder in the user's profile (C:\Users\<username>\Saved Games) with subfolders for each game. I'm guessing if you don't specify a folder name, AGS just tries to put the files in the same folder as the .exe, which as you say causes problem when you're running it from Program Files or another protected location.
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: Ali on Tue 17/07/2012 21:33:52
I changed to a new Save Game folder, just to test. The problem still occurs. I when I try to overwrite agssave.001, it creates a file called agssave.-01 instead.

Is this only happening to me?
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: Crimson Wizard on Tue 17/07/2012 22:37:30
Hmm, okay, I assume this is your game? How do you save the game exactly (script-wise)? Unlikely, but could there be anything wrong with it?
Also does it happen on other systems/computers?
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: OneDollar on Tue 17/07/2012 22:39:33
I can't reproduce the problem. If I save it creates a new file (C:\Users\<my username>\Saved Games\<my game name>\agssave.001). If I save again it overwrites fine. If I change the file permissions on the agssave.001 file so that I don't have rights to edit the file, AGS crashes out when I try and save.

Are you using the built in save game dialogue
Code (AGS) Select
SaveGameDialog(); and does it make a difference if you do?

Two more things that comes to mind at the moment:
1) Do you have anything entered in the "Save game file extension" in the general settings (even a space?)
2) If you right-click and choose properties on the game's .exe file is there anything ticked on the Compatibility tab?
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: Crimson Wizard on Tue 17/07/2012 22:58:15
You know, I could reproduce this if I save slot number -1... don't know if that's anyway related to your problem.
Title: Re: Delete / Overwrite save games not working in win 7?
Post by: Khris on Wed 18/07/2012 00:03:11
That has to be it; assuming AGS adds zeros to get three characters, 1 ends up as 001 and -1 as -01.
Title: Re: Delete / Overwrite save games not working in win 7? [SOLVED]
Post by: Ali on Wed 18/07/2012 21:39:03
Ah! That makes sense... it's definitely my script that's at fault.

But I haven't got it working right yet... I may need to ask for more help soon. Thanks for clearing this up for me!

EDIT: I have it working. What confused me was the fact that the save games appeared in reverse order in the save game list, so the numbers didn't correspond with the save slot numbers. I seem to be able to find the right slot by doing: SaveList.ItemCount - SaveList.SelectedIndex.

Thanks for the help, and for putting up with my theories about folder permissions.