[Scummvm-devel] File vs SaveFileManager
Marcus Comstedt
marcus at mc.pp.se
Sun Aug 10 07:20:03 CEST 2003
Mornin'.
Alex Bradbury alerted me to the fact that the simon and sky engines
incorrectly circumvent the system->get_savefile_manager() interface
and do their own savefile handling. The reason that this error could
creep in is that the File interface allows for making files in write
mode, even though File's don't access read/write media on some ports.
It's of course stupid to have two API:s that can do the same thing,
one that works on all platforms and one that doesn't, so we should do
either
A) Remove the write support from File.
pros:
* File class remains simple and clean
cons:
* More work in fixing the simon/sky code, although adding more
functionality to the SaveFile class can take care of most of
it.
or
B) Merge the File and SaveFileManager API:s, so that File can provide
all the services now provided by SaveFileManager, and rewrite the
Scumm Serializer to use File instead.
pros:
* Serializer can now utilize writeUint16BE() etc instead of doing
its own endian conversions
cons:
* File class needs to be made abstract so that the backend can
provide an subclass through a factory method; i.e.
File f;
would _not_ work anymore, since f needs to be a different class
depending on what filename you open().
* Namespace problem needs to be solved on DC
The "namespace problem" refers to finding a suitable "mountpoint"
strategy for accessing both the CD and the memory cards through a
common namespace. I think it would be unwise to "mount" the CD
anywhere else than "/", since that would make the filenames
inconsistenet with what fopen uses. So some kind of overlay mount
using a filename that is not legal in ISO9660 would probably be best.
Actually, before I wrote this post I was slightly in favour of B, but
now that I realize that this would mean that all File objects have to
be created by a factory method, I'm more leaning towards A, in
combination with copying enough functionality from File into SaveFile
to make it just as convenient to use for the actual data I/O.
// Marcus
More information about the Scummvm-devel
mailing list