View Issue Details

IDProjectCategoryView StatusLast Update
0002682The Dark ModSaving/Loadingpublic12.05.2013 20:07
Reportertels Assigned Totels  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionTDM 1.04 
Target VersionTDM 2.00Fixed in VersionTDM 2.00 
Summary0002682: savegame names with dots overwrite each other
DescriptionSaving under the name "test 1.03" and "test 1.04" means that both save games get written as "test_1.save", and thus the latter save game overwrites the former without warning or error.
TagsNo tags attached.

Activities

stgatilov

stgatilov

12.07.2011 13:49

administrator   ~0003922

All the process from GUI to naming and opening save files is inside Doom3 engine (perhaps someone with knowledge in GUI knows better if any TDM code is executed when the user clicks on save?). gamex86 gets control first time only in idGameLocal::SaveGame when the save file is already opened. So to fix the problem we have to change something in Doom3's behavior.
I can try to set a hook on opening files (idFileSystem::OpenFileWrite), but I don't know what to do in this hook. I can of course rename all the save files in case they already exist. But then user won't be able to overwrite his saves=)
Zbyl

Zbyl

10.02.2013 02:37

reporter   ~0005062

Last edited: 10.02.2013 12:51

View 2 revisions

Reason for this bug is simple. Menu command for save is:
"play sound/meta/menu/mnu_select; saveGame 1 ; close"
Where "1" means "overwrite".

It was ment to overwrite only "the same" save, but it actually overwrites any save whose display name filtered by idSessionLocal::ScrubSaveGameFileName() is equivalent.

Bad, and unused in this case, overwrite check is handled in idSessionLocal::HandleSaveGameMenuCommand(). Overwriting happens in idSessionLocal::SaveGame() - without checking if we're overwriting save with the same displayed name (saveName) or a slightly different one.

Partial and bad solution:
- replace inFileName.StripFileExtension() in ScrubSaveGameFileName() with "remove '.save' from the end"

Complete solution, that won't break current saves:
scrubedName = ScrubSaveGameFileName(saveName)
- from "scrubedName*.save" find filename that is associated with our display name (check all candidates, since there can be gaps in numeration),
- if not found get first free filename "scrubedName<idx>.save",
- make sure that loading can cope with that.

tels

tels

12.05.2013 20:07

reporter   ~0005428

Fixed with revision #5761. Only ".save" is now removed from the string, the result has then special chars replaced by "_".

Empty strings (like ".save" and ".save.save" etc) result in "default".

This minimizes the impact the replacement has.

It is still possible to have filenames clash with "test.1.03" and "test 1.03", which both result in "test_1_03.save" as filename, but it's better than before.

Issue History

Date Modified Username Field Change
07.03.2011 23:08 tels New Issue
11.03.2011 06:21 tels Severity normal => major
12.07.2011 13:49 stgatilov Note Added: 0003922
10.02.2013 02:37 Zbyl Note Added: 0005062
10.02.2013 12:51 Zbyl Note Edited: 0005062 View Revisions
12.05.2013 14:23 tels Assigned To => tels
12.05.2013 14:23 tels Status new => assigned
12.05.2013 19:40 tels Target Version => TDM 2.00
12.05.2013 20:07 tels Note Added: 0005428
12.05.2013 20:07 tels Status assigned => resolved
12.05.2013 20:07 tels Fixed in Version => TDM 2.00
12.05.2013 20:07 tels Resolution open => fixed