[Scummvm-devel] PORTERS: (Abstract)FSNode has two new methods

Max Horn max at quendi.de
Wed Sep 3 14:58:00 CEST 2008


Hi everybody, especially you porters,

with this email (part of a series) I want to inform you about some  
changes related to the FSNode code, the class File, and in general how  
we handle files. I will try to describe briefly what changed, why, and  
how we suggest you deal with it.  As always, questions, suggestions,  
wishlists and constructive criticism are welcome :).


CHANGE: There are two new FilesystemNode method:
	virtual Common::SeekableReadStream *openForReading();
	virtual Common::WriteStream *openForWriting();
These, together with Peres work on the new "Archive" class, will  
eventually replace the existing File class. The DefaultSaveFileManager  
already uses this API, so does our config file loading code.
The way these two new methods work right now: They call the  
corresponding methods of AbstractFilesystemNode, which I took the  
liberty to add to *all* FSNode impls (untested -- resulting compile  
errors should be trivial to fix, though, if not, talk to me). Which in  
turn make use of the new StdioStream class (in backends/fs/ 
stdiostream.h), which is a thin wrapper around FILE.

PORTERS TASK: Not all ports support FILE, and some have buggy  
implementations. If so, you should change the openForReading() and  
openForWriting() implementations in your AbstractFilesystemNode class,  
and return a custom Stream subclass instead of StdioStream.

AFFECTED PORTS: ALL -- but especially PS2, DS, Symbian, (more?), which  
already have custom FILE code

RATIONALE: With this change *NO* use of the FILE api should remain for  
ports that don't want it. Just overload the open*() methods, don't  
compile in backends/fs/stdiostream.cpp, and use your own custom class.  
This should considerably ease life for porters on the long run.



Cheers,
Max






More information about the Scummvm-devel mailing list