[Scummvm-devel] Porters: Adding seeking to InSaveFile for HE games

Max Horn max at quendi.de
Sat Apr 22 04:41:02 CEST 2006


Dear porters, dear SCUMM HE folks,


currently, the HE part of the SCUMM engine has to abuse the File API  
(no offense intended) for the _hFileTable (see scumm/he/intern_he.h),  
to implement the file read/write APIs found in the HE games.

The HE engine uses lost of Common::File objects aggregated in  
_hFileTable to allow read/write/seek access to files in the savepath.  
This is not so nice. Much better (i.e. portable) would be to use (In/ 
Out)SaveFiles and the SaveFileManager.

Luckily, files are only opened for either reading or writing, not  
both at once. So I would have already converted the code, but for one  
problem: HE games need to seek in those "save games", which is  
currently not possible.

There are two ways around this: I could simply read the whole file  
into a buffer, and do seeking in there as desired. Much simpler,  
however, would be to change InSaveFile to derive from  
SeekableReadStream instead of ReadStream. For the default save game  
support, that's totally trivial to do. Looking through the savegame  
implementations for DC, PalmOS and PS2, I believe it's rather easy to  
add seeking there, too (but please correct me if I am mistaken here).


So, my plan is to change InSaveGame accordingly and then move the HE  
engine over to use SaveGameManager as it should. I'll implement this  
next weekend, unless somebody objects (or unless all affected porters  
give me a "go" before that :-).

A nice side effect of this is that we can finally get rid of the  
"directory" parameter of Common::File, which has been a thorn in my  
side for some time now.



Cheers,
Max




More information about the Scummvm-devel mailing list