[Scummvm-devel] PORTERS: Improved file seeking & buffering for free

Max Horn max at quendi.de
Tue Sep 30 18:57:14 CEST 2008


Dear porters,

I just wanted to remind you that some time ago, we added wrapper  
stream classes, namely BufferedReadStream and  
BufferedSeekableReadStream, which are meant to wrap an arbitrary  
(Seekable)ReadStream and endow it with a buffer.

If your porter suffers from slow seek times, or if you have to  
manually implement a file buffer / cache, you may want to look into  
using one of these classes -- maybe you can completely get rid of your  
custom buffering code; or maybe you don't do buffering right now and  
want to. If so, just modify the openForReading() method of your FSNode  
subclass and add the wrapper. If you need details on how to do this,  
ping me and/or ask here.

Alternatively, check out StdioStream::makeFromPath() in backends/fs/ 
stdiostream.cpp, which invokes setvbuf for AmigaOS to set a larger  
default buffer. You may want to add a check for your porter there, and  
doing something similar.


Cheers,
Max




More information about the Scummvm-devel mailing list