[Scummvm-devel] Porters: Adding seeking to InSaveFile for HE games
kirben at optusnet.com.au
Mon Apr 24 17:50:04 CEST 2006
From: "Max Horn" <max at quendi.de>
> The way to implement this properly (unless I miss something) is roughly
> * You replace _hFileTable by two tables (_hReadFileTable and
> _hWriteFileTable or so), which hold pointers to WriteStreams resp.
> * When opening a file for writing, you use the SaveFileManager API and
> insert the new object into the _hWriteFileTable.
> * When trying to open a file for reading, you first try to open it via
> the SaveFileManager. If that works, insert the returned pointer into
> _hReadFileTable. If that failed, create a File object (via new), and try
> to open the file that way. If that works, insert the returned pointer
> into _hReadFileTable, else get rid of it.
> * When closing files, obviously one has to delete & remove the pointer in
> the corresponding array. Thanks to virtual destructors, no need to worry
> where the stream came from.
Yes, that implementation sounds like it should cover all file access by HE
games. There are currently similar problems when accessing an external
config file by o80_readConfigFile/o80_writeConfigFile too.
This might be a good time, to ask about the possible support of deleting and
renaming save game files too? as this would allow the original load/save
system of HE games to be used.
More information about the Scummvm-devel